From dc123a0a37db110bf3d6adcdc5720e06874c21ae Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Tue, 27 Aug 2019 16:51:00 +0200 Subject: [PATCH 001/216] don't send errlog on all logClients --- src/libCom/log/iocLog.c | 14 ++++++++++++++ src/libCom/log/logClient.c | 4 ---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/libCom/log/iocLog.c b/src/libCom/log/iocLog.c index e62da2050..8cb1349a1 100644 --- a/src/libCom/log/iocLog.c +++ b/src/libCom/log/iocLog.c @@ -18,8 +18,10 @@ #define epicsExportSharedSymbols #include "envDefs.h" +#include "errlog.h" #include "logClient.h" #include "iocLog.h" +#include "epicsExit.h" int iocLogDisable = 0; @@ -74,6 +76,14 @@ void epicsShareAPI epicsShareAPI iocLogFlush (void) } } +/* + * logClientDestroy() + */ +static void iocLogClientDestroy (logClientId id) +{ + errlogRemoveListeners (logClientSendMessage, id); +} + /* * iocLogClientInit() */ @@ -89,6 +99,10 @@ static logClientId iocLogClientInit (void) return NULL; } id = logClientCreate (addr, port); + if (id != NULL) { + errlogAddListener (logClientSendMessage, id); + epicsAtExit (iocLogClientDestroy, id); + } return id; } diff --git a/src/libCom/log/logClient.c b/src/libCom/log/logClient.c index 99ee671d9..b076d50cb 100644 --- a/src/libCom/log/logClient.c +++ b/src/libCom/log/logClient.c @@ -154,8 +154,6 @@ static void logClientDestroy (logClientId id) return; } - errlogRemoveListeners ( logClientSendMessage, (void *) pClient ); - logClientClose ( pClient ); epicsMutexDestroy ( pClient->mutex ); @@ -549,8 +547,6 @@ logClientId epicsShareAPI logClientCreate ( pClient->name, LOG_SERVER_CREATE_CONNECT_SYNC_TIMEOUT ); } - errlogAddListener ( logClientSendMessage, (void *) pClient ); - return (void *) pClient; } From 74a403090b31b2b68283ea08cfe54c113b6a62f9 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Tue, 27 Aug 2019 17:34:01 +0200 Subject: [PATCH 002/216] speed up logRestart thread termination at exit --- src/libCom/log/logClient.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/libCom/log/logClient.c b/src/libCom/log/logClient.c index b076d50cb..96382a2eb 100644 --- a/src/libCom/log/logClient.c +++ b/src/libCom/log/logClient.c @@ -44,6 +44,7 @@ typedef struct { SOCKET sock; epicsThreadId restartThreadId; epicsEventId stateChangeNotify; + epicsEventId shutdownNotify; unsigned connectCount; unsigned nextMsgIndex; unsigned connected; @@ -113,6 +114,7 @@ static void logClientDestroy (logClientId id) epicsMutexMustLock ( pClient->mutex ); pClient->shutdown = 1u; epicsMutexUnlock ( pClient->mutex ); + epicsEventSignal ( pClient->shutdownNotify ); /* unblock log client thread blocking in send() or connect() */ interruptInfo = @@ -157,8 +159,8 @@ static void logClientDestroy (logClientId id) logClientClose ( pClient ); epicsMutexDestroy ( pClient->mutex ); - epicsEventDestroy ( pClient->stateChangeNotify ); + epicsEventDestroy ( pClient->shutdownNotify ); free ( pClient ); } @@ -461,8 +463,8 @@ static void logClientRestart ( logClientId id ) else { logClientConnect ( pClient ); } - - epicsThreadSleep ( LOG_RESTART_DELAY ); + + epicsEventWaitWithTimeout ( pClient->shutdownNotify, LOG_RESTART_DELAY); epicsMutexMustLock ( pClient->mutex ); } @@ -505,14 +507,22 @@ logClientId epicsShareAPI logClientCreate ( pClient->shutdownConfirm = 0; epicsAtExit (logClientDestroy, (void*) pClient); - + pClient->stateChangeNotify = epicsEventCreate (epicsEventEmpty); if ( ! pClient->stateChangeNotify ) { epicsMutexDestroy ( pClient->mutex ); free ( pClient ); return NULL; } - + + pClient->shutdownNotify = epicsEventCreate (epicsEventEmpty); + if ( ! pClient->shutdownNotify ) { + epicsMutexDestroy ( pClient->mutex ); + epicsEventDestroy ( pClient->stateChangeNotify ); + free ( pClient ); + return NULL; + } + pClient->restartThreadId = epicsThreadCreate ( "logRestart", epicsThreadPriorityLow, epicsThreadGetStackSize(epicsThreadStackSmall), @@ -520,6 +530,7 @@ logClientId epicsShareAPI logClientCreate ( if ( pClient->restartThreadId == NULL ) { epicsMutexDestroy ( pClient->mutex ); epicsEventDestroy ( pClient->stateChangeNotify ); + epicsEventDestroy ( pClient->shutdownNotify ); free (pClient); fprintf(stderr, "log client: unable to start log client connection watch dog thread\n"); return NULL; From cf2658be5329f90f997be8ea8548d3b5a7188c60 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Wed, 28 Aug 2019 09:29:57 +0200 Subject: [PATCH 003/216] do not discard unsent messages when log server has closed connection, instead try to send them after reconnect --- src/libCom/log/logClient.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/libCom/log/logClient.c b/src/libCom/log/logClient.c index 96382a2eb..75984404c 100644 --- a/src/libCom/log/logClient.c +++ b/src/libCom/log/logClient.c @@ -85,8 +85,6 @@ static void logClientClose ( logClient *pClient ) pClient->sock = INVALID_SOCKET; } - pClient->nextMsgIndex = 0u; - memset ( pClient->msgBuf, '\0', sizeof ( pClient->msgBuf ) ); pClient->connected = 0u; /* From 06f1a8ec23cba2f47568879fd1c0ae8665935c1b Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Wed, 28 Aug 2019 11:41:12 +0200 Subject: [PATCH 004/216] elimitate duplicate code in logClient --- src/libCom/log/logClient.c | 62 +++++++++----------------------------- 1 file changed, 14 insertions(+), 48 deletions(-) diff --git a/src/libCom/log/logClient.c b/src/libCom/log/logClient.c index 75984404c..90fde98b5 100644 --- a/src/libCom/log/logClient.c +++ b/src/libCom/log/logClient.c @@ -174,57 +174,23 @@ static void sendMessageChunk(logClient * pClient, const char * message) { unsigned msgBufBytesLeft = sizeof ( pClient->msgBuf ) - pClient->nextMsgIndex; - if ( strSize > msgBufBytesLeft ) { - int status; - - if ( ! pClient->connected ) { - break; - } - - if ( msgBufBytesLeft > 0u ) { - memcpy ( & pClient->msgBuf[pClient->nextMsgIndex], - message, msgBufBytesLeft ); - pClient->nextMsgIndex += msgBufBytesLeft; - strSize -= msgBufBytesLeft; - message += msgBufBytesLeft; - } - - status = send ( pClient->sock, pClient->msgBuf, - pClient->nextMsgIndex, 0 ); - if ( status > 0 ) { - unsigned nSent = (unsigned) status; - if ( nSent < pClient->nextMsgIndex ) { - unsigned newNextMsgIndex = pClient->nextMsgIndex - nSent; - memmove ( pClient->msgBuf, & pClient->msgBuf[nSent], - newNextMsgIndex ); - pClient->nextMsgIndex = newNextMsgIndex; - } - else { - pClient->nextMsgIndex = 0u; - } - } - else { - if ( ! pClient->shutdown ) { - char sockErrBuf[64]; - if ( status ) { - epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - } - else { - strcpy ( sockErrBuf, "server initiated disconnect" ); - } - fprintf ( stderr, "log client: lost contact with log server at \"%s\" because \"%s\"\n", - pClient->name, sockErrBuf ); - } - logClientClose ( pClient ); - break; - } + if ( msgBufBytesLeft < strSize && pClient->nextMsgIndex != 0u && pClient->connected) + { + /* buffer is full, thus flush it */ + logClientFlush ( pClient ); + msgBufBytesLeft = sizeof ( pClient->msgBuf ) - pClient->nextMsgIndex; } - else { - memcpy ( & pClient->msgBuf[pClient->nextMsgIndex], - message, strSize ); - pClient->nextMsgIndex += strSize; + if ( msgBufBytesLeft == 0u ) { + fprintf ( stderr, "log client: messages to \"%s\" are lost\n", + pClient->name ); break; } + if ( msgBufBytesLeft > strSize) msgBufBytesLeft = strSize; + memcpy ( & pClient->msgBuf[pClient->nextMsgIndex], + message, msgBufBytesLeft ); + pClient->nextMsgIndex += msgBufBytesLeft; + strSize -= msgBufBytesLeft; + message += msgBufBytesLeft; } } From e000ea491360ae681a42e9f479c65c6ef406f4f1 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Wed, 28 Aug 2019 15:15:19 +0200 Subject: [PATCH 005/216] avoid needless memmove calls --- src/libCom/log/logClient.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/libCom/log/logClient.c b/src/libCom/log/logClient.c index 90fde98b5..203f29dd3 100644 --- a/src/libCom/log/logClient.c +++ b/src/libCom/log/logClient.c @@ -219,6 +219,8 @@ void epicsShareAPI logClientSend ( logClientId id, const char * message ) void epicsShareAPI logClientFlush ( logClientId id ) { + unsigned nSent = 0u; + logClient * pClient = ( logClient * ) id; if ( ! pClient ) { @@ -227,20 +229,11 @@ void epicsShareAPI logClientFlush ( logClientId id ) epicsMutexMustLock ( pClient->mutex ); - while ( pClient->nextMsgIndex && pClient->connected ) { - int status = send ( pClient->sock, pClient->msgBuf, - pClient->nextMsgIndex, 0 ); + while ( nSent < pClient->nextMsgIndex && pClient->connected ) { + int status = send ( pClient->sock, pClient->msgBuf + nSent, + pClient->nextMsgIndex - nSent, 0 ); if ( status > 0 ) { - unsigned nSent = (unsigned) status; - if ( nSent < pClient->nextMsgIndex ) { - unsigned newNextMsgIndex = pClient->nextMsgIndex - nSent; - memmove ( pClient->msgBuf, & pClient->msgBuf[nSent], - newNextMsgIndex ); - pClient->nextMsgIndex = newNextMsgIndex; - } - else { - pClient->nextMsgIndex = 0u; - } + nSent += (unsigned) status; } else { if ( ! pClient->shutdown ) { @@ -258,6 +251,11 @@ void epicsShareAPI logClientFlush ( logClientId id ) break; } } + pClient->nextMsgIndex -= nSent; + if ( nSent > 0 && pClient->nextMsgIndex > 0 ) { + memmove ( pClient->msgBuf, & pClient->msgBuf[nSent], + pClient->nextMsgIndex ); + } epicsMutexUnlock ( pClient->mutex ); } From 1b88e834d6b4468758b02cacf76ea48287306e1c Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Wed, 28 Aug 2019 15:23:00 +0200 Subject: [PATCH 006/216] send pending log messages directly after connecting --- src/libCom/log/logClient.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/libCom/log/logClient.c b/src/libCom/log/logClient.c index 203f29dd3..743910fb8 100644 --- a/src/libCom/log/logClient.c +++ b/src/libCom/log/logClient.c @@ -223,7 +223,7 @@ void epicsShareAPI logClientFlush ( logClientId id ) logClient * pClient = ( logClient * ) id; - if ( ! pClient ) { + if ( ! pClient || ! pClient->connected ) { return; } @@ -419,12 +419,8 @@ static void logClientRestart ( logClientId id ) epicsMutexUnlock ( pClient->mutex ); - if ( isConn ) { - logClientFlush ( pClient ); - } - else { - logClientConnect ( pClient ); - } + if ( ! isConn ) logClientConnect ( pClient ); + logClientFlush ( pClient ); epicsEventWaitWithTimeout ( pClient->shutdownNotify, LOG_RESTART_DELAY); From ad861a06177d6900b6ede951af0ee6bd5796d400 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Wed, 28 Aug 2019 15:29:23 +0200 Subject: [PATCH 007/216] no need to delay startup only because log server is currently not available --- src/libCom/log/logClient.c | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/src/libCom/log/logClient.c b/src/libCom/log/logClient.c index 743910fb8..72a2e1364 100644 --- a/src/libCom/log/logClient.c +++ b/src/libCom/log/logClient.c @@ -54,7 +54,6 @@ typedef struct { } logClient; static const double LOG_RESTART_DELAY = 5.0; /* sec */ -static const double LOG_SERVER_CREATE_CONNECT_SYNC_TIMEOUT = 5.0; /* sec */ static const double LOG_SERVER_SHUTDOWN_TIMEOUT = 30.0; /* sec */ /* @@ -438,9 +437,7 @@ static void logClientRestart ( logClientId id ) logClientId epicsShareAPI logClientCreate ( struct in_addr server_addr, unsigned short server_port) { - epicsTimeStamp begin, current; logClient *pClient; - double diff; pClient = calloc (1, sizeof (*pClient)); if (pClient==NULL) { @@ -494,28 +491,6 @@ logClientId epicsShareAPI logClientCreate ( return NULL; } - /* - * attempt to synchronize with circuit connect - */ - epicsTimeGetCurrent ( & begin ); - epicsMutexMustLock ( pClient->mutex ); - do { - epicsMutexUnlock ( pClient->mutex ); - epicsEventWaitWithTimeout ( - pClient->stateChangeNotify, - LOG_SERVER_CREATE_CONNECT_SYNC_TIMEOUT / 10.0 ); - epicsTimeGetCurrent ( & current ); - diff = epicsTimeDiffInSeconds ( & current, & begin ); - epicsMutexMustLock ( pClient->mutex ); - } - while ( ! pClient->connected && diff < LOG_SERVER_CREATE_CONNECT_SYNC_TIMEOUT ); - epicsMutexUnlock ( pClient->mutex ); - - if ( ! pClient->connected ) { - fprintf (stderr, "log client create: timed out synchronizing with circuit connect to \"%s\" after %.1f seconds\n", - pClient->name, LOG_SERVER_CREATE_CONNECT_SYNC_TIMEOUT ); - } - return (void *) pClient; } From af73e4cf6547cdd65c858d48ac0114e6235606c5 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Tue, 17 Sep 2019 11:59:02 +0200 Subject: [PATCH 008/216] removed unneeded include --- src/libCom/log/logClient.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libCom/log/logClient.c b/src/libCom/log/logClient.c index 72a2e1364..723f5d4be 100644 --- a/src/libCom/log/logClient.c +++ b/src/libCom/log/logClient.c @@ -25,7 +25,6 @@ #include "dbDefs.h" #include "epicsEvent.h" #include "iocLog.h" -#include "errlog.h" #include "epicsMutex.h" #include "epicsThread.h" #include "epicsTime.h" From 9d9840ad1ee58777ba234d29a524f7921f398111 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Tue, 17 Sep 2019 14:39:03 +0200 Subject: [PATCH 009/216] improve logClientShow to show unsent bytes on level 2 (and fix level 1) --- src/libCom/log/logClient.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/libCom/log/logClient.c b/src/libCom/log/logClient.c index 723f5d4be..9b9e039b1 100644 --- a/src/libCom/log/logClient.c +++ b/src/libCom/log/logClient.c @@ -507,14 +507,21 @@ void epicsShareAPI logClientShow (logClientId id, unsigned level) printf ("log client: disconnected from log server at \"%s\"\n", pClient->name); } - if (level>1) { - printf ("log client: sock=%s, connect cycles = %u\n", + if (logClientPrefix) { + printf ("log client: prefix is \"%s\"\n", logClientPrefix); + } + + if (level>0) { + printf ("log client: sock %s, connect cycles = %u\n", pClient->sock==INVALID_SOCKET?"INVALID":"OK", pClient->connectCount); } - - if (logClientPrefix) { - printf ("log client: prefix is \"%s\"\n", logClientPrefix); + if (level>1) { + printf ("log client: %u bytes in buffer\n", pClient->nextMsgIndex); + if (pClient->nextMsgIndex) + printf("-------------------------\n" + "%.*s-------------------------\n", + (int)(pClient->nextMsgIndex), pClient->msgBuf); } } From feb1f9b0df689915d77ce6c8c7a00b0f19e111d7 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Tue, 17 Sep 2019 14:41:35 +0200 Subject: [PATCH 010/216] increase error message buffer size for long (Windows) error messges --- src/libCom/log/logClient.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libCom/log/logClient.c b/src/libCom/log/logClient.c index 9b9e039b1..3defa6baf 100644 --- a/src/libCom/log/logClient.c +++ b/src/libCom/log/logClient.c @@ -235,7 +235,7 @@ void epicsShareAPI logClientFlush ( logClientId id ) } else { if ( ! pClient->shutdown ) { - char sockErrBuf[64]; + char sockErrBuf[128]; if ( status ) { epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); } @@ -274,7 +274,7 @@ static void logClientMakeSock (logClient *pClient) */ pClient->sock = epicsSocketCreate ( AF_INET, SOCK_STREAM, 0 ); if ( pClient->sock == INVALID_SOCKET ) { - char sockErrBuf[64]; + char sockErrBuf[128]; epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); fprintf ( stderr, "log client: no socket error %s\n", @@ -326,7 +326,7 @@ static void logClientConnect (logClient *pClient) } else { if ( pClient->connFailStatus != errnoCpy && ! pClient->shutdown ) { - char sockErrBuf[64]; + char sockErrBuf[128]; epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); fprintf (stderr, @@ -352,7 +352,7 @@ static void logClientConnect (logClient *pClient) optval = TRUE; status = setsockopt (pClient->sock, SOL_SOCKET, SO_KEEPALIVE, (char *)&optval, sizeof(optval)); if (status<0) { - char sockErrBuf[64]; + char sockErrBuf[128]; epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); fprintf (stderr, "log client: unable to enable keepalive option because \"%s\"\n", sockErrBuf); @@ -364,7 +364,7 @@ static void logClientConnect (logClient *pClient) */ status = shutdown (pClient->sock, SHUT_RD); if (status < 0) { - char sockErrBuf[64]; + char sockErrBuf[128]; epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); fprintf (stderr, "%s:%d shutdown(%d,SHUT_RD) error was \"%s\"\n", @@ -385,7 +385,7 @@ static void logClientConnect (logClient *pClient) lingerval.l_linger = 60*5; status = setsockopt (pClient->sock, SOL_SOCKET, SO_LINGER, (char *) &lingerval, sizeof(lingerval)); if (status<0) { - char sockErrBuf[64]; + char sockErrBuf[128]; epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); fprintf (stderr, "log client: unable to set linger options because \"%s\"\n", sockErrBuf); From 059c3852862ea9fa454c0b8be010b651cddbdd8f Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Tue, 17 Sep 2019 17:06:55 +0200 Subject: [PATCH 011/216] use dynamic debug flag for logClient --- src/ioc/misc/dbCore.dbd | 3 +++ src/libCom/log/logClient.c | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/ioc/misc/dbCore.dbd b/src/ioc/misc/dbCore.dbd index 9d5ae9474..898bb5954 100644 --- a/src/ioc/misc/dbCore.dbd +++ b/src/ioc/misc/dbCore.dbd @@ -25,3 +25,6 @@ variable(callbackParallelThreadsDefault,int) # Real-time operation variable(dbThreadRealtimeLock,int) + +# show logClient network activity +variable(logClientDebug,int) diff --git a/src/libCom/log/logClient.c b/src/libCom/log/logClient.c index 3defa6baf..19d79b617 100644 --- a/src/libCom/log/logClient.c +++ b/src/libCom/log/logClient.c @@ -21,7 +21,6 @@ #include #include -#define epicsExportSharedSymbols #include "dbDefs.h" #include "epicsEvent.h" #include "iocLog.h" @@ -32,9 +31,13 @@ #include "epicsAssert.h" #include "epicsExit.h" #include "epicsSignal.h" +#include "epicsExport.h" #include "logClient.h" +int logClientDebug = 0; +epicsExportAddress (int, logClientDebug); + typedef struct { char msgBuf[0x4000]; struct sockaddr_in addr; @@ -65,10 +68,10 @@ static char* logClientPrefix = NULL; */ static void logClientClose ( logClient *pClient ) { -# ifdef DEBUG + if (logClientDebug) { fprintf (stderr, "log client: lingering for connection close..."); fflush (stderr); -# endif + } /* * mutex on @@ -90,9 +93,8 @@ static void logClientClose ( logClient *pClient ) */ epicsMutexUnlock (pClient->mutex); -# ifdef DEBUG + if (logClientDebug) fprintf (stderr, "done\n"); -# endif } /* @@ -262,10 +264,10 @@ void epicsShareAPI logClientFlush ( logClientId id ) */ static void logClientMakeSock (logClient *pClient) { - -# ifdef DEBUG + if (logClientDebug) { fprintf (stderr, "log client: creating socket..."); -# endif + fflush (stderr); + } epicsMutexMustLock (pClient->mutex); @@ -283,10 +285,8 @@ static void logClientMakeSock (logClient *pClient) epicsMutexUnlock (pClient->mutex); -# ifdef DEBUG + if (logClientDebug) fprintf (stderr, "done\n"); -# endif - } /* From 765af2efead9c0758929e69cfe42d242a6948400 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Tue, 17 Sep 2019 17:34:16 +0200 Subject: [PATCH 012/216] ask logClient socket how many bytes are still in the send queue and don't discard them in case the connection turns out broken. --- src/libCom/log/logClient.c | 83 +++++++++++++++++++++++++++----------- 1 file changed, 59 insertions(+), 24 deletions(-) diff --git a/src/libCom/log/logClient.c b/src/libCom/log/logClient.c index 19d79b617..44eaf7dab 100644 --- a/src/libCom/log/logClient.c +++ b/src/libCom/log/logClient.c @@ -49,6 +49,7 @@ typedef struct { epicsEventId shutdownNotify; unsigned connectCount; unsigned nextMsgIndex; + unsigned backlog; unsigned connected; unsigned shutdown; unsigned shutdownConfirm; @@ -194,6 +195,39 @@ static void sendMessageChunk(logClient * pClient, const char * message) { } } +/* + * epicsSockCountUnsentBytes () + * Should go to osd socket support + */ +#if defined (_WIN32) && WINVER >= _WIN32_WINNT_WIN10 +#include +#endif + +static int epicsSockCountUnsentBytes(SOCKET sock) { +#if defined (_WIN32) && WINVER >= _WIN32_WINNT_WIN10 +/* Windows 10 Version 1703 / Server 2016 */ +/* https://docs.microsoft.com/en-us/windows/win32/api/mstcpip/ns-mstcpip-tcp_info_v0 */ + DWORD infoVersion = 0, bytesReturned; + TCP_INFO_v0 tcpInfo; + int status; + if ((status = WSAIoctl(sock, SIO_TCP_INFO, &infoVersion, sizeof(infoVersion), + &tcpInfo, sizeof(tcpInfo), &bytesReturned, NULL, NULL)) == 0) + return tcpInfo.BytesInFlight; +#elif defined (SO_NWRITE) +/* macOS / iOS */ +/* https://www.unix.com/man-page/osx/2/setsockopt/ */ + int unsent; + if (getsockopt(sock, SOL_SOCKET, SO_NWRITE, &unsent) == 0) + return unsent; +#elif defined (TIOCOUTQ) +/* Linux */ +/* https://linux.die.net/man/7/tcp */ + int unsent; + if (ioctl(sock, TIOCOUTQ, &unsent) == 0) + return unsent; +#endif + return 0; +} /* * logClientSend () @@ -219,7 +253,8 @@ void epicsShareAPI logClientSend ( logClientId id, const char * message ) void epicsShareAPI logClientFlush ( logClientId id ) { - unsigned nSent = 0u; + unsigned nSent; + int status = 0; logClient * pClient = ( logClient * ) id; @@ -229,32 +264,32 @@ void epicsShareAPI logClientFlush ( logClientId id ) epicsMutexMustLock ( pClient->mutex ); + nSent = pClient->backlog; while ( nSent < pClient->nextMsgIndex && pClient->connected ) { - int status = send ( pClient->sock, pClient->msgBuf + nSent, + status = send ( pClient->sock, pClient->msgBuf + nSent, pClient->nextMsgIndex - nSent, 0 ); - if ( status > 0 ) { - nSent += (unsigned) status; - } - else { - if ( ! pClient->shutdown ) { - char sockErrBuf[128]; - if ( status ) { - epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - } - else { - strcpy ( sockErrBuf, "server initiated disconnect" ); - } - fprintf ( stderr, "log client: lost contact with log server at \"%s\" because \"%s\"\n", - pClient->name, sockErrBuf ); - } - logClientClose ( pClient ); - break; - } + if ( status < 0 ) break; + nSent += status; } - pClient->nextMsgIndex -= nSent; - if ( nSent > 0 && pClient->nextMsgIndex > 0 ) { - memmove ( pClient->msgBuf, & pClient->msgBuf[nSent], - pClient->nextMsgIndex ); + + if ( status < 0 ) { + if ( ! pClient->shutdown ) { + char sockErrBuf[128]; + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); + fprintf ( stderr, "log client: lost contact with log server at \"%s\" because \"%s\"\n", + pClient->name, sockErrBuf ); + } + pClient->backlog = 0; + logClientClose ( pClient ); + } + else if ( nSent > 0 && pClient->nextMsgIndex > 0 ) { + pClient->backlog = epicsSockCountUnsentBytes ( pClient->sock ); + nSent -= pClient->backlog; + if ( nSent > 0 ) { + memmove ( pClient->msgBuf, & pClient->msgBuf[nSent], + pClient->nextMsgIndex ); + pClient->nextMsgIndex -= nSent; + } } epicsMutexUnlock ( pClient->mutex ); } From 9c18ce007a67800528b927eeaae480a9d50da330 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Tue, 17 Sep 2019 17:45:33 +0200 Subject: [PATCH 013/216] cannot print sockets with %d in Windows, they are not small ints but maybe pointers. --- src/libCom/log/logClient.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libCom/log/logClient.c b/src/libCom/log/logClient.c index 44eaf7dab..762703417 100644 --- a/src/libCom/log/logClient.c +++ b/src/libCom/log/logClient.c @@ -402,8 +402,8 @@ static void logClientConnect (logClient *pClient) char sockErrBuf[128]; epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - fprintf (stderr, "%s:%d shutdown(%d,SHUT_RD) error was \"%s\"\n", - __FILE__, __LINE__, pClient->sock, sockErrBuf); + fprintf (stderr, "%s:%d shutdown(sock,SHUT_RD) error was \"%s\"\n", + __FILE__, __LINE__, sockErrBuf); /* not fatal (although it shouldn't happen) */ } From 15f28f11834f188c3708f2652f821f98139e7946 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Wed, 18 Sep 2019 09:58:28 +0200 Subject: [PATCH 014/216] sending 0 bytes helps to detect broken connections on some systems (but is undefined behavior on Linux, fails on vxWorks and is a documented no-op on Windows) --- src/libCom/log/logClient.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/libCom/log/logClient.c b/src/libCom/log/logClient.c index 762703417..6671d2785 100644 --- a/src/libCom/log/logClient.c +++ b/src/libCom/log/logClient.c @@ -272,6 +272,15 @@ void epicsShareAPI logClientFlush ( logClientId id ) nSent += status; } + if ( pClient->backlog > 0 && status >= 0 ) + { + /* On Linux send 0 bytes can detect EPIPE */ + /* NOOP on Windows, fails on vxWorks */ + errno = 0; + status = send ( pClient->sock, NULL, 0, 0 ); + if (!(errno == ECONNRESET || errno == EPIPE)) status = 0; + } + if ( status < 0 ) { if ( ! pClient->shutdown ) { char sockErrBuf[128]; From a16ce877e7b7991efc8c52787199b1a5e0bf178e Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Thu, 19 Sep 2019 08:54:19 +0200 Subject: [PATCH 015/216] fix wrong function name in comment --- src/libCom/log/iocLog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libCom/log/iocLog.c b/src/libCom/log/iocLog.c index 8cb1349a1..c0fa33fa6 100644 --- a/src/libCom/log/iocLog.c +++ b/src/libCom/log/iocLog.c @@ -77,7 +77,7 @@ void epicsShareAPI epicsShareAPI iocLogFlush (void) } /* - * logClientDestroy() + * iocLogClientDestroy() */ static void iocLogClientDestroy (logClientId id) { From 04e752c83aa863dbee5b3d4ccc2fcab62e465c00 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Thu, 19 Sep 2019 10:44:36 +0200 Subject: [PATCH 016/216] moved logClientSendMessage and made it static --- src/libCom/log/iocLog.c | 11 +++++++++++ src/libCom/log/logClient.c | 10 ---------- src/libCom/log/logClient.h | 1 - 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/libCom/log/iocLog.c b/src/libCom/log/iocLog.c index c0fa33fa6..ba78041c8 100644 --- a/src/libCom/log/iocLog.c +++ b/src/libCom/log/iocLog.c @@ -76,6 +76,16 @@ void epicsShareAPI epicsShareAPI iocLogFlush (void) } } +/* + * logClientSendMessage () + */ +static void logClientSendMessage ( logClientId id, const char * message ) +{ + if ( !iocLogDisable ) { + logClientSend (id, message); + } +} + /* * iocLogClientDestroy() */ @@ -149,3 +159,4 @@ logClientId epicsShareAPI logClientInit (void) { return iocLogClientInit (); } + diff --git a/src/libCom/log/logClient.c b/src/libCom/log/logClient.c index 6671d2785..cd832b60c 100644 --- a/src/libCom/log/logClient.c +++ b/src/libCom/log/logClient.c @@ -569,16 +569,6 @@ void epicsShareAPI logClientShow (logClientId id, unsigned level) } } -/* - * logClientSendMessage (); deprecated - */ -void logClientSendMessage ( logClientId id, const char * message ) -{ - if ( !iocLogDisable ) { - logClientSend (id, message); - } -} - /* * iocLogPrefix() */ diff --git a/src/libCom/log/logClient.h b/src/libCom/log/logClient.h index 1797bbb20..3b3f63add 100644 --- a/src/libCom/log/logClient.h +++ b/src/libCom/log/logClient.h @@ -38,7 +38,6 @@ epicsShareFunc void epicsShareAPI iocLogPrefix(const char* prefix); /* deprecated interface; retained for backward compatibility */ /* note: implementations are in iocLog.c, not logClient.c */ epicsShareFunc logClientId epicsShareAPI logClientInit (void); -epicsShareFunc void logClientSendMessage (logClientId id, const char *message); #ifdef __cplusplus } From a5c9db8c8eeb819144d35263263c043d487bd916 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Thu, 19 Sep 2019 10:48:14 +0200 Subject: [PATCH 017/216] epicsSockCountUnsentBytes renamed to epicsSocketCountUnsentBytes --- src/libCom/log/logClient.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libCom/log/logClient.c b/src/libCom/log/logClient.c index cd832b60c..28b933e02 100644 --- a/src/libCom/log/logClient.c +++ b/src/libCom/log/logClient.c @@ -196,14 +196,14 @@ static void sendMessageChunk(logClient * pClient, const char * message) { } /* - * epicsSockCountUnsentBytes () + * epicsSocketCountUnsentBytes () * Should go to osd socket support */ #if defined (_WIN32) && WINVER >= _WIN32_WINNT_WIN10 #include #endif -static int epicsSockCountUnsentBytes(SOCKET sock) { +static int epicsSocketCountUnsentBytes(SOCKET sock) { #if defined (_WIN32) && WINVER >= _WIN32_WINNT_WIN10 /* Windows 10 Version 1703 / Server 2016 */ /* https://docs.microsoft.com/en-us/windows/win32/api/mstcpip/ns-mstcpip-tcp_info_v0 */ @@ -292,7 +292,7 @@ void epicsShareAPI logClientFlush ( logClientId id ) logClientClose ( pClient ); } else if ( nSent > 0 && pClient->nextMsgIndex > 0 ) { - pClient->backlog = epicsSockCountUnsentBytes ( pClient->sock ); + pClient->backlog = epicsSocketCountUnsentBytes ( pClient->sock ); nSent -= pClient->backlog; if ( nSent > 0 ) { memmove ( pClient->msgBuf, & pClient->msgBuf[nSent], From 62fb49f93b3e5782eb7ad9c6196499c8e377f30e Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Thu, 19 Sep 2019 11:42:04 +0200 Subject: [PATCH 018/216] bugfix: memmove'ed to much --- src/libCom/log/logClient.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libCom/log/logClient.c b/src/libCom/log/logClient.c index 28b933e02..4e647bd83 100644 --- a/src/libCom/log/logClient.c +++ b/src/libCom/log/logClient.c @@ -294,10 +294,10 @@ void epicsShareAPI logClientFlush ( logClientId id ) else if ( nSent > 0 && pClient->nextMsgIndex > 0 ) { pClient->backlog = epicsSocketCountUnsentBytes ( pClient->sock ); nSent -= pClient->backlog; - if ( nSent > 0 ) { + pClient->nextMsgIndex -= nSent; + if ( nSent > 0 && pClient->nextMsgIndex > 0 ) { memmove ( pClient->msgBuf, & pClient->msgBuf[nSent], pClient->nextMsgIndex ); - pClient->nextMsgIndex -= nSent; } } epicsMutexUnlock ( pClient->mutex ); From eb8992a750d9b9d9ff4dd4e66835d01972fc2999 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Thu, 19 Sep 2019 12:08:45 +0200 Subject: [PATCH 019/216] epicsSocketCountUnsentBytes returns -1 on failure --- src/libCom/log/logClient.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/libCom/log/logClient.c b/src/libCom/log/logClient.c index 4e647bd83..476634c5f 100644 --- a/src/libCom/log/logClient.c +++ b/src/libCom/log/logClient.c @@ -226,7 +226,7 @@ static int epicsSocketCountUnsentBytes(SOCKET sock) { if (ioctl(sock, TIOCOUTQ, &unsent) == 0) return unsent; #endif - return 0; + return -1; } /* @@ -292,8 +292,11 @@ void epicsShareAPI logClientFlush ( logClientId id ) logClientClose ( pClient ); } else if ( nSent > 0 && pClient->nextMsgIndex > 0 ) { - pClient->backlog = epicsSocketCountUnsentBytes ( pClient->sock ); - nSent -= pClient->backlog; + int backlog = epicsSocketCountUnsentBytes ( pClient->sock ); + if (backlog >= 0) { + pClient->backlog = backlog; + nSent -= backlog; + } pClient->nextMsgIndex -= nSent; if ( nSent > 0 && pClient->nextMsgIndex > 0 ) { memmove ( pClient->msgBuf, & pClient->msgBuf[nSent], From 39e8ccdef4d7d569e77fdfb465a0c151604ba703 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Mon, 23 Sep 2019 10:54:17 +0200 Subject: [PATCH 020/216] fix bug from commit f85454. Apparently epicsExportSharedSymbols is needed even though epicsExport.h is included --- src/libCom/log/logClient.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libCom/log/logClient.c b/src/libCom/log/logClient.c index 476634c5f..ee92c27c4 100644 --- a/src/libCom/log/logClient.c +++ b/src/libCom/log/logClient.c @@ -21,6 +21,7 @@ #include #include +#define epicsExportSharedSymbols #include "dbDefs.h" #include "epicsEvent.h" #include "iocLog.h" From 6f193242e07afe99c06d60e3da33654a3d57df3b Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Mon, 23 Sep 2019 11:10:32 +0200 Subject: [PATCH 021/216] renamed epicsSocketCountUnsentBytes to epicsSocketUnsentCount and moved it to osi/os/ --- src/libCom/log/logClient.c | 36 +------------------ src/libCom/osi/Makefile | 1 + src/libCom/osi/os/Darwin/osdSockUnsentCount.c | 17 +++++++++ src/libCom/osi/os/Linux/osdSockUnsentCount.c | 18 ++++++++++ src/libCom/osi/os/WIN32/osdSockUnsentCount.c | 25 +++++++++++++ .../osi/os/default/osdSockUnsentCount.c | 14 ++++++++ src/libCom/osi/os/iOS/osdSockUnsentCount.c | 17 +++++++++ src/libCom/osi/osiSock.h | 6 ++++ 8 files changed, 99 insertions(+), 35 deletions(-) create mode 100644 src/libCom/osi/os/Darwin/osdSockUnsentCount.c create mode 100644 src/libCom/osi/os/Linux/osdSockUnsentCount.c create mode 100644 src/libCom/osi/os/WIN32/osdSockUnsentCount.c create mode 100644 src/libCom/osi/os/default/osdSockUnsentCount.c create mode 100644 src/libCom/osi/os/iOS/osdSockUnsentCount.c diff --git a/src/libCom/log/logClient.c b/src/libCom/log/logClient.c index ee92c27c4..73664ff76 100644 --- a/src/libCom/log/logClient.c +++ b/src/libCom/log/logClient.c @@ -196,40 +196,6 @@ static void sendMessageChunk(logClient * pClient, const char * message) { } } -/* - * epicsSocketCountUnsentBytes () - * Should go to osd socket support - */ -#if defined (_WIN32) && WINVER >= _WIN32_WINNT_WIN10 -#include -#endif - -static int epicsSocketCountUnsentBytes(SOCKET sock) { -#if defined (_WIN32) && WINVER >= _WIN32_WINNT_WIN10 -/* Windows 10 Version 1703 / Server 2016 */ -/* https://docs.microsoft.com/en-us/windows/win32/api/mstcpip/ns-mstcpip-tcp_info_v0 */ - DWORD infoVersion = 0, bytesReturned; - TCP_INFO_v0 tcpInfo; - int status; - if ((status = WSAIoctl(sock, SIO_TCP_INFO, &infoVersion, sizeof(infoVersion), - &tcpInfo, sizeof(tcpInfo), &bytesReturned, NULL, NULL)) == 0) - return tcpInfo.BytesInFlight; -#elif defined (SO_NWRITE) -/* macOS / iOS */ -/* https://www.unix.com/man-page/osx/2/setsockopt/ */ - int unsent; - if (getsockopt(sock, SOL_SOCKET, SO_NWRITE, &unsent) == 0) - return unsent; -#elif defined (TIOCOUTQ) -/* Linux */ -/* https://linux.die.net/man/7/tcp */ - int unsent; - if (ioctl(sock, TIOCOUTQ, &unsent) == 0) - return unsent; -#endif - return -1; -} - /* * logClientSend () */ @@ -293,7 +259,7 @@ void epicsShareAPI logClientFlush ( logClientId id ) logClientClose ( pClient ); } else if ( nSent > 0 && pClient->nextMsgIndex > 0 ) { - int backlog = epicsSocketCountUnsentBytes ( pClient->sock ); + int backlog = epicsSocketUnsentCount ( pClient->sock ); if (backlog >= 0) { pClient->backlog = backlog; nSent -= backlog; diff --git a/src/libCom/osi/Makefile b/src/libCom/osi/Makefile index e05aec37d..00685d8bc 100644 --- a/src/libCom/osi/Makefile +++ b/src/libCom/osi/Makefile @@ -86,6 +86,7 @@ endif Com_SRCS += osdSock.c Com_SRCS += osdSockAddrReuse.cpp +Com_SRCS += osdSockUnsentCount.c Com_SRCS += osiSock.c Com_SRCS += systemCallIntMech.cpp Com_SRCS += epicsSocketConvertErrnoToString.cpp diff --git a/src/libCom/osi/os/Darwin/osdSockUnsentCount.c b/src/libCom/osi/os/Darwin/osdSockUnsentCount.c new file mode 100644 index 000000000..00ef550bd --- /dev/null +++ b/src/libCom/osi/os/Darwin/osdSockUnsentCount.c @@ -0,0 +1,17 @@ +/*************************************************************************\ +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ + +#include "osiSock.h" + +/* + * epicsSocketUnsentCount () + * See https://www.unix.com/man-page/osx/2/setsockopt + */ +int epicsSocketUnsentCount(SOCKET sock) { + int unsent; + if (getsockopt(sock, SOL_SOCKET, SO_NWRITE, &unsent) == 0) + return unsent; + return -1; +} diff --git a/src/libCom/osi/os/Linux/osdSockUnsentCount.c b/src/libCom/osi/os/Linux/osdSockUnsentCount.c new file mode 100644 index 000000000..6f6cbf0fe --- /dev/null +++ b/src/libCom/osi/os/Linux/osdSockUnsentCount.c @@ -0,0 +1,18 @@ +/*************************************************************************\ +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ + +#include +#include "osiSock.h" + +/* + * epicsSocketUnsentCount () + * See https://linux.die.net/man/7/tcp + */ +int epicsSocketUnsentCount(SOCKET sock) { + int unsent; + if (ioctl(sock, SIOCOUTQ, &unsent) == 0) + return unsent; + return -1; +} diff --git a/src/libCom/osi/os/WIN32/osdSockUnsentCount.c b/src/libCom/osi/os/WIN32/osdSockUnsentCount.c new file mode 100644 index 000000000..c2045bc79 --- /dev/null +++ b/src/libCom/osi/os/WIN32/osdSockUnsentCount.c @@ -0,0 +1,25 @@ +/*************************************************************************\ +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ + +#define epicsExportSharedSymbols +#include "osiSock.h" +#include + +/* + * epicsSocketUnsentCount () + * See https://docs.microsoft.com/en-us/windows/win32/api/mstcpip/ns-mstcpip-tcp_info_v0 + */ +int epicsSocketUnsentCount(SOCKET sock) { +#if defined (_WIN32) && WINVER >= _WIN32_WINNT_WIN10 +/* Windows 10 Version 1703 / Server 2016 */ + DWORD infoVersion = 0, bytesReturned; + TCP_INFO_v0 tcpInfo; + int status; + if ((status = WSAIoctl(sock, SIO_TCP_INFO, &infoVersion, sizeof(infoVersion), + &tcpInfo, sizeof(tcpInfo), &bytesReturned, NULL, NULL)) == 0) + return tcpInfo.BytesInFlight; +#endif + return -1; +} diff --git a/src/libCom/osi/os/default/osdSockUnsentCount.c b/src/libCom/osi/os/default/osdSockUnsentCount.c new file mode 100644 index 000000000..61094c710 --- /dev/null +++ b/src/libCom/osi/os/default/osdSockUnsentCount.c @@ -0,0 +1,14 @@ +/*************************************************************************\ +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ + +#include "osiSock.h" + +/* + * epicsSocketUnsentCount () + */ +int epicsSocketUnsentCount(SOCKET sock) { + /* not implemented */ + return -1; +} diff --git a/src/libCom/osi/os/iOS/osdSockUnsentCount.c b/src/libCom/osi/os/iOS/osdSockUnsentCount.c new file mode 100644 index 000000000..00ef550bd --- /dev/null +++ b/src/libCom/osi/os/iOS/osdSockUnsentCount.c @@ -0,0 +1,17 @@ +/*************************************************************************\ +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ + +#include "osiSock.h" + +/* + * epicsSocketUnsentCount () + * See https://www.unix.com/man-page/osx/2/setsockopt + */ +int epicsSocketUnsentCount(SOCKET sock) { + int unsent; + if (getsockopt(sock, SOL_SOCKET, SO_NWRITE, &unsent) == 0) + return unsent; + return -1; +} diff --git a/src/libCom/osi/osiSock.h b/src/libCom/osi/osiSock.h index 061619e89..e1c2de881 100644 --- a/src/libCom/osi/osiSock.h +++ b/src/libCom/osi/osiSock.h @@ -52,6 +52,12 @@ enum epicsSocketSystemCallInterruptMechanismQueryInfo { epicsShareFunc enum epicsSocketSystemCallInterruptMechanismQueryInfo epicsSocketSystemCallInterruptMechanismQuery (); +/* + * Some systems (e.g Linux and Windows 10) allow to check the amount + * of unsent data in the output queue. + * Returns -1 if the information is not available. + */ +epicsShareFunc int epicsSocketUnsentCount(SOCKET sock); /* * convert socket address to ASCII in this order From d2d8674cb9925ab72bef5d59fccf5cd4fbb28026 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Fri, 4 Oct 2019 14:32:07 +0200 Subject: [PATCH 022/216] use EPICS_PRIVATE_API macro and fix bug with darwin/ios --- src/libCom/log/logClient.c | 1 + src/libCom/osi/os/Darwin/osdSockUnsentCount.c | 4 +++- src/libCom/osi/os/Linux/osdSockUnsentCount.c | 1 + src/libCom/osi/os/WIN32/osdSockUnsentCount.c | 1 + src/libCom/osi/os/default/osdSockUnsentCount.c | 1 + src/libCom/osi/os/iOS/osdSockUnsentCount.c | 4 +++- src/libCom/osi/osiSock.h | 2 ++ 7 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/libCom/log/logClient.c b/src/libCom/log/logClient.c index 73664ff76..9a09ef7b7 100644 --- a/src/libCom/log/logClient.c +++ b/src/libCom/log/logClient.c @@ -21,6 +21,7 @@ #include #include +#define EPICS_PRIVATE_API #define epicsExportSharedSymbols #include "dbDefs.h" #include "epicsEvent.h" diff --git a/src/libCom/osi/os/Darwin/osdSockUnsentCount.c b/src/libCom/osi/os/Darwin/osdSockUnsentCount.c index 00ef550bd..20bd82b14 100644 --- a/src/libCom/osi/os/Darwin/osdSockUnsentCount.c +++ b/src/libCom/osi/os/Darwin/osdSockUnsentCount.c @@ -3,6 +3,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ +#define EPICS_PRIVATE_API #include "osiSock.h" /* @@ -11,7 +12,8 @@ */ int epicsSocketUnsentCount(SOCKET sock) { int unsent; - if (getsockopt(sock, SOL_SOCKET, SO_NWRITE, &unsent) == 0) + socklen_t len = sizeof(unsent); + if (getsockopt(sock, SOL_SOCKET, SO_NWRITE, &unsent, &len) == 0) return unsent; return -1; } diff --git a/src/libCom/osi/os/Linux/osdSockUnsentCount.c b/src/libCom/osi/os/Linux/osdSockUnsentCount.c index 6f6cbf0fe..3c0a8f915 100644 --- a/src/libCom/osi/os/Linux/osdSockUnsentCount.c +++ b/src/libCom/osi/os/Linux/osdSockUnsentCount.c @@ -4,6 +4,7 @@ \*************************************************************************/ #include +#define EPICS_PRIVATE_API #include "osiSock.h" /* diff --git a/src/libCom/osi/os/WIN32/osdSockUnsentCount.c b/src/libCom/osi/os/WIN32/osdSockUnsentCount.c index c2045bc79..fe68ead01 100644 --- a/src/libCom/osi/os/WIN32/osdSockUnsentCount.c +++ b/src/libCom/osi/os/WIN32/osdSockUnsentCount.c @@ -4,6 +4,7 @@ \*************************************************************************/ #define epicsExportSharedSymbols +#define EPICS_PRIVATE_API #include "osiSock.h" #include diff --git a/src/libCom/osi/os/default/osdSockUnsentCount.c b/src/libCom/osi/os/default/osdSockUnsentCount.c index 61094c710..ef01e9b24 100644 --- a/src/libCom/osi/os/default/osdSockUnsentCount.c +++ b/src/libCom/osi/os/default/osdSockUnsentCount.c @@ -3,6 +3,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ +#define EPICS_PRIVATE_API #include "osiSock.h" /* diff --git a/src/libCom/osi/os/iOS/osdSockUnsentCount.c b/src/libCom/osi/os/iOS/osdSockUnsentCount.c index 00ef550bd..20bd82b14 100644 --- a/src/libCom/osi/os/iOS/osdSockUnsentCount.c +++ b/src/libCom/osi/os/iOS/osdSockUnsentCount.c @@ -3,6 +3,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ +#define EPICS_PRIVATE_API #include "osiSock.h" /* @@ -11,7 +12,8 @@ */ int epicsSocketUnsentCount(SOCKET sock) { int unsent; - if (getsockopt(sock, SOL_SOCKET, SO_NWRITE, &unsent) == 0) + socklen_t len = sizeof(unsent); + if (getsockopt(sock, SOL_SOCKET, SO_NWRITE, &unsent, &len) == 0) return unsent; return -1; } diff --git a/src/libCom/osi/osiSock.h b/src/libCom/osi/osiSock.h index e1c2de881..6e3b053c5 100644 --- a/src/libCom/osi/osiSock.h +++ b/src/libCom/osi/osiSock.h @@ -52,12 +52,14 @@ enum epicsSocketSystemCallInterruptMechanismQueryInfo { epicsShareFunc enum epicsSocketSystemCallInterruptMechanismQueryInfo epicsSocketSystemCallInterruptMechanismQuery (); +#ifdef EPICS_PRIVATE_API /* * Some systems (e.g Linux and Windows 10) allow to check the amount * of unsent data in the output queue. * Returns -1 if the information is not available. */ epicsShareFunc int epicsSocketUnsentCount(SOCKET sock); +#endif /* * convert socket address to ASCII in this order From 81550ac4d3b532ca78824ae48059e7ef4e3d6f01 Mon Sep 17 00:00:00 2001 From: Martin Konrad Date: Thu, 14 Nov 2019 10:11:16 -0500 Subject: [PATCH 023/216] Fix segfault when calling dbLoadRecords after iocInit This fixes lp:1829919. --- src/ioc/db/dbAccess.c | 15 ++++++++++++--- src/ioc/dbStatic/dbLexRoutines.c | 10 ++++++++++ src/ioc/dbStatic/dbStaticIocRegister.c | 8 ++++++++ src/ioc/dbStatic/dbStaticPvt.h | 1 + 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/ioc/db/dbAccess.c b/src/ioc/db/dbAccess.c index 4ee2d677d..0b893eeb9 100644 --- a/src/ioc/db/dbAccess.c +++ b/src/ioc/db/dbAccess.c @@ -730,9 +730,18 @@ int dbLoadDatabase(const char *file, const char *path, const char *subs) int dbLoadRecords(const char* file, const char* subs) { int status = dbReadDatabase(&pdbbase, file, 0, subs); - - if (!status && dbLoadRecordsHook) - dbLoadRecordsHook(file, subs); + switch(status) + { + case 0: + if(dbLoadRecordsHook) + dbLoadRecordsHook(file, subs); + break; + case -2: + errlogPrintf("dbLoadRecords: failed to load %s - cannot load records after running iocBuild!\n", file); + break; + default: + errlogPrintf("dbLoadRecords: failed to load %s\n", file); + } return status; } diff --git a/src/ioc/dbStatic/dbLexRoutines.c b/src/ioc/dbStatic/dbLexRoutines.c index 3df3c7f3a..9bc0f8722 100644 --- a/src/ioc/dbStatic/dbLexRoutines.c +++ b/src/ioc/dbStatic/dbLexRoutines.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "dbDefs.h" #include "dbmf.h" @@ -115,6 +116,12 @@ typedef struct tempListNode { static ELLLIST tempList = ELLLIST_INIT; static void *freeListPvt = NULL; static int duplicate = FALSE; +static bool dbLoadRecordsAllowed = true; + +void disableDbLoadRecords() +{ + dbLoadRecordsAllowed = false; +} static void yyerrorAbort(char *str) { @@ -215,6 +222,9 @@ static long dbReadCOM(DBBASE **ppdbbase,const char *filename, FILE *fp, char *penv; char **macPairs; + if(!dbLoadRecordsAllowed) + return -2; + if(*ppdbbase == 0) *ppdbbase = dbAllocBase(); pdbbase = *ppdbbase; if(path && strlen(path)>0) { diff --git a/src/ioc/dbStatic/dbStaticIocRegister.c b/src/ioc/dbStatic/dbStaticIocRegister.c index 18d346c70..7156691ac 100644 --- a/src/ioc/dbStatic/dbStaticIocRegister.c +++ b/src/ioc/dbStatic/dbStaticIocRegister.c @@ -8,12 +8,19 @@ \*************************************************************************/ #include "iocsh.h" +#include "initHooks.h" #define epicsExportSharedSymbols #include "dbStaticIocRegister.h" #include "dbStaticLib.h" #include "dbStaticPvt.h" +static void dbStaticIocRegisterInitHook(initHookState state) +{ + if(state == initHookAtIocBuild) + disableDbLoadRecords(); +} + /* common arguments */ static const iocshArg argPdbbase = { "pdbbase", iocshArgPdbbase}; @@ -153,6 +160,7 @@ static void dbReportDeviceConfigCallFunc(const iocshArgBuf *args) void dbStaticIocRegister(void) { + initHookRegister(dbStaticIocRegisterInitHook); iocshRegister(&dbDumpPathFuncDef, dbDumpPathCallFunc); iocshRegister(&dbDumpRecordFuncDef, dbDumpRecordCallFunc); iocshRegister(&dbDumpMenuFuncDef, dbDumpMenuCallFunc); diff --git a/src/ioc/dbStatic/dbStaticPvt.h b/src/ioc/dbStatic/dbStaticPvt.h index 842c0dc21..62e595e02 100644 --- a/src/ioc/dbStatic/dbStaticPvt.h +++ b/src/ioc/dbStatic/dbStaticPvt.h @@ -25,6 +25,7 @@ dbDeviceMenu *dbGetDeviceMenu(DBENTRY *pdbentry); void dbFreeLinkContents(struct link *plink); void dbFreePath(DBBASE *pdbbase); int dbIsMacroOk(DBENTRY *pdbentry); +void disableDbLoadRecords(); /*The following routines have different versions for run-time no-run-time*/ long dbAllocRecord(DBENTRY *pdbentry,const char *precordName); From 6767bcd31e2335e13fc1f3e548fe54b122d5527b Mon Sep 17 00:00:00 2001 From: Martin Konrad Date: Thu, 14 Nov 2019 13:57:45 -0500 Subject: [PATCH 024/216] Use accessor in iocInit This is simpler than using init hooks. --- src/ioc/dbStatic/dbLexRoutines.c | 10 ++-------- src/ioc/dbStatic/dbStaticIocRegister.c | 8 -------- src/ioc/dbStatic/dbStaticPvt.h | 1 - src/ioc/misc/iocInit.c | 9 ++++++--- src/ioc/misc/iocInit.h | 5 +++++ 5 files changed, 13 insertions(+), 20 deletions(-) diff --git a/src/ioc/dbStatic/dbLexRoutines.c b/src/ioc/dbStatic/dbLexRoutines.c index 9bc0f8722..b5f94674f 100644 --- a/src/ioc/dbStatic/dbLexRoutines.c +++ b/src/ioc/dbStatic/dbLexRoutines.c @@ -16,7 +16,6 @@ #include #include #include -#include #include "dbDefs.h" #include "dbmf.h" @@ -27,6 +26,7 @@ #include "freeList.h" #include "gpHash.h" #include "macLib.h" +#include "iocInit.h" #define epicsExportSharedSymbols #include "dbBase.h" @@ -116,12 +116,6 @@ typedef struct tempListNode { static ELLLIST tempList = ELLLIST_INIT; static void *freeListPvt = NULL; static int duplicate = FALSE; -static bool dbLoadRecordsAllowed = true; - -void disableDbLoadRecords() -{ - dbLoadRecordsAllowed = false; -} static void yyerrorAbort(char *str) { @@ -222,7 +216,7 @@ static long dbReadCOM(DBBASE **ppdbbase,const char *filename, FILE *fp, char *penv; char **macPairs; - if(!dbLoadRecordsAllowed) + if(getIocState() != iocVirgin) return -2; if(*ppdbbase == 0) *ppdbbase = dbAllocBase(); diff --git a/src/ioc/dbStatic/dbStaticIocRegister.c b/src/ioc/dbStatic/dbStaticIocRegister.c index 7156691ac..18d346c70 100644 --- a/src/ioc/dbStatic/dbStaticIocRegister.c +++ b/src/ioc/dbStatic/dbStaticIocRegister.c @@ -8,19 +8,12 @@ \*************************************************************************/ #include "iocsh.h" -#include "initHooks.h" #define epicsExportSharedSymbols #include "dbStaticIocRegister.h" #include "dbStaticLib.h" #include "dbStaticPvt.h" -static void dbStaticIocRegisterInitHook(initHookState state) -{ - if(state == initHookAtIocBuild) - disableDbLoadRecords(); -} - /* common arguments */ static const iocshArg argPdbbase = { "pdbbase", iocshArgPdbbase}; @@ -160,7 +153,6 @@ static void dbReportDeviceConfigCallFunc(const iocshArgBuf *args) void dbStaticIocRegister(void) { - initHookRegister(dbStaticIocRegisterInitHook); iocshRegister(&dbDumpPathFuncDef, dbDumpPathCallFunc); iocshRegister(&dbDumpRecordFuncDef, dbDumpRecordCallFunc); iocshRegister(&dbDumpMenuFuncDef, dbDumpMenuCallFunc); diff --git a/src/ioc/dbStatic/dbStaticPvt.h b/src/ioc/dbStatic/dbStaticPvt.h index 62e595e02..842c0dc21 100644 --- a/src/ioc/dbStatic/dbStaticPvt.h +++ b/src/ioc/dbStatic/dbStaticPvt.h @@ -25,7 +25,6 @@ dbDeviceMenu *dbGetDeviceMenu(DBENTRY *pdbentry); void dbFreeLinkContents(struct link *plink); void dbFreePath(DBBASE *pdbbase); int dbIsMacroOk(DBENTRY *pdbentry); -void disableDbLoadRecords(); /*The following routines have different versions for run-time no-run-time*/ long dbAllocRecord(DBENTRY *pdbentry,const char *precordName); diff --git a/src/ioc/misc/iocInit.c b/src/ioc/misc/iocInit.c index a45770d9e..93d8908a8 100644 --- a/src/ioc/misc/iocInit.c +++ b/src/ioc/misc/iocInit.c @@ -70,9 +70,7 @@ #include "registryRecordType.h" #include "rsrv.h" -static enum { - iocVirgin, iocBuilding, iocBuilt, iocRunning, iocPaused, iocStopped -} iocState = iocVirgin; +static enum iocStateEnum iocState = iocVirgin; static enum { buildRSRV, buildIsolated } iocBuildMode; @@ -91,6 +89,11 @@ static void exitDatabase(void *dummy); int dbThreadRealtimeLock = 1; epicsExportAddress(int, dbThreadRealtimeLock); +enum iocStateEnum getIocState(void) +{ + return iocState; +} + /* * Initialize EPICS on the IOC. */ diff --git a/src/ioc/misc/iocInit.h b/src/ioc/misc/iocInit.h index 24ae45e06..3e711d6c5 100644 --- a/src/ioc/misc/iocInit.h +++ b/src/ioc/misc/iocInit.h @@ -13,10 +13,15 @@ #include "shareLib.h" +enum iocStateEnum { + iocVirgin, iocBuilding, iocBuilt, iocRunning, iocPaused, iocStopped +}; + #ifdef __cplusplus extern "C" { #endif +epicsShareFunc enum iocStateEnum getIocState(void); epicsShareFunc int iocInit(void); epicsShareFunc int iocBuild(void); epicsShareFunc int iocBuildIsolated(void); From a50b850ebdb4ef7ebb2906e090513bc618085a18 Mon Sep 17 00:00:00 2001 From: Martin Konrad Date: Fri, 15 Nov 2019 09:33:15 -0500 Subject: [PATCH 025/216] Fix mingw cross-build --- src/ioc/dbStatic/dbLexRoutines.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ioc/dbStatic/dbLexRoutines.c b/src/ioc/dbStatic/dbLexRoutines.c index b5f94674f..2be7b0d0c 100644 --- a/src/ioc/dbStatic/dbLexRoutines.c +++ b/src/ioc/dbStatic/dbLexRoutines.c @@ -26,7 +26,6 @@ #include "freeList.h" #include "gpHash.h" #include "macLib.h" -#include "iocInit.h" #define epicsExportSharedSymbols #include "dbBase.h" @@ -36,6 +35,7 @@ #include "epicsExport.h" #include "link.h" #include "special.h" +#include "iocInit.h" From 23450fcfc81d98b1cd3d71deb598c4d323508846 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 16 Nov 2019 22:16:50 -0600 Subject: [PATCH 026/216] Modify printfdset, set USE_TYPED_DSET --- modules/database/src/std/dev/Makefile | 3 +++ modules/database/src/std/dev/devPrintfSoft.c | 2 +- modules/database/src/std/dev/devPrintfSoftCallback.c | 2 +- modules/database/src/std/dev/devStdio.c | 2 +- modules/database/src/std/rec/Makefile | 1 + modules/database/src/std/rec/printfRecord.c | 8 ++++---- modules/database/src/std/rec/printfRecord.dbd | 9 +++------ 7 files changed, 14 insertions(+), 13 deletions(-) diff --git a/modules/database/src/std/dev/Makefile b/modules/database/src/std/dev/Makefile index ec3713bd6..a42879883 100644 --- a/modules/database/src/std/dev/Makefile +++ b/modules/database/src/std/dev/Makefile @@ -42,6 +42,7 @@ dbRecStd_SRCS += devMbboDirectSoft.c dbRecStd_SRCS += devMbboDirectSoftRaw.c dbRecStd_SRCS += devMbboSoft.c dbRecStd_SRCS += devMbboSoftRaw.c +devPrintfSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devPrintfSoft.c dbRecStd_SRCS += devSASoft.c dbRecStd_SRCS += devSiSoft.c @@ -65,10 +66,12 @@ dbRecStd_SRCS += devLoSoftCallback.c dbRecStd_SRCS += devLsoSoftCallback.c dbRecStd_SRCS += devMbboSoftCallback.c dbRecStd_SRCS += devMbboDirectSoftCallback.c +devPrintfSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devPrintfSoftCallback.c dbRecStd_SRCS += devSoSoftCallback.c dbRecStd_SRCS += devTimestamp.c +devStdio_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devStdio.c dbRecStd_SRCS += devEnviron.c diff --git a/modules/database/src/std/dev/devPrintfSoft.c b/modules/database/src/std/dev/devPrintfSoft.c index ca06f04be..053b6e44d 100644 --- a/modules/database/src/std/dev/devPrintfSoft.c +++ b/modules/database/src/std/dev/devPrintfSoft.c @@ -19,7 +19,7 @@ static long write_string(printfRecord *prec) } printfdset devPrintfSoft = { - 5, NULL, NULL, NULL, NULL, write_string + { 5, NULL, NULL, NULL, NULL }, write_string }; epicsExportAddress(dset, devPrintfSoft); diff --git a/modules/database/src/std/dev/devPrintfSoftCallback.c b/modules/database/src/std/dev/devPrintfSoftCallback.c index e89afd53b..a17efc400 100644 --- a/modules/database/src/std/dev/devPrintfSoftCallback.c +++ b/modules/database/src/std/dev/devPrintfSoftCallback.c @@ -40,6 +40,6 @@ static long write_string(printfRecord *prec) } printfdset devPrintfSoftCallback = { - 5, NULL, NULL, NULL, NULL, write_string + { 5, NULL, NULL, NULL, NULL }, write_string }; epicsExportAddress(dset, devPrintfSoftCallback); diff --git a/modules/database/src/std/dev/devStdio.c b/modules/database/src/std/dev/devStdio.c index e957bfce0..0bed72a57 100644 --- a/modules/database/src/std/dev/devStdio.c +++ b/modules/database/src/std/dev/devStdio.c @@ -153,7 +153,7 @@ static long write_printf(printfRecord *prec) } printfdset devPrintfStdio = { - 5, NULL, init_printf, NULL, NULL, write_printf + {5, NULL, init_printf, NULL, NULL }, write_printf }; epicsExportAddress(dset, devPrintfStdio); diff --git a/modules/database/src/std/rec/Makefile b/modules/database/src/std/rec/Makefile index 87021987e..d950eda35 100644 --- a/modules/database/src/std/rec/Makefile +++ b/modules/database/src/std/rec/Makefile @@ -36,6 +36,7 @@ stdRecords += mbbiDirectRecord stdRecords += mbboRecord stdRecords += mbboDirectRecord stdRecords += permissiveRecord +printfRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += printfRecord stdRecords += selRecord stdRecords += seqRecord diff --git a/modules/database/src/std/rec/printfRecord.c b/modules/database/src/std/rec/printfRecord.c index 576b9632a..8a8edb133 100644 --- a/modules/database/src/std/rec/printfRecord.c +++ b/modules/database/src/std/rec/printfRecord.c @@ -336,13 +336,13 @@ static long init_record(struct dbCommon *pcommon, int pass) if (!pdset) return 0; /* Device support is optional */ - if (pdset->number < 5) { + if (pdset->common.number < 5) { recGblRecordError(S_dev_missingSup, prec, "printf::init_record"); return S_dev_missingSup; } - if (pdset->init_record) { - long status = pdset->init_record(prec); + if (pdset->common.init_record) { + long status = pdset->common.init_record(pcommon); if (status) return status; } @@ -368,7 +368,7 @@ static long process(struct dbCommon *pcommon) /* Call device support */ pdset = (printfdset *) prec->dset; if (pdset && - pdset->number >= 5 && + pdset->common.number >= 5 && pdset->write_string) { status = pdset->write_string(prec); diff --git a/modules/database/src/std/rec/printfRecord.dbd b/modules/database/src/std/rec/printfRecord.dbd index 4fd63ef3c..6cdbc73c4 100644 --- a/modules/database/src/std/rec/printfRecord.dbd +++ b/modules/database/src/std/rec/printfRecord.dbd @@ -10,13 +10,10 @@ recordtype(printf) { %#include "devSup.h" % %/* Declare Device Support Entry Table */ + %struct printfRecord; %typedef struct printfdset { - % long number; - % DEVSUPFUN report; - % DEVSUPFUN init; - % DEVSUPFUN init_record; - % DEVSUPFUN get_ioint_info; - % DEVSUPFUN write_string; + % dset common; + % long (*write_string)(struct printfRecord *prec); %} printfdset; % field(VAL,DBF_NOACCESS) { From 465ab446069261f31671bfe5f9746e315430e7af Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 16 Nov 2019 22:18:32 -0600 Subject: [PATCH 027/216] Modify lsidset, set USE_TYPED_DSET --- modules/database/src/std/dev/Makefile | 2 ++ modules/database/src/std/dev/devEnviron.c | 2 +- modules/database/src/std/dev/devLsiSoft.c | 5 +++-- modules/database/src/std/rec/Makefile | 1 + modules/database/src/std/rec/lsiRecord.c | 6 +++--- modules/database/src/std/rec/lsiRecord.dbd | 9 +++------ 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/modules/database/src/std/dev/Makefile b/modules/database/src/std/dev/Makefile index a42879883..a72bfa342 100644 --- a/modules/database/src/std/dev/Makefile +++ b/modules/database/src/std/dev/Makefile @@ -32,6 +32,7 @@ dbRecStd_SRCS += devI64inSoft.c dbRecStd_SRCS += devI64outSoft.c dbRecStd_SRCS += devLiSoft.c dbRecStd_SRCS += devLoSoft.c +devLsiSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devLsiSoft.c dbRecStd_SRCS += devLsoSoft.c dbRecStd_SRCS += devMbbiDirectSoft.c @@ -73,6 +74,7 @@ dbRecStd_SRCS += devSoSoftCallback.c dbRecStd_SRCS += devTimestamp.c devStdio_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devStdio.c +devEnviron_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devEnviron.c dbRecStd_SRCS += asSubRecordFunctions.c diff --git a/modules/database/src/std/dev/devEnviron.c b/modules/database/src/std/dev/devEnviron.c index 9672d6ce5..69c9a3d92 100644 --- a/modules/database/src/std/dev/devEnviron.c +++ b/modules/database/src/std/dev/devEnviron.c @@ -69,7 +69,7 @@ static long read_lsi(lsiRecord *prec) } lsidset devLsiEnviron = { - 5, NULL, init_lsi, NULL, NULL, read_lsi + {5, NULL, init_lsi, NULL, NULL }, read_lsi }; epicsExportAddress(dset, devLsiEnviron); diff --git a/modules/database/src/std/dev/devLsiSoft.c b/modules/database/src/std/dev/devLsiSoft.c index 3076c9900..d7c5021e7 100644 --- a/modules/database/src/std/dev/devLsiSoft.c +++ b/modules/database/src/std/dev/devLsiSoft.c @@ -17,8 +17,9 @@ #include "lsiRecord.h" #include "epicsExport.h" -static long init_record(lsiRecord *prec) +static long init_record(dbCommon *common) { + lsiRecord *prec = (lsiRecord *)common; dbLoadLinkLS(&prec->inp, prec->val, prec->sizv, &prec->len); return 0; @@ -49,6 +50,6 @@ static long read_string(lsiRecord *prec) } lsidset devLsiSoft = { - 5, NULL, NULL, init_record, NULL, read_string + { 5, NULL, NULL, init_record, NULL }, read_string }; epicsExportAddress(dset, devLsiSoft); diff --git a/modules/database/src/std/rec/Makefile b/modules/database/src/std/rec/Makefile index d950eda35..4d3687794 100644 --- a/modules/database/src/std/rec/Makefile +++ b/modules/database/src/std/rec/Makefile @@ -29,6 +29,7 @@ stdRecords += int64inRecord stdRecords += int64outRecord stdRecords += longinRecord stdRecords += longoutRecord +lsiRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += lsiRecord stdRecords += lsoRecord stdRecords += mbbiRecord diff --git a/modules/database/src/std/rec/lsiRecord.c b/modules/database/src/std/rec/lsiRecord.c index 7396946d4..96e870b0e 100644 --- a/modules/database/src/std/rec/lsiRecord.c +++ b/modules/database/src/std/rec/lsiRecord.c @@ -66,13 +66,13 @@ static long init_record(struct dbCommon *pcommon, int pass) } /* must have a read_string function */ - if (pdset->number < 5 || !pdset->read_string) { + if (pdset->common.number < 5 || !pdset->read_string) { recGblRecordError(S_dev_missingSup, prec, "lsi: init_record"); return S_dev_missingSup; } - if (pdset->init_record) { - long status = pdset->init_record(prec); + if (pdset->common.init_record) { + long status = pdset->common.init_record(pcommon); if (status) return status; diff --git a/modules/database/src/std/rec/lsiRecord.dbd b/modules/database/src/std/rec/lsiRecord.dbd index 21f2ba43d..7d885987b 100644 --- a/modules/database/src/std/rec/lsiRecord.dbd +++ b/modules/database/src/std/rec/lsiRecord.dbd @@ -10,13 +10,10 @@ recordtype(lsi) { %#include "devSup.h" % %/* Declare Device Support Entry Table */ + %struct lsiRecord; %typedef struct lsidset { - % long number; - % DEVSUPFUN report; - % DEVSUPFUN init; - % DEVSUPFUN init_record; - % DEVSUPFUN get_ioint_info; - % DEVSUPFUN read_string; + % dset common; + % long (*read_string)(struct lsiRecord *prec); %} lsidset; % field(VAL,DBF_NOACCESS) { From 7893445a2ed92a1350e4fb40ac77e5f8e39b1557 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 16 Nov 2019 22:19:38 -0600 Subject: [PATCH 028/216] Modify lsodset, set USE_TYPED_DSET --- modules/database/src/std/dev/Makefile | 2 ++ modules/database/src/std/dev/devLsoSoft.c | 2 +- modules/database/src/std/dev/devLsoSoftCallback.c | 2 +- modules/database/src/std/dev/devStdio.c | 2 +- modules/database/src/std/rec/Makefile | 1 + modules/database/src/std/rec/lsoRecord.c | 6 +++--- modules/database/src/std/rec/lsoRecord.dbd | 9 +++------ 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/database/src/std/dev/Makefile b/modules/database/src/std/dev/Makefile index a72bfa342..bcfc51870 100644 --- a/modules/database/src/std/dev/Makefile +++ b/modules/database/src/std/dev/Makefile @@ -34,6 +34,7 @@ dbRecStd_SRCS += devLiSoft.c dbRecStd_SRCS += devLoSoft.c devLsiSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devLsiSoft.c +devLsoSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devLsoSoft.c dbRecStd_SRCS += devMbbiDirectSoft.c dbRecStd_SRCS += devMbbiDirectSoftRaw.c @@ -64,6 +65,7 @@ dbRecStd_SRCS += devBoSoftCallback.c dbRecStd_SRCS += devCalcoutSoftCallback.c dbRecStd_SRCS += devI64outSoftCallback.c dbRecStd_SRCS += devLoSoftCallback.c +devLsoSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devLsoSoftCallback.c dbRecStd_SRCS += devMbboSoftCallback.c dbRecStd_SRCS += devMbboDirectSoftCallback.c diff --git a/modules/database/src/std/dev/devLsoSoft.c b/modules/database/src/std/dev/devLsoSoft.c index 02079a053..2f6f6abda 100644 --- a/modules/database/src/std/dev/devLsoSoft.c +++ b/modules/database/src/std/dev/devLsoSoft.c @@ -21,6 +21,6 @@ static long write_string(lsoRecord *prec) } lsodset devLsoSoft = { - 5, NULL, NULL, NULL, NULL, write_string + { 5, NULL, NULL, NULL, NULL }, write_string }; epicsExportAddress(dset, devLsoSoft); diff --git a/modules/database/src/std/dev/devLsoSoftCallback.c b/modules/database/src/std/dev/devLsoSoftCallback.c index 59579d558..08fca77c2 100644 --- a/modules/database/src/std/dev/devLsoSoftCallback.c +++ b/modules/database/src/std/dev/devLsoSoftCallback.c @@ -40,7 +40,7 @@ static long write_string(lsoRecord *prec) } lsodset devLsoSoftCallback = { - 5, NULL, NULL, NULL, NULL, write_string + { 5, NULL, NULL, NULL, NULL }, write_string }; epicsExportAddress(dset, devLsoSoftCallback); diff --git a/modules/database/src/std/dev/devStdio.c b/modules/database/src/std/dev/devStdio.c index 0bed72a57..928c8a420 100644 --- a/modules/database/src/std/dev/devStdio.c +++ b/modules/database/src/std/dev/devStdio.c @@ -103,7 +103,7 @@ static long write_lso(lsoRecord *prec) } lsodset devLsoStdio = { - 5, NULL, init_lso, NULL, NULL, write_lso + { 5, NULL, init_lso, NULL, NULL }, write_lso }; epicsExportAddress(dset, devLsoStdio); diff --git a/modules/database/src/std/rec/Makefile b/modules/database/src/std/rec/Makefile index 4d3687794..3f46ae33a 100644 --- a/modules/database/src/std/rec/Makefile +++ b/modules/database/src/std/rec/Makefile @@ -31,6 +31,7 @@ stdRecords += longinRecord stdRecords += longoutRecord lsiRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += lsiRecord +lsoRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += lsoRecord stdRecords += mbbiRecord stdRecords += mbbiDirectRecord diff --git a/modules/database/src/std/rec/lsoRecord.c b/modules/database/src/std/rec/lsoRecord.c index 9485e3810..4fa6bb725 100644 --- a/modules/database/src/std/rec/lsoRecord.c +++ b/modules/database/src/std/rec/lsoRecord.c @@ -70,15 +70,15 @@ static long init_record(struct dbCommon *pcommon, int pass) } /* must have a write_string function defined */ - if (pdset->number < 5 || !pdset->write_string) { + if (pdset->common.number < 5 || !pdset->write_string) { recGblRecordError(S_dev_missingSup, prec, "lso: init_record"); return S_dev_missingSup; } dbLoadLinkLS(&prec->dol, prec->val, prec->sizv, &prec->len); - if (pdset->init_record) { - long status = pdset->init_record(prec); + if (pdset->common.init_record) { + long status = pdset->common.init_record(pcommon); if (status) return status; diff --git a/modules/database/src/std/rec/lsoRecord.dbd b/modules/database/src/std/rec/lsoRecord.dbd index 880139a3c..50cc6f29c 100644 --- a/modules/database/src/std/rec/lsoRecord.dbd +++ b/modules/database/src/std/rec/lsoRecord.dbd @@ -10,13 +10,10 @@ recordtype(lso) { %#include "devSup.h" % %/* Declare Device Support Entry Table */ + %struct lsoRecord; %typedef struct lsodset { - % long number; - % DEVSUPFUN report; - % DEVSUPFUN init; - % DEVSUPFUN init_record; - % DEVSUPFUN get_ioint_info; - % DEVSUPFUN write_string; + % dset common; + % long (*write_string)(struct lsoRecord *prec); %} lsodset; % field(VAL,DBF_NOACCESS) { From 7e1d1650929f12ec91bf352a4b287b84bed08d1b Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 16 Nov 2019 22:40:08 -0600 Subject: [PATCH 029/216] Export and use int64indset, set USE_TYPED_DSET --- modules/database/src/std/dev/Makefile | 2 ++ modules/database/src/std/dev/devI64inSoft.c | 32 ++++++------------- .../src/std/dev/devI64inSoftCallback.c | 11 +++---- modules/database/src/std/rec/Makefile | 1 + modules/database/src/std/rec/int64inRecord.c | 14 ++------ .../src/std/rec/int64inRecord.dbd.pod | 9 ++++++ 6 files changed, 29 insertions(+), 40 deletions(-) diff --git a/modules/database/src/std/dev/Makefile b/modules/database/src/std/dev/Makefile index bcfc51870..4e023abbd 100644 --- a/modules/database/src/std/dev/Makefile +++ b/modules/database/src/std/dev/Makefile @@ -28,6 +28,7 @@ dbRecStd_SRCS += devBoDbState.c dbRecStd_SRCS += devCalcoutSoft.c dbRecStd_SRCS += devEventSoft.c dbRecStd_SRCS += devHistogramSoft.c +devI64inSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devI64inSoft.c dbRecStd_SRCS += devI64outSoft.c dbRecStd_SRCS += devLiSoft.c @@ -54,6 +55,7 @@ dbRecStd_SRCS += devGeneralTime.c dbRecStd_SRCS += devAiSoftCallback.c dbRecStd_SRCS += devBiSoftCallback.c +devI64inSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devI64inSoftCallback.c dbRecStd_SRCS += devLiSoftCallback.c dbRecStd_SRCS += devMbbiDirectSoftCallback.c diff --git a/modules/database/src/std/dev/devI64inSoft.c b/modules/database/src/std/dev/devI64inSoft.c index 8d4ad90b7..76a049b85 100644 --- a/modules/database/src/std/dev/devI64inSoft.c +++ b/modules/database/src/std/dev/devI64inSoft.c @@ -24,29 +24,9 @@ #include "int64inRecord.h" #include "epicsExport.h" -/* Create the dset for devI64inSoft */ -static long init_record(int64inRecord *prec); -static long read_int64in(int64inRecord *prec); - -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_int64in; -} devI64inSoft = { - 5, - NULL, - NULL, - init_record, - NULL, - read_int64in -}; -epicsExportAddress(dset, devI64inSoft); - -static long init_record(int64inRecord *prec) +static long init_record(dbCommon *common) { + int64inRecord *prec = (int64inRecord *)common; if (recGblInitConstantLink(&prec->inp, DBF_INT64, &prec->val)) prec->udf = FALSE; @@ -76,3 +56,11 @@ static long read_int64in(int64inRecord *prec) return status; } + +/* Create the dset for devI64inSoft */ + +int64indset devI64inSoft = { + { 5, NULL, NULL, init_record, NULL }, read_int64in +}; +epicsExportAddress(dset, devI64inSoft); + diff --git a/modules/database/src/std/dev/devI64inSoftCallback.c b/modules/database/src/std/dev/devI64inSoftCallback.c index 9eb5656bb..d93f8c993 100644 --- a/modules/database/src/std/dev/devI64inSoftCallback.c +++ b/modules/database/src/std/dev/devI64inSoftCallback.c @@ -151,8 +151,9 @@ static long init(int pass) return 0; } -static long init_record(int64inRecord *prec) +static long init_record(dbCommon *common) { + int64inRecord *prec = (int64inRecord *)common; if (recGblInitConstantLink(&prec->inp, DBR_INT64, &prec->val)) prec->udf = FALSE; @@ -204,11 +205,7 @@ static long read_int64in(int64inRecord *prec) } /* Create the dset for devI64inSoftCallback */ -struct { - dset common; - DEVSUPFUN read_int64in; -} devI64inSoftCallback = { - {5, NULL, init, init_record, NULL}, - read_int64in +int64indset devI64inSoftCallback = { + { 5, NULL, init, init_record, NULL }, read_int64in }; epicsExportAddress(dset, devI64inSoftCallback); diff --git a/modules/database/src/std/rec/Makefile b/modules/database/src/std/rec/Makefile index 3f46ae33a..ce2625cd3 100644 --- a/modules/database/src/std/rec/Makefile +++ b/modules/database/src/std/rec/Makefile @@ -25,6 +25,7 @@ stdRecords += dfanoutRecord stdRecords += eventRecord stdRecords += fanoutRecord stdRecords += histogramRecord +int64inRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += int64inRecord stdRecords += int64outRecord stdRecords += longinRecord diff --git a/modules/database/src/std/rec/int64inRecord.c b/modules/database/src/std/rec/int64inRecord.c index 8ce241000..b802f125c 100644 --- a/modules/database/src/std/rec/int64inRecord.c +++ b/modules/database/src/std/rec/int64inRecord.c @@ -83,14 +83,6 @@ rset int64inRSET={ epicsExportAddress(rset,int64inRSET); -struct int64indset { /* int64in input dset */ - long number; - DEVSUPFUN dev_report; - DEVSUPFUN init; - DEVSUPFUN init_record; /*returns: (-1,0)=>(failure,success)*/ - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_int64in; /*returns: (-1,0)=>(failure,success)*/ -}; static void checkAlarms(int64inRecord *prec, epicsTimeStamp *timeLast); static void monitor(int64inRecord *prec); static long readValue(int64inRecord *prec); @@ -113,12 +105,12 @@ static long init_record(dbCommon *pcommon, int pass) return(S_dev_noDSET); } /* must have read_int64in function defined */ - if( (pdset->number < 5) || (pdset->read_int64in == NULL) ) { + if ((pdset->common.number < 5) || (pdset->read_int64in == NULL)) { recGblRecordError(S_dev_missingSup,(void *)prec,"int64in: init_record"); return(S_dev_missingSup); } - if( pdset->init_record ) { - if((status=(*pdset->init_record)(prec))) return(status); + if (pdset->common.init_record) { + if ((status = pdset->common.init_record(pcommon))) return status; } prec->mlst = prec->val; prec->alst = prec->val; diff --git a/modules/database/src/std/rec/int64inRecord.dbd.pod b/modules/database/src/std/rec/int64inRecord.dbd.pod index edb19a73f..c512fc677 100644 --- a/modules/database/src/std/rec/int64inRecord.dbd.pod +++ b/modules/database/src/std/rec/int64inRecord.dbd.pod @@ -111,6 +111,15 @@ monitoring deadband functionality. =cut include "dbCommon.dbd" + %#include "devSup.h" + % + %/* Declare Device Support Entry Table */ + %struct int64inRecord; + %typedef struct int64indset { + % dset common; + % long (*read_int64in)(struct int64inRecord *prec); + %} int64indset; + % field(VAL,DBF_INT64) { prompt("Current value") promptgroup("40 - Input") From b1b51cc70e737f3e56303088525e066348a4ac80 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 16 Nov 2019 23:02:34 -0600 Subject: [PATCH 030/216] Export and use int64outdset, set USE_TYPED_DSET --- modules/database/src/std/dev/Makefile | 2 ++ modules/database/src/std/dev/devI64outSoft.c | 29 +++++-------------- .../src/std/dev/devI64outSoftCallback.c | 25 ++++------------ modules/database/src/std/rec/Makefile | 1 + modules/database/src/std/rec/int64outRecord.c | 14 ++------- .../src/std/rec/int64outRecord.dbd.pod | 9 ++++++ 6 files changed, 29 insertions(+), 51 deletions(-) diff --git a/modules/database/src/std/dev/Makefile b/modules/database/src/std/dev/Makefile index 4e023abbd..40f68b8f1 100644 --- a/modules/database/src/std/dev/Makefile +++ b/modules/database/src/std/dev/Makefile @@ -30,6 +30,7 @@ dbRecStd_SRCS += devEventSoft.c dbRecStd_SRCS += devHistogramSoft.c devI64inSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devI64inSoft.c +devI64outSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devI64outSoft.c dbRecStd_SRCS += devLiSoft.c dbRecStd_SRCS += devLoSoft.c @@ -65,6 +66,7 @@ dbRecStd_SRCS += devSiSoftCallback.c dbRecStd_SRCS += devAoSoftCallback.c dbRecStd_SRCS += devBoSoftCallback.c dbRecStd_SRCS += devCalcoutSoftCallback.c +devI64outSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devI64outSoftCallback.c dbRecStd_SRCS += devLoSoftCallback.c devLsoSoftCallback_CFLAGS += -DUSE_TYPED_DSET diff --git a/modules/database/src/std/dev/devI64outSoft.c b/modules/database/src/std/dev/devI64outSoft.c index f9ac70a7e..f94b90855 100644 --- a/modules/database/src/std/dev/devI64outSoft.c +++ b/modules/database/src/std/dev/devI64outSoft.c @@ -25,27 +25,7 @@ #include "int64outRecord.h" #include "epicsExport.h" -/* Create the dset for devI64outSoft */ -static long init_record(int64outRecord *prec); -static long write_int64out(int64outRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_int64out; -} devI64outSoft = { - 5, - NULL, - NULL, - init_record, - NULL, - write_int64out -}; -epicsExportAddress(dset, devI64outSoft); - -static long init_record(int64outRecord *prec) +static long init_record(dbCommon *common) { return 0; } @@ -55,3 +35,10 @@ static long write_int64out(int64outRecord *prec) dbPutLink(&prec->out, DBR_INT64, &prec->val,1); return 0; } + +/* Create the dset for devI64outSoft */ +int64outdset devI64outSoft = { + { 5, NULL, NULL, init_record, NULL }, write_int64out +}; +epicsExportAddress(dset, devI64outSoft); + diff --git a/modules/database/src/std/dev/devI64outSoftCallback.c b/modules/database/src/std/dev/devI64outSoftCallback.c index e8041a26f..3ad717da3 100644 --- a/modules/database/src/std/dev/devI64outSoftCallback.c +++ b/modules/database/src/std/dev/devI64outSoftCallback.c @@ -25,25 +25,6 @@ #include "int64outRecord.h" #include "epicsExport.h" -/* Create the dset for devI64outSoftCallback */ -static long write_int64out(int64outRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_int64out; -} devI64outSoftCallback = { - 5, - NULL, - NULL, - NULL, - NULL, - write_int64out -}; -epicsExportAddress(dset, devI64outSoftCallback); - static long write_int64out(int64outRecord *prec) { struct link *plink = &prec->out; @@ -60,3 +41,9 @@ static long write_int64out(int64outRecord *prec) return status; } + +/* Create the dset for devI64outSoftCallback */ +int64outdset devI64outSoftCallback = { + { 5, NULL, NULL, NULL, NULL }, write_int64out +}; +epicsExportAddress(dset, devI64outSoftCallback); diff --git a/modules/database/src/std/rec/Makefile b/modules/database/src/std/rec/Makefile index ce2625cd3..2d1cfe67b 100644 --- a/modules/database/src/std/rec/Makefile +++ b/modules/database/src/std/rec/Makefile @@ -27,6 +27,7 @@ stdRecords += fanoutRecord stdRecords += histogramRecord int64inRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += int64inRecord +int64outRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += int64outRecord stdRecords += longinRecord stdRecords += longoutRecord diff --git a/modules/database/src/std/rec/int64outRecord.c b/modules/database/src/std/rec/int64outRecord.c index e9170f9a9..cbacb2739 100644 --- a/modules/database/src/std/rec/int64outRecord.c +++ b/modules/database/src/std/rec/int64outRecord.c @@ -80,14 +80,6 @@ rset int64outRSET={ epicsExportAddress(rset,int64outRSET); -struct int64outdset { /* int64out input dset */ - long number; - DEVSUPFUN dev_report; - DEVSUPFUN init; - DEVSUPFUN init_record; /*returns: (-1,0)=>(failure,success)*/ - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_int64out;/*(-1,0)=>(failure,success*/ -}; static void checkAlarms(int64outRecord *prec); static void monitor(int64outRecord *prec); static long writeValue(int64outRecord *prec); @@ -109,7 +101,7 @@ static long init_record(dbCommon *pcommon, int pass) return(S_dev_noDSET); } /* must have write_int64out functions defined */ - if( (pdset->number < 5) || (pdset->write_int64out == NULL) ) { + if ((pdset->common.number < 5) || (pdset->write_int64out == NULL)) { recGblRecordError(S_dev_missingSup,(void *)prec,"int64out: init_record"); return(S_dev_missingSup); } @@ -117,8 +109,8 @@ static long init_record(dbCommon *pcommon, int pass) if(recGblInitConstantLink(&prec->dol,DBF_INT64,&prec->val)) prec->udf=FALSE; } - if( pdset->init_record ) { - if((status=(*pdset->init_record)(prec))) return(status); + if (pdset->common.init_record) { + if ((status = pdset->common.init_record(pcommon))) return status; } prec->mlst = prec->val; prec->alst = prec->val; diff --git a/modules/database/src/std/rec/int64outRecord.dbd.pod b/modules/database/src/std/rec/int64outRecord.dbd.pod index 1b5003efe..2f0fb346a 100644 --- a/modules/database/src/std/rec/int64outRecord.dbd.pod +++ b/modules/database/src/std/rec/int64outRecord.dbd.pod @@ -137,6 +137,15 @@ monitoring deadband functionality. =cut include "dbCommon.dbd" + %#include "devSup.h" + % + %/* Declare Device Support Entry Table */ + %struct int64outRecord; + %typedef struct int64outdset { + % dset common; + % long (*write_int64out)(struct int64outRecord *prec); + %} int64outdset; + % field(VAL,DBF_INT64) { prompt("Desired Output") promptgroup("50 - Output") From 45c7039a45f801cea2ee489c813e1a8927840ebe Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 23 Nov 2019 22:23:47 -0600 Subject: [PATCH 031/216] Add HAS_dset macros to allow detection External device support that must also build against earlier Base versions can use these to determine whether they need so declare their own dset structures for each record type. --- modules/database/src/std/rec/int64inRecord.dbd.pod | 1 + modules/database/src/std/rec/int64outRecord.dbd.pod | 1 + modules/database/src/std/rec/lsiRecord.dbd | 1 + modules/database/src/std/rec/lsoRecord.dbd | 1 + modules/database/src/std/rec/printfRecord.dbd | 1 + 5 files changed, 5 insertions(+) diff --git a/modules/database/src/std/rec/int64inRecord.dbd.pod b/modules/database/src/std/rec/int64inRecord.dbd.pod index c512fc677..c690c8105 100644 --- a/modules/database/src/std/rec/int64inRecord.dbd.pod +++ b/modules/database/src/std/rec/int64inRecord.dbd.pod @@ -119,6 +119,7 @@ monitoring deadband functionality. % dset common; % long (*read_int64in)(struct int64inRecord *prec); %} int64indset; + %#define HAS_int64indset % field(VAL,DBF_INT64) { prompt("Current value") diff --git a/modules/database/src/std/rec/int64outRecord.dbd.pod b/modules/database/src/std/rec/int64outRecord.dbd.pod index 2f0fb346a..00fe822bb 100644 --- a/modules/database/src/std/rec/int64outRecord.dbd.pod +++ b/modules/database/src/std/rec/int64outRecord.dbd.pod @@ -145,6 +145,7 @@ monitoring deadband functionality. % dset common; % long (*write_int64out)(struct int64outRecord *prec); %} int64outdset; + %#define HAS_int64outdset % field(VAL,DBF_INT64) { prompt("Desired Output") diff --git a/modules/database/src/std/rec/lsiRecord.dbd b/modules/database/src/std/rec/lsiRecord.dbd index 7d885987b..a3ce1deee 100644 --- a/modules/database/src/std/rec/lsiRecord.dbd +++ b/modules/database/src/std/rec/lsiRecord.dbd @@ -15,6 +15,7 @@ recordtype(lsi) { % dset common; % long (*read_string)(struct lsiRecord *prec); %} lsidset; + %#define HAS_lsidset % field(VAL,DBF_NOACCESS) { prompt("Current Value") diff --git a/modules/database/src/std/rec/lsoRecord.dbd b/modules/database/src/std/rec/lsoRecord.dbd index 50cc6f29c..2011bb66d 100644 --- a/modules/database/src/std/rec/lsoRecord.dbd +++ b/modules/database/src/std/rec/lsoRecord.dbd @@ -15,6 +15,7 @@ recordtype(lso) { % dset common; % long (*write_string)(struct lsoRecord *prec); %} lsodset; + %#define HAS_lsodset % field(VAL,DBF_NOACCESS) { prompt("Current Value") diff --git a/modules/database/src/std/rec/printfRecord.dbd b/modules/database/src/std/rec/printfRecord.dbd index 6cdbc73c4..c0f4095dd 100644 --- a/modules/database/src/std/rec/printfRecord.dbd +++ b/modules/database/src/std/rec/printfRecord.dbd @@ -15,6 +15,7 @@ recordtype(printf) { % dset common; % long (*write_string)(struct printfRecord *prec); %} printfdset; + %#define HAS_printfdset % field(VAL,DBF_NOACCESS) { prompt("Result") From 6eaef183475c786df88ac544b923d8cbe07a450d Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 28 Nov 2019 00:56:00 -0600 Subject: [PATCH 032/216] Remove duplicated include line --- modules/database/src/std/rec/int64inRecord.dbd.pod | 1 - modules/database/src/std/rec/int64outRecord.dbd.pod | 1 - modules/database/src/std/rec/lsiRecord.dbd | 1 - modules/database/src/std/rec/lsoRecord.dbd | 1 - modules/database/src/std/rec/printfRecord.dbd | 1 - 5 files changed, 5 deletions(-) diff --git a/modules/database/src/std/rec/int64inRecord.dbd.pod b/modules/database/src/std/rec/int64inRecord.dbd.pod index c690c8105..01dc2899a 100644 --- a/modules/database/src/std/rec/int64inRecord.dbd.pod +++ b/modules/database/src/std/rec/int64inRecord.dbd.pod @@ -111,7 +111,6 @@ monitoring deadband functionality. =cut include "dbCommon.dbd" - %#include "devSup.h" % %/* Declare Device Support Entry Table */ %struct int64inRecord; diff --git a/modules/database/src/std/rec/int64outRecord.dbd.pod b/modules/database/src/std/rec/int64outRecord.dbd.pod index 00fe822bb..78244fb42 100644 --- a/modules/database/src/std/rec/int64outRecord.dbd.pod +++ b/modules/database/src/std/rec/int64outRecord.dbd.pod @@ -137,7 +137,6 @@ monitoring deadband functionality. =cut include "dbCommon.dbd" - %#include "devSup.h" % %/* Declare Device Support Entry Table */ %struct int64outRecord; diff --git a/modules/database/src/std/rec/lsiRecord.dbd b/modules/database/src/std/rec/lsiRecord.dbd index a3ce1deee..4bc30809f 100644 --- a/modules/database/src/std/rec/lsiRecord.dbd +++ b/modules/database/src/std/rec/lsiRecord.dbd @@ -7,7 +7,6 @@ recordtype(lsi) { include "dbCommon.dbd" - %#include "devSup.h" % %/* Declare Device Support Entry Table */ %struct lsiRecord; diff --git a/modules/database/src/std/rec/lsoRecord.dbd b/modules/database/src/std/rec/lsoRecord.dbd index 2011bb66d..345885e2e 100644 --- a/modules/database/src/std/rec/lsoRecord.dbd +++ b/modules/database/src/std/rec/lsoRecord.dbd @@ -7,7 +7,6 @@ recordtype(lso) { include "dbCommon.dbd" - %#include "devSup.h" % %/* Declare Device Support Entry Table */ %struct lsoRecord; diff --git a/modules/database/src/std/rec/printfRecord.dbd b/modules/database/src/std/rec/printfRecord.dbd index c0f4095dd..b13608f8c 100644 --- a/modules/database/src/std/rec/printfRecord.dbd +++ b/modules/database/src/std/rec/printfRecord.dbd @@ -7,7 +7,6 @@ recordtype(printf) { include "dbCommon.dbd" - %#include "devSup.h" % %/* Declare Device Support Entry Table */ %struct printfRecord; From 5407a25775a5f400203c4d979c9f313ebfbee60b Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 30 Nov 2019 00:17:23 -0600 Subject: [PATCH 033/216] Export and use aidset, set USE_TYPED_DSET I did ai so I can use it as an example in the Release Notes. --- modules/database/src/std/dev/Makefile | 7 +++++- modules/database/src/std/dev/devAiSoft.c | 25 ++++++------------- .../database/src/std/dev/devAiSoftCallback.c | 14 ++++------- modules/database/src/std/dev/devAiSoftRaw.c | 25 ++++++------------- modules/database/src/std/dev/devGeneralTime.c | 21 ++++++++-------- modules/database/src/std/dev/devTimestamp.c | 12 ++++----- modules/database/src/std/rec/Makefile | 1 + modules/database/src/std/rec/aiRecord.c | 19 +++----------- modules/database/src/std/rec/aiRecord.dbd.pod | 10 ++++++++ 9 files changed, 56 insertions(+), 78 deletions(-) diff --git a/modules/database/src/std/dev/Makefile b/modules/database/src/std/dev/Makefile index 40f68b8f1..bd1add3ee 100644 --- a/modules/database/src/std/dev/Makefile +++ b/modules/database/src/std/dev/Makefile @@ -15,7 +15,9 @@ DBD += devSoft.dbd dbRecStd_SRCS += devAaiSoft.c dbRecStd_SRCS += devAaoSoft.c +devAiSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devAiSoft.c +devAiSoftRaw_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devAiSoftRaw.c dbRecStd_SRCS += devAoSoft.c dbRecStd_SRCS += devAoSoftRaw.c @@ -52,8 +54,8 @@ dbRecStd_SRCS += devSASoft.c dbRecStd_SRCS += devSiSoft.c dbRecStd_SRCS += devSoSoft.c dbRecStd_SRCS += devWfSoft.c -dbRecStd_SRCS += devGeneralTime.c +devAiSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devAiSoftCallback.c dbRecStd_SRCS += devBiSoftCallback.c devI64inSoftCallback_CFLAGS += -DUSE_TYPED_DSET @@ -77,6 +79,9 @@ devPrintfSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devPrintfSoftCallback.c dbRecStd_SRCS += devSoSoftCallback.c +devGeneralTime_CFLAGS += -DUSE_TYPED_DSET +dbRecStd_SRCS += devGeneralTime.c +devTimestamp_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devTimestamp.c devStdio_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devStdio.c diff --git a/modules/database/src/std/dev/devAiSoft.c b/modules/database/src/std/dev/devAiSoft.c index 0ecc1b13f..136c7f5fe 100644 --- a/modules/database/src/std/dev/devAiSoft.c +++ b/modules/database/src/std/dev/devAiSoft.c @@ -26,30 +26,19 @@ #include "epicsExport.h" /* Create the dset for devAiSoft */ -static long init_record(aiRecord *prec); +static long init_record(dbCommon *pcommon); static long read_ai(aiRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_ai; - DEVSUPFUN special_linconv; -} devAiSoft = { - 6, - NULL, - NULL, - init_record, - NULL, - read_ai, - NULL +aidset devAiSoft = { + {6, NULL, NULL, init_record, NULL}, + read_ai, NULL }; epicsExportAddress(dset, devAiSoft); -static long init_record(aiRecord *prec) +static long init_record(dbCommon *pcommon) { + aiRecord *prec = (aiRecord *)pcommon; + if (recGblInitConstantLink(&prec->inp, DBF_DOUBLE, &prec->val)) prec->udf = FALSE; diff --git a/modules/database/src/std/dev/devAiSoftCallback.c b/modules/database/src/std/dev/devAiSoftCallback.c index 8bf6385e1..4eca6b562 100644 --- a/modules/database/src/std/dev/devAiSoftCallback.c +++ b/modules/database/src/std/dev/devAiSoftCallback.c @@ -153,8 +153,10 @@ static long init(int pass) return 0; } -static long init_record(aiRecord *prec) +static long init_record(dbCommon *pcommon) { + aiRecord *prec = (aiRecord *)pcommon; + if (recGblInitConstantLink(&prec->inp, DBF_DOUBLE, &prec->val)) prec->udf = FALSE; @@ -213,14 +215,8 @@ static long read_ai(aiRecord *prec) return 2; } -/* Create the dset for devAiSoftCallback */ -struct { - dset common; - DEVSUPFUN read_ai; - DEVSUPFUN special_linconv; -} devAiSoftCallback = { +aidset devAiSoftCallback = { {6, NULL, init, init_record, NULL}, - read_ai, - NULL + read_ai, NULL }; epicsExportAddress(dset, devAiSoftCallback); diff --git a/modules/database/src/std/dev/devAiSoftRaw.c b/modules/database/src/std/dev/devAiSoftRaw.c index f2cfd5df5..39bf6b956 100644 --- a/modules/database/src/std/dev/devAiSoftRaw.c +++ b/modules/database/src/std/dev/devAiSoftRaw.c @@ -25,30 +25,19 @@ #include "epicsExport.h" /* Create the dset for devAiSoftRaw */ -static long init_record(aiRecord *prec); +static long init_record(dbCommon *pcommon); static long read_ai(aiRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_ai; - DEVSUPFUN special_linconv; -} devAiSoftRaw = { - 6, - NULL, - NULL, - init_record, - NULL, - read_ai, - NULL +aidset devAiSoftRaw = { + {6, NULL, NULL, init_record, NULL}, + read_ai, NULL }; epicsExportAddress(dset, devAiSoftRaw); -static long init_record(aiRecord *prec) +static long init_record(dbCommon *pcommon) { + aiRecord *prec = (aiRecord *)pcommon; + recGblInitConstantLink(&prec->inp, DBF_LONG, &prec->rval); return 0; diff --git a/modules/database/src/std/dev/devGeneralTime.c b/modules/database/src/std/dev/devGeneralTime.c index 1b821d582..c424fb772 100644 --- a/modules/database/src/std/dev/devGeneralTime.c +++ b/modules/database/src/std/dev/devGeneralTime.c @@ -50,8 +50,9 @@ static struct ai_channel { {"TIME", getCurrentTime}, }; -static long init_ai(aiRecord *prec) +static long init_ai(dbCommon *pcommon) { + aiRecord *prec = (aiRecord *)pcommon; int i; if (prec->inp.type != INST_IO) { @@ -91,12 +92,9 @@ static long read_ai(aiRecord *prec) return -1; } -struct { - dset common; - DEVSUPFUN read_write; - DEVSUPFUN special_linconv; -} devAiGeneralTime = { - {6, NULL, NULL, init_ai, NULL}, read_ai, NULL +aidset devAiGeneralTime = { + {6, NULL, NULL, init_ai, NULL}, + read_ai, NULL }; epicsExportAddress(dset, devAiGeneralTime); @@ -114,8 +112,9 @@ static struct bo_channel { {"RSTERRCNT", resetErrors}, }; -static long init_bo(boRecord *prec) +static long init_bo(dbCommon *pcommon) { + boRecord *prec = (boRecord *)pcommon; int i; if (prec->out.type != INST_IO) { @@ -173,8 +172,9 @@ static struct li_channel { {"GETERRCNT", errorCount}, }; -static long init_li(longinRecord *prec) +static long init_li(dbCommon *pcommon) { + longinRecord *prec = (longinRecord *)pcommon; int i; if (prec->inp.type != INST_IO) { @@ -243,8 +243,9 @@ static struct si_channel { {"BESTTEP", eventProvider}, }; -static long init_si(stringinRecord *prec) +static long init_si(dbCommon *pcommon) { + stringinRecord *prec = (stringinRecord *)pcommon; int i; if (prec->inp.type != INST_IO) { diff --git a/modules/database/src/std/dev/devTimestamp.c b/modules/database/src/std/dev/devTimestamp.c index 936d7767d..bcab26629 100644 --- a/modules/database/src/std/dev/devTimestamp.c +++ b/modules/database/src/std/dev/devTimestamp.c @@ -40,12 +40,9 @@ static long read_ai(aiRecord *prec) return 2; } -struct { - dset common; - DEVSUPFUN read_write; - DEVSUPFUN special_linconv; -} devTimestampAI = { - {6, NULL, initAllow, NULL, NULL}, read_ai, NULL +aidset devTimestampAI = { + {6, NULL, initAllow, NULL, NULL}, + read_ai, NULL }; epicsExportAddress(dset, devTimestampAI); @@ -72,6 +69,7 @@ struct { dset common; DEVSUPFUN read_stringin; } devTimestampSI = { - {5, NULL, initAllow, NULL, NULL}, read_stringin + {5, NULL, initAllow, NULL, NULL}, + read_stringin }; epicsExportAddress(dset, devTimestampSI); diff --git a/modules/database/src/std/rec/Makefile b/modules/database/src/std/rec/Makefile index 2d1cfe67b..e6277fb49 100644 --- a/modules/database/src/std/rec/Makefile +++ b/modules/database/src/std/rec/Makefile @@ -13,6 +13,7 @@ SRC_DIRS += $(STDDIR)/rec stdRecords += aaiRecord stdRecords += aaoRecord +aiRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += aiRecord stdRecords += aoRecord stdRecords += aSubRecord diff --git a/modules/database/src/std/rec/aiRecord.c b/modules/database/src/std/rec/aiRecord.c index 0e3593282..512a01287 100644 --- a/modules/database/src/std/rec/aiRecord.c +++ b/modules/database/src/std/rec/aiRecord.c @@ -86,17 +86,6 @@ rset aiRSET={ }; epicsExportAddress(rset,aiRSET); -typedef struct aidset { /* analog input dset */ - long number; - DEVSUPFUN dev_report; - DEVSUPFUN init; - DEVSUPFUN init_record; /*returns: (-1,0)=>(failure,success)*/ - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_ai;/*(0,2)=> success and convert,don't convert)*/ - /* if convert then raw value stored in rval */ - DEVSUPFUN special_linconv; -}aidset; - static void checkAlarms(aiRecord *prec, epicsTimeStamp *lastTime); static void convert(aiRecord *prec); static void monitor(aiRecord *prec); @@ -118,7 +107,7 @@ static long init_record(struct dbCommon *pcommon, int pass) return(S_dev_noDSET); } /* must have read_ai function defined */ - if( (pdset->number < 6) || (pdset->read_ai == NULL) ) { + if ((pdset->common.number < 6) || (pdset->read_ai == NULL)) { recGblRecordError(S_dev_missingSup,(void *)prec,"ai: init_record"); return(S_dev_missingSup); } @@ -128,8 +117,8 @@ static long init_record(struct dbCommon *pcommon, int pass) prec->eoff = prec->egul; } - if( pdset->init_record ) { - long status=(*pdset->init_record)(prec); + if (pdset->common.init_record) { + long status = pdset->common.init_record(pcommon); if (prec->linr == menuConvertSLOPE) { prec->eoff = eoff; prec->eslo = eslo; @@ -190,7 +179,7 @@ static long special(DBADDR *paddr,int after) switch(special_type) { case(SPC_LINCONV): - if(pdset->number<6) { + if (pdset->common.number < 6) { recGblDbaddrError(S_db_noMod,paddr,"ai: special"); return(S_db_noMod); } diff --git a/modules/database/src/std/rec/aiRecord.dbd.pod b/modules/database/src/std/rec/aiRecord.dbd.pod index 3b53b7a24..440d16c0c 100644 --- a/modules/database/src/std/rec/aiRecord.dbd.pod +++ b/modules/database/src/std/rec/aiRecord.dbd.pod @@ -215,6 +215,16 @@ monitoring functionality. =cut include "dbCommon.dbd" + % + %/* Declare Device Support Entry Table */ + %struct aiRecord; + %typedef struct aidset { + % dset common; + % long (*read_ai)(struct aiRecord *prec); + % long (*special_linconv)(struct aiRecord *prec, int after); + %} aidset; + %#define HAS_aidset + % field(VAL,DBF_DOUBLE) { prompt("Current EGU Value") promptgroup("40 - Input") From 4c99a94453007015a9ef0eb319dc2c10dcce60a8 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 30 Nov 2019 01:01:33 -0600 Subject: [PATCH 034/216] Add Release Notes entry about dsets --- documentation/RELEASE_NOTES.md | 100 +++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/documentation/RELEASE_NOTES.md b/documentation/RELEASE_NOTES.md index 2adeacf24..ec5549878 100644 --- a/documentation/RELEASE_NOTES.md +++ b/documentation/RELEASE_NOTES.md @@ -12,6 +12,106 @@ The external PVA submodules each have their own separate set of release notes which should also be read to understand what has changed since an earlier release. +## EPICS Release 7.0.3.2 + + + + +### Record types publish their dset's + +The record types in Base are starting to define the device support entry table +structures in the record header file. While still optional, developers of +external support modules are encouraged to start converting their code to use +the record's definitions instead of the traditional approach of copying the +structure definitions into each source file that needs them. It will still be +possible for converted code to build and work with older Base releases. + +This might also be a good time to modify the device support to use the type-safe +device support entry tables that were introduced in Base-3.16.2 -- see +[#type-safe-device-and-driver-support-tables](this entry below) for the +description of that change, which is also optional for now. + +Look at the aiRecord for example. Near the top of the generated `aiRecord.h` +header file is a new section that declares the `aidset`: + +```C +/* Declare Device Support Entry Table */ +struct aiRecord; +typedef struct aidset { + dset common; + long (*read_ai)(struct aiRecord *prec); + long (*special_linconv)(struct aiRecord *prec, int after); +} aidset; +#define HAS_aidset +``` + +Notice that the common members (`number`, `report()`, `init()`, `init_record()` +and `get_ioint_info()` don't appear directly but are included by embedding the +`dset common` member instead. This avoids the need to have separate definitions +of those members in each record dset, but does require those members to be +wrapped inside another set of braces `{}` when initializing the data structure +for the individual device supports. It also requires changes to code that +references those common members, but that code usually only appears inside the +record type implementation and very rarely in device supports. + +An aiRecord device support that will only be built against this or later +versions of EPICS can now declare its dset like this: + +```C +aidset devAiSoft = { + { 6, NULL, NULL, init_record, NULL }, + read_ai, NULL +}; +epicsExportAddress(dset, devAiSoft); +``` + +However most device support that is not built into EPICS itself will need to +remain compatible with older EPICS versions, which is why the ai record's header +file also declares the preprocessor macro `HAS_aidset`. This makes it easy to +define the `aidset` in the device support code when it's needed, and not when +it's provided in the header: + +```C +#ifndef HAS_aidset +typedef struct aidset { + dset common; + long (*read_ai)(struct aiRecord *prec); + long (*special_linconv)(struct aiRecord *prec, int after); +} aidset; +#endif +aidset devAiSoft = { + { 6, NULL, NULL, init_record, NULL }, + read_ai, NULL +}; +epicsExportAddress(dset, devAiSoft); +``` + +The above `typedef struct` declaration was copied directly from the new +aiRecord.h file and wrapped in the `#ifndef HAS_aidset` conditional. + +This same pattern should be followed for all record types except for the lsi, +lso and printf record types, which have published their device support entry +table structures since they were first added to Base but didn't previously embed +the `dset common` member. Device support for these record types therefore can't +use the dset name since the new definitions are different from the originals +causing a compile error, so this pattern should be used instead: + +```C +#ifndef HAS_lsidset +struct { + dset common; + long (*read_string)(struct lsiRecord *prec); +} +#else +lsidset +#endif +devLsiEtherIP = { + {5, NULL, lsi_init, lsi_init_record, get_ioint_info}, + lsi_read +}; +``` + + ## EPICS Release 7.0.3.1 **IMPORTANT NOTE:** *Some record types in this release will not be compatible From cbe6173417d323f61be3fa163aa101ec0b02c386 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 8 Jan 2020 17:19:25 -0600 Subject: [PATCH 035/216] Updates to the subArrayRecord reference page --- src/std/rec/subArrayRecord.dbd.pod | 55 +++++++++++++++--------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/src/std/rec/subArrayRecord.dbd.pod b/src/std/rec/subArrayRecord.dbd.pod index c47f2d003..086ca583d 100644 --- a/src/std/rec/subArrayRecord.dbd.pod +++ b/src/std/rec/subArrayRecord.dbd.pod @@ -49,7 +49,7 @@ L
for information on specifying links. In addition, the DTYP field must specify a device support module. Currently, the -only device support module is C<<< Soft Channel >>>. +only device support module is C. =fields INP, DTYP @@ -59,13 +59,13 @@ These parameters determine the number of array elements (the array length) and the data type of those elements. The Field Type of Value (FTVL) field determines the data type of the array. -The user specifies the maximum number of elements allowed in the subarray in the -MALM field. Generally, the number should be equal to the number of elements of -the Waveform array (found in the Waveform's NELM field). The MALM field is used -to allocate memory. The subArray's Number of Elements (NELM) field is where the -user specifies the actual number of elements that the subArray will contain. It -should of course be no greater than MALM; if it is, the record processing -routine sets it equal to MALM. +The user specifies the maximum number of elements that can be read into the +subarray in the MALM field. This number should normally be equal to the number +of elements of the Waveform array (found in the Waveform's NELM field). The MALM +field is used to allocate memory. The subArray's Number of Elements (NELM) field +is where the user specifies the actual number of elements that the subArray will +extract. It should of course be no greater than MALM; if it is, the record +processing routine sets it equal to MALM. The INDX field determines the offset of the subArray record's array in relation to the Waveform's. For instance, if INDX is 2, then the subArray will read NELM @@ -83,15 +83,15 @@ display the value and other parameters of the subarray record either textually or graphically. EGU is a string of up to 16 characters describing the engineering units (if any) -of the values which the subArray holds. It is retrieved by the C<<< get_units ->>> record support routine. +of the values which the subArray holds. It is retrieved by the C +record support routine. The HOPR and LOPR fields set the upper and lower display limits for the -sub-array elements. Both the C<<< get_graphic_double >>> and C<<< -get_control_double >>> record support routines retrieve these fields. +sub-array elements. Both the C and C +record support routines retrieve these fields. The PREC field determines the floating point precision with which to display -VAL. It is used whenever the C<<< get_precision >>> record support routine is +VAL. It is used whenever the C record support routine is called. See L @@ -110,9 +110,9 @@ record types. These fields are not configurable by the user. They are used for the record's internal processing or to represent the current state of the record. -The NORD field holds a counter of the number of elements read into the array. It -can be less than NELM even after the array is full if NELM exceeds the number of -existing elements in the referenced array, i.e., the Waveform's array. +The NORD field holds the number of elements that were actually read into the +array. It will be less than NELM whenever the sum of the NELM and INDX fields +exceeds the number of existing elements found in the source array. BPTR contains a pointer to the record's array. @@ -150,14 +150,14 @@ See L. long (*cvt_dbaddr)(struct dbAddr *paddr) -This is called by dbNameToAddr. It makes the dbAddr structure refer to the +This is called by C. It makes the dbAddr structure refer to the actual buffer holding the result. =head4 get_array_info long (*get_array_info)(struct dbAddr *paddr, long *no_elements, long *offset) -Retrieves NELM. +Retrieves NORD. =head4 put_array_info @@ -171,14 +171,14 @@ Sets NORD. For the elements in the array, this routine routines HOPR and LOPR. For the INDX field, this routine returns MALM - 1 and 0. For NELM, it returns MALM and 1. For -other fields, it calls C<<< recGblGetGraphicDouble() >>>. +other fields, it calls C. =head4 get_control_double long (*get_control_double)(struct dbAddr *paddr, struct dbr_ctrlDouble *p) -For array elements, this routine retrieves HOPR and LOPR. Otherwise, C<<< -recGblGetControlDouble() >>> is called. +For array elements, this routine retrieves HOPR and LOPR. Otherwise, +C is called. =head4 get_units @@ -212,13 +212,13 @@ INDX is greater than or equal to MALM it is set to MALM-1. =item 3. -Call device support read routine. This routine is expected to place the desired -sub-array at the beginning of the buffer and set NORD to the number of elements -of the sub-array that were read. +Call the device support's C routine. This routine is expected to +place the desired sub-array at the beginning of the buffer and set NORD to the +number of elements of the sub-array that were read. =item 4. -If PACT has been changed to TRUE, the device support read routine has started +If PACT has been changed to TRUE, the device support read operation has started but has not completed writing the new value. In this case, the processing routine merely returns, leaving PACT TRUE. Otherwise, process sets PACT TRUE at this time. This asynchronous processing logic is not currently used but has been @@ -305,12 +305,11 @@ sub-array were acquired. =head3 Device Support For Soft Records -Only the device support module C<<< Soft Channel >>> is currently provided. The -INP link type must be either DB_LINK or CA_LINK. +Only the device support module C is currently provided. =head4 Soft Channel -INP is expected to point to a waveform record. +INP is expected to point to an array field of a waveform record or similar. =cut From 54cd7e7ba12726564795beadb15217ad2d9b8b67 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 8 Jan 2020 17:21:04 -0600 Subject: [PATCH 036/216] MinGW: Replace -Wno-format with -D__USE_MINGW_ANSI_STDIO --- configure/os/CONFIG.Common.win32-x86-mingw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure/os/CONFIG.Common.win32-x86-mingw b/configure/os/CONFIG.Common.win32-x86-mingw index cb3f53978..7c03781b0 100644 --- a/configure/os/CONFIG.Common.win32-x86-mingw +++ b/configure/os/CONFIG.Common.win32-x86-mingw @@ -30,7 +30,7 @@ ARCH_DEP_LDFLAGS += -m32 # Compiler does not define __unix __unix__ unix # Override for -DUNIX from CONFIG.Common.UnixCommon -OP_SYS_CPPFLAGS = -D_MINGW -Wno-format +OP_SYS_CPPFLAGS = -D_MINGW -D__USE_MINGW_ANSI_STDIO EXE = .exe RES = .coff From dbd6f7e8079bb158b9b30eaec6a60d0327752d6a Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 23 Jan 2020 14:26:33 -0600 Subject: [PATCH 037/216] Adding tests for epicsThreadClass API Two tests are disabled which hang the parent in the epicsThread destuctor --- src/libCom/test/Makefile | 5 + src/libCom/test/epicsThreadClassTest.cpp | 210 +++++++++++++++++++++++ 2 files changed, 215 insertions(+) create mode 100644 src/libCom/test/epicsThreadClassTest.cpp diff --git a/src/libCom/test/Makefile b/src/libCom/test/Makefile index c80339317..58fd4556d 100755 --- a/src/libCom/test/Makefile +++ b/src/libCom/test/Makefile @@ -107,6 +107,11 @@ epicsThreadTest_SRCS += epicsThreadTest.cpp testHarness_SRCS += epicsThreadTest.cpp TESTS += epicsThreadTest +TESTPROD_HOST += epicsThreadClassTest +epicsThreadClassTest_SRCS += epicsThreadClassTest.cpp +testHarness_SRCS += epicsThreadClassTest.cpp +TESTS += epicsThreadClassTest + TESTPROD_HOST += epicsThreadOnceTest epicsThreadOnceTest_SRCS += epicsThreadOnceTest.c testHarness_SRCS += epicsThreadOnceTest.c diff --git a/src/libCom/test/epicsThreadClassTest.cpp b/src/libCom/test/epicsThreadClassTest.cpp new file mode 100644 index 000000000..1dba5ee26 --- /dev/null +++ b/src/libCom/test/epicsThreadClassTest.cpp @@ -0,0 +1,210 @@ +/*************************************************************************\ +* Copyright (c) 2020 UChicago Argonne LLC, as Operator of Argonne +* National Laboratory. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ +/* epicsThreadClassTest.cpp */ + +#include +#include +#include +#include +#include + +#include "dbDefs.h" +#include "epicsAssert.h" +#include "epicsThread.h" +#include "epicsUnitTest.h" +#include "testMain.h" + +/* Key to the char's that define the test case actions: + * + * Upper case letters are for parent thread actions + * B - Parent calls thread->start() and waits for child to start + * D - Parent deletes thread. This waits for child to return if it hasn't yet + * E - Parent calls thread->exitWait(), this may wait for child to return + * S - Parent sleeps for SLEEP_TIME seconds + * T - Parent sends sync trigger to child (w) + * W - Parent waits for sync trigger from child (t) + * X - Parent calls thread->exitWait(0) + * + * Lower case letters are for child thread actions + * d - Child deletes thread + * e - Child calls thread->exitWait() + * r - Child returns + * s - Child sleeps for SLEEP_TIME seconds + * t - Child sends sync trigger to parent (W) + * w - Child waits for sync trigger from child (T) + * + * Note that it is possible to write test cases that can hang, + * segfault, or that trigger errors from thread APIs. + */ + +// The test cases + +const char * const cases[] = { + // These cases don't start the thread: + "D", // Parent deletes thread + "ED", // Parent does exitWait(), deletes thread + + // In these cases the parent deletes the thread + "BrSD", // Child returns; parent deletes thread + "BsDr", // Parent deletes thread; child returns + "BrSED", // Child returns; parent does exitWait(), deletes thread + "BsErD", // Parent does exitWait(); child returns; parent deletes thread + "BsXDr", // Parent does exitWait(0); parent deletes thread; child returns + "BwXTDsr", // Parent does exitWait(0); parent deletes thread; child returns + // These are currently broken +// "BetWSrD", // Child does exitWait(); sync; child returns; parent deletes thread +// "BetWsDr", // Child does exitWait(); sync; parent deletes thread; child returns + + // In these cases the child deletes the thread + "BdrS", // Child deletes thread, returns + "BedrS", // Child does exitWait(), deletes thread, returns + "BwXTSdr", // Parent does exitWait(0); sync; child deletes thread, returns + + NULL // Terminator +}; + +// How long to sleep for while the other thread works +#define SLEEP_TIME 1.0 + +class threadCase: public epicsThreadRunable { +public: + threadCase(const char * const tcase); + virtual ~threadCase(); + virtual void run(); + epicsThread *pthread; + epicsEvent startEvt; + epicsEvent childEvt; + epicsEvent parentEvt; +private: + const char * const name; +}; + +threadCase::threadCase(const char * const tcase) : + pthread(new epicsThread(*this, tcase, + epicsThreadGetStackSize(epicsThreadStackSmall))), + name(tcase) +{ + testDiag("Constructing test case '%s'", name); +} + +threadCase::~threadCase() +{ + testDiag("Destroying test case '%s'", name); +} + +void threadCase::run() +{ + testDiag("Child running for '%s'", name); + startEvt.signal(); + + for (const char * pdo = name; + const char tdo = *pdo; + pdo++) + { + switch (tdo) + { + case 'd': + testDiag("'%c': Child deleting epicsThread", tdo); + delete pthread; + pthread = NULL; + break; + + case 'e': + testDiag("'%c': Child calling exitWait()", tdo); + assert(pthread); + pthread->exitWait(); + break; + + case 's': + testDiag("'%c': Child sleeping", tdo); + epicsThreadSleep(SLEEP_TIME); + break; + + case 't': + testDiag("'%c': Child sending trigger", tdo); + parentEvt.signal(); + break; + + case 'w': + testDiag("'%c': Child awaiting trigger", tdo); + childEvt.wait(); + break; + + case 'r': + testDiag("'%c': Child returning", tdo); + return; + } + } + testFail("Test case '%s' is missing 'r'", name); +} + +MAIN(epicsThreadClassTest) +{ + const int ntests = NELEMENTS(cases); + testPlan(ntests - 1); // The last element is the NULL terminator + + for (const char * const * pcase = cases; + const char * const tcase = *pcase; + pcase++) + { + testDiag("======= Test case '%s' =======", tcase); + threadCase thrCase(tcase); + + for (const char * pdo = tcase; + const char tdo = *pdo; + pdo++) + { + switch (tdo) + { + case 'B': + testDiag("'%c': Parent starting child", tdo); + assert(thrCase.pthread); + thrCase.pthread->start(); + thrCase.startEvt.wait(); + break; + + case 'D': + testDiag("'%c': Parent deleting epicsThread", tdo); + assert(thrCase.pthread); + delete thrCase.pthread; + thrCase.pthread = NULL; + break; + + case 'E': + testDiag("'%c': Parent calling exitWait()", tdo); + assert(thrCase.pthread); + thrCase.pthread->exitWait(); + break; + + case 'X': + testDiag("'%c': Parent calling exitWait(0)", tdo); + assert(thrCase.pthread); + thrCase.pthread->exitWait(0); + break; + + case 'S': + testDiag("'%c': Parent sleeping", tdo); + epicsThreadSleep(SLEEP_TIME); + break; + + case 'T': + testDiag("'%c': Parent sending trigger", tdo); + thrCase.childEvt.signal(); + break; + + case 'W': + testDiag("'%c': Parent awaiting trigger", tdo); + thrCase.parentEvt.wait(); + break; + } + } + + testPass("Test case '%s' passed", tcase); + } + + return testDone(); +} From 5064931aa6e54481832951b4f27a982c5003233d Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 5 Feb 2020 10:32:47 -0800 Subject: [PATCH 038/216] try both to set both SO_REUSEPORT and SO_REUSEADDR It seems that on Linux, SO_REUSEPORT shares with SO_REUSEPORT and SO_REUSEADDR with SO_REUSEADDR, but not each other. Setting both allows full sharing --- .../src/osi/os/posix/osdSockAddrReuse.cpp | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/modules/libcom/src/osi/os/posix/osdSockAddrReuse.cpp b/modules/libcom/src/osi/os/posix/osdSockAddrReuse.cpp index bac6a587e..77b387034 100644 --- a/modules/libcom/src/osi/os/posix/osdSockAddrReuse.cpp +++ b/modules/libcom/src/osi/os/posix/osdSockAddrReuse.cpp @@ -34,23 +34,26 @@ epicsShareFunc void epicsShareAPI } } -#ifdef SO_REUSEPORT -# define X_REUSEUDP SO_REUSEPORT -#else -# define X_REUSEUDP SO_REUSEADDR -#endif - -epicsShareFunc void epicsShareAPI - epicsSocketEnableAddressUseForDatagramFanout ( SOCKET s ) +static +void setfanout(SOCKET s, int opt, const char *optname) { int yes = true; int status; - status = setsockopt ( s, SOL_SOCKET, X_REUSEUDP, + status = setsockopt ( s, SOL_SOCKET, opt, (char *) & yes, sizeof ( yes ) ); if ( status < 0 ) { errlogPrintf ( "epicsSocketEnablePortUseForDatagramFanout: " - "unable to set %s?\n", - (X_REUSEUDP==SO_REUSEADDR)?"SO_REUSEADDR":"SO_REUSEPORT"); + "unable to set %s?\n", optname); } } + +void epicsSocketEnableAddressUseForDatagramFanout ( SOCKET s ) +{ +#define DOIT(sock, opt) setfanout(sock, opt, #opt) +#ifdef SO_REUSEPORT + DOIT(s, SO_REUSEPORT); +#endif + DOIT(s, SO_REUSEADDR); +#undef DOIT +} From db6e7c7a22b73f70a8b93e2aa4b6fa505e0218a6 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 5 Feb 2020 10:30:58 -0800 Subject: [PATCH 039/216] use one osdSockAddrReuse impl for all targets drop win32 specialization of osdSockAddrReuse --- .../src/osi/os/WIN32/osdSockAddrReuse.cpp | 44 ------------------- .../src/osi/os/cygwin32/osdSockAddrReuse.cpp | 44 ------------------- .../{posix => default}/osdSockAddrReuse.cpp | 0 3 files changed, 88 deletions(-) delete mode 100644 modules/libcom/src/osi/os/WIN32/osdSockAddrReuse.cpp delete mode 100644 modules/libcom/src/osi/os/cygwin32/osdSockAddrReuse.cpp rename modules/libcom/src/osi/os/{posix => default}/osdSockAddrReuse.cpp (100%) diff --git a/modules/libcom/src/osi/os/WIN32/osdSockAddrReuse.cpp b/modules/libcom/src/osi/os/WIN32/osdSockAddrReuse.cpp deleted file mode 100644 index d441d7511..000000000 --- a/modules/libcom/src/osi/os/WIN32/osdSockAddrReuse.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -/*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne -* National Laboratory. -* Copyright (c) 2002 The Regents of the University of California, as -* Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. -\*************************************************************************/ - -/* - * Author: Jeff Hill - */ - -#define epicsExportSharedSymbols -#include "osiSock.h" -#include "errlog.h" - -/* - * Note: WINSOCK appears to assign a different functionality for - * SO_REUSEADDR compared to other OS. With WINSOCK SO_REUSEADDR indicates - * that simultaneously servers can bind to the same TCP port on the same host! - * Also, servers are always enabled to reuse a port immediately after - * they exit ( even if SO_REUSEADDR isnt set ). - */ -epicsShareFunc void epicsShareAPI - epicsSocketEnableAddressReuseDuringTimeWaitState ( SOCKET s ) -{ -} - -epicsShareFunc void epicsShareAPI - epicsSocketEnableAddressUseForDatagramFanout ( SOCKET s ) -{ - int yes = true; - int status; - status = setsockopt ( s, SOL_SOCKET, SO_REUSEADDR, - (char *) & yes, sizeof ( yes ) ); - if ( status < 0 ) { - errlogPrintf ( - "epicsSocketEnablePortUseForDatagramFanout: " - "unable to set SO_REUSEADDR?\n"); - } -} diff --git a/modules/libcom/src/osi/os/cygwin32/osdSockAddrReuse.cpp b/modules/libcom/src/osi/os/cygwin32/osdSockAddrReuse.cpp deleted file mode 100644 index d441d7511..000000000 --- a/modules/libcom/src/osi/os/cygwin32/osdSockAddrReuse.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -/*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne -* National Laboratory. -* Copyright (c) 2002 The Regents of the University of California, as -* Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. -\*************************************************************************/ - -/* - * Author: Jeff Hill - */ - -#define epicsExportSharedSymbols -#include "osiSock.h" -#include "errlog.h" - -/* - * Note: WINSOCK appears to assign a different functionality for - * SO_REUSEADDR compared to other OS. With WINSOCK SO_REUSEADDR indicates - * that simultaneously servers can bind to the same TCP port on the same host! - * Also, servers are always enabled to reuse a port immediately after - * they exit ( even if SO_REUSEADDR isnt set ). - */ -epicsShareFunc void epicsShareAPI - epicsSocketEnableAddressReuseDuringTimeWaitState ( SOCKET s ) -{ -} - -epicsShareFunc void epicsShareAPI - epicsSocketEnableAddressUseForDatagramFanout ( SOCKET s ) -{ - int yes = true; - int status; - status = setsockopt ( s, SOL_SOCKET, SO_REUSEADDR, - (char *) & yes, sizeof ( yes ) ); - if ( status < 0 ) { - errlogPrintf ( - "epicsSocketEnablePortUseForDatagramFanout: " - "unable to set SO_REUSEADDR?\n"); - } -} diff --git a/modules/libcom/src/osi/os/posix/osdSockAddrReuse.cpp b/modules/libcom/src/osi/os/default/osdSockAddrReuse.cpp similarity index 100% rename from modules/libcom/src/osi/os/posix/osdSockAddrReuse.cpp rename to modules/libcom/src/osi/os/default/osdSockAddrReuse.cpp From f0bf61b4cba4eff8ed76cae789454a5e469f17e4 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 13 Jan 2020 11:03:49 -0800 Subject: [PATCH 040/216] rsrv: improve monitor/get error message --- modules/database/src/ioc/rsrv/camessage.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/database/src/ioc/rsrv/camessage.c b/modules/database/src/ioc/rsrv/camessage.c index f54bb4888..10ab5024c 100644 --- a/modules/database/src/ioc/rsrv/camessage.c +++ b/modules/database/src/ioc/rsrv/camessage.c @@ -474,8 +474,8 @@ static void no_read_access_event ( struct client *pClient, } else { send_err ( &pevext->msg, status, pClient, - "server unable to load read access denied response into protocol buffer PV=\"%s max bytes=%u\"", - RECORD_NAME ( pevext->pciu->dbch ), rsrvSizeofLargeBufTCP ); + "server unable to load read access denied response into protocol buffer PV=\"%s\" dbf=%u count=%u avail=%u max bytes=%u", + RECORD_NAME ( pevext->pciu->dbch ), pevext->msg.m_dataType, pevext->msg.m_count, pevext->msg.m_available, rsrvSizeofLargeBufTCP ); } } @@ -516,8 +516,8 @@ static void read_reply ( void *pArg, struct dbChannel *dbch, if ( status != ECA_NORMAL ) { send_err ( &pevext->msg, status, pClient, "server unable to load read (or subscription update) response " - "into protocol buffer PV=\"%s\" max bytes=%u", - RECORD_NAME ( dbch ), rsrvSizeofLargeBufTCP ); + "into protocol buffer PV=\"%s\" dbf=%u count=%ld avail=%u max bytes=%u", + RECORD_NAME ( dbch ), pevext->msg.m_dataType, item_count, pevext->msg.m_available, rsrvSizeofLargeBufTCP ); if ( ! eventsRemaining ) cas_send_bs_msg ( pClient, FALSE ); SEND_UNLOCK ( pClient ); @@ -638,8 +638,8 @@ static int read_action ( caHdrLargeArray *mp, void *pPayloadIn, struct client *p mp->m_dataType, mp->m_count, pciu->cid, mp->m_available, &pPayload ); if ( status != ECA_NORMAL ) { send_err ( mp, status, pClient, - "server unable to load read response into protocol buffer PV=\"%s\" max bytes=%u", - RECORD_NAME ( pciu->dbch ), rsrvSizeofLargeBufTCP ); + "server unable to load read response into protocol buffer PV=\"%s\" dbf=%u count=%u avail=%u max bytes=%u", + RECORD_NAME ( pciu->dbch ), mp->m_dataType, mp->m_count, mp->m_available, rsrvSizeofLargeBufTCP ); SEND_UNLOCK ( pClient ); return RSRV_OK; } From 7b6e48f4e0cffc50b121fb0c5521c634261665ee Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 11 Feb 2020 15:56:20 +0000 Subject: [PATCH 041/216] casw shouldn't use monotonic --- modules/ca/src/client/casw.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ca/src/client/casw.cpp b/modules/ca/src/client/casw.cpp index bdb08e04d..ed1766072 100644 --- a/modules/ca/src/client/casw.cpp +++ b/modules/ca/src/client/casw.cpp @@ -59,7 +59,7 @@ int main ( int argc, char ** argv ) epicsMutex mutex; epicsGuard < epicsMutex > guard ( mutex ); bheFreeStoreMgr bheFreeList; - epicsTime programBeginTime = epicsTime::getMonotonic (); + epicsTime programBeginTime = epicsTime::getCurrent(); bool validCommandLine = false; unsigned interest = 0u; SOCKET sock; @@ -244,7 +244,7 @@ int main ( int argc, char ** argv ) ca_uint32_t beaconNumber = ntohl ( pCurMsg->m_cid ); unsigned protocolRevision = ntohs ( pCurMsg->m_dataType ); - epicsTime currentTime = epicsTime::getMonotonic(); + epicsTime currentTime = epicsTime::getCurrent(); /* * look for it in the hash table From e6810a422484291c317058f7d3b94c6a73f16cd6 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 11 Feb 2020 15:56:59 +0000 Subject: [PATCH 042/216] processTarget() remove unnecessary NULL test psrc and pdst will always be non-NULL --- modules/database/src/ioc/db/dbDbLink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/database/src/ioc/db/dbDbLink.c b/modules/database/src/ioc/db/dbDbLink.c index 0da927139..f2cb0c5b4 100644 --- a/modules/database/src/ioc/db/dbDbLink.c +++ b/modules/database/src/ioc/db/dbDbLink.c @@ -394,7 +394,7 @@ static long processTarget(dbCommon *psrc, dbCommon *pdst) psrc->pact = TRUE; - if (psrc && psrc->ppn) + if (psrc->ppn) dbNotifyAdd(psrc, pdst); if (trace && dbServerClient(context, sizeof(context))) { From 0db8f8ca1ba16cadf9b0ef3c11c5f455bf9a37ed Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 12 Feb 2020 07:45:04 -0600 Subject: [PATCH 043/216] Rename histogramRecord.dbd to .dbd.pod --- src/std/rec/{histogramRecord.dbd => histogramRecord.dbd.pod} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/std/rec/{histogramRecord.dbd => histogramRecord.dbd.pod} (100%) diff --git a/src/std/rec/histogramRecord.dbd b/src/std/rec/histogramRecord.dbd.pod similarity index 100% rename from src/std/rec/histogramRecord.dbd rename to src/std/rec/histogramRecord.dbd.pod From 55ec813908f7027322c30482c83d57cb9041cd35 Mon Sep 17 00:00:00 2001 From: gabadinho Date: Wed, 12 Feb 2020 15:32:13 +0100 Subject: [PATCH 044/216] initial typed-dset changes for ao record --- modules/database/src/std/rec/Makefile | 1 + modules/database/src/std/rec/aoRecord.c | 12 ------------ modules/database/src/std/rec/aoRecord.dbd.pod | 9 +++++++++ 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/modules/database/src/std/rec/Makefile b/modules/database/src/std/rec/Makefile index e6277fb49..e289bc387 100644 --- a/modules/database/src/std/rec/Makefile +++ b/modules/database/src/std/rec/Makefile @@ -14,6 +14,7 @@ SRC_DIRS += $(STDDIR)/rec stdRecords += aaiRecord stdRecords += aaoRecord aiRecord_CFLAGS += -DUSE_TYPED_DSET +aoRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += aiRecord stdRecords += aoRecord stdRecords += aSubRecord diff --git a/modules/database/src/std/rec/aoRecord.c b/modules/database/src/std/rec/aoRecord.c index 6fa65859b..94ad11fd2 100644 --- a/modules/database/src/std/rec/aoRecord.c +++ b/modules/database/src/std/rec/aoRecord.c @@ -83,18 +83,6 @@ rset aoRSET={ get_control_double, get_alarm_double }; -struct aodset { /* analog input dset */ - long number; - DEVSUPFUN dev_report; - DEVSUPFUN init; - DEVSUPFUN init_record; /*returns: (0,2)=>(success,success no convert)*/ - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_ao;/*(0)=>(success ) */ - DEVSUPFUN special_linconv; -}; -epicsExportAddress(rset,aoRSET); - - static void checkAlarms(aoRecord *); static long fetch_value(aoRecord *, double *); static void convert(aoRecord *, double); diff --git a/modules/database/src/std/rec/aoRecord.dbd.pod b/modules/database/src/std/rec/aoRecord.dbd.pod index c54cb2c4f..026805ee7 100644 --- a/modules/database/src/std/rec/aoRecord.dbd.pod +++ b/modules/database/src/std/rec/aoRecord.dbd.pod @@ -269,6 +269,15 @@ information on these fields. =cut include "dbCommon.dbd" + % + %/* Declare Device Support Entry Table */ + %struct aoRecord; + %typedef struct aodset { + % dset common; + % long (*write_ao)(struct aoRecord *prec); + %} aodset; + %#define HAS_aodset + % field(VAL,DBF_DOUBLE) { prompt("Desired Output") promptgroup("50 - Output") From 7a612f952457338b709a7c0d43cbb7acb49c1c57 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 12 Feb 2020 09:25:54 -0600 Subject: [PATCH 045/216] Update to stringout POD from Rolf Keitel Fix spelling of OMSL. Document the stdio device support. --- src/std/rec/stringoutRecord.dbd.pod | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/std/rec/stringoutRecord.dbd.pod b/src/std/rec/stringoutRecord.dbd.pod index 6034641bc..773f0a7bf 100644 --- a/src/std/rec/stringoutRecord.dbd.pod +++ b/src/std/rec/stringoutRecord.dbd.pod @@ -48,7 +48,7 @@ explains how these fields are used. The string output record must specify from where it gets its desired output string. The first field that determines where the desired output originates is -the output mode select (OSML) field, which can have two possible value: C<<< +the output mode select (OMSL) field, which can have two possible value: C<<< closed_loop >>> or C<<< supervisory >>>. If C<<< supervisory >>> is specified, DOL is ignored, the current value of VAL is written, and the VAL can be changed externally via dbPuts at run-time. If C<<< closed_loop >>> is specified, the VAL @@ -80,7 +80,7 @@ for information on specifying links. menu(menuOmsl) } -=head3 Write Parameters +=head3 Output Specification The output link specified in the OUT field specifies where the string output record is to write its string. The link can be a database or channel access @@ -360,6 +360,10 @@ C. write_so calls recGblPutLinkValue to write the current value of VAL. See L. +Device support for DTYP C is provided for writing values to the stdout, stderr, or errlog streams. +C addressing C<@stdout>, C<@stderr> or C<@errlog> is used on the OUT link field to select the desired +stream. + =cut } From a5bae49dabda6981ee1c6b7a24998efa78de0947 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 13 Feb 2020 04:58:06 -0600 Subject: [PATCH 046/216] Rename lsi, lso and printf *Record.dbd to .dbd.pod --- src/std/rec/{lsiRecord.dbd => lsiRecord.dbd.pod} | 0 src/std/rec/{lsoRecord.dbd => lsoRecord.dbd.pod} | 0 src/std/rec/{printfRecord.dbd => printfRecord.dbd.pod} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename src/std/rec/{lsiRecord.dbd => lsiRecord.dbd.pod} (100%) rename src/std/rec/{lsoRecord.dbd => lsoRecord.dbd.pod} (100%) rename src/std/rec/{printfRecord.dbd => printfRecord.dbd.pod} (100%) diff --git a/src/std/rec/lsiRecord.dbd b/src/std/rec/lsiRecord.dbd.pod similarity index 100% rename from src/std/rec/lsiRecord.dbd rename to src/std/rec/lsiRecord.dbd.pod diff --git a/src/std/rec/lsoRecord.dbd b/src/std/rec/lsoRecord.dbd.pod similarity index 100% rename from src/std/rec/lsoRecord.dbd rename to src/std/rec/lsoRecord.dbd.pod diff --git a/src/std/rec/printfRecord.dbd b/src/std/rec/printfRecord.dbd.pod similarity index 100% rename from src/std/rec/printfRecord.dbd rename to src/std/rec/printfRecord.dbd.pod From bfd289e85f4931999b78ee2faaba5a104daa13ac Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 13 Feb 2020 05:11:36 -0600 Subject: [PATCH 047/216] Add converted histogram POD --- src/std/rec/histogramRecord.dbd.pod | 275 +++++++++++++++++++++++++++- 1 file changed, 274 insertions(+), 1 deletion(-) diff --git a/src/std/rec/histogramRecord.dbd.pod b/src/std/rec/histogramRecord.dbd.pod index 075400fc6..a459e08d9 100644 --- a/src/std/rec/histogramRecord.dbd.pod +++ b/src/std/rec/histogramRecord.dbd.pod @@ -6,14 +6,141 @@ # EPICS BASE is distributed subject to a Software License Agreement found # in file LICENSE that is included with this distribution. #************************************************************************* + +=title Histogram Record (histogram) + +The histogram record is used to store frequency counts of a signal into an array +of arbitrary length. The user can configure the range of the signal value that +the array will store. Anything outside this range will be ignored. + +=head2 Parameter Fields + +The record-specific fields are described below. + +=recordtype histogram + +=cut + menu(histogramCMD) { choice(histogramCMD_Read,"Read") choice(histogramCMD_Clear,"Clear") choice(histogramCMD_Start,"Start") choice(histogramCMD_Stop,"Stop") } + recordtype(histogram) { - include "dbCommon.dbd" + +=head3 Read Parameters + +The SVL is the input link where the record reads its value. It can be a +constant, a database link, or a channel access link. If SVL is a database or +channel access link, then SGNL is read from SVL. If SVL is a constant, then SGNL +is initialized with the constant value but can be changed via dbPuts. The C device support module can be specified in the DTYP field. + +The ULIM and LLIM fields determine the usable range of signal values. Any value +of SGNL below LLIM or above ULIM is outside the range and will not be stored in +the array. In the NELM field the user must specify the array size, e.g., the +number of array elements. Each element in the NELM field holds the counts for an +interval of the range of signal counts, the range specified by ULIM and LLIM. +These intervals are determined by dividing the range by NELM: + + (ULIM - LLIM) / NELM. + +=fields SVL, SGNL, DTYP, NELM, ULIM, LLIM + +=head3 Operator Display Parameters + +These parameters are used to present meaningful data to the operator. These +fields are used to display the value and other parameters of the histogram +either textually or graphically. See L for +more on the record name (NAME) and description (DESC) fields. + +=fields NAME, DESC + +=head3 Alarm Parameters + +The Histogram record has the alarm parameters common to all record types. +L lists other fields related to a alarms that are common to all +record types. + +=head3 Monitor Parameters + +The MDEL field implements the monitor count deadband. Only when MCNT is greater +than the value given to MDEL are monitors triggered, MCNT being the number of +counts since the last time the record was processed. If MDEL is -1, everytime +the record is processed, a monitor is triggered regardless. + +If SDEL is greater than 0, it causes a callback routine to be called. The number +specified in SDEL is the callback routines interval. The callback routine is +called every SDEL seconds. The callback routine posts an event if MCNT is +greater than 0. + +=fields MDEL, SDEL + +=head3 Run-time and Simulation Mode Parameters + +These parameters are used by the run-time code for processing the histogram. +They are not configurable by the user prior to run-time. They represent the +current state of the record. Many of them are used to process the histogram more +efficiently. + +The BPTR field contains a pointer to the unsigned long array of frequency +values. The VAL field references this array as well. However, the BPTR field is +not accessible at run-time. + +The MCNT field keeps counts the number of signal counts since the last monitor +was invoked. + +The collections controls field (CMD) is a menu field with five choices: + +=menu histogramCMD + +When CMD is C, the record retrieves its values and adds them to the signal +array. This command will first clear the signal counts which have already been +read when it is first invoked. + +The C command erases the signal counts, setting the elements in the array +back to zero. Afterwards, the CMD field is set back to C. + +The C command simply causes the record to read signal values into the +array. Unlike C, it doesn't clear the array first. + +The C command disables the reading of signal values into the array. + +The C command waits until the C or C command has been issued +to start counting. + +The CSTA or collections status field implements the CMD field choices by +enabling or disabling the reading of values into the histogram array. While +FALSE, no signals are added to the array. While TRUE, signals are read and added +to the array. The field is initialized to TRUE. The C command is the only +command that sets CSTA to FALSE. On the other hand, the C command is the +only command that sets it to TRUE. Thus, C must be invoked after each +C command in order to enable counting; invoking C will not enable +signal counting after C has been invoked. + +A typical use of these fields would be to initialize the CMD field to C +(it is initialized to this command by default), to use the C command to +disable counting when necessary, after which the C command can be invoked +to re-start the signal count. + +The WDTH field is a private field that holds the signal width of the array +elements. For instance, if the LLIM was configured to be 4.0 and ULIM was +configured to be 12.0 and the NELM was set to 4, then the WDTH for each array +would be 2. Thus, it is (ULIM - LLIM) / NELM. + +=fields BPTR, VAL, MCNT, CMD, CSTA, WDTH + +The following fields are used to operate the histogram record in simulation +mode. See L for more information on the +simulation mode fields. + +=fields SIOL, SVAL, SIML, SIMM, SIMS + +=cut + + include "dbCommon.dbd" field(VAL,DBF_NOACCESS) { prompt("Value") asl(ASL0) @@ -141,6 +268,152 @@ recordtype(histogram) { interest(1) prop(YES) } + +=head2 Record Support + +=head3 Record Support Routines + +=head4 init_record + +Using NELM, space for the unsigned long array is allocated and the width WDTH of +the array is calculated. + +This routine initializes SIMM with the value of SIML if SIML type is CONSTANT +link or creates a channel access link if SIML type is PV_LINK. SVAL is likewise +initialized if SIOL is CONSTANT or PV_LINK. + +This routine next checks to see that device support and a device support read +routine are available. If device support includes C, it is +called. + +=head4 process + +See next section. + +=head4 special + +Special is invoked whenever the fields CMD, SGNL, ULIM, or LLIM are changed. + +If SGNL is changed, add_count is called. + +If ULIM or LLIM are changed, WDTH is recalculated and clear_histogram is called. + +If CMD is less or equal to 1, clear_histogram is called and CMD is reset to 0. +If CMD is 2, CSTA is set to TRUE and CMD is reset to 0. If CMD is 3, CSTA is set +to FALSE and CMD is reset to 0. + +clear_histogram zeros out the histogram array. add_count increments the +frequency in the histogram array. + +=head4 cvt_dbaddr + +This is called by dbNameToAddr. It makes the dbAddr structure refer to the +actual buffer holding the array. + +=head4 get_array_info + +Obtains values from the array referenced by VAL. + +=head4 put_array_info + +Writes values into the array referenced by VAL. + +=head3 Record Processing + +Routine process implements the following algorithm: + +=over + +=item 1. + +Check to see that the appropriate device support module exists. If it doesn't, +an error message is issued and processing is terminated with the PACT field set +to TRUE. This ensures that processes will no longer be called for this record. +Thus error storms will not occur. + +=item 2. + +readValue is called. See L for more information + +=item 3. + +If PACT has been changed to TRUE, the device support read routine has started +but has not completed writing the new value. In this case, the processing +routine merely returns, leaving PACT TRUE. + +=item 4. + +Add count to histogram array. + +=item 5. + +Check to see if monitors should be invoked. Alarm monitors are invoked if the +alarm status or severity has changed. Archive and value change monitors are +invoked if MDEL conditions are met. NSEV and NSTA are reset to 0. + +=item 6. + +Scan forward link if necessary, set PACT and INIT to FALSE, and return. + +=back + +=head2 Device Support + +=head3 Fields Of Interest To Device Support + +The device support routines are primarily interested in the following fields: + +=fields PACT, DPVT, UDF, NSEV, NSTA, SVL, SGNL + +=head3 Device Support Routines + +Device support consists of the following routines: + +=head4 long report(int level) + +This optional routine is called by the IOC command C and is passed the +report level that was requested by the user. +It should print a report on the state of the device support to stdout. +The C parameter may be used to output increasingly more detailed +information at higher levels, or to select different types of information with +different levels. +Level zero should print no more than a small summary. + +=head4 long init(int after) + +This optional routine is called twice at IOC initialization time. +The first call happens before any of the C calls are made, with +the integer parameter C set to 0. +The second call happens after all of the C calls have been made, +with C set to 1. + +=head4 init_record + + init_record(precord) + +This routine is called by the record support C routine. It makes +sure that SGNL is a CONSTANT, PV_LINK, DB_LINK, or CA_LINK. It also retrieves a +value for SVL from SGNL. If SGNL is none of the above, an error is generated. + +=head4 read_histogram + + read_histogram(*precord) + +This routine is called by the record support routines. It retrieves a value for +SVL from SGNL. + +=head3 Device Support For Soft Records + +Only the device support module C is currently provided, though +other device support modules may be provided at the user's site. + +=head4 Soft Channel + +The C device support routine retrieves a value from SGNL. SGNL +must be CONSTANT, PV_LINK, DB_LINK, or CA_LINK. + +=cut + } variable(histogramSDELprecision, int) From 538f5321841276704b657f206a0f97a79178e722 Mon Sep 17 00:00:00 2001 From: Karl Vestin Date: Wed, 12 Feb 2020 12:41:50 +0100 Subject: [PATCH 048/216] Added a free statement to release memory allocated for postbuf if the memory allocation for inbuf fails. Resolves an error level issue generated by the Codacy static code analysis. Codacy link: https://app.codacy.com/gh/epics-base/epics-base/file/42098735308/issues/source?bid=16430872&fileBranchId=16430872#l201 Launchpad bug: https://bugs.launchpad.net/epics-base/+bug/1862917 LP: #1862917 --- modules/database/src/std/link/lnkCalc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/database/src/std/link/lnkCalc.c b/modules/database/src/std/link/lnkCalc.c index 6f525059b..5bcc485d7 100644 --- a/modules/database/src/std/link/lnkCalc.c +++ b/modules/database/src/std/link/lnkCalc.c @@ -127,8 +127,8 @@ static jlif_result lnkCalc_integer(jlink *pjlink, long long num) } if (clink->pstate != ps_args) { - return jlif_stop; errlogPrintf("lnkCalc: Unexpected integer %lld\n", num); + return jlif_stop; } if (clink->nArgs == CALCPERFORM_NARGS) { @@ -147,8 +147,8 @@ static jlif_result lnkCalc_double(jlink *pjlink, double num) calc_link *clink = CONTAINER(pjlink, struct calc_link, jlink); if (clink->pstate != ps_args) { - return jlif_stop; errlogPrintf("lnkCalc: Unexpected double %g\n", num); + return jlif_stop; } if (clink->nArgs == CALCPERFORM_NARGS) { @@ -196,8 +196,9 @@ static jlif_result lnkCalc_string(jlink *pjlink, const char *val, size_t len) } inbuf = malloc(len+1); - if(!inbuf) { + if(!inbuf) { errlogPrintf("lnkCalc: Out of memory\n"); + free(postbuf); return jlif_stop; } memcpy(inbuf, val, len); From 66f2a509db9195112b71f4867a5e9fbaba0fb517 Mon Sep 17 00:00:00 2001 From: Karl Vestin Date: Wed, 12 Feb 2020 17:32:58 +0100 Subject: [PATCH 049/216] Added initialization of alarm severity on probe. This value is not used, but should be initialized regardless. This was flagged as an error by the Codacy static code analysis. Codacy link: https://app.codacy.com/gh/epics-base/epics-base/file/42103575016/issues/source?bid=16430872&fileBranchId=16430872#l604 Launchpad bug: https://bugs.launchpad.net/epics-base/+bug/1862918 LP: #1862918 --- modules/database/src/ioc/db/dbChannel.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/database/src/ioc/db/dbChannel.c b/modules/database/src/ioc/db/dbChannel.c index 6db2982d8..bc3c8e421 100644 --- a/modules/database/src/ioc/db/dbChannel.c +++ b/modules/database/src/ioc/db/dbChannel.c @@ -37,6 +37,7 @@ #include "link.h" #include "recSup.h" #include "special.h" +#include "alarm.h" typedef struct parseContext { dbChannel *chan; @@ -601,6 +602,7 @@ long dbChannelOpen(dbChannel *chan) probe.field_type = dbChannelExportType(chan); probe.no_elements = dbChannelElements(chan); probe.field_size = dbChannelFieldSize(chan); + probe.sevr = NO_ALARM; p = probe; /* From 2bcaa5448c7e583a5e4f063c54f930e857cebb06 Mon Sep 17 00:00:00 2001 From: Karl Vestin Date: Wed, 12 Feb 2020 16:28:15 +0100 Subject: [PATCH 050/216] Added null check in modules/ca/src/client/udpiiu.cpp to prevent possible dereferencing of null pointer. Flagged as error by Codacy static code analysis. Codacy link: https://app.codacy.com/gh/epics-base/epics-base/file/42103575495/issues/source?bid=16430872&fileBranchId=16430872#l950 Launchpad bug: https://bugs.launchpad.net/epics-base/+bug/1862916 LP: #1862916 --- modules/ca/src/client/udpiiu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ca/src/client/udpiiu.cpp b/modules/ca/src/client/udpiiu.cpp index fe15f1b69..4efa8ba32 100644 --- a/modules/ca/src/client/udpiiu.cpp +++ b/modules/ca/src/client/udpiiu.cpp @@ -946,7 +946,7 @@ bool udpiiu::pushDatagramMsg ( epicsGuard < epicsMutex > & guard, caHdr * pbufmsg = ( caHdr * ) &this->xmitBuf[this->nBytesInXmitBuf]; *pbufmsg = msg; - if ( extsize ) { + if ( extsize && pExt ) { memcpy ( pbufmsg + 1, pExt, extsize ); if ( extsize != alignedExtSize ) { char *pDest = (char *) ( pbufmsg + 1 ); From 45bbe274e9f13f935a5e31ba2e7cc46e26495e7f Mon Sep 17 00:00:00 2001 From: Aaron Date: Wed, 12 Feb 2020 11:58:32 +0000 Subject: [PATCH 051/216] Error case for NULL arg causing segfault in iocshPersistentString --- modules/libcom/src/iocsh/iocsh.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/libcom/src/iocsh/iocsh.cpp b/modules/libcom/src/iocsh/iocsh.cpp index 8e4d365f9..2341c9b83 100644 --- a/modules/libcom/src/iocsh/iocsh.cpp +++ b/modules/libcom/src/iocsh/iocsh.cpp @@ -314,13 +314,18 @@ cvtArg (const char *filename, int lineno, char *arg, iocshArgBuf *argBuf, break; case iocshArgPersistentString: - argBuf->sval = (char *) malloc(strlen(arg) + 1); - if (argBuf->sval == NULL) { - showError(filename, lineno, "Out of memory"); + if (arg != NULL) { + argBuf->sval = (char *) malloc(strlen(arg) + 1); + if (argBuf->sval == NULL) { + showError(filename, lineno, "Out of memory"); + return 0; + } + strcpy(argBuf->sval, arg); + break; + } else { + showError(filename, lineno, "Unable to copy as provided arg was NULL"); return 0; } - strcpy(argBuf->sval, arg); - break; case iocshArgPdbbase: /* Argument must be missing or 0 or pdbbase */ From 6e0706a3121a56ba395db1fcb28ba58c5c623e81 Mon Sep 17 00:00:00 2001 From: Aaron Date: Wed, 12 Feb 2020 14:54:45 +0000 Subject: [PATCH 052/216] Set argBuff->sval to NULL if arg is NULL --- modules/libcom/src/iocsh/iocsh.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/libcom/src/iocsh/iocsh.cpp b/modules/libcom/src/iocsh/iocsh.cpp index 2341c9b83..97d1101f6 100644 --- a/modules/libcom/src/iocsh/iocsh.cpp +++ b/modules/libcom/src/iocsh/iocsh.cpp @@ -321,11 +321,10 @@ cvtArg (const char *filename, int lineno, char *arg, iocshArgBuf *argBuf, return 0; } strcpy(argBuf->sval, arg); - break; } else { - showError(filename, lineno, "Unable to copy as provided arg was NULL"); - return 0; + argBuf->sval = NULL; } + break; case iocshArgPdbbase: /* Argument must be missing or 0 or pdbbase */ From 6feb1c788d261376d3b14440d0ce2114b3f6acd6 Mon Sep 17 00:00:00 2001 From: Gabriel Fedel Date: Tue, 11 Feb 2020 15:39:42 +0100 Subject: [PATCH 053/216] Add extern C for all c headers This allow that these files could be imported to c++ correctly --- modules/database/src/ioc/db/dbLockPvt.h | 8 ++++++++ modules/database/src/ioc/rsrv/server.h | 8 ++++++++ modules/libcom/RTEMS/epicsMemFs.h | 8 ++++++++ modules/libcom/RTEMS/epicsRtemsInitHooks.h | 9 +++++++++ modules/libcom/src/osi/os/RTEMS/osdVME.h | 8 ++++++++ modules/libcom/src/osi/os/WIN32/osdSock.h | 8 ++++++++ modules/libcom/src/osi/os/vxWorks/camacLib.h | 6 ++++++ modules/libcom/src/pool/poolPriv.h | 8 ++++++++ modules/libcom/src/yajl/yajl_alloc.h | 8 ++++++++ modules/libcom/src/yajl/yajl_buf.h | 8 ++++++++ modules/libcom/src/yajl/yajl_encode.h | 8 ++++++++ modules/libcom/src/yajl/yajl_lex.h | 8 ++++++++ modules/libcom/src/yajl/yajl_parser.h | 7 +++++++ 13 files changed, 102 insertions(+) diff --git a/modules/database/src/ioc/db/dbLockPvt.h b/modules/database/src/ioc/db/dbLockPvt.h index f90d00617..79ccd44d8 100644 --- a/modules/database/src/ioc/db/dbLockPvt.h +++ b/modules/database/src/ioc/db/dbLockPvt.h @@ -86,6 +86,10 @@ struct dbLocker { lockRecordRef refs[DBLOCKER_NALLOC]; /* actual length is maxrefs */ }; +#ifdef __cplusplus +extern "C" { +#endif + /* These are exported for testing only */ epicsShareFunc lockSet* dbLockGetRef(lockRecord *lr); /* lookup lockset and increment ref count */ epicsShareFunc void dbLockIncRef(lockSet* ls); @@ -107,4 +111,8 @@ void dbLockSetSplit(struct dbLocker *locker, struct dbCommon *psource, struct dbCommon *psecond); +#ifdef __cplusplus +} +#endif + #endif /* DBLOCKPVT_H */ diff --git a/modules/database/src/ioc/rsrv/server.h b/modules/database/src/ioc/rsrv/server.h index 6392c692b..e0564d68c 100644 --- a/modules/database/src/ioc/rsrv/server.h +++ b/modules/database/src/ioc/rsrv/server.h @@ -223,6 +223,10 @@ GLBLTYPE unsigned int threadPrios[5]; #define LOCK_CLIENTQ epicsMutexMustLock (clientQlock); #define UNLOCK_CLIENTQ epicsMutexUnlock (clientQlock); +#ifdef __cplusplus +extern "C" { +#endif + void camsgtask (void *client); void cas_send_bs_msg ( struct client *pclient, int lock_needed ); void cas_send_dg_msg ( struct client *pclient ); @@ -259,4 +263,8 @@ void cas_set_header_cid ( struct client *pClient, ca_uint32_t ); void cas_set_header_count (struct client *pClient, ca_uint32_t count); void cas_commit_msg ( struct client *pClient, ca_uint32_t size ); +#ifdef __cplusplus +} +#endif + #endif /*INCLserverh*/ diff --git a/modules/libcom/RTEMS/epicsMemFs.h b/modules/libcom/RTEMS/epicsMemFs.h index c57f4d793..cf4f70322 100644 --- a/modules/libcom/RTEMS/epicsMemFs.h +++ b/modules/libcom/RTEMS/epicsMemFs.h @@ -19,6 +19,14 @@ typedef struct { const epicsMemFile * const *files; } epicsMemFS; +#ifdef __cplusplus +extern "C" { +#endif + int epicsMemFsLoad(const epicsMemFS *fs); +#ifdef __cplusplus +} +#endif + #endif // EPICSMEMFS_H diff --git a/modules/libcom/RTEMS/epicsRtemsInitHooks.h b/modules/libcom/RTEMS/epicsRtemsInitHooks.h index 4313f19e3..d51a10470 100644 --- a/modules/libcom/RTEMS/epicsRtemsInitHooks.h +++ b/modules/libcom/RTEMS/epicsRtemsInitHooks.h @@ -16,6 +16,10 @@ extern char *env_nfsServer; extern char *env_nfsPath; extern char *env_nfsMountPoint; +#ifdef __cplusplus +extern "C" { +#endif + /* * Return 0 for success, non-zero for failure (will cause panic) */ @@ -23,3 +27,8 @@ int epicsRtemsInitPreSetBootConfigFromNVRAM(struct rtems_bsdnet_config *config); int epicsRtemsInitPostSetBootConfigFromNVRAM(struct rtems_bsdnet_config *config); /* Return 0 if local file system was setup, or non-zero (will fall back to network */ int epicsRtemsMountLocalFilesystem(char **argv); + +#ifdef __cplusplus +} +#endif + diff --git a/modules/libcom/src/osi/os/RTEMS/osdVME.h b/modules/libcom/src/osi/os/RTEMS/osdVME.h index 65548abcb..a04cafe6f 100644 --- a/modules/libcom/src/osi/os/RTEMS/osdVME.h +++ b/modules/libcom/src/osi/os/RTEMS/osdVME.h @@ -19,4 +19,12 @@ #endif #endif +#ifdef __cplusplus +extern "C" { +#endif + void bcopyLongs(char *source, char *destination, int nlongs); + +#ifdef __cplusplus +} +#endif diff --git a/modules/libcom/src/osi/os/WIN32/osdSock.h b/modules/libcom/src/osi/os/WIN32/osdSock.h index c1bc1d9b1..d0549bfad 100644 --- a/modules/libcom/src/osi/os/WIN32/osdSock.h +++ b/modules/libcom/src/osi/os/WIN32/osdSock.h @@ -75,6 +75,14 @@ typedef DWORD osiSockOptMcastTTL_t; */ #define FD_IN_FDSET(FD) (1) +#ifdef __cplusplus +extern "C" { +#endif + epicsShareFunc unsigned epicsShareAPI wsaMajorVersion (); +#ifdef __cplusplus +} +#endif /*__cplusplus*/ + #endif /*osdSockH*/ diff --git a/modules/libcom/src/osi/os/vxWorks/camacLib.h b/modules/libcom/src/osi/os/vxWorks/camacLib.h index a30ab5659..49357f934 100644 --- a/modules/libcom/src/osi/os/vxWorks/camacLib.h +++ b/modules/libcom/src/osi/os/vxWorks/camacLib.h @@ -32,6 +32,9 @@ extern struct glob_dat { /********************************/ /* FUNCTION PROTOTYPES */ /********************************/ +#ifdef __cplusplus +extern "C" { +#endif void cdreg(int *ext, int b, int c, int n, int a); void cfsa(int f, int ext, int *dat, int *q); @@ -55,3 +58,6 @@ void csubc(int f, int ext, unsigned short *intc, int cb[4]); void csubr(int f, int ext, int intc[], int cb[4]); void print_reg(int ext); +#ifdef __cplusplus +} +#endif diff --git a/modules/libcom/src/pool/poolPriv.h b/modules/libcom/src/pool/poolPriv.h index 237cedf45..97fdcd8b2 100644 --- a/modules/libcom/src/pool/poolPriv.h +++ b/modules/libcom/src/pool/poolPriv.h @@ -94,6 +94,14 @@ struct epicsJob { unsigned int dead:1; /* flag to catch use of freed objects */ }; +#ifdef __cplusplus +extern "C" { +#endif + int createPoolThread(epicsThreadPool *pool); +#ifdef __cplusplus +} +#endif + #endif // POOLPRIV_H diff --git a/modules/libcom/src/yajl/yajl_alloc.h b/modules/libcom/src/yajl/yajl_alloc.h index 471f76f66..433b16c9d 100644 --- a/modules/libcom/src/yajl/yajl_alloc.h +++ b/modules/libcom/src/yajl/yajl_alloc.h @@ -29,6 +29,14 @@ #define YA_FREE(afs, ptr) (afs)->free((afs)->ctx, (ptr)) #define YA_REALLOC(afs, ptr, sz) (afs)->realloc((afs)->ctx, (ptr), (sz)) +#ifdef __cplusplus +extern "C" { +#endif + YAJL_API void yajl_set_default_alloc_funcs(yajl_alloc_funcs * yaf); +#ifdef __cplusplus +} +#endif + #endif diff --git a/modules/libcom/src/yajl/yajl_buf.h b/modules/libcom/src/yajl/yajl_buf.h index 0ae73aa35..0da2396e1 100644 --- a/modules/libcom/src/yajl/yajl_buf.h +++ b/modules/libcom/src/yajl/yajl_buf.h @@ -33,6 +33,10 @@ */ typedef struct yajl_buf_t * yajl_buf; +#ifdef __cplusplus +extern "C" { +#endif + /* allocate a new buffer */ yajl_buf yajl_buf_alloc(yajl_alloc_funcs * alloc); @@ -54,4 +58,8 @@ size_t yajl_buf_len(yajl_buf buf); /* truncate the buffer */ void yajl_buf_truncate(yajl_buf buf, size_t len); +#ifdef __cplusplus +} +#endif + #endif diff --git a/modules/libcom/src/yajl/yajl_encode.h b/modules/libcom/src/yajl/yajl_encode.h index 28d63958c..2c0559705 100644 --- a/modules/libcom/src/yajl/yajl_encode.h +++ b/modules/libcom/src/yajl/yajl_encode.h @@ -20,6 +20,10 @@ #include "yajl_buf.h" #include "yajl_gen.h" +#ifdef __cplusplus +extern "C" { +#endif + void yajl_string_encode(const yajl_print_t printer, void * ctx, const unsigned char * str, @@ -31,4 +35,8 @@ void yajl_string_decode(yajl_buf buf, const unsigned char * str, int yajl_string_validate_utf8(const unsigned char * s, size_t len); +#ifdef __cplusplus +} +#endif + #endif diff --git a/modules/libcom/src/yajl/yajl_lex.h b/modules/libcom/src/yajl/yajl_lex.h index 40c434427..7a79cd4a1 100644 --- a/modules/libcom/src/yajl/yajl_lex.h +++ b/modules/libcom/src/yajl/yajl_lex.h @@ -47,6 +47,10 @@ typedef enum { typedef struct yajl_lexer_t * yajl_lexer; +#ifdef __cplusplus +extern "C" { +#endif + yajl_lexer yajl_lex_alloc(yajl_alloc_funcs * alloc, unsigned int allowComments, unsigned int validateUTF8); @@ -114,4 +118,8 @@ size_t yajl_lex_current_line(yajl_lexer lexer); * \n or \r */ size_t yajl_lex_current_char(yajl_lexer lexer); +#ifdef __cplusplus +} +#endif + #endif diff --git a/modules/libcom/src/yajl/yajl_parser.h b/modules/libcom/src/yajl/yajl_parser.h index bd5a74dfd..0cf9e98e2 100644 --- a/modules/libcom/src/yajl/yajl_parser.h +++ b/modules/libcom/src/yajl/yajl_parser.h @@ -58,6 +58,10 @@ struct yajl_handle_t { unsigned int flags; }; +#ifdef __cplusplus +extern "C" { +#endif + yajl_status yajl_do_parse(yajl_handle handle, const unsigned char * jsonText, size_t jsonTextLen); @@ -74,5 +78,8 @@ yajl_render_error_string(yajl_handle hand, const unsigned char * jsonText, long long yajl_parse_integer(const unsigned char *number, size_t length); +#ifdef __cplusplus +} +#endif #endif From eb8ca227044a04e025f183b9d22262a532d9d48c Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 13 Feb 2020 08:59:17 -0600 Subject: [PATCH 054/216] Add new POD documentation, from Rolf Keitel Documents the lsi, lso and printf record types. --- src/std/rec/lsiRecord.dbd.pod | 119 +++++++++++++++++ src/std/rec/lsoRecord.dbd.pod | 162 ++++++++++++++++++++++- src/std/rec/printfRecord.dbd.pod | 216 ++++++++++++++++++++++++++++++- 3 files changed, 495 insertions(+), 2 deletions(-) diff --git a/src/std/rec/lsiRecord.dbd.pod b/src/std/rec/lsiRecord.dbd.pod index c50d905d8..bb8b5d712 100644 --- a/src/std/rec/lsiRecord.dbd.pod +++ b/src/std/rec/lsiRecord.dbd.pod @@ -5,7 +5,44 @@ # in file LICENSE that is included with this distribution. #************************************************************************* + +=title Long String Input Record (lsi) + +The long string input record is used to retrieve an arbitrary ASCII string with +a maximum length of 65535 characters. + +=head2 Parameter Fields + +The record-specific fields are described below, grouped by functionality. + +=recordtype lsi + +=cut + recordtype(lsi) { + +=head3 Scan Parameters + +The long string input record has the standard fields for specifying under what +circumstances it will be processed. These fields are listed in L. +In addition, L explains how these fields are used. + +=head3 Input Specification + +The INP field determines where the long string input record obtains its string +from. It can be a database or channel access link, or a constant. If constant, +the VAL field is initialized with the constant and can be changed via dbPuts. +Otherwise, the string is read from the specified location each time the record +is processed and placed in the VAL field. The maximum number of characters in +VAL is given by SIZV, and cannot be larger than 65535. In addition, the +appropriate device support module must be entered into the DTYP field. + +See L
for information on specifying links. + +=fields VAL, OVAL, SIZV, INP, DTYP + +=cut + include "dbCommon.dbd" %#include "devSup.h" % @@ -25,12 +62,18 @@ recordtype(lsi) { pp(TRUE) special(SPC_DBADDR) extra("char *val") + #=type STRING[SIZV] + #=read Yes + #=write Yes } field(OVAL,DBF_NOACCESS) { prompt("Old Value") special(SPC_DBADDR) interest(3) extra("char *oval") + #=type STRING[SIZV] + #=read Yes + #=write No } field(SIZV,DBF_USHORT) { prompt("Size of buffers") @@ -52,6 +95,18 @@ recordtype(lsi) { promptgroup("40 - Input") interest(1) } + +=head3 Monitor Parameters + +These parameters are used to specify when the monitor post should be sent by the +C routine. There are two possible choices: + +APST is used for archiver monitors and MPST for all other type of monitors. + +=fields MPST, APST + +=cut + field(MPST,DBF_MENU) { prompt("Post Value Monitors") promptgroup("80 - Display") @@ -64,6 +119,37 @@ recordtype(lsi) { interest(1) menu(menuPost) } + +=head3 Operator Display Parameters + +See L for more on the record name (NAME) and +description (DESC) fields. + +=fields NAME, DESC + +=head3 Alarm Parameters + +The long string input record has the alarm parameters common to all record +types. L lists other fields related to a alarms that are common to +all record types. + +=head3 Run-time and Simulation Mode Parameters + +The old value field (OVAL) of the long string input record is used to implement +value change monitors for VAL. If VAL is not equal to OVAL, then monitors are +triggered. LEN contains the length of the string in VAL, OLEN contains the +length of the string in OVAL. + +=fields OVAL, LEN, OLEN + + +The following fields are used to operate the string input in the simulation +mode. See L for more information on simulation mode fields. + +=fields SIOL, SIML, SIMM, SIMS + +=cut + field(SIML,DBF_INLINK) { prompt("Simulation Mode Link") promptgroup("90 - Simulate") @@ -86,3 +172,36 @@ recordtype(lsi) { interest(2) } } + + + +=head2 Device Support Interface + +The record requires device support to provide an entry table (dset) which +defines the following members: + + typedef struct { + long number; + long (*report)(int level); + long (*init)(int after); + long (*init_record)(lsiRecord *prec); + long (*get_ioint_info)(int cmd, lsiRecord *prec, IOSCANPVT *piosl); + long (*read_string)(lsiRecord *prec); + } lsidset; + +The module must set C to at least 5, and provide a pointer to its +C routine; the other function pointers may be C if their +associated functionality is not required for this support layer. +Most device supports also provide an C routine to configure the +record instance and connect it to the hardware or driver support layer. + +=head2 Device Support for Soft Records + +A device support module for DTYP C is provided for retrieving +values from other records or other software components. + +Device support for DTYP C is provided for retrieving strings from +environment variables. C addressing C<< @ >> is +used on the C link field to select the desired environment variable. + +=cut diff --git a/src/std/rec/lsoRecord.dbd.pod b/src/std/rec/lsoRecord.dbd.pod index 69203f2d0..63aa4c515 100644 --- a/src/std/rec/lsoRecord.dbd.pod +++ b/src/std/rec/lsoRecord.dbd.pod @@ -5,8 +5,110 @@ # in file LICENSE that is included with this distribution. #************************************************************************* + +=title Long String Output Record (lso) + +The long string output record is used to write an arbitrary ASCII string with a +maximum length of 65535 characters. + +=head2 Parameter Fields + +The record-specific fields are described below, grouped by functionality. + +=recordtype lso + +=cut + +include "menuIvoa.dbd" + recordtype(lso) { - include "dbCommon.dbd" + +=head3 Scan Parameters + +The long string output record has the standard fields for specifying under what +circumstances it will be processed. These fields are listed in L. +In addition, L explains how these fields are used. + +=head3 Desired Output Parameters + +The long string output record must specify from where it gets its desired output +string. The first field that determines where the desired output originates is +the output mode select (OMSL) field, which can have two possible value: +C or C. If C is specified, DOL is +ignored, the current value of VAL is written, and VAL can be changed externally +via dbPuts at run-time. If C is specified, the VAL field's value is +obtained from the address specified in the desired output location field (DOL) +which can be either a database link or a channel access link. + +The maximum number of characters in VAL is given by SIZV, and cannot be larger +than 65535. + +DOL can also be a constant in addition to a link, in which case VAL is +initialized to the constant value. Your string constant, however, may be +interpreted as a CA link name. If you want to initialize your string output +record, it is therefore best to use the VAL field. Note that if DOL is a +constant, OMSL cannot be C. + +See L
for information on specifying links. + +=fields VAL, SIZV, DOL, OMSL + +=head3 Output Specification + +The output link specified in the OUT field specifies where the long string +output record is to write its string. The link can be a database or channel +access link. If the OUT field is a constant, no output will be written. + +See L
for information on specifying links. + +In addition, the appropriate device support module must be entered into the DTYP +field. + + +=fields OUT, DTYP + +=head3 Monitor Parameters + +These parameters are used to specify when the monitor post should be sent by the +C routine. There are two possible choices: + +APST is used for archiver monitors and MPST for all other type of monitors. + +=fields MPST, APST + + +=head3 Operator Display Parameters + +See L for more on the record name (NAME) and +description (DESC) fields. + +=fields NAME, DESC + +=head3 Alarm Parameters + +The long string input record has the alarm parameters common to all record +types. L lists other fields related to a alarms that are common to +all record types. + +The IVOA field specifies an action to take when the INVALID alarm is triggered. +There are three possible actions: + +=head4 Menu menuIvoa + +=menu menuIvoa + +When C<<< Set output to IVOV >>>, the value contained in the IVOV field is +written to the output link during an alarm condition. See +L +for more information on the IVOA and IVOV fields. +L +lists other fields related to a alarms that are common to all record types. + +=fields IVOA, IVOV + +=cut + + include "dbCommon.dbd" %#include "devSup.h" % %/* Declare Device Support Entry Table */ @@ -25,12 +127,18 @@ recordtype(lso) { pp(TRUE) special(SPC_DBADDR) extra("char *val") + #=type STRING[SIZV] + #=read Yes + #=write Yes } field(OVAL,DBF_NOACCESS) { prompt("Previous Value") special(SPC_DBADDR) interest(3) extra("char *oval") + #=type STRING[SIZV] + #=read Yes + #=write No } field(SIZV,DBF_USHORT) { prompt("Size of buffers") @@ -88,6 +196,24 @@ recordtype(lso) { interest(1) menu(menuPost) } + + +=head3 Run-time and Simulation Mode Parameters + +The old value field (OVAL) of the long string input record is used to implement +value change monitors for VAL. If VAL is not equal to OVAL, then monitors are +triggered. LEN contains the length of the string in VAL, OLEN contains the +length of the string in OVAL. + +=fields OVAL, LEN, OLEN + +The following fields are used to operate the string input in the simulation +mode. See L for more information on simulation mode fields. + +=fields SIOL, SIML, SIMM, SIMS + +=cut + field(SIML,DBF_INLINK) { prompt("Sim Mode link") promptgroup("90 - Simulate") @@ -110,3 +236,37 @@ recordtype(lso) { interest(1) } } + + + +=head2 Device Support Interface + +The record requires device support to provide an entry table (dset) which +defines the following members: + + typedef struct { + long number; + long (*report)(int level); + long (*init)(int after); + long (*init_record)(lsoRecord *prec); + long (*get_ioint_info)(int cmd, lsoRecord *prec, IOSCANPVT *piosl); + long (*write_string)(lsoRecord *prec); + } lsodset; + +The module must set C to at least 5, and provide a pointer to its +C routine; the other function pointers may be C if their +associated functionality is not required for this support layer. +Most device supports also provide an C routine to configure the +record instance and connect it to the hardware or driver support layer. + + +=head2 Device Support for Soft Records + +Device support for DTYP C is provided for writing values to other +records or other software components. + +Device support for DTYP C is provided for writing values to the stdout, +stderr, or errlog streams. C addressing C<@stdout>, C<@stderr> or +C<@errlog> is used on the OUT link field to select the desired stream. + +=cut diff --git a/src/std/rec/printfRecord.dbd.pod b/src/std/rec/printfRecord.dbd.pod index 4fd63ef3c..3f4c859c1 100644 --- a/src/std/rec/printfRecord.dbd.pod +++ b/src/std/rec/printfRecord.dbd.pod @@ -2,10 +2,174 @@ # Copyright (c) 2012 UChicago Argonne LLC, as Operator of Argonne # National Laboratory. # EPICS BASE is distributed subject to a Software License Agreement found -# in file LICENSE that is included with this distribution. +# in file LICENSE that is included with this distribution. #************************************************************************* + +=title Printf Record (printf) + +The printf record is used to generate and write a string using a format +specification and parameters, analogous to the C C function. + +=head2 Parameter Fields + +The record-specific fields are described below, grouped by functionality. + +=recordtype printf + +=cut + recordtype(printf) { + +=head3 Scan Parameters + +The printf record has the standard fields for specifying under what +circumstances it will be processed. These fields are listed in L. +In addition, L explains how these fields are used. + +=head3 String Generation Parameters + +The printf record must specify the desired output string with embedded format +specifiers in the FMT field. Plain characters are copied directly to the output +string. A pair of percent characters 'C<%%>' are converted into a single percent +character in the output string. A single precent character 'C<%>' introduces a +format specifier and is followed by zero or more of the standard C +format flags and modifiers: + +=over 4 + +=item * + +Plus ('C<+>') + +=item * + +Minus ('C<->') + +=item * + +Space ('C< >') + +=item * + +Hash ('C<#>') + +=item * + +Minimum Field Width (decimal digits or 'C<*>') + +=item * + +Precision ('C<.>' followed by decimal digits or 'C<*>') + +=item * + +Length Modifier 'C' E Reads link as DBR_CHAR or DBR_UCHAR + +=item * + +Length Modifier 'C' E Reads link as DBR_SHORT or DBR_USHORT for +integer conversions, DBR_FLOAT for floating-point conversions. + +=item * + +Length Modifier 'C' E Reads link as DBR_LONG or DBR_ULONG for integer +conversions, array of DBR_CHAR for string conversion. + +=back + + +The following character specifies the conversion to perform, see your operating +system's C documentation for more details. These conversions +ultimately call the C routine for the actual string conversion +process, so are subject to the behaviour of that routine. + +=over 4 + +=item * + +'C' E Convert to a character. Only single byte characters are +permitted. + +=item * + +'C' or 'C' E Convert to a decimal integer. + +=item * + +'C' E Convert to an unsigned octal integer. + +=item * + +'C' E Convert to an unsigned decimal integer. + +=item * + +'C' E Convert to an unsigned hexadecimal integer, using C. + +=item * + +'C' E Convert to an unsigned hexadecimal integer, using C. + +=item * + +'C' or 'C' E Convert to floating-point in exponent style, reading +the link as DBR_DOUBLE or DBR_FLOAT. + +=item * + +'C' or 'C' E Convert to floating-point in fixed-point style, +reading the link as DBR_DOUBLE or DBR_FLOAT. + +=item * + +'C' or 'C' E Convert to floating-point in general style, reading +the link as DBR_DOUBLE or DBR_FLOAT. + +=item * + +'C' E Insert string, reading the link as DBR_STRING or array of +DBR_CHAR. + +=back + +The fields INP0 ... INP9 are input links that provide the parameter values to be +formatted into the output. The format specifiers in the FMT string determine +which type of the data is requested through the appropriate input link. As with +C a C<*> character may be used in the format to specify width and/or +precision instead of numeric literals, in which case additional input links are +used to provide the necessary integer parameter or parameters. See L
for information on specifying links. + +The formatted string is written to the VAL field. The maximum number of +characters in VAL is given by SIZV, and cannot be larger than 65535. The LEN +field contains the length of the formatted string in the VAL field. + +=fields FMT, INP0, INP1, INP2, INP3, INP4, INP5, INP6, INP7, INP8, INP9, VAL, SIZV, LEN + + +=head3 Output Specification + +The output link specified in the OUT field specifies where the printf record is +to write the contents of its VAL field. The link can be a database or channel +access link. If the OUT field is a constant, no output will be written. + +See L
for information on specifying links. + +In addition, the appropriate device support module must be entered into the DTYP +field. + +=fields OUT, DTYP + +=head3 Operator Display Parameters + +See L for more on the record name (NAME) and +description (DESC) fields. + +=fields NAME, DESC + +=cut + include "dbCommon.dbd" %#include "devSup.h" % @@ -25,6 +189,9 @@ recordtype(printf) { pp(TRUE) special(SPC_DBADDR) extra("char *val") + #=type STRING[SIZV] + #=read Yes + #=write Yes } field(SIZV,DBF_USHORT) { prompt("Size of VAL buffer") @@ -48,6 +215,21 @@ recordtype(printf) { pp(TRUE) size(81) } + + +=head3 Alarm Parameters + +The printf record has the alarm parameters common to all record types. +L lists other fields related to a alarms that are common to all +record types. + +The IVLS field specifies a string which is sent to the OUT link if if input +link data are invalid. + +=fields IVLS + +=cut + field(IVLS,DBF_STRING) { prompt("Invalid Link String") promptgroup("30 - Action") @@ -107,3 +289,35 @@ recordtype(printf) { %/* Number of INPx fields defined */ %#define PRINTF_NLINKS 10 } + + +=head2 Device Support Interface + +The record requires device support to provide an entry table (dset) which +defines the following members: + + typedef struct { + long number; + long (*report)(int level); + long (*init)(int after); + long (*init_record)(printfRecord *prec); + long (*get_ioint_info)(int cmd, printfRecord *prec, IOSCANPVT *piosl); + long (*write_string)(printfRecord *prec); + } printfdset; + +The module must set C to at least 5, and provide a pointer to its +C routine; the other function pointers may be C if their +associated functionality is not required for this support layer. +Most device supports also provide an C routine to configure the +record instance and connect it to the hardware or driver support layer. + +=head2 Device Support for Soft Records + +A soft device support module Soft Channel is provided for writing values to +other records or other software components. + +Device support for DTYP C is provided for writing values to the stdout, +stderr, or errlog streams. C addressing C<@stdout>, C<@stderr> or +C<@errlog> is used on the OUT link field to select the desired stream. + +=cut From 1d9e9ff4f70027b72b4e74e1be5758948bd61493 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 13 Feb 2020 09:06:48 -0600 Subject: [PATCH 055/216] Add new POD output files to RecordReference index --- documentation/RecordReference.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/documentation/RecordReference.md b/documentation/RecordReference.md index 941d6d97b..469c39626 100644 --- a/documentation/RecordReference.md +++ b/documentation/RecordReference.md @@ -15,13 +15,17 @@ The following documentation for the record types and menus include with Base was * [Data Fanout Record (dfanout)](dfanoutRecord.html) * [Event Record (event)](eventRecord.html) * [Fanout Record (fanout)](fanoutRecord.html) +* [Histogram Record (histogram)](histogramRecord.html) * [Long Input Record (longin)](longinRecord.html) * [Long Output Record (longout)](longoutRecord.html) +* [Long String Input Record (lsi)](lsiRecord.html) +* [Long String Output Record (lso)](lsoRecord.html) * [Multi-Bit Binary Input Direct Record (mbbiDirect)](mbbiDirectRecord.html) * [Multi-Bit Binary Input Record (mbbi)](mbbiRecord.html) * [Multi-Bit Binary Output Direct Record (mbboDirect)](mbboDirectRecord.html) * [Multi-Bit Binary Output Record (mbbo)](mbboRecord.html) * [Permissive Record (permissive)](permissiveRecord.html) +* [Printf Record (prinf)](printfRecord.html) * [Select Record (sel)](selRecord.html) * [Sequence Record (seq)](seqRecord.html) * [State Record (state)](stateRecord.html) From 8075b3c316c2673026b9708b32a9fb7a0afbba8b Mon Sep 17 00:00:00 2001 From: Karl Vestin Date: Thu, 13 Feb 2020 15:55:46 +0100 Subject: [PATCH 056/216] Added a null check in epicsWin32ThreadEntry to prevent dereferencing a null pointer in case fetchWin32ThreadGlobal fails. LP: #1863118 --- modules/libcom/src/osi/os/WIN32/osdThread.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/libcom/src/osi/os/WIN32/osdThread.c b/modules/libcom/src/osi/os/WIN32/osdThread.c index 67a64bb9a..5b498a7ea 100644 --- a/modules/libcom/src/osi/os/WIN32/osdThread.c +++ b/modules/libcom/src/osi/os/WIN32/osdThread.c @@ -473,7 +473,11 @@ static unsigned WINAPI epicsWin32ThreadEntry ( LPVOID lpParameter ) /* * CAUTION: !!!! the thread id might continue to be used after this thread exits !!!! */ - TlsSetValue ( pGbl->tlsIndexThreadLibraryEPICS, (void*)0xdeadbeef ); + + if ( pGbl ) { + TlsSetValue ( pGbl->tlsIndexThreadLibraryEPICS, (void*)0xdeadbeef ); + } + epicsParmCleanupWIN32 ( pParm ); return retStat; /* this indirectly closes the thread handle */ From 754eb733345a2d9b0982f37b213a5afe9f7c7907 Mon Sep 17 00:00:00 2001 From: gabadinho Date: Thu, 13 Feb 2020 17:40:22 +0100 Subject: [PATCH 057/216] - Record updates: . aoRecord . biRecord . boRecord . mbbiRecord . mbbiDirectRecord . mbboRecord . mbboDirectRecord . longinRecord . longoutRecord . stringoutRecord . stringinRecord . waveformRecord . calcoutRecord . subArrayRecord - Device support updates: . devAoSoft, devAoSoftCallback, devAoSoftRaw (aoRecord) . devBiSoft, devBiSoftCallback, devBiSoftRaw, devBiDbState (biRecord) . devBoSoft, devBoSoftCallback, devBoSoftRaw, devBoDbState, devGeneralTime (boRecord) . devMbbiSoft, devMbbiSoftCallback, devMbbiSoftRaw (mbbiRecord) . devMbboSoft, devMbboSoftCallback, devMbboSoftRaw (mbboRecord) . devMbbiDirectSoft, devMbbiDirectSoftCallback, devMbbiDirectSoftRaw (mbbiDirectRecord) . devMbboDirectSoft, devMbboDirectSoftCallback, devMbboDirectSoftRaw (mbboDirectRecord) . devGeneralTime, devLiSoft, devLiSoftCallback (longinRecord) . devLoSoft, devLoSoftCallback (longoutRecord) . devSoSoft, devSoSoftCallback, devStdio (stringoutRecord) . devSiSoft, devSiSoftCallback, devEnviron, devGeneralTime, devTimestamp (stringinRecord) . devWfSoft (waveformRecord) . devCalcoutSoft, devCalcoutSoftCallback (recordCalcout) . devSASoft (subArrayRecord) --- modules/database/src/std/dev/Makefile | 33 +++++++++++++++++++ modules/database/src/std/dev/devAoSoft.c | 30 +++++------------ .../database/src/std/dev/devAoSoftCallback.c | 23 ++++--------- modules/database/src/std/dev/devAoSoftRaw.c | 24 ++++---------- modules/database/src/std/dev/devBiDbState.c | 19 +++-------- modules/database/src/std/dev/devBiSoft.c | 21 ++++-------- .../database/src/std/dev/devBiSoftCallback.c | 9 +++-- modules/database/src/std/dev/devBiSoftRaw.c | 21 ++++-------- modules/database/src/std/dev/devBoDbState.c | 19 +++-------- modules/database/src/std/dev/devBoSoft.c | 28 +++++----------- .../database/src/std/dev/devBoSoftCallback.c | 20 +++-------- modules/database/src/std/dev/devBoSoftRaw.c | 27 ++++----------- modules/database/src/std/dev/devCalcoutSoft.c | 12 ++----- .../src/std/dev/devCalcoutSoftCallback.c | 12 ++----- modules/database/src/std/dev/devEnviron.c | 8 ++--- modules/database/src/std/dev/devGeneralTime.c | 25 ++++++-------- modules/database/src/std/dev/devLiSoft.c | 21 ++++-------- .../database/src/std/dev/devLiSoftCallback.c | 9 +++-- modules/database/src/std/dev/devLoSoft.c | 26 +++++---------- .../database/src/std/dev/devLoSoftCallback.c | 21 +++--------- .../database/src/std/dev/devMbbiDirectSoft.c | 21 ++++-------- .../src/std/dev/devMbbiDirectSoftCallback.c | 9 +++-- .../src/std/dev/devMbbiDirectSoftRaw.c | 21 ++++-------- modules/database/src/std/dev/devMbbiSoft.c | 21 ++++-------- .../src/std/dev/devMbbiSoftCallback.c | 11 +++---- modules/database/src/std/dev/devMbbiSoftRaw.c | 21 ++++-------- .../database/src/std/dev/devMbboDirectSoft.c | 5 +-- .../src/std/dev/devMbboDirectSoftCallback.c | 7 ++-- .../src/std/dev/devMbboDirectSoftRaw.c | 9 +++-- modules/database/src/std/dev/devMbboSoft.c | 26 +++++---------- .../src/std/dev/devMbboSoftCallback.c | 20 +++-------- modules/database/src/std/dev/devMbboSoftRaw.c | 9 +++-- modules/database/src/std/dev/devSASoft.c | 20 +++-------- modules/database/src/std/dev/devSiSoft.c | 21 ++++-------- .../database/src/std/dev/devSiSoftCallback.c | 11 +++---- modules/database/src/std/dev/devSoSoft.c | 16 ++------- .../database/src/std/dev/devSoSoftCallback.c | 17 ++-------- modules/database/src/std/dev/devStdio.c | 8 ++--- modules/database/src/std/dev/devTimestamp.c | 5 +-- modules/database/src/std/dev/devWfSoft.c | 20 +++-------- modules/database/src/std/rec/Makefile | 12 +++++++ modules/database/src/std/rec/aoRecord.c | 22 +++++++------ modules/database/src/std/rec/aoRecord.dbd.pod | 5 +-- modules/database/src/std/rec/biRecord.c | 25 +++++--------- modules/database/src/std/rec/biRecord.dbd.pod | 9 +++++ modules/database/src/std/rec/boRecord.c | 22 ++++--------- modules/database/src/std/rec/boRecord.dbd.pod | 9 +++++ modules/database/src/std/rec/calcoutRecord.c | 20 +++-------- .../src/std/rec/calcoutRecord.dbd.pod | 8 +++++ modules/database/src/std/rec/longinRecord.c | 21 ++++-------- .../database/src/std/rec/longinRecord.dbd.pod | 9 +++++ modules/database/src/std/rec/longoutRecord.c | 21 ++++-------- .../src/std/rec/longoutRecord.dbd.pod | 9 +++++ .../database/src/std/rec/mbbiDirectRecord.c | 21 ++++-------- .../src/std/rec/mbbiDirectRecord.dbd.pod | 8 +++++ modules/database/src/std/rec/mbbiRecord.c | 22 ++++--------- .../database/src/std/rec/mbbiRecord.dbd.pod | 8 +++++ .../database/src/std/rec/mbboDirectRecord.c | 22 ++++--------- .../src/std/rec/mbboDirectRecord.dbd.pod | 8 +++++ modules/database/src/std/rec/mbboRecord.c | 23 ++++--------- .../database/src/std/rec/mbboRecord.dbd.pod | 8 +++++ modules/database/src/std/rec/stringinRecord.c | 20 ++++------- .../src/std/rec/stringinRecord.dbd.pod | 9 +++++ .../database/src/std/rec/stringoutRecord.c | 20 ++++------- .../src/std/rec/stringoutRecord.dbd.pod | 9 +++++ modules/database/src/std/rec/subArrayRecord.c | 23 ++++--------- .../src/std/rec/subArrayRecord.dbd.pod | 9 +++++ modules/database/src/std/rec/waveformRecord.c | 22 ++++--------- .../src/std/rec/waveformRecord.dbd.pod | 9 +++++ 69 files changed, 448 insertions(+), 691 deletions(-) diff --git a/modules/database/src/std/dev/Makefile b/modules/database/src/std/dev/Makefile index bd1add3ee..d78f363b8 100644 --- a/modules/database/src/std/dev/Makefile +++ b/modules/database/src/std/dev/Makefile @@ -19,14 +19,21 @@ devAiSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devAiSoft.c devAiSoftRaw_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devAiSoftRaw.c +devAoSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devAoSoft.c +devAoSoftRaw_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devAoSoftRaw.c +devBiSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devBiSoft.c dbRecStd_SRCS += devBiSoftRaw.c +devBiDbState_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devBiDbState.c +devBoSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devBoSoft.c +devBoSoftRaw_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devBoSoftRaw.c dbRecStd_SRCS += devBoDbState.c +devCalcoutSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devCalcoutSoft.c dbRecStd_SRCS += devEventSoft.c dbRecStd_SRCS += devHistogramSoft.c @@ -34,49 +41,75 @@ devI64inSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devI64inSoft.c devI64outSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devI64outSoft.c +devLiSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devLiSoft.c +devLoSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devLoSoft.c devLsiSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devLsiSoft.c devLsoSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devLsoSoft.c +devMbbiDirectSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devMbbiDirectSoft.c +devMbbiDirectSoftRaw_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devMbbiDirectSoftRaw.c +devMbbiSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devMbbiSoft.c +devMbbiSoftRaw_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devMbbiSoftRaw.c +devMbboDirectSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devMbboDirectSoft.c +devMbboDirectSoftRaw_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devMbboDirectSoftRaw.c +devMbboSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devMbboSoft.c +devMbboSoftRaw_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devMbboSoftRaw.c devPrintfSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devPrintfSoft.c +devSASoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devSASoft.c +devSiSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devSiSoft.c +devSoSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devSoSoft.c +devWfSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devWfSoft.c devAiSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devAiSoftCallback.c +devBiSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devBiSoftCallback.c devI64inSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devI64inSoftCallback.c +devLiSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devLiSoftCallback.c +devMbbiDirectSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devMbbiDirectSoftCallback.c +devMbbiCallbackSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devMbbiSoftCallback.c +devSiSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devSiSoftCallback.c +devAoSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devAoSoftCallback.c +devBoSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devBoSoftCallback.c +devCalcoutSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devCalcoutSoftCallback.c devI64outSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devI64outSoftCallback.c +devLoSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devLoSoftCallback.c devLsoSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devLsoSoftCallback.c +devMbboSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devMbboSoftCallback.c +devMbboDirectSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devMbboDirectSoftCallback.c devPrintfSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devPrintfSoftCallback.c +devSoSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devSoSoftCallback.c devGeneralTime_CFLAGS += -DUSE_TYPED_DSET diff --git a/modules/database/src/std/dev/devAoSoft.c b/modules/database/src/std/dev/devAoSoft.c index 56bd05620..8772cdede 100644 --- a/modules/database/src/std/dev/devAoSoft.c +++ b/modules/database/src/std/dev/devAoSoft.c @@ -31,31 +31,17 @@ #include "aoRecord.h" #include "epicsExport.h" -/* added for Channel Access Links */ -static long init_record(aoRecord *prec); - /* Create the dset for devAoSoft */ +static long init_record(dbCommon *pcommon); static long write_ao(aoRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_ao; - DEVSUPFUN special_linconv; -}devAoSoft={ - 6, - NULL, - NULL, - init_record, - NULL, - write_ao, - NULL}; -epicsExportAddress(dset,devAoSoft); - -static long init_record(aoRecord *prec) +aodset devAoSoft = { + {6, NULL, NULL, init_record, NULL}, + write_ao, NULL +}; +epicsExportAddress(dset, devAoSoft); + +static long init_record(dbCommon *pcommon) { long status=0; diff --git a/modules/database/src/std/dev/devAoSoftCallback.c b/modules/database/src/std/dev/devAoSoftCallback.c index c1fb72f13..5144c772a 100644 --- a/modules/database/src/std/dev/devAoSoftCallback.c +++ b/modules/database/src/std/dev/devAoSoftCallback.c @@ -31,23 +31,12 @@ /* Create the dset for devAoSoftCallback */ static long write_ao(aoRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_ao; - DEVSUPFUN special_linconv; -}devAoSoftCallback={ - 6, - NULL, - NULL, - NULL, - NULL, - write_ao, - NULL}; -epicsExportAddress(dset,devAoSoftCallback); + +aodset devAoSoftCallback = { + {6, NULL, NULL, NULL, NULL}, + write_ao, NULL +}; +epicsExportAddress(dset, devAoSoftCallback); static long write_ao(aoRecord *prec) { diff --git a/modules/database/src/std/dev/devAoSoftRaw.c b/modules/database/src/std/dev/devAoSoftRaw.c index 05aed035e..bb2ae7d94 100644 --- a/modules/database/src/std/dev/devAoSoftRaw.c +++ b/modules/database/src/std/dev/devAoSoftRaw.c @@ -33,25 +33,13 @@ /* Create the dset for devAoSoftRaw */ static long write_ao(aoRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_ao; - DEVSUPFUN special_linconv; -}devAoSoftRaw={ - 6, - NULL, - NULL, - NULL, - NULL, - write_ao, - NULL + +aodset devAoSoftRaw = { + {6, NULL, NULL, NULL, NULL}, + write_ao, NULL }; -epicsExportAddress(dset,devAoSoftRaw); - +epicsExportAddress(dset, devAoSoftRaw); + static long write_ao(aoRecord *prec) { long status; diff --git a/modules/database/src/std/dev/devBiDbState.c b/modules/database/src/std/dev/devBiDbState.c index fcb6c8f63..373270ad5 100644 --- a/modules/database/src/std/dev/devBiDbState.c +++ b/modules/database/src/std/dev/devBiDbState.c @@ -69,20 +69,9 @@ static long read_bi(biRecord *prec) return 2; } -static struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_bi; -} devBiDbState = { - 5, - NULL, - init, - NULL, - NULL, - read_bi +/* Create the dset for devBiDbState */ +bidset devBiDbState = { + {5, NULL, init, NULL, NULL}, + read_bi }; - epicsExportAddress(dset, devBiDbState); diff --git a/modules/database/src/std/dev/devBiSoft.c b/modules/database/src/std/dev/devBiSoft.c index 12640ad0c..41a308ae7 100644 --- a/modules/database/src/std/dev/devBiSoft.c +++ b/modules/database/src/std/dev/devBiSoft.c @@ -25,28 +25,19 @@ #include "epicsExport.h" /* Create the dset for devBiSoft */ -static long init_record(biRecord *prec); +static long init_record(dbCommon *pcommon); static long read_bi(biRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_bi; -} devBiSoft = { - 5, - NULL, - NULL, - init_record, - NULL, +bidset devBiSoft = { + {5, NULL, NULL, init_record, NULL}, read_bi }; epicsExportAddress(dset, devBiSoft); -static long init_record(biRecord *prec) +static long init_record(dbCommon *pcommon) { + biRecord *prec = (biRecord *)pcommon; + if (recGblInitConstantLink(&prec->inp, DBF_ENUM, &prec->val)) prec->udf = FALSE; return 0; diff --git a/modules/database/src/std/dev/devBiSoftCallback.c b/modules/database/src/std/dev/devBiSoftCallback.c index 607b1af33..06100714c 100644 --- a/modules/database/src/std/dev/devBiSoftCallback.c +++ b/modules/database/src/std/dev/devBiSoftCallback.c @@ -151,8 +151,10 @@ static long init(int pass) return 0; } -static long init_record(biRecord *prec) +static long init_record(dbCommon *pcommon) { + biRecord *prec = (biRecord *)pcommon; + if (recGblInitConstantLink(&prec->inp, DBR_ENUM, &prec->val)) prec->udf = FALSE; @@ -204,10 +206,7 @@ static long read_bi(biRecord *prec) } /* Create the dset for devBiSoftCallback */ -struct { - dset common; - DEVSUPFUN read_bi; -} devBiSoftCallback = { +bidset devBiSoftCallback = { {5, NULL, init, init_record, NULL}, read_bi }; diff --git a/modules/database/src/std/dev/devBiSoftRaw.c b/modules/database/src/std/dev/devBiSoftRaw.c index a71bf89cb..90fbcbbcc 100644 --- a/modules/database/src/std/dev/devBiSoftRaw.c +++ b/modules/database/src/std/dev/devBiSoftRaw.c @@ -25,28 +25,19 @@ #include "epicsExport.h" /* Create the dset for devBiSoftRaw */ -static long init_record(biRecord *prec); +static long init_record(dbCommon *pcommon); static long read_bi(biRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_bi; -} devBiSoftRaw = { - 5, - NULL, - NULL, - init_record, - NULL, +bidset devBiSoftRaw = { + {5, NULL, NULL, init_record, NULL}, read_bi }; epicsExportAddress(dset, devBiSoftRaw); -static long init_record(biRecord *prec) +static long init_record(dbCommon *pcommon) { + biRecord *prec = (biRecord *)pcommon; + recGblInitConstantLink(&prec->inp, DBF_ULONG, &prec->rval); return 0; diff --git a/modules/database/src/std/dev/devBoDbState.c b/modules/database/src/std/dev/devBoDbState.c index 26e97ae5b..f9a7606c9 100644 --- a/modules/database/src/std/dev/devBoDbState.c +++ b/modules/database/src/std/dev/devBoDbState.c @@ -67,20 +67,9 @@ static long write_bo(boRecord *prec) return 0; } -static struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_bo; -} devBoDbState = { - 5, - NULL, - init, - NULL, - NULL, - write_bo +/* Create the dset for devBoDbState */ +bodset devBoDbState = { + {5, NULL, init, NULL, NULL}, + write_bo }; - epicsExportAddress(dset, devBoDbState); diff --git a/modules/database/src/std/dev/devBoSoft.c b/modules/database/src/std/dev/devBoSoft.c index ba6ff14a7..80ca61b81 100644 --- a/modules/database/src/std/dev/devBoSoft.c +++ b/modules/database/src/std/dev/devBoSoft.c @@ -29,31 +29,19 @@ #include "boRecord.h" #include "epicsExport.h" -static long init_record(boRecord *prec); - /* Create the dset for devBoSoft */ +static long init_record(dbCommon *pcommon); static long write_bo(boRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_bo; -}devBoSoft={ - 5, - NULL, - NULL, - init_record, - NULL, - write_bo +bodset devBoSoft = { + {5, NULL, NULL, init_record, NULL}, + write_bo }; -epicsExportAddress(dset,devBoSoft); - -static long init_record(boRecord *prec) +epicsExportAddress(dset, devBoSoft); + +static long init_record(dbCommon *pcommon) { - + boRecord *prec = (boRecord *)pcommon; long status=0; /* dont convert */ diff --git a/modules/database/src/std/dev/devBoSoftCallback.c b/modules/database/src/std/dev/devBoSoftCallback.c index ffb68e525..93735588b 100644 --- a/modules/database/src/std/dev/devBoSoftCallback.c +++ b/modules/database/src/std/dev/devBoSoftCallback.c @@ -31,22 +31,11 @@ /* Create the dset for devBoCallbackSoft */ static long write_bo(boRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_bo; -}devBoSoftCallback={ - 5, - NULL, - NULL, - NULL, - NULL, - write_bo +bodset devBoSoftCallback = { + {5, NULL, NULL, NULL, NULL}, + write_bo }; -epicsExportAddress(dset,devBoSoftCallback); +epicsExportAddress(dset, devBoSoftCallback); static long write_bo(boRecord *prec) { @@ -64,4 +53,3 @@ static long write_bo(boRecord *prec) return status; } - diff --git a/modules/database/src/std/dev/devBoSoftRaw.c b/modules/database/src/std/dev/devBoSoftRaw.c index df1ba5b4e..b0bd8542a 100644 --- a/modules/database/src/std/dev/devBoSoftRaw.c +++ b/modules/database/src/std/dev/devBoSoftRaw.c @@ -28,30 +28,17 @@ #include "boRecord.h" #include "epicsExport.h" -/* added for Channel Access Links */ -static long init_record(boRecord *prec); - /* Create the dset for devBoSoftRaw */ +static long init_record(dbCommon *pcommon); static long write_bo(boRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_bo; -}devBoSoftRaw={ - 5, - NULL, - NULL, - init_record, - NULL, - write_bo +bodset devBoSoftRaw = { + {5, NULL, NULL, init_record, NULL}, + write_bo }; -epicsExportAddress(dset,devBoSoftRaw); - -static long init_record(boRecord *prec) +epicsExportAddress(dset, devBoSoftRaw); + +static long init_record(dbCommon *pcommon) { long status; diff --git a/modules/database/src/std/dev/devCalcoutSoft.c b/modules/database/src/std/dev/devCalcoutSoft.c index f931e6ac0..52ee11b8d 100644 --- a/modules/database/src/std/dev/devCalcoutSoft.c +++ b/modules/database/src/std/dev/devCalcoutSoft.c @@ -31,15 +31,9 @@ static long write_calcout(calcoutRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN write; -} devCalcoutSoft = { - 5, NULL, NULL, NULL, NULL, write_calcout +calcoutdset devCalcoutSoft = { + {5, NULL, NULL, NULL, NULL}, + write_calcout }; epicsExportAddress(dset, devCalcoutSoft); diff --git a/modules/database/src/std/dev/devCalcoutSoftCallback.c b/modules/database/src/std/dev/devCalcoutSoftCallback.c index 94f9d4f99..3d357b8d9 100644 --- a/modules/database/src/std/dev/devCalcoutSoftCallback.c +++ b/modules/database/src/std/dev/devCalcoutSoftCallback.c @@ -31,15 +31,9 @@ static long write_calcout(calcoutRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN write; -} devCalcoutSoftCallback = { - 5, NULL, NULL, NULL, NULL, write_calcout +calcoutdset devCalcoutSoftCallback = { + {5, NULL, NULL, NULL, NULL}, + write_calcout }; epicsExportAddress(dset, devCalcoutSoftCallback); diff --git a/modules/database/src/std/dev/devEnviron.c b/modules/database/src/std/dev/devEnviron.c index 69c9a3d92..8e4bd7937 100644 --- a/modules/database/src/std/dev/devEnviron.c +++ b/modules/database/src/std/dev/devEnviron.c @@ -119,10 +119,8 @@ static long read_stringin(stringinRecord *prec) return 0; } -static struct { - dset common; - DEVSUPFUN read; -} devSiEnviron = { - {5, NULL, init_stringin, NULL, NULL}, read_stringin +stringindset devSiEnviron = { + {5, NULL, init_stringin, NULL, NULL}, + read_stringin }; epicsExportAddress(dset, devSiEnviron); diff --git a/modules/database/src/std/dev/devGeneralTime.c b/modules/database/src/std/dev/devGeneralTime.c index c424fb772..f03275165 100644 --- a/modules/database/src/std/dev/devGeneralTime.c +++ b/modules/database/src/std/dev/devGeneralTime.c @@ -150,15 +150,14 @@ static long write_bo(boRecord *prec) return 0; } -struct { - dset common; - DEVSUPFUN read_write; -} devBoGeneralTime = { - {5, NULL, NULL, init_bo, NULL}, write_bo +bodset devBoGeneralTime = { + {5, NULL, NULL, init_bo, NULL}, + write_bo }; epicsExportAddress(dset, devBoGeneralTime); + /******* longin record *************/ static int errorCount(void) { @@ -209,11 +208,9 @@ static long read_li(longinRecord *prec) return 0; } -struct { - dset common; - DEVSUPFUN read_write; -} devLiGeneralTime = { - {5, NULL, NULL, init_li, NULL}, read_li +longindset devLiGeneralTime = { + {5, NULL, NULL, init_li, NULL}, + read_li }; epicsExportAddress(dset, devLiGeneralTime); @@ -289,10 +286,8 @@ static long read_si(stringinRecord *prec) return 0; } -struct { - dset common; - DEVSUPFUN read_write; -} devSiGeneralTime = { - {5, NULL, NULL, init_si, NULL}, read_si +stringindset devSiGeneralTime = { + {5, NULL, NULL, init_si, NULL}, + read_si }; epicsExportAddress(dset, devSiGeneralTime); diff --git a/modules/database/src/std/dev/devLiSoft.c b/modules/database/src/std/dev/devLiSoft.c index 6d7b7fda1..4c9912bc6 100644 --- a/modules/database/src/std/dev/devLiSoft.c +++ b/modules/database/src/std/dev/devLiSoft.c @@ -25,28 +25,19 @@ #include "epicsExport.h" /* Create the dset for devLiSoft */ -static long init_record(longinRecord *prec); +static long init_record(dbCommon *pcommon); static long read_longin(longinRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_longin; -} devLiSoft = { - 5, - NULL, - NULL, - init_record, - NULL, +longindset devLiSoft = { + {5, NULL, NULL, init_record, NULL}, read_longin }; epicsExportAddress(dset, devLiSoft); -static long init_record(longinRecord *prec) +static long init_record(dbCommon *pcommon) { + longinRecord *prec = (longinRecord *)pcommon; + if (recGblInitConstantLink(&prec->inp, DBF_LONG, &prec->val)) prec->udf = FALSE; diff --git a/modules/database/src/std/dev/devLiSoftCallback.c b/modules/database/src/std/dev/devLiSoftCallback.c index d833939ee..b7f7ceea3 100644 --- a/modules/database/src/std/dev/devLiSoftCallback.c +++ b/modules/database/src/std/dev/devLiSoftCallback.c @@ -151,8 +151,10 @@ static long init(int pass) return 0; } -static long init_record(longinRecord *prec) +static long init_record(dbCommon *pcommon) { + longinRecord *prec = (longinRecord *)pcommon; + if (recGblInitConstantLink(&prec->inp, DBR_LONG, &prec->val)) prec->udf = FALSE; @@ -204,10 +206,7 @@ static long read_li(longinRecord *prec) } /* Create the dset for devLiSoftCallback */ -struct { - dset common; - DEVSUPFUN read_li; -} devLiSoftCallback = { +longindset devLiSoftCallback = { {5, NULL, init, init_record, NULL}, read_li }; diff --git a/modules/database/src/std/dev/devLoSoft.c b/modules/database/src/std/dev/devLoSoft.c index af49c60ff..c9b8fe342 100644 --- a/modules/database/src/std/dev/devLoSoft.c +++ b/modules/database/src/std/dev/devLoSoft.c @@ -26,26 +26,16 @@ #include "epicsExport.h" /* Create the dset for devLoSoft */ -static long init_record(longoutRecord *prec); +static long init_record(dbCommon *pcommon); static long write_longout(longoutRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_longout; -}devLoSoft={ - 5, - NULL, - NULL, - init_record, - NULL, - write_longout + +longoutdset devLoSoft = { + {5, NULL, NULL, init_record, NULL}, + write_longout }; -epicsExportAddress(dset,devLoSoft); - -static long init_record(longoutRecord *prec) +epicsExportAddress(dset, devLoSoft); + +static long init_record(dbCommon *pcommon) { return 0; } /* end init_record() */ diff --git a/modules/database/src/std/dev/devLoSoftCallback.c b/modules/database/src/std/dev/devLoSoftCallback.c index f211957b5..3883e1906 100644 --- a/modules/database/src/std/dev/devLoSoftCallback.c +++ b/modules/database/src/std/dev/devLoSoftCallback.c @@ -29,22 +29,12 @@ /* Create the dset for devLoSoftCallback */ static long write_longout(longoutRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_longout; -}devLoSoftCallback={ - 5, - NULL, - NULL, - NULL, - NULL, - write_longout + +longoutdset devLoSoftCallback = { + {5, NULL, NULL, NULL, NULL}, + write_longout }; -epicsExportAddress(dset,devLoSoftCallback); +epicsExportAddress(dset, devLoSoftCallback); static long write_longout(longoutRecord *prec) { @@ -62,4 +52,3 @@ static long write_longout(longoutRecord *prec) return status; } - diff --git a/modules/database/src/std/dev/devMbbiDirectSoft.c b/modules/database/src/std/dev/devMbbiDirectSoft.c index 861952f8d..2138500be 100644 --- a/modules/database/src/std/dev/devMbbiDirectSoft.c +++ b/modules/database/src/std/dev/devMbbiDirectSoft.c @@ -25,28 +25,19 @@ #include "epicsExport.h" /* Create the dset for devMbbiDirectSoft */ -static long init_record(mbbiDirectRecord *prec); +static long init_record(dbCommon *pcommon); static long read_mbbi(mbbiDirectRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_mbbi; -} devMbbiDirectSoft = { - 5, - NULL, - NULL, - init_record, - NULL, +mbbidirectdset devMbbiDirectSoft = { + {5, NULL, NULL, init_record, NULL}, read_mbbi }; epicsExportAddress(dset, devMbbiDirectSoft); -static long init_record(mbbiDirectRecord *prec) +static long init_record(dbCommon *pcommon) { + mbbiDirectRecord *prec = (mbbiDirectRecord *)pcommon; + if (recGblInitConstantLink(&prec->inp, DBR_ULONG, &prec->val)) prec->udf = FALSE; diff --git a/modules/database/src/std/dev/devMbbiDirectSoftCallback.c b/modules/database/src/std/dev/devMbbiDirectSoftCallback.c index e40a6b006..7c9850b3f 100644 --- a/modules/database/src/std/dev/devMbbiDirectSoftCallback.c +++ b/modules/database/src/std/dev/devMbbiDirectSoftCallback.c @@ -151,8 +151,10 @@ static long init(int pass) return 0; } -static long init_record(mbbiDirectRecord *prec) +static long init_record(dbCommon *pcommon) { + mbbiDirectRecord *prec = (mbbiDirectRecord *)pcommon; + if (recGblInitConstantLink(&prec->inp, DBR_ULONG, &prec->val)) prec->udf = FALSE; @@ -204,10 +206,7 @@ static long read_mbbiDirect(mbbiDirectRecord *prec) } /* Create the dset for devMbbiDirectSoftCallback */ -struct { - dset common; - DEVSUPFUN read_mbbiDirect; -} devMbbiDirectSoftCallback = { +mbbidirectdset devMbbiDirectSoftCallback = { {5, NULL, init, init_record, NULL}, read_mbbiDirect }; diff --git a/modules/database/src/std/dev/devMbbiDirectSoftRaw.c b/modules/database/src/std/dev/devMbbiDirectSoftRaw.c index 98b4673fc..007568648 100644 --- a/modules/database/src/std/dev/devMbbiDirectSoftRaw.c +++ b/modules/database/src/std/dev/devMbbiDirectSoftRaw.c @@ -25,28 +25,19 @@ #include "epicsExport.h" /* Create the dset for devMbbiDirectSoftRaw */ -static long init_record(mbbiDirectRecord *prec); +static long init_record(dbCommon *pcommon); static long read_mbbi(mbbiDirectRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_mbbi; -} devMbbiDirectSoftRaw = { - 5, - NULL, - NULL, - init_record, - NULL, +mbbidirectdset devMbbiDirectSoftRaw = { + {5, NULL, NULL, init_record, NULL}, read_mbbi }; epicsExportAddress(dset, devMbbiDirectSoftRaw); -static long init_record(mbbiDirectRecord *prec) +static long init_record(dbCommon *pcommon) { + mbbiDirectRecord *prec = (mbbiDirectRecord *)pcommon; + recGblInitConstantLink(&prec->inp, DBF_ULONG, &prec->rval); /* Preserve old functionality */ diff --git a/modules/database/src/std/dev/devMbbiSoft.c b/modules/database/src/std/dev/devMbbiSoft.c index b0b57144f..d1e0716b3 100644 --- a/modules/database/src/std/dev/devMbbiSoft.c +++ b/modules/database/src/std/dev/devMbbiSoft.c @@ -25,28 +25,19 @@ #include "epicsExport.h" /* Create the dset for devMbbiSoft */ -static long init_record(mbbiRecord *prec); +static long init_record(dbCommon *pcommon); static long read_mbbi(mbbiRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_mbbi; -} devMbbiSoft = { - 5, - NULL, - NULL, - init_record, - NULL, +mbbidset devMbbiSoft = { + {5, NULL, NULL, init_record, NULL}, read_mbbi }; epicsExportAddress(dset, devMbbiSoft); -static long init_record(mbbiRecord *prec) +static long init_record(dbCommon *pcommon) { + mbbiRecord *prec = (mbbiRecord *)pcommon; + if (recGblInitConstantLink(&prec->inp, DBF_ENUM, &prec->val)) prec->udf = FALSE; diff --git a/modules/database/src/std/dev/devMbbiSoftCallback.c b/modules/database/src/std/dev/devMbbiSoftCallback.c index fee81b5d9..6466b4c14 100644 --- a/modules/database/src/std/dev/devMbbiSoftCallback.c +++ b/modules/database/src/std/dev/devMbbiSoftCallback.c @@ -151,8 +151,10 @@ static long init(int pass) return 0; } -static long init_record(mbbiRecord *prec) +static long init_record(dbCommon *pcommon) { + mbbiRecord *prec = (mbbiRecord *)pcommon; + if (recGblInitConstantLink(&prec->inp, DBR_ENUM, &prec->val)) prec->udf = FALSE; @@ -204,11 +206,8 @@ static long read_mbbi(mbbiRecord *prec) } /* Create the dset for devMbbiSoftCallback */ -struct { - dset common; - DEVSUPFUN read_mbbi; -} devMbbiSoftCallback = { +mbbidset devMbbiSoftCallback = { {5, NULL, init, init_record, NULL}, read_mbbi }; -epicsExportAddress(dset,devMbbiSoftCallback); +epicsExportAddress(dset, devMbbiSoftCallback); diff --git a/modules/database/src/std/dev/devMbbiSoftRaw.c b/modules/database/src/std/dev/devMbbiSoftRaw.c index 3bd6b21da..40617ab6b 100644 --- a/modules/database/src/std/dev/devMbbiSoftRaw.c +++ b/modules/database/src/std/dev/devMbbiSoftRaw.c @@ -25,28 +25,19 @@ #include "epicsExport.h" /* Create the dset for devMbbiSoftRaw */ -static long init_record(mbbiRecord *prec); +static long init_record(dbCommon *pcommon); static long read_mbbi(mbbiRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_mbbi; -} devMbbiSoftRaw = { - 5, - NULL, - NULL, - init_record, - NULL, +mbbidset devMbbiSoftRaw = { + {5, NULL, NULL, init_record, NULL}, read_mbbi }; epicsExportAddress(dset, devMbbiSoftRaw); -static long init_record(mbbiRecord *prec) +static long init_record(dbCommon *pcommon) { + mbbiRecord *prec = (mbbiRecord *)pcommon; + recGblInitConstantLink(&prec->inp, DBF_ULONG, &prec->rval); /* Preserve old functionality*/ diff --git a/modules/database/src/std/dev/devMbboDirectSoft.c b/modules/database/src/std/dev/devMbboDirectSoft.c index 75359f283..dc769b2ca 100644 --- a/modules/database/src/std/dev/devMbboDirectSoft.c +++ b/modules/database/src/std/dev/devMbboDirectSoft.c @@ -26,10 +26,7 @@ static long write_mbbo(mbboDirectRecord *prec) } /* Create the dset for devMbboDirectSoft */ -struct { - dset common; - DEVSUPFUN write; -} devMbboDirectSoft = { +mbbodirectdset devMbboDirectSoft = { {5, NULL, NULL, NULL, NULL}, write_mbbo }; diff --git a/modules/database/src/std/dev/devMbboDirectSoftCallback.c b/modules/database/src/std/dev/devMbboDirectSoftCallback.c index 6d86507ae..18d9b9c23 100644 --- a/modules/database/src/std/dev/devMbboDirectSoftCallback.c +++ b/modules/database/src/std/dev/devMbboDirectSoftCallback.c @@ -38,11 +38,8 @@ static long write_mbbo(mbboDirectRecord *prec) return status; } -/* Create the dset for devMbboSoft */ -struct { - dset common; - DEVSUPFUN write; -} devMbboDirectSoftCallback = { +/* Create the dset for devMbboDirectSoftCallback */ +mbbodirectdset devMbboDirectSoftCallback = { {5, NULL, NULL, NULL, NULL}, write_mbbo }; diff --git a/modules/database/src/std/dev/devMbboDirectSoftRaw.c b/modules/database/src/std/dev/devMbboDirectSoftRaw.c index c3bbdc898..f3d45a7fb 100644 --- a/modules/database/src/std/dev/devMbboDirectSoftRaw.c +++ b/modules/database/src/std/dev/devMbboDirectSoftRaw.c @@ -20,8 +20,10 @@ #include "mbboDirectRecord.h" #include "epicsExport.h" -static long init_record(mbboDirectRecord *prec) +static long init_record(dbCommon *pcommon) { + mbboDirectRecord *prec = (mbboDirectRecord *)pcommon; + if (prec->nobt == 0) prec->mask = 0xffffffff; @@ -40,10 +42,7 @@ static long write_mbbo(mbboDirectRecord *prec) } /* Create the dset for devMbboDirectSoftRaw */ -struct { - dset common; - DEVSUPFUN write; -} devMbboDirectSoftRaw = { +mbbodirectdset devMbboDirectSoftRaw = { {5, NULL, NULL, init_record, NULL}, write_mbbo }; diff --git a/modules/database/src/std/dev/devMbboSoft.c b/modules/database/src/std/dev/devMbboSoft.c index b2fe6b094..dfe856982 100644 --- a/modules/database/src/std/dev/devMbboSoft.c +++ b/modules/database/src/std/dev/devMbboSoft.c @@ -27,26 +27,16 @@ #include "epicsExport.h" /* Create the dset for devMbboSoft */ -static long init_record(mbboRecord *prec); +static long init_record(dbCommon *pcommon); static long write_mbbo(mbboRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_mbbo; -}devMbboSoft={ - 5, - NULL, - NULL, - init_record, - NULL, - write_mbbo + +mbbodset devMbboSoft = { + {5, NULL, NULL, init_record, NULL}, + write_mbbo }; -epicsExportAddress(dset,devMbboSoft); - -static long init_record(mbboRecord *prec) +epicsExportAddress(dset, devMbboSoft); + +static long init_record(dbCommon *pcommon) { /*dont convert*/ return 2; diff --git a/modules/database/src/std/dev/devMbboSoftCallback.c b/modules/database/src/std/dev/devMbboSoftCallback.c index fd5fe405a..d5f2f1c1d 100644 --- a/modules/database/src/std/dev/devMbboSoftCallback.c +++ b/modules/database/src/std/dev/devMbboSoftCallback.c @@ -28,22 +28,12 @@ /* Create the dset for devMbboSoftCallback */ static long write_mbbo(mbboRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_mbbo; -}devMbboSoftCallback={ - 5, - NULL, - NULL, - NULL, - NULL, - write_mbbo + +mbbodset devMbboSoftCallback = { + {5, NULL, NULL, NULL, NULL}, + write_mbbo }; -epicsExportAddress(dset,devMbboSoftCallback); +epicsExportAddress(dset, devMbboSoftCallback); static long write_mbbo(mbboRecord *prec) { diff --git a/modules/database/src/std/dev/devMbboSoftRaw.c b/modules/database/src/std/dev/devMbboSoftRaw.c index 092b6a8a7..2813ca9fa 100644 --- a/modules/database/src/std/dev/devMbboSoftRaw.c +++ b/modules/database/src/std/dev/devMbboSoftRaw.c @@ -20,8 +20,10 @@ #include "mbboRecord.h" #include "epicsExport.h" -static long init_record(mbboRecord *prec) +static long init_record(dbCommon *pcommon) { + mbboRecord *prec = (mbboRecord *)pcommon; + if (prec->nobt == 0) prec->mask = 0xffffffff; @@ -40,10 +42,7 @@ static long write_mbbo(mbboRecord *prec) } /* Create the dset for devMbboSoftRaw */ -struct { - dset common; - DEVSUPFUN write; -} devMbboSoftRaw = { +mbbodset devMbboSoftRaw = { {5, NULL, NULL, init_record, NULL}, write_mbbo }; diff --git a/modules/database/src/std/dev/devSASoft.c b/modules/database/src/std/dev/devSASoft.c index 69894dd89..be32af458 100644 --- a/modules/database/src/std/dev/devSASoft.c +++ b/modules/database/src/std/dev/devSASoft.c @@ -26,22 +26,11 @@ #include "epicsExport.h" /* Create the dset for devSASoft */ -static long init_record(subArrayRecord *prec); +static long init_record(dbCommon *pcommon); static long read_sa(subArrayRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_sa; -} devSASoft = { - 5, - NULL, - NULL, - init_record, - NULL, +sadset devSASoft = { + {5, NULL, NULL, init_record, NULL}, read_sa }; epicsExportAddress(dset, devSASoft); @@ -65,8 +54,9 @@ static void subset(subArrayRecord *prec, long nRequest) prec->udf = FALSE; } -static long init_record(subArrayRecord *prec) +static long init_record(dbCommon *pcommon) { + subArrayRecord *prec = (subArrayRecord *)pcommon; long nRequest = prec->indx + prec->nelm; long status; diff --git a/modules/database/src/std/dev/devSiSoft.c b/modules/database/src/std/dev/devSiSoft.c index 5141c1038..7b978033a 100644 --- a/modules/database/src/std/dev/devSiSoft.c +++ b/modules/database/src/std/dev/devSiSoft.c @@ -27,28 +27,19 @@ #include "epicsExport.h" /* Create the dset for devSiSoft */ -static long init_record(stringinRecord *prec); +static long init_record(dbCommon *pcommon); static long read_stringin(stringinRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_stringin; -} devSiSoft = { - 5, - NULL, - NULL, - init_record, - NULL, +stringindset devSiSoft = { + {5, NULL, NULL, init_record, NULL}, read_stringin }; epicsExportAddress(dset, devSiSoft); -static long init_record(stringinRecord *prec) +static long init_record(dbCommon *pcommon) { + stringinRecord *prec = (stringinRecord *)pcommon; + if (recGblInitConstantLink(&prec->inp, DBF_STRING, prec->val)) prec->udf = FALSE; diff --git a/modules/database/src/std/dev/devSiSoftCallback.c b/modules/database/src/std/dev/devSiSoftCallback.c index fd0e3761b..303e1beae 100644 --- a/modules/database/src/std/dev/devSiSoftCallback.c +++ b/modules/database/src/std/dev/devSiSoftCallback.c @@ -153,8 +153,10 @@ static long init(int pass) return 0; } -static long init_record(stringinRecord *prec) +static long init_record(dbCommon *pcommon) { + stringinRecord *prec = (stringinRecord *)pcommon; + if (recGblInitConstantLink(&prec->inp, DBR_STRING, &prec->val)) prec->udf = FALSE; @@ -207,11 +209,8 @@ static long read_si(stringinRecord *prec) } /* Create the dset for devSiSoftCallback */ -struct { - dset common; - DEVSUPFUN read_li; -} devSiSoftCallback = { +stringindset devSiSoftCallback = { {5, NULL, init, init_record, NULL}, read_si }; -epicsExportAddress(dset,devSiSoftCallback); +epicsExportAddress(dset, devSiSoftCallback); diff --git a/modules/database/src/std/dev/devSoSoft.c b/modules/database/src/std/dev/devSoSoft.c index 6dda4a765..5af5a52d6 100644 --- a/modules/database/src/std/dev/devSoSoft.c +++ b/modules/database/src/std/dev/devSoSoft.c @@ -27,19 +27,9 @@ /* Create the dset for devSoSoft */ static long write_stringout(stringoutRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_stringout; -} devSoSoft = { - 5, - NULL, - NULL, - NULL, - NULL, + +stringoutdset devSoSoft = { + {5, NULL, NULL, NULL, NULL}, write_stringout }; epicsExportAddress(dset, devSoSoft); diff --git a/modules/database/src/std/dev/devSoSoftCallback.c b/modules/database/src/std/dev/devSoSoftCallback.c index df8c5d819..ceae80198 100644 --- a/modules/database/src/std/dev/devSoSoftCallback.c +++ b/modules/database/src/std/dev/devSoSoftCallback.c @@ -27,19 +27,9 @@ /* Create the dset for devSoSoftCallback */ static long write_stringout(stringoutRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_stringout; -} devSoSoftCallback = { - 5, - NULL, - NULL, - NULL, - NULL, + +stringoutdset devSoSoftCallback = { + {5, NULL, NULL, NULL, NULL}, write_stringout }; epicsExportAddress(dset, devSoSoftCallback); @@ -60,4 +50,3 @@ static long write_stringout(stringoutRecord *prec) return status; } - diff --git a/modules/database/src/std/dev/devStdio.c b/modules/database/src/std/dev/devStdio.c index 928c8a420..d8646d95a 100644 --- a/modules/database/src/std/dev/devStdio.c +++ b/modules/database/src/std/dev/devStdio.c @@ -202,10 +202,8 @@ static long write_stringout(stringoutRecord *prec) return 0; } -static struct { - dset common; - DEVSUPFUN write; -} devSoStdio = { - {5, NULL, init_stringout, NULL, NULL}, write_stringout +stringoutdset devSoStdio = { + {5, NULL, init_stringout, NULL, NULL}, + write_stringout }; epicsExportAddress(dset, devSoStdio); diff --git a/modules/database/src/std/dev/devTimestamp.c b/modules/database/src/std/dev/devTimestamp.c index bcab26629..06f694eac 100644 --- a/modules/database/src/std/dev/devTimestamp.c +++ b/modules/database/src/std/dev/devTimestamp.c @@ -65,10 +65,7 @@ static long read_stringin (stringinRecord *prec) return 0; } -struct { - dset common; - DEVSUPFUN read_stringin; -} devTimestampSI = { +stringindset devTimestampSI = { {5, NULL, initAllow, NULL, NULL}, read_stringin }; diff --git a/modules/database/src/std/dev/devWfSoft.c b/modules/database/src/std/dev/devWfSoft.c index 5b521518d..0a089b831 100644 --- a/modules/database/src/std/dev/devWfSoft.c +++ b/modules/database/src/std/dev/devWfSoft.c @@ -26,28 +26,18 @@ #include "epicsExport.h" /* Create the dset for devWfSoft */ -static long init_record(waveformRecord *prec); +static long init_record(dbCommon *pcommon); static long read_wf(waveformRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_wf; -} devWfSoft = { - 5, - NULL, - NULL, - init_record, - NULL, +wfdset devWfSoft = { + {5, NULL, NULL, init_record, NULL}, read_wf }; epicsExportAddress(dset, devWfSoft); -static long init_record(waveformRecord *prec) +static long init_record(dbCommon *pcommon) { + waveformRecord *prec = (waveformRecord *)pcommon; long nelm = prec->nelm; long status = dbLoadLinkArray(&prec->inp, prec->ftvl, prec->bptr, &nelm); diff --git a/modules/database/src/std/rec/Makefile b/modules/database/src/std/rec/Makefile index e289bc387..8c37732e2 100644 --- a/modules/database/src/std/rec/Makefile +++ b/modules/database/src/std/rec/Makefile @@ -18,9 +18,12 @@ aoRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += aiRecord stdRecords += aoRecord stdRecords += aSubRecord +biRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += biRecord +boRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += boRecord stdRecords += calcRecord +calcoutRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += calcoutRecord stdRecords += compressRecord stdRecords += dfanoutRecord @@ -31,15 +34,21 @@ int64inRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += int64inRecord int64outRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += int64outRecord +longinRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += longinRecord +longoutRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += longoutRecord lsiRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += lsiRecord lsoRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += lsoRecord +mbbiRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += mbbiRecord +mbbiDirectRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += mbbiDirectRecord +mbboRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += mbboRecord +mbboDirectRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += mbboDirectRecord stdRecords += permissiveRecord printfRecord_CFLAGS += -DUSE_TYPED_DSET @@ -48,9 +57,12 @@ stdRecords += selRecord stdRecords += seqRecord stdRecords += stateRecord stdRecords += stringinRecord +stringoutRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += stringoutRecord stdRecords += subRecord +subArrayRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += subArrayRecord +waveformRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += waveformRecord DBDINC += $(stdRecords) diff --git a/modules/database/src/std/rec/aoRecord.c b/modules/database/src/std/rec/aoRecord.c index 94ad11fd2..3f9a84e89 100644 --- a/modules/database/src/std/rec/aoRecord.c +++ b/modules/database/src/std/rec/aoRecord.c @@ -81,7 +81,9 @@ rset aoRSET={ put_enum_str, get_graphic_double, get_control_double, - get_alarm_double }; + get_alarm_double +}; +epicsExportAddress(rset,aoRSET); static void checkAlarms(aoRecord *); static long fetch_value(aoRecord *, double *); @@ -92,7 +94,7 @@ static long writeValue(aoRecord *); static long init_record(struct dbCommon *pcommon, int pass) { struct aoRecord *prec = (struct aoRecord *)pcommon; - struct aodset *pdset; + aodset *pdset; double eoff = prec->eoff, eslo = prec->eslo; double value; long status = 0; @@ -101,7 +103,7 @@ static long init_record(struct dbCommon *pcommon, int pass) recGblInitSimm(pcommon, &prec->sscn, &prec->oldsimm, &prec->simm, &prec->siml); - if(!(pdset = (struct aodset *)(prec->dset))) { + if(!(pdset = (aodset *)(prec->dset))) { recGblRecordError(S_dev_noDSET,(void *)prec,"ao: init_record"); return(S_dev_noDSET); } @@ -110,7 +112,7 @@ static long init_record(struct dbCommon *pcommon, int pass) prec->udf = isnan(prec->val); /* must have write_ao function defined */ - if ((pdset->number < 6) || (pdset->write_ao ==NULL)) { + if ((pdset->common.number < 6) || (pdset->write_ao ==NULL)) { recGblRecordError(S_dev_missingSup,(void *)prec,"ao: init_record"); return(S_dev_missingSup); } @@ -120,8 +122,8 @@ static long init_record(struct dbCommon *pcommon, int pass) prec->eoff = prec->egul; } - if (pdset->init_record) { - status = (*pdset->init_record)(prec); + if (pdset->common.init_record) { + status = pdset->common.init_record(pcommon); if (prec->linr == menuConvertSLOPE) { prec->eoff = eoff; prec->eslo = eslo; @@ -162,7 +164,7 @@ static long init_record(struct dbCommon *pcommon, int pass) static long process(struct dbCommon *pcommon) { struct aoRecord *prec = (struct aoRecord *)pcommon; - struct aodset *pdset = (struct aodset *)(prec->dset); + aodset *pdset = (aodset *)(prec->dset); long status=0; unsigned char pact=prec->pact; double value; @@ -233,12 +235,12 @@ static long process(struct dbCommon *pcommon) static long special(DBADDR *paddr, int after) { aoRecord *prec = (aoRecord *)(paddr->precord); - struct aodset *pdset = (struct aodset *) (prec->dset); + aodset *pdset = (aodset *) (prec->dset); int special_type = paddr->special; switch(special_type) { case(SPC_LINCONV): - if(pdset->number<6 ) { + if(pdset->common.number<6 ) { recGblDbaddrError(S_db_noMod,paddr,"ao: special"); return(S_db_noMod); } @@ -543,7 +545,7 @@ static void monitor(aoRecord *prec) static long writeValue(aoRecord *prec) { - struct aodset *pdset = (struct aodset *) prec->dset; + aodset *pdset = (aodset *) prec->dset; long status = 0; if (!prec->pact) { diff --git a/modules/database/src/std/rec/aoRecord.dbd.pod b/modules/database/src/std/rec/aoRecord.dbd.pod index 026805ee7..672329e74 100644 --- a/modules/database/src/std/rec/aoRecord.dbd.pod +++ b/modules/database/src/std/rec/aoRecord.dbd.pod @@ -273,8 +273,9 @@ information on these fields. %/* Declare Device Support Entry Table */ %struct aoRecord; %typedef struct aodset { - % dset common; - % long (*write_ao)(struct aoRecord *prec); + % dset common; /*init_record returns: (0,2)=>(success,success no convert)*/ + % long (*write_ao)(struct aoRecord *prec); /*(0)=>(success ) */ + % long (*special_linconv)(struct aoRecord *prec, int after); %} aodset; %#define HAS_aodset % diff --git a/modules/database/src/std/rec/biRecord.c b/modules/database/src/std/rec/biRecord.c index 9c0ddb3c0..c26ed79ee 100644 --- a/modules/database/src/std/rec/biRecord.c +++ b/modules/database/src/std/rec/biRecord.c @@ -75,17 +75,10 @@ rset biRSET={ put_enum_str, get_graphic_double, get_control_double, - get_alarm_double }; -struct bidset { /* binary input dset */ - long number; - DEVSUPFUN dev_report; - DEVSUPFUN init; - DEVSUPFUN init_record; /*returns: (-1,0)=>(failure,success)*/ - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_bi;/*(0,2)=> success and convert, don't convert)*/ - /* if convert then raw value stored in rval */ + get_alarm_double }; epicsExportAddress(rset,biRSET); + static void checkAlarms(biRecord *); static void monitor(biRecord *); static long readValue(biRecord *); @@ -93,7 +86,7 @@ static long readValue(biRecord *); static long init_record(struct dbCommon *pcommon, int pass) { struct biRecord *prec = (struct biRecord *)pcommon; - struct bidset *pdset; + bidset *pdset; long status; if (pass == 0) return 0; @@ -101,17 +94,17 @@ static long init_record(struct dbCommon *pcommon, int pass) recGblInitSimm(pcommon, &prec->sscn, &prec->oldsimm, &prec->simm, &prec->siml); recGblInitConstantLink(&prec->siol, DBF_USHORT, &prec->sval); - if(!(pdset = (struct bidset *)(prec->dset))) { + if(!(pdset = (bidset *)(prec->dset))) { recGblRecordError(S_dev_noDSET,(void *)prec,"bi: init_record"); return(S_dev_noDSET); } /* must have read_bi function defined */ - if( (pdset->number < 5) || (pdset->read_bi == NULL) ) { + if( (pdset->common.number < 5) || (pdset->read_bi == NULL) ) { recGblRecordError(S_dev_missingSup,(void *)prec,"bi: init_record"); return(S_dev_missingSup); } - if( pdset->init_record ) { - if((status=(*pdset->init_record)(prec))) return(status); + if( pdset->common.init_record ) { + if((status=(*pdset->common.init_record)(pcommon))) return(status); } prec->mlst = prec->val; prec->lalm = prec->val; @@ -122,7 +115,7 @@ static long init_record(struct dbCommon *pcommon, int pass) static long process(struct dbCommon *pcommon) { struct biRecord *prec = (struct biRecord *)pcommon; - struct bidset *pdset = (struct bidset *)(prec->dset); + bidset *pdset = (bidset *)(prec->dset); long status; unsigned char pact=prec->pact; @@ -275,7 +268,7 @@ static void monitor(biRecord *prec) static long readValue(biRecord *prec) { - struct bidset *pdset = (struct bidset *)prec->dset; + bidset *pdset = (bidset *)prec->dset; long status = 0; if (!prec->pact) { diff --git a/modules/database/src/std/rec/biRecord.dbd.pod b/modules/database/src/std/rec/biRecord.dbd.pod index 62bcf3bf2..a3b5ed3c0 100644 --- a/modules/database/src/std/rec/biRecord.dbd.pod +++ b/modules/database/src/std/rec/biRecord.dbd.pod @@ -163,6 +163,15 @@ these fields. =cut include "dbCommon.dbd" + % + %/* Declare Device Support Entry Table */ + %struct biRecord; + %typedef struct bidset { + % dset common; /*init_record returns: (-1,0)=>(failure,success)*/ + % long (*read_bi)(struct biRecord *prec);/*(0,2)=> success and convert, don't convert); if convert then raw value stored in rval */ + %} bidset; + %#define HAS_bidset + % field(INP,DBF_INLINK) { prompt("Input Specification") promptgroup("40 - Input") diff --git a/modules/database/src/std/rec/boRecord.c b/modules/database/src/std/rec/boRecord.c index 4cfe62d48..94aa58782 100644 --- a/modules/database/src/std/rec/boRecord.c +++ b/modules/database/src/std/rec/boRecord.c @@ -86,16 +86,6 @@ epicsExportAddress(int, boHIGHprecision); double boHIGHlimit = 100000; epicsExportAddress(double, boHIGHlimit); -struct bodset { /* binary output dset */ - long number; - DEVSUPFUN dev_report; - DEVSUPFUN init; - DEVSUPFUN init_record; /*returns:(0,2)=>(success,success no convert*/ - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_bo;/*returns: (-1,0)=>(failure,success)*/ -}; - - /* control block for callback*/ typedef struct myCallback { epicsCallback callback; @@ -131,7 +121,7 @@ static void myCallbackFunc(epicsCallback *arg) static long init_record(struct dbCommon *pcommon,int pass) { struct boRecord *prec = (struct boRecord *)pcommon; - struct bodset *pdset = (struct bodset *) prec->dset; + bodset *pdset = (bodset *) prec->dset; unsigned short ival = 0; long status = 0; myCallback *pcallback; @@ -146,7 +136,7 @@ static long init_record(struct dbCommon *pcommon,int pass) } /* must have write_bo functions defined */ - if ((pdset->number < 5) || (pdset->write_bo == NULL)) { + if ((pdset->common.number < 5) || (pdset->write_bo == NULL)) { recGblRecordError(S_dev_missingSup, prec, "bo: init_record"); return S_dev_missingSup; } @@ -163,8 +153,8 @@ static long init_record(struct dbCommon *pcommon,int pass) callbackSetUser(pcallback, &pcallback->callback); pcallback->precord = (struct dbCommon *) prec; - if (pdset->init_record) { - status=(*pdset->init_record)(prec); + if (pdset->common.init_record) { + status=(*pdset->common.init_record)(pcommon); if(status==0) { if(prec->rval==0) prec->val = 0; else prec->val = 1; @@ -188,7 +178,7 @@ static long init_record(struct dbCommon *pcommon,int pass) static long process(struct dbCommon *pcommon) { struct boRecord *prec = (struct boRecord *)pcommon; - struct bodset *pdset = (struct bodset *)(prec->dset); + bodset *pdset = (bodset *)(prec->dset); long status=0; unsigned char pact=prec->pact; @@ -420,7 +410,7 @@ static void monitor(boRecord *prec) static long writeValue(boRecord *prec) { - struct bodset *pdset = (struct bodset *) prec->dset; + bodset *pdset = (bodset *) prec->dset; long status = 0; if (!prec->pact) { diff --git a/modules/database/src/std/rec/boRecord.dbd.pod b/modules/database/src/std/rec/boRecord.dbd.pod index 6b6d1800c..ad48070a9 100644 --- a/modules/database/src/std/rec/boRecord.dbd.pod +++ b/modules/database/src/std/rec/boRecord.dbd.pod @@ -210,6 +210,15 @@ information on these fields. =cut include "dbCommon.dbd" + % + %/* Declare Device Support Entry Table */ + %struct boRecord; + %typedef struct bodset { + % dset common; /*init_record returns:(0,2)=>(success,success no convert*/ + % long (*write_bo)(struct boRecord *prec); /*returns: (-1,0)=>(failure,success)*/ + %} bodset; + %#define HAS_bodset + % field(VAL,DBF_ENUM) { prompt("Current Value") promptgroup("50 - Output") diff --git a/modules/database/src/std/rec/calcoutRecord.c b/modules/database/src/std/rec/calcoutRecord.c index d9f66af3c..75edcce47 100644 --- a/modules/database/src/std/rec/calcoutRecord.c +++ b/modules/database/src/std/rec/calcoutRecord.c @@ -90,16 +90,6 @@ epicsExportAddress(int, calcoutODLYprecision); double calcoutODLYlimit = 100000; epicsExportAddress(double, calcoutODLYlimit); -typedef struct calcoutDSET { - long number; - DEVSUPFUN dev_report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN write; -}calcoutDSET; - - /* To provide feedback to the user as to the connection status of the * links (.INxV and .OUTV), the following algorithm has been implemented ... * @@ -142,7 +132,7 @@ static long init_record(struct dbCommon *pcommon, int pass) double *pvalue; epicsEnum16 *plinkValid; short error_number; - calcoutDSET *pcalcoutDSET; + calcoutdset *pcalcoutDSET; rpvtStruct *prpvt; if (pass == 0) { @@ -150,13 +140,13 @@ static long init_record(struct dbCommon *pcommon, int pass) return 0; } - if (!(pcalcoutDSET = (calcoutDSET *)prec->dset)) { + if (!(pcalcoutDSET = (calcoutdset *)prec->dset)) { recGblRecordError(S_dev_noDSET, (void *)prec, "calcout:init_record"); return S_dev_noDSET; } /* must have write defined */ - if ((pcalcoutDSET->number < 5) || (pcalcoutDSET->write ==NULL)) { + if ((pcalcoutDSET->common.number < 5) || (pcalcoutDSET->write ==NULL)) { recGblRecordError(S_dev_missingSup, (void *)prec, "calcout:init_record"); return S_dev_missingSup; } @@ -221,7 +211,7 @@ static long init_record(struct dbCommon *pcommon, int pass) prec->epvt = eventNameToHandle(prec->oevt); - if (pcalcoutDSET->init_record) pcalcoutDSET->init_record(prec); + if (pcalcoutDSET->common.init_record) pcalcoutDSET->common.init_record(pcommon); prec->pval = prec->val; prec->mlst = prec->val; prec->alst = prec->val; @@ -768,7 +758,7 @@ static void checkLinks(calcoutRecord *prec) static long writeValue(calcoutRecord *prec) { - calcoutDSET *pcalcoutDSET = (calcoutDSET *)prec->dset; + calcoutdset *pcalcoutDSET = (calcoutdset *)prec->dset; if (!pcalcoutDSET || !pcalcoutDSET->write) { diff --git a/modules/database/src/std/rec/calcoutRecord.dbd.pod b/modules/database/src/std/rec/calcoutRecord.dbd.pod index 176f1d25f..ef329f5ae 100644 --- a/modules/database/src/std/rec/calcoutRecord.dbd.pod +++ b/modules/database/src/std/rec/calcoutRecord.dbd.pod @@ -659,6 +659,14 @@ manner for the VAL field. =cut include "dbCommon.dbd" + %/* Declare Device Support Entry Table */ + %struct calcoutRecord; + %typedef struct calcoutdset { + % dset common; + % long (*write)(struct calcoutRecord *prec); + %} calcoutdset; + %#define HAS_calcoutdset + % field(RPVT,DBF_NOACCESS) { prompt("Record Private") special(SPC_NOMOD) diff --git a/modules/database/src/std/rec/longinRecord.c b/modules/database/src/std/rec/longinRecord.c index d52464137..299cfb8e6 100644 --- a/modules/database/src/std/rec/longinRecord.c +++ b/modules/database/src/std/rec/longinRecord.c @@ -83,15 +83,6 @@ rset longinRSET={ }; epicsExportAddress(rset,longinRSET); - -struct longindset { /* longin input dset */ - long number; - DEVSUPFUN dev_report; - DEVSUPFUN init; - DEVSUPFUN init_record; /*returns: (-1,0)=>(failure,success)*/ - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_longin; /*returns: (-1,0)=>(failure,success)*/ -}; static void checkAlarms(longinRecord *prec, epicsTimeStamp *timeLast); static void monitor(longinRecord *prec); static long readValue(longinRecord *prec); @@ -100,7 +91,7 @@ static long readValue(longinRecord *prec); static long init_record(struct dbCommon *pcommon, int pass) { struct longinRecord *prec = (struct longinRecord *)pcommon; - struct longindset *pdset = (struct longindset *) prec->dset; + longindset *pdset = (longindset *) prec->dset; if (pass == 0) return 0; @@ -113,13 +104,13 @@ static long init_record(struct dbCommon *pcommon, int pass) } /* must have read_longin function defined */ - if ((pdset->number < 5) || (pdset->read_longin == NULL)) { + if ((pdset->common.number < 5) || (pdset->read_longin == NULL)) { recGblRecordError(S_dev_missingSup, prec, "longin: init_record"); return S_dev_missingSup; } - if (pdset->init_record) { - long status = pdset->init_record(prec); + if (pdset->common.init_record) { + long status = pdset->common.init_record(pcommon); if (status) return status; @@ -134,7 +125,7 @@ static long init_record(struct dbCommon *pcommon, int pass) static long process(struct dbCommon *pcommon) { struct longinRecord *prec = (struct longinRecord *)pcommon; - struct longindset *pdset = (struct longindset *)(prec->dset); + longindset *pdset = (longindset *)(prec->dset); long status; unsigned char pact=prec->pact; epicsTimeStamp timeLast; @@ -405,7 +396,7 @@ static void monitor(longinRecord *prec) static long readValue(longinRecord *prec) { - struct longindset *pdset = (struct longindset *) prec->dset; + longindset *pdset = (longindset *) prec->dset; long status = 0; if (!prec->pact) { diff --git a/modules/database/src/std/rec/longinRecord.dbd.pod b/modules/database/src/std/rec/longinRecord.dbd.pod index cf2a3a395..51f74bc86 100644 --- a/modules/database/src/std/rec/longinRecord.dbd.pod +++ b/modules/database/src/std/rec/longinRecord.dbd.pod @@ -305,6 +305,15 @@ sets UDF to FALSE. read_longin returns the status of C. =cut include "dbCommon.dbd" + % + %/* Declare Device Support Entry Table */ + %struct longinRecord; + %typedef struct longindset { + % dset common; /*init_record returns: (-1,0)=>(failure,success)*/ + % long (*read_longin)(struct longinRecord *prec); /*returns: (-1,0)=>(failure,success)*/ + %} longindset; + %#define HAS_longindset + % field(VAL,DBF_LONG) { prompt("Current value") promptgroup("40 - Input") diff --git a/modules/database/src/std/rec/longoutRecord.c b/modules/database/src/std/rec/longoutRecord.c index 06e3b6e21..238fb691c 100644 --- a/modules/database/src/std/rec/longoutRecord.c +++ b/modules/database/src/std/rec/longoutRecord.c @@ -80,15 +80,6 @@ rset longoutRSET={ }; epicsExportAddress(rset,longoutRSET); - -struct longoutdset { /* longout input dset */ - long number; - DEVSUPFUN dev_report; - DEVSUPFUN init; - DEVSUPFUN init_record; /*returns: (-1,0)=>(failure,success)*/ - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_longout;/*(-1,0)=>(failure,success*/ -}; static void checkAlarms(longoutRecord *prec); static void monitor(longoutRecord *prec); static long writeValue(longoutRecord *prec); @@ -97,7 +88,7 @@ static void convert(longoutRecord *prec, epicsInt32 value); static long init_record(struct dbCommon *pcommon, int pass) { struct longoutRecord *prec = (struct longoutRecord *)pcommon; - struct longoutdset *pdset = (struct longoutdset *) prec->dset; + longoutdset *pdset = (longoutdset *) prec->dset; if (pass == 0) return 0; @@ -109,7 +100,7 @@ static long init_record(struct dbCommon *pcommon, int pass) } /* must have write_longout functions defined */ - if ((pdset->number < 5) || (pdset->write_longout == NULL)) { + if ((pdset->common.number < 5) || (pdset->write_longout == NULL)) { recGblRecordError(S_dev_missingSup, prec, "longout: init_record"); return S_dev_missingSup; } @@ -117,8 +108,8 @@ static long init_record(struct dbCommon *pcommon, int pass) if (recGblInitConstantLink(&prec->dol, DBF_LONG, &prec->val)) prec->udf=FALSE; - if (pdset->init_record) { - long status = pdset->init_record(prec); + if (pdset->common.init_record) { + long status = pdset->common.init_record(pcommon); if (status) return status; @@ -133,7 +124,7 @@ static long init_record(struct dbCommon *pcommon, int pass) static long process(struct dbCommon *pcommon) { struct longoutRecord *prec = (struct longoutRecord *)pcommon; - struct longoutdset *pdset = (struct longoutdset *)(prec->dset); + longoutdset *pdset = (longoutdset *)(prec->dset); long status=0; epicsInt32 value; unsigned char pact=prec->pact; @@ -382,7 +373,7 @@ static void monitor(longoutRecord *prec) static long writeValue(longoutRecord *prec) { - struct longoutdset *pdset = (struct longoutdset *) prec->dset; + longoutdset *pdset = (longoutdset *) prec->dset; long status = 0; if (!prec->pact) { diff --git a/modules/database/src/std/rec/longoutRecord.dbd.pod b/modules/database/src/std/rec/longoutRecord.dbd.pod index 276f3046f..f5e8b7587 100644 --- a/modules/database/src/std/rec/longoutRecord.dbd.pod +++ b/modules/database/src/std/rec/longoutRecord.dbd.pod @@ -96,6 +96,15 @@ and database links. =cut include "dbCommon.dbd" + % + %/* Declare Device Support Entry Table */ + %struct longoutRecord; + %typedef struct longoutdset { + % dset common; /*init_record returns: (-1,0)=>(failure,success)*/ + % long (*write_longout)(struct longoutRecord *prec); /*(-1,0)=>(failure,success*/ + %} longoutdset; + %#define HAS_longoutdset + % field(VAL,DBF_LONG) { prompt("Desired Output") promptgroup("50 - Output") diff --git a/modules/database/src/std/rec/mbbiDirectRecord.c b/modules/database/src/std/rec/mbbiDirectRecord.c index 88d805c7c..d3515119a 100644 --- a/modules/database/src/std/rec/mbbiDirectRecord.c +++ b/modules/database/src/std/rec/mbbiDirectRecord.c @@ -81,15 +81,6 @@ rset mbbiDirectRSET={ }; epicsExportAddress(rset,mbbiDirectRSET); -struct mbbidset { /* multi bit binary input dset */ - long number; - DEVSUPFUN dev_report; - DEVSUPFUN init; - DEVSUPFUN init_record; /*returns: (-1,0)=>(failure, success)*/ - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_mbbi; /*returns: (0,2)=>(success, success no convert)*/ -}; - static void monitor(mbbiDirectRecord *); static long readValue(mbbiDirectRecord *); @@ -98,7 +89,7 @@ static long readValue(mbbiDirectRecord *); static long init_record(struct dbCommon *pcommon, int pass) { struct mbbiDirectRecord *prec = (struct mbbiDirectRecord *)pcommon; - struct mbbidset *pdset = (struct mbbidset *) prec->dset; + mbbidirectdset *pdset = (mbbidirectdset *) prec->dset; long status = 0; if (pass == 0) return 0; @@ -108,7 +99,7 @@ static long init_record(struct dbCommon *pcommon, int pass) return S_dev_noDSET; } - if ((pdset->number < 5) || (pdset->read_mbbi == NULL)) { + if ((pdset->common.number < 5) || (pdset->read_mbbi == NULL)) { recGblRecordError(S_dev_missingSup, prec, "mbbiDirect: init_record"); return S_dev_missingSup; } @@ -120,8 +111,8 @@ static long init_record(struct dbCommon *pcommon, int pass) if (prec->mask == 0 && prec->nobt <= 32) prec->mask = ((epicsUInt64) 1u << prec->nobt) - 1; - if (pdset->init_record) { - status = pdset->init_record(prec); + if (pdset->common.init_record) { + status = pdset->common.init_record(pcommon); if (status == 0) { epicsUInt32 val = prec->val; epicsUInt8 *pBn = &prec->b0; @@ -141,7 +132,7 @@ static long init_record(struct dbCommon *pcommon, int pass) static long process(struct dbCommon *pcommon) { struct mbbiDirectRecord *prec = (struct mbbiDirectRecord *)pcommon; - struct mbbidset *pdset = (struct mbbidset *) prec->dset; + mbbidirectdset *pdset = (mbbidirectdset *) prec->dset; long status; int pact = prec->pact; @@ -248,7 +239,7 @@ static void monitor(mbbiDirectRecord *prec) static long readValue(mbbiDirectRecord *prec) { - struct mbbidset *pdset = (struct mbbidset *) prec->dset; + mbbidirectdset *pdset = (mbbidirectdset *) prec->dset; long status = 0; if (!prec->pact) { diff --git a/modules/database/src/std/rec/mbbiDirectRecord.dbd.pod b/modules/database/src/std/rec/mbbiDirectRecord.dbd.pod index 5b1c4da09..fa5d40fcd 100644 --- a/modules/database/src/std/rec/mbbiDirectRecord.dbd.pod +++ b/modules/database/src/std/rec/mbbiDirectRecord.dbd.pod @@ -85,6 +85,14 @@ description (DESC) fields. =cut include "dbCommon.dbd" + %/* Declare Device Support Entry Table */ + %struct mbbiDirectRecord; + %typedef struct mbbidirectdset { + % dset common; /* init_record returns: (-1,0) => (failure, success)*/ + % long (*read_mbbi)(struct mbbiDirectRecord *prec); /* (0, 2) => (success, success no convert)*/ + %} mbbidirectdset; + %#define HAS_mbbidirectdset + % field(VAL,DBF_LONG) { prompt("Current Value") promptgroup("40 - Input") diff --git a/modules/database/src/std/rec/mbbiRecord.c b/modules/database/src/std/rec/mbbiRecord.c index 0202594c5..ba24d52e3 100644 --- a/modules/database/src/std/rec/mbbiRecord.c +++ b/modules/database/src/std/rec/mbbiRecord.c @@ -83,15 +83,6 @@ rset mbbiRSET = { }; epicsExportAddress(rset,mbbiRSET); -struct mbbidset { /* multi bit binary input dset */ - long number; - DEVSUPFUN dev_report; - DEVSUPFUN init; - DEVSUPFUN init_record; /* returns: (-1,0) => (failure, success)*/ - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_mbbi;/* (0, 2) => (success, success no convert)*/ -}; - static void checkAlarms(mbbiRecord *, epicsTimeStamp *); static void monitor(mbbiRecord *); static long readValue(mbbiRecord *); @@ -115,18 +106,17 @@ static void init_common(mbbiRecord *prec) static long init_record(struct dbCommon *pcommon, int pass) { struct mbbiRecord *prec = (struct mbbiRecord *)pcommon; - struct mbbidset *pdset = (struct mbbidset *) prec->dset; + mbbidset *pdset = (mbbidset *) prec->dset; long status = 0; if (pass == 0) return 0; - pdset = (struct mbbidset *) prec->dset; if (!pdset) { recGblRecordError(S_dev_noDSET, prec, "mbbi: init_record"); return S_dev_noDSET; } - if ((pdset->number < 5) || (pdset->read_mbbi == NULL)) { + if ((pdset->common.number < 5) || (pdset->read_mbbi == NULL)) { recGblRecordError(S_dev_missingSup, prec, "mbbi: init_record"); return S_dev_missingSup; } @@ -138,8 +128,8 @@ static long init_record(struct dbCommon *pcommon, int pass) if (prec->mask == 0 && prec->nobt <= 32) prec->mask = ((epicsUInt64) 1u << prec->nobt) - 1; - if (pdset->init_record) - status = pdset->init_record(prec); + if (pdset->common.init_record) + status = pdset->common.init_record(pcommon); init_common(prec); @@ -152,7 +142,7 @@ static long init_record(struct dbCommon *pcommon, int pass) static long process(struct dbCommon *pcommon) { struct mbbiRecord *prec = (struct mbbiRecord *)pcommon; - struct mbbidset *pdset = (struct mbbidset *) prec->dset; + mbbidset *pdset = (mbbidset *) prec->dset; long status; int pact = prec->pact; epicsTimeStamp timeLast; @@ -380,7 +370,7 @@ static void monitor(mbbiRecord *prec) static long readValue(mbbiRecord *prec) { - struct mbbidset *pdset = (struct mbbidset *) prec->dset; + mbbidset *pdset = (mbbidset *) prec->dset; long status = 0; if (!prec->pact) { diff --git a/modules/database/src/std/rec/mbbiRecord.dbd.pod b/modules/database/src/std/rec/mbbiRecord.dbd.pod index b4ab1b402..5f0e08ebe 100644 --- a/modules/database/src/std/rec/mbbiRecord.dbd.pod +++ b/modules/database/src/std/rec/mbbiRecord.dbd.pod @@ -119,6 +119,14 @@ description (DESC) fields. =cut include "dbCommon.dbd" + %/* Declare Device Support Entry Table */ + %struct mbbiRecord; + %typedef struct mbbidset { + % dset common; /* init_record returns: (-1,0) => (failure, success)*/ + % long (*read_mbbi)(struct mbbiRecord *prec); /* (0, 2) => (success, success no convert)*/ + %} mbbidset; + %#define HAS_mbbidset + % field(VAL,DBF_ENUM) { prompt("Current Value") promptgroup("40 - Input") diff --git a/modules/database/src/std/rec/mbboDirectRecord.c b/modules/database/src/std/rec/mbboDirectRecord.c index 5c2dd9403..2f928198d 100644 --- a/modules/database/src/std/rec/mbboDirectRecord.c +++ b/modules/database/src/std/rec/mbboDirectRecord.c @@ -81,16 +81,6 @@ rset mbboDirectRSET = { }; epicsExportAddress(rset, mbboDirectRSET); -struct mbbodset { /* multi bit binary output dset */ - long number; - DEVSUPFUN dev_report; - DEVSUPFUN init; - DEVSUPFUN init_record; /*returns: (0, 2)=>(success, success no convert)*/ - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_mbbo; /*returns: (0, 2)=>(success, success no convert)*/ -}; - - static void convert(mbboDirectRecord *); static void monitor(mbboDirectRecord *); static long writeValue(mbboDirectRecord *); @@ -100,7 +90,7 @@ static long writeValue(mbboDirectRecord *); static long init_record(struct dbCommon *pcommon, int pass) { struct mbboDirectRecord *prec = (struct mbboDirectRecord *)pcommon; - struct mbbodset *pdset = (struct mbbodset *) prec->dset; + mbbodirectdset *pdset = (mbbodirectdset *) prec->dset; long status = 0; if (pass == 0) return 0; @@ -110,7 +100,7 @@ static long init_record(struct dbCommon *pcommon, int pass) return S_dev_noDSET; } - if ((pdset->number < 5) || (pdset->write_mbbo == NULL)) { + if ((pdset->common.number < 5) || (pdset->write_mbbo == NULL)) { recGblRecordError(S_dev_missingSup, prec, "mbboDirect: init_record"); return S_dev_missingSup; } @@ -124,8 +114,8 @@ static long init_record(struct dbCommon *pcommon, int pass) if (prec->mask == 0 && prec->nobt <= 32) prec->mask = ((epicsUInt64) 1u << prec->nobt) - 1; - if (pdset->init_record) { - status = pdset->init_record(prec); + if (pdset->common.init_record) { + status = pdset->common.init_record(pcommon); if (status == 0) { /* Convert initial read-back */ epicsUInt32 rval = prec->rval; @@ -162,7 +152,7 @@ static long init_record(struct dbCommon *pcommon, int pass) static long process(struct dbCommon *pcommon) { struct mbboDirectRecord *prec = (struct mbboDirectRecord *)pcommon; - struct mbbodset *pdset = (struct mbbodset *)(prec->dset); + mbbodirectdset *pdset = (mbbodirectdset *)(prec->dset); long status = 0; int pact = prec->pact; @@ -356,7 +346,7 @@ static void convert(mbboDirectRecord *prec) static long writeValue(mbboDirectRecord *prec) { - struct mbbodset *pdset = (struct mbbodset *) prec->dset; + mbbodirectdset *pdset = (mbbodirectdset *) prec->dset; long status = 0; if (!prec->pact) { diff --git a/modules/database/src/std/rec/mbboDirectRecord.dbd.pod b/modules/database/src/std/rec/mbboDirectRecord.dbd.pod index ca49bcd53..01402db18 100644 --- a/modules/database/src/std/rec/mbboDirectRecord.dbd.pod +++ b/modules/database/src/std/rec/mbboDirectRecord.dbd.pod @@ -90,6 +90,14 @@ description (DESC) fields. =cut include "dbCommon.dbd" + %/* Declare Device Support Entry Table */ + %struct mbboDirectRecord; + %typedef struct mbbodirectdset { + % dset common; /*init_record returns: (0, 2)=>(success, success no convert)*/ + % long (*write_mbbo)(struct mbboDirectRecord *prec); /*returns: (0, 2)=>(success, success no convert)*/ + %} mbbodirectdset; + %#define HAS_mbbodirectdset + % field(VAL,DBF_LONG) { prompt("Word") promptgroup("50 - Output") diff --git a/modules/database/src/std/rec/mbboRecord.c b/modules/database/src/std/rec/mbboRecord.c index 2488552ba..b54988d6d 100644 --- a/modules/database/src/std/rec/mbboRecord.c +++ b/modules/database/src/std/rec/mbboRecord.c @@ -82,15 +82,6 @@ rset mbboRSET = { }; epicsExportAddress(rset,mbboRSET); -struct mbbodset { /* multi bit binary output dset */ - long number; - DEVSUPFUN dev_report; - DEVSUPFUN init; - DEVSUPFUN init_record; /*returns: (0, 2) => (success, success no convert)*/ - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_mbbo; /*returns: (0, 2) => (success, success no convert)*/ -}; - static void checkAlarms(mbboRecord *); static void convert(mbboRecord *); @@ -117,7 +108,7 @@ static void init_common(mbboRecord *prec) static long init_record(struct dbCommon *pcommon, int pass) { struct mbboRecord *prec = (struct mbboRecord *)pcommon; - struct mbbodset *pdset; + mbbodset *pdset; long status; if (pass == 0) { @@ -125,13 +116,13 @@ static long init_record(struct dbCommon *pcommon, int pass) return 0; } - pdset = (struct mbbodset *) prec->dset; + pdset = (mbbodset *) prec->dset; if (!pdset) { recGblRecordError(S_dev_noDSET, prec, "mbbo: init_record"); return S_dev_noDSET; } - if ((pdset->number < 5) || (pdset->write_mbbo == NULL)) { + if ((pdset->common.number < 5) || (pdset->write_mbbo == NULL)) { recGblRecordError(S_dev_missingSup, prec, "mbbo: init_record"); return S_dev_missingSup; } @@ -145,8 +136,8 @@ static long init_record(struct dbCommon *pcommon, int pass) if (prec->mask == 0 && prec->nobt <= 32) prec->mask = ((epicsUInt64) 1u << prec->nobt) - 1; - if (pdset->init_record) { - status = pdset->init_record(prec); + if (pdset->common.init_record) { + status = pdset->common.init_record(pcommon); init_common(prec); if (status == 0) { /* Convert initial read-back */ @@ -194,7 +185,7 @@ static long init_record(struct dbCommon *pcommon, int pass) static long process(struct dbCommon *pcommon) { struct mbboRecord *prec = (struct mbboRecord *)pcommon; - struct mbbodset *pdset = (struct mbbodset *) prec->dset; + mbbodset *pdset = (mbbodset *) prec->dset; long status = 0; int pact = prec->pact; @@ -439,7 +430,7 @@ static void convert(mbboRecord *prec) static long writeValue(mbboRecord *prec) { - struct mbbodset *pdset = (struct mbbodset *) prec->dset; + mbbodset *pdset = (mbbodset *) prec->dset; long status = 0; if (!prec->pact) { diff --git a/modules/database/src/std/rec/mbboRecord.dbd.pod b/modules/database/src/std/rec/mbboRecord.dbd.pod index 2196aa5a2..ff5cd7e13 100644 --- a/modules/database/src/std/rec/mbboRecord.dbd.pod +++ b/modules/database/src/std/rec/mbboRecord.dbd.pod @@ -173,6 +173,14 @@ mode fields. =cut include "dbCommon.dbd" + %/* Declare Device Support Entry Table */ + %struct mbboRecord; + %typedef struct mbbodset { + % dset common; /*init_record returns: (0, 2) => (success, success no convert)*/ + % long (*write_mbbo)(struct mbboRecord *prec); /*returns: (0, 2) => (success, success no convert)*/ + %} mbbodset; + %#define HAS_mbbodset + % field(VAL,DBF_ENUM) { prompt("Desired Value") promptgroup("50 - Output") diff --git a/modules/database/src/std/rec/stringinRecord.c b/modules/database/src/std/rec/stringinRecord.c index fdc1f2642..3c6776204 100644 --- a/modules/database/src/std/rec/stringinRecord.c +++ b/modules/database/src/std/rec/stringinRecord.c @@ -80,14 +80,6 @@ rset stringinRSET={ }; epicsExportAddress(rset,stringinRSET); -struct stringindset { /* stringin input dset */ - long number; - DEVSUPFUN dev_report; - DEVSUPFUN init; - DEVSUPFUN init_record; /*returns: (-1,0)=>(failure,success)*/ - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_stringin; /*returns: (-1,0)=>(failure,success)*/ -}; static void monitor(stringinRecord *); static long readValue(stringinRecord *); @@ -97,7 +89,7 @@ static long init_record(struct dbCommon *pcommon, int pass) struct stringinRecord *prec = (struct stringinRecord *)pcommon; STATIC_ASSERT(sizeof(prec->oval)==sizeof(prec->val)); STATIC_ASSERT(sizeof(prec->sval)==sizeof(prec->val)); - struct stringindset *pdset = (struct stringindset *) prec->dset; + stringindset *pdset = (stringindset *) prec->dset; if (pass == 0) return 0; @@ -110,13 +102,13 @@ static long init_record(struct dbCommon *pcommon, int pass) } /* must have read_stringin function defined */ - if ((pdset->number < 5) || (pdset->read_stringin == NULL)) { + if ((pdset->common.number < 5) || (pdset->read_stringin == NULL)) { recGblRecordError(S_dev_missingSup, prec, "stringin: init_record"); return S_dev_missingSup; } - if (pdset->init_record) { - long status = pdset->init_record(prec); + if (pdset->common.init_record) { + long status = pdset->common.init_record(pcommon); if (status) return status; @@ -130,7 +122,7 @@ static long init_record(struct dbCommon *pcommon, int pass) static long process(struct dbCommon *pcommon) { struct stringinRecord *prec = (struct stringinRecord *)pcommon; - struct stringindset *pdset = (struct stringindset *)(prec->dset); + stringindset *pdset = (stringindset *)(prec->dset); long status; unsigned char pact=prec->pact; @@ -196,7 +188,7 @@ static void monitor(stringinRecord *prec) static long readValue(stringinRecord *prec) { - struct stringindset *pdset = (struct stringindset *) prec->dset; + stringindset *pdset = (stringindset *) prec->dset; long status = 0; if (!prec->pact) { diff --git a/modules/database/src/std/rec/stringinRecord.dbd.pod b/modules/database/src/std/rec/stringinRecord.dbd.pod index 17e0c101b..c633b314e 100644 --- a/modules/database/src/std/rec/stringinRecord.dbd.pod +++ b/modules/database/src/std/rec/stringinRecord.dbd.pod @@ -24,6 +24,15 @@ menu(stringinPOST) { } recordtype(stringin) { include "dbCommon.dbd" + % + %/* Declare Device Support Entry Table */ + %struct stringinRecord; + %typedef struct stringindset { + % dset common; /*init_record returns: (-1,0)=>(failure,success)*/ + % long (*read_stringin)(struct stringinRecord *prec); /*returns: (-1,0)=>(failure,success)*/ + %} stringindset; + %#define HAS_stringindset + % field(VAL,DBF_STRING) { prompt("Current Value") promptgroup("40 - Input") diff --git a/modules/database/src/std/rec/stringoutRecord.c b/modules/database/src/std/rec/stringoutRecord.c index ddf302848..786d295cf 100644 --- a/modules/database/src/std/rec/stringoutRecord.c +++ b/modules/database/src/std/rec/stringoutRecord.c @@ -82,14 +82,6 @@ rset stringoutRSET={ }; epicsExportAddress(rset,stringoutRSET); -struct stringoutdset { /* stringout input dset */ - long number; - DEVSUPFUN dev_report; - DEVSUPFUN init; - DEVSUPFUN init_record; /*returns: (-1,0)=>(failure,success)*/ - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_stringout;/*(-1,0)=>(failure,success)*/ -}; static void monitor(stringoutRecord *); static long writeValue(stringoutRecord *); @@ -99,7 +91,7 @@ static long init_record(struct dbCommon *pcommon, int pass) struct stringoutRecord *prec = (struct stringoutRecord *)pcommon; STATIC_ASSERT(sizeof(prec->oval)==sizeof(prec->val)); STATIC_ASSERT(sizeof(prec->ivov)==sizeof(prec->val)); - struct stringoutdset *pdset = (struct stringoutdset *) prec->dset; + stringoutdset *pdset = (stringoutdset *) prec->dset; if (pass == 0) return 0; @@ -111,7 +103,7 @@ static long init_record(struct dbCommon *pcommon, int pass) } /* must have write_stringout functions defined */ - if ((pdset->number < 5) || (pdset->write_stringout == NULL)) { + if ((pdset->common.number < 5) || (pdset->write_stringout == NULL)) { recGblRecordError(S_dev_missingSup, prec, "stringout: init_record"); return S_dev_missingSup; } @@ -120,8 +112,8 @@ static long init_record(struct dbCommon *pcommon, int pass) if (recGblInitConstantLink(&prec->dol, DBF_STRING, prec->val)) prec->udf = FALSE; - if (pdset->init_record) { - long status = pdset->init_record(prec); + if (pdset->common.init_record) { + long status = pdset->common.init_record(pcommon); if(status) return status; @@ -133,7 +125,7 @@ static long init_record(struct dbCommon *pcommon, int pass) static long process(struct dbCommon *pcommon) { struct stringoutRecord *prec = (struct stringoutRecord *)pcommon; - struct stringoutdset *pdset = (struct stringoutdset *)(prec->dset); + stringoutdset *pdset = (stringoutdset *)(prec->dset); long status=0; unsigned char pact=prec->pact; @@ -228,7 +220,7 @@ static void monitor(stringoutRecord *prec) static long writeValue(stringoutRecord *prec) { - struct stringoutdset *pdset = (struct stringoutdset *) prec->dset; + stringoutdset *pdset = (stringoutdset *) prec->dset; long status = 0; if (!prec->pact) { diff --git a/modules/database/src/std/rec/stringoutRecord.dbd.pod b/modules/database/src/std/rec/stringoutRecord.dbd.pod index 0d63d5f61..1c843edf0 100644 --- a/modules/database/src/std/rec/stringoutRecord.dbd.pod +++ b/modules/database/src/std/rec/stringoutRecord.dbd.pod @@ -24,6 +24,15 @@ menu(stringoutPOST) { } recordtype(stringout) { include "dbCommon.dbd" + % + %/* Declare Device Support Entry Table */ + %struct stringoutRecord; + %typedef struct stringoutdset { + % dset common; /*init_record returns: (-1,0)=>(failure,success)*/ + % long (*write_stringout)(struct stringoutRecord *prec); /*(-1,0)=>(failure,success)*/ + %} stringoutdset; + %#define HAS_stringoutdset + % field(VAL,DBF_STRING) { prompt("Current Value") promptgroup("50 - Output") diff --git a/modules/database/src/std/rec/subArrayRecord.c b/modules/database/src/std/rec/subArrayRecord.c index 6de514766..00eed313e 100644 --- a/modules/database/src/std/rec/subArrayRecord.c +++ b/modules/database/src/std/rec/subArrayRecord.c @@ -82,15 +82,6 @@ rset subArrayRSET={ }; epicsExportAddress(rset,subArrayRSET); -struct sadset { /* subArray dset */ - long number; - DEVSUPFUN dev_report; - DEVSUPFUN init; - DEVSUPFUN init_record; /*returns: (-1,0)=>(failure,success)*/ - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_sa; /*returns: (-1,0)=>(failure,success)*/ -}; - static void monitor(subArrayRecord *prec); static long readValue(subArrayRecord *prec); @@ -98,7 +89,7 @@ static long readValue(subArrayRecord *prec); static long init_record(struct dbCommon *pcommon, int pass) { struct subArrayRecord *prec = (struct subArrayRecord *)pcommon; - struct sadset *pdset; + sadset *pdset; if (pass==0){ if (prec->malm <= 0) @@ -114,19 +105,19 @@ static long init_record(struct dbCommon *pcommon, int pass) } /* must have dset defined */ - if (!(pdset = (struct sadset *)(prec->dset))) { + if (!(pdset = (sadset *)(prec->dset))) { recGblRecordError(S_dev_noDSET,(void *)prec,"sa: init_record"); return S_dev_noDSET; } /* must have read_sa function defined */ - if ( (pdset->number < 5) || (pdset->read_sa == NULL) ) { + if ( (pdset->common.number < 5) || (pdset->read_sa == NULL) ) { recGblRecordError(S_dev_missingSup,(void *)prec,"sa: init_record"); return S_dev_missingSup; } - if (pdset->init_record) - return pdset->init_record(prec); + if (pdset->common.init_record) + return pdset->common.init_record(pcommon); return 0; } @@ -134,7 +125,7 @@ static long init_record(struct dbCommon *pcommon, int pass) static long process(struct dbCommon *pcommon) { struct subArrayRecord *prec = (struct subArrayRecord *)pcommon; - struct sadset *pdset = (struct sadset *)(prec->dset); + sadset *pdset = (sadset *)(prec->dset); long status; unsigned char pact=prec->pact; @@ -309,7 +300,7 @@ static void monitor(subArrayRecord *prec) static long readValue(subArrayRecord *prec) { long status; - struct sadset *pdset = (struct sadset *) (prec->dset); + sadset *pdset = (sadset *) (prec->dset); if (prec->nelm > prec->malm) prec->nelm = prec->malm; diff --git a/modules/database/src/std/rec/subArrayRecord.dbd.pod b/modules/database/src/std/rec/subArrayRecord.dbd.pod index c47f2d003..fa4a41066 100644 --- a/modules/database/src/std/rec/subArrayRecord.dbd.pod +++ b/modules/database/src/std/rec/subArrayRecord.dbd.pod @@ -315,6 +315,15 @@ INP is expected to point to a waveform record. =cut include "dbCommon.dbd" + % + %/* Declare Device Support Entry Table */ + %struct subArrayRecord; + %typedef struct sadset { + % dset common; /*init_record returns: (-1,0)=>(failure,success)*/ + % long (*read_sa)(struct subArrayRecord *prec); /*returns: (-1,0)=>(failure,success)*/ + %} sadset; + %#define HAS_sadset + % field(VAL,DBF_NOACCESS) { prompt("Value") asl(ASL0) diff --git a/modules/database/src/std/rec/waveformRecord.c b/modules/database/src/std/rec/waveformRecord.c index 8d210183c..69a36f496 100644 --- a/modules/database/src/std/rec/waveformRecord.c +++ b/modules/database/src/std/rec/waveformRecord.c @@ -80,14 +80,6 @@ rset waveformRSET={ get_alarm_double }; epicsExportAddress(rset,waveformRSET); -struct wfdset { /* waveform dset */ - long number; - DEVSUPFUN dev_report; - DEVSUPFUN init; - DEVSUPFUN init_record; /*returns: (-1,0)=>(failure,success)*/ - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_wf; /*returns: (-1,0)=>(failure,success)*/ -}; static void monitor(waveformRecord *); static long readValue(waveformRecord *); @@ -95,7 +87,7 @@ static long readValue(waveformRecord *); static long init_record(struct dbCommon *pcommon, int pass) { struct waveformRecord *prec = (struct waveformRecord *)pcommon; - struct wfdset *pdset; + wfdset *pdset; if (pass == 0) { if (prec->nelm <= 0) @@ -111,25 +103,25 @@ static long init_record(struct dbCommon *pcommon, int pass) recGblInitSimm(pcommon, &prec->sscn, &prec->oldsimm, &prec->simm, &prec->siml); /* must have dset defined */ - if (!(pdset = (struct wfdset *)(prec->dset))) { + if (!(pdset = (wfdset *)(prec->dset))) { recGblRecordError(S_dev_noDSET,(void *)prec,"wf: init_record"); return S_dev_noDSET; } /* must have read_wf function defined */ - if ((pdset->number < 5) || (pdset->read_wf == NULL)) { + if ((pdset->common.number < 5) || (pdset->read_wf == NULL)) { recGblRecordError(S_dev_missingSup,(void *)prec,"wf: init_record"); return S_dev_missingSup; } - if (!pdset->init_record) + if (!pdset->common.init_record) return 0; - return pdset->init_record(prec); + return pdset->common.init_record(pcommon); } static long process(struct dbCommon *pcommon) { struct waveformRecord *prec = (struct waveformRecord *)pcommon; - struct wfdset *pdset = (struct wfdset *)(prec->dset); + wfdset *pdset = (wfdset *)(prec->dset); unsigned char pact=prec->pact; long status; @@ -328,7 +320,7 @@ static void monitor(waveformRecord *prec) static long readValue(waveformRecord *prec) { - struct wfdset *pdset = (struct wfdset *) prec->dset; + wfdset *pdset = (wfdset *) prec->dset; long status = 0; if (!prec->pact) { diff --git a/modules/database/src/std/rec/waveformRecord.dbd.pod b/modules/database/src/std/rec/waveformRecord.dbd.pod index ce488ef0f..06f38b620 100644 --- a/modules/database/src/std/rec/waveformRecord.dbd.pod +++ b/modules/database/src/std/rec/waveformRecord.dbd.pod @@ -397,6 +397,15 @@ NORD is set to the number of values returned and read_wf returns. =cut include "dbCommon.dbd" + % + %/* Declare Device Support Entry Table */ + %struct waveformRecord; + %typedef struct wfdset { + % dset common; /*init_record returns: (-1,0)=>(failure,success)*/ + % long (*read_wf)(struct waveformRecord *prec); /*returns: (-1,0)=>(failure,success)*/ + %} wfdset; + %#define HAS_wfdset + % field(VAL,DBF_NOACCESS) { prompt("Value") asl(ASL0) From 6867f973465329656dc333a307af6f42e46f7adc Mon Sep 17 00:00:00 2001 From: Freddie Akeroyd Date: Fri, 14 Feb 2020 01:16:09 +0000 Subject: [PATCH 058/216] Fix bit operations failures on VS2019 32bit Working with Dirk Zimoch @dirk.zimoch, fixed various issues with bit operations on VS2019 32bit. These seem to relate to handling bit 31 of a 32 bit number. As EPICS << is an arithmetic bit shift, following Java we have added <<< and >>> operators for logical shifts Though it is on a different architecture, this looks like a similar issue to LP: #1838792 --- src/libCom/calc/calcPerform.c | 61 ++++++++++++++++++++----------- src/libCom/calc/postfix.c | 12 ++++-- src/libCom/calc/postfixPvt.h | 6 ++- src/libCom/test/epicsCalcTest.cpp | 37 +++++++++++++++++-- 4 files changed, 84 insertions(+), 32 deletions(-) diff --git a/src/libCom/calc/calcPerform.c b/src/libCom/calc/calcPerform.c index c0f4aebb8..1d675cffc 100644 --- a/src/libCom/calc/calcPerform.c +++ b/src/libCom/calc/calcPerform.c @@ -33,7 +33,7 @@ static int cond_search(const char **ppinst, int match); #endif /* Turn off global optimization for 64-bit MSVC builds */ -#if defined(_WIN32) && defined(_M_X64) && !defined(_MINGW) +#if 0 && defined(_WIN32) && defined(_M_X64) && !defined(_MINGW) # pragma optimize("g", off) #endif @@ -48,7 +48,6 @@ epicsShareFunc long double *ptop; /* stack pointer */ double top; /* value from top of stack */ epicsInt32 itop; /* integer from top of stack */ - epicsUInt32 utop; /* unsigned integer from top of stack */ int op; int nargs; @@ -287,30 +286,37 @@ epicsShareFunc long *ptop = ! *ptop; break; - /* For bitwise operations on values with bit 31 set, double values - * must first be cast to unsigned to correctly set that bit; the - * double value must be negative in that case. The result must be - * cast to a signed integer before converting to the double result. + /* Be VERY careful converting double to int in case bit 31 is set! + * Out-of-range errors give very different results on different sytems. + * Convert negative doubles to signed and positive doubles to unsigned + * first to avoid overflows if bit 32 is set. + * The result is always signed, values with bit 31 set are negative + * to avoid problems when writing the value to signed integer fields + * like longout.VAL or ao.RVAL. However unsigned fields may give + * problems on some architectures. (Fewer than giving problems with + * signed integer. Maybe the conversion functions should handle + * overflows better.) */ + #define d2i(x) ((x)<0?(epicsInt32)(x):(epicsInt32)(epicsUInt32)(x)) + #define d2ui(x) ((x)<0?(epicsUInt32)(epicsInt32)(x):(epicsUInt32)(x)) case BIT_OR: - utop = *ptop--; - *ptop = (epicsInt32) ((epicsUInt32) *ptop | utop); + top = *ptop--; + *ptop = (double)(d2i(*ptop) | d2i(top)); break; case BIT_AND: - utop = *ptop--; - *ptop = (epicsInt32) ((epicsUInt32) *ptop & utop); + top = *ptop--; + *ptop = (double)(d2i(*ptop) & d2i(top)); break; case BIT_EXCL_OR: - utop = *ptop--; - *ptop = (epicsInt32) ((epicsUInt32) *ptop ^ utop); + top = *ptop--; + *ptop = (double)(d2i(*ptop) ^ d2i(top)); break; case BIT_NOT: - utop = *ptop; - *ptop = (epicsInt32) ~utop; + *ptop = (double)~d2i(*ptop); break; /* The shift operators use signed integers, so a right-shift will @@ -318,14 +324,24 @@ epicsShareFunc long * double-casting through unsigned here is important, see above. */ - case RIGHT_SHIFT: - utop = *ptop--; - *ptop = ((epicsInt32) (epicsUInt32) *ptop) >> (utop & 31); + case RIGHT_SHIFT_ARITH: + top = *ptop--; + *ptop = (double)(d2i(*ptop) >> (d2i(top) & 31)); break; - case LEFT_SHIFT: - utop = *ptop--; - *ptop = ((epicsInt32) (epicsUInt32) *ptop) << (utop & 31); + case LEFT_SHIFT_ARITH: + top = *ptop--; + *ptop = (double)(d2i(*ptop) << (d2i(top) & 31)); + break; + + case RIGHT_SHIFT_LOGIC: + top = *ptop--; + *ptop = (double)(d2ui(*ptop) >> (d2ui(top) & 31u)); + break; + + case LEFT_SHIFT_LOGIC: + top = *ptop--; + *ptop = (double)(d2ui(*ptop) << (d2ui(top) & 31u)); break; case NOT_EQ: @@ -382,11 +398,12 @@ epicsShareFunc long *presult = *ptop; return 0; } -#if defined(_WIN32) && defined(_M_X64) && !defined(_MINGW) +#if 0 && defined(_WIN32) && defined(_M_X64) && !defined(_MINGW) # pragma optimize("", on) #endif - + + epicsShareFunc long calcArgUsage(const char *pinst, unsigned long *pinputs, unsigned long *pstores) { diff --git a/src/libCom/calc/postfix.c b/src/libCom/calc/postfix.c index 463ceea82..cf54eb8ec 100644 --- a/src/libCom/calc/postfix.c +++ b/src/libCom/calc/postfix.c @@ -148,13 +148,15 @@ static const ELEMENT operators[] = { {":=", 0, 0, -1, STORE_OPERATOR, STORE_A}, {";", 0, 0, 0, EXPR_TERMINATOR,NOT_GENERATED}, {"<", 3, 3, -1, BINARY_OPERATOR,LESS_THAN}, -{"<<", 2, 2, -1, BINARY_OPERATOR,LEFT_SHIFT}, +{"<<", 2, 2, -1, BINARY_OPERATOR,LEFT_SHIFT_ARITH}, +{"<<<", 2, 2, -1, BINARY_OPERATOR,LEFT_SHIFT_LOGIC}, {"<=", 3, 3, -1, BINARY_OPERATOR,LESS_OR_EQ}, {"=", 3, 3, -1, BINARY_OPERATOR,EQUAL}, {"==", 3, 3, -1, BINARY_OPERATOR,EQUAL}, {">", 3, 3, -1, BINARY_OPERATOR,GR_THAN}, {">=", 3, 3, -1, BINARY_OPERATOR,GR_OR_EQ}, -{">>", 2, 2, -1, BINARY_OPERATOR,RIGHT_SHIFT}, +{">>", 2, 2, -1, BINARY_OPERATOR,RIGHT_SHIFT_ARITH}, +{">>>", 2, 2, -1, BINARY_OPERATOR,RIGHT_SHIFT_LOGIC}, {"?", 0, 0, -1, CONDITIONAL, COND_IF}, {"AND", 2, 2, -1, BINARY_OPERATOR,BIT_AND}, {"OR", 1, 1, -1, BINARY_OPERATOR,BIT_OR}, @@ -579,8 +581,10 @@ epicsShareFunc void "BIT_AND", "BIT_EXCL_OR", "BIT_NOT", - "RIGHT_SHIFT", - "LEFT_SHIFT", + "RIGHT_SHIFT_ARITH", + "RIGHT_SHIFT_LOGIC", + "LEFT_SHIFT_ARITH", + "LEFT_SHIFT_LOGIC", /* Relationals */ "NOT_EQ", "LESS_THAN", diff --git a/src/libCom/calc/postfixPvt.h b/src/libCom/calc/postfixPvt.h index 53efb32e0..5b2ba0a7b 100644 --- a/src/libCom/calc/postfixPvt.h +++ b/src/libCom/calc/postfixPvt.h @@ -84,8 +84,10 @@ typedef enum { BIT_AND, BIT_EXCL_OR, BIT_NOT, - RIGHT_SHIFT, - LEFT_SHIFT, + RIGHT_SHIFT_ARITH, + RIGHT_SHIFT_LOGIC, + LEFT_SHIFT_ARITH, + LEFT_SHIFT_LOGIC, /* Relationals */ NOT_EQ, LESS_THAN, diff --git a/src/libCom/test/epicsCalcTest.cpp b/src/libCom/test/epicsCalcTest.cpp index 2492c95ba..a0131cd31 100644 --- a/src/libCom/test/epicsCalcTest.cpp +++ b/src/libCom/test/epicsCalcTest.cpp @@ -104,7 +104,7 @@ void testUInt32Calc(const char *expr, epicsUInt32 expected) { testDiag("calcPerform: error evaluating '%s'", expr); } - uresult = (epicsUInt32) result; + uresult = (result < 0.0 ? (epicsUInt32)(epicsInt32)result : (epicsUInt32)result); pass = (uresult == expected); if (!testOk(pass, "%s", expr)) { testDiag("Expected result is 0x%x (%u), actually got 0x%x (%u)", @@ -297,7 +297,7 @@ MAIN(epicsCalcTest) const double a=1.0, b=2.0, c=3.0, d=4.0, e=5.0, f=6.0, g=7.0, h=8.0, i=9.0, j=10.0, k=11.0, l=12.0; - testPlan(613); + testPlan(643); /* LITERAL_OPERAND elements */ testExpr(0); @@ -688,7 +688,9 @@ MAIN(epicsCalcTest) testExpr(NaN < NaN); testExpr(1 << 2); - testExpr(1 << 3 << 2) + testCalc("1 <<< 2", 1u << 2u); + testExpr(1 << 3 << 2); + testCalc("1 <<< 3 <<< 2", 1u << 3u << 2u); testExpr(0 <= 1); testExpr(0 <= 0); @@ -776,7 +778,9 @@ MAIN(epicsCalcTest) testExpr(NaN >= NaN); testExpr(8 >> 1); + testCalc("8 >>> 1", 8u >> 1u); testExpr(64 >> 2 >> 1); + testCalc("64 >>> 2 >>> 1", 64u >> 2u >> 1u); testExpr(7 AND 4); @@ -873,13 +877,19 @@ MAIN(epicsCalcTest) testExpr(2 | 4 / 2); // 1 5 testCalc("1 | 2 ** 3", 1 | (int) pow(2., 3.));// 1 6 testExpr(3 << 2 & 10); // 2 2 + testCalc("3 <<< 2 & 10", 3u << 2u & 10u); // 2 2 testCalc("18 & 6 << 2", (18 & 6) << 2); // 2 2 + testCalc("18 & 6 <<< 2", (18u & 6u) << 2u); // 2 2 testExpr(36 >> 2 & 10); // 2 2 + testCalc("36 >>> 2 & 10", 36u >> 2u & 10u); // 2 2 testCalc("18 & 20 >> 2", (18 & 20) >> 2); // 2 2 + testCalc("18 & 20 >>> 2", (18u & 20u) >> 2u); // 2 2 testExpr(3 & 4 == 4); // 2 3 testExpr(3 AND 4 == 4); // 2 3 testCalc("1 << 2 != 4", 1 << (2 != 4)); // 2 3 + testCalc("1 <<< 2 != 4", 1u << (2u != 4u)); // 2 3 testCalc("16 >> 2 != 4", 16 >> (2 != 4)); // 2 3 + testCalc("16 >>> 2 != 4", 16u >> (2u != 4u)); // 2 3 testExpr(3 AND -2); // 2 8 testExpr(0 < 1 ? 2 : 3); // 3 0 testExpr(1 <= 0 ? 2 : 3); // 3 0 @@ -951,7 +961,13 @@ MAIN(epicsCalcTest) testUInt32Calc("~0xaaaaaaaa", 0x55555555u); testUInt32Calc("~~0xaaaaaaaa", 0xaaaaaaaau); testUInt32Calc("0xaaaaaaaa >> 8", 0xffaaaaaau); + testUInt32Calc("0x55555555 >> 8", 0x00555555u); + testUInt32Calc("0xaaaaaaaa >>> 8", 0x00aaaaaau); + testUInt32Calc("0x55555555 >>> 8", 0x00555555u); testUInt32Calc("0xaaaaaaaa << 8", 0xaaaaaa00u); + testUInt32Calc("0x55555555 << 8", 0x55555500u); + testUInt32Calc("0xaaaaaaaa <<< 8", 0xaaaaaa00u); + testUInt32Calc("0x55555555 <<< 8", 0x55555500u); // using integer literals assigned to variables testUInt32Calc("a:=0xaaaaaaaa; b:=0xffff0000; a AND b", 0xaaaa0000u); testUInt32Calc("a:=0xaaaaaaaa; b:=0xffff0000; a OR b", 0xffffaaaau); @@ -959,7 +975,13 @@ MAIN(epicsCalcTest) testUInt32Calc("a:=0xaaaaaaaa; ~a", 0x55555555u); testUInt32Calc("a:=0xaaaaaaaa; ~~a", 0xaaaaaaaau); testUInt32Calc("a:=0xaaaaaaaa; a >> 8", 0xffaaaaaau); + testUInt32Calc("a:=0xaaaaaaaa; a >>> 8", 0x00aaaaaau); testUInt32Calc("a:=0xaaaaaaaa; a << 8", 0xaaaaaa00u); + testUInt32Calc("a:=0xaaaaaaaa; a <<< 8", 0xaaaaaa00u); + testUInt32Calc("a:=0x55555555; a >> 8", 0x00555555u); + testUInt32Calc("a:=0x55555555; a >>> 8", 0x00555555u); + testUInt32Calc("a:=0x55555555; a << 8", 0x55555500u); + testUInt32Calc("a:=0x55555555; a <<< 8", 0x55555500u); // Test proper conversion of double values (+ 0.1 enforces double literal) // when used as inputs to the bitwise operations. @@ -979,14 +1001,21 @@ MAIN(epicsCalcTest) testUInt32Calc("~ -1431655766.1", 0x55555555u); testUInt32Calc("~ 2863311530.1", 0x55555555u); testUInt32Calc("-1431655766.1 >> 0", 0xaaaaaaaau); + testUInt32Calc("-1431655766.1 >>> 0", 0xaaaaaaaau); testUInt32Calc("2863311530.1 >> 0", 0xaaaaaaaau); + testUInt32Calc("2863311530.1 >>> 0", 0xaaaaaaaau); testUInt32Calc("-1431655766.1 >> 0.1", 0xaaaaaaaau); + testUInt32Calc("-1431655766.1 >>> 0.1", 0xaaaaaaaau); testUInt32Calc("2863311530.1 >> 0.1", 0xaaaaaaaau); + testUInt32Calc("2863311530.1 >>> 0.1", 0xaaaaaaaau); testUInt32Calc("-1431655766.1 << 0", 0xaaaaaaaau); + testUInt32Calc("-1431655766.1 <<< 0", 0xaaaaaaaau); testUInt32Calc("2863311530.1 << 0", 0xaaaaaaaau); + testUInt32Calc("2863311530.1 <<< 0", 0xaaaaaaaau); testUInt32Calc("-1431655766.1 << 0.1", 0xaaaaaaaau); + testUInt32Calc("-1431655766.1 <<< 0.1", 0xaaaaaaaau); testUInt32Calc("2863311530.1 << 0.1", 0xaaaaaaaau); + testUInt32Calc("2863311530.1 <<< 0.1", 0xaaaaaaaau); return testDone(); } - From 819b0de65b92d29d2ab26b0a2e36390ba0e17f71 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 12 Feb 2020 14:53:09 +0000 Subject: [PATCH 059/216] epicsTimerTest testImpreciseTiming() --- .ci/travis-build.sh | 1 + modules/libcom/src/misc/epicsUnitTest.c | 12 ++++++++++++ modules/libcom/src/misc/epicsUnitTest.h | 2 ++ modules/libcom/test/epicsTimerTest.cpp | 4 ++++ 4 files changed, 19 insertions(+) diff --git a/.ci/travis-build.sh b/.ci/travis-build.sh index c71bdd90e..bf6d605d1 100755 --- a/.ci/travis-build.sh +++ b/.ci/travis-build.sh @@ -72,6 +72,7 @@ make -j2 RTEMS_QEMU_FIXUPS=YES CMD_CFLAGS="${CMD_CFLAGS}" CMD_CXXFLAGS="${CMD_CX if [ "$TEST" != "NO" ] then + export EPICS_TEST_IMPRECISE_TIMING=YES make -j2 tapfiles make -s test-results fi diff --git a/modules/libcom/src/misc/epicsUnitTest.c b/modules/libcom/src/misc/epicsUnitTest.c index dce05983e..22fbc1f2a 100644 --- a/modules/libcom/src/misc/epicsUnitTest.c +++ b/modules/libcom/src/misc/epicsUnitTest.c @@ -15,6 +15,7 @@ #include #include +#include #ifdef _WIN32 # include @@ -248,6 +249,17 @@ int testDone(void) { return (status); } +static int impreciseTiming; + +int testImpreciseTiming(void) +{ + if(impreciseTiming==0) { + const char* env = getenv("EPICS_TEST_IMPRECISE_TIMING"); + + impreciseTiming = (env && strcmp(env, "YES")==0) ? 1 : -1; + } + return impreciseTiming>0; +} /* Our test harness, for RTEMS and vxWorks */ diff --git a/modules/libcom/src/misc/epicsUnitTest.h b/modules/libcom/src/misc/epicsUnitTest.h index 9a119ad22..b0199333e 100644 --- a/modules/libcom/src/misc/epicsUnitTest.h +++ b/modules/libcom/src/misc/epicsUnitTest.h @@ -40,6 +40,8 @@ epicsShareFunc int testDone(void); #define testOk1(cond) testOk(cond, "%s", #cond) +epicsShareFunc +int testImpreciseTiming(void); typedef int (*TESTFUNC)(void); epicsShareFunc void testHarness(void); diff --git a/modules/libcom/test/epicsTimerTest.cpp b/modules/libcom/test/epicsTimerTest.cpp index 12e5eaeb2..e3b36a8c1 100644 --- a/modules/libcom/test/epicsTimerTest.cpp +++ b/modules/libcom/test/epicsTimerTest.cpp @@ -112,9 +112,13 @@ double delayVerify::checkError () const double actualDelay = this->expireStamp - this->beginStamp; double measuredError = actualDelay - this->expectedDelay; double percentError = 100.0 * fabs ( measuredError ) / this->expectedDelay; + if(testImpreciseTiming()) + testTodoBegin("imprecise"); testOk ( percentError < messageThresh, "%f < %f, delay = %f s, error = %f s (%.1f %%)", percentError, messageThresh, this->expectedDelay, measuredError, percentError ); + if(testImpreciseTiming()) + testTodoEnd(); return measuredError; } From 6dba2ec1d7f600d66fddb6c30d0c3e5b6b3a8618 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 13 Feb 2020 12:08:51 +0000 Subject: [PATCH 060/216] caRepeater /dev/null --- documentation/RELEASE_NOTES.md | 13 +++++++ modules/ca/src/client/caRepeater.cpp | 55 +++++++++++++++++++++++++++- 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/documentation/RELEASE_NOTES.md b/documentation/RELEASE_NOTES.md index 2adeacf24..bdd246857 100644 --- a/documentation/RELEASE_NOTES.md +++ b/documentation/RELEASE_NOTES.md @@ -12,6 +12,19 @@ The external PVA submodules each have their own separate set of release notes which should also be read to understand what has changed since an earlier release. +## EPICS Release 7.x.y.z + +### caRepeater /dev/null + +On *NIX targets caRepeater will now partially daemonize by redirecting +stdin/out/err with /dev/null. This prevents caRepeater from inheriting +the stdin/out of a process, like caget, which has spawned it in the +background. This has been known to cause problems in some cases when +caget is itself being run from a shell script. + +caRepeater will now understand the '-v' argument to retain stdin/out/err +which may be necessary to see any error messages it may emit. + ## EPICS Release 7.0.3.1 **IMPORTANT NOTE:** *Some record types in this release will not be compatible diff --git a/modules/ca/src/client/caRepeater.cpp b/modules/ca/src/client/caRepeater.cpp index 03cb8957d..2561223a5 100644 --- a/modules/ca/src/client/caRepeater.cpp +++ b/modules/ca/src/client/caRepeater.cpp @@ -31,12 +31,65 @@ #define epicsAssertAuthor "Jeff Hill johill@lanl.gov" +#include + +#if !defined(_WIN32) && !defined(__rtems__) && !defined(vxWorks) +# include +# include +# include +#define CAN_DETACH_STDINOUT +#endif + #include "epicsAssert.h" #include "osiUnistd.h" +#include "epicsGetopt.h" #include "udpiiu.h" -int main() +static void usage(char* argv[]) { + fprintf(stderr, "Usage: %s -hv\n" + "\n" + " -h - Print this message\n" + " -v - Do not replace stdin/out/err with /dev/null\n", + argv[0]); +} + +int main(int argc, char* argv[]) +{ + bool detachinout = true; + + int opt; + while ((opt = getopt(argc, argv, "hv")) != -1) { + switch (opt) { + default: + usage(argv); + fprintf(stderr, "\nUnknown argument '%c'\n", opt); + return 1; + case 'h': + usage(argv); + return 0; + case 'v': + detachinout = false; + break; + } + } + +#ifdef CAN_DETACH_STDINOUT + if(detachinout) { + int readfd = open("/dev/null", O_RDONLY); + int writefd = open("/dev/null", O_WRONLY); + + dup2(readfd, 0); + dup2(writefd, 1); + dup2(writefd, 2); + + close(readfd); + close(writefd); + } +#else + (void)detachinout; +#endif + chdir ( "/" ); ca_repeater (); return ( 0 ); From bf533ac195d93dc8e30b87d2e931db12e78cd2ec Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 13 Feb 2020 08:52:18 +0000 Subject: [PATCH 061/216] win32 epicsSocketEnableAddressUseForDatagramFanout call spec apparently epicsShareAPI is required on both declaration and definition. --- modules/libcom/src/osi/os/default/osdSockAddrReuse.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/libcom/src/osi/os/default/osdSockAddrReuse.cpp b/modules/libcom/src/osi/os/default/osdSockAddrReuse.cpp index 77b387034..98ac3d098 100644 --- a/modules/libcom/src/osi/os/default/osdSockAddrReuse.cpp +++ b/modules/libcom/src/osi/os/default/osdSockAddrReuse.cpp @@ -48,7 +48,7 @@ void setfanout(SOCKET s, int opt, const char *optname) } } -void epicsSocketEnableAddressUseForDatagramFanout ( SOCKET s ) +void epicsShareAPI epicsSocketEnableAddressUseForDatagramFanout ( SOCKET s ) { #define DOIT(sock, opt) setfanout(sock, opt, #opt) #ifdef SO_REUSEPORT From c54237e34a0c2b01b26a2d163c3786ffa6fc9de3 Mon Sep 17 00:00:00 2001 From: gabadinho Date: Fri, 14 Feb 2020 11:07:11 +0100 Subject: [PATCH 062/216] - Record updates: . histogramRecord . eventRecord . aaiRecord . aaoRecord - Device support updates: . devHistogramSoft (histogramRecord) . devEventSoft (eventRecord) . devAaiSoft (aaiRecord) . devAaoSoft (aaoRecord) - Fixes in already-migrated records . lsiRecord: replaced 'struct lsidset' with typedef(ed) 'lsidset' . int64inRecord (similar as above) . int64outRecord (similar as above) . calcRecord: minor fix in init_record() prototype declaration - Note: the comments about return values in dset structs were outright copied from .c to .pod/.dbd files without confirmation if they are indeed correct! --- modules/database/src/std/dev/Makefile | 4 +++ modules/database/src/std/dev/devAaiSoft.c | 24 +++++---------- modules/database/src/std/dev/devAaoSoft.c | 25 +++++----------- modules/database/src/std/dev/devEventSoft.c | 21 ++++--------- .../database/src/std/dev/devHistogramSoft.c | 30 +++++++------------ modules/database/src/std/rec/Makefile | 6 +++- modules/database/src/std/rec/aaiRecord.c | 21 ++++--------- modules/database/src/std/rec/aaiRecord.dbd | 9 ++++++ modules/database/src/std/rec/aaoRecord.c | 21 ++++--------- modules/database/src/std/rec/aaoRecord.dbd | 9 ++++++ modules/database/src/std/rec/calcRecord.c | 2 +- modules/database/src/std/rec/eventRecord.c | 20 ++++--------- .../database/src/std/rec/eventRecord.dbd.pod | 10 +++++++ .../database/src/std/rec/histogramRecord.c | 25 +++++----------- .../database/src/std/rec/histogramRecord.dbd | 10 +++++++ modules/database/src/std/rec/int64inRecord.c | 8 ++--- modules/database/src/std/rec/int64outRecord.c | 8 ++--- modules/database/src/std/rec/lsiRecord.c | 2 +- 18 files changed, 113 insertions(+), 142 deletions(-) diff --git a/modules/database/src/std/dev/Makefile b/modules/database/src/std/dev/Makefile index d78f363b8..b582f0b47 100644 --- a/modules/database/src/std/dev/Makefile +++ b/modules/database/src/std/dev/Makefile @@ -13,7 +13,9 @@ SRC_DIRS += $(STDDIR)/dev DBD += devSoft.dbd +devAaiSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devAaiSoft.c +devAaoSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devAaoSoft.c devAiSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devAiSoft.c @@ -35,7 +37,9 @@ dbRecStd_SRCS += devBoSoftRaw.c dbRecStd_SRCS += devBoDbState.c devCalcoutSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devCalcoutSoft.c +devEventSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devEventSoft.c +devHistogramSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devHistogramSoft.c devI64inSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devI64inSoft.c diff --git a/modules/database/src/std/dev/devAaiSoft.c b/modules/database/src/std/dev/devAaiSoft.c index cb4aa0213..1f5765650 100644 --- a/modules/database/src/std/dev/devAaiSoft.c +++ b/modules/database/src/std/dev/devAaiSoft.c @@ -32,28 +32,18 @@ #include "epicsExport.h" /* Create the dset for devAaiSoft */ -static long init_record(); -static long read_aai(); +static long init_record(dbCommon *pcommon); +static long read_aai(aaiRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_aai; -} devAaiSoft = { - 5, - NULL, - NULL, - init_record, - NULL, +aaidset devAaiSoft = { + {5, NULL, NULL, init_record, NULL}, read_aai }; -epicsExportAddress(dset,devAaiSoft); +epicsExportAddress(dset, devAaiSoft); -static long init_record(aaiRecord *prec) +static long init_record(dbCommon *pcommon) { + aaiRecord *prec = (aaiRecord *)pcommon; DBLINK *plink = &prec->inp; /* This is pass 0, link hasn't been initialized yet */ diff --git a/modules/database/src/std/dev/devAaoSoft.c b/modules/database/src/std/dev/devAaoSoft.c index 3331ec1bf..98a84cd1a 100644 --- a/modules/database/src/std/dev/devAaoSoft.c +++ b/modules/database/src/std/dev/devAaoSoft.c @@ -30,28 +30,19 @@ #include "epicsExport.h" /* Create the dset for devAaoSoft */ -static long init_record(); -static long write_aao(); +static long init_record(dbCommon *pcommon); +static long write_aao(aaoRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_aao; -} devAaoSoft = { - 5, - NULL, - NULL, - init_record, - NULL, +aaodset devAaoSoft = { + {5, NULL, NULL, init_record, NULL}, write_aao }; -epicsExportAddress(dset,devAaoSoft); +epicsExportAddress(dset, devAaoSoft); -static long init_record(aaoRecord *prec) +static long init_record(dbCommon *pcommon) { + aaoRecord *prec = (aaoRecord *)pcommon; + if (dbLinkIsConstant(&prec->out)) { prec->nord = 0; } diff --git a/modules/database/src/std/dev/devEventSoft.c b/modules/database/src/std/dev/devEventSoft.c index a748dda66..4020c91f8 100644 --- a/modules/database/src/std/dev/devEventSoft.c +++ b/modules/database/src/std/dev/devEventSoft.c @@ -25,28 +25,19 @@ #include "epicsExport.h" /* Create the dset for devEventSoft */ -static long init_record(eventRecord *prec); +static long init_record(dbCommon *pcommon); static long read_event(eventRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_event; -} devEventSoft = { - 5, - NULL, - NULL, - init_record, - NULL, +eventdset devEventSoft = { + {5, NULL, NULL, init_record, NULL}, read_event }; epicsExportAddress(dset, devEventSoft); -static long init_record(eventRecord *prec) +static long init_record(dbCommon *pcommon) { + eventRecord *prec = (eventRecord *)pcommon; + if (recGblInitConstantLink(&prec->inp, DBF_STRING, prec->val)) prec->udf = FALSE; diff --git a/modules/database/src/std/dev/devHistogramSoft.c b/modules/database/src/std/dev/devHistogramSoft.c index 3b46b5d99..a410fef5c 100644 --- a/modules/database/src/std/dev/devHistogramSoft.c +++ b/modules/database/src/std/dev/devHistogramSoft.c @@ -28,29 +28,19 @@ #include "epicsExport.h" /* Create the dset for devHistogramSoft */ -static long init_record(histogramRecord *prec); +static long init_record(dbCommon *pcommon); static long read_histogram(histogramRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_histogram; - DEVSUPFUN special_linconv; -}devHistogramSoft={ - 6, - NULL, - NULL, - init_record, - NULL, - read_histogram, - NULL + +histogramdset devHistogramSoft = { + {6, NULL, NULL, init_record, NULL}, + read_histogram, NULL }; -epicsExportAddress(dset,devHistogramSoft); - -static long init_record(histogramRecord *prec) +epicsExportAddress(dset, devHistogramSoft); + +static long init_record(dbCommon *pcommon) { + histogramRecord *prec = (histogramRecord *)pcommon; + if (recGblInitConstantLink(&prec->svl,DBF_DOUBLE,&prec->sgnl)) prec->udf = FALSE; diff --git a/modules/database/src/std/rec/Makefile b/modules/database/src/std/rec/Makefile index 8c37732e2..51f54dbdf 100644 --- a/modules/database/src/std/rec/Makefile +++ b/modules/database/src/std/rec/Makefile @@ -11,11 +11,13 @@ SRC_DIRS += $(STDDIR)/rec +aaiRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += aaiRecord +aaoRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += aaoRecord aiRecord_CFLAGS += -DUSE_TYPED_DSET -aoRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += aiRecord +aoRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += aoRecord stdRecords += aSubRecord biRecord_CFLAGS += -DUSE_TYPED_DSET @@ -27,8 +29,10 @@ calcoutRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += calcoutRecord stdRecords += compressRecord stdRecords += dfanoutRecord +eventRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += eventRecord stdRecords += fanoutRecord +histogramRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += histogramRecord int64inRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += int64inRecord diff --git a/modules/database/src/std/rec/aaiRecord.c b/modules/database/src/std/rec/aaiRecord.c index 51af45f61..e8143aedd 100644 --- a/modules/database/src/std/rec/aaiRecord.c +++ b/modules/database/src/std/rec/aaiRecord.c @@ -90,22 +90,13 @@ rset aaiRSET={ }; epicsExportAddress(rset,aaiRSET); -struct aaidset { /* aai dset */ - long number; - DEVSUPFUN dev_report; - DEVSUPFUN init; - DEVSUPFUN init_record; /*returns: (-1,0)=>(failure,success)*/ - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_aai; /*returns: (-1,0)=>(failure,success)*/ -}; - static void monitor(aaiRecord *); static long readValue(aaiRecord *); static long init_record(struct dbCommon *pcommon, int pass) { struct aaiRecord *prec = (struct aaiRecord *)pcommon; - struct aaidset *pdset = (struct aaidset *)(prec->dset); + aaidset *pdset = (aaidset *)(prec->dset); /* must have dset defined */ if (!pdset) { @@ -125,8 +116,8 @@ static long init_record(struct dbCommon *pcommon, int pass) not change after links are established before pass 1 */ - if (pdset->init_record) { - long status = pdset->init_record(prec); + if (pdset->common.init_record) { + long status = pdset->common.init_record(pcommon); /* init_record may set the bptr to point to the data */ if (status) @@ -143,7 +134,7 @@ static long init_record(struct dbCommon *pcommon, int pass) recGblInitSimm(pcommon, &prec->sscn, &prec->oldsimm, &prec->simm, &prec->siml); /* must have read_aai function defined */ - if (pdset->number < 5 || pdset->read_aai == NULL) { + if (pdset->common.number < 5 || pdset->read_aai == NULL) { recGblRecordError(S_dev_missingSup, prec, "aai: init_record"); return S_dev_missingSup; } @@ -153,7 +144,7 @@ static long init_record(struct dbCommon *pcommon, int pass) static long process(struct dbCommon *pcommon) { struct aaiRecord *prec = (struct aaiRecord *)pcommon; - struct aaidset *pdset = (struct aaidset *)(prec->dset); + aaidset *pdset = (aaidset *)(prec->dset); long status; unsigned char pact = prec->pact; @@ -339,7 +330,7 @@ static void monitor(aaiRecord *prec) static long readValue(aaiRecord *prec) { - struct aaidset *pdset = (struct aaidset *) prec->dset; + aaidset *pdset = (aaidset *) prec->dset; long status; /* NB: Device support must post updates to NORD */ diff --git a/modules/database/src/std/rec/aaiRecord.dbd b/modules/database/src/std/rec/aaiRecord.dbd index b4675b302..bc29209ca 100644 --- a/modules/database/src/std/rec/aaiRecord.dbd +++ b/modules/database/src/std/rec/aaiRecord.dbd @@ -12,6 +12,15 @@ menu(aaiPOST) { } recordtype(aai) { include "dbCommon.dbd" + % + %/* Declare Device Support Entry Table */ + %struct aaiRecord; + %typedef struct aaidset { + % dset common; /*init_record returns: (-1,0)=>(failure,success)*/ + % long (*read_aai)(struct aaiRecord *prec); /*returns: (-1,0)=>(failure,success)*/ + %} aaidset; + %#define HAS_aaidset + % field(VAL,DBF_NOACCESS) { prompt("Value") asl(ASL0) diff --git a/modules/database/src/std/rec/aaoRecord.c b/modules/database/src/std/rec/aaoRecord.c index ccf05179f..feb4e3479 100644 --- a/modules/database/src/std/rec/aaoRecord.c +++ b/modules/database/src/std/rec/aaoRecord.c @@ -90,22 +90,13 @@ rset aaoRSET={ }; epicsExportAddress(rset,aaoRSET); -struct aaodset { /* aao dset */ - long number; - DEVSUPFUN dev_report; - DEVSUPFUN init; - DEVSUPFUN init_record; /*returns: (-1,0)=>(failure,success)*/ - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_aao; /*returns: (-1,0)=>(failure,success)*/ -}; - static void monitor(aaoRecord *); static long writeValue(aaoRecord *); static long init_record(struct dbCommon *pcommon, int pass) { struct aaoRecord *prec = (struct aaoRecord *)pcommon; - struct aaodset *pdset = (struct aaodset *)(prec->dset); + aaodset *pdset = (aaodset *)(prec->dset); long status; /* must have dset defined */ @@ -130,9 +121,9 @@ static long init_record(struct dbCommon *pcommon, int pass) not change after links are established before pass 1 */ - if (pdset->init_record) { + if (pdset->common.init_record) { /* init_record may set the bptr to point to the data */ - if ((status = pdset->init_record(prec))) + if ((status = pdset->common.init_record(pcommon))) return status; } if (!prec->bptr) { @@ -146,7 +137,7 @@ static long init_record(struct dbCommon *pcommon, int pass) recGblInitSimm(pcommon, &prec->sscn, &prec->oldsimm, &prec->simm, &prec->siml); /* must have write_aao function defined */ - if (pdset->number < 5 || pdset->write_aao == NULL) { + if (pdset->common.number < 5 || pdset->write_aao == NULL) { recGblRecordError(S_dev_missingSup, prec, "aao: init_record"); return S_dev_missingSup; } @@ -156,7 +147,7 @@ static long init_record(struct dbCommon *pcommon, int pass) static long process(struct dbCommon *pcommon) { struct aaoRecord *prec = (struct aaoRecord *)pcommon; - struct aaodset *pdset = (struct aaodset *)(prec->dset); + aaodset *pdset = (aaodset *)(prec->dset); long status; unsigned char pact = prec->pact; @@ -339,7 +330,7 @@ static void monitor(aaoRecord *prec) static long writeValue(aaoRecord *prec) { - struct aaodset *pdset = (struct aaodset *) prec->dset; + aaodset *pdset = (aaodset *) prec->dset; long status = 0; if (!prec->pact) { diff --git a/modules/database/src/std/rec/aaoRecord.dbd b/modules/database/src/std/rec/aaoRecord.dbd index 20e957ff4..aebb769e0 100644 --- a/modules/database/src/std/rec/aaoRecord.dbd +++ b/modules/database/src/std/rec/aaoRecord.dbd @@ -12,6 +12,15 @@ menu(aaoPOST) { } recordtype(aao) { include "dbCommon.dbd" + % + %/* Declare Device Support Entry Table */ + %struct aaoRecord; + %typedef struct aaodset { + % dset common; /*init_record returns: (-1,0)=>(failure,success)*/ + % long (*write_aao)(struct aaoRecord *prec); /*returns: (-1,0)=>(failure,success)*/ + %} aaodset; + %#define HAS_aaodset + % field(VAL,DBF_NOACCESS) { prompt("Value") asl(ASL0) diff --git a/modules/database/src/std/rec/calcRecord.c b/modules/database/src/std/rec/calcRecord.c index 12a58d1c8..d72792a57 100644 --- a/modules/database/src/std/rec/calcRecord.c +++ b/modules/database/src/std/rec/calcRecord.c @@ -43,7 +43,7 @@ #define report NULL #define initialize NULL -static long init_record(struct dbCommon *prec, int pass); +static long init_record(struct dbCommon *pcommon, int pass); static long process(struct dbCommon *prec); static long special(DBADDR *paddr, int after); #define get_value NULL diff --git a/modules/database/src/std/rec/eventRecord.c b/modules/database/src/std/rec/eventRecord.c index c10c90240..0d03cf3e9 100644 --- a/modules/database/src/std/rec/eventRecord.c +++ b/modules/database/src/std/rec/eventRecord.c @@ -80,14 +80,6 @@ rset eventRSET={ }; epicsExportAddress(rset,eventRSET); -struct eventdset { /* event input dset */ - long number; - DEVSUPFUN dev_report; - DEVSUPFUN init; - DEVSUPFUN init_record; /*returns: (-1,0)=>(failure,success)*/ - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_event;/*(0)=> success */ -}; static void monitor(eventRecord *); static long readValue(eventRecord *); @@ -95,7 +87,7 @@ static long readValue(eventRecord *); static long init_record(struct dbCommon *pcommon, int pass) { struct eventRecord *prec = (struct eventRecord *)pcommon; - struct eventdset *pdset; + eventdset *pdset; long status=0; if (pass == 0) return 0; @@ -103,8 +95,8 @@ static long init_record(struct dbCommon *pcommon, int pass) recGblInitSimm(pcommon, &prec->sscn, &prec->oldsimm, &prec->simm, &prec->siml); recGblInitConstantLink(&prec->siol, DBF_STRING, &prec->sval); - if( (pdset=(struct eventdset *)(prec->dset)) && (pdset->init_record) ) - status=(*pdset->init_record)(prec); + if( (pdset=(eventdset *)(prec->dset)) && (pdset->common.init_record) ) + status=(*pdset->common.init_record)(pcommon); prec->epvt = eventNameToHandle(prec->val); @@ -114,11 +106,11 @@ static long init_record(struct dbCommon *pcommon, int pass) static long process(struct dbCommon *pcommon) { struct eventRecord *prec = (struct eventRecord *)pcommon; - struct eventdset *pdset = (struct eventdset *)(prec->dset); + eventdset *pdset = (eventdset *)(prec->dset); long status=0; unsigned char pact=prec->pact; - if((pdset!=NULL) && (pdset->number >= 5) && pdset->read_event ) + if((pdset!=NULL) && (pdset->common.number >= 5) && pdset->read_event ) status=readValue(prec); /* read the new value */ /* check if device support set pact */ if ( !pact && prec->pact ) return(0); @@ -173,7 +165,7 @@ static void monitor(eventRecord *prec) static long readValue(eventRecord *prec) { - struct eventdset *pdset = (struct eventdset *) prec->dset; + eventdset *pdset = (eventdset *) prec->dset; long status = 0; if (!prec->pact) { diff --git a/modules/database/src/std/rec/eventRecord.dbd.pod b/modules/database/src/std/rec/eventRecord.dbd.pod index c783e984f..4004056b5 100644 --- a/modules/database/src/std/rec/eventRecord.dbd.pod +++ b/modules/database/src/std/rec/eventRecord.dbd.pod @@ -44,6 +44,16 @@ simulation mode parameters recordtype(event) { include "dbCommon.dbd" + % + %/* Declare Device Support Entry Table */ + %struct eventRecord; + %typedef struct eventdset { + % dset common; /*init_record returns: (-1,0)=>(failure,success)*/ + % long (*read_event)(struct eventRecord *prec); /*(0)=> success */ + %} eventdset; + %#define HAS_eventdset + % + =head3 Scan Parameters The event record has the standard fields for specifying under what circumstances diff --git a/modules/database/src/std/rec/histogramRecord.c b/modules/database/src/std/rec/histogramRecord.c index 82fc91a68..1a426363d 100644 --- a/modules/database/src/std/rec/histogramRecord.c +++ b/modules/database/src/std/rec/histogramRecord.c @@ -87,17 +87,6 @@ epicsExportAddress(rset,histogramRSET); int histogramSDELprecision = 2; epicsExportAddress(int, histogramSDELprecision); -struct histogramdset { /* histogram input dset */ - long number; - DEVSUPFUN dev_report; - DEVSUPFUN init; - DEVSUPFUN init_record; /*returns: (-1,0)=>(failure,success)*/ - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_histogram;/*(0,2)=> success and add_count, don't add_count)*/ - /* if add_count then sgnl added to array */ - DEVSUPFUN special_linconv; -}; - /* control block for callback*/ typedef struct myCallback { epicsCallback callback; @@ -165,7 +154,7 @@ static long wdogInit(histogramRecord *prec) static long init_record(struct dbCommon *pcommon, int pass) { struct histogramRecord *prec = (struct histogramRecord *)pcommon; - struct histogramdset *pdset; + histogramdset *pdset; if (pass == 0) { /* allocate space for histogram array */ @@ -186,21 +175,21 @@ static long init_record(struct dbCommon *pcommon, int pass) recGblInitConstantLink(&prec->siol, DBF_DOUBLE, &prec->sval); /* must have device support defined */ - pdset = (struct histogramdset *) prec->dset; + pdset = (histogramdset *) prec->dset; if (!pdset) { recGblRecordError(S_dev_noDSET, prec, "histogram: init_record"); return S_dev_noDSET; } /* must have read_histogram function defined */ - if (pdset->number < 6 || !pdset->read_histogram) { + if (pdset->common.number < 6 || !pdset->read_histogram) { recGblRecordError(S_dev_missingSup, prec, "histogram: init_record"); return S_dev_missingSup; } /* call device support init_record */ - if (pdset->init_record) { - long status = pdset->init_record(prec); + if (pdset->common.init_record) { + long status = pdset->common.init_record(pcommon); if (status) return status; @@ -211,7 +200,7 @@ static long init_record(struct dbCommon *pcommon, int pass) static long process(struct dbCommon *pcommon) { struct histogramRecord *prec = (struct histogramRecord *)pcommon; - struct histogramdset *pdset = (struct histogramdset *) prec->dset; + histogramdset *pdset = (histogramdset *) prec->dset; int pact = prec->pact; long status; @@ -380,7 +369,7 @@ static long clear_histogram(histogramRecord *prec) static long readValue(histogramRecord *prec) { - struct histogramdset *pdset = (struct histogramdset *) prec->dset; + histogramdset *pdset = (histogramdset *) prec->dset; long status = 0; if (!prec->pact) { diff --git a/modules/database/src/std/rec/histogramRecord.dbd b/modules/database/src/std/rec/histogramRecord.dbd index 304038bf1..e615d295e 100644 --- a/modules/database/src/std/rec/histogramRecord.dbd +++ b/modules/database/src/std/rec/histogramRecord.dbd @@ -14,6 +14,16 @@ menu(histogramCMD) { } recordtype(histogram) { include "dbCommon.dbd" + % + %/* Declare Device Support Entry Table */ + %struct histogramRecord; + %typedef struct histogramdset { + % dset common; /*init_record returns: (-1,0)=>(failure,success)*/ + % long (*read_histogram)(struct histogramRecord *prec); /*(0,2)=> success and add_count, don't add_count); if add_count then sgnl added to array*/ + % long (*special_linconv)(struct histogramRecord *prec, int after); + %} histogramdset; + %#define HAS_histogramdset + % field(VAL,DBF_NOACCESS) { prompt("Value") asl(ASL0) diff --git a/modules/database/src/std/rec/int64inRecord.c b/modules/database/src/std/rec/int64inRecord.c index b802f125c..cb4d85340 100644 --- a/modules/database/src/std/rec/int64inRecord.c +++ b/modules/database/src/std/rec/int64inRecord.c @@ -91,7 +91,7 @@ static long readValue(int64inRecord *prec); static long init_record(dbCommon *pcommon, int pass) { int64inRecord *prec = (int64inRecord*)pcommon; - struct int64indset *pdset; + int64indset *pdset; long status; if (pass == 0) return 0; @@ -100,7 +100,7 @@ static long init_record(dbCommon *pcommon, int pass) recGblInitSimm(pcommon, &prec->sscn, &prec->oldsimm, &prec->simm, &prec->siml); recGblInitConstantLink(&prec->siol, DBF_INT64, &prec->sval); - if(!(pdset = (struct int64indset *)(prec->dset))) { + if(!(pdset = (int64indset *)(prec->dset))) { recGblRecordError(S_dev_noDSET,(void *)prec,"int64in: init_record"); return(S_dev_noDSET); } @@ -121,7 +121,7 @@ static long init_record(dbCommon *pcommon, int pass) static long process(dbCommon *pcommon) { int64inRecord *prec = (int64inRecord*)pcommon; - struct int64indset *pdset = (struct int64indset *)(prec->dset); + int64indset *pdset = (int64indset *)(prec->dset); long status; unsigned char pact=prec->pact; epicsTimeStamp timeLast; @@ -389,7 +389,7 @@ static void monitor(int64inRecord *prec) static long readValue(int64inRecord *prec) { - struct int64indset *pdset = (struct int64indset *) prec->dset; + int64indset *pdset = (int64indset *) prec->dset; long status = 0; if (!prec->pact) { diff --git a/modules/database/src/std/rec/int64outRecord.c b/modules/database/src/std/rec/int64outRecord.c index cbacb2739..c90518e1d 100644 --- a/modules/database/src/std/rec/int64outRecord.c +++ b/modules/database/src/std/rec/int64outRecord.c @@ -89,14 +89,14 @@ static void convert(int64outRecord *prec, epicsInt64 value); static long init_record(dbCommon *pcommon, int pass) { int64outRecord *prec = (int64outRecord*)pcommon; - struct int64outdset *pdset; + int64outdset *pdset; long status=0; if (pass == 0) return 0; recGblInitSimm(pcommon, &prec->sscn, &prec->oldsimm, &prec->simm, &prec->siml); - if(!(pdset = (struct int64outdset *)(prec->dset))) { + if(!(pdset = (int64outdset *)(prec->dset))) { recGblRecordError(S_dev_noDSET,(void *)prec,"int64out: init_record"); return(S_dev_noDSET); } @@ -121,7 +121,7 @@ static long init_record(dbCommon *pcommon, int pass) static long process(dbCommon *pcommon) { int64outRecord *prec = (int64outRecord*)pcommon; - struct int64outdset *pdset = (struct int64outdset *)(prec->dset); + int64outdset *pdset = (int64outdset *)(prec->dset); long status=0; epicsInt64 value; unsigned char pact=prec->pact; @@ -369,7 +369,7 @@ static void monitor(int64outRecord *prec) static long writeValue(int64outRecord *prec) { - struct int64outdset *pdset = (struct int64outdset *) prec->dset; + int64outdset *pdset = (int64outdset *) prec->dset; long status = 0; if (!prec->pact) { diff --git a/modules/database/src/std/rec/lsiRecord.c b/modules/database/src/std/rec/lsiRecord.c index 96e870b0e..6d5b9db4a 100644 --- a/modules/database/src/std/rec/lsiRecord.c +++ b/modules/database/src/std/rec/lsiRecord.c @@ -221,7 +221,7 @@ static void monitor(lsiRecord *prec) static long readValue(lsiRecord *prec) { - struct lsidset *pdset = (struct lsidset *) prec->dset; + lsidset *pdset = (lsidset *) prec->dset; long status = 0; if (!prec->pact) { From 97bf9171c6c08b4a02141c05dca33c2022a4b301 Mon Sep 17 00:00:00 2001 From: hanlet Date: Wed, 12 Feb 2020 08:56:27 -0600 Subject: [PATCH 063/216] Added Multicast to caRepeater Modifications to allow for CA multicast listening by adding multicast address from EPICS_CA_BEACON_ADDR_LIST (or EPICS_CA_ADDR_LIST if beacon list is empty). Original modifications from Jim Smedinghoff, with further changes by Pierrick Hanlet. --- modules/ca/src/client/repeater.cpp | 53 +++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/modules/ca/src/client/repeater.cpp b/modules/ca/src/client/repeater.cpp index 61ba33fc5..67429e659 100644 --- a/modules/ca/src/client/repeater.cpp +++ b/modules/ca/src/client/repeater.cpp @@ -74,6 +74,7 @@ #include "caProto.h" #include "udpiiu.h" #include "repeaterClient.h" +#include "addrList.h" /* @@ -92,7 +93,7 @@ static int makeSocket ( unsigned short port, bool reuseAddr, SOCKET * pSock ) SOCKET sock = epicsSocketCreate ( AF_INET, SOCK_DGRAM, 0 ); if ( sock == INVALID_SOCKET ) { - *pSock = sock; + *pSock = sock; return SOCKERRNO; } @@ -517,6 +518,56 @@ void ca_repeater () return; } +#ifdef IP_ADD_MEMBERSHIP + /* + * join UDP socket to any multicast groups + */ + { + ELLLIST casBeaconAddrList = ELLLIST_INIT; + ELLLIST casMergeAddrList = ELLLIST_INIT; + + /* + * collect user specified beacon address list; + * check BEACON_ADDR_LIST list first; if no result, take CA_ADDR_LIST + */ + if(!addAddrToChannelAccessAddressList(&casMergeAddrList,&EPICS_CAS_BEACON_ADDR_LIST,port,0)) { + addAddrToChannelAccessAddressList(&casMergeAddrList,&EPICS_CA_ADDR_LIST,port,0); + } + + /* First clean up */ + removeDuplicateAddresses(&casBeaconAddrList, &casMergeAddrList , 0); + + osiSockAddrNode *pNode; + for(pNode = (osiSockAddrNode*)ellFirst(&casBeaconAddrList); + pNode; + pNode = (osiSockAddrNode*)ellNext(&pNode->node)) + { + + if(pNode->addr.ia.sin_family==AF_INET) { + epicsUInt32 top = ntohl(pNode->addr.ia.sin_addr.s_addr)>>24; + if(top>=224 && top<=239) { + + /* This is a multi-cast address */ + struct ip_mreq mreq; + + memset(&mreq, 0, sizeof(mreq)); + mreq.imr_multiaddr = pNode->addr.ia.sin_addr; + mreq.imr_interface.s_addr = INADDR_ANY; + + if (setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, + (char *) &mreq, sizeof(mreq)) != 0) { + char name[40]; + char sockErrBuf[64]; + epicsSocketConvertErrnoToString (sockErrBuf, sizeof ( sockErrBuf ) ); + ipAddrToDottedIP (&pNode->addr.ia, name, sizeof(name)); + errlogPrintf("caR: Socket mcast join to %s failed: %s\n", name, sockErrBuf ); + } + } + } + } + } +#endif + debugPrintf ( ( "CA Repeater: Attached and initialized\n" ) ); while ( true ) { From b5be8b2eaf5422c3839f2db946602d6c5c7c59cd Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Fri, 14 Feb 2020 11:58:17 +0000 Subject: [PATCH 064/216] update PVA --- modules/pvAccess | 2 +- modules/pvData | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/pvAccess b/modules/pvAccess index 9a02377b3..2c199fe50 160000 --- a/modules/pvAccess +++ b/modules/pvAccess @@ -1 +1 @@ -Subproject commit 9a02377b3d5e1cbdce619ffeeeed9240748aa3af +Subproject commit 2c199fe50c20b9038d87c68924d3aef5f3c2fa45 diff --git a/modules/pvData b/modules/pvData index 94eff54fa..3d93a80cc 160000 --- a/modules/pvData +++ b/modules/pvData @@ -1 +1 @@ -Subproject commit 94eff54fa99879bfaa2020806f18b169acc7f764 +Subproject commit 3d93a80cce58eb4a639d8be9866aff57b2930e45 From 3465c0c8b03602ebeb765374ad144b80f8dd1967 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Fri, 14 Feb 2020 13:24:50 +0000 Subject: [PATCH 065/216] simmTest imprecise --- modules/database/test/std/rec/simmTest.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/database/test/std/rec/simmTest.c b/modules/database/test/std/rec/simmTest.c index 6558bfec7..24d8e4dc7 100644 --- a/modules/database/test/std/rec/simmTest.c +++ b/modules/database/test/std/rec/simmTest.c @@ -436,8 +436,12 @@ void testSimmDelay(const char *name, testdbGetFieldEqual(namePACT, DBR_USHORT, 1); epicsTimeGetCurrent(&now); epicsThreadSleep(1.75*delay); + if(testImpreciseTiming()) + testTodoBegin("imprecise"); testdbGetFieldEqual(namePACT, DBR_USHORT, 0); testOk(epicsTimeLessThan(&now, mytime), "time stamp taken from second pass processing"); + if(testImpreciseTiming()) + testTodoEnd(); /* Reset delay */ *psdly = -1.; From 8668cc12671f1144ba8f957b6647efbfb5827bb3 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Fri, 14 Feb 2020 13:28:44 +0000 Subject: [PATCH 066/216] testTodoEnd() needs to lock when NULLing --- modules/libcom/src/misc/epicsUnitTest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/libcom/src/misc/epicsUnitTest.c b/modules/libcom/src/misc/epicsUnitTest.c index 22fbc1f2a..40e67a147 100644 --- a/modules/libcom/src/misc/epicsUnitTest.c +++ b/modules/libcom/src/misc/epicsUnitTest.c @@ -176,7 +176,7 @@ void testTodoBegin(const char *why) { } void testTodoEnd(void) { - todo = NULL; + testTodoBegin(NULL); } int testDiag(const char *fmt, ...) { From d82529058aea2adfca19e411139712c98c4bb251 Mon Sep 17 00:00:00 2001 From: Gabriel Fedel Date: Thu, 13 Feb 2020 11:26:12 +0100 Subject: [PATCH 067/216] Add a test to record seq in "Specified" mode --- modules/database/test/std/rec/Makefile | 7 +++ modules/database/test/std/rec/seqTest.c | 55 ++++++++++++++++++++++++ modules/database/test/std/rec/seqTest.db | 39 +++++++++++++++++ 3 files changed, 101 insertions(+) create mode 100644 modules/database/test/std/rec/seqTest.c create mode 100644 modules/database/test/std/rec/seqTest.db diff --git a/modules/database/test/std/rec/Makefile b/modules/database/test/std/rec/Makefile index 357dd5306..8c087b347 100644 --- a/modules/database/test/std/rec/Makefile +++ b/modules/database/test/std/rec/Makefile @@ -77,6 +77,13 @@ testHarness_SRCS += softTest.c TESTFILES += ../softTest.db TESTS += softTest +TESTPROD_HOST += seqTest +seqTest_SRCS += seqTest.c +seqTest_SRCS += recTestIoc_registerRecordDeviceDriver.cpp +testHarness_SRCS += seqTest.c +TESTFILES += ../seqTest.db +TESTS += seqTest + TARGETS += $(COMMON_DIR)/asTestIoc.dbd DBDDEPENDS_FILES += asTestIoc.dbd$(DEP) asTestIoc_DBD += base.dbd diff --git a/modules/database/test/std/rec/seqTest.c b/modules/database/test/std/rec/seqTest.c new file mode 100644 index 000000000..f43d15f29 --- /dev/null +++ b/modules/database/test/std/rec/seqTest.c @@ -0,0 +1,55 @@ +/*************************************************************************\ +* Copyright (c) 2020 Gabriel Fedel +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ + +#include "dbUnitTest.h" +#include "testMain.h" +#include "errlog.h" +#include "dbAccess.h" +#include + +void recTestIoc_registerRecordDeviceDriver(struct dbBase *); + +/* + * This test verifies the behavior of seq using Specified for SELM + * The behavior should be the same for all the DOLx + * */ +static +void testSeqSpecified(void){ + int i; + for (i=0; i < 16; i++) { + testdbPutFieldOk("seq0.SELN", DBR_USHORT, i); + + testdbPutFieldOk("ai0", DBR_LONG, 0); + + testdbPutFieldOk("seq0.PROC", DBR_USHORT, 1); + + testSyncCallback(); + testdbGetFieldEqual("ai0", DBR_LONG, i+1); + } +} + + +MAIN(eventTest) { + testPlan(4*16); + + testdbPrepare(); + + testdbReadDatabase("recTestIoc.dbd", NULL, NULL); + recTestIoc_registerRecordDeviceDriver(pdbbase); + + testdbReadDatabase("seqTest.db", NULL, NULL); + + eltc(0); + testIocInitOk(); + eltc(1); + + testSeqSpecified(); + + testIocShutdownOk(); + testdbCleanup(); + + return testDone(); +} diff --git a/modules/database/test/std/rec/seqTest.db b/modules/database/test/std/rec/seqTest.db new file mode 100644 index 000000000..fcba9ac35 --- /dev/null +++ b/modules/database/test/std/rec/seqTest.db @@ -0,0 +1,39 @@ +record(seq, "seq0"){ + field(SELM, "Specified") + field(DOL0, "1") + field(DOL1, "2") + field(DOL2, "3") + field(DOL3, "4") + field(DOL4, "5") + field(DOL5, "6") + field(DOL6, "7") + field(DOL7, "8") + field(DOL8, "9") + field(DOL9, "10") + field(DOLA, "11") + field(DOLB, "12") + field(DOLC, "13") + field(DOLD, "14") + field(DOLE, "15") + field(DOLF, "16") + field(LNK0, "ai0") + field(LNK1, "ai0") + field(LNK2, "ai0") + field(LNK3, "ai0") + field(LNK4, "ai0") + field(LNK5, "ai0") + field(LNK6, "ai0") + field(LNK7, "ai0") + field(LNK8, "ai0") + field(LNK9, "ai0") + field(LNKA, "ai0") + field(LNKB, "ai0") + field(LNKC, "ai0") + field(LNKD, "ai0") + field(LNKE, "ai0") + field(LNKF, "ai0") + +} +record(ai, "ai0"){ +} + From 90c0f5c48d133cfd0b394cd724eddbca6ff41a1b Mon Sep 17 00:00:00 2001 From: Gabriel Fedel Date: Thu, 13 Feb 2020 11:42:27 +0100 Subject: [PATCH 068/216] Fix seq to work correctly on "Specified" mode On Specified mode is expected that when seq is processed the value from DOL0 (fixed or links) is set on LNK0, if SELN = 0 (and OFFS = 0). --- modules/database/src/std/rec/seqRecord.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/database/src/std/rec/seqRecord.c b/modules/database/src/std/rec/seqRecord.c index 8b88f80ac..4b026a99b 100644 --- a/modules/database/src/std/rec/seqRecord.c +++ b/modules/database/src/std/rec/seqRecord.c @@ -156,8 +156,6 @@ static long process(struct dbCommon *pcommon) recGblSetSevr(prec, SOFT_ALARM, INVALID_ALARM); return asyncFinish(prec); } - if (grpn == 0) - return asyncFinish(prec); lmask = 1 << grpn; } From 983937a52ff9ffe04b3013b51dd240fe8da3f0c5 Mon Sep 17 00:00:00 2001 From: Gabriel Fedel Date: Tue, 11 Feb 2020 12:45:07 +0100 Subject: [PATCH 069/216] Fix event record device support with constant INP This fix apply to event record device with constant INP. Now when the event record is proccessed the associated records with the same SCAN setup get triggered correctly, it is not more necessary to set VAL on event record. Fixes lp: #1829770 --- src/std/rec/eventRecord.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/std/rec/eventRecord.c b/src/std/rec/eventRecord.c index a135a3a37..2ba4859a5 100644 --- a/src/std/rec/eventRecord.c +++ b/src/std/rec/eventRecord.c @@ -106,10 +106,11 @@ static long init_record(eventRecord *prec, int pass) recGblInitConstantLink(&prec->siol,DBF_STRING,&prec->sval); } - prec->epvt = eventNameToHandle(prec->val); - if( (pdset=(struct eventdset *)(prec->dset)) && (pdset->init_record) ) status=(*pdset->init_record)(prec); + + prec->epvt = eventNameToHandle(prec->val); + return(status); } From 4844fbbd8271e513d2baf7cd3726a10619c3fa9c Mon Sep 17 00:00:00 2001 From: Bryan Robert Tester Date: Wed, 12 Feb 2020 15:11:38 +0000 Subject: [PATCH 070/216] moved listen into rsrv_grab_tcp to allow retry if failed Fixes race condition with multiple IOCs starting simultaneously. --- src/ioc/rsrv/caservertask.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/ioc/rsrv/caservertask.c b/src/ioc/rsrv/caservertask.c index 80310a422..24fa5859f 100644 --- a/src/ioc/rsrv/caservertask.c +++ b/src/ioc/rsrv/caservertask.c @@ -66,17 +66,6 @@ static void req_server (void *pParm) IOC_sock = conf->tcp; - /* listen and accept new connections */ - if ( listen ( IOC_sock, 20 ) < 0 ) { - char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( - sockErrBuf, sizeof ( sockErrBuf ) ); - errlogPrintf ( "CAS: Listen error: %s\n", - sockErrBuf ); - epicsSocketDestroy (IOC_sock); - epicsThreadSuspendSelf (); - } - epicsEventSignal(castcp_startStopEvent); while (TRUE) { @@ -194,7 +183,7 @@ SOCKET* rsrv_grab_tcp(unsigned short *port) epicsSocketEnableAddressReuseDuringTimeWaitState ( tcpsock ); - if(bind(tcpsock, &scratch.sa, sizeof(scratch))==0) { + if(bind(tcpsock, &scratch.sa, sizeof(scratch))==0 && listen(tcpsock, 20)==0) { if(scratch.ia.sin_port==0) { /* use first socket to pick a random port */ osiSocklen_t alen = sizeof(ifaceAddr); From 803593560dc160ef5c971ef04908574e6dc88c37 Mon Sep 17 00:00:00 2001 From: Freddie Akeroyd Date: Mon, 17 Feb 2020 12:22:20 +0000 Subject: [PATCH 071/216] Remove redundant left logical shift --- src/libCom/calc/calcPerform.c | 24 ++++++------------------ src/libCom/calc/postfix.c | 4 +--- src/libCom/calc/postfixPvt.h | 3 +-- src/libCom/test/epicsCalcTest.cpp | 15 +-------------- 4 files changed, 9 insertions(+), 37 deletions(-) diff --git a/src/libCom/calc/calcPerform.c b/src/libCom/calc/calcPerform.c index 1d675cffc..4a073c774 100644 --- a/src/libCom/calc/calcPerform.c +++ b/src/libCom/calc/calcPerform.c @@ -32,11 +32,6 @@ static int cond_search(const char **ppinst, int match); #define PI 3.14159265358979323 #endif -/* Turn off global optimization for 64-bit MSVC builds */ -#if 0 && defined(_WIN32) && defined(_M_X64) && !defined(_MINGW) -# pragma optimize("g", off) -#endif - /* calcPerform * * Evalutate the postfix expression @@ -319,9 +314,12 @@ epicsShareFunc long *ptop = (double)~d2i(*ptop); break; - /* The shift operators use signed integers, so a right-shift will - * extend the sign bit into the left-hand end of the value. The - * double-casting through unsigned here is important, see above. + /* In C the shift operators decide on an arithmetic or logical shift + * based on whether the integer is signed or unsigned. + * With signed integers, a right-shift is arithmetic and will + * extend the sign bit into the left-hand end of the value. When used + * with unsigned values a logical shift is performed. The + * double-casting through signed/unsigned here is important, see above. */ case RIGHT_SHIFT_ARITH: @@ -339,11 +337,6 @@ epicsShareFunc long *ptop = (double)(d2ui(*ptop) >> (d2ui(top) & 31u)); break; - case LEFT_SHIFT_LOGIC: - top = *ptop--; - *ptop = (double)(d2ui(*ptop) << (d2ui(top) & 31u)); - break; - case NOT_EQ: top = *ptop--; *ptop = *ptop != top; @@ -398,11 +391,6 @@ epicsShareFunc long *presult = *ptop; return 0; } -#if 0 && defined(_WIN32) && defined(_M_X64) && !defined(_MINGW) -# pragma optimize("", on) -#endif - - epicsShareFunc long calcArgUsage(const char *pinst, unsigned long *pinputs, unsigned long *pstores) diff --git a/src/libCom/calc/postfix.c b/src/libCom/calc/postfix.c index cf54eb8ec..54d629b40 100644 --- a/src/libCom/calc/postfix.c +++ b/src/libCom/calc/postfix.c @@ -149,7 +149,6 @@ static const ELEMENT operators[] = { {";", 0, 0, 0, EXPR_TERMINATOR,NOT_GENERATED}, {"<", 3, 3, -1, BINARY_OPERATOR,LESS_THAN}, {"<<", 2, 2, -1, BINARY_OPERATOR,LEFT_SHIFT_ARITH}, -{"<<<", 2, 2, -1, BINARY_OPERATOR,LEFT_SHIFT_LOGIC}, {"<=", 3, 3, -1, BINARY_OPERATOR,LESS_OR_EQ}, {"=", 3, 3, -1, BINARY_OPERATOR,EQUAL}, {"==", 3, 3, -1, BINARY_OPERATOR,EQUAL}, @@ -582,9 +581,8 @@ epicsShareFunc void "BIT_EXCL_OR", "BIT_NOT", "RIGHT_SHIFT_ARITH", - "RIGHT_SHIFT_LOGIC", "LEFT_SHIFT_ARITH", - "LEFT_SHIFT_LOGIC", + "RIGHT_SHIFT_LOGIC", /* Relationals */ "NOT_EQ", "LESS_THAN", diff --git a/src/libCom/calc/postfixPvt.h b/src/libCom/calc/postfixPvt.h index 5b2ba0a7b..739cdbb78 100644 --- a/src/libCom/calc/postfixPvt.h +++ b/src/libCom/calc/postfixPvt.h @@ -85,9 +85,8 @@ typedef enum { BIT_EXCL_OR, BIT_NOT, RIGHT_SHIFT_ARITH, - RIGHT_SHIFT_LOGIC, LEFT_SHIFT_ARITH, - LEFT_SHIFT_LOGIC, + RIGHT_SHIFT_LOGIC, /* Relationals */ NOT_EQ, LESS_THAN, diff --git a/src/libCom/test/epicsCalcTest.cpp b/src/libCom/test/epicsCalcTest.cpp index a0131cd31..5f7d68826 100644 --- a/src/libCom/test/epicsCalcTest.cpp +++ b/src/libCom/test/epicsCalcTest.cpp @@ -297,7 +297,7 @@ MAIN(epicsCalcTest) const double a=1.0, b=2.0, c=3.0, d=4.0, e=5.0, f=6.0, g=7.0, h=8.0, i=9.0, j=10.0, k=11.0, l=12.0; - testPlan(643); + testPlan(630); /* LITERAL_OPERAND elements */ testExpr(0); @@ -688,9 +688,7 @@ MAIN(epicsCalcTest) testExpr(NaN < NaN); testExpr(1 << 2); - testCalc("1 <<< 2", 1u << 2u); testExpr(1 << 3 << 2); - testCalc("1 <<< 3 <<< 2", 1u << 3u << 2u); testExpr(0 <= 1); testExpr(0 <= 0); @@ -877,9 +875,7 @@ MAIN(epicsCalcTest) testExpr(2 | 4 / 2); // 1 5 testCalc("1 | 2 ** 3", 1 | (int) pow(2., 3.));// 1 6 testExpr(3 << 2 & 10); // 2 2 - testCalc("3 <<< 2 & 10", 3u << 2u & 10u); // 2 2 testCalc("18 & 6 << 2", (18 & 6) << 2); // 2 2 - testCalc("18 & 6 <<< 2", (18u & 6u) << 2u); // 2 2 testExpr(36 >> 2 & 10); // 2 2 testCalc("36 >>> 2 & 10", 36u >> 2u & 10u); // 2 2 testCalc("18 & 20 >> 2", (18 & 20) >> 2); // 2 2 @@ -887,7 +883,6 @@ MAIN(epicsCalcTest) testExpr(3 & 4 == 4); // 2 3 testExpr(3 AND 4 == 4); // 2 3 testCalc("1 << 2 != 4", 1 << (2 != 4)); // 2 3 - testCalc("1 <<< 2 != 4", 1u << (2u != 4u)); // 2 3 testCalc("16 >> 2 != 4", 16 >> (2 != 4)); // 2 3 testCalc("16 >>> 2 != 4", 16u >> (2u != 4u)); // 2 3 testExpr(3 AND -2); // 2 8 @@ -966,8 +961,6 @@ MAIN(epicsCalcTest) testUInt32Calc("0x55555555 >>> 8", 0x00555555u); testUInt32Calc("0xaaaaaaaa << 8", 0xaaaaaa00u); testUInt32Calc("0x55555555 << 8", 0x55555500u); - testUInt32Calc("0xaaaaaaaa <<< 8", 0xaaaaaa00u); - testUInt32Calc("0x55555555 <<< 8", 0x55555500u); // using integer literals assigned to variables testUInt32Calc("a:=0xaaaaaaaa; b:=0xffff0000; a AND b", 0xaaaa0000u); testUInt32Calc("a:=0xaaaaaaaa; b:=0xffff0000; a OR b", 0xffffaaaau); @@ -977,11 +970,9 @@ MAIN(epicsCalcTest) testUInt32Calc("a:=0xaaaaaaaa; a >> 8", 0xffaaaaaau); testUInt32Calc("a:=0xaaaaaaaa; a >>> 8", 0x00aaaaaau); testUInt32Calc("a:=0xaaaaaaaa; a << 8", 0xaaaaaa00u); - testUInt32Calc("a:=0xaaaaaaaa; a <<< 8", 0xaaaaaa00u); testUInt32Calc("a:=0x55555555; a >> 8", 0x00555555u); testUInt32Calc("a:=0x55555555; a >>> 8", 0x00555555u); testUInt32Calc("a:=0x55555555; a << 8", 0x55555500u); - testUInt32Calc("a:=0x55555555; a <<< 8", 0x55555500u); // Test proper conversion of double values (+ 0.1 enforces double literal) // when used as inputs to the bitwise operations. @@ -1009,13 +1000,9 @@ MAIN(epicsCalcTest) testUInt32Calc("2863311530.1 >> 0.1", 0xaaaaaaaau); testUInt32Calc("2863311530.1 >>> 0.1", 0xaaaaaaaau); testUInt32Calc("-1431655766.1 << 0", 0xaaaaaaaau); - testUInt32Calc("-1431655766.1 <<< 0", 0xaaaaaaaau); testUInt32Calc("2863311530.1 << 0", 0xaaaaaaaau); - testUInt32Calc("2863311530.1 <<< 0", 0xaaaaaaaau); testUInt32Calc("-1431655766.1 << 0.1", 0xaaaaaaaau); - testUInt32Calc("-1431655766.1 <<< 0.1", 0xaaaaaaaau); testUInt32Calc("2863311530.1 << 0.1", 0xaaaaaaaau); - testUInt32Calc("2863311530.1 <<< 0.1", 0xaaaaaaaau); return testDone(); } From 8250339e0df18d7922dce4eb70ee44ed7a6d2bd7 Mon Sep 17 00:00:00 2001 From: Freddie Akeroyd Date: Mon, 17 Feb 2020 12:46:11 +0000 Subject: [PATCH 072/216] Update record pod documentation --- src/std/rec/calcRecord.dbd.pod | 7 +++++-- src/std/rec/calcoutRecord.dbd.pod | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/std/rec/calcRecord.dbd.pod b/src/std/rec/calcRecord.dbd.pod index 243c81eee..83b8edd76 100644 --- a/src/std/rec/calcRecord.dbd.pod +++ b/src/std/rec/calcRecord.dbd.pod @@ -318,10 +318,13 @@ XOR : Bitwise Exclusive Or C<~> : One's Complement =item * -C<<< << >>> : Left shift +C<<< << >>> : Arithmetic Left Shift =item * -C<<< >> >>> : Right shift +C<<< >> >>> : Arithmetic Right Shift + +=item * +C<<<< >>> >>>> : Logical Right Shift =back diff --git a/src/std/rec/calcoutRecord.dbd.pod b/src/std/rec/calcoutRecord.dbd.pod index a59eaa348..9a1393d73 100644 --- a/src/std/rec/calcoutRecord.dbd.pod +++ b/src/std/rec/calcoutRecord.dbd.pod @@ -350,11 +350,13 @@ XOR : Bitwise Exclusive Or C<~> : One's Complement =item * -C<<< << >>> : Left shift +C<<< << >>> : Arithmetic Left Shift =item * -C<<< >> >>> : Right shift +C<<< >> >>> : Arithmetic Right Shift +=item * +C<<<< >>> >>>> : Logical Right Shift =back =head3 Assignment Operator From f2b4c412d3aa14bdf4c86fc3cd61d9cf482b4a99 Mon Sep 17 00:00:00 2001 From: Freddie Akeroyd Date: Mon, 17 Feb 2020 12:49:45 +0000 Subject: [PATCH 073/216] Fix doc typo --- src/std/rec/calcoutRecord.dbd.pod | 1 + 1 file changed, 1 insertion(+) diff --git a/src/std/rec/calcoutRecord.dbd.pod b/src/std/rec/calcoutRecord.dbd.pod index 9a1393d73..a9b2a4e59 100644 --- a/src/std/rec/calcoutRecord.dbd.pod +++ b/src/std/rec/calcoutRecord.dbd.pod @@ -357,6 +357,7 @@ C<<< >> >>> : Arithmetic Right Shift =item * C<<<< >>> >>>> : Logical Right Shift + =back =head3 Assignment Operator From a0667a122bd2e4ac9fd01f3c554a43b040e8d9e0 Mon Sep 17 00:00:00 2001 From: Freddie Akeroyd Date: Mon, 17 Feb 2020 13:29:38 +0000 Subject: [PATCH 074/216] Excluded x64 tests now need to be excluded on x86 too --- src/libCom/test/epicsCalcTest.cpp | 4 ++-- src/libCom/test/epicsMathTest.c | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/libCom/test/epicsCalcTest.cpp b/src/libCom/test/epicsCalcTest.cpp index 5f7d68826..ee2108ffb 100644 --- a/src/libCom/test/epicsCalcTest.cpp +++ b/src/libCom/test/epicsCalcTest.cpp @@ -612,14 +612,14 @@ MAIN(epicsCalcTest) testExpr(0.0 + NaN); testExpr(Inf + 0.0); testExpr(Inf + Inf); -#if defined(_WIN64) && defined(_MSC_VER) +#if defined(_WIN32) && defined(_MSC_VER) testCalc("Inf + -Inf", NaN); #else testExpr(Inf + -Inf); #endif testExpr(Inf + NaN); testExpr(-Inf + 0.0); -#if defined(_WIN64) && defined(_MSC_VER) +#if defined(_WIN32) && defined(_MSC_VER) testCalc("-Inf + Inf", NaN); #else testExpr(-Inf + Inf); diff --git a/src/libCom/test/epicsMathTest.c b/src/libCom/test/epicsMathTest.c index 8ea763cf0..ffb2426fd 100644 --- a/src/libCom/test/epicsMathTest.c +++ b/src/libCom/test/epicsMathTest.c @@ -32,23 +32,23 @@ MAIN(epicsMathTest) testOk1(epicsINF > 0.0); testOk1(epicsINF - epicsINF != 0.0); -#if defined(_WIN64) && defined(_MSC_VER) - testTodoBegin("Known failure on windows-x64"); +#if defined(_WIN32) && defined(_MSC_VER) + testTodoBegin("Known failure on windows-x64 and win32-x86"); #endif testOk1(epicsINF + -epicsINF != 0.0); testOk1(-epicsINF + epicsINF != 0.0); -#if defined(_WIN64) && defined(_MSC_VER) +#if defined(_WIN32) && defined(_MSC_VER) testTodoEnd(); #endif testOk1(isnan(epicsINF - epicsINF)); -#if defined(_WIN64) && defined(_MSC_VER) - testTodoBegin("Known failure on windows-x64"); +#if defined(_WIN32) && defined(_MSC_VER) + testTodoBegin("Known failure on windows-x64 and win32-x86"); #endif testOk1(isnan(epicsINF + -epicsINF)); testOk1(isnan(-epicsINF + epicsINF)); -#if defined(_WIN64) && defined(_MSC_VER) +#if defined(_WIN32) && defined(_MSC_VER) testTodoEnd(); #endif @@ -62,12 +62,12 @@ MAIN(epicsMathTest) testOk1(!(epicsNAN > epicsNAN)); testOk1(isnan(epicsNAN - epicsNAN)); -#if defined(_WIN64) && defined(_MSC_VER) - testTodoBegin("Known failure on windows-x64"); +#if defined(_WIN32) && defined(_MSC_VER) + testTodoBegin("Known failure on windows-x64 and win32-x86"); #endif testOk1(isnan(epicsNAN + -epicsNAN)); testOk1(isnan(-epicsNAN + epicsNAN)); -#if defined(_WIN64) && defined(_MSC_VER) +#if defined(_WIN32) && defined(_MSC_VER) testTodoEnd(); #endif From 3944b32e048b4362808ffa847cd2feb7d3525e06 Mon Sep 17 00:00:00 2001 From: Freddie Akeroyd Date: Mon, 17 Feb 2020 13:30:15 +0000 Subject: [PATCH 075/216] Add back in optimisation disable --- src/libCom/calc/calcPerform.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/libCom/calc/calcPerform.c b/src/libCom/calc/calcPerform.c index 4a073c774..40e173b61 100644 --- a/src/libCom/calc/calcPerform.c +++ b/src/libCom/calc/calcPerform.c @@ -25,6 +25,7 @@ #include "postfix.h" #include "postfixPvt.h" + static double calcRandom(void); static int cond_search(const char **ppinst, int match); @@ -32,6 +33,11 @@ static int cond_search(const char **ppinst, int match); #define PI 3.14159265358979323 #endif +/* Turn off global optimization for 64-bit MSVC builds */ +#if defined(_WIN32) && defined(_M_X64) && !defined(_MINGW) +# pragma optimize("g", off) +#endif + /* calcPerform * * Evalutate the postfix expression @@ -392,6 +398,10 @@ epicsShareFunc long return 0; } +#if defined(_WIN32) && defined(_M_X64) && !defined(_MINGW) +# pragma optimize("", on) +#endif + epicsShareFunc long calcArgUsage(const char *pinst, unsigned long *pinputs, unsigned long *pstores) { From e48cdb48aca1fcd7cbf5dae518572b1f323e4be4 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Tue, 18 Feb 2020 17:45:12 +0100 Subject: [PATCH 076/216] dbGet should not crash when source is an empty array --- src/ioc/db/dbAccess.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ioc/db/dbAccess.c b/src/ioc/db/dbAccess.c index 4ee2d677d..a8ff3f137 100644 --- a/src/ioc/db/dbAccess.c +++ b/src/ioc/db/dbAccess.c @@ -898,6 +898,11 @@ long dbGet(DBADDR *paddr, short dbrType, } else { DBADDR localAddr = *paddr; /* Structure copy */ + if (pfl->no_elements < 1) { + status = S_db_badField; + goto done; + } + localAddr.field_type = pfl->field_type; localAddr.field_size = pfl->field_size; localAddr.no_elements = pfl->no_elements; From d82d3d367975e4c686f265e9fba5549b3f0af946 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 18 Feb 2020 18:05:46 -0600 Subject: [PATCH 077/216] Combine the iocVirgin and iocStopped states into iocVoid --- src/ioc/dbStatic/dbLexRoutines.c | 2 +- src/ioc/misc/iocInit.c | 8 ++++---- src/ioc/misc/iocInit.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ioc/dbStatic/dbLexRoutines.c b/src/ioc/dbStatic/dbLexRoutines.c index 2be7b0d0c..f412711d5 100644 --- a/src/ioc/dbStatic/dbLexRoutines.c +++ b/src/ioc/dbStatic/dbLexRoutines.c @@ -216,7 +216,7 @@ static long dbReadCOM(DBBASE **ppdbbase,const char *filename, FILE *fp, char *penv; char **macPairs; - if(getIocState() != iocVirgin) + if(getIocState() != iocVoid) return -2; if(*ppdbbase == 0) *ppdbbase = dbAllocBase(); diff --git a/src/ioc/misc/iocInit.c b/src/ioc/misc/iocInit.c index 93d8908a8..1e13463a4 100644 --- a/src/ioc/misc/iocInit.c +++ b/src/ioc/misc/iocInit.c @@ -70,7 +70,7 @@ #include "registryRecordType.h" #include "rsrv.h" -static enum iocStateEnum iocState = iocVirgin; +static enum iocStateEnum iocState = iocVoid; static enum { buildRSRV, buildIsolated } iocBuildMode; @@ -104,7 +104,7 @@ int iocInit(void) static int iocBuild_1(void) { - if (iocState != iocVirgin && iocState != iocStopped) { + if (iocState != iocVoid) { errlogPrintf("iocBuild: IOC can only be initialized from uninitialized or stopped state\n"); return -1; } @@ -704,7 +704,7 @@ static void doFreeRecord(dbRecordType *pdbRecordType, dbCommon *precord, int iocShutdown(void) { - if (iocState == iocVirgin || iocState == iocStopped) return 0; + if (iocState == iocVoid) return 0; iterateRecords(doCloseLinks, NULL); if (iocBuildMode==buildIsolated) { /* stop and "join" threads */ @@ -723,7 +723,7 @@ int iocShutdown(void) dbProcessNotifyExit(); iocshFree(); } - iocState = iocStopped; + iocState = iocVoid; iocBuildMode = buildRSRV; return 0; } diff --git a/src/ioc/misc/iocInit.h b/src/ioc/misc/iocInit.h index 3e711d6c5..7e73b620a 100644 --- a/src/ioc/misc/iocInit.h +++ b/src/ioc/misc/iocInit.h @@ -14,7 +14,7 @@ #include "shareLib.h" enum iocStateEnum { - iocVirgin, iocBuilding, iocBuilt, iocRunning, iocPaused, iocStopped + iocVoid, iocBuilding, iocBuilt, iocRunning, iocPaused }; #ifdef __cplusplus From 41f1b0ffb51b611f4290dfcc9454b8b72dedbc81 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 19 Feb 2020 15:09:13 -0600 Subject: [PATCH 078/216] Fix histogram record allocation bug Found by Peter Heesterman: Potential use of NULL pcallback pointer. Nothing looks at the return value from wdogInit(), so don't bother. --- src/std/rec/histogramRecord.c | 39 +++++++++++++++-------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/src/std/rec/histogramRecord.c b/src/std/rec/histogramRecord.c index 17730991b..c37b05df9 100644 --- a/src/std/rec/histogramRecord.c +++ b/src/std/rec/histogramRecord.c @@ -133,33 +133,28 @@ static void wdogCallback(epicsCallback *arg) return; } -static long wdogInit(histogramRecord *prec) + +static void wdogInit(histogramRecord *prec) { - myCallback *pcallback; - - if (!prec->wdog && prec->sdel > 0) { - /* initialize a callback object */ - pcallback = calloc(1, sizeof(myCallback)); - pcallback->prec = prec; - if (!pcallback) - return -1; - - callbackSetCallback(wdogCallback, &pcallback->callback); - callbackSetUser(pcallback, &pcallback->callback); - callbackSetPriority(priorityLow, &pcallback->callback); - prec->wdog = pcallback; - } - - if (!prec->wdog) - return -1; - pcallback = prec->wdog; - if (!pcallback) - return -1; if (prec->sdel > 0) { + myCallback *pcallback = prec->wdog; + + if (!pcallback) { + /* initialize a callback object */ + pcallback = calloc(1, sizeof(myCallback)); + if (!pcallback) + return; + + pcallback->prec = prec; + callbackSetCallback(wdogCallback, &pcallback->callback); + callbackSetUser(pcallback, &pcallback->callback); + callbackSetPriority(priorityLow, &pcallback->callback); + prec->wdog = pcallback; + } + /* start new timer on monitor */ callbackRequestDelayed(&pcallback->callback, prec->sdel); } - return 0; } static long init_record(histogramRecord *prec, int pass) From e6914f3b8089a417c9efc31940906854be182e6b Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 24 Oct 2019 19:15:31 -0700 Subject: [PATCH 079/216] osdSockUnsentCount.c check for existance of SIO_TCP_INFO --- src/libCom/osi/os/WIN32/osdSockUnsentCount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libCom/osi/os/WIN32/osdSockUnsentCount.c b/src/libCom/osi/os/WIN32/osdSockUnsentCount.c index fe68ead01..3f4ab3eee 100644 --- a/src/libCom/osi/os/WIN32/osdSockUnsentCount.c +++ b/src/libCom/osi/os/WIN32/osdSockUnsentCount.c @@ -13,7 +13,7 @@ * See https://docs.microsoft.com/en-us/windows/win32/api/mstcpip/ns-mstcpip-tcp_info_v0 */ int epicsSocketUnsentCount(SOCKET sock) { -#if defined (_WIN32) && WINVER >= _WIN32_WINNT_WIN10 +#ifdef SIO_TCP_INFO /* Windows 10 Version 1703 / Server 2016 */ DWORD infoVersion = 0, bytesReturned; TCP_INFO_v0 tcpInfo; From cc4d888ae874063d0519ce9411dec3feaa72844e Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 29 Feb 2020 14:42:54 -0600 Subject: [PATCH 080/216] Convert epicsTempFile.cpp to .c --- modules/libcom/src/osi/Makefile | 2 +- .../src/osi/os/WIN32/{epicsTempFile.cpp => epicsTempFile.c} | 1 - .../src/osi/os/posix/{epicsTempFile.cpp => epicsTempFile.c} | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) rename modules/libcom/src/osi/os/WIN32/{epicsTempFile.cpp => epicsTempFile.c} (99%) rename modules/libcom/src/osi/os/posix/{epicsTempFile.cpp => epicsTempFile.c} (98%) diff --git a/modules/libcom/src/osi/Makefile b/modules/libcom/src/osi/Makefile index 10eb98be0..f0108e662 100644 --- a/modules/libcom/src/osi/Makefile +++ b/modules/libcom/src/osi/Makefile @@ -104,7 +104,7 @@ epicsReadline_INCLUDES += $(INCLUDES_$(COMMANDLINE_LIBRARY)) Com_SRCS += epicsReadline.c -Com_SRCS += epicsTempFile.cpp +Com_SRCS += epicsTempFile.c Com_SRCS += epicsStdio.c Com_SRCS += osdStdio.c diff --git a/modules/libcom/src/osi/os/WIN32/epicsTempFile.cpp b/modules/libcom/src/osi/os/WIN32/epicsTempFile.c similarity index 99% rename from modules/libcom/src/osi/os/WIN32/epicsTempFile.cpp rename to modules/libcom/src/osi/os/WIN32/epicsTempFile.c index 2283a8574..4d7bbf7dc 100644 --- a/modules/libcom/src/osi/os/WIN32/epicsTempFile.cpp +++ b/modules/libcom/src/osi/os/WIN32/epicsTempFile.c @@ -27,7 +27,6 @@ // allow the teporary file directory to be set with the // TMP environment varianble // -extern "C" epicsShareFunc FILE * epicsShareAPI epicsTempFile () { char * pName = _tempnam ( "c:\\tmp", "epics" ); diff --git a/modules/libcom/src/osi/os/posix/epicsTempFile.cpp b/modules/libcom/src/osi/os/posix/epicsTempFile.c similarity index 98% rename from modules/libcom/src/osi/os/posix/epicsTempFile.cpp rename to modules/libcom/src/osi/os/posix/epicsTempFile.c index c015f0418..6d7f631b2 100644 --- a/modules/libcom/src/osi/os/posix/epicsTempFile.cpp +++ b/modules/libcom/src/osi/os/posix/epicsTempFile.c @@ -13,7 +13,6 @@ #define epicsExportSharedSymbols #include "epicsTempFile.h" -extern "C" epicsShareFunc FILE * epicsShareAPI epicsTempFile ( void ) { return tmpfile (); From 5361888997b7534fd258d1aea0b6b43f8451ef42 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 29 Feb 2020 14:46:13 -0600 Subject: [PATCH 081/216] Have antelope.c include epicsTempFile.c directly --- modules/libcom/src/yacc/Makefile | 1 - modules/libcom/src/yacc/antelope.c | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/libcom/src/yacc/Makefile b/modules/libcom/src/yacc/Makefile index 4f2083037..81f80779d 100644 --- a/modules/libcom/src/yacc/Makefile +++ b/modules/libcom/src/yacc/Makefile @@ -23,7 +23,6 @@ antelope_SRCS += skeleton.c antelope_SRCS += symtab.c antelope_SRCS += verbose.c antelope_SRCS += warshall.c -antelope_OBJS += epicsTempFile$(OBJ) PROD_HOST += antelope diff --git a/modules/libcom/src/yacc/antelope.c b/modules/libcom/src/yacc/antelope.c index 7143b38ff..5475874ed 100644 --- a/modules/libcom/src/yacc/antelope.c +++ b/modules/libcom/src/yacc/antelope.c @@ -8,9 +8,9 @@ \*************************************************************************/ #include #include "defs.h" -#define epicsExportSharedSymbols -#include "epicsTempFile.h" -#undef epicsExportSharedSymbols + +/* Need this before the Com library can build it */ +#include "epicsTempFile.c" char dflag; char lflag; From fdacb6b92e8d70bffb3e36527652d1cc621d82ff Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 3 Mar 2020 00:53:16 -0600 Subject: [PATCH 082/216] MSVC <= 11.0 doesn't like 'const int' in C code --- modules/libcom/src/osi/os/WIN32/epicsTempFile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/libcom/src/osi/os/WIN32/epicsTempFile.c b/modules/libcom/src/osi/os/WIN32/epicsTempFile.c index 4d7bbf7dc..b8160d867 100644 --- a/modules/libcom/src/osi/os/WIN32/epicsTempFile.c +++ b/modules/libcom/src/osi/os/WIN32/epicsTempFile.c @@ -45,7 +45,7 @@ epicsShareFunc FILE * epicsShareAPI epicsTempFile () // _O_BINARY no translation // _O_SHORT_LIVED avoid flush to disk // - const int openFlag = _O_CREAT | _O_EXCL | _O_RDWR | + int openFlag = _O_CREAT | _O_EXCL | _O_RDWR | _O_SHORT_LIVED | _O_BINARY | _O_TEMPORARY; int fd = open ( pName, openFlag, _S_IWRITE ); FILE * pNewFile = 0; From f9820577c1908ce7442ef4cae2b963f9a5ba78e5 Mon Sep 17 00:00:00 2001 From: Martin Konrad Date: Wed, 4 Mar 2020 10:56:25 -0500 Subject: [PATCH 083/216] Replace usleep call by nanosleep Also improve behavior in case signals are delivered to the sleeping thread. This fixes a potential security weakness reported by codacy (interaction of usleep with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified). --- src/libCom/osi/os/posix/epicsAtomicOSD.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libCom/osi/os/posix/epicsAtomicOSD.cpp b/src/libCom/osi/os/posix/epicsAtomicOSD.cpp index 1cc227fcd..a449a69c0 100644 --- a/src/libCom/osi/os/posix/epicsAtomicOSD.cpp +++ b/src/libCom/osi/os/posix/epicsAtomicOSD.cpp @@ -48,8 +48,10 @@ void epicsAtomicLock ( EpicsAtomicLockKey * ) status = pthread_mutex_lock ( & mutex ); if ( status == 0 ) return; assert ( status == EINTR ); - static const useconds_t retryDelayUSec = 100000; - usleep ( retryDelayUSec ); + struct timespec retryDelay = { 0, 100000000 }; + struct timespec remainingDelay; + while (nanosleep(&retryDelay, &remainingDelay) == -1 && errno == EINTR) + retryDelay = remainingDelay; countDown--; assert ( countDown ); } From 227a749105e24371b5a60d69472ffa57f075afe7 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 4 Mar 2020 21:49:17 -0600 Subject: [PATCH 084/216] Properly convert epicsTempFile to old-style C --- .../libcom/src/osi/os/WIN32/epicsTempFile.c | 77 +++++++++---------- 1 file changed, 37 insertions(+), 40 deletions(-) diff --git a/modules/libcom/src/osi/os/WIN32/epicsTempFile.c b/modules/libcom/src/osi/os/WIN32/epicsTempFile.c index b8160d867..9f4c61e20 100644 --- a/modules/libcom/src/osi/os/WIN32/epicsTempFile.c +++ b/modules/libcom/src/osi/os/WIN32/epicsTempFile.c @@ -3,13 +3,12 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* - * Author: Jeff Hill + * Author: Jeff Hill */ #include @@ -21,43 +20,41 @@ #define epicsExportSharedSymbols #include "epicsTempFile.h" -// -// epicsTmpFile -// -// allow the teporary file directory to be set with the -// TMP environment varianble -// +/* + * epicsTmpFile + * + * allow the teporary file directory to be set with the + * TMP environment varianble + */ epicsShareFunc FILE * epicsShareAPI epicsTempFile () { - char * pName = _tempnam ( "c:\\tmp", "epics" ); - if( ! pName ) { - return 0; + char * pName = _tempnam("c:\\tmp", "epics"); + if (pName) { + /* We use open followed by fdopen so that the _O_EXCL + * flag can be used. This causes detection of a race + * condition where two programs end up receiving the + * same temporary file name. + * + * _O_CREAT create if non-existant + * _O_EXCL file must not exist + * _O_RDWR read and write the file + * _O_TEMPORARY delete file on close + * _O_BINARY no translation + * _O_SHORT_LIVED avoid flush to disk + */ + int openFlag = _O_CREAT | _O_EXCL | _O_RDWR | + _O_SHORT_LIVED | _O_BINARY | _O_TEMPORARY; + int fd = open(pName, openFlag, _S_IWRITE); + FILE * pNewFile = 0; + if (fd >=0) { + pNewFile = _fdopen(fd, "w+b"); + } + else { + printf("Temporary file \"%s\" open failed because " + "\"%s\"\n", pName, strerror(errno)); + } + free(pName); + return pNewFile; } - // We use open followed by fdopen so that the _O_EXCL - // flag can be used. This causes detection of a race - // condition where two programs end up receiving the - // same temporary file name. - // - // _O_CREAT create if non-existant - // _O_EXCL file must not exist - // _O_RDWR read and write the file - // _O_TEMPORARY delete file on close - // _O_BINARY no translation - // _O_SHORT_LIVED avoid flush to disk - // - int openFlag = _O_CREAT | _O_EXCL | _O_RDWR | - _O_SHORT_LIVED | _O_BINARY | _O_TEMPORARY; - int fd = open ( pName, openFlag, _S_IWRITE ); - FILE * pNewFile = 0; - if ( fd >=0 ) { - pNewFile = _fdopen ( fd, "w+b" ); - } - else { - printf ( - "Temporary file \"%s\" open failed because " - "\"%s\"\n", pName, strerror ( errno ) ); - } - free ( pName ); - return pNewFile; + return 0; } - From 3871f89dcd59ea17b70fe89241444ec59368728f Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 5 Mar 2020 13:23:07 -0600 Subject: [PATCH 085/216] Appveyor should 'make -s test-results' as the last thing --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index bba0292e8..aba48957a 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -90,10 +90,10 @@ build_script: test_script: - cmd: .ci/appveyor-make.bat tapfiles - - cmd: .ci/appveyor-make.bat test-results on_finish: - ps: Get-ChildItem *.tap -Recurse -Force | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } + - cmd: .ci/appveyor-make.bat -s test-results #---------------------------------# From 8b9c3139414d412e5534bd0ebf014124d0248aca Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 6 Mar 2020 22:36:02 -0600 Subject: [PATCH 086/216] Update the wording of the Release Notes entry --- documentation/RELEASE_NOTES.md | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/documentation/RELEASE_NOTES.md b/documentation/RELEASE_NOTES.md index ec5549878..f13a8c37f 100644 --- a/documentation/RELEASE_NOTES.md +++ b/documentation/RELEASE_NOTES.md @@ -17,16 +17,17 @@ release. -### Record types publish their dset's +### Record types publish dset's -The record types in Base are starting to define the device support entry table +The record types in Base now define their device support entry table (DSET) structures in the record header file. While still optional, developers of external support modules are encouraged to start converting their code to use -the record's definitions instead of the traditional approach of copying the -structure definitions into each source file that needs them. It will still be -possible for converted code to build and work with older Base releases. +the record's new definitions instead of the traditional approach of copying the +structure definitions into each source file that needs them. By following the +instructions below it is still possible for the converted code to build and +work with older Base releases. -This might also be a good time to modify the device support to use the type-safe +This would also be a good time to modify the device support to use the type-safe device support entry tables that were introduced in Base-3.16.2 -- see [#type-safe-device-and-driver-support-tables](this entry below) for the description of that change, which is also optional for now. @@ -75,8 +76,8 @@ it's provided in the header: #ifndef HAS_aidset typedef struct aidset { dset common; - long (*read_ai)(struct aiRecord *prec); - long (*special_linconv)(struct aiRecord *prec, int after); + long (*read_ai)(aiRecord *prec); + long (*special_linconv)(aiRecord *prec, int after); } aidset; #endif aidset devAiSoft = { @@ -93,14 +94,14 @@ This same pattern should be followed for all record types except for the lsi, lso and printf record types, which have published their device support entry table structures since they were first added to Base but didn't previously embed the `dset common` member. Device support for these record types therefore can't -use the dset name since the new definitions are different from the originals -causing a compile error, so this pattern should be used instead: +use the dset name since the new definitions are different from the originals and +will cause a compile error, so this pattern should be used instead: ```C #ifndef HAS_lsidset struct { dset common; - long (*read_string)(struct lsiRecord *prec); + long (*read_string)(lsiRecord *prec); } #else lsidset From 23cac3c1a8c5abe15ddf7ff5e77669fcd969e649 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 6 Mar 2020 22:49:58 -0600 Subject: [PATCH 087/216] Set USE_TYPED_DSET centrally now everything uses it --- modules/database/src/std/Makefile | 2 +- modules/database/src/std/dev/Makefile | 53 ------------------------ modules/database/src/std/dev/devBoSoft.c | 1 - modules/database/src/std/rec/Makefile | 23 ---------- 4 files changed, 1 insertion(+), 78 deletions(-) diff --git a/modules/database/src/std/Makefile b/modules/database/src/std/Makefile index d8eb39bdb..3aee75078 100644 --- a/modules/database/src/std/Makefile +++ b/modules/database/src/std/Makefile @@ -11,7 +11,7 @@ TOP = ../../../.. include $(TOP)/configure/CONFIG -USR_CPPFLAGS += -DUSE_TYPED_RSET +USR_CPPFLAGS += -DUSE_TYPED_RSET -DUSE_TYPED_DSET SHRLIB_VERSION = 3.17.0 diff --git a/modules/database/src/std/dev/Makefile b/modules/database/src/std/dev/Makefile index b582f0b47..1412f217c 100644 --- a/modules/database/src/std/dev/Makefile +++ b/modules/database/src/std/dev/Makefile @@ -13,116 +13,63 @@ SRC_DIRS += $(STDDIR)/dev DBD += devSoft.dbd -devAaiSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devAaiSoft.c -devAaoSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devAaoSoft.c -devAiSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devAiSoft.c -devAiSoftRaw_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devAiSoftRaw.c -devAoSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devAoSoft.c -devAoSoftRaw_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devAoSoftRaw.c -devBiSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devBiSoft.c dbRecStd_SRCS += devBiSoftRaw.c -devBiDbState_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devBiDbState.c -devBoSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devBoSoft.c -devBoSoftRaw_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devBoSoftRaw.c dbRecStd_SRCS += devBoDbState.c -devCalcoutSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devCalcoutSoft.c -devEventSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devEventSoft.c -devHistogramSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devHistogramSoft.c -devI64inSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devI64inSoft.c -devI64outSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devI64outSoft.c -devLiSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devLiSoft.c -devLoSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devLoSoft.c -devLsiSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devLsiSoft.c -devLsoSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devLsoSoft.c -devMbbiDirectSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devMbbiDirectSoft.c -devMbbiDirectSoftRaw_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devMbbiDirectSoftRaw.c -devMbbiSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devMbbiSoft.c -devMbbiSoftRaw_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devMbbiSoftRaw.c -devMbboDirectSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devMbboDirectSoft.c -devMbboDirectSoftRaw_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devMbboDirectSoftRaw.c -devMbboSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devMbboSoft.c -devMbboSoftRaw_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devMbboSoftRaw.c -devPrintfSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devPrintfSoft.c -devSASoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devSASoft.c -devSiSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devSiSoft.c -devSoSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devSoSoft.c -devWfSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devWfSoft.c -devAiSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devAiSoftCallback.c -devBiSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devBiSoftCallback.c -devI64inSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devI64inSoftCallback.c -devLiSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devLiSoftCallback.c -devMbbiDirectSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devMbbiDirectSoftCallback.c -devMbbiCallbackSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devMbbiSoftCallback.c -devSiSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devSiSoftCallback.c -devAoSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devAoSoftCallback.c -devBoSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devBoSoftCallback.c -devCalcoutSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devCalcoutSoftCallback.c -devI64outSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devI64outSoftCallback.c -devLoSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devLoSoftCallback.c -devLsoSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devLsoSoftCallback.c -devMbboSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devMbboSoftCallback.c -devMbboDirectSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devMbboDirectSoftCallback.c -devPrintfSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devPrintfSoftCallback.c -devSoSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devSoSoftCallback.c -devGeneralTime_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devGeneralTime.c -devTimestamp_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devTimestamp.c -devStdio_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devStdio.c -devEnviron_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devEnviron.c dbRecStd_SRCS += asSubRecordFunctions.c diff --git a/modules/database/src/std/dev/devBoSoft.c b/modules/database/src/std/dev/devBoSoft.c index 80ca61b81..b86454252 100644 --- a/modules/database/src/std/dev/devBoSoft.c +++ b/modules/database/src/std/dev/devBoSoft.c @@ -41,7 +41,6 @@ epicsExportAddress(dset, devBoSoft); static long init_record(dbCommon *pcommon) { - boRecord *prec = (boRecord *)pcommon; long status=0; /* dont convert */ diff --git a/modules/database/src/std/rec/Makefile b/modules/database/src/std/rec/Makefile index 51f54dbdf..87021987e 100644 --- a/modules/database/src/std/rec/Makefile +++ b/modules/database/src/std/rec/Makefile @@ -11,62 +11,39 @@ SRC_DIRS += $(STDDIR)/rec -aaiRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += aaiRecord -aaoRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += aaoRecord -aiRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += aiRecord -aoRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += aoRecord stdRecords += aSubRecord -biRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += biRecord -boRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += boRecord stdRecords += calcRecord -calcoutRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += calcoutRecord stdRecords += compressRecord stdRecords += dfanoutRecord -eventRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += eventRecord stdRecords += fanoutRecord -histogramRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += histogramRecord -int64inRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += int64inRecord -int64outRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += int64outRecord -longinRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += longinRecord -longoutRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += longoutRecord -lsiRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += lsiRecord -lsoRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += lsoRecord -mbbiRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += mbbiRecord -mbbiDirectRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += mbbiDirectRecord -mbboRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += mbboRecord -mbboDirectRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += mbboDirectRecord stdRecords += permissiveRecord -printfRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += printfRecord stdRecords += selRecord stdRecords += seqRecord stdRecords += stateRecord stdRecords += stringinRecord -stringoutRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += stringoutRecord stdRecords += subRecord -subArrayRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += subArrayRecord -waveformRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += waveformRecord DBDINC += $(stdRecords) From 048689d6dbfae9564e2e1eb103c368e640c6b356 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 6 Mar 2020 23:20:55 -0600 Subject: [PATCH 088/216] Adjust example code in devSup.h --- modules/database/src/ioc/dbStatic/devSup.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/modules/database/src/ioc/dbStatic/devSup.h b/modules/database/src/ioc/dbStatic/devSup.h index dc55a35dd..c54f476d4 100644 --- a/modules/database/src/ioc/dbStatic/devSup.h +++ b/modules/database/src/ioc/dbStatic/devSup.h @@ -34,7 +34,7 @@ struct link; /* aka DBLINK */ * * In Makefile: @code - USR_CFLAGS += -DUSE_TYPED_RSET -DUSE_TYPED_DSET + USR_CPPFLAGS += -DUSE_TYPED_RSET -DUSE_TYPED_DSET @endcode * * In C source file: @@ -48,10 +48,7 @@ struct link; /* aka DBLINK */ static long get_iointr_info(int detach, dbCommon *prec, IOCSCANPVT* pscan); static long longin_read(longinRecord *prec); - const struct { - dset common; - long (*read)(longinRecord *prec); - } devLiDevName = { + longindset devLiDevName = { { 5, // 4 from dset + 1 from longinRecord NULL, From e13b01208ba86f5e5c8f446e5fc287118e822f9a Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 6 Mar 2020 23:28:57 -0600 Subject: [PATCH 089/216] Bump database version to 3.18.0, use in SHRLIB_VERSION --- configure/CONFIG_DATABASE_VERSION | 4 ++-- modules/database/src/ioc/Makefile | 5 +++-- modules/database/src/std/Makefile | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/configure/CONFIG_DATABASE_VERSION b/configure/CONFIG_DATABASE_VERSION index 21ac836b0..93a87a0a3 100644 --- a/configure/CONFIG_DATABASE_VERSION +++ b/configure/CONFIG_DATABASE_VERSION @@ -1,8 +1,8 @@ # Version number for the database APIs and shared library EPICS_DATABASE_MAJOR_VERSION = 3 -EPICS_DATABASE_MINOR_VERSION = 17 -EPICS_DATABASE_MAINTENANCE_VERSION = 6 +EPICS_DATABASE_MINOR_VERSION = 18 +EPICS_DATABASE_MAINTENANCE_VERSION = 0 # Development flag, set to zero for release versions diff --git a/modules/database/src/ioc/Makefile b/modules/database/src/ioc/Makefile index 70b1b5558..c19b55098 100644 --- a/modules/database/src/ioc/Makefile +++ b/modules/database/src/ioc/Makefile @@ -11,9 +11,10 @@ TOP = ../../../.. include $(TOP)/configure/CONFIG -USR_CPPFLAGS += -DUSE_TYPED_RSET +USR_CPPFLAGS += -DUSE_TYPED_RSET -DUSE_TYPED_DSET -SHRLIB_VERSION = 3.17.0 +# Shared library ABI version. +SHRLIB_VERSION = $(EPICS_DATABASE_MAJOR_VERSION).$(EPICS_DATABASE_MINOR_VERSION).$(EPICS_DATABASE_MAINTENANCE_VERSION) LIBRARY_IOC += dbCore dbCore_LIBS += ca Com diff --git a/modules/database/src/std/Makefile b/modules/database/src/std/Makefile index 3aee75078..d323bc077 100644 --- a/modules/database/src/std/Makefile +++ b/modules/database/src/std/Makefile @@ -13,7 +13,8 @@ include $(TOP)/configure/CONFIG USR_CPPFLAGS += -DUSE_TYPED_RSET -DUSE_TYPED_DSET -SHRLIB_VERSION = 3.17.0 +# Shared library ABI version. +SHRLIB_VERSION = $(EPICS_DATABASE_MAJOR_VERSION).$(EPICS_DATABASE_MINOR_VERSION).$(EPICS_DATABASE_MAINTENANCE_VERSION) LIBRARY_IOC += dbRecStd dbRecStd_LIBS = dbCore ca Com From a9034bb5860fb46bb094ca2cd02ba3f4135b43b9 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 7 Mar 2020 00:40:13 -0600 Subject: [PATCH 090/216] Fix clock_gettime issue on newer MinGW builds Fixes lp: #1853168 --- src/libCom/osi/osiClockTime.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/libCom/osi/osiClockTime.c b/src/libCom/osi/osiClockTime.c index 01958b20e..d9dff13a2 100644 --- a/src/libCom/osi/osiClockTime.c +++ b/src/libCom/osi/osiClockTime.c @@ -41,7 +41,7 @@ static struct { static epicsThreadOnceId onceId = EPICS_THREAD_ONCE_INIT; -#ifdef CLOCK_REALTIME +#if defined(CLOCK_REALTIME) && !defined(_WIN32) /* This code is not used on systems without Posix CLOCK_REALTIME, * but the only way to detect that is from the OS headers, so the * Makefile can't exclude compiling this file on those systems. @@ -229,7 +229,11 @@ static int ClockTimeGetCurrent(epicsTimeStamp *pDest) return 0; } -#endif /* CLOCK_REALTIME */ +/* Used in Report function below: */ +#define UNINIT_ERROR "initialized" +#else +#define UNINIT_ERROR "available" +#endif /* CLOCK_REALTIME && !WIN32 */ /* Allow the following report routine to be compiled anyway * to avoid getting a build warning from ranlib. @@ -242,13 +246,7 @@ int ClockTime_Report(int level) char timebuf[32]; if (onceId == EPICS_THREAD_ONCE_INIT) { - printf("OS Clock driver not %s.\n", -#ifdef CLOCK_REALTIME - "initialized" -#else - "available" -#endif /* CLOCK_REALTIME */ - ); + puts("OS Clock driver not " UNINIT_ERROR); } else if (ClockTimePvt.synchronize == CLOCKTIME_SYNC) { int synchronized, syncFromPriority; From eaee851a2d1bf4c768de753937cea91842867d2e Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 3 Mar 2020 00:58:48 -0600 Subject: [PATCH 091/216] Add script to generate *API.h headers --- src/tools/Makefile | 2 + src/tools/makeAPIheader.pl | 141 +++++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+) create mode 100644 src/tools/makeAPIheader.pl diff --git a/src/tools/Makefile b/src/tools/Makefile index c58c923b9..792440591 100644 --- a/src/tools/Makefile +++ b/src/tools/Makefile @@ -29,6 +29,7 @@ PERL_SCRIPTS += epicsProve.pl PERL_SCRIPTS += expandVars.pl PERL_SCRIPTS += fullPathName.pl PERL_SCRIPTS += installEpics.pl +PERL_SCRIPTS += makeAPIheader.pl PERL_SCRIPTS += makeMakefile.pl PERL_SCRIPTS += makeTestfile.pl PERL_SCRIPTS += mkmf.pl @@ -47,6 +48,7 @@ HTMLS += EPICS/Getopts.html HTMLS += EPICS/Path.html HTMLS += EPICS/Readfile.html HTMLS += fullPathName.html +HTMLS += makeAPIheader.html HTMLS += munch.html HTMLS += podToHtml.html HTMLS += podRemove.html diff --git a/src/tools/makeAPIheader.pl b/src/tools/makeAPIheader.pl new file mode 100644 index 000000000..79965a615 --- /dev/null +++ b/src/tools/makeAPIheader.pl @@ -0,0 +1,141 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +use Getopt::Std; +$Getopt::Std::STANDARD_HELP_VERSION = 1; + +use Pod::Usage; + +=head1 NAME + +makeAPIheader.pl - Create a header for marking API import/export + +=head1 SYNOPSIS + +B [B<-h>] [B<-o> fileAPI.h] stem + +=head1 DESCRIPTION + +Creates a C/C++ header file containing macro definitions for C and +C which on Windows will expand to the appropriate C<__declspec> +and C<__stdcall> keywords and under GCC to a C attribute. + +=head1 OPTIONS + +B understands the following options: + +=over 4 + +=item B<-h> + +Help, display this document as text. + +=item B<-o> fileAPI.h + +Name of the output file to be created. Must end C. + +=back + +If no output filename is set, the filename will be generated by appending +C to the B argument. + +=head1 USAGE FOR EPICS + +In the Makefile that is building a DLL or shared library, set the variable +C to the name of the name of the header file to be generated, +which must end with C. The part before that is referred to as the +I for this library. For example the stem here is C: + + # Generate our library API header file + API_HEADER = libComAPI.h + +Lower down in the RULES section of the same Makefile (below the line that +includes the C<$(TOP)/configure/RULES> file), add a line like this: + + # Set the API Building flag while we are building the code + $(LIBNAME) $(SHRLIBNAME): USR_CPPFLAGS += -DLIBCOM_API_BUILDING + +Replace the string C above with the upper-case version of the stem +that you used in your header filename. + +Then in each header and source file that declares or defines a routine to be +exported by the library, decorate the routine declaration or definition with +the keyword C like this: + + LIBCOM_API void epicsExit(int status); + +The header also defines a second macro C which is for Windows +builds to indicate that the calling convention for this routine must be +C<__stdcall>. If needed, this macro should be placed between the return type +and the routine name, like this: + + LIBCOM_API int LIBCOMSTD_API iocshCmd(const char *cmd); + +=cut + +our ($opt_o, $opt_h); + +sub HELP_MESSAGE { + pod2usage(-exitval => 2, -verbose => $opt_h); +} + +HELP_MESSAGE() if !getopts('ho:') || $opt_h || @ARGV != 1; + +my $stem = shift @ARGV; +my $outfile = defined($opt_o) ? $opt_o : "${stem}API.h"; + +die "makeAPIheader.pl: Output filename must end with 'API.h'\n" + unless $outfile =~ m/API\.h$/; + +my $STEM = uc $stem; +my $guard = "INC_${stem}API_H"; + +open my $o, '>', $outfile or + die "makeAPIheader.pl: Can't create $outfile: $!\n"; + +print $o <<"__EOF__"; +/* This is a generated file, do not edit! */ + +#ifndef $guard +#define $guard + +#if defined(_WIN32) || defined(__CYGWIN__) +# define ${STEM}STD_API __stdcall + +# if defined(BUILDING_${stem}_API) && defined(EPICS_BUILD_DLL) +/* Building library as dll */ +# define ${STEM}_API __declspec(dllexport) +# elif !defined(BUILDING_${stem}_API) && defined(EPICS_CALL_DLL) +/* Calling library in dll form */ +# define ${STEM}_API __declspec(dllimport) +# endif + +#elif __GNUC__ >= 4 +# define ${STEM}_API __attribute__ ((visibility("default"))) +#endif + +#if !defined(${STEM}_API) +# define ${STEM}_API +#endif + +#if !defined(${STEM}STD_API) +# define ${STEM}STD_API +#endif + +#endif /* $guard */ + +__EOF__ + +close $o; + + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2020 UChicago Argonne LLC, as Operator of Argonne National +Laboratory. + +This software is distributed under the terms of the EPICS Open License. + +=cut From 9e7fc1915b388704e5fd8c45004486bd91999fce Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 3 Mar 2020 01:00:42 -0600 Subject: [PATCH 092/216] Add build rules to generate and install *API.h header files --- configure/CONFIG_COMMON | 2 +- configure/RULES_BUILD | 16 ++++++++++++++++ configure/RULES_TARGET | 13 +++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/configure/CONFIG_COMMON b/configure/CONFIG_COMMON index b79e15cf5..6c0e11e0d 100644 --- a/configure/CONFIG_COMMON +++ b/configure/CONFIG_COMMON @@ -306,7 +306,7 @@ LDLIBS = $(POSIX_LDLIBS) $(ARCH_DEP_LDLIBS) $(DEBUG_LDLIBS) $(OP_SYS_LDLIBS)\ CPPFLAGS = $($(BUILD_CLASS)_CPPFLAGS) $(POSIX_CPPFLAGS) $(OPT_CPPFLAGS)\ $(DEBUG_CPPFLAGS) $(WARN_CPPFLAGS) $(BASE_CPPFLAGS) $(TARGET_CPPFLAGS)\ $(USR_CPPFLAGS) $(CMD_CPPFLAGS) $(ARCH_DEP_CPPFLAGS) $(OP_SYS_CPPFLAGS)\ - $(OP_SYS_INCLUDE_CPPFLAGS) $(CODE_CPPFLAGS) + $(OP_SYS_INCLUDE_CPPFLAGS) $(CODE_CPPFLAGS) $(API_CPPFLAGS) #-------------------------------------------------- # ar definition default diff --git a/configure/RULES_BUILD b/configure/RULES_BUILD index 3df3052b4..99bbb0726 100644 --- a/configure/RULES_BUILD +++ b/configure/RULES_BUILD @@ -409,6 +409,22 @@ endif $(PERL) $(TOOLS)/makeTestfile.pl $(T_A) $(EPICS_HOST_ARCH) $@ $< #--------------------------------------------------------------- +# Generate an $(API_HEADER) file on request (%API.h) + +ifdef API_HEADER +# Install it +INC += $(API_HEADER) + +# Ensure we generate it early enough +$(filter-out $(INSTALL_INCLUDE)/$(API_HEADER), $(INSTALL_INC)) $(HDEPENDS_FILES): \ + | $(INSTALL_INCLUDE)/$(API_HEADER) + +# How to make it +$(COMMON_DIR)/$(API_HEADER): + @$(RM) $@ + $(PERL) $(TOOLS)/makeAPIheader.pl -o $@ $(API_HEADER:API.h=) +endif + # Generate header with version number from VCS ifneq ($(GENVERSION),) diff --git a/configure/RULES_TARGET b/configure/RULES_TARGET index e96232876..5d77b105e 100644 --- a/configure/RULES_TARGET +++ b/configure/RULES_TARGET @@ -95,12 +95,20 @@ $(1)_DLL_DEPLIBS=$$(foreach lib, $$($(1)_DLL_LIBS), \ $$(LIB_PREFIX)$(1)$$(LIB_SUFFIX):$$($(1)_OBJSNAME) $$($(1)_RESS) $$(LIB_PREFIX)$(1)$$(LIB_SUFFIX):$$($(1)_DEPLIBS) +ifneq ($$($(1)_API),) +$$(LIB_PREFIX)$(1)$$(LIB_SUFFIX): API_CPPFLAGS += -DBUILDING_$$($(1)_API)_API +endif + ifeq ($$(SHARED_LIBRARIES),YES) ifdef SHRLIB_SUFFIX $$(SHRLIB_PREFIX)$(1)$$(SHRLIB_SUFFIX):$$($(1)_OBJSNAME) $$($(1)_RESS) $$(SHRLIB_PREFIX)$(1)$$(SHRLIB_SUFFIX):$$($(1)_DEPLIBS) $$(SHRLIB_PREFIX)$(1)$$(SHRLIB_SUFFIX):$$($(1)_DLL_DEPLIBS) + +ifneq ($$($(1)_API),) +$$(SHRLIB_PREFIX)$(1)$$(SHRLIB_SUFFIX): API_CPPFLAGS += -DBUILDING_$$($(1)_API)_API +endif endif endif @@ -141,6 +149,11 @@ $(1)_DLL_DEPLIBS=$$(foreach lib, $$($(1)_DLL_LIBS),\ $$(LOADABLE_SHRLIB_PREFIX)$(1)$$(LOADABLE_SHRLIB_SUFFIX):$$($(1)_OBJSNAME) $$($(1)_RESS) $$(LOADABLE_SHRLIB_PREFIX)$(1)$$(LOADABLE_SHRLIB_SUFFIX):$$($(1)_DEPLIBS) $$(LOADABLE_SHRLIB_PREFIX)$(1)$$(LOADABLE_SHRLIB_SUFFIX):$$($(1)_DLL_DEPLIBS) + +ifneq ($$($(1)_API),) +$$(LOADABLE_SHRLIB_PREFIX)$(1)$$(LOADABLE_SHRLIB_SUFFIX): \ + API_CPPFLAGS += -DBUILDING_$$($(1)_API)_API +endif endef $(foreach target, $(LOADABLE_LIBRARY), \ From 0cf38bfb29eaf557fb0a28410337eceeb2ce740a Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 7 Mar 2020 01:32:36 -0600 Subject: [PATCH 093/216] Try out a representative sample of APIs from multiple libraries --- modules/ca/src/client/Makefile | 3 + modules/ca/src/client/access.cpp | 35 ++--- modules/ca/src/client/ca_client_context.cpp | 4 +- modules/ca/src/client/cacIO.h | 22 ++-- modules/ca/src/client/cadef.h | 135 ++++++++++---------- modules/ca/src/client/caerr.h | 6 +- modules/ca/src/client/db_access.h | 26 ++-- modules/database/src/ioc/Makefile | 3 + modules/database/src/ioc/db/dbChannel.h | 38 +++--- modules/database/src/ioc/db/dbJLink.c | 6 +- modules/database/src/ioc/db/dbJLink.h | 16 +-- modules/database/src/std/Makefile | 3 + modules/libcom/src/Makefile | 4 + modules/libcom/src/yajl/yajl.c | 1 - modules/libcom/src/yajl/yajl_alloc.c | 1 - modules/libcom/src/yajl/yajl_buf.c | 1 - modules/libcom/src/yajl/yajl_common.h | 4 +- modules/libcom/src/yajl/yajl_encode.c | 1 - modules/libcom/src/yajl/yajl_gen.c | 1 - modules/libcom/src/yajl/yajl_lex.c | 1 - modules/libcom/src/yajl/yajl_parser.c | 1 - 21 files changed, 157 insertions(+), 155 deletions(-) diff --git a/modules/ca/src/client/Makefile b/modules/ca/src/client/Makefile index fa7d0916f..57d113e6b 100644 --- a/modules/ca/src/client/Makefile +++ b/modules/ca/src/client/Makefile @@ -73,6 +73,9 @@ LIBSRCS += comBuf.cpp LIBSRCS += hostNameCache.cpp LIBSRCS += msgForMultiplyDefinedPV.cpp +API_HEADER = libCaAPI.h +ca_API = libCa + LIBRARY=ca ca_RCS = ca.rc diff --git a/modules/ca/src/client/access.cpp b/modules/ca/src/client/access.cpp index a36899c02..b39406014 100644 --- a/modules/ca/src/client/access.cpp +++ b/modules/ca/src/client/access.cpp @@ -785,8 +785,7 @@ void epicsShareAPI ca_self_test () pcac->selfTest (); } -// extern "C" -epicsShareDef const int epicsTypeToDBR_XXXX [lastEpicsType+1] = { +const int epicsTypeToDBR_XXXX [lastEpicsType+1] = { DBR_SHORT, /* forces conversion fronm uint8 to int16 */ DBR_CHAR, DBR_SHORT, @@ -800,8 +799,7 @@ epicsShareDef const int epicsTypeToDBR_XXXX [lastEpicsType+1] = { DBR_STRING }; -// extern "C" -epicsShareDef const epicsType DBR_XXXXToEpicsType [LAST_BUFFER_TYPE+1] = { +const epicsType DBR_XXXXToEpicsType [LAST_BUFFER_TYPE+1] = { epicsOldStringT, epicsInt16T, epicsFloat32T, @@ -848,8 +846,7 @@ epicsShareDef const epicsType DBR_XXXXToEpicsType [LAST_BUFFER_TYPE+1] = { epicsOldStringT }; -// extern "C" -epicsShareDef const unsigned short dbr_size[LAST_BUFFER_TYPE+1] = { +const unsigned short dbr_size[LAST_BUFFER_TYPE+1] = { sizeof(dbr_string_t), /* string max size */ sizeof(dbr_short_t), /* short */ sizeof(dbr_float_t), /* IEEE Float */ @@ -898,8 +895,7 @@ epicsShareDef const unsigned short dbr_size[LAST_BUFFER_TYPE+1] = { sizeof(dbr_string_t), /* string max size */ }; -// extern "C" -epicsShareDef const unsigned short dbr_value_size[LAST_BUFFER_TYPE+1] = { +const unsigned short dbr_value_size[LAST_BUFFER_TYPE+1] = { sizeof(dbr_string_t), /* string max size */ sizeof(dbr_short_t), /* short */ sizeof(dbr_float_t), /* IEEE Float */ @@ -949,7 +945,7 @@ epicsShareDef const unsigned short dbr_value_size[LAST_BUFFER_TYPE+1] = { }; //extern "C" -epicsShareDef const enum dbr_value_class dbr_value_class[LAST_BUFFER_TYPE+1] = { +const enum dbr_value_class dbr_value_class[LAST_BUFFER_TYPE+1] = { dbr_class_string, /* string max size */ dbr_class_int, /* short */ dbr_class_float, /* IEEE Float */ @@ -995,8 +991,7 @@ epicsShareDef const enum dbr_value_class dbr_value_class[LAST_BUFFER_TYPE+1] = { dbr_class_string, /* string max size */ }; -// extern "C" -epicsShareDef const unsigned short dbr_value_offset[LAST_BUFFER_TYPE+1] = { +const unsigned short dbr_value_offset[LAST_BUFFER_TYPE+1] = { 0, /* string */ 0, /* short */ 0, /* IEEE Float */ @@ -1038,8 +1033,7 @@ epicsShareDef const unsigned short dbr_value_offset[LAST_BUFFER_TYPE+1] = { 0, /* string */ }; -// extern "C" -epicsShareDef const char *dbf_text[LAST_TYPE+3] = { +const char *dbf_text[LAST_TYPE+3] = { "TYPENOTCONN", "DBF_STRING", "DBF_SHORT", @@ -1051,14 +1045,11 @@ epicsShareDef const char *dbf_text[LAST_TYPE+3] = { "DBF_NO_ACCESS" }; -// extern "C" -epicsShareDef const char *dbf_text_invalid = "DBF_invalid"; +const char *dbf_text_invalid = "DBF_invalid"; -// extern "C" -epicsShareDef const short dbf_text_dim = (sizeof dbf_text)/(sizeof (char *)); +const short dbf_text_dim = (sizeof dbf_text)/(sizeof (char *)); -// extern "C" -epicsShareDef const char *dbr_text[LAST_BUFFER_TYPE+1] = { +const char *dbr_text[LAST_BUFFER_TYPE+1] = { "DBR_STRING", "DBR_SHORT", "DBR_FLOAT", @@ -1100,8 +1091,6 @@ epicsShareDef const char *dbr_text[LAST_BUFFER_TYPE+1] = { "DBR_CLASS_NAME" }; -// extern "C" -epicsShareDef const char *dbr_text_invalid = "DBR_invalid"; +const char *dbr_text_invalid = "DBR_invalid"; -// extern "C" -epicsShareDef const short dbr_text_dim = (sizeof dbr_text) / (sizeof (char *)) + 1; +const short dbr_text_dim = (sizeof dbr_text) / (sizeof (char *)) + 1; diff --git a/modules/ca/src/client/ca_client_context.cpp b/modules/ca/src/client/ca_client_context.cpp index 3fd0512d6..011a4f105 100644 --- a/modules/ca/src/client/ca_client_context.cpp +++ b/modules/ca/src/client/ca_client_context.cpp @@ -39,7 +39,7 @@ #include "oldAccess.h" #include "cac.h" -epicsShareDef epicsThreadPrivateId caClientCallbackThreadId; +epicsThreadPrivateId caClientCallbackThreadId; static epicsThreadOnceId cacOnce = EPICS_THREAD_ONCE_INIT; @@ -741,7 +741,7 @@ void epicsShareAPI caInstallDefaultService ( cacService & service ) ca_client_context::installDefaultService ( service ); } -epicsShareFunc int epicsShareAPI ca_clear_subscription ( evid pMon ) +LIBCA_API int epicsShareAPI ca_clear_subscription ( evid pMon ) { oldChannelNotify & chan = pMon->channel (); ca_client_context & cac = chan.getClientCtx (); diff --git a/modules/ca/src/client/cacIO.h b/modules/ca/src/client/cacIO.h index 4e8af4a05..f75c18cc4 100644 --- a/modules/ca/src/client/cacIO.h +++ b/modules/ca/src/client/cacIO.h @@ -62,6 +62,8 @@ # include "shareLib.h" #endif +#include "libCaAPI.h" + class cacChannel; @@ -69,7 +71,7 @@ typedef unsigned long arrayElementCount; // 1) this should not be passing caerr.h status to the exception callback // 2) needless-to-say the data should be passed here using the new data access API -class epicsShareClass cacWriteNotify { +class LIBCA_API cacWriteNotify { public: virtual ~cacWriteNotify () = 0; virtual void completion ( epicsGuard < epicsMutex > & ) = 0; @@ -82,7 +84,7 @@ public: // 1) this should not be passing caerr.h status to the exception callback // 2) needless-to-say the data should be passed here using the new data access API -class epicsShareClass cacReadNotify { +class LIBCA_API cacReadNotify { public: virtual ~cacReadNotify () = 0; virtual void completion ( @@ -97,7 +99,7 @@ public: // 1) this should not be passing caerr.h status to the exception callback // 2) needless-to-say the data should be passed here using the new data access API -class epicsShareClass cacStateNotify { +class LIBCA_API cacStateNotify { public: virtual ~cacStateNotify () = 0; virtual void current ( @@ -131,7 +133,7 @@ private: bool f_operatorConfirmationRequest:1; }; -class epicsShareClass cacChannelNotify { +class LIBCA_API cacChannelNotify { public: virtual ~cacChannelNotify () = 0; virtual void connectNotify ( epicsGuard < epicsMutex > & ) = 0; @@ -169,7 +171,7 @@ private: // but perhaps is a bad practice that should be eliminated? If so, // then the IO should not store or use a pointer to the channel. // -class epicsShareClass cacChannel { +class LIBCA_API cacChannel { public: typedef unsigned priLev; static const priLev priorityMax; @@ -277,7 +279,7 @@ private: cacChannel & operator = ( const cacChannel & ); }; -class epicsShareClass cacContext { +class LIBCA_API cacContext { public: virtual ~cacContext (); virtual cacChannel & createChannel ( @@ -296,7 +298,7 @@ public: epicsGuard < epicsMutex > &, unsigned level ) const = 0; }; -class epicsShareClass cacContextNotify { +class LIBCA_API cacContextNotify { public: virtual ~cacContextNotify () = 0; virtual cacContext & createNetworkContext ( @@ -316,7 +318,7 @@ public: // **** Lock Hierarchy **** // callbackControl must be taken before mutualExclusion if both are held at // the same time -class epicsShareClass cacService { +class LIBCA_API cacService { public: virtual ~cacService () = 0; virtual cacContext & contextCreate ( @@ -325,9 +327,9 @@ public: cacContextNotify & ) = 0; }; -epicsShareFunc void epicsShareAPI caInstallDefaultService ( cacService & service ); +LIBCA_API void epicsShareAPI caInstallDefaultService ( cacService & service ); -epicsShareExtern epicsThreadPrivateId caClientCallbackThreadId; +LIBCA_API extern epicsThreadPrivateId caClientCallbackThreadId; inline cacChannel::cacChannel ( cacChannelNotify & notify ) : callback ( notify ) diff --git a/modules/ca/src/client/cadef.h b/modules/ca/src/client/cadef.h index e62dd7249..1b37be3f9 100644 --- a/modules/ca/src/client/cadef.h +++ b/modules/ca/src/client/cadef.h @@ -44,6 +44,7 @@ # include "shareLib.h" #endif +#include "libCaAPI.h" #include "caerr.h" #include "db_access.h" @@ -102,7 +103,7 @@ typedef struct event_handler_args { } evargs; typedef void caEventCallBackFunc (struct event_handler_args); -epicsShareFunc void epicsShareAPI ca_test_event +LIBCA_API void epicsShareAPI ca_test_event ( struct event_handler_args ); @@ -158,13 +159,13 @@ typedef unsigned CA_SYNC_GID; #define TYPENOTCONN (-1) /* the channel's native type when disconnected */ -epicsShareFunc short epicsShareAPI ca_field_type (chid chan); -epicsShareFunc unsigned long epicsShareAPI ca_element_count (chid chan); -epicsShareFunc const char * epicsShareAPI ca_name (chid chan); -epicsShareFunc void epicsShareAPI ca_set_puser (chid chan, void *puser); -epicsShareFunc void * epicsShareAPI ca_puser (chid chan); -epicsShareFunc unsigned epicsShareAPI ca_read_access (chid chan); -epicsShareFunc unsigned epicsShareAPI ca_write_access (chid chan); +LIBCA_API short epicsShareAPI ca_field_type (chid chan); +LIBCA_API unsigned long epicsShareAPI ca_element_count (chid chan); +LIBCA_API const char * epicsShareAPI ca_name (chid chan); +LIBCA_API void epicsShareAPI ca_set_puser (chid chan, void *puser); +LIBCA_API void * epicsShareAPI ca_puser (chid chan); +LIBCA_API unsigned epicsShareAPI ca_read_access (chid chan); +LIBCA_API unsigned epicsShareAPI ca_write_access (chid chan); /* * cs_ - `channel state' @@ -175,27 +176,27 @@ epicsShareFunc unsigned epicsShareAPI ca_write_access (chid chan); * cs_closed channel deleted by user */ enum channel_state {cs_never_conn, cs_prev_conn, cs_conn, cs_closed}; -epicsShareFunc enum channel_state epicsShareAPI ca_state (chid chan); +LIBCA_API enum channel_state epicsShareAPI ca_state (chid chan); /************************************************************************/ /* Perform Library Initialization */ /* */ /* Must be called once before calling any of the other routines */ /************************************************************************/ -epicsShareFunc int epicsShareAPI ca_task_initialize (void); +LIBCA_API int epicsShareAPI ca_task_initialize (void); enum ca_preemptive_callback_select { ca_disable_preemptive_callback, ca_enable_preemptive_callback }; -epicsShareFunc int epicsShareAPI +LIBCA_API int epicsShareAPI ca_context_create (enum ca_preemptive_callback_select select); -epicsShareFunc void epicsShareAPI ca_detach_context (); +LIBCA_API void epicsShareAPI ca_detach_context (); /************************************************************************/ /* Remove CA facility from your task */ /* */ /* Normally called automatically at task exit */ /************************************************************************/ -epicsShareFunc int epicsShareAPI ca_task_exit (void); -epicsShareFunc void epicsShareAPI ca_context_destroy (void); +LIBCA_API int epicsShareAPI ca_task_exit (void); +LIBCA_API void epicsShareAPI ca_context_destroy (void); typedef unsigned capri; #define CA_PRIORITY_MAX 99 @@ -218,7 +219,7 @@ typedef unsigned capri; * priority R priority level in the server 0 - 100 * pChanID RW channel id written here */ -epicsShareFunc int epicsShareAPI ca_create_channel +LIBCA_API int epicsShareAPI ca_create_channel ( const char *pChanName, caCh *pConnStateCallback, @@ -233,7 +234,7 @@ epicsShareFunc int epicsShareAPI ca_create_channel * chan R channel identifier * pfunc R address of connection call-back function */ -epicsShareFunc int epicsShareAPI ca_change_connection_event +LIBCA_API int epicsShareAPI ca_change_connection_event ( chid chan, caCh * pfunc @@ -245,7 +246,7 @@ epicsShareFunc int epicsShareAPI ca_change_connection_event * chan R channel identifier * pfunc R address of access rights call-back function */ -epicsShareFunc int epicsShareAPI ca_replace_access_rights_event ( +LIBCA_API int epicsShareAPI ca_replace_access_rights_event ( chid chan, caArh *pfunc ); @@ -260,7 +261,7 @@ epicsShareFunc int epicsShareAPI ca_replace_access_rights_event ( * call-back function */ typedef void caExceptionHandler (struct exception_handler_args); -epicsShareFunc int epicsShareAPI ca_add_exception_event +LIBCA_API int epicsShareAPI ca_add_exception_event ( caExceptionHandler *pfunc, void *pArg @@ -272,7 +273,7 @@ epicsShareFunc int epicsShareAPI ca_add_exception_event * * chanId R channel ID */ -epicsShareFunc int epicsShareAPI ca_clear_channel +LIBCA_API int epicsShareAPI ca_clear_channel ( chid chanId ); @@ -320,7 +321,7 @@ ca_array_put(DBR_FLOAT, 1u, chan, (const dbr_float_t *) pValue) * chan R channel identifier * pValue R new channel value copied from this location */ -epicsShareFunc int epicsShareAPI ca_array_put +LIBCA_API int epicsShareAPI ca_array_put ( chtype type, unsigned long count, @@ -345,7 +346,7 @@ epicsShareFunc int epicsShareAPI ca_array_put * pFunc R pointer to call-back function * pArg R copy of this pointer passed to pFunc */ -epicsShareFunc int epicsShareAPI ca_array_put_callback +LIBCA_API int epicsShareAPI ca_array_put_callback ( chtype type, unsigned long count, @@ -402,7 +403,7 @@ ca_array_get(DBR_FLOAT, 1u, chan, (dbr_float_t *)(pValue)) * chan R channel identifier * pValue W channel value copied to this location */ -epicsShareFunc int epicsShareAPI ca_array_get +LIBCA_API int epicsShareAPI ca_array_get ( chtype type, unsigned long count, @@ -461,7 +462,7 @@ ca_array_get_callback (type, 1u, chan, pFunc, pArg) * pFunc R pointer to call-back function * pArg R copy of this pointer passed to pFunc */ -epicsShareFunc int epicsShareAPI ca_array_get_callback +LIBCA_API int epicsShareAPI ca_array_get_callback ( chtype type, unsigned long count, @@ -491,7 +492,7 @@ epicsShareFunc int epicsShareAPI ca_array_get_callback * pArg R copy of this pointer passed to pFunc * pEventID W event id written at specified address */ -epicsShareFunc int epicsShareAPI ca_create_subscription +LIBCA_API int epicsShareAPI ca_create_subscription ( chtype type, unsigned long count, @@ -512,12 +513,12 @@ epicsShareFunc int epicsShareAPI ca_create_subscription * * eventID R event id */ -epicsShareFunc int epicsShareAPI ca_clear_subscription +LIBCA_API int epicsShareAPI ca_clear_subscription ( evid eventID ); -epicsShareFunc chid epicsShareAPI ca_evid_to_chid ( evid id ); +LIBCA_API chid epicsShareAPI ca_evid_to_chid ( evid id ); /************************************************************************/ @@ -571,7 +572,7 @@ epicsShareFunc chid epicsShareAPI ca_evid_to_chid ( evid id ); * * timeOut R wait for this delay in seconds */ -epicsShareFunc int epicsShareAPI ca_pend_event (ca_real timeOut); +LIBCA_API int epicsShareAPI ca_pend_event (ca_real timeOut); #define ca_poll() ca_pend_event(1e-12) /* @@ -581,10 +582,10 @@ epicsShareFunc int epicsShareAPI ca_pend_event (ca_real timeOut); * if all get requests (or search requests with null * connection handler pointer have completed) */ -epicsShareFunc int epicsShareAPI ca_pend_io (ca_real timeOut); +LIBCA_API int epicsShareAPI ca_pend_io (ca_real timeOut); /* calls ca_pend_io() if early is true otherwise ca_pend_event() is called */ -epicsShareFunc int epicsShareAPI ca_pend (ca_real timeout, int early); +LIBCA_API int epicsShareAPI ca_pend (ca_real timeout, int early); /* * ca_test_io() @@ -592,7 +593,7 @@ epicsShareFunc int epicsShareAPI ca_pend (ca_real timeout, int early); * returns TRUE when get requests (or search requests with null * connection handler pointer) are outstanding */ -epicsShareFunc int epicsShareAPI ca_test_io (void); +LIBCA_API int epicsShareAPI ca_test_io (void); /************************************************************************/ /* Send out all outstanding messages in the send queue */ @@ -600,7 +601,7 @@ epicsShareFunc int epicsShareAPI ca_test_io (void); /* * ca_flush_io() */ -epicsShareFunc int epicsShareAPI ca_flush_io (void); +LIBCA_API int epicsShareAPI ca_flush_io (void); /* @@ -609,7 +610,7 @@ epicsShareFunc int epicsShareAPI ca_flush_io (void); * errorCode R status returned from channel access function * pCtxStr R context string included with error print out */ -epicsShareFunc void epicsShareAPI ca_signal +LIBCA_API void epicsShareAPI ca_signal ( long errorCode, const char *pCtxStr @@ -623,7 +624,7 @@ epicsShareFunc void epicsShareAPI ca_signal * lineNo R line number included with error print out * */ -epicsShareFunc void epicsShareAPI ca_signal_with_file_and_lineno +LIBCA_API void epicsShareAPI ca_signal_with_file_and_lineno ( long errorCode, const char *pCtxStr, @@ -639,7 +640,7 @@ epicsShareFunc void epicsShareAPI ca_signal_with_file_and_lineno * pFormat R printf dtyle format string (and optional arguments) * */ -epicsShareFunc void epicsShareAPI ca_signal_formated (long ca_status, const char *pfilenm, +LIBCA_API void epicsShareAPI ca_signal_formated (long ca_status, const char *pfilenm, int lineno, const char *pFormat, ...); /* @@ -649,9 +650,9 @@ epicsShareFunc void epicsShareAPI ca_signal_formated (long ca_status, const char * * !!!! this function is _not_ thread safe !!!! */ -epicsShareFunc const char * epicsShareAPI ca_host_name (chid channel); +LIBCA_API const char * epicsShareAPI ca_host_name (chid channel); /* thread safe version */ -epicsShareFunc unsigned epicsShareAPI ca_get_host_name ( chid pChan, +LIBCA_API unsigned epicsShareAPI ca_get_host_name ( chid pChan, char *pBuf, unsigned bufLength ); /* @@ -674,7 +675,7 @@ typedef void CAFDHANDLER (void *parg, int fd, int opened); * when an fd is created or deleted * pArg R argument passed to above function */ -epicsShareFunc int epicsShareAPI ca_add_fd_registration +LIBCA_API int epicsShareAPI ca_add_fd_registration ( CAFDHANDLER *pHandler, void *pArg @@ -698,7 +699,7 @@ epicsShareFunc int epicsShareAPI ca_add_fd_registration * * pgid W pointer to sync group id that will be written */ -epicsShareFunc int epicsShareAPI ca_sg_create (CA_SYNC_GID * pgid); +LIBCA_API int epicsShareAPI ca_sg_create (CA_SYNC_GID * pgid); /* * ca_sg_delete() @@ -707,7 +708,7 @@ epicsShareFunc int epicsShareAPI ca_sg_create (CA_SYNC_GID * pgid); * * gid R sync group id */ -epicsShareFunc int epicsShareAPI ca_sg_delete (const CA_SYNC_GID gid); +LIBCA_API int epicsShareAPI ca_sg_delete (const CA_SYNC_GID gid); /* * ca_sg_block() @@ -718,7 +719,7 @@ epicsShareFunc int epicsShareAPI ca_sg_delete (const CA_SYNC_GID gid); * timeout R wait for this duration prior to timing out * and returning ECA_TIMEOUT */ -epicsShareFunc int epicsShareAPI ca_sg_block (const CA_SYNC_GID gid, ca_real timeout); +LIBCA_API int epicsShareAPI ca_sg_block (const CA_SYNC_GID gid, ca_real timeout); /* * ca_sg_test() @@ -729,14 +730,14 @@ epicsShareFunc int epicsShareAPI ca_sg_block (const CA_SYNC_GID gid, ca_real tim * * returns one of ECA_BADSYNCGRP, ECA_IOINPROGRESS, ECA_IODONE */ -epicsShareFunc int epicsShareAPI ca_sg_test (const CA_SYNC_GID gid); +LIBCA_API int epicsShareAPI ca_sg_test (const CA_SYNC_GID gid); /* * ca_sg_reset * * gid R sync group id */ -epicsShareFunc int epicsShareAPI ca_sg_reset(const CA_SYNC_GID gid); +LIBCA_API int epicsShareAPI ca_sg_reset(const CA_SYNC_GID gid); /* * ca_sg_array_get() @@ -750,7 +751,7 @@ epicsShareFunc int epicsShareAPI ca_sg_reset(const CA_SYNC_GID gid); * chan R channel identifier * pValue W channel value copied to this location */ -epicsShareFunc int epicsShareAPI ca_sg_array_get +LIBCA_API int epicsShareAPI ca_sg_array_get ( const CA_SYNC_GID gid, chtype type, @@ -774,7 +775,7 @@ ca_sg_array_get (gid, type, 1u, chan, pValue) * chan R channel identifier * pValue R new channel value copied from this location */ -epicsShareFunc int epicsShareAPI ca_sg_array_put +LIBCA_API int epicsShareAPI ca_sg_array_put ( const CA_SYNC_GID gid, chtype type, @@ -793,9 +794,9 @@ ca_sg_array_put (gid, type, 1u, chan, pValue) * * gid R sync group id */ -epicsShareFunc int epicsShareAPI ca_sg_stat (CA_SYNC_GID gid); +LIBCA_API int epicsShareAPI ca_sg_stat (CA_SYNC_GID gid); -epicsShareFunc void epicsShareAPI ca_dump_dbr (chtype type, unsigned count, const void * pbuffer); +LIBCA_API void epicsShareAPI ca_dump_dbr (chtype type, unsigned count, const void * pbuffer); /* @@ -808,14 +809,14 @@ epicsShareFunc void epicsShareAPI ca_dump_dbr (chtype type, unsigned count, cons * * (returns true or false) */ -epicsShareFunc int epicsShareAPI ca_v42_ok (chid chan); +LIBCA_API int epicsShareAPI ca_v42_ok (chid chan); /* * ca_version() * * returns the CA version string */ -epicsShareFunc const char * epicsShareAPI ca_version (void); +LIBCA_API const char * epicsShareAPI ca_version (void); /* * ca_replace_printf_handler () @@ -830,7 +831,7 @@ epicsShareFunc const char * epicsShareAPI ca_version (void); */ #ifndef CA_DONT_INCLUDE_STDARGH typedef int caPrintfFunc (const char *pformat, va_list args); -epicsShareFunc int epicsShareAPI ca_replace_printf_handler ( +LIBCA_API int epicsShareAPI ca_replace_printf_handler ( caPrintfFunc *ca_printf_func ); #endif /*CA_DONT_INCLUDE_STDARGH*/ @@ -838,24 +839,24 @@ epicsShareFunc int epicsShareAPI ca_replace_printf_handler ( /* * (for testing purposes only) */ -epicsShareFunc unsigned epicsShareAPI ca_get_ioc_connection_count (void); -epicsShareFunc int epicsShareAPI ca_preemtive_callback_is_enabled (void); -epicsShareFunc void epicsShareAPI ca_self_test (void); -epicsShareFunc unsigned epicsShareAPI ca_beacon_anomaly_count (void); -epicsShareFunc unsigned epicsShareAPI ca_search_attempts (chid chan); -epicsShareFunc double epicsShareAPI ca_beacon_period (chid chan); -epicsShareFunc double epicsShareAPI ca_receive_watchdog_delay (chid chan); +LIBCA_API unsigned epicsShareAPI ca_get_ioc_connection_count (void); +LIBCA_API int epicsShareAPI ca_preemtive_callback_is_enabled (void); +LIBCA_API void epicsShareAPI ca_self_test (void); +LIBCA_API unsigned epicsShareAPI ca_beacon_anomaly_count (void); +LIBCA_API unsigned epicsShareAPI ca_search_attempts (chid chan); +LIBCA_API double epicsShareAPI ca_beacon_period (chid chan); +LIBCA_API double epicsShareAPI ca_receive_watchdog_delay (chid chan); /* * used when an auxillary thread needs to join a CA client context started * by another thread */ -epicsShareFunc struct ca_client_context * epicsShareAPI ca_current_context (); -epicsShareFunc int epicsShareAPI ca_attach_context ( struct ca_client_context * context ); +LIBCA_API struct ca_client_context * epicsShareAPI ca_current_context (); +LIBCA_API int epicsShareAPI ca_attach_context ( struct ca_client_context * context ); -epicsShareFunc int epicsShareAPI ca_client_status ( unsigned level ); -epicsShareFunc int epicsShareAPI ca_context_status ( struct ca_client_context *, unsigned level ); +LIBCA_API int epicsShareAPI ca_client_status ( unsigned level ); +LIBCA_API int epicsShareAPI ca_context_status ( struct ca_client_context *, unsigned level ); /* * deprecated @@ -864,16 +865,16 @@ epicsShareFunc int epicsShareAPI ca_context_status ( struct ca_client_context *, ca_build_and_connect(NAME, XXXXX, 1, CHIDPTR, YYYYY, 0, 0) #define ca_array_build(NAME,XXXXX, ZZZZZZ, CHIDPTR,YYYYY)\ ca_build_and_connect(NAME, XXXXX, ZZZZZZ, CHIDPTR, YYYYY, 0, 0) -epicsShareFunc int epicsShareAPI ca_build_and_connect +LIBCA_API int epicsShareAPI ca_build_and_connect ( const char *pChanName, chtype, unsigned long, chid * pChanID, void *, caCh * pFunc, void * pArg ); #define ca_search(pChanName, pChanID)\ ca_search_and_connect (pChanName, pChanID, 0, 0) -epicsShareFunc int epicsShareAPI ca_search_and_connect +LIBCA_API int epicsShareAPI ca_search_and_connect ( const char * pChanName, chid * pChanID, caCh *pFunc, void * pArg ); -epicsShareFunc int epicsShareAPI ca_channel_status (epicsThreadId tid); -epicsShareFunc int epicsShareAPI ca_clear_event ( evid eventID ); +LIBCA_API int epicsShareAPI ca_channel_status (epicsThreadId tid); +LIBCA_API int epicsShareAPI ca_clear_event ( evid eventID ); #define ca_add_event(type,chan,pFunc,pArg,pEventID)\ ca_add_array_event(type,1u,chan,pFunc,pArg,0.0,0.0,0.0,pEventID) #define ca_add_delta_event(TYPE,CHID,ENTRY,ARG,DELTA,EVID)\ @@ -882,7 +883,7 @@ ca_add_array_event(type,1u,chan,pFunc,pArg,0.0,0.0,0.0,pEventID) ca_add_array_event(TYPE,1,CHID,ENTRY,ARG,P_DELTA,N_DELTA,TO,EVID) #define ca_add_array_event(TYPE,COUNT,CHID,ENTRY,ARG,P_DELTA,N_DELTA,TO,EVID)\ ca_add_masked_array_event(TYPE,COUNT,CHID,ENTRY,ARG,P_DELTA,N_DELTA,TO,EVID, DBE_VALUE | DBE_ALARM) -epicsShareFunc int epicsShareAPI ca_add_masked_array_event +LIBCA_API int epicsShareAPI ca_add_masked_array_event ( chtype type, unsigned long count, chid chanId, caEventCallBackFunc * pFunc, void * pArg, ca_real p_delta, ca_real n_delta, ca_real timeout, evid * pEventID, long mask ); @@ -890,8 +891,8 @@ epicsShareFunc int epicsShareAPI ca_add_masked_array_event /* * defunct */ -epicsShareFunc int epicsShareAPI ca_modify_user_name ( const char *pUserName ); -epicsShareFunc int epicsShareAPI ca_modify_host_name ( const char *pHostName ); +LIBCA_API int epicsShareAPI ca_modify_user_name ( const char *pUserName ); +LIBCA_API int epicsShareAPI ca_modify_host_name ( const char *pHostName ); #ifdef __cplusplus } diff --git a/modules/ca/src/client/caerr.h b/modules/ca/src/client/caerr.h index 53930962d..4c0b36835 100644 --- a/modules/ca/src/client/caerr.h +++ b/modules/ca/src/client/caerr.h @@ -35,6 +35,8 @@ # include "shareLib.h" #endif +#include "libCaAPI.h" + /* CA Status Code Definitions */ #define CA_K_INFO 3 /* successful */ @@ -149,9 +151,9 @@ extern "C" { #endif -epicsShareFunc const char * epicsShareAPI ca_message(long ca_status); +LIBCA_API const char * epicsShareAPI ca_message(long ca_status); -epicsShareExtern const char * ca_message_text []; +LIBCA_API extern const char * ca_message_text []; #ifdef __cplusplus } diff --git a/modules/ca/src/client/db_access.h b/modules/ca/src/client/db_access.h index 92aa5d011..5ad565863 100644 --- a/modules/ca/src/client/db_access.h +++ b/modules/ca/src/client/db_access.h @@ -30,6 +30,8 @@ # include "shareLib.h" #endif +#include "libCaAPI.h" + #ifdef __cplusplus extern "C" { @@ -128,12 +130,12 @@ typedef epicsOldString dbr_class_name_t; * of type DBR types. In some cases we select the a * larger type to avoid loss of information */ -epicsShareExtern const int epicsTypeToDBR_XXXX [lastEpicsType+1]; +LIBCA_API extern const int epicsTypeToDBR_XXXX [lastEpicsType+1]; /* * The DBR_XXXX types are indicies into this array */ -epicsShareExtern const epicsType DBR_XXXXToEpicsType [LAST_BUFFER_TYPE+1]; +LIBCA_API extern const epicsType DBR_XXXXToEpicsType [LAST_BUFFER_TYPE+1]; /* values returned for each field type * DBR_STRING returns a NULL terminated string @@ -528,10 +530,10 @@ struct dbr_ctrl_double{ ((unsigned)((COUNT)<=0?dbr_size[TYPE]:dbr_size[TYPE]+((COUNT)-1)*dbr_value_size[TYPE])) /* size for each type - array indexed by the DBR_ type code */ -epicsShareExtern const unsigned short dbr_size[]; +LIBCA_API extern const unsigned short dbr_size[]; /* size for each type's value - array indexed by the DBR_ type code */ -epicsShareExtern const unsigned short dbr_value_size[]; +LIBCA_API extern const unsigned short dbr_value_size[]; #ifndef db_accessHFORdb_accessC /* class for each type's value */ @@ -541,7 +543,7 @@ enum dbr_value_class { dbr_class_string, dbr_class_max}; -epicsShareExtern const enum dbr_value_class dbr_value_class[LAST_BUFFER_TYPE+1]; +LIBCA_API extern const enum dbr_value_class dbr_value_class[LAST_BUFFER_TYPE+1]; /* * ptr to value given a pointer to the structure and the DBR type @@ -555,7 +557,7 @@ epicsShareExtern const enum dbr_value_class dbr_value_class[LAST_BUFFER_TYPE+1]; #define dbr_value_ptr_from_structure(PDBR, STRUCTURE)\ ((void *)(((char *)PDBR)+BYTE_OS(STRUCTURE, value))) -epicsShareExtern const unsigned short dbr_value_offset[LAST_BUFFER_TYPE+1]; +LIBCA_API extern const unsigned short dbr_value_offset[LAST_BUFFER_TYPE+1]; /* union for each fetch buffers */ @@ -724,13 +726,13 @@ union db_access_val{ (type) + 4*(dbf_text_dim-2) : -1 ) -epicsShareExtern const char *dbf_text[LAST_TYPE+3]; -epicsShareExtern const short dbf_text_dim; -epicsShareExtern const char *dbf_text_invalid; +LIBCA_API extern const char *dbf_text[LAST_TYPE+3]; +LIBCA_API extern const short dbf_text_dim; +LIBCA_API extern const char *dbf_text_invalid; -epicsShareExtern const char *dbr_text[LAST_BUFFER_TYPE+1]; -epicsShareExtern const short dbr_text_dim; -epicsShareExtern const char *dbr_text_invalid; +LIBCA_API extern const char *dbr_text[LAST_BUFFER_TYPE+1]; +LIBCA_API extern const short dbr_text_dim; +LIBCA_API extern const char *dbr_text_invalid; #endif /*db_accessHFORdb_accessC*/ #ifdef __cplusplus diff --git a/modules/database/src/ioc/Makefile b/modules/database/src/ioc/Makefile index 70b1b5558..23c9c02b6 100644 --- a/modules/database/src/ioc/Makefile +++ b/modules/database/src/ioc/Makefile @@ -15,6 +15,9 @@ USR_CPPFLAGS += -DUSE_TYPED_RSET SHRLIB_VERSION = 3.17.0 +API_HEADER = dbCoreAPI.h +dbCore_API = dbCore + LIBRARY_IOC += dbCore dbCore_LIBS += ca Com dbCore_SYS_LIBS_WIN32 += ws2_32 diff --git a/modules/database/src/ioc/db/dbChannel.h b/modules/database/src/ioc/db/dbChannel.h index fab9c6627..e30270a1c 100644 --- a/modules/database/src/ioc/db/dbChannel.h +++ b/modules/database/src/ioc/db/dbChannel.h @@ -21,9 +21,9 @@ #include "ellLib.h" #include "epicsTypes.h" #include "errMdef.h" -#include "shareLib.h" #include "db_field_log.h" #include "dbEvent.h" +#include "dbCoreAPI.h" #ifdef __cplusplus extern "C" { @@ -148,14 +148,14 @@ struct chFilter { struct dbCommon; struct dbFldDes; -epicsShareFunc void dbChannelInit (void); -epicsShareFunc void dbChannelExit(void); -epicsShareFunc long dbChannelTest(const char *name); -epicsShareFunc dbChannel * dbChannelCreate(const char *name); -epicsShareFunc long dbChannelOpen(dbChannel *chan); +DBCORE_API void dbChannelInit (void); +DBCORE_API void dbChannelExit(void); +DBCORE_API long dbChannelTest(const char *name); +DBCORE_API dbChannel * dbChannelCreate(const char *name); +DBCORE_API long dbChannelOpen(dbChannel *chan); /*Following is also defined in db_convert.h*/ -epicsShareExtern unsigned short dbDBRnewToDBRold[]; +DBCORE_API extern unsigned short dbDBRnewToDBRold[]; /* In the following macros pChan is dbChannel* */ @@ -206,25 +206,25 @@ epicsShareExtern unsigned short dbDBRnewToDBRold[]; #define dbChannelField(pChan) ((pChan)->addr.pfield) -epicsShareFunc long dbChannelGet(dbChannel *chan, short type, +DBCORE_API long dbChannelGet(dbChannel *chan, short type, void *pbuffer, long *options, long *nRequest, void *pfl); -epicsShareFunc long dbChannelGetField(dbChannel *chan, short type, +DBCORE_API long dbChannelGetField(dbChannel *chan, short type, void *pbuffer, long *options, long *nRequest, void *pfl); -epicsShareFunc long dbChannelPut(dbChannel *chan, short type, +DBCORE_API long dbChannelPut(dbChannel *chan, short type, const void *pbuffer, long nRequest); -epicsShareFunc long dbChannelPutField(dbChannel *chan, short type, +DBCORE_API long dbChannelPutField(dbChannel *chan, short type, const void *pbuffer, long nRequest); -epicsShareFunc void dbChannelShow(dbChannel *chan, int level, +DBCORE_API void dbChannelShow(dbChannel *chan, int level, const unsigned short indent); -epicsShareFunc void dbChannelFilterShow(dbChannel *chan, int level, +DBCORE_API void dbChannelFilterShow(dbChannel *chan, int level, const unsigned short indent); -epicsShareFunc void dbChannelDelete(dbChannel *chan); +DBCORE_API void dbChannelDelete(dbChannel *chan); -epicsShareFunc void dbRegisterFilter(const char *key, const chFilterIf *fif, void *puser); -epicsShareFunc db_field_log* dbChannelRunPreChain(dbChannel *chan, db_field_log *pLogIn); -epicsShareFunc db_field_log* dbChannelRunPostChain(dbChannel *chan, db_field_log *pLogIn); -epicsShareFunc const chFilterPlugin * dbFindFilter(const char *key, size_t len); -epicsShareFunc void dbChannelMakeArrayCopy(void *pvt, db_field_log *pfl, dbChannel *chan); +DBCORE_API void dbRegisterFilter(const char *key, const chFilterIf *fif, void *puser); +DBCORE_API db_field_log* dbChannelRunPreChain(dbChannel *chan, db_field_log *pLogIn); +DBCORE_API db_field_log* dbChannelRunPostChain(dbChannel *chan, db_field_log *pLogIn); +DBCORE_API const chFilterPlugin * dbFindFilter(const char *key, size_t len); +DBCORE_API void dbChannelMakeArrayCopy(void *pvt, db_field_log *pfl, dbChannel *chan); #ifdef __cplusplus } diff --git a/modules/database/src/ioc/db/dbJLink.c b/modules/database/src/ioc/db/dbJLink.c index 3acf75660..7f8b41216 100644 --- a/modules/database/src/ioc/db/dbJLink.c +++ b/modules/database/src/ioc/db/dbJLink.c @@ -27,7 +27,7 @@ #include "link.h" #include "epicsExport.h" -epicsShareDef int dbJLinkDebug = 0; +int dbJLinkDebug = 0; epicsExportAddress(int, dbJLinkDebug); #define IFDEBUG(n) if (dbJLinkDebug >= (n)) @@ -39,12 +39,12 @@ typedef struct parseContext { short jsonDepth; } parseContext; -epicsShareDef const char *jlif_result_name[2] = { +const char *jlif_result_name[2] = { "jlif_stop", "jlif_continue", }; -epicsShareDef const char *jlif_key_result_name[5] = { +const char *jlif_key_result_name[5] = { "jlif_key_stop", "jlif_key_continue", "jlif_key_child_inlink", diff --git a/modules/database/src/ioc/db/dbJLink.h b/modules/database/src/ioc/db/dbJLink.h index bd1a6c8a2..fdd4def3e 100644 --- a/modules/database/src/ioc/db/dbJLink.h +++ b/modules/database/src/ioc/db/dbJLink.h @@ -10,7 +10,7 @@ #define INC_dbJLink_H #include -#include +#include #ifdef __cplusplus extern "C" { @@ -124,18 +124,18 @@ typedef struct jlif { */ } jlif; -epicsShareFunc long dbJLinkParse(const char *json, size_t len, short dbfType, +DBCORE_API long dbJLinkParse(const char *json, size_t len, short dbfType, jlink **ppjlink); -epicsShareFunc long dbJLinkInit(struct link *plink); +DBCORE_API long dbJLinkInit(struct link *plink); -epicsShareFunc void dbJLinkFree(jlink *); -epicsShareFunc void dbJLinkReport(jlink *, int level, int indent); +DBCORE_API void dbJLinkFree(jlink *); +DBCORE_API void dbJLinkReport(jlink *, int level, int indent); -epicsShareFunc long dbJLinkMapChildren(struct link *, +DBCORE_API long dbJLinkMapChildren(struct link *, jlink_map_fn rtn, void *ctx); -epicsShareFunc long dbjlr(const char *recname, int level); -epicsShareFunc long dbJLinkMapAll(char *recname, jlink_map_fn rtn, void *ctx); +DBCORE_API long dbjlr(const char *recname, int level); +DBCORE_API long dbJLinkMapAll(char *recname, jlink_map_fn rtn, void *ctx); #ifdef __cplusplus } diff --git a/modules/database/src/std/Makefile b/modules/database/src/std/Makefile index d8eb39bdb..b037b41fb 100644 --- a/modules/database/src/std/Makefile +++ b/modules/database/src/std/Makefile @@ -15,6 +15,9 @@ USR_CPPFLAGS += -DUSE_TYPED_RSET SHRLIB_VERSION = 3.17.0 +API_HEADER = dbRecStdAPI.h +dbRecStd_API = dbRecStd + LIBRARY_IOC += dbRecStd dbRecStd_LIBS = dbCore ca Com diff --git a/modules/libcom/src/Makefile b/modules/libcom/src/Makefile index 57533bafe..f90fde6a6 100644 --- a/modules/libcom/src/Makefile +++ b/modules/libcom/src/Makefile @@ -45,6 +45,10 @@ include $(LIBCOM)/timer/Makefile include $(LIBCOM)/yacc/Makefile include $(LIBCOM)/yajl/Makefile +# Generate library API header file +API_HEADER = libComAPI.h +Com_API = libCom + # Library to build: LIBRARY=Com diff --git a/modules/libcom/src/yajl/yajl.c b/modules/libcom/src/yajl/yajl.c index 6c4977598..02ca188ac 100644 --- a/modules/libcom/src/yajl/yajl.c +++ b/modules/libcom/src/yajl/yajl.c @@ -19,7 +19,6 @@ #include #include -#define epicsExportSharedSymbols #include "yajl_parse.h" #include "yajl_lex.h" #include "yajl_parser.h" diff --git a/modules/libcom/src/yajl/yajl_alloc.c b/modules/libcom/src/yajl/yajl_alloc.c index 5b2601685..2388814be 100644 --- a/modules/libcom/src/yajl/yajl_alloc.c +++ b/modules/libcom/src/yajl/yajl_alloc.c @@ -22,7 +22,6 @@ #include -#define epicsExportSharedSymbols #include "yajl_alloc.h" static void * yajl_internal_malloc(void *ctx, size_t sz) diff --git a/modules/libcom/src/yajl/yajl_buf.c b/modules/libcom/src/yajl/yajl_buf.c index 0f9c28046..182db7257 100644 --- a/modules/libcom/src/yajl/yajl_buf.c +++ b/modules/libcom/src/yajl/yajl_buf.c @@ -18,7 +18,6 @@ #include #include -#define epicsExportSharedSymbols #include "yajl_buf.h" #define YAJL_BUF_INIT_SIZE 2048 diff --git a/modules/libcom/src/yajl/yajl_common.h b/modules/libcom/src/yajl/yajl_common.h index 4bc63eead..8bf0b44c6 100644 --- a/modules/libcom/src/yajl/yajl_common.h +++ b/modules/libcom/src/yajl/yajl_common.h @@ -18,7 +18,7 @@ #define __YAJL_COMMON_H__ #include -#include +#include #include @@ -42,7 +42,7 @@ extern "C" { #define YAJL_MAX_DEPTH 128 -#define YAJL_API epicsShareFunc +#define YAJL_API LIBCOM_API /** pointer to a malloc function, supporting client overriding memory * allocation routines */ diff --git a/modules/libcom/src/yajl/yajl_encode.c b/modules/libcom/src/yajl/yajl_encode.c index 980021ee5..0aa06a3d6 100644 --- a/modules/libcom/src/yajl/yajl_encode.c +++ b/modules/libcom/src/yajl/yajl_encode.c @@ -19,7 +19,6 @@ #include #include -#define epicsExportSharedSymbols #include "yajl_encode.h" static void CharToHex(unsigned char c, char * hexBuf) diff --git a/modules/libcom/src/yajl/yajl_gen.c b/modules/libcom/src/yajl/yajl_gen.c index 7f669247d..0727e9fc1 100644 --- a/modules/libcom/src/yajl/yajl_gen.c +++ b/modules/libcom/src/yajl/yajl_gen.c @@ -19,7 +19,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsMath.h" #include "yajl_gen.h" #include "yajl_buf.h" diff --git a/modules/libcom/src/yajl/yajl_lex.c b/modules/libcom/src/yajl/yajl_lex.c index 0159cfa55..b911da678 100644 --- a/modules/libcom/src/yajl/yajl_lex.c +++ b/modules/libcom/src/yajl/yajl_lex.c @@ -19,7 +19,6 @@ #include #include -#define epicsExportSharedSymbols #include "yajl_lex.h" #include "yajl_buf.h" diff --git a/modules/libcom/src/yajl/yajl_parser.c b/modules/libcom/src/yajl/yajl_parser.c index 7e4da6924..cb910f79d 100644 --- a/modules/libcom/src/yajl/yajl_parser.c +++ b/modules/libcom/src/yajl/yajl_parser.c @@ -23,7 +23,6 @@ #include #include -#define epicsExportSharedSymbols #include "yajl_parse.h" #include "yajl_lex.h" #include "yajl_parser.h" From 02a24a144d0c062311212c769926c1e2df5a1a52 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Sun, 8 Mar 2020 21:19:02 -0700 Subject: [PATCH 094/216] Com: fix handling of thread joinable flag and refcnt The second increment of refcnt must occur before pthread_create or a subtle possibility of a double free() occurs if the thread runs immediately and self-joins before the second inc. Also use atomic ops for joinable flag to ensure that concurrent joins will error properly. --- modules/libcom/src/osi/os/posix/osdThread.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/modules/libcom/src/osi/os/posix/osdThread.c b/modules/libcom/src/osi/os/posix/osdThread.c index a13d3876c..d99e5d9a6 100644 --- a/modules/libcom/src/osi/os/posix/osdThread.c +++ b/modules/libcom/src/osi/os/posix/osdThread.c @@ -185,7 +185,7 @@ static epicsThreadOSD * init_threadInfo(const char *name, return NULL; pthreadInfo->createFunc = funptr; pthreadInfo->createArg = parm; - pthreadInfo->joinable = joinable; + pthreadInfo->joinable = !!joinable; /* ensure 0 or 1 for later atomic compare+swap */ status = pthread_attr_init(&pthreadInfo->attr); checkStatusOnce(status,"pthread_attr_init"); if(status) return 0; @@ -558,6 +558,11 @@ epicsThreadCreateOpt(const char * name, setSchedulingPolicy(pthreadInfo, SCHED_FIFO); pthreadInfo->isRealTimeScheduled = 1; + if (pthreadInfo->joinable) { + /* extra ref for epicsThreadMustJoin() */ + epicsAtomicIncrIntT(&pthreadInfo->refcnt); + } + status = pthread_create(&pthreadInfo->tid, &pthreadInfo->attr, start_routine, pthreadInfo); if (status==EPERM) { @@ -575,16 +580,17 @@ epicsThreadCreateOpt(const char * name, } checkStatusOnce(status, "pthread_create"); if (status) { + if (pthreadInfo->joinable) { + /* release extra ref which would have been for epicsThreadMustJoin() */ + epicsAtomicDecrIntT(&pthreadInfo->refcnt); + } + free_threadInfo(pthreadInfo); return 0; } status = pthread_sigmask(SIG_SETMASK, &oldSig, NULL); checkStatusOnce(status, "pthread_sigmask"); - if (pthreadInfo->joinable) { - /* extra ref for epicsThreadMustJoin() */ - epicsAtomicIncrIntT(&pthreadInfo->refcnt); - } return pthreadInfo; } @@ -631,7 +637,7 @@ void epicsThreadMustJoin(epicsThreadId id) if(!id) { return; - } else if(!id->joinable) { + } else if(epicsAtomicCmpAndSwapIntT(&id->joinable, 1, 0)!=1) { if(epicsThreadGetIdSelf()==id) { errlogPrintf("Warning: %s thread self-join of unjoinable\n", id->name); @@ -653,7 +659,6 @@ void epicsThreadMustJoin(epicsThreadId id) status = pthread_detach(id->tid); checkStatusOnce(status, "pthread_detach"); } else checkStatusOnce(status, "pthread_join"); - id->joinable = 0; free_threadInfo(id); } From 18402f035419d98ceaddbed9ab00bf48acb5165f Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 9 Mar 2020 23:53:22 -0500 Subject: [PATCH 095/216] Convert modules/ca to use LIBCA_API instead of epicsShare Also unified the header exclusion guard names, removed a couple of files that are no longer used, dropped the '3.13.7' from the Copyright header. --- modules/ca/src/client/CASG.cpp | 1 - modules/ca/src/client/SearchDest.h | 8 +- modules/ca/src/client/access.cpp | 4 +- modules/ca/src/client/addrList.h | 22 ++-- modules/ca/src/client/autoPtrFreeList.h | 20 +--- modules/ca/src/client/baseNMIU.cpp | 5 +- modules/ca/src/client/bhe.cpp | 6 +- modules/ca/src/client/bhe.h | 54 ++++------ modules/ca/src/client/caConnTest.cpp | 5 +- modules/ca/src/client/caConnTestMain.cpp | 5 +- modules/ca/src/client/caDiagnostics.h | 11 +- modules/ca/src/client/caEventRate.cpp | 5 +- modules/ca/src/client/caEventRateMain.cpp | 5 +- modules/ca/src/client/caProto.h | 11 +- modules/ca/src/client/caRepeater.cpp | 5 +- modules/ca/src/client/caServerID.h | 13 +-- modules/ca/src/client/caVersion.h | 14 +-- modules/ca/src/client/caVersionNum.h@ | 2 +- modules/ca/src/client/ca_client_context.cpp | 1 - modules/ca/src/client/cac.cpp | 1 - modules/ca/src/client/cac.h | 17 +-- modules/ca/src/client/cacChannel.cpp | 6 +- modules/ca/src/client/cacChannelNotify.cpp | 7 +- modules/ca/src/client/cacContextNotify.cpp | 7 +- modules/ca/src/client/cacIO.h | 19 +--- modules/ca/src/client/cacReadNotify.cpp | 7 +- modules/ca/src/client/cacStateNotify.cpp | 7 +- modules/ca/src/client/cacWriteNotify.cpp | 7 +- modules/ca/src/client/cadef.h | 22 +--- modules/ca/src/client/caerr.h | 21 +--- modules/ca/src/client/casw.cpp | 5 +- modules/ca/src/client/comBuf.cpp | 5 +- modules/ca/src/client/comBuf.h | 11 +- modules/ca/src/client/comQueRecv.cpp | 5 +- modules/ca/src/client/comQueRecv.h | 11 +- modules/ca/src/client/comQueSend.cpp | 6 +- modules/ca/src/client/comQueSend.h | 13 ++- modules/ca/src/client/convert.cpp | 6 +- modules/ca/src/client/db_access.h | 33 ++---- .../ca/src/client/disconnectGovernorTimer.cpp | 6 +- .../ca/src/client/disconnectGovernorTimer.h | 22 ++-- modules/ca/src/client/getCallback.cpp | 6 +- modules/ca/src/client/getCopy.cpp | 6 +- modules/ca/src/client/hostNameCache.cpp | 5 +- modules/ca/src/client/hostNameCache.h | 20 +--- modules/ca/src/client/inetAddrID.h | 11 +- modules/ca/src/client/iocinf.cpp | 5 +- modules/ca/src/client/iocinf.h | 11 +- modules/ca/src/client/localHostName.cpp | 5 +- modules/ca/src/client/localHostName.h | 20 +--- .../ca/src/client/msgForMultiplyDefinedPV.cpp | 6 +- .../ca/src/client/msgForMultiplyDefinedPV.h | 20 +--- modules/ca/src/client/nciu.cpp | 4 +- modules/ca/src/client/nciu.h | 19 +--- modules/ca/src/client/netIO.h | 11 +- modules/ca/src/client/netReadNotifyIO.cpp | 5 +- modules/ca/src/client/netSubscription.cpp | 6 +- modules/ca/src/client/netWriteNotifyIO.cpp | 5 +- modules/ca/src/client/net_convert.h | 15 ++- modules/ca/src/client/netiiu.cpp | 5 +- modules/ca/src/client/netiiu.h | 11 +- modules/ca/src/client/noopiiu.cpp | 6 +- modules/ca/src/client/noopiiu.h | 11 +- modules/ca/src/client/oldAccess.h | 20 +--- modules/ca/src/client/oldChannelNotify.cpp | 4 +- modules/ca/src/client/oldSubscription.cpp | 6 +- modules/ca/src/client/putCallback.cpp | 6 +- modules/ca/src/client/repeater.cpp | 3 +- modules/ca/src/client/repeaterClient.h | 23 ++-- .../ca/src/client/repeaterSubscribeTimer.cpp | 7 +- .../ca/src/client/repeaterSubscribeTimer.h | 23 ++-- modules/ca/src/client/searchTimer.cpp | 6 +- modules/ca/src/client/searchTimer.h | 22 ++-- modules/ca/src/client/sgAutoPtr.h | 11 +- modules/ca/src/client/syncGroup.h | 20 +--- modules/ca/src/client/syncGroupNotify.cpp | 6 +- modules/ca/src/client/syncGroupReadNotify.cpp | 4 +- .../ca/src/client/syncGroupWriteNotify.cpp | 4 +- modules/ca/src/client/syncgrp.cpp | 4 +- modules/ca/src/client/tcpRecvThread.cpp | 11 -- modules/ca/src/client/tcpRecvWatchdog.cpp | 5 +- modules/ca/src/client/tcpRecvWatchdog.h | 21 ++-- modules/ca/src/client/tcpSendWatchdog.cpp | 5 +- modules/ca/src/client/tcpSendWatchdog.h | 22 ++-- modules/ca/src/client/tcpiiu.cpp | 3 +- modules/ca/src/client/test_event.cpp | 6 +- modules/ca/src/client/ucx.h | 102 ------------------ modules/ca/src/client/udpiiu.cpp | 3 +- modules/ca/src/client/udpiiu.h | 28 ++--- modules/ca/src/client/virtualCircuit.h | 8 +- 90 files changed, 308 insertions(+), 729 deletions(-) delete mode 100644 modules/ca/src/client/tcpRecvThread.cpp delete mode 100644 modules/ca/src/client/ucx.h diff --git a/modules/ca/src/client/CASG.cpp b/modules/ca/src/client/CASG.cpp index 4ffb414c7..bb0cc2083 100644 --- a/modules/ca/src/client/CASG.cpp +++ b/modules/ca/src/client/CASG.cpp @@ -18,7 +18,6 @@ #include "errlog.h" -#define epicsExportSharedSymbols #include "iocinf.h" #include "syncGroup.h" #include "oldAccess.h" diff --git a/modules/ca/src/client/SearchDest.h b/modules/ca/src/client/SearchDest.h index c22be7c87..cb9c3e737 100644 --- a/modules/ca/src/client/SearchDest.h +++ b/modules/ca/src/client/SearchDest.h @@ -5,11 +5,11 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found - * in file LICENSE that is included with this distribution. + * in file LICENSE that is included with this distribution. \*************************************************************************/ -#ifndef SearchDest_h -#define SearchDest_h +#ifndef INC_SearchDest_H +#define INC_SearchDest_H #include #include @@ -36,4 +36,4 @@ struct SearchDest : virtual void show ( epicsGuard < epicsMutex > &, unsigned level ) const = 0; }; -#endif // SearchDest_h +#endif // ifndef INC_SearchDest_H diff --git a/modules/ca/src/client/access.cpp b/modules/ca/src/client/access.cpp index b39406014..42e25686d 100644 --- a/modules/ca/src/client/access.cpp +++ b/modules/ca/src/client/access.cpp @@ -3,8 +3,7 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ @@ -40,7 +39,6 @@ */ #define CAC_VERSION_GLOBAL -#define epicsExportSharedSymbols #include "iocinf.h" #include "oldAccess.h" #include "cac.h" diff --git a/modules/ca/src/client/addrList.h b/modules/ca/src/client/addrList.h index c06c8b2bc..c59f8e7af 100644 --- a/modules/ca/src/client/addrList.h +++ b/modules/ca/src/client/addrList.h @@ -3,38 +3,38 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ -#ifndef addrListh -#define addrListh +#ifndef INC_addrList_H +#define INC_addrList_H -#include "shareLib.h" #include "envDefs.h" #include "osiSock.h" +#include "libCaAPI.h" + #ifdef __cplusplus extern "C" { #endif -epicsShareFunc void epicsShareAPI configureChannelAccessAddressList +LIBCA_API void epicsShareAPI configureChannelAccessAddressList ( struct ELLLIST *pList, SOCKET sock, unsigned short port ); -epicsShareFunc int epicsShareAPI addAddrToChannelAccessAddressList +LIBCA_API int epicsShareAPI addAddrToChannelAccessAddressList ( struct ELLLIST *pList, const ENV_PARAM *pEnv, unsigned short port, int ignoreNonDefaultPort ); -epicsShareFunc void epicsShareAPI printChannelAccessAddressList +LIBCA_API void epicsShareAPI printChannelAccessAddressList ( const struct ELLLIST *pList ); -epicsShareFunc void epicsShareAPI removeDuplicateAddresses +LIBCA_API void epicsShareAPI removeDuplicateAddresses ( struct ELLLIST *pDestList, ELLLIST *pSrcList, int silent); #ifdef __cplusplus } #endif -#endif /* ifndef addrListh */ +#endif /* ifndef INC_addrList_H */ diff --git a/modules/ca/src/client/autoPtrFreeList.h b/modules/ca/src/client/autoPtrFreeList.h index 7dc73609a..b3679c6e8 100644 --- a/modules/ca/src/client/autoPtrFreeList.h +++ b/modules/ca/src/client/autoPtrFreeList.h @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -23,21 +22,12 @@ * 505 665 1831 */ -#ifndef autoPtrFreeListh -#define autoPtrFreeListh - -#ifdef epicsExportSharedSymbols -# define autoPtrFreeListh_epicsExportSharedSymbols -# undef epicsExportSharedSymbols -#endif +#ifndef INC_autoPtrFreeList_H +#define INC_autoPtrFreeList_H #include "tsFreeList.h" #include "compilerDependencies.h" -#ifdef autoPtrFreeListh_epicsExportSharedSymbols -# define epicsExportSharedSymbols -#endif - template < class T, unsigned N = 0x400, class MUTEX = epicsMutex > class autoPtrFreeList { public: @@ -101,4 +91,4 @@ inline T * autoPtrFreeList < T, N, MUTEX >::release () return pTmp; } -#endif // #ifdef autoPtrFreeListh +#endif // #ifndef INC_autoPtrFreeList_H diff --git a/modules/ca/src/client/baseNMIU.cpp b/modules/ca/src/client/baseNMIU.cpp index 20f153b0a..226568e62 100644 --- a/modules/ca/src/client/baseNMIU.cpp +++ b/modules/ca/src/client/baseNMIU.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/ca/src/client/bhe.cpp b/modules/ca/src/client/bhe.cpp index d6f1796be..8ba679e7d 100644 --- a/modules/ca/src/client/bhe.cpp +++ b/modules/ca/src/client/bhe.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -28,7 +27,6 @@ #include "errlog.h" -#define epicsExportSharedSymbols #include "iocinf.h" #include "virtualCircuit.h" #include "bhe.h" diff --git a/modules/ca/src/client/bhe.h b/modules/ca/src/client/bhe.h index 4da95202a..b503ebb42 100644 --- a/modules/ca/src/client/bhe.h +++ b/modules/ca/src/client/bhe.h @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -19,24 +18,15 @@ * Author: Jeff Hill */ -#ifndef bheh -#define bheh - -#ifdef epicsExportSharedSymbols -# define bhehEpicsExportSharedSymbols -# undef epicsExportSharedSymbols -#endif +#ifndef INC_bhe_H +#define INC_bhe_H #include "tsDLList.h" #include "tsFreeList.h" #include "epicsTime.h" #include "compilerDependencies.h" -#ifdef bhehEpicsExportSharedSymbols -# define epicsExportSharedSymbols -# include "shareLib.h" -#endif - +#include "libCaAPI.h" #include "inetAddrID.h" #include "caProto.h" @@ -45,7 +35,7 @@ class bheMemoryManager; // using a pure abstract wrapper class around the free list avoids // Tornado 2.0.1 GNU compiler bugs -class epicsShareClass bheMemoryManager { +class LIBCA_API bheMemoryManager { public: virtual ~bheMemoryManager (); virtual void * allocate ( size_t ) = 0; @@ -54,24 +44,24 @@ public: class bhe : public tsSLNode < bhe >, public inetAddrID { public: - epicsShareFunc bhe ( - epicsMutex &, const epicsTime & initialTimeStamp, + LIBCA_API bhe ( + epicsMutex &, const epicsTime & initialTimeStamp, unsigned initialBeaconNumber, const inetAddrID & addr ); - epicsShareFunc ~bhe (); - epicsShareFunc bool updatePeriod ( + LIBCA_API ~bhe (); + LIBCA_API bool updatePeriod ( epicsGuard < epicsMutex > &, - const epicsTime & programBeginTime, - const epicsTime & currentTime, ca_uint32_t beaconNumber, + const epicsTime & programBeginTime, + const epicsTime & currentTime, ca_uint32_t beaconNumber, unsigned protocolRevision ); - epicsShareFunc double period ( epicsGuard < epicsMutex > & ) const; - epicsShareFunc epicsTime updateTime ( epicsGuard < epicsMutex > & ) const; - epicsShareFunc void show ( unsigned level ) const; - epicsShareFunc void show ( epicsGuard < epicsMutex > &, unsigned /* level */ ) const; - epicsShareFunc void registerIIU ( epicsGuard < epicsMutex > &, tcpiiu & ); - epicsShareFunc void unregisterIIU ( epicsGuard < epicsMutex > &, tcpiiu & ); - epicsShareFunc void * operator new ( size_t size, bheMemoryManager & ); + LIBCA_API double period ( epicsGuard < epicsMutex > & ) const; + LIBCA_API epicsTime updateTime ( epicsGuard < epicsMutex > & ) const; + LIBCA_API void show ( unsigned level ) const; + LIBCA_API void show ( epicsGuard < epicsMutex > &, unsigned /* level */ ) const; + LIBCA_API void registerIIU ( epicsGuard < epicsMutex > &, tcpiiu & ); + LIBCA_API void unregisterIIU ( epicsGuard < epicsMutex > &, tcpiiu & ); + LIBCA_API void * operator new ( size_t size, bheMemoryManager & ); #ifdef CXX_PLACEMENT_DELETE - epicsShareFunc void operator delete ( void *, bheMemoryManager & ); + LIBCA_API void operator delete ( void *, bheMemoryManager & ); #endif private: epicsTime timeStamp; @@ -87,7 +77,7 @@ private: const epicsTime & currentTime ); bhe ( const bhe & ); bhe & operator = ( const bhe & ); - epicsShareFunc void operator delete ( void * ); + LIBCA_API void operator delete ( void * ); }; // using a wrapper class around the free list avoids @@ -117,6 +107,6 @@ inline void bhe::operator delete ( void * pCadaver, } #endif -#endif // ifdef bheh +#endif // ifndef INC_bhe_H diff --git a/modules/ca/src/client/caConnTest.cpp b/modules/ca/src/client/caConnTest.cpp index 21077398a..6f6ed0d1b 100644 --- a/modules/ca/src/client/caConnTest.cpp +++ b/modules/ca/src/client/caConnTest.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include diff --git a/modules/ca/src/client/caConnTestMain.cpp b/modules/ca/src/client/caConnTestMain.cpp index f3985801a..aaab0f1d2 100644 --- a/modules/ca/src/client/caConnTestMain.cpp +++ b/modules/ca/src/client/caConnTestMain.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include diff --git a/modules/ca/src/client/caDiagnostics.h b/modules/ca/src/client/caDiagnostics.h index 90221e1ed..56318e764 100644 --- a/modules/ca/src/client/caDiagnostics.h +++ b/modules/ca/src/client/caDiagnostics.h @@ -3,13 +3,12 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ -#ifndef caDiagnosticsh -#define caDiagnosticsh +#ifndef INC_caDiagnostics_H +#define INC_caDiagnostics_H #include "cadef.h" @@ -33,6 +32,6 @@ int acctst ( const char *pname, unsigned logggingInterestLevel, void caConnTest ( const char *pNameIn, unsigned channelCountIn, double delayIn ); -#endif /* caDiagnosticsh */ +#endif /* ifndef INC_caDiagnostics_H */ diff --git a/modules/ca/src/client/caEventRate.cpp b/modules/ca/src/client/caEventRate.cpp index 8beb16333..414464948 100644 --- a/modules/ca/src/client/caEventRate.cpp +++ b/modules/ca/src/client/caEventRate.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include diff --git a/modules/ca/src/client/caEventRateMain.cpp b/modules/ca/src/client/caEventRateMain.cpp index 725e66102..f773c5de4 100644 --- a/modules/ca/src/client/caEventRateMain.cpp +++ b/modules/ca/src/client/caEventRateMain.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include diff --git a/modules/ca/src/client/caProto.h b/modules/ca/src/client/caProto.h index 781c89b34..f43a848bb 100644 --- a/modules/ca/src/client/caProto.h +++ b/modules/ca/src/client/caProto.h @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * @@ -14,8 +13,8 @@ * 505 665 1831 */ -#ifndef __CAPROTO__ -#define __CAPROTO__ +#ifndef INC_caProto_H +#define INC_caProto_H #define capStrOf(A) #A #define capStrOfX(A) capStrOf ( A ) @@ -183,5 +182,5 @@ struct mon_info { */ #define unreasonablePVNameSize 500u -#endif /* __CAPROTO__ */ +#endif /* ifndef INC_caProto_H */ diff --git a/modules/ca/src/client/caRepeater.cpp b/modules/ca/src/client/caRepeater.cpp index 2561223a5..a9cefbdf7 100644 --- a/modules/ca/src/client/caRepeater.cpp +++ b/modules/ca/src/client/caRepeater.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * diff --git a/modules/ca/src/client/caServerID.h b/modules/ca/src/client/caServerID.h index 08bfdd5df..b2df7cafb 100644 --- a/modules/ca/src/client/caServerID.h +++ b/modules/ca/src/client/caServerID.h @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * @@ -18,8 +17,8 @@ * Author: Jeff Hill */ -#ifndef caServerIDh -#define caServerIDh +#ifndef INC_caServerID_H +#define INC_caServerID_H #include "osiSock.h" #include "resourceLib.h" @@ -83,6 +82,4 @@ inline unsigned caServerID::priority () const return this->pri; } -#endif // ifdef caServerID - - +#endif // ifdef INC_caServerID_H diff --git a/modules/ca/src/client/caVersion.h b/modules/ca/src/client/caVersion.h index cdae17dce..9dda32c60 100644 --- a/modules/ca/src/client/caVersion.h +++ b/modules/ca/src/client/caVersion.h @@ -5,15 +5,10 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -#ifndef CAVERSION_H -#define CAVERSION_H +#ifndef INC_caVersion_H +#define INC_caVersion_H #include -#include - -#ifndef VERSION_INT -# define VERSION_INT(V,R,M,P) ( ((V)<<24) | ((R)<<16) | ((M)<<8) | (P)) -#endif /* include generated headers with: * EPICS_CA_MAJOR_VERSION @@ -23,6 +18,7 @@ */ #include "caVersionNum.h" -#define CA_VERSION_INT VERSION_INT(EPICS_CA_MAJOR_VERSION, EPICS_CA_MINOR_VERSION, EPICS_CA_MAINTENANCE_VERSION, 0) +#define CA_VERSION_INT VERSION_INT(EPICS_CA_MAJOR_VERSION, \ + EPICS_CA_MINOR_VERSION, EPICS_CA_MAINTENANCE_VERSION, 0) -#endif // CAVERSION_H +#endif /* ifndef INC_caVersion_H */ diff --git a/modules/ca/src/client/caVersionNum.h@ b/modules/ca/src/client/caVersionNum.h@ index 26ce6e1af..dcd7518c0 100644 --- a/modules/ca/src/client/caVersionNum.h@ +++ b/modules/ca/src/client/caVersionNum.h@ @@ -1,4 +1,4 @@ -#ifndef CAVERSION_H +#ifndef INC_caVersion_H # error include caVersion.h, not this header #endif #define EPICS_CA_MAJOR_VERSION @EPICS_CA_MAJOR_VERSION@ diff --git a/modules/ca/src/client/ca_client_context.cpp b/modules/ca/src/client/ca_client_context.cpp index 011a4f105..6e5bbb88e 100644 --- a/modules/ca/src/client/ca_client_context.cpp +++ b/modules/ca/src/client/ca_client_context.cpp @@ -34,7 +34,6 @@ #include "errlog.h" #include "locationException.h" -#define epicsExportSharedSymbols #include "iocinf.h" #include "oldAccess.h" #include "cac.h" diff --git a/modules/ca/src/client/cac.cpp b/modules/ca/src/client/cac.cpp index 476d1c380..ecf67e0e5 100644 --- a/modules/ca/src/client/cac.cpp +++ b/modules/ca/src/client/cac.cpp @@ -34,7 +34,6 @@ #include "errlog.h" #include "epicsExport.h" -#define epicsExportSharedSymbols #include "addrList.h" #include "iocinf.h" #include "cac.h" diff --git a/modules/ca/src/client/cac.h b/modules/ca/src/client/cac.h index 7db5c6ddc..f59245c26 100644 --- a/modules/ca/src/client/cac.h +++ b/modules/ca/src/client/cac.h @@ -19,13 +19,8 @@ * */ -#ifndef cach -#define cach - -#ifdef epicsExportSharedSymbols -# define cach_restore_epicsExportSharedSymbols -# undef epicsExportSharedSymbols -#endif +#ifndef INC_cac_H +#define INC_cac_H #include "compilerDependencies.h" #include "ipAddrToAsciiAsynchronous.h" @@ -35,11 +30,7 @@ #include "freeList.h" #include "localHostName.h" -#ifdef cach_restore_epicsExportSharedSymbols -# define epicsExportSharedSymbols -# include "shareLib.h" -#endif - +#include "libCaAPI.h" #include "nciu.h" #include "comBuf.h" #include "bhe.h" @@ -432,4 +423,4 @@ inline double cac :: return this->connTMO; } -#endif // ifdef cach +#endif // ifndef INC_cac_H diff --git a/modules/ca/src/client/cacChannel.cpp b/modules/ca/src/client/cacChannel.cpp index c1a52a002..6a7fd287d 100644 --- a/modules/ca/src/client/cacChannel.cpp +++ b/modules/ca/src/client/cacChannel.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ @@ -27,7 +26,6 @@ #include "errlog.h" -#define epicsExportSharedSymbols #include "iocinf.h" #include "localHostName.h" #include "cacIO.h" diff --git a/modules/ca/src/client/cacChannelNotify.cpp b/modules/ca/src/client/cacChannelNotify.cpp index 08d2cab94..67e23164c 100644 --- a/modules/ca/src/client/cacChannelNotify.cpp +++ b/modules/ca/src/client/cacChannelNotify.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * @@ -24,9 +23,7 @@ #include "iocinf.h" -#define epicsExportSharedSymbols #include "cacIO.h" -#undef epicsExportSharedSymbols cacChannelNotify::~cacChannelNotify () { diff --git a/modules/ca/src/client/cacContextNotify.cpp b/modules/ca/src/client/cacContextNotify.cpp index a4498ac04..aa8904e17 100644 --- a/modules/ca/src/client/cacContextNotify.cpp +++ b/modules/ca/src/client/cacContextNotify.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -23,9 +22,7 @@ #include "iocinf.h" -#define epicsExportSharedSymbols #include "cacIO.h" -#undef epicsExportSharedSymbols cacContextNotify::~cacContextNotify () { diff --git a/modules/ca/src/client/cacIO.h b/modules/ca/src/client/cacIO.h index f75c18cc4..640b9a3c1 100644 --- a/modules/ca/src/client/cacIO.h +++ b/modules/ca/src/client/cacIO.h @@ -3,8 +3,7 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -22,8 +21,8 @@ * 505 665 1831 */ -#ifndef cacIOh -#define cacIOh +#ifndef INC_cacIO_H +#define INC_cacIO_H // // Open Issues @@ -47,21 +46,11 @@ #include #include -#ifdef epicsExportSharedSymbols -# define cacIOh_restore_epicsExportSharedSymbols -# undef epicsExportSharedSymbols -#endif - #include "tsDLList.h" #include "epicsMutex.h" #include "epicsGuard.h" #include "epicsThread.h" -#ifdef cacIOh_restore_epicsExportSharedSymbols -# define epicsExportSharedSymbols -# include "shareLib.h" -#endif - #include "libCaAPI.h" @@ -391,4 +380,4 @@ inline bool caAccessRights::operatorConfirmationRequest () const return this->f_operatorConfirmationRequest; } -#endif // ifndef cacIOh +#endif // ifndef INC_cacIO_H diff --git a/modules/ca/src/client/cacReadNotify.cpp b/modules/ca/src/client/cacReadNotify.cpp index 23284c8df..c8e9a5434 100644 --- a/modules/ca/src/client/cacReadNotify.cpp +++ b/modules/ca/src/client/cacReadNotify.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -21,9 +20,7 @@ #include "iocinf.h" -#define epicsExportSharedSymbols #include "cacIO.h" -#undef epicsExportSharedSymbols cacReadNotify::~cacReadNotify () { diff --git a/modules/ca/src/client/cacStateNotify.cpp b/modules/ca/src/client/cacStateNotify.cpp index 08852489a..799b0dfa0 100644 --- a/modules/ca/src/client/cacStateNotify.cpp +++ b/modules/ca/src/client/cacStateNotify.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -21,9 +20,7 @@ #include "iocinf.h" -#define epicsExportSharedSymbols #include "cacIO.h" -#undef epicsExportSharedSymbols cacStateNotify::~cacStateNotify () { diff --git a/modules/ca/src/client/cacWriteNotify.cpp b/modules/ca/src/client/cacWriteNotify.cpp index 13d47cd45..79b98bb66 100644 --- a/modules/ca/src/client/cacWriteNotify.cpp +++ b/modules/ca/src/client/cacWriteNotify.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -21,9 +20,7 @@ #include "iocinf.h" -#define epicsExportSharedSymbols #include "cacIO.h" -#undef epicsExportSharedSymbols cacWriteNotify::~cacWriteNotify () { diff --git a/modules/ca/src/client/cadef.h b/modules/ca/src/client/cadef.h index 1b37be3f9..afa81f927 100644 --- a/modules/ca/src/client/cadef.h +++ b/modules/ca/src/client/cadef.h @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * @@ -21,8 +20,8 @@ * */ -#ifndef INCLcadefh -#define INCLcadefh +#ifndef INC_cadef_H +#define INC_cadef_H /* * done in two ifdef steps so that we will remain compatible with @@ -32,20 +31,9 @@ # include #endif -#ifdef epicsExportSharedSymbols -# define INCLcadefh_accessh_epicsExportSharedSymbols -# undef epicsExportSharedSymbols -#endif - #include "epicsThread.h" -#ifdef INCLcadefh_accessh_epicsExportSharedSymbols -# define epicsExportSharedSymbols -# include "shareLib.h" -#endif - #include "libCaAPI.h" - #include "caerr.h" #include "db_access.h" #include "caeventmask.h" @@ -901,5 +889,5 @@ LIBCA_API int epicsShareAPI ca_modify_host_name ( const char *pHostName ); /* * no additions below this endif */ -#endif /* ifndef INCLcadefh */ +#endif /* ifndef INC_cadef_H */ diff --git a/modules/ca/src/client/caerr.h b/modules/ca/src/client/caerr.h index 4c0b36835..ead86db9f 100644 --- a/modules/ca/src/client/caerr.h +++ b/modules/ca/src/client/caerr.h @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * @@ -20,20 +19,10 @@ */ -#ifndef INCLcaerrh -#define INCLcaerrh +#ifndef INC_caerr_H +#define INC_caerr_H -#ifdef epicsExportSharedSymbols -# define INCLcaerrh_accessh_epicsExportSharedSymbols -# undef epicsExportSharedSymbols -#endif - -# include "epicsTypes.h" - -#ifdef INCLcaerrh_accessh_epicsExportSharedSymbols -# define epicsExportSharedSymbols -# include "shareLib.h" -#endif +#include "epicsTypes.h" #include "libCaAPI.h" diff --git a/modules/ca/src/client/casw.cpp b/modules/ca/src/client/casw.cpp index ed1766072..74e38dca9 100644 --- a/modules/ca/src/client/casw.cpp +++ b/modules/ca/src/client/casw.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/ca/src/client/comBuf.cpp b/modules/ca/src/client/comBuf.cpp index 94245d387..21c73ebba 100644 --- a/modules/ca/src/client/comBuf.cpp +++ b/modules/ca/src/client/comBuf.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * diff --git a/modules/ca/src/client/comBuf.h b/modules/ca/src/client/comBuf.h index 59e38780b..281961c6d 100644 --- a/modules/ca/src/client/comBuf.h +++ b/modules/ca/src/client/comBuf.h @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * @@ -21,8 +20,8 @@ * johill@lanl.gov */ -#ifndef comBufh -#define comBufh +#ifndef INC_comBuf_H +#define INC_comBuf_H #include #include @@ -332,4 +331,4 @@ comBuf :: popStatus comBuf :: pop ( T & returnVal ) return status; } -#endif // ifndef comBufh +#endif // ifndef INC_comBuf_H diff --git a/modules/ca/src/client/comQueRecv.cpp b/modules/ca/src/client/comQueRecv.cpp index 88263544d..3628ad181 100644 --- a/modules/ca/src/client/comQueRecv.cpp +++ b/modules/ca/src/client/comQueRecv.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * diff --git a/modules/ca/src/client/comQueRecv.h b/modules/ca/src/client/comQueRecv.h index 7f3153d8d..96b6b5eac 100644 --- a/modules/ca/src/client/comQueRecv.h +++ b/modules/ca/src/client/comQueRecv.h @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -23,8 +22,8 @@ * 505 665 1831 */ -#ifndef comQueRecvh -#define comQueRecvh +#ifndef INC_comQueRecv_H +#define INC_comQueRecv_H #include "comBuf.h" @@ -108,4 +107,4 @@ inline epicsFloat64 comQueRecv::popFloat64 () return AlignedWireRef < epicsFloat64 > ( tmp._fp ); } -#endif // ifndef comQueRecvh +#endif // ifndef INC_comQueRecv_H diff --git a/modules/ca/src/client/comQueSend.cpp b/modules/ca/src/client/comQueSend.cpp index 6ed516bb3..b81411c37 100644 --- a/modules/ca/src/client/comQueSend.cpp +++ b/modules/ca/src/client/comQueSend.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -67,7 +66,6 @@ #define epicsAssertAuthor "Jeff Hill johill@lanl.gov" -#define epicsExportSharedSymbols #include "iocinf.h" #include "virtualCircuit.h" #include "db_access.h" // for dbr_short_t etc diff --git a/modules/ca/src/client/comQueSend.h b/modules/ca/src/client/comQueSend.h index 808285e7a..30ef30712 100644 --- a/modules/ca/src/client/comQueSend.h +++ b/modules/ca/src/client/comQueSend.h @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ @@ -24,10 +23,10 @@ * 505 665 1831 */ -#ifndef comQueSendh -#define comQueSendh +#ifndef INC_comQueSend_H +#define INC_comQueSend_H -#include +#include #include "tsDLList.h" #include "comBuf.h" @@ -235,4 +234,4 @@ inline comBuf * comQueSend::newComBuf () return new ( this->comBufMemMgr ) comBuf; } -#endif // ifndef comQueSendh +#endif // ifndef INC_comQueSend_H diff --git a/modules/ca/src/client/convert.cpp b/modules/ca/src/client/convert.cpp index 851711774..e70e6be9e 100644 --- a/modules/ca/src/client/convert.cpp +++ b/modules/ca/src/client/convert.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * C O N V E R T . C @@ -29,7 +28,6 @@ #include "osiSock.h" #include "osiWireFormat.h" -#define epicsExportSharedSymbols #include "net_convert.h" #include "iocinf.h" #include "caProto.h" diff --git a/modules/ca/src/client/db_access.h b/modules/ca/src/client/db_access.h index 5ad565863..b82ae4243 100644 --- a/modules/ca/src/client/db_access.h +++ b/modules/ca/src/client/db_access.h @@ -3,33 +3,22 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* base/include/db_access.h */ /* Author: Bob Dalesio * Date: 4-4-88 */ -#ifndef INCLdb_accessh -#define INCLdb_accessh +#ifndef INC_db_access_H +#define INC_db_access_H #include -#ifdef epicsExportSharedSymbols -# define INCLdb_accessh_epicsExportSharedSymbols -# undef epicsExportSharedSymbols -#endif - #include "epicsTypes.h" #include "epicsTime.h" -#ifdef INCLdb_accessh_epicsExportSharedSymbols -# define epicsExportSharedSymbols -# include "shareLib.h" -#endif - #include "libCaAPI.h" @@ -726,17 +715,17 @@ union db_access_val{ (type) + 4*(dbf_text_dim-2) : -1 ) -LIBCA_API extern const char *dbf_text[LAST_TYPE+3]; -LIBCA_API extern const short dbf_text_dim; -LIBCA_API extern const char *dbf_text_invalid; +LIBCA_API extern const char *dbf_text[LAST_TYPE+3]; +LIBCA_API extern const short dbf_text_dim; +LIBCA_API extern const char *dbf_text_invalid; -LIBCA_API extern const char *dbr_text[LAST_BUFFER_TYPE+1]; -LIBCA_API extern const short dbr_text_dim; -LIBCA_API extern const char *dbr_text_invalid; +LIBCA_API extern const char *dbr_text[LAST_BUFFER_TYPE+1]; +LIBCA_API extern const short dbr_text_dim; +LIBCA_API extern const char *dbr_text_invalid; #endif /*db_accessHFORdb_accessC*/ #ifdef __cplusplus } #endif -#endif /* INCLdb_accessh */ +#endif /* ifndef INC_db_access_H */ diff --git a/modules/ca/src/client/disconnectGovernorTimer.cpp b/modules/ca/src/client/disconnectGovernorTimer.cpp index f1d517f07..987c54a84 100644 --- a/modules/ca/src/client/disconnectGovernorTimer.cpp +++ b/modules/ca/src/client/disconnectGovernorTimer.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ // // @@ -20,7 +19,6 @@ #define epicsAssertAuthor "Jeff Hill johill@lanl.gov" -#define epicsExportSharedSymbols #include "disconnectGovernorTimer.h" #include "udpiiu.h" #include "nciu.h" diff --git a/modules/ca/src/client/disconnectGovernorTimer.h b/modules/ca/src/client/disconnectGovernorTimer.h index f636d6260..70127a711 100644 --- a/modules/ca/src/client/disconnectGovernorTimer.h +++ b/modules/ca/src/client/disconnectGovernorTimer.h @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ // @@ -23,23 +22,14 @@ // 505 665 1831 // -#ifndef disconnectGovernorTimerh -#define disconnectGovernorTimerh - -#ifdef epicsExportSharedSymbols -# define searchTimerh_epicsExportSharedSymbols -# undef epicsExportSharedSymbols -#endif +#ifndef INC_disconnectGovernorTimer_H +#define INC_disconnectGovernorTimer_H #include "epicsMutex.h" #include "epicsGuard.h" #include "epicsTimer.h" -#ifdef searchTimerh_epicsExportSharedSymbols -# define epicsExportSharedSymbols -# include "shareLib.h" -#endif - +#include "libCaAPI.h" #include "caProto.h" #include "netiiu.h" @@ -74,4 +64,4 @@ private: disconnectGovernorTimer & operator = ( const disconnectGovernorTimer & ); }; -#endif // ifdef disconnectGovernorTimerh +#endif // ifdef INC_disconnectGovernorTimer_H diff --git a/modules/ca/src/client/getCallback.cpp b/modules/ca/src/client/getCallback.cpp index 0fc050043..f5c4e760d 100644 --- a/modules/ca/src/client/getCallback.cpp +++ b/modules/ca/src/client/getCallback.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -28,7 +27,6 @@ #include "errlog.h" -#define epicsExportSharedSymbols #include "iocinf.h" #include "oldAccess.h" diff --git a/modules/ca/src/client/getCopy.cpp b/modules/ca/src/client/getCopy.cpp index 23a508d9a..7f1ccf07c 100644 --- a/modules/ca/src/client/getCopy.cpp +++ b/modules/ca/src/client/getCopy.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -30,7 +29,6 @@ #define epicsAssertAuthor "Jeff Hill johill@lanl.gov" -#define epicsExportSharedSymbols #include "iocinf.h" #include "oldAccess.h" #include "cac.h" diff --git a/modules/ca/src/client/hostNameCache.cpp b/modules/ca/src/client/hostNameCache.cpp index c3d105c06..d82ffde13 100644 --- a/modules/ca/src/client/hostNameCache.cpp +++ b/modules/ca/src/client/hostNameCache.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/ca/src/client/hostNameCache.h b/modules/ca/src/client/hostNameCache.h index a4eacfbb3..0fc7e7860 100644 --- a/modules/ca/src/client/hostNameCache.h +++ b/modules/ca/src/client/hostNameCache.h @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -23,21 +22,12 @@ * 505 665 1831 */ -#ifndef hostNameCacheh -#define hostNameCacheh - -#ifdef epicsExportSharedSymbols -# define hostNameCache_epicsExportSharedSymbols -# undef epicsExportSharedSymbols -#endif +#ifndef INC_hostNameCache_H +#define INC_hostNameCache_H #include "ipAddrToAsciiAsynchronous.h" #include "epicsMutex.h" -#ifdef hostNameCache_epicsExportSharedSymbols -# define epicsExportSharedSymbols -#endif - class hostNameCache : public ipAddrToAsciiCallBack { public: hostNameCache ( const osiSockAddr & addr, ipAddrToAsciiEngine & engine ); @@ -58,4 +48,4 @@ inline const char * hostNameCache::pointer () const return this->hostNameBuf; } -#endif // #ifndef hostNameCacheh +#endif // #ifndef INC_hostNameCache_H diff --git a/modules/ca/src/client/inetAddrID.h b/modules/ca/src/client/inetAddrID.h index 978787599..d7ee160cb 100644 --- a/modules/ca/src/client/inetAddrID.h +++ b/modules/ca/src/client/inetAddrID.h @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -19,8 +18,8 @@ * Author: Jeff Hill */ -#ifndef inetAddrIDh -#define inetAddrIDh +#ifndef INC_inetAddrID_H +#define INC_inetAddrID_H #include "osiSock.h" #include "resourceLib.h" @@ -67,6 +66,6 @@ inline void inetAddrID::name ( char *pBuf, unsigned bufSize ) const ipAddrToDottedIP ( &this->addr, pBuf, bufSize ); } -#endif // ifdef inetAddrID +#endif // ifdef INC_inetAddrID_H diff --git a/modules/ca/src/client/iocinf.cpp b/modules/ca/src/client/iocinf.cpp index 09eea292b..c0f6e7cab 100644 --- a/modules/ca/src/client/iocinf.cpp +++ b/modules/ca/src/client/iocinf.cpp @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -31,10 +31,7 @@ #include "errlog.h" #include "osiWireFormat.h" -#define epicsExportSharedSymbols #include "addrList.h" -#undef epicsExportSharedSymbols - #include "iocinf.h" /* diff --git a/modules/ca/src/client/iocinf.h b/modules/ca/src/client/iocinf.h index 0d3b57db1..fee060370 100644 --- a/modules/ca/src/client/iocinf.h +++ b/modules/ca/src/client/iocinf.h @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * @@ -22,8 +21,8 @@ * 505 665 1831 */ -#ifndef INCiocinfh -#define INCiocinfh +#ifndef INC_iocinf_H +#define INC_iocinf_H #ifdef DEBUG # define debugPrintf(argsInParen) ::printf argsInParen @@ -67,4 +66,4 @@ static const unsigned contiguousMsgCountWhichTriggersFlowControl = 10u; #define genLocalExcep( CBGUARD, GUARD, CAC, STAT, PCTX ) \ (CAC).exception ( CBGUARD, GUARD, STAT, PCTX, __FILE__, __LINE__ ) -#endif // ifdef INCiocinfh +#endif // ifdef INC_iocinf_H diff --git a/modules/ca/src/client/localHostName.cpp b/modules/ca/src/client/localHostName.cpp index b0b96bb47..4810a279c 100644 --- a/modules/ca/src/client/localHostName.cpp +++ b/modules/ca/src/client/localHostName.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/ca/src/client/localHostName.h b/modules/ca/src/client/localHostName.h index f116b8140..95d1452f8 100644 --- a/modules/ca/src/client/localHostName.h +++ b/modules/ca/src/client/localHostName.h @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -19,22 +18,13 @@ * Author: Jeff Hill */ -#ifndef localHostNameh -#define localHostNameh +#ifndef INC_localHostName_H +#define INC_localHostName_H #include -#ifdef epicsExportSharedSymbols -# define localHostNameh_restore_epicsExportSharedSymbols -# undef epicsExportSharedSymbols -#endif - #include "epicsSingleton.h" -#ifdef localHostNameh_restore_epicsExportSharedSymbols -# define epicsExportSharedSymbols -#endif - class localHostName { public: localHostName (); @@ -60,6 +50,6 @@ inline const char * localHostName::pointer () const return this->cache; } -#endif // ifndef localHostNameh +#endif // ifndef INC_localHostName_H diff --git a/modules/ca/src/client/msgForMultiplyDefinedPV.cpp b/modules/ca/src/client/msgForMultiplyDefinedPV.cpp index 7002dd4b9..06c2ce354 100644 --- a/modules/ca/src/client/msgForMultiplyDefinedPV.cpp +++ b/modules/ca/src/client/msgForMultiplyDefinedPV.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -30,7 +29,6 @@ #include "errlog.h" -#define epicsExportSharedSymbols #include "iocinf.h" #include "msgForMultiplyDefinedPV.h" #include "cac.h" diff --git a/modules/ca/src/client/msgForMultiplyDefinedPV.h b/modules/ca/src/client/msgForMultiplyDefinedPV.h index 3f1e771c0..afcbc807e 100644 --- a/modules/ca/src/client/msgForMultiplyDefinedPV.h +++ b/modules/ca/src/client/msgForMultiplyDefinedPV.h @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -23,23 +22,14 @@ * 505 665 1831 */ -#ifndef msgForMultiplyDefinedPVh -#define msgForMultiplyDefinedPVh - -#ifdef epicsExportSharedSymbols -# define msgForMultiplyDefinedPVh_epicsExportSharedSymbols -# undef epicsExportSharedSymbols -#endif +#ifndef INC_msgForMultiplyDefinedPV_H +#define INC_msgForMultiplyDefinedPV_H #include "ipAddrToAsciiAsynchronous.h" #include "tsFreeList.h" #include "tsDLList.h" #include "compilerDependencies.h" -#ifdef msgForMultiplyDefinedPVh_epicsExportSharedSymbols -# define epicsExportSharedSymbols -#endif - class callbackForMultiplyDefinedPV { public: virtual ~callbackForMultiplyDefinedPV () = 0; @@ -75,5 +65,5 @@ inline void msgForMultiplyDefinedPV::ioInitiate ( const osiSockAddr & rej ) this->dnsTransaction.ipAddrToAscii ( rej, *this ); } -#endif // ifdef msgForMultiplyDefinedPVh +#endif // ifdef INC_msgForMultiplyDefinedPV_H diff --git a/modules/ca/src/client/nciu.cpp b/modules/ca/src/client/nciu.cpp index 8eb89c5c3..d3ea7097b 100644 --- a/modules/ca/src/client/nciu.cpp +++ b/modules/ca/src/client/nciu.cpp @@ -3,8 +3,7 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -29,7 +28,6 @@ #include "errlog.h" -#define epicsExportSharedSymbols #include "iocinf.h" #include "cac.h" #include "osiWireFormat.h" diff --git a/modules/ca/src/client/nciu.h b/modules/ca/src/client/nciu.h index 7cba6e82b..52b73302c 100644 --- a/modules/ca/src/client/nciu.h +++ b/modules/ca/src/client/nciu.h @@ -3,8 +3,7 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -22,13 +21,8 @@ * 505 665 1831 */ -#ifndef nciuh -#define nciuh - -#ifdef epicsExportSharedSymbols -# define nciuh_restore_epicsExportSharedSymbols -# undef epicsExportSharedSymbols -#endif +#ifndef INC_nciu_H +#define INC_nciu_H #include "resourceLib.h" #include "tsDLList.h" @@ -36,10 +30,7 @@ #include "epicsMutex.h" #include "compilerDependencies.h" -#ifdef nciuh_restore_epicsExportSharedSymbols -# define epicsExportSharedSymbols -# include "shareLib.h" -#endif +#include "libCaAPI.h" #define CA_MINOR_PROTOCOL_REVISION 13 #include "caProto.h" @@ -382,4 +373,4 @@ inline bool channelNode::isInstalledInServer ( epicsGuard < epicsMutex > & ) con this->listMember == cs_subscripUpdateReqPend; } -#endif // ifdef nciuh +#endif // ifdef INC_nciu_H diff --git a/modules/ca/src/client/netIO.h b/modules/ca/src/client/netIO.h index e728d2a1a..74d48adbb 100644 --- a/modules/ca/src/client/netIO.h +++ b/modules/ca/src/client/netIO.h @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * @@ -22,8 +21,8 @@ * 505 665 1831 */ -#ifndef netIOh -#define netIOh +#ifndef INC_netIO_H +#define INC_netIO_H #include "nciu.h" #include "compilerDependencies.h" @@ -303,4 +302,4 @@ inline void * netWriteNotifyIO::operator new ( size_t size, } #endif -#endif // ifdef netIOh +#endif // ifdef INC_netIO_H diff --git a/modules/ca/src/client/netReadNotifyIO.cpp b/modules/ca/src/client/netReadNotifyIO.cpp index 2e4b8ead6..41199c1dd 100644 --- a/modules/ca/src/client/netReadNotifyIO.cpp +++ b/modules/ca/src/client/netReadNotifyIO.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * diff --git a/modules/ca/src/client/netSubscription.cpp b/modules/ca/src/client/netSubscription.cpp index fe2426a89..78f0b71c8 100644 --- a/modules/ca/src/client/netSubscription.cpp +++ b/modules/ca/src/client/netSubscription.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * @@ -25,7 +24,6 @@ #define epicsAssertAuthor "Jeff Hill johill@lanl.gov" -#define epicsExportSharedSymbols #include "iocinf.h" #include "nciu.h" #include "cac.h" diff --git a/modules/ca/src/client/netWriteNotifyIO.cpp b/modules/ca/src/client/netWriteNotifyIO.cpp index afa9996d5..045217e66 100644 --- a/modules/ca/src/client/netWriteNotifyIO.cpp +++ b/modules/ca/src/client/netWriteNotifyIO.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * diff --git a/modules/ca/src/client/net_convert.h b/modules/ca/src/client/net_convert.h index bee51c0c4..1c3aac5df 100644 --- a/modules/ca/src/client/net_convert.h +++ b/modules/ca/src/client/net_convert.h @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * @@ -13,11 +12,11 @@ * */ -#ifndef _NET_CONVERT_H -#define _NET_CONVERT_H +#ifndef INC_net_convert_H +#define INC_net_convert_H #include "db_access.h" -#include "shareLib.h" +#include "libCaAPI.h" #ifdef __cplusplus extern "C" { @@ -25,7 +24,7 @@ extern "C" { typedef unsigned long arrayElementCount; -epicsShareFunc int caNetConvert ( +LIBCA_API int caNetConvert ( unsigned type, const void *pSrc, void *pDest, int hton, arrayElementCount count ); @@ -33,4 +32,4 @@ epicsShareFunc int caNetConvert ( } #endif -#endif /* define _NET_CONVERT_H */ +#endif /* ifndef INC_net_convert_H */ diff --git a/modules/ca/src/client/netiiu.cpp b/modules/ca/src/client/netiiu.cpp index a81b15533..cfd4b8091 100644 --- a/modules/ca/src/client/netiiu.cpp +++ b/modules/ca/src/client/netiiu.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/ca/src/client/netiiu.h b/modules/ca/src/client/netiiu.h index 2caa3d0fa..7c2ca2cae 100644 --- a/modules/ca/src/client/netiiu.h +++ b/modules/ca/src/client/netiiu.h @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * @@ -22,8 +21,8 @@ * 505 665 1831 */ -#ifndef netiiuh -#define netiiuh +#ifndef INC_netiiu_H +#define INC_netiiu_H #include "cacIO.h" #include "caProto.h" @@ -94,4 +93,4 @@ public: const char * pName, unsigned nameLength ) = 0; }; -#endif // netiiuh +#endif // ifndef INC_netiiu_H diff --git a/modules/ca/src/client/noopiiu.cpp b/modules/ca/src/client/noopiiu.cpp index a3d20b59b..84edb3828 100644 --- a/modules/ca/src/client/noopiiu.cpp +++ b/modules/ca/src/client/noopiiu.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * @@ -24,7 +23,6 @@ #include "osiSock.h" -#define epicsExportSharedSymbols #include "noopiiu.h" noopiiu noopIIU; diff --git a/modules/ca/src/client/noopiiu.h b/modules/ca/src/client/noopiiu.h index f373edec8..f6ed87fcb 100644 --- a/modules/ca/src/client/noopiiu.h +++ b/modules/ca/src/client/noopiiu.h @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * @@ -22,8 +21,8 @@ * 505 665 1831 */ -#ifndef noopiiuh -#define noopiiuh +#ifndef INC_noopiiu_H +#define INC_noopiiu_H #include "netiiu.h" @@ -89,4 +88,4 @@ public: extern noopiiu noopIIU; -#endif // ifndef noopiiuh +#endif // ifndef INC_noopiiu_H diff --git a/modules/ca/src/client/oldAccess.h b/modules/ca/src/client/oldAccess.h index 1337cb31a..273b550c5 100644 --- a/modules/ca/src/client/oldAccess.h +++ b/modules/ca/src/client/oldAccess.h @@ -3,8 +3,7 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ @@ -23,25 +22,16 @@ * 505 665 1831 */ -#ifndef oldAccessh -#define oldAccessh +#ifndef INC_oldAccess_H +#define INC_oldAccess_H #include -#ifdef epicsExportSharedSymbols -# define oldAccessh_restore_epicsExportSharedSymbols -# undef epicsExportSharedSymbols -#endif - #include "tsFreeList.h" #include "compilerDependencies.h" #include "osiSock.h" -#ifdef oldAccessh_restore_epicsExportSharedSymbols -# define epicsExportSharedSymbols -# include "shareLib.h" -#endif - +#include "libCaAPI.h" #include "caProto.h" #include "cacIO.h" #include "cadef.h" @@ -607,4 +597,4 @@ void ca_client_context :: whenThereIsAnExceptionDestroySyncGroupIO ( } } -#endif // ifndef oldAccessh +#endif // ifndef INC_oldAccess_H diff --git a/modules/ca/src/client/oldChannelNotify.cpp b/modules/ca/src/client/oldChannelNotify.cpp index 701f51fc1..1af7a7453 100644 --- a/modules/ca/src/client/oldChannelNotify.cpp +++ b/modules/ca/src/client/oldChannelNotify.cpp @@ -3,8 +3,7 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -33,7 +32,6 @@ #include "errlog.h" -#define epicsExportSharedSymbols #include "iocinf.h" #include "oldAccess.h" #include "cac.h" diff --git a/modules/ca/src/client/oldSubscription.cpp b/modules/ca/src/client/oldSubscription.cpp index 34b58a48d..39e6bb002 100644 --- a/modules/ca/src/client/oldSubscription.cpp +++ b/modules/ca/src/client/oldSubscription.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -23,7 +22,6 @@ #include "errlog.h" -#define epicsExportSharedSymbols #include "iocinf.h" #include "oldAccess.h" diff --git a/modules/ca/src/client/putCallback.cpp b/modules/ca/src/client/putCallback.cpp index 85fcaeb7f..50f4542aa 100644 --- a/modules/ca/src/client/putCallback.cpp +++ b/modules/ca/src/client/putCallback.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -28,7 +27,6 @@ #include "errlog.h" -#define epicsExportSharedSymbols #include "iocinf.h" #include "oldAccess.h" diff --git a/modules/ca/src/client/repeater.cpp b/modules/ca/src/client/repeater.cpp index 67429e659..418174198 100644 --- a/modules/ca/src/client/repeater.cpp +++ b/modules/ca/src/client/repeater.cpp @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * @@ -69,7 +69,6 @@ #include "taskwd.h" #include "errlog.h" -#define epicsExportSharedSymbols #include "iocinf.h" #include "caProto.h" #include "udpiiu.h" diff --git a/modules/ca/src/client/repeaterClient.h b/modules/ca/src/client/repeaterClient.h index faaf0809f..7a028810f 100644 --- a/modules/ca/src/client/repeaterClient.h +++ b/modules/ca/src/client/repeaterClient.h @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -23,22 +22,14 @@ * 505 665 1831 */ -#ifndef repeaterClienth -#define repeaterClienth - -#ifdef epicsExportSharedSymbols -# define repeaterClienth_restore_epicsExportSharedSymbols -# undef epicsExportSharedSymbols -#endif +#ifndef INC_repeaterClient_H +#define INC_repeaterClient_H #include "tsDLList.h" #include "tsFreeList.h" #include "compilerDependencies.h" -#ifdef repeaterClienth_restore_epicsExportSharedSymbols -# define epicsExportSharedSymbols -# include "shareLib.h" -#endif +#include "libCaAPI.h" union osiSockAddr; @@ -67,6 +58,4 @@ private: void operator delete ( void * ); }; -#endif // repeaterClienth - - +#endif // ifndef INC_repeaterClient_H diff --git a/modules/ca/src/client/repeaterSubscribeTimer.cpp b/modules/ca/src/client/repeaterSubscribeTimer.cpp index 71ba5ad06..5e3d856bd 100644 --- a/modules/ca/src/client/repeaterSubscribeTimer.cpp +++ b/modules/ca/src/client/repeaterSubscribeTimer.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * @@ -25,9 +24,7 @@ #include "iocinf.h" #include "repeaterSubscribeTimer.h" -#define epicsExportSharedSymbols #include "udpiiu.h" -#undef epicsExportSharedSymbols static const double repeaterSubscribeTimerInitialPeriod = 10.0; // sec static const double repeaterSubscribeTimerPeriod = 1.0; // sec diff --git a/modules/ca/src/client/repeaterSubscribeTimer.h b/modules/ca/src/client/repeaterSubscribeTimer.h index fa4768499..cc5431b71 100644 --- a/modules/ca/src/client/repeaterSubscribeTimer.h +++ b/modules/ca/src/client/repeaterSubscribeTimer.h @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -23,22 +22,12 @@ * 505 665 1831 */ -#ifndef repeaterSubscribeTimerh -#define repeaterSubscribeTimerh +#ifndef INC_repeaterSubscribeTimer_H +#define INC_repeaterSubscribeTimer_H #include "epicsTimer.h" -#ifdef epicsExportSharedSymbols -# define repeaterSubscribeTimerh_epicsExportSharedSymbols -# undef epicsExportSharedSymbols -#endif - -#include "epicsTimer.h" - -#ifdef repeaterSubscribeTimerh_epicsExportSharedSymbols -# define epicsExportSharedSymbols -# include "shareLib.h" -#endif +#include "libCaAPI.h" class epicsMutex; class cacContextNotify; @@ -79,4 +68,4 @@ private: repeaterSubscribeTimer & operator = ( const repeaterSubscribeTimer & ); }; -#endif // ifdef repeaterSubscribeTimerh +#endif // ifdef INC_repeaterSubscribeTimer_H diff --git a/modules/ca/src/client/searchTimer.cpp b/modules/ca/src/client/searchTimer.cpp index bb9b9a91c..a98537795 100644 --- a/modules/ca/src/client/searchTimer.cpp +++ b/modules/ca/src/client/searchTimer.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ // // @@ -26,7 +25,6 @@ #include "envDefs.h" -#define epicsExportSharedSymbols #include "iocinf.h" #include "udpiiu.h" #include "nciu.h" diff --git a/modules/ca/src/client/searchTimer.h b/modules/ca/src/client/searchTimer.h index 7b9fe1717..0baa3caed 100644 --- a/modules/ca/src/client/searchTimer.h +++ b/modules/ca/src/client/searchTimer.h @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ // @@ -23,23 +22,14 @@ // 505 665 1831 // -#ifndef searchTimerh -#define searchTimerh - -#ifdef epicsExportSharedSymbols -# define searchTimerh_epicsExportSharedSymbols -# undef epicsExportSharedSymbols -#endif +#ifndef INC_searchTimer_H +#define INC_searchTimer_H #include "epicsMutex.h" #include "epicsGuard.h" #include "epicsTimer.h" -#ifdef searchTimerh_epicsExportSharedSymbols -# define epicsExportSharedSymbols -# include "shareLib.h" -#endif - +#include "libCaAPI.h" #include "caProto.h" #include "netiiu.h" @@ -105,4 +95,4 @@ private: searchTimer & operator = ( const searchTimer & ); // not implemented }; -#endif // ifdef searchTimerh +#endif // ifdef INC_searchTimer_H diff --git a/modules/ca/src/client/sgAutoPtr.h b/modules/ca/src/client/sgAutoPtr.h index e2899468c..f42877e25 100644 --- a/modules/ca/src/client/sgAutoPtr.h +++ b/modules/ca/src/client/sgAutoPtr.h @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -23,8 +22,8 @@ * 505 665 1831 */ -#ifndef sgAutoPtrh -#define sgAutoPtrh +#ifndef INC_sgAutoPtr_H +#define INC_sgAutoPtr_H template < class T > class sgAutoPtr { @@ -100,4 +99,4 @@ inline T * sgAutoPtr < T > :: get () return this->pNotify; } -#endif // sgAutoPtrh +#endif // ifndef INC_sgAutoPtr_H diff --git a/modules/ca/src/client/syncGroup.h b/modules/ca/src/client/syncGroup.h index 3b9c3cd4f..3b4247537 100644 --- a/modules/ca/src/client/syncGroup.h +++ b/modules/ca/src/client/syncGroup.h @@ -3,8 +3,7 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -22,13 +21,8 @@ * 505 665 1831 */ -#ifndef syncGrouph -#define syncGrouph - -#ifdef epicsExportSharedSymbols -# define syncGrouph_restore_epicsExportSharedSymbols -# undef epicsExportSharedSymbols -#endif +#ifndef INC_syncGroup_H +#define INC_syncGroup_H #include "tsDLList.h" #include "tsFreeList.h" @@ -36,11 +30,7 @@ #include "epicsEvent.h" #include "compilerDependencies.h" -#ifdef syncGrouph_restore_epicsExportSharedSymbols -# define epicsExportSharedSymbols -# include "shareLib.h" -#endif - +#include "libCaAPI.h" #include "cadef.h" #include "cacIO.h" @@ -277,4 +267,4 @@ inline bool syncGroupReadNotify::ioPending ( return ! this->ioComplete; } -#endif // ifdef syncGrouph +#endif // ifdef INC_syncGroup_H diff --git a/modules/ca/src/client/syncGroupNotify.cpp b/modules/ca/src/client/syncGroupNotify.cpp index 2780fbe89..800641feb 100644 --- a/modules/ca/src/client/syncGroupNotify.cpp +++ b/modules/ca/src/client/syncGroupNotify.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -16,7 +15,6 @@ #define epicsAssertAuthor "Jeff Hill johill@lanl.gov" -#define epicsExportSharedSymbols #include "iocinf.h" #include "syncGroup.h" #include "oldAccess.h" diff --git a/modules/ca/src/client/syncGroupReadNotify.cpp b/modules/ca/src/client/syncGroupReadNotify.cpp index 711a2fae4..e7390fade 100644 --- a/modules/ca/src/client/syncGroupReadNotify.cpp +++ b/modules/ca/src/client/syncGroupReadNotify.cpp @@ -3,8 +3,7 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ @@ -21,7 +20,6 @@ #include "errlog.h" -#define epicsExportSharedSymbols #include "iocinf.h" #include "syncGroup.h" #include "oldAccess.h" diff --git a/modules/ca/src/client/syncGroupWriteNotify.cpp b/modules/ca/src/client/syncGroupWriteNotify.cpp index f0bf42753..5d4d49055 100644 --- a/modules/ca/src/client/syncGroupWriteNotify.cpp +++ b/modules/ca/src/client/syncGroupWriteNotify.cpp @@ -3,8 +3,7 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ @@ -21,7 +20,6 @@ #include "errlog.h" -#define epicsExportSharedSymbols #include "iocinf.h" #include "syncGroup.h" #include "oldAccess.h" diff --git a/modules/ca/src/client/syncgrp.cpp b/modules/ca/src/client/syncgrp.cpp index 9727ae8df..1ba8057d0 100644 --- a/modules/ca/src/client/syncgrp.cpp +++ b/modules/ca/src/client/syncgrp.cpp @@ -3,8 +3,7 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -15,7 +14,6 @@ #define epicsAssertAuthor "Jeff Hill johill@lanl.gov" -#define epicsExportSharedSymbols #include "iocinf.h" #include "oldAccess.h" #include "syncGroup.h" diff --git a/modules/ca/src/client/tcpRecvThread.cpp b/modules/ca/src/client/tcpRecvThread.cpp deleted file mode 100644 index 34bf8ca83..000000000 --- a/modules/ca/src/client/tcpRecvThread.cpp +++ /dev/null @@ -1,11 +0,0 @@ -/*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne -* National Laboratory. -* Copyright (c) 2002 The Regents of the University of California, as -* Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. -\*************************************************************************/ - - diff --git a/modules/ca/src/client/tcpRecvWatchdog.cpp b/modules/ca/src/client/tcpRecvWatchdog.cpp index 72c92968b..4596c33dc 100644 --- a/modules/ca/src/client/tcpRecvWatchdog.cpp +++ b/modules/ca/src/client/tcpRecvWatchdog.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * diff --git a/modules/ca/src/client/tcpRecvWatchdog.h b/modules/ca/src/client/tcpRecvWatchdog.h index 0b15e22d8..ca214c222 100644 --- a/modules/ca/src/client/tcpRecvWatchdog.h +++ b/modules/ca/src/client/tcpRecvWatchdog.h @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -23,20 +22,12 @@ * 505 665 1831 */ -#ifndef tcpRecvWatchdogh -#define tcpRecvWatchdogh - -#ifdef epicsExportSharedSymbols -# define tcpRecvWatchdogh_epicsExportSharedSymbols -# undef epicsExportSharedSymbols -#endif +#ifndef INC_tcpRecvWatchdog_H +#define INC_tcpRecvWatchdog_H #include "epicsTimer.h" -#ifdef tcpRecvWatchdogh_epicsExportSharedSymbols -# define epicsExportSharedSymbols -# include "shareLib.h" -#endif +#include "libCaAPI.h" class tcpiiu; @@ -81,5 +72,5 @@ private: tcpRecvWatchdog & operator = ( const tcpRecvWatchdog & ); }; -#endif // #ifndef tcpRecvWatchdogh +#endif // #ifndef INC_tcpRecvWatchdog_H diff --git a/modules/ca/src/client/tcpSendWatchdog.cpp b/modules/ca/src/client/tcpSendWatchdog.cpp index 6834b39e7..140fdba39 100644 --- a/modules/ca/src/client/tcpSendWatchdog.cpp +++ b/modules/ca/src/client/tcpSendWatchdog.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/ca/src/client/tcpSendWatchdog.h b/modules/ca/src/client/tcpSendWatchdog.h index 05a2dfe75..3d9bc05fa 100644 --- a/modules/ca/src/client/tcpSendWatchdog.h +++ b/modules/ca/src/client/tcpSendWatchdog.h @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -23,21 +22,12 @@ * 505 665 1831 */ -#ifndef tcpSendWatchdogh -#define tcpSendWatchdogh - - -#ifdef epicsExportSharedSymbols -# define tcpSendWatchdogh_epicsExportSharedSymbols -# undef epicsExportSharedSymbols -#endif +#ifndef INC_tcpSendWatchdog_H +#define INC_tcpSendWatchdog_H #include "epicsTimer.h" -#ifdef tcpSendWatchdogh_epicsExportSharedSymbols -# define epicsExportSharedSymbols -# include "shareLib.h" -#endif +#include "libCaAPI.h" class tcpSendWatchdog : private epicsTimerNotify { public: @@ -60,4 +50,4 @@ private: tcpSendWatchdog & operator = ( const tcpSendWatchdog & ); }; -#endif // #ifndef tcpSendWatchdog +#endif // #ifndef INC_tcpSendWatchdog_H diff --git a/modules/ca/src/client/tcpiiu.cpp b/modules/ca/src/client/tcpiiu.cpp index 9d174ab84..0b6f99d6e 100644 --- a/modules/ca/src/client/tcpiiu.cpp +++ b/modules/ca/src/client/tcpiiu.cpp @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -31,7 +31,6 @@ #include "errlog.h" -#define epicsExportSharedSymbols #include "localHostName.h" #include "iocinf.h" #include "virtualCircuit.h" diff --git a/modules/ca/src/client/test_event.cpp b/modules/ca/src/client/test_event.cpp index 8b5a8bb54..78179f31e 100644 --- a/modules/ca/src/client/test_event.cpp +++ b/modules/ca/src/client/test_event.cpp @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * @@ -16,7 +15,6 @@ #include "epicsStdioRedirect.h" -#define epicsExportSharedSymbols #include "cadef.h" extern "C" void epicsShareAPI ca_test_event ( struct event_handler_args args ) diff --git a/modules/ca/src/client/ucx.h b/modules/ca/src/client/ucx.h deleted file mode 100644 index c164161a5..000000000 --- a/modules/ca/src/client/ucx.h +++ /dev/null @@ -1,102 +0,0 @@ -/*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne -* National Laboratory. -* Copyright (c) 2002 The Regents of the University of California, as -* Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. -\*************************************************************************/ -/* - * - * U C X . H - * UNIX ioctl structures and defines used for VAX/UCX - * - */ -#ifndef _UCX_H_ -# define _UCX_H_ -#ifdef UCX - -#define IFF_UP 0x1 /* interface is up */ -#define IFF_BROADCAST 0x2 /* broadcast address valid */ -#define IFF_LOOPBACK 0x8 /* is a loopback net */ -#define IFF_POINTOPOINT 0x10 /* interface is point to point */ -/* - * Interface request structure used for socket - * ioctl's. All interface ioctl's must have parameter - * definitions which begin with ifr_name. The - * remainder may be interface specific. - */ -struct ifreq { -#define IFNAMSIZ 16 - char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ - union { - struct sockaddr ifru_addr; - struct sockaddr ifru_dstaddr; - struct sockaddr ifru_broadaddr; - short ifru_flags; - int ifru_metric; - caddr_t ifru_data; - } ifr_ifru; -#define ifr_addr ifr_ifru.ifru_addr /* address */ -#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ -#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ -#define ifr_flags ifr_ifru.ifru_flags /* flags */ -#define ifr_metric ifr_ifru.ifru_metric /* metric */ -#define ifr_data ifr_ifru.ifru_data /* for use by interface */ -}; - -/* Structure used in SIOCGIFCONF request. - * Used to retrieve interface configuration - * for machine (useful for programs which - * must know all networks accessible). - */ -struct ifconf { - int ifc_len; /* size of associated buffer */ - union { - caddr_t ifcu_buf; - struct ifreq *ifcu_req; - } ifc_ifcu; -#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ -#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ -}; - -#ifndef NBBY -# define NBBY 8 -#endif - - -#ifndef FD_SETSIZE -# define FD_SETSIZE 256 -#endif - -typedef long fd_mask ; -#define NFDBITS (sizeof (fd_mask) * NBBY ) /* bits per mask */ -#ifndef howmany -# define howmany(x, y) (((x)+((y)-1))/(y)) -#endif - -/* - * Both DEC C and VAX C only allow 32 fd's at once - */ -typedef int fd_set ; - -#define FD_SET(n, p) (*(p) |= (1 << ((n) % NFDBITS))) -#define FD_CLR(n, p) (*(p) &= ~(1 << ((n) % NFDBITS))) -#define FD_ISSET(n, p) (*(p) & (1 << ((n) % NFDBITS))) -#define FD_ZERO(p) memset((char *)(p), 0, sizeof (*(p))) - -#include -#define IO$_RECEIVE (IO$_WRITEVBLK) - -struct timezone { - int tz_minuteswest ; /* minutes west of Greenwich */ - int tz_dsttime ; /* type of dst correction */ -}; - -#define TWOPOWER32 4294967296.0 -#define TWOPOWER31 2147483648.0 -#define UNIX_EPOCH_AS_MJD 40587.0 -#endif -#endif - diff --git a/modules/ca/src/client/udpiiu.cpp b/modules/ca/src/client/udpiiu.cpp index 4efa8ba32..de94f1f63 100644 --- a/modules/ca/src/client/udpiiu.cpp +++ b/modules/ca/src/client/udpiiu.cpp @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -32,7 +32,6 @@ #include "errlog.h" #include "locationException.h" -#define epicsExportSharedSymbols #include "addrList.h" #include "caerr.h" // for ECA_NOSEARCHADDR #include "udpiiu.h" diff --git a/modules/ca/src/client/udpiiu.h b/modules/ca/src/client/udpiiu.h index fdf348296..00e415622 100644 --- a/modules/ca/src/client/udpiiu.h +++ b/modules/ca/src/client/udpiiu.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -22,26 +22,17 @@ * 505 665 1831 */ -#ifndef udpiiuh -#define udpiiuh +#ifndef INC_udpiiu_H +#define INC_udpiiu_H #include -#ifdef epicsExportSharedSymbols -# define udpiiuh_accessh_epicsExportSharedSymbols -# undef epicsExportSharedSymbols -#endif - #include "osiSock.h" #include "epicsThread.h" #include "epicsTime.h" #include "tsDLList.h" -#ifdef udpiiuh_accessh_epicsExportSharedSymbols -# define epicsExportSharedSymbols -# include "shareLib.h" -#endif - +#include "libCaAPI.h" #include "netiiu.h" #include "searchTimer.h" #include "disconnectGovernorTimer.h" @@ -50,13 +41,13 @@ extern "C" void cacRecvThreadUDP ( void *pParam ); -epicsShareFunc void epicsShareAPI caStartRepeaterIfNotInstalled ( +LIBCA_API void epicsShareAPI caStartRepeaterIfNotInstalled ( unsigned repeaterPort ); -epicsShareFunc void epicsShareAPI caRepeaterRegistrationMessage ( +LIBCA_API void epicsShareAPI caRepeaterRegistrationMessage ( SOCKET sock, unsigned repeaterPort, unsigned attemptNumber ); -extern "C" epicsShareFunc void caRepeaterThread ( +extern "C" LIBCA_API void caRepeaterThread ( void * pDummy ); -epicsShareFunc void ca_repeater ( void ); +LIBCA_API void ca_repeater ( void ); class cac; class cacContextNotify; @@ -314,5 +305,4 @@ private: friend class udpiiu::M_repeaterTimerNotify; }; -#endif // udpiiuh - +#endif // ifndef INC_udpiiu_H diff --git a/modules/ca/src/client/virtualCircuit.h b/modules/ca/src/client/virtualCircuit.h index d06d87c60..dd68cac93 100644 --- a/modules/ca/src/client/virtualCircuit.h +++ b/modules/ca/src/client/virtualCircuit.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -22,8 +22,8 @@ * 505 665 1831 */ -#ifndef virtualCircuith -#define virtualCircuith +#ifndef INC_virtualCircuit_H +#define INC_virtualCircuit_H #include "tsDLList.h" @@ -418,4 +418,4 @@ inline void SearchDestTCP::setCircuit ( tcpiiu * piiu ) _ptcpiiu = piiu; } -#endif // ifdef virtualCircuith +#endif // ifdef INC_virtualCircuit_H From eb817ba056f212ab8490636a5dbb70603e17b906 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 10 Mar 2020 23:35:03 -0500 Subject: [PATCH 096/216] Modify rules to allow multiple API.h libraries to be built --- configure/RULES_BUILD | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/configure/RULES_BUILD b/configure/RULES_BUILD index 99bbb0726..3664efd38 100644 --- a/configure/RULES_BUILD +++ b/configure/RULES_BUILD @@ -409,20 +409,21 @@ endif $(PERL) $(TOOLS)/makeTestfile.pl $(T_A) $(EPICS_HOST_ARCH) $@ $< #--------------------------------------------------------------- -# Generate an $(API_HEADER) file on request (%API.h) +# Generate $(API_HEADER) files on request (%API.h) ifdef API_HEADER -# Install it +# Install them INC += $(API_HEADER) -# Ensure we generate it early enough -$(filter-out $(INSTALL_INCLUDE)/$(API_HEADER), $(INSTALL_INC)) $(HDEPENDS_FILES): \ - | $(INSTALL_INCLUDE)/$(API_HEADER) +# Ensure we generate them early enough +INSTALL_API_HEADERS = $(addprefix $(INSTALL_INCLUDE)/,$(API_HEADER)) +$(filter-out $(INSTALL_API_HEADERS), $(INSTALL_INC)) $(HDEPENDS_FILES): \ + | $(INSTALL_API_HEADERS) -# How to make it -$(COMMON_DIR)/$(API_HEADER): +# How to make one +$(COMMON_DIR)/%API.h: $(TOOLS)/makeAPIheader.pl @$(RM) $@ - $(PERL) $(TOOLS)/makeAPIheader.pl -o $@ $(API_HEADER:API.h=) + $(PERL) $(TOOLS)/makeAPIheader.pl -o $@ $(@:$(COMMON_DIR)/%API.h=%) endif # Generate header with version number from VCS From 017d561b8d95bc207885bf2b86e51b5497c4a3b7 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 10 Mar 2020 23:41:15 -0500 Subject: [PATCH 097/216] Update generator script Rename xxxSTD_API to epicsStdCall, don't redefine. Ensure name stem is a legal C identifier. Update the Pod text --- src/tools/makeAPIheader.pl | 87 +++++++++++++++++++++++++------------- 1 file changed, 57 insertions(+), 30 deletions(-) diff --git a/src/tools/makeAPIheader.pl b/src/tools/makeAPIheader.pl index 79965a615..cb7fde97d 100644 --- a/src/tools/makeAPIheader.pl +++ b/src/tools/makeAPIheader.pl @@ -10,17 +10,18 @@ use Pod::Usage; =head1 NAME -makeAPIheader.pl - Create a header for marking API import/export +makeAPIheader.pl - Create a header for marking API symbols import/export =head1 SYNOPSIS -B [B<-h>] [B<-o> fileAPI.h] stem +B [B<-h>] [B<-o> path/fileB] stem =head1 DESCRIPTION Creates a C/C++ header file containing macro definitions for C and -C which on Windows will expand to the appropriate C<__declspec> -and C<__stdcall> keywords and under GCC to a C attribute. +C which on Windows will expand to the appropriate C<__declspec> +and C<__stdcall> keywords respectively, and on GCC to a C +attribute and nothing. =head1 OPTIONS @@ -32,58 +33,81 @@ B understands the following options: Help, display this document as text. -=item B<-o> fileAPI.h +=item B<-o> path/fileB -Name of the output file to be created. Must end C. +Pathname to the output file to be created. Must end with C. =back -If no output filename is set, the filename will be generated by appending -C to the B argument. +If no output filename is set, the name will be generated by appending +C to the I argument. -=head1 USAGE FOR EPICS +The I used must be a legal C identifier, starting with a letter or +underscore followed by any combination of digits, letters and underscores. -In the Makefile that is building a DLL or shared library, set the variable -C to the name of the name of the header file to be generated, -which must end with C. The part before that is referred to as the -I for this library. For example the stem here is C: +=head1 PURPOSE + +The generated header and the macros in it replace the C macros +that were defined in the C header, avoiding the need for shared +library implementation code to define the C macro in +between the import and export headers. The order of including header files no +longer matters when using this approach. + +=head1 USING WITH EPICS + +In a Makefile that is building a DLL or shared library, set the variable +C to the name of the API header file to be generated. This name +must start with a legal C identifier and end with C. The C identifier +part preceeding the C is referred to here as the I for this +header file, and should be a short name in lower case or camelCase. For +example the stem used in the example here is C: # Generate our library API header file - API_HEADER = libComAPI.h + API_HEADER += libComAPI.h Lower down in the RULES section of the same Makefile (below the line that -includes the C<$(TOP)/configure/RULES> file), add a line like this: +says C), add another line like this: # Set the API Building flag while we are building the code - $(LIBNAME) $(SHRLIBNAME): USR_CPPFLAGS += -DLIBCOM_API_BUILDING + $(LIBNAME) $(SHRLIBNAME): USR_CPPFLAGS += -DBUILDING_libCom_API -Replace the string C above with the upper-case version of the stem -that you used in your header filename. +For your library replace the string C in the last word above with +the stem from your header filename. -Then in each header and source file that declares or defines a routine to be -exported by the library, decorate the routine declaration or definition with -the keyword C like this: +Then in each header file that declares a function, global variable or C++ +class or method to be exported by the library, decorate those declarations +with the all-uppercase keyword C as in these examples: LIBCOM_API void epicsExit(int status); + LIBCOM_API int asCheckClientIP; + class LIBCOM_API epicsTime { ... } + LIBCOM_API virtual ~fdManager (); -The header also defines a second macro C which is for Windows -builds to indicate that the calling convention for this routine must be -C<__stdcall>. If needed, this macro should be placed between the return type -and the routine name, like this: +The generated header file also defines a second macro C which on +Windows expands to C<__stdcall> to indicate the calling convention for this +routine. When used, this macro should be placed between the return type and +the routine name, like this: - LIBCOM_API int LIBCOMSTD_API iocshCmd(const char *cmd); + LIBCOM_API int epicsStdCall iocshCmd(const char *cmd); + +It is possible to build more than one shared library in the same Makefile, +although each C or C++ source file can only be included in one library. Just +repeat the above instructions, using different stems for each library. =cut our ($opt_o, $opt_h); sub HELP_MESSAGE { - pod2usage(-exitval => 2, -verbose => $opt_h); + pod2usage(-exitval => 2, -verbose => $opt_h ? 2 : 0); } HELP_MESSAGE() if !getopts('ho:') || $opt_h || @ARGV != 1; my $stem = shift @ARGV; +die "makeAPIheader.pl: API stem '$stem' is not a legal C identifier\n" + unless $stem =~ m/^ [A-Za-z_][0-9A-Za-z_]* $/x; + my $outfile = defined($opt_o) ? $opt_o : "${stem}API.h"; die "makeAPIheader.pl: Output filename must end with 'API.h'\n" @@ -102,7 +126,10 @@ print $o <<"__EOF__"; #define $guard #if defined(_WIN32) || defined(__CYGWIN__) -# define ${STEM}STD_API __stdcall + +# if !defined(epicsStdCall) +# define epicsStdCall __stdcall +# endif # if defined(BUILDING_${stem}_API) && defined(EPICS_BUILD_DLL) /* Building library as dll */ @@ -120,8 +147,8 @@ print $o <<"__EOF__"; # define ${STEM}_API #endif -#if !defined(${STEM}STD_API) -# define ${STEM}STD_API +#if !defined(epicsStdCall) +# define epicsStdCall #endif #endif /* $guard */ From 33c3b1c89ad5155ec1073825f76b24f528afbb6c Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 10 Mar 2020 23:42:42 -0500 Subject: [PATCH 098/216] Convert epicsShareAPI to epicsStdCall in modules/ca --- modules/ca/src/client/access.cpp | 72 +++++------ modules/ca/src/client/addrList.h | 8 +- modules/ca/src/client/ca_client_context.cpp | 4 +- modules/ca/src/client/cacIO.h | 2 +- modules/ca/src/client/cadef.h | 134 ++++++++++---------- modules/ca/src/client/caerr.h | 2 +- modules/ca/src/client/iocinf.cpp | 8 +- modules/ca/src/client/oldAccess.h | 74 +++++------ modules/ca/src/client/oldChannelNotify.cpp | 42 +++--- modules/ca/src/client/syncgrp.cpp | 16 +-- modules/ca/src/client/test_event.cpp | 4 +- modules/ca/src/client/udpiiu.cpp | 4 +- modules/ca/src/client/udpiiu.h | 4 +- 13 files changed, 187 insertions(+), 187 deletions(-) diff --git a/modules/ca/src/client/access.cpp b/modules/ca/src/client/access.cpp index 42e25686d..a290805f7 100644 --- a/modules/ca/src/client/access.cpp +++ b/modules/ca/src/client/access.cpp @@ -163,13 +163,13 @@ int fetchClientContext ( ca_client_context **ppcac ) * ca_task_initialize () */ // extern "C" -int epicsShareAPI ca_task_initialize ( void ) +int epicsStdCall ca_task_initialize ( void ) { return ca_context_create ( ca_disable_preemptive_callback ); } // extern "C" -int epicsShareAPI ca_context_create ( +int epicsStdCall ca_context_create ( ca_preemptive_callback_select premptiveCallbackSelect ) { ca_client_context *pcac; @@ -209,7 +209,7 @@ int epicsShareAPI ca_context_create ( // defunct // // extern "C" -int epicsShareAPI ca_modify_host_name ( const char * ) +int epicsStdCall ca_modify_host_name ( const char * ) { return ECA_NORMAL; } @@ -220,7 +220,7 @@ int epicsShareAPI ca_modify_host_name ( const char * ) // defunct // // extern "C" -int epicsShareAPI ca_modify_user_name ( const char * ) +int epicsStdCall ca_modify_user_name ( const char * ) { return ECA_NORMAL; } @@ -229,7 +229,7 @@ int epicsShareAPI ca_modify_user_name ( const char * ) // ca_context_destroy () // // extern "C" -void epicsShareAPI ca_context_destroy () +void epicsStdCall ca_context_destroy () { ca_client_context *pcac; @@ -248,7 +248,7 @@ void epicsShareAPI ca_context_destroy () * releases all resources alloc to a channel access client */ // extern "C" -int epicsShareAPI ca_task_exit () +int epicsStdCall ca_task_exit () { ca_context_destroy (); return ECA_NORMAL; @@ -261,7 +261,7 @@ int epicsShareAPI ca_task_exit () * backwards compatible entry point to ca_search_and_connect() */ // extern "C" -int epicsShareAPI ca_build_and_connect ( const char *name_str, chtype get_type, +int epicsStdCall ca_build_and_connect ( const char *name_str, chtype get_type, arrayElementCount get_count, chid * chan, void *pvalue, caCh *conn_func, void *puser ) { @@ -276,7 +276,7 @@ int epicsShareAPI ca_build_and_connect ( const char *name_str, chtype get_type, * ca_search_and_connect() */ // extern "C" -int epicsShareAPI ca_search_and_connect ( +int epicsStdCall ca_search_and_connect ( const char * name_str, chid * chanptr, caCh * conn_func, void * puser ) { @@ -285,7 +285,7 @@ int epicsShareAPI ca_search_and_connect ( } // extern "C" -int epicsShareAPI ca_create_channel ( +int epicsStdCall ca_create_channel ( const char * name_str, caCh * conn_func, void * puser, capri priority, chid * chanptr ) { @@ -360,7 +360,7 @@ int epicsShareAPI ca_create_channel ( * its context */ // extern "C" -int epicsShareAPI ca_clear_channel ( chid pChan ) +int epicsStdCall ca_clear_channel ( chid pChan ) { ca_client_context & cac = pChan->getClientCtx (); { @@ -399,7 +399,7 @@ int epicsShareAPI ca_clear_channel ( chid pChan ) * Specify an event subroutine to be run for asynch exceptions */ // extern "C" -int epicsShareAPI ca_add_exception_event ( caExceptionHandler *pfunc, void *arg ) +int epicsStdCall ca_add_exception_event ( caExceptionHandler *pfunc, void *arg ) { ca_client_context *pcac; int caStatus = fetchClientContext ( &pcac ); @@ -415,7 +415,7 @@ int epicsShareAPI ca_add_exception_event ( caExceptionHandler *pfunc, void *arg /* * ca_add_masked_array_event */ -int epicsShareAPI ca_add_masked_array_event ( +int epicsStdCall ca_add_masked_array_event ( chtype type, arrayElementCount count, chid pChan, caEventCallBackFunc *pCallBack, void *pCallBackArg, ca_real, ca_real, ca_real, @@ -428,19 +428,19 @@ int epicsShareAPI ca_add_masked_array_event ( /* * ca_clear_event () */ -int epicsShareAPI ca_clear_event ( evid pMon ) +int epicsStdCall ca_clear_event ( evid pMon ) { return ca_clear_subscription ( pMon ); } // extern "C" -chid epicsShareAPI ca_evid_to_chid ( evid pMon ) +chid epicsStdCall ca_evid_to_chid ( evid pMon ) { return & pMon->channel (); } // extern "C" -int epicsShareAPI ca_pend ( ca_real timeout, int early ) +int epicsStdCall ca_pend ( ca_real timeout, int early ) { if ( early ) { return ca_pend_io ( timeout ); @@ -454,7 +454,7 @@ int epicsShareAPI ca_pend ( ca_real timeout, int early ) * ca_pend_event () */ // extern "C" -int epicsShareAPI ca_pend_event ( ca_real timeout ) +int epicsStdCall ca_pend_event ( ca_real timeout ) { ca_client_context *pcac; int status = fetchClientContext ( &pcac ); @@ -481,7 +481,7 @@ int epicsShareAPI ca_pend_event ( ca_real timeout ) * ca_pend_io () */ // extern "C" -int epicsShareAPI ca_pend_io ( ca_real timeout ) +int epicsStdCall ca_pend_io ( ca_real timeout ) { ca_client_context *pcac; int status = fetchClientContext ( &pcac ); @@ -506,7 +506,7 @@ int epicsShareAPI ca_pend_io ( ca_real timeout ) /* * ca_flush_io () */ -int epicsShareAPI ca_flush_io () +int epicsStdCall ca_flush_io () { ca_client_context * pcac; int caStatus = fetchClientContext (&pcac); @@ -523,7 +523,7 @@ int epicsShareAPI ca_flush_io () /* * CA_TEST_IO () */ -int epicsShareAPI ca_test_io () +int epicsStdCall ca_test_io () { ca_client_context *pcac; int caStatus = fetchClientContext ( &pcac ); @@ -543,7 +543,7 @@ int epicsShareAPI ca_test_io () * CA_SIGNAL() */ // extern "C" -void epicsShareAPI ca_signal ( long ca_status, const char *message ) +void epicsStdCall ca_signal ( long ca_status, const char *message ) { ca_signal_with_file_and_lineno ( ca_status, message, NULL, 0 ); } @@ -558,7 +558,7 @@ void epicsShareAPI ca_signal ( long ca_status, const char *message ) * (if they call this routine again). */ // extern "C" -const char * epicsShareAPI ca_message ( long ca_status ) +const char * epicsStdCall ca_message ( long ca_status ) { unsigned msgNo = CA_EXTRACT_MSG_NO ( ca_status ); @@ -574,7 +574,7 @@ const char * epicsShareAPI ca_message ( long ca_status ) * ca_signal_with_file_and_lineno() */ // extern "C" -void epicsShareAPI ca_signal_with_file_and_lineno ( long ca_status, +void epicsStdCall ca_signal_with_file_and_lineno ( long ca_status, const char *message, const char *pfilenm, int lineno ) { ca_signal_formated ( ca_status, pfilenm, lineno, message ); @@ -584,7 +584,7 @@ void epicsShareAPI ca_signal_with_file_and_lineno ( long ca_status, * ca_signal_formated() */ // extern "C" -void epicsShareAPI ca_signal_formated ( long ca_status, const char *pfilenm, +void epicsStdCall ca_signal_formated ( long ca_status, const char *pfilenm, int lineno, const char *pFormat, ... ) { ca_client_context *pcac; @@ -620,7 +620,7 @@ void epicsShareAPI ca_signal_formated ( long ca_status, const char *pfilenm, * */ // extern "C" -int epicsShareAPI ca_add_fd_registration ( CAFDHANDLER * func, void * arg ) +int epicsStdCall ca_add_fd_registration ( CAFDHANDLER * func, void * arg ) { ca_client_context *pcac; int caStatus = fetchClientContext ( &pcac ); @@ -638,7 +638,7 @@ int epicsShareAPI ca_add_fd_registration ( CAFDHANDLER * func, void * arg ) * function that returns the CA version string */ // extern "C" -const char * epicsShareAPI ca_version () +const char * epicsStdCall ca_version () { return CA_VERSION_STRING ( CA_MINOR_PROTOCOL_REVISION ); } @@ -647,7 +647,7 @@ const char * epicsShareAPI ca_version () * ca_replace_printf_handler () */ // extern "C" -int epicsShareAPI ca_replace_printf_handler ( caPrintfFunc *ca_printf_func ) +int epicsStdCall ca_replace_printf_handler ( caPrintfFunc *ca_printf_func ) { ca_client_context *pcac; int caStatus = fetchClientContext (&pcac); @@ -667,7 +667,7 @@ int epicsShareAPI ca_replace_printf_handler ( caPrintfFunc *ca_printf_func ) * (for testing purposes only) */ // extern "C" -unsigned epicsShareAPI ca_get_ioc_connection_count () +unsigned epicsStdCall ca_get_ioc_connection_count () { ca_client_context * pcac; int caStatus = fetchClientContext ( & pcac ); @@ -678,7 +678,7 @@ unsigned epicsShareAPI ca_get_ioc_connection_count () return pcac->circuitCount (); } -unsigned epicsShareAPI ca_beacon_anomaly_count () +unsigned epicsStdCall ca_beacon_anomaly_count () { ca_client_context * pcac; int caStatus = fetchClientContext ( & pcac ); @@ -690,7 +690,7 @@ unsigned epicsShareAPI ca_beacon_anomaly_count () } // extern "C" -int epicsShareAPI ca_channel_status ( epicsThreadId /* tid */ ) +int epicsStdCall ca_channel_status ( epicsThreadId /* tid */ ) { ::printf ("The R3.14 EPICS OS abstraction API does not allow peeking at thread private storage of another thread.\n"); ::printf ("Please call \"ca_client_status ( unsigned level )\" from the subsystem specific diagnostic code.\n"); @@ -698,7 +698,7 @@ int epicsShareAPI ca_channel_status ( epicsThreadId /* tid */ ) } // extern "C" -int epicsShareAPI ca_client_status ( unsigned level ) +int epicsStdCall ca_client_status ( unsigned level ) { ca_client_context *pcac; int caStatus = fetchClientContext ( &pcac ); @@ -710,7 +710,7 @@ int epicsShareAPI ca_client_status ( unsigned level ) return ECA_NORMAL; } -int epicsShareAPI ca_context_status ( ca_client_context * pcac, unsigned level ) +int epicsStdCall ca_context_status ( ca_client_context * pcac, unsigned level ) { pcac->show ( level ); return ECA_NORMAL; @@ -723,7 +723,7 @@ int epicsShareAPI ca_context_status ( ca_client_context * pcac, unsigned level ) * by another thread */ // extern "C" -struct ca_client_context * epicsShareAPI ca_current_context () +struct ca_client_context * epicsStdCall ca_current_context () { struct ca_client_context *pCtx; if ( caClientContextId ) { @@ -743,7 +743,7 @@ struct ca_client_context * epicsShareAPI ca_current_context () * by another thread */ // extern "C" -int epicsShareAPI ca_attach_context ( struct ca_client_context * pCtx ) +int epicsStdCall ca_attach_context ( struct ca_client_context * pCtx ) { ca_client_context *pcac = (ca_client_context *) epicsThreadPrivateGet ( caClientContextId ); if ( pcac && pCtx != 0 ) { @@ -756,14 +756,14 @@ int epicsShareAPI ca_attach_context ( struct ca_client_context * pCtx ) return ECA_NORMAL; } -void epicsShareAPI ca_detach_context () +void epicsStdCall ca_detach_context () { if ( caClientContextId ) { epicsThreadPrivateSet ( caClientContextId, 0 ); } } -int epicsShareAPI ca_preemtive_callback_is_enabled () +int epicsStdCall ca_preemtive_callback_is_enabled () { ca_client_context *pcac = (ca_client_context *) epicsThreadPrivateGet ( caClientContextId ); if ( ! pcac ) { @@ -774,7 +774,7 @@ int epicsShareAPI ca_preemtive_callback_is_enabled () // extern "C" -void epicsShareAPI ca_self_test () +void epicsStdCall ca_self_test () { ca_client_context *pcac = (ca_client_context *) epicsThreadPrivateGet ( caClientContextId ); if ( ! pcac ) { diff --git a/modules/ca/src/client/addrList.h b/modules/ca/src/client/addrList.h index c59f8e7af..bc0fd9d7e 100644 --- a/modules/ca/src/client/addrList.h +++ b/modules/ca/src/client/addrList.h @@ -19,17 +19,17 @@ extern "C" { #endif -LIBCA_API void epicsShareAPI configureChannelAccessAddressList +LIBCA_API void epicsStdCall configureChannelAccessAddressList ( struct ELLLIST *pList, SOCKET sock, unsigned short port ); -LIBCA_API int epicsShareAPI addAddrToChannelAccessAddressList +LIBCA_API int epicsStdCall addAddrToChannelAccessAddressList ( struct ELLLIST *pList, const ENV_PARAM *pEnv, unsigned short port, int ignoreNonDefaultPort ); -LIBCA_API void epicsShareAPI printChannelAccessAddressList +LIBCA_API void epicsStdCall printChannelAccessAddressList ( const struct ELLLIST *pList ); -LIBCA_API void epicsShareAPI removeDuplicateAddresses +LIBCA_API void epicsStdCall removeDuplicateAddresses ( struct ELLLIST *pDestList, ELLLIST *pSrcList, int silent); #ifdef __cplusplus diff --git a/modules/ca/src/client/ca_client_context.cpp b/modules/ca/src/client/ca_client_context.cpp index 6e5bbb88e..f9b02e192 100644 --- a/modules/ca/src/client/ca_client_context.cpp +++ b/modules/ca/src/client/ca_client_context.cpp @@ -735,12 +735,12 @@ void ca_client_context::installDefaultService ( cacService & service ) ca_client_context::pDefaultService = & service; } -void epicsShareAPI caInstallDefaultService ( cacService & service ) +void epicsStdCall caInstallDefaultService ( cacService & service ) { ca_client_context::installDefaultService ( service ); } -LIBCA_API int epicsShareAPI ca_clear_subscription ( evid pMon ) +LIBCA_API int epicsStdCall ca_clear_subscription ( evid pMon ) { oldChannelNotify & chan = pMon->channel (); ca_client_context & cac = chan.getClientCtx (); diff --git a/modules/ca/src/client/cacIO.h b/modules/ca/src/client/cacIO.h index 640b9a3c1..699626a54 100644 --- a/modules/ca/src/client/cacIO.h +++ b/modules/ca/src/client/cacIO.h @@ -316,7 +316,7 @@ public: cacContextNotify & ) = 0; }; -LIBCA_API void epicsShareAPI caInstallDefaultService ( cacService & service ); +LIBCA_API void epicsStdCall caInstallDefaultService ( cacService & service ); LIBCA_API extern epicsThreadPrivateId caClientCallbackThreadId; diff --git a/modules/ca/src/client/cadef.h b/modules/ca/src/client/cadef.h index afa81f927..32cef0070 100644 --- a/modules/ca/src/client/cadef.h +++ b/modules/ca/src/client/cadef.h @@ -91,7 +91,7 @@ typedef struct event_handler_args { } evargs; typedef void caEventCallBackFunc (struct event_handler_args); -LIBCA_API void epicsShareAPI ca_test_event +LIBCA_API void epicsStdCall ca_test_event ( struct event_handler_args ); @@ -147,13 +147,13 @@ typedef unsigned CA_SYNC_GID; #define TYPENOTCONN (-1) /* the channel's native type when disconnected */ -LIBCA_API short epicsShareAPI ca_field_type (chid chan); -LIBCA_API unsigned long epicsShareAPI ca_element_count (chid chan); -LIBCA_API const char * epicsShareAPI ca_name (chid chan); -LIBCA_API void epicsShareAPI ca_set_puser (chid chan, void *puser); -LIBCA_API void * epicsShareAPI ca_puser (chid chan); -LIBCA_API unsigned epicsShareAPI ca_read_access (chid chan); -LIBCA_API unsigned epicsShareAPI ca_write_access (chid chan); +LIBCA_API short epicsStdCall ca_field_type (chid chan); +LIBCA_API unsigned long epicsStdCall ca_element_count (chid chan); +LIBCA_API const char * epicsStdCall ca_name (chid chan); +LIBCA_API void epicsStdCall ca_set_puser (chid chan, void *puser); +LIBCA_API void * epicsStdCall ca_puser (chid chan); +LIBCA_API unsigned epicsStdCall ca_read_access (chid chan); +LIBCA_API unsigned epicsStdCall ca_write_access (chid chan); /* * cs_ - `channel state' @@ -164,27 +164,27 @@ LIBCA_API unsigned epicsShareAPI ca_write_access (chid chan); * cs_closed channel deleted by user */ enum channel_state {cs_never_conn, cs_prev_conn, cs_conn, cs_closed}; -LIBCA_API enum channel_state epicsShareAPI ca_state (chid chan); +LIBCA_API enum channel_state epicsStdCall ca_state (chid chan); /************************************************************************/ /* Perform Library Initialization */ /* */ /* Must be called once before calling any of the other routines */ /************************************************************************/ -LIBCA_API int epicsShareAPI ca_task_initialize (void); +LIBCA_API int epicsStdCall ca_task_initialize (void); enum ca_preemptive_callback_select { ca_disable_preemptive_callback, ca_enable_preemptive_callback }; -LIBCA_API int epicsShareAPI +LIBCA_API int epicsStdCall ca_context_create (enum ca_preemptive_callback_select select); -LIBCA_API void epicsShareAPI ca_detach_context (); +LIBCA_API void epicsStdCall ca_detach_context (); /************************************************************************/ /* Remove CA facility from your task */ /* */ /* Normally called automatically at task exit */ /************************************************************************/ -LIBCA_API int epicsShareAPI ca_task_exit (void); -LIBCA_API void epicsShareAPI ca_context_destroy (void); +LIBCA_API int epicsStdCall ca_task_exit (void); +LIBCA_API void epicsStdCall ca_context_destroy (void); typedef unsigned capri; #define CA_PRIORITY_MAX 99 @@ -207,7 +207,7 @@ typedef unsigned capri; * priority R priority level in the server 0 - 100 * pChanID RW channel id written here */ -LIBCA_API int epicsShareAPI ca_create_channel +LIBCA_API int epicsStdCall ca_create_channel ( const char *pChanName, caCh *pConnStateCallback, @@ -222,7 +222,7 @@ LIBCA_API int epicsShareAPI ca_create_channel * chan R channel identifier * pfunc R address of connection call-back function */ -LIBCA_API int epicsShareAPI ca_change_connection_event +LIBCA_API int epicsStdCall ca_change_connection_event ( chid chan, caCh * pfunc @@ -234,7 +234,7 @@ LIBCA_API int epicsShareAPI ca_change_connection_event * chan R channel identifier * pfunc R address of access rights call-back function */ -LIBCA_API int epicsShareAPI ca_replace_access_rights_event ( +LIBCA_API int epicsStdCall ca_replace_access_rights_event ( chid chan, caArh *pfunc ); @@ -249,7 +249,7 @@ LIBCA_API int epicsShareAPI ca_replace_access_rights_event ( * call-back function */ typedef void caExceptionHandler (struct exception_handler_args); -LIBCA_API int epicsShareAPI ca_add_exception_event +LIBCA_API int epicsStdCall ca_add_exception_event ( caExceptionHandler *pfunc, void *pArg @@ -261,7 +261,7 @@ LIBCA_API int epicsShareAPI ca_add_exception_event * * chanId R channel ID */ -LIBCA_API int epicsShareAPI ca_clear_channel +LIBCA_API int epicsStdCall ca_clear_channel ( chid chanId ); @@ -309,7 +309,7 @@ ca_array_put(DBR_FLOAT, 1u, chan, (const dbr_float_t *) pValue) * chan R channel identifier * pValue R new channel value copied from this location */ -LIBCA_API int epicsShareAPI ca_array_put +LIBCA_API int epicsStdCall ca_array_put ( chtype type, unsigned long count, @@ -334,7 +334,7 @@ LIBCA_API int epicsShareAPI ca_array_put * pFunc R pointer to call-back function * pArg R copy of this pointer passed to pFunc */ -LIBCA_API int epicsShareAPI ca_array_put_callback +LIBCA_API int epicsStdCall ca_array_put_callback ( chtype type, unsigned long count, @@ -391,7 +391,7 @@ ca_array_get(DBR_FLOAT, 1u, chan, (dbr_float_t *)(pValue)) * chan R channel identifier * pValue W channel value copied to this location */ -LIBCA_API int epicsShareAPI ca_array_get +LIBCA_API int epicsStdCall ca_array_get ( chtype type, unsigned long count, @@ -450,7 +450,7 @@ ca_array_get_callback (type, 1u, chan, pFunc, pArg) * pFunc R pointer to call-back function * pArg R copy of this pointer passed to pFunc */ -LIBCA_API int epicsShareAPI ca_array_get_callback +LIBCA_API int epicsStdCall ca_array_get_callback ( chtype type, unsigned long count, @@ -480,7 +480,7 @@ LIBCA_API int epicsShareAPI ca_array_get_callback * pArg R copy of this pointer passed to pFunc * pEventID W event id written at specified address */ -LIBCA_API int epicsShareAPI ca_create_subscription +LIBCA_API int epicsStdCall ca_create_subscription ( chtype type, unsigned long count, @@ -501,12 +501,12 @@ LIBCA_API int epicsShareAPI ca_create_subscription * * eventID R event id */ -LIBCA_API int epicsShareAPI ca_clear_subscription +LIBCA_API int epicsStdCall ca_clear_subscription ( evid eventID ); -LIBCA_API chid epicsShareAPI ca_evid_to_chid ( evid id ); +LIBCA_API chid epicsStdCall ca_evid_to_chid ( evid id ); /************************************************************************/ @@ -560,7 +560,7 @@ LIBCA_API chid epicsShareAPI ca_evid_to_chid ( evid id ); * * timeOut R wait for this delay in seconds */ -LIBCA_API int epicsShareAPI ca_pend_event (ca_real timeOut); +LIBCA_API int epicsStdCall ca_pend_event (ca_real timeOut); #define ca_poll() ca_pend_event(1e-12) /* @@ -570,10 +570,10 @@ LIBCA_API int epicsShareAPI ca_pend_event (ca_real timeOut); * if all get requests (or search requests with null * connection handler pointer have completed) */ -LIBCA_API int epicsShareAPI ca_pend_io (ca_real timeOut); +LIBCA_API int epicsStdCall ca_pend_io (ca_real timeOut); /* calls ca_pend_io() if early is true otherwise ca_pend_event() is called */ -LIBCA_API int epicsShareAPI ca_pend (ca_real timeout, int early); +LIBCA_API int epicsStdCall ca_pend (ca_real timeout, int early); /* * ca_test_io() @@ -581,7 +581,7 @@ LIBCA_API int epicsShareAPI ca_pend (ca_real timeout, int early); * returns TRUE when get requests (or search requests with null * connection handler pointer) are outstanding */ -LIBCA_API int epicsShareAPI ca_test_io (void); +LIBCA_API int epicsStdCall ca_test_io (void); /************************************************************************/ /* Send out all outstanding messages in the send queue */ @@ -589,7 +589,7 @@ LIBCA_API int epicsShareAPI ca_test_io (void); /* * ca_flush_io() */ -LIBCA_API int epicsShareAPI ca_flush_io (void); +LIBCA_API int epicsStdCall ca_flush_io (void); /* @@ -598,7 +598,7 @@ LIBCA_API int epicsShareAPI ca_flush_io (void); * errorCode R status returned from channel access function * pCtxStr R context string included with error print out */ -LIBCA_API void epicsShareAPI ca_signal +LIBCA_API void epicsStdCall ca_signal ( long errorCode, const char *pCtxStr @@ -612,7 +612,7 @@ LIBCA_API void epicsShareAPI ca_signal * lineNo R line number included with error print out * */ -LIBCA_API void epicsShareAPI ca_signal_with_file_and_lineno +LIBCA_API void epicsStdCall ca_signal_with_file_and_lineno ( long errorCode, const char *pCtxStr, @@ -628,7 +628,7 @@ LIBCA_API void epicsShareAPI ca_signal_with_file_and_lineno * pFormat R printf dtyle format string (and optional arguments) * */ -LIBCA_API void epicsShareAPI ca_signal_formated (long ca_status, const char *pfilenm, +LIBCA_API void epicsStdCall ca_signal_formated (long ca_status, const char *pfilenm, int lineno, const char *pFormat, ...); /* @@ -638,9 +638,9 @@ LIBCA_API void epicsShareAPI ca_signal_formated (long ca_status, const char *pfi * * !!!! this function is _not_ thread safe !!!! */ -LIBCA_API const char * epicsShareAPI ca_host_name (chid channel); +LIBCA_API const char * epicsStdCall ca_host_name (chid channel); /* thread safe version */ -LIBCA_API unsigned epicsShareAPI ca_get_host_name ( chid pChan, +LIBCA_API unsigned epicsStdCall ca_get_host_name ( chid pChan, char *pBuf, unsigned bufLength ); /* @@ -663,7 +663,7 @@ typedef void CAFDHANDLER (void *parg, int fd, int opened); * when an fd is created or deleted * pArg R argument passed to above function */ -LIBCA_API int epicsShareAPI ca_add_fd_registration +LIBCA_API int epicsStdCall ca_add_fd_registration ( CAFDHANDLER *pHandler, void *pArg @@ -687,7 +687,7 @@ LIBCA_API int epicsShareAPI ca_add_fd_registration * * pgid W pointer to sync group id that will be written */ -LIBCA_API int epicsShareAPI ca_sg_create (CA_SYNC_GID * pgid); +LIBCA_API int epicsStdCall ca_sg_create (CA_SYNC_GID * pgid); /* * ca_sg_delete() @@ -696,7 +696,7 @@ LIBCA_API int epicsShareAPI ca_sg_create (CA_SYNC_GID * pgid); * * gid R sync group id */ -LIBCA_API int epicsShareAPI ca_sg_delete (const CA_SYNC_GID gid); +LIBCA_API int epicsStdCall ca_sg_delete (const CA_SYNC_GID gid); /* * ca_sg_block() @@ -707,7 +707,7 @@ LIBCA_API int epicsShareAPI ca_sg_delete (const CA_SYNC_GID gid); * timeout R wait for this duration prior to timing out * and returning ECA_TIMEOUT */ -LIBCA_API int epicsShareAPI ca_sg_block (const CA_SYNC_GID gid, ca_real timeout); +LIBCA_API int epicsStdCall ca_sg_block (const CA_SYNC_GID gid, ca_real timeout); /* * ca_sg_test() @@ -718,14 +718,14 @@ LIBCA_API int epicsShareAPI ca_sg_block (const CA_SYNC_GID gid, ca_real timeout) * * returns one of ECA_BADSYNCGRP, ECA_IOINPROGRESS, ECA_IODONE */ -LIBCA_API int epicsShareAPI ca_sg_test (const CA_SYNC_GID gid); +LIBCA_API int epicsStdCall ca_sg_test (const CA_SYNC_GID gid); /* * ca_sg_reset * * gid R sync group id */ -LIBCA_API int epicsShareAPI ca_sg_reset(const CA_SYNC_GID gid); +LIBCA_API int epicsStdCall ca_sg_reset(const CA_SYNC_GID gid); /* * ca_sg_array_get() @@ -739,7 +739,7 @@ LIBCA_API int epicsShareAPI ca_sg_reset(const CA_SYNC_GID gid); * chan R channel identifier * pValue W channel value copied to this location */ -LIBCA_API int epicsShareAPI ca_sg_array_get +LIBCA_API int epicsStdCall ca_sg_array_get ( const CA_SYNC_GID gid, chtype type, @@ -763,7 +763,7 @@ ca_sg_array_get (gid, type, 1u, chan, pValue) * chan R channel identifier * pValue R new channel value copied from this location */ -LIBCA_API int epicsShareAPI ca_sg_array_put +LIBCA_API int epicsStdCall ca_sg_array_put ( const CA_SYNC_GID gid, chtype type, @@ -782,9 +782,9 @@ ca_sg_array_put (gid, type, 1u, chan, pValue) * * gid R sync group id */ -LIBCA_API int epicsShareAPI ca_sg_stat (CA_SYNC_GID gid); +LIBCA_API int epicsStdCall ca_sg_stat (CA_SYNC_GID gid); -LIBCA_API void epicsShareAPI ca_dump_dbr (chtype type, unsigned count, const void * pbuffer); +LIBCA_API void epicsStdCall ca_dump_dbr (chtype type, unsigned count, const void * pbuffer); /* @@ -797,14 +797,14 @@ LIBCA_API void epicsShareAPI ca_dump_dbr (chtype type, unsigned count, const voi * * (returns true or false) */ -LIBCA_API int epicsShareAPI ca_v42_ok (chid chan); +LIBCA_API int epicsStdCall ca_v42_ok (chid chan); /* * ca_version() * * returns the CA version string */ -LIBCA_API const char * epicsShareAPI ca_version (void); +LIBCA_API const char * epicsStdCall ca_version (void); /* * ca_replace_printf_handler () @@ -819,7 +819,7 @@ LIBCA_API const char * epicsShareAPI ca_version (void); */ #ifndef CA_DONT_INCLUDE_STDARGH typedef int caPrintfFunc (const char *pformat, va_list args); -LIBCA_API int epicsShareAPI ca_replace_printf_handler ( +LIBCA_API int epicsStdCall ca_replace_printf_handler ( caPrintfFunc *ca_printf_func ); #endif /*CA_DONT_INCLUDE_STDARGH*/ @@ -827,24 +827,24 @@ LIBCA_API int epicsShareAPI ca_replace_printf_handler ( /* * (for testing purposes only) */ -LIBCA_API unsigned epicsShareAPI ca_get_ioc_connection_count (void); -LIBCA_API int epicsShareAPI ca_preemtive_callback_is_enabled (void); -LIBCA_API void epicsShareAPI ca_self_test (void); -LIBCA_API unsigned epicsShareAPI ca_beacon_anomaly_count (void); -LIBCA_API unsigned epicsShareAPI ca_search_attempts (chid chan); -LIBCA_API double epicsShareAPI ca_beacon_period (chid chan); -LIBCA_API double epicsShareAPI ca_receive_watchdog_delay (chid chan); +LIBCA_API unsigned epicsStdCall ca_get_ioc_connection_count (void); +LIBCA_API int epicsStdCall ca_preemtive_callback_is_enabled (void); +LIBCA_API void epicsStdCall ca_self_test (void); +LIBCA_API unsigned epicsStdCall ca_beacon_anomaly_count (void); +LIBCA_API unsigned epicsStdCall ca_search_attempts (chid chan); +LIBCA_API double epicsStdCall ca_beacon_period (chid chan); +LIBCA_API double epicsStdCall ca_receive_watchdog_delay (chid chan); /* * used when an auxillary thread needs to join a CA client context started * by another thread */ -LIBCA_API struct ca_client_context * epicsShareAPI ca_current_context (); -LIBCA_API int epicsShareAPI ca_attach_context ( struct ca_client_context * context ); +LIBCA_API struct ca_client_context * epicsStdCall ca_current_context (); +LIBCA_API int epicsStdCall ca_attach_context ( struct ca_client_context * context ); -LIBCA_API int epicsShareAPI ca_client_status ( unsigned level ); -LIBCA_API int epicsShareAPI ca_context_status ( struct ca_client_context *, unsigned level ); +LIBCA_API int epicsStdCall ca_client_status ( unsigned level ); +LIBCA_API int epicsStdCall ca_context_status ( struct ca_client_context *, unsigned level ); /* * deprecated @@ -853,16 +853,16 @@ LIBCA_API int epicsShareAPI ca_context_status ( struct ca_client_context *, unsi ca_build_and_connect(NAME, XXXXX, 1, CHIDPTR, YYYYY, 0, 0) #define ca_array_build(NAME,XXXXX, ZZZZZZ, CHIDPTR,YYYYY)\ ca_build_and_connect(NAME, XXXXX, ZZZZZZ, CHIDPTR, YYYYY, 0, 0) -LIBCA_API int epicsShareAPI ca_build_and_connect +LIBCA_API int epicsStdCall ca_build_and_connect ( const char *pChanName, chtype, unsigned long, chid * pChanID, void *, caCh * pFunc, void * pArg ); #define ca_search(pChanName, pChanID)\ ca_search_and_connect (pChanName, pChanID, 0, 0) -LIBCA_API int epicsShareAPI ca_search_and_connect +LIBCA_API int epicsStdCall ca_search_and_connect ( const char * pChanName, chid * pChanID, caCh *pFunc, void * pArg ); -LIBCA_API int epicsShareAPI ca_channel_status (epicsThreadId tid); -LIBCA_API int epicsShareAPI ca_clear_event ( evid eventID ); +LIBCA_API int epicsStdCall ca_channel_status (epicsThreadId tid); +LIBCA_API int epicsStdCall ca_clear_event ( evid eventID ); #define ca_add_event(type,chan,pFunc,pArg,pEventID)\ ca_add_array_event(type,1u,chan,pFunc,pArg,0.0,0.0,0.0,pEventID) #define ca_add_delta_event(TYPE,CHID,ENTRY,ARG,DELTA,EVID)\ @@ -871,7 +871,7 @@ ca_add_array_event(type,1u,chan,pFunc,pArg,0.0,0.0,0.0,pEventID) ca_add_array_event(TYPE,1,CHID,ENTRY,ARG,P_DELTA,N_DELTA,TO,EVID) #define ca_add_array_event(TYPE,COUNT,CHID,ENTRY,ARG,P_DELTA,N_DELTA,TO,EVID)\ ca_add_masked_array_event(TYPE,COUNT,CHID,ENTRY,ARG,P_DELTA,N_DELTA,TO,EVID, DBE_VALUE | DBE_ALARM) -LIBCA_API int epicsShareAPI ca_add_masked_array_event +LIBCA_API int epicsStdCall ca_add_masked_array_event ( chtype type, unsigned long count, chid chanId, caEventCallBackFunc * pFunc, void * pArg, ca_real p_delta, ca_real n_delta, ca_real timeout, evid * pEventID, long mask ); @@ -879,8 +879,8 @@ LIBCA_API int epicsShareAPI ca_add_masked_array_event /* * defunct */ -LIBCA_API int epicsShareAPI ca_modify_user_name ( const char *pUserName ); -LIBCA_API int epicsShareAPI ca_modify_host_name ( const char *pHostName ); +LIBCA_API int epicsStdCall ca_modify_user_name ( const char *pUserName ); +LIBCA_API int epicsStdCall ca_modify_host_name ( const char *pHostName ); #ifdef __cplusplus } diff --git a/modules/ca/src/client/caerr.h b/modules/ca/src/client/caerr.h index ead86db9f..9104a4f02 100644 --- a/modules/ca/src/client/caerr.h +++ b/modules/ca/src/client/caerr.h @@ -140,7 +140,7 @@ extern "C" { #endif -LIBCA_API const char * epicsShareAPI ca_message(long ca_status); +LIBCA_API const char * epicsStdCall ca_message(long ca_status); LIBCA_API extern const char * ca_message_text []; diff --git a/modules/ca/src/client/iocinf.cpp b/modules/ca/src/client/iocinf.cpp index c0f6e7cab..8dcf8c087 100644 --- a/modules/ca/src/client/iocinf.cpp +++ b/modules/ca/src/client/iocinf.cpp @@ -70,7 +70,7 @@ static char *getToken ( const char **ppString, char *pBuf, unsigned bufSIze ) /* * addAddrToChannelAccessAddressList () */ -extern "C" int epicsShareAPI addAddrToChannelAccessAddressList +extern "C" int epicsStdCall addAddrToChannelAccessAddressList ( ELLLIST *pList, const ENV_PARAM *pEnv, unsigned short port, int ignoreNonDefaultPort ) { @@ -119,7 +119,7 @@ extern "C" int epicsShareAPI addAddrToChannelAccessAddressList /* * removeDuplicateAddresses () */ -extern "C" void epicsShareAPI removeDuplicateAddresses +extern "C" void epicsStdCall removeDuplicateAddresses ( ELLLIST *pDestList, ELLLIST *pSrcList, int silent ) { ELLNODE *pRawNode; @@ -179,7 +179,7 @@ static void forcePort ( ELLLIST *pList, unsigned short port ) /* * configureChannelAccessAddressList () */ -extern "C" void epicsShareAPI configureChannelAccessAddressList +extern "C" void epicsStdCall configureChannelAccessAddressList ( ELLLIST *pList, SOCKET sock, unsigned short port ) { ELLLIST tmpList; @@ -247,7 +247,7 @@ extern "C" void epicsShareAPI configureChannelAccessAddressList /* * printChannelAccessAddressList () */ -extern "C" void epicsShareAPI printChannelAccessAddressList ( const ELLLIST *pList ) +extern "C" void epicsStdCall printChannelAccessAddressList ( const ELLLIST *pList ) { osiSockAddrNode *pNode; diff --git a/modules/ca/src/client/oldAccess.h b/modules/ca/src/client/oldAccess.h index 273b550c5..4fdb89a33 100644 --- a/modules/ca/src/client/oldAccess.h +++ b/modules/ca/src/client/oldAccess.h @@ -48,53 +48,53 @@ public: epicsGuard < epicsMutex > & mutexGuard ); // legacy C API - friend unsigned epicsShareAPI ca_get_host_name ( + friend unsigned epicsStdCall ca_get_host_name ( chid pChan, char * pBuf, unsigned bufLength ); - friend const char * epicsShareAPI ca_host_name ( + friend const char * epicsStdCall ca_host_name ( chid pChan ); - friend const char * epicsShareAPI ca_name ( + friend const char * epicsStdCall ca_name ( chid pChan ); - friend void epicsShareAPI ca_set_puser ( + friend void epicsStdCall ca_set_puser ( chid pChan, void * puser ); - friend void * epicsShareAPI ca_puser ( + friend void * epicsStdCall ca_puser ( chid pChan ); - friend int epicsShareAPI ca_change_connection_event ( + friend int epicsStdCall ca_change_connection_event ( chid pChan, caCh * pfunc ); - friend int epicsShareAPI ca_replace_access_rights_event ( + friend int epicsStdCall ca_replace_access_rights_event ( chid pChan, caArh *pfunc ); - friend int epicsShareAPI ca_array_get ( chtype type, + friend int epicsStdCall ca_array_get ( chtype type, arrayElementCount count, chid pChan, void * pValue ); - friend int epicsShareAPI ca_array_get_callback ( chtype type, + friend int epicsStdCall ca_array_get_callback ( chtype type, arrayElementCount count, chid pChan, caEventCallBackFunc *pfunc, void *arg ); - friend int epicsShareAPI ca_array_put ( + friend int epicsStdCall ca_array_put ( chtype type, arrayElementCount count, chid pChan, const void * pValue ); - friend int epicsShareAPI ca_array_put_callback ( + friend int epicsStdCall ca_array_put_callback ( chtype type, arrayElementCount count, chid pChan, const void *pValue, caEventCallBackFunc *pfunc, void *usrarg ); - friend double epicsShareAPI ca_beacon_period ( + friend double epicsStdCall ca_beacon_period ( chid pChan ); - friend unsigned epicsShareAPI ca_search_attempts ( + friend unsigned epicsStdCall ca_search_attempts ( chid pChan ); - friend unsigned epicsShareAPI ca_write_access ( + friend unsigned epicsStdCall ca_write_access ( chid pChan ); - friend unsigned epicsShareAPI ca_read_access ( + friend unsigned epicsStdCall ca_read_access ( chid pChan ); - friend short epicsShareAPI ca_field_type ( + friend short epicsStdCall ca_field_type ( chid pChan ); - friend arrayElementCount epicsShareAPI ca_element_count ( + friend arrayElementCount epicsStdCall ca_element_count ( chid pChan ); - friend int epicsShareAPI ca_v42_ok ( + friend int epicsStdCall ca_v42_ok ( chid pChan ); - friend int epicsShareAPI ca_create_subscription ( + friend int epicsStdCall ca_create_subscription ( chtype type, arrayElementCount count, chid pChan, long mask, caEventCallBackFunc * pCallBack, void * pCallBackArg, evid * monixptr ); - friend enum channel_state epicsShareAPI ca_state ( + friend enum channel_state epicsStdCall ca_state ( chid pChan ); - friend double epicsShareAPI ca_receive_watchdog_delay ( + friend double epicsStdCall ca_receive_watchdog_delay ( chid pChan ); unsigned getName ( @@ -340,35 +340,35 @@ public: void whenThereIsAnExceptionDestroySyncGroupIO ( epicsGuard < epicsMutex > &, T & ); // legacy C API - friend int epicsShareAPI ca_create_channel ( + friend int epicsStdCall ca_create_channel ( const char * name_str, caCh * conn_func, void * puser, capri priority, chid * chanptr ); - friend int epicsShareAPI ca_clear_channel ( chid pChan ); - friend int epicsShareAPI ca_array_get ( chtype type, + friend int epicsStdCall ca_clear_channel ( chid pChan ); + friend int epicsStdCall ca_array_get ( chtype type, arrayElementCount count, chid pChan, void * pValue ); - friend int epicsShareAPI ca_array_get_callback ( chtype type, + friend int epicsStdCall ca_array_get_callback ( chtype type, arrayElementCount count, chid pChan, caEventCallBackFunc *pfunc, void *arg ); - friend int epicsShareAPI ca_array_put ( chtype type, + friend int epicsStdCall ca_array_put ( chtype type, arrayElementCount count, chid pChan, const void * pValue ); - friend int epicsShareAPI ca_array_put_callback ( chtype type, + friend int epicsStdCall ca_array_put_callback ( chtype type, arrayElementCount count, chid pChan, const void * pValue, caEventCallBackFunc *pfunc, void *usrarg ); - friend int epicsShareAPI ca_create_subscription ( + friend int epicsStdCall ca_create_subscription ( chtype type, arrayElementCount count, chid pChan, long mask, caEventCallBackFunc * pCallBack, void * pCallBackArg, evid *monixptr ); - friend int epicsShareAPI ca_flush_io (); - friend int epicsShareAPI ca_clear_subscription ( evid pMon ); - friend int epicsShareAPI ca_sg_create ( CA_SYNC_GID * pgid ); - friend int epicsShareAPI ca_sg_delete ( const CA_SYNC_GID gid ); - friend int epicsShareAPI ca_sg_block ( const CA_SYNC_GID gid, ca_real timeout ); - friend int epicsShareAPI ca_sg_reset ( const CA_SYNC_GID gid ); - friend int epicsShareAPI ca_sg_test ( const CA_SYNC_GID gid ); - friend int epicsShareAPI ca_sg_array_get ( const CA_SYNC_GID gid, + friend int epicsStdCall ca_flush_io (); + friend int epicsStdCall ca_clear_subscription ( evid pMon ); + friend int epicsStdCall ca_sg_create ( CA_SYNC_GID * pgid ); + friend int epicsStdCall ca_sg_delete ( const CA_SYNC_GID gid ); + friend int epicsStdCall ca_sg_block ( const CA_SYNC_GID gid, ca_real timeout ); + friend int epicsStdCall ca_sg_reset ( const CA_SYNC_GID gid ); + friend int epicsStdCall ca_sg_test ( const CA_SYNC_GID gid ); + friend int epicsStdCall ca_sg_array_get ( const CA_SYNC_GID gid, chtype type, arrayElementCount count, chid pChan, void *pValue ); - friend int epicsShareAPI ca_sg_array_put ( const CA_SYNC_GID gid, + friend int epicsStdCall ca_sg_array_put ( const CA_SYNC_GID gid, chtype type, arrayElementCount count, chid pChan, const void *pValue ); friend int ca_sync_group_destroy ( CallbackGuard & cbGuard, diff --git a/modules/ca/src/client/oldChannelNotify.cpp b/modules/ca/src/client/oldChannelNotify.cpp index 1af7a7453..2c546edbb 100644 --- a/modules/ca/src/client/oldChannelNotify.cpp +++ b/modules/ca/src/client/oldChannelNotify.cpp @@ -172,7 +172,7 @@ void oldChannelNotify::operator delete ( void * ) /* * ca_get_host_name () */ -unsigned epicsShareAPI ca_get_host_name ( +unsigned epicsStdCall ca_get_host_name ( chid pChan, char * pBuf, unsigned bufLength ) { epicsGuard < epicsMutex > guard ( pChan->cacCtx.mutexRef() ); @@ -185,7 +185,7 @@ unsigned epicsShareAPI ca_get_host_name ( * !!!! not thread safe !!!! * */ -const char * epicsShareAPI ca_host_name ( +const char * epicsStdCall ca_host_name ( chid pChan ) { epicsGuard < epicsMutex > guard ( pChan->cacCtx.mutexRef () ); @@ -195,7 +195,7 @@ const char * epicsShareAPI ca_host_name ( /* * ca_set_puser () */ -void epicsShareAPI ca_set_puser ( +void epicsStdCall ca_set_puser ( chid pChan, void * puser ) { epicsGuard < epicsMutex > guard ( pChan->cacCtx.mutexRef () ); @@ -205,7 +205,7 @@ void epicsShareAPI ca_set_puser ( /* * ca_get_puser () */ -void * epicsShareAPI ca_puser ( +void * epicsStdCall ca_puser ( chid pChan ) { epicsGuard < epicsMutex > guard ( pChan->cacCtx.mutexRef () ); @@ -215,7 +215,7 @@ void * epicsShareAPI ca_puser ( /* * Specify an event subroutine to be run for connection events */ -int epicsShareAPI ca_change_connection_event ( chid pChan, caCh * pfunc ) +int epicsStdCall ca_change_connection_event ( chid pChan, caCh * pfunc ) { epicsGuard < epicsMutex > guard ( pChan->cacCtx.mutexRef () ); if ( ! pChan->currentlyConnected ) { @@ -237,7 +237,7 @@ int epicsShareAPI ca_change_connection_event ( chid pChan, caCh * pfunc ) /* * ca_replace_access_rights_event */ -int epicsShareAPI ca_replace_access_rights_event ( +int epicsStdCall ca_replace_access_rights_event ( chid pChan, caArh *pfunc ) { epicsGuard < epicsMutex > guard ( pChan->cacCtx.mutexRef () ); @@ -264,7 +264,7 @@ int epicsShareAPI ca_replace_access_rights_event ( /* * ca_array_get () */ -int epicsShareAPI ca_array_get ( chtype type, +int epicsStdCall ca_array_get ( chtype type, arrayElementCount count, chid pChan, void *pValue ) { int caStatus; @@ -332,7 +332,7 @@ int epicsShareAPI ca_array_get ( chtype type, /* * ca_array_get_callback () */ -int epicsShareAPI ca_array_get_callback ( chtype type, +int epicsStdCall ca_array_get_callback ( chtype type, arrayElementCount count, chid pChan, caEventCallBackFunc *pfunc, void *arg ) { @@ -409,7 +409,7 @@ void oldChannelNotify::read ( /* * ca_array_put_callback () */ -int epicsShareAPI ca_array_put_callback ( chtype type, arrayElementCount count, +int epicsStdCall ca_array_put_callback ( chtype type, arrayElementCount count, chid pChan, const void *pValue, caEventCallBackFunc *pfunc, void *usrarg ) { int caStatus; @@ -473,7 +473,7 @@ int epicsShareAPI ca_array_put_callback ( chtype type, arrayElementCount count, /* * ca_array_put () */ -int epicsShareAPI ca_array_put ( chtype type, arrayElementCount count, +int epicsStdCall ca_array_put ( chtype type, arrayElementCount count, chid pChan, const void * pValue ) { if ( type < 0 ) { @@ -527,7 +527,7 @@ int epicsShareAPI ca_array_put ( chtype type, arrayElementCount count, return caStatus; } -int epicsShareAPI ca_create_subscription ( +int epicsStdCall ca_create_subscription ( chtype type, arrayElementCount count, chid pChan, long mask, caEventCallBackFunc * pCallBack, void * pCallBackArg, evid * monixptr ) @@ -618,7 +618,7 @@ void oldChannelNotify::write ( /* * ca_field_type() */ -short epicsShareAPI ca_field_type ( chid pChan ) +short epicsStdCall ca_field_type ( chid pChan ) { epicsGuard < epicsMutex > guard ( pChan->cacCtx.mutexRef () ); return pChan->io.nativeType ( guard ); @@ -627,7 +627,7 @@ short epicsShareAPI ca_field_type ( chid pChan ) /* * ca_element_count () */ -arrayElementCount epicsShareAPI ca_element_count ( chid pChan ) +arrayElementCount epicsStdCall ca_element_count ( chid pChan ) { epicsGuard < epicsMutex > guard ( pChan->cacCtx.mutexRef () ); return pChan->io.nativeElementCount ( guard ); @@ -636,7 +636,7 @@ arrayElementCount epicsShareAPI ca_element_count ( chid pChan ) /* * ca_state () */ -enum channel_state epicsShareAPI ca_state ( chid pChan ) +enum channel_state epicsStdCall ca_state ( chid pChan ) { epicsGuard < epicsMutex > guard ( pChan->cacCtx.mutexRef () ); if ( pChan->io.connected ( guard ) ) { @@ -653,7 +653,7 @@ enum channel_state epicsShareAPI ca_state ( chid pChan ) /* * ca_read_access () */ -unsigned epicsShareAPI ca_read_access ( chid pChan ) +unsigned epicsStdCall ca_read_access ( chid pChan ) { epicsGuard < epicsMutex > guard ( pChan->cacCtx.mutexRef () ); return pChan->io.accessRights(guard).readPermit(); @@ -662,7 +662,7 @@ unsigned epicsShareAPI ca_read_access ( chid pChan ) /* * ca_write_access () */ -unsigned epicsShareAPI ca_write_access ( chid pChan ) +unsigned epicsStdCall ca_write_access ( chid pChan ) { epicsGuard < epicsMutex > guard ( pChan->cacCtx.mutexRef () ); return pChan->io.accessRights(guard).writePermit(); @@ -671,25 +671,25 @@ unsigned epicsShareAPI ca_write_access ( chid pChan ) /* * ca_name () */ -const char * epicsShareAPI ca_name ( chid pChan ) +const char * epicsStdCall ca_name ( chid pChan ) { epicsGuard < epicsMutex > guard ( pChan->cacCtx.mutexRef () ); return pChan->io.pName ( guard ); } -unsigned epicsShareAPI ca_search_attempts ( chid pChan ) +unsigned epicsStdCall ca_search_attempts ( chid pChan ) { epicsGuard < epicsMutex > guard ( pChan->cacCtx.mutexRef () ); return pChan->io.searchAttempts ( guard ); } -double epicsShareAPI ca_beacon_period ( chid pChan ) +double epicsStdCall ca_beacon_period ( chid pChan ) { epicsGuard < epicsMutex > guard ( pChan->cacCtx.mutexRef () ); return pChan->io.beaconPeriod ( guard ); } -double epicsShareAPI ca_receive_watchdog_delay ( chid pChan ) +double epicsStdCall ca_receive_watchdog_delay ( chid pChan ) { epicsGuard < epicsMutex > guard ( pChan->cacCtx.mutexRef () ); return pChan->io.receiveWatchdogDelay ( guard ); @@ -698,7 +698,7 @@ double epicsShareAPI ca_receive_watchdog_delay ( chid pChan ) /* * ca_v42_ok(chid chan) */ -int epicsShareAPI ca_v42_ok ( chid pChan ) +int epicsStdCall ca_v42_ok ( chid pChan ) { epicsGuard < epicsMutex > guard ( pChan->cacCtx.mutexRef () ); return pChan->io.ca_v42_ok ( guard ); diff --git a/modules/ca/src/client/syncgrp.cpp b/modules/ca/src/client/syncgrp.cpp index 1ba8057d0..e938fa579 100644 --- a/modules/ca/src/client/syncgrp.cpp +++ b/modules/ca/src/client/syncgrp.cpp @@ -21,7 +21,7 @@ /* * ca_sg_create() */ -extern "C" int epicsShareAPI ca_sg_create ( CA_SYNC_GID * pgid ) +extern "C" int epicsStdCall ca_sg_create ( CA_SYNC_GID * pgid ) { ca_client_context * pcac; int caStatus; @@ -65,7 +65,7 @@ int ca_sync_group_destroy ( CallbackGuard & cbGuard, epicsGuard < epicsMutex > & /* * ca_sg_delete() */ -extern "C" int epicsShareAPI ca_sg_delete ( const CA_SYNC_GID gid ) +extern "C" int epicsStdCall ca_sg_delete ( const CA_SYNC_GID gid ) { ca_client_context * pcac; int caStatus = fetchClientContext ( & pcac ); @@ -124,7 +124,7 @@ void sync_group_reset ( ca_client_context & client, CASG & sg ) // !!!! is disabled. This prevents the preemptive callback lock from being released // !!!! by other threads than the one that locked it. // -extern "C" int epicsShareAPI ca_sg_block ( +extern "C" int epicsStdCall ca_sg_block ( const CA_SYNC_GID gid, ca_real timeout ) { ca_client_context *pcac; @@ -152,7 +152,7 @@ extern "C" int epicsShareAPI ca_sg_block ( /* * ca_sg_reset */ -extern "C" int epicsShareAPI ca_sg_reset ( const CA_SYNC_GID gid ) +extern "C" int epicsStdCall ca_sg_reset ( const CA_SYNC_GID gid ) { ca_client_context *pcac; int caStatus = fetchClientContext (&pcac); @@ -176,7 +176,7 @@ extern "C" int epicsShareAPI ca_sg_reset ( const CA_SYNC_GID gid ) /* * ca_sg_stat */ -extern "C" int epicsShareAPI ca_sg_stat ( const CA_SYNC_GID gid ) +extern "C" int epicsStdCall ca_sg_stat ( const CA_SYNC_GID gid ) { ca_client_context * pcac; int caStatus = fetchClientContext ( &pcac ); @@ -199,7 +199,7 @@ extern "C" int epicsShareAPI ca_sg_stat ( const CA_SYNC_GID gid ) /* * ca_sg_test */ -extern "C" int epicsShareAPI ca_sg_test ( const CA_SYNC_GID gid ) +extern "C" int epicsStdCall ca_sg_test ( const CA_SYNC_GID gid ) { ca_client_context * pcac; int caStatus = fetchClientContext ( &pcac ); @@ -243,7 +243,7 @@ extern "C" int epicsShareAPI ca_sg_test ( const CA_SYNC_GID gid ) /* * ca_sg_array_put() */ -extern "C" int epicsShareAPI ca_sg_array_put ( const CA_SYNC_GID gid, chtype type, +extern "C" int epicsStdCall ca_sg_array_put ( const CA_SYNC_GID gid, chtype type, arrayElementCount count, chid pChan, const void *pValue ) { ca_client_context *pcac; @@ -305,7 +305,7 @@ extern "C" int epicsShareAPI ca_sg_array_put ( const CA_SYNC_GID gid, chtype typ /* * ca_sg_array_get() */ -extern "C" int epicsShareAPI ca_sg_array_get ( const CA_SYNC_GID gid, chtype type, +extern "C" int epicsStdCall ca_sg_array_get ( const CA_SYNC_GID gid, chtype type, arrayElementCount count, chid pChan, void *pValue ) { ca_client_context *pcac; diff --git a/modules/ca/src/client/test_event.cpp b/modules/ca/src/client/test_event.cpp index 78179f31e..18469ab3b 100644 --- a/modules/ca/src/client/test_event.cpp +++ b/modules/ca/src/client/test_event.cpp @@ -17,7 +17,7 @@ #include "cadef.h" -extern "C" void epicsShareAPI ca_test_event ( struct event_handler_args args ) +extern "C" void epicsStdCall ca_test_event ( struct event_handler_args args ) { chtype nativeType = ca_field_type ( args.chid ); const char * pNativeTypeName = ""; @@ -47,7 +47,7 @@ extern "C" void epicsShareAPI ca_test_event ( struct event_handler_args args ) * ca_dump_dbr() * dump the specified dbr type to stdout */ -extern "C" void epicsShareAPI ca_dump_dbr ( +extern "C" void epicsStdCall ca_dump_dbr ( chtype type, unsigned count, const void * pbuffer ) { unsigned i; diff --git a/modules/ca/src/client/udpiiu.cpp b/modules/ca/src/client/udpiiu.cpp index de94f1f63..e3879bae2 100644 --- a/modules/ca/src/client/udpiiu.cpp +++ b/modules/ca/src/client/udpiiu.cpp @@ -461,7 +461,7 @@ void udpiiu :: M_repeaterTimerNotify :: repeaterRegistrationMessage ( unsigned a * * register with the repeater */ -void epicsShareAPI caRepeaterRegistrationMessage ( +void epicsStdCall caRepeaterRegistrationMessage ( SOCKET sock, unsigned repeaterPort, unsigned attemptNumber ) { osiSockAddr saddr; @@ -578,7 +578,7 @@ void epicsShareAPI caRepeaterRegistrationMessage ( * * 072392 - problem solved by using SO_REUSEADDR */ -void epicsShareAPI caStartRepeaterIfNotInstalled ( unsigned repeaterPort ) +void epicsStdCall caStartRepeaterIfNotInstalled ( unsigned repeaterPort ) { bool installed = false; int status; diff --git a/modules/ca/src/client/udpiiu.h b/modules/ca/src/client/udpiiu.h index 00e415622..47ad4088d 100644 --- a/modules/ca/src/client/udpiiu.h +++ b/modules/ca/src/client/udpiiu.h @@ -41,9 +41,9 @@ extern "C" void cacRecvThreadUDP ( void *pParam ); -LIBCA_API void epicsShareAPI caStartRepeaterIfNotInstalled ( +LIBCA_API void epicsStdCall caStartRepeaterIfNotInstalled ( unsigned repeaterPort ); -LIBCA_API void epicsShareAPI caRepeaterRegistrationMessage ( +LIBCA_API void epicsStdCall caRepeaterRegistrationMessage ( SOCKET sock, unsigned repeaterPort, unsigned attemptNumber ); extern "C" LIBCA_API void caRepeaterThread ( void * pDummy ); From 809fb88fa28a55fc8798df887ecf8ae5a96a8d9c Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 11 Mar 2020 21:19:11 -0500 Subject: [PATCH 099/216] Document _API = for Makefiles --- src/tools/makeAPIheader.pl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/tools/makeAPIheader.pl b/src/tools/makeAPIheader.pl index cb7fde97d..db118b022 100644 --- a/src/tools/makeAPIheader.pl +++ b/src/tools/makeAPIheader.pl @@ -65,14 +65,15 @@ example the stem used in the example here is C: # Generate our library API header file API_HEADER += libComAPI.h -Lower down in the RULES section of the same Makefile (below the line that -says C), add another line like this: +The Makefile also needs to find the API stem given the name of the library. +These may be different, as shown in our example since the libCom API actually +gets used by a library whose formal name is just "Com". This relationship is +indicated by setting the C variable to the API stem, like this: - # Set the API Building flag while we are building the code - $(LIBNAME) $(SHRLIBNAME): USR_CPPFLAGS += -DBUILDING_libCom_API - -For your library replace the string C in the last word above with -the stem from your header filename. + # Library to build: + LIBRARY = Com + # API stem for the Com library + Com_API = libCom Then in each header file that declares a function, global variable or C++ class or method to be exported by the library, decorate those declarations From d38ede55c5304f3d934cb7049f015f534768792b Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 11 Mar 2020 22:37:02 -0500 Subject: [PATCH 100/216] More generator doc updates --- src/tools/makeAPIheader.pl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/tools/makeAPIheader.pl b/src/tools/makeAPIheader.pl index db118b022..db043d8cb 100644 --- a/src/tools/makeAPIheader.pl +++ b/src/tools/makeAPIheader.pl @@ -53,6 +53,11 @@ library implementation code to define the C macro in between the import and export headers. The order of including header files no longer matters when using this approach. +For libraries that contain EPICS record, device, driver or link support and use +the epicsExport.h macros to publish the associated support entry table for the +IOC to locate, switching from shareLib.h to a generated API header file is not +recommended. The old approach is simpler in these cases. + =head1 USING WITH EPICS In a Makefile that is building a DLL or shared library, set the variable @@ -76,8 +81,9 @@ indicated by setting the C variable to the API stem, like this: Com_API = libCom Then in each header file that declares a function, global variable or C++ -class or method to be exported by the library, decorate those declarations -with the all-uppercase keyword C as in these examples: +class or method to be exported by the library, include the generated header +file and then decorate those declarations with the all-uppercase keyword +C as in these examples: LIBCOM_API void epicsExit(int status); LIBCOM_API int asCheckClientIP; From b4625a0c1fd271c0ac214597d43a43b6f26d30ca Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 12 Mar 2020 13:49:55 -0500 Subject: [PATCH 101/216] Fix osiSockTest on VxWorks --- modules/libcom/test/osiSockTest.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/libcom/test/osiSockTest.c b/modules/libcom/test/osiSockTest.c index 39777fc10..6150370bd 100644 --- a/modules/libcom/test/osiSockTest.c +++ b/modules/libcom/test/osiSockTest.c @@ -70,8 +70,9 @@ void udpSockTest(void) multiCastLoop(s, 1); multiCastLoop(s, 0); + /* Defaults to 1, setting to 0 makes no sense */ + multiCastTTL(s, 2); multiCastTTL(s, 1); - multiCastTTL(s, 0); epicsSocketDestroy(s); } From 0f35d0c3f9d5e2c68655a47b4e7af4efe460d662 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 12 Mar 2020 13:59:41 -0500 Subject: [PATCH 102/216] Improve epicsEventTest delay checks --- modules/libcom/test/epicsEventTest.cpp | 33 ++++++++++++++------------ 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/modules/libcom/test/epicsEventTest.cpp b/modules/libcom/test/epicsEventTest.cpp index b3e48f8f2..c58e57c11 100644 --- a/modules/libcom/test/epicsEventTest.cpp +++ b/modules/libcom/test/epicsEventTest.cpp @@ -154,31 +154,34 @@ static void eventWakeupTest(void) } // extern "C" -static double eventWaitMeasureDelayError( const epicsEventId &id, const double & delay ) +static double eventWaitCheckDelayError( const epicsEventId &id, const double & delay ) { + epicsEventWaitWithTimeout ( id, 0.000001 ); + epicsTime beg = epicsTime::getMonotonic(); epicsEventWaitWithTimeout ( id, delay ); epicsTime end = epicsTime::getMonotonic(); double meas = end - beg; - double error = fabs ( delay - meas ); - testDiag("epicsEventWaitWithTimeout(%.6f) delay error %.6f sec", - delay, error ); - return error; + double error = meas - delay; + testOk(error >= 0, "epicsEventWaitWithTimeout(%.6f) delay error %.6f sec", + delay, error); + return fabs(error); } +#define WAITCOUNT 21 static void eventWaitTest() { - double errorSum = 0.0; - epicsEventId event = epicsEventMustCreate ( epicsEventEmpty ); - int i; - for ( i = 0u; i < 20; i++ ) { + epicsEventId event = epicsEventMustCreate(epicsEventEmpty); + double errorSum = eventWaitCheckDelayError(event, 0.0); + + for (int i = 0; i < WAITCOUNT - 1; i++) { double delay = ldexp ( 1.0 , -i ); - errorSum += eventWaitMeasureDelayError ( event, delay ); + errorSum += eventWaitCheckDelayError ( event, delay ); } - errorSum += eventWaitMeasureDelayError ( event, 0.0 ); - epicsEventDestroy ( event ); - double meanError = errorSum / ( i + 1 ); - testOk(meanError < 0.05, "Average error %.6f sec", meanError); + double meanError = errorSum / WAITCOUNT; + testOk(meanError < 0.05, "Mean delay error was %.6f sec", meanError); + + epicsEventDestroy(event); } @@ -190,7 +193,7 @@ MAIN(epicsEventTest) epicsEventId event; int status; - testPlan(13+SLEEPERCOUNT); + testPlan(13 + SLEEPERCOUNT + WAITCOUNT); event = epicsEventMustCreate(epicsEventEmpty); From 25bb966cbc4be1f2a47116a8b9ec940bc2270b12 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 14 Mar 2020 16:19:26 -0500 Subject: [PATCH 103/216] Use the dbChannel*() accessor macros in the array filter code instead of exposing the dbChannel innards unnecessarily. --- modules/database/src/std/filters/arr.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/database/src/std/filters/arr.c b/modules/database/src/std/filters/arr.c index 0bd73e295..f91708a11 100644 --- a/modules/database/src/std/filters/arr.c +++ b/modules/database/src/std/filters/arr.c @@ -99,7 +99,7 @@ static db_field_log* filter(void* pvt, dbChannel *chan, db_field_log *pfl) long end = my->end; long nTarget = 0; long offset = 0; - long nSource = chan->addr.no_elements; + long nSource = dbChannelElements(chan); long capacity = nSource; void *pdst; @@ -110,12 +110,12 @@ static db_field_log* filter(void* pvt, dbChannel *chan, db_field_log *pfl) case dbfl_type_rec: /* Extract from record */ - if (chan->addr.special == SPC_DBADDR && + if (dbChannelSpecial(chan) == SPC_DBADDR && nSource > 1 && (prset = dbGetRset(&chan->addr)) && prset->get_array_info) { - void *pfieldsave = chan->addr.pfield; + void *pfieldsave = dbChannelField(chan); prec = dbChannelRecord(chan); dbScanLock(prec); prset->get_array_info(&chan->addr, &nSource, &offset); @@ -124,22 +124,22 @@ static db_field_log* filter(void* pvt, dbChannel *chan, db_field_log *pfl) pfl->stat = prec->stat; pfl->sevr = prec->sevr; pfl->time = prec->time; - pfl->field_type = chan->addr.field_type; - pfl->field_size = chan->addr.field_size; + pfl->field_type = dbChannelFieldType(chan); + pfl->field_size = dbChannelFieldSize(chan); pfl->no_elements = nTarget; if (nTarget) { pdst = freeListCalloc(my->arrayFreeList); if (pdst) { pfl->u.r.dtor = freeArray; pfl->u.r.pvt = my->arrayFreeList; - offset = (offset + start) % chan->addr.no_elements; + offset = (offset + start) % dbChannelElements(chan); dbExtractArrayFromRec(&chan->addr, pdst, nTarget, capacity, offset, my->incr); pfl->u.r.field = pdst; } } dbScanUnlock(prec); - chan->addr.pfield = pfieldsave; + dbChannelField(chan) = pfieldsave; } break; From 5f1b3a541975953f09243c237776077d524b4801 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 20 Mar 2020 11:33:39 -0500 Subject: [PATCH 104/216] Extend RULES_EXPAND to add more features * Use EXPAND_COMMON for architecture-independent templates, generated in the O.Common directory instead of O.$(T_A). * Add EXPAND_ME to name Makefile variables to be added without having to provide a value (permits spaces in value too). * Comments in RULES_EXPAND describe how to use these rules. --- configure/RULES_EXPAND | 57 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 7 deletions(-) diff --git a/configure/RULES_EXPAND b/configure/RULES_EXPAND index f315a7e9e..2fce30de1 100644 --- a/configure/RULES_EXPAND +++ b/configure/RULES_EXPAND @@ -12,28 +12,72 @@ vpath %@ $(USR_VPATH) $(ALL_SRC_DIRS) #--------------------------------------------------------------- -# Variable expansion +# Template variable expansion + +# This feature allows you to instantiate simple template files at +# build-time, replacing macros spelled @NAME@ with values provided +# by the Makefile. The template filename must end with an @ sign, +# which is removed to create the expanded filename. + +# Makefiles can use this variable expansion as follows: +# +# 1. Add the template filename (with the trailing @ sign) to either +# the EXPAND or EXPAND_COMMON variable, for example: +# EXPAND_COMMON += myVersion.h@ +# Use EXPAND_COMMON for templates that don't depend on the +# target architecture (these will be generated in O.Common). +# 2. There are 2 ways of defining template macros. The simplest +# is to add a NAME=VALUE string to the EXPAND_VARS variable for +# the desired macros, e.g.: +# EXPAND_VARS += MY_MAJOR_VERSION=$(MY_MAJOR_VERSION) +# EXPAND_VARS += MY_MINOR_VERSION=$(MY_MINOR_VERSION) +# These values may not contain spaces, even if inside quotes. +# 3. A better way in the above case is to add the names of any +# Makefile variables that should be provided as macros to the +# variable EXPAND_ME, like this: +# EXPAND_ME += MY_MAJOR_VERSION +# EXPAND_ME += MY_MINOR_VERSION +# The values of these variables may contain spaces. +# 4. The macros TOP and ARCH will be set by the build system. +# TOP is the value of $(INSTALL_LOCATION) for this module. +# ARCH is the target architecture $(T_A), but is only set +# while expanding files in EXPAND +# 5. Add the expanded filename to some other variable that will +# cause it to be created and used, such as INC here: +# INC += myVersion.h # Default settings EXPAND_TOOL ?= $(PERL) $(TOOLS)/expandVars.pl -EXPANDFLAGS += -t $(INSTALL_LOCATION) -a $(T_A) -EXPANDFLAGS += $(addprefix -D ,$(EXPAND_VARS)) +EXPANDARCH = -a $(T_A) +EXPANDFLAGS += -t $(INSTALL_LOCATION) +EXPANDFLAGS += $(addprefix -D ,$(EXPAND_VARS) $($@_EXPAND_VARS)) +EXPANDFLAGS += $(foreach var, $(EXPAND_ME) $($@_EXPAND_ME), \ + -D$(var)="$(strip $($(var)))") # The names of files to be expanded must end with '@' EXPANDED = $(EXPAND:%@=%) +EXPANDED_COM = $(EXPAND_COMMON:%@=%) +EXPANDED_COMMON = $(EXPANDED_COM:%=$(COMMON_DIR)/%) $(EXPANDED): %: %@ $(ECHO) "Expanding $< to $@" @$(RM) $@ - @$(EXPAND_TOOL) $(EXPANDFLAGS) $($@_EXPANDFLAGS) $< $@ + $(EXPAND_TOOL) $(EXPANDARCH) $(EXPANDFLAGS) $($@_EXPANDFLAGS) $< $@ + +$(EXPANDED_COM): %: %@ + $(ECHO) "Expanding $< to $(COMMON_DIR)/$@" + @$(RM) $@ + $(EXPAND_TOOL) $(EXPANDFLAGS) $($@_EXPANDFLAGS) $< $@ +$(EXPANDED_COMMON): $(COMMON_DIR)/%: % + @$(MV) $< $@ clean: expand_clean expand_clean: - @$(RM) $(EXPANDED) + @$(RM) $(EXPANDED) $(EXPANDED_COMMON) -.PRECIOUS: $(EXPANDED) +.PRECIOUS: $(EXPANDED) $(EXPANDED_COMMON) .PHONY: expand_clean #--------------------------------------------------------------- @@ -70,4 +114,3 @@ $1$(DEP): endef $(foreach asy, $(sort $(COMMON_ASSEMBLIES) $(ASSEMBLIES)), \ $(eval $(call ASSEMBLY_DEP_template,$(strip $(asy))))) - From 5009f288ae9777484eb62ce3f3be4331e71e6148 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 20 Mar 2020 11:42:44 -0500 Subject: [PATCH 105/216] Generate module version files with new RULES_EXPAND facilities Also removes the separate *VersionNum.h@ templates --- modules/ca/src/client/Makefile | 21 +++++---------- .../src/client/{caVersion.h => caVersion.h@} | 15 +++++------ modules/ca/src/client/caVersionNum.h@ | 7 ----- modules/database/src/ioc/Makefile | 22 +++++---------- .../{databaseVersion.h => databaseVersion.h@} | 26 +++++++----------- .../database/src/ioc/databaseVersionNum.h@ | 7 ----- modules/database/test/std/rec/dbHeaderTest.c | 5 +--- modules/libcom/src/Makefile | 20 +++++--------- .../src/{libComVersion.h => libComVersion.h@} | 27 +++++++------------ modules/libcom/src/libComVersionNum.h@ | 7 ----- 10 files changed, 48 insertions(+), 109 deletions(-) rename modules/ca/src/client/{caVersion.h => caVersion.h@} (68%) delete mode 100644 modules/ca/src/client/caVersionNum.h@ rename modules/database/src/ioc/{databaseVersion.h => databaseVersion.h@} (50%) delete mode 100644 modules/database/src/ioc/databaseVersionNum.h@ rename modules/libcom/src/{libComVersion.h => libComVersion.h@} (50%) delete mode 100644 modules/libcom/src/libComVersionNum.h@ diff --git a/modules/ca/src/client/Makefile b/modules/ca/src/client/Makefile index 57d113e6b..5b5874aee 100644 --- a/modules/ca/src/client/Makefile +++ b/modules/ca/src/client/Makefile @@ -26,7 +26,13 @@ INC += cacIO.h INC += caDiagnostics.h INC += net_convert.h INC += caVersion.h -INC += caVersionNum.h + +EXPAND_COMMON += caVersion.h@ + +EXPAND_ME += EPICS_CA_MAJOR_VERSION +EXPAND_ME += EPICS_CA_MINOR_VERSION +EXPAND_ME += EPICS_CA_MAINTENANCE_VERSION +EXPAND_ME += EPICS_CA_DEVELOPMENT_FLAG LIBSRCS += cac.cpp LIBSRCS += cacChannel.cpp @@ -120,20 +126,7 @@ ca_test_SYS_LIBS_WIN32 = ws2_32 advapi32 user32 OBJS_vxWorks += ca_test -EXPANDVARS += EPICS_CA_MAJOR_VERSION -EXPANDVARS += EPICS_CA_MINOR_VERSION -EXPANDVARS += EPICS_CA_MAINTENANCE_VERSION -EXPANDVARS += EPICS_CA_DEVELOPMENT_FLAG - -EXPANDFLAGS += $(foreach var,$(EXPANDVARS),-D$(var)="$(strip $($(var)))") - # shared library ABI version. SHRLIB_VERSION = $(EPICS_CA_MAJOR_VERSION).$(EPICS_CA_MINOR_VERSION).$(EPICS_CA_MAINTENANCE_VERSION) include $(TOP)/configure/RULES - - -# Can't use EXPAND as generated headers must appear -# in O.Common, but EXPAND emits rules for O.$(T_A) -../O.Common/caVersionNum.h: ../caVersionNum.h@ - $(EXPAND_TOOL) $(EXPANDFLAGS) $($@_EXPANDFLAGS) $< $@ diff --git a/modules/ca/src/client/caVersion.h b/modules/ca/src/client/caVersion.h@ similarity index 68% rename from modules/ca/src/client/caVersion.h rename to modules/ca/src/client/caVersion.h@ index 9dda32c60..f9225c53a 100644 --- a/modules/ca/src/client/caVersion.h +++ b/modules/ca/src/client/caVersion.h@ @@ -8,17 +8,14 @@ #ifndef INC_caVersion_H #define INC_caVersion_H -#include +#define EPICS_CA_MAJOR_VERSION @EPICS_CA_MAJOR_VERSION@ +#define EPICS_CA_MINOR_VERSION @EPICS_CA_MINOR_VERSION@ +#define EPICS_CA_MAINTENANCE_VERSION @EPICS_CA_MAINTENANCE_VERSION@ +#define EPICS_CA_DEVELOPMENT_FLAG @EPICS_CA_DEVELOPMENT_FLAG@ -/* include generated headers with: - * EPICS_CA_MAJOR_VERSION - * EPICS_CA_MINOR_VERSION - * EPICS_CA_MAINTENANCE_VERSION - * EPICS_CA_DEVELOPMENT_FLAG - */ -#include "caVersionNum.h" +#include #define CA_VERSION_INT VERSION_INT(EPICS_CA_MAJOR_VERSION, \ EPICS_CA_MINOR_VERSION, EPICS_CA_MAINTENANCE_VERSION, 0) -#endif /* ifndef INC_caVersion_H */ +#endif /* INC_caVersion_H */ diff --git a/modules/ca/src/client/caVersionNum.h@ b/modules/ca/src/client/caVersionNum.h@ deleted file mode 100644 index dcd7518c0..000000000 --- a/modules/ca/src/client/caVersionNum.h@ +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef INC_caVersion_H -# error include caVersion.h, not this header -#endif -#define EPICS_CA_MAJOR_VERSION @EPICS_CA_MAJOR_VERSION@ -#define EPICS_CA_MINOR_VERSION @EPICS_CA_MINOR_VERSION@ -#define EPICS_CA_MAINTENANCE_VERSION @EPICS_CA_MAINTENANCE_VERSION@ -#define EPICS_CA_DEVELOPMENT_FLAG @EPICS_CA_DEVELOPMENT_FLAG@ diff --git a/modules/database/src/ioc/Makefile b/modules/database/src/ioc/Makefile index 23c9c02b6..503208862 100644 --- a/modules/database/src/ioc/Makefile +++ b/modules/database/src/ioc/Makefile @@ -23,10 +23,15 @@ dbCore_LIBS += ca Com dbCore_SYS_LIBS_WIN32 += ws2_32 dbCore_RCS += dbCore.rc -dbStaticHost_RCS = dbStaticHost.rc + +EXPAND_COMMON += databaseVersion.h@ + +EXPAND_ME += EPICS_DATABASE_MAJOR_VERSION +EXPAND_ME += EPICS_DATABASE_MINOR_VERSION +EXPAND_ME += EPICS_DATABASE_MAINTENANCE_VERSION +EXPAND_ME += EPICS_DATABASE_DEVELOPMENT_FLAG INC += databaseVersion.h -INC += databaseVersionNum.h PROD_LIBS = Com @@ -42,13 +47,6 @@ include $(IOCDIR)/rsrv/Makefile GENVERSION = epicsVCS.h GENVERSIONMACRO = EPICS_VCS_VERSION -EXPANDVARS += EPICS_DATABASE_MAJOR_VERSION -EXPANDVARS += EPICS_DATABASE_MINOR_VERSION -EXPANDVARS += EPICS_DATABASE_MAINTENANCE_VERSION -EXPANDVARS += EPICS_DATABASE_DEVELOPMENT_FLAG - -EXPANDFLAGS += $(foreach var,$(EXPANDVARS),-D$(var)="$(strip $($(var)))") - include $(TOP)/configure/RULES include $(IOCDIR)/dbStatic/RULES @@ -56,10 +54,4 @@ include $(IOCDIR)/bpt/RULES include $(IOCDIR)/db/RULES include $(IOCDIR)/dbtemplate/RULES -# Can't use EXPAND as generated headers must appear -# in O.Common, but EXPAND emits rules for O.$(T_A) -../O.Common/databaseVersionNum.h: ../databaseVersionNum.h@ - $(MKDIR) $(COMMON_DIR) - $(EXPAND_TOOL) $(EXPANDFLAGS) $($@_EXPANDFLAGS) $< $@ - epicsRelease$(DEP): $(COMMON_DIR)/$(GENVERSION) diff --git a/modules/database/src/ioc/databaseVersion.h b/modules/database/src/ioc/databaseVersion.h@ similarity index 50% rename from modules/database/src/ioc/databaseVersion.h rename to modules/database/src/ioc/databaseVersion.h@ index eb5e4d732..efd837b26 100644 --- a/modules/database/src/ioc/databaseVersion.h +++ b/modules/database/src/ioc/databaseVersion.h@ @@ -5,23 +5,17 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -#ifndef DATABASEVERSION_H -#define DATABASEVERSION_H +#ifndef INC_databaseVersion_H +#define INC_databaseVersion_H + +#define EPICS_DATABASE_MAJOR_VERSION @EPICS_DATABASE_MAJOR_VERSION@ +#define EPICS_DATABASE_MINOR_VERSION @EPICS_DATABASE_MINOR_VERSION@ +#define EPICS_DATABASE_MAINTENANCE_VERSION @EPICS_DATABASE_MAINTENANCE_VERSION@ +#define EPICS_DATABASE_DEVELOPMENT_FLAG @EPICS_DATABASE_DEVELOPMENT_FLAG@ #include -#ifndef VERSION_INT -# define VERSION_INT(V,R,M,P) ( ((V)<<24) | ((R)<<16) | ((M)<<8) | (P)) -#endif +#define DATABASE_VERSION_INT VERSION_INT(EPICS_DATABASE_MAJOR_VERSION, \ + EPICS_DATABASE_MINOR_VERSION, EPICS_DATABASE_MAINTENANCE_VERSION, 0) -/* include generated headers with: - * EPICS_DATABASE_MAJOR_VERSION - * EPICS_DATABASE_MINOR_VERSION - * EPICS_DATABASE_MAINTENANCE_VERSION - * EPICS_DATABASE_DEVELOPMENT_FLAG - */ -#include "databaseVersionNum.h" - -#define DATABASE_VERSION_INT VERSION_INT(EPICS_DATABASE_MAJOR_VERSION, EPICS_DATABASE_MINOR_VERSION, EPICS_DATABASE_MAINTENANCE_VERSION, 0) - -#endif // DATABASEVERSION_H +#endif /* INC_databaseVersion_H */ diff --git a/modules/database/src/ioc/databaseVersionNum.h@ b/modules/database/src/ioc/databaseVersionNum.h@ deleted file mode 100644 index 02184a81b..000000000 --- a/modules/database/src/ioc/databaseVersionNum.h@ +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef DATABASEVERSION_H -# error include databaseVersion.h, not this header -#endif -#define EPICS_DATABASE_MAJOR_VERSION @EPICS_DATABASE_MAJOR_VERSION@ -#define EPICS_DATABASE_MINOR_VERSION @EPICS_DATABASE_MINOR_VERSION@ -#define EPICS_DATABASE_MAINTENANCE_VERSION @EPICS_DATABASE_MAINTENANCE_VERSION@ -#define EPICS_DATABASE_DEVELOPMENT_FLAG @EPICS_DATABASE_DEVELOPMENT_FLAG@ diff --git a/modules/database/test/std/rec/dbHeaderTest.c b/modules/database/test/std/rec/dbHeaderTest.c index 0e2785a8f..a88e2213b 100644 --- a/modules/database/test/std/rec/dbHeaderTest.c +++ b/modules/database/test/std/rec/dbHeaderTest.c @@ -5,7 +5,7 @@ \*************************************************************************/ /* This test includes all public headers from libCom and database modules - * to ensure they are all syntaxtically correct in C and C++ + * to ensure they are all syntaxtically correct in both C and C++ */ #include @@ -31,14 +31,12 @@ #include #include #include -#include #include #include #include #include #include #include -#include #include #include #include @@ -152,7 +150,6 @@ #endif #include #include -#include #include #ifdef __cplusplus # include diff --git a/modules/libcom/src/Makefile b/modules/libcom/src/Makefile index f90fde6a6..ffc36445e 100644 --- a/modules/libcom/src/Makefile +++ b/modules/libcom/src/Makefile @@ -16,8 +16,14 @@ include $(TOP)/configure/CONFIG INC += valgrind/valgrind.h +EXPAND_COMMON = libComVersion.h@ + +EXPAND_ME += EPICS_LIBCOM_MAJOR_VERSION +EXPAND_ME += EPICS_LIBCOM_MINOR_VERSION +EXPAND_ME += EPICS_LIBCOM_MAINTENANCE_VERSION +EXPAND_ME += EPICS_LIBCOM_DEVELOPMENT_FLAG + INC += libComVersion.h -INC += libComVersionNum.h include $(LIBCOM)/as/Makefile include $(LIBCOM)/bucketLib/Makefile @@ -61,13 +67,6 @@ ifeq ($(T_A),$(EPICS_HOST_ARCH)) DELAY_INSTALL_LIBS = YES endif -EXPANDVARS += EPICS_LIBCOM_MAJOR_VERSION -EXPANDVARS += EPICS_LIBCOM_MINOR_VERSION -EXPANDVARS += EPICS_LIBCOM_MAINTENANCE_VERSION -EXPANDVARS += EPICS_LIBCOM_DEVELOPMENT_FLAG - -EXPANDFLAGS += $(foreach var,$(EXPANDVARS),-D$(var)="$(strip $($(var)))") - # shared library ABI version. SHRLIB_VERSION = $(EPICS_LIBCOM_MAJOR_VERSION).$(EPICS_LIBCOM_MINOR_VERSION).$(EPICS_LIBCOM_MAINTENANCE_VERSION) @@ -80,8 +79,3 @@ include $(LIBCOM)/flex/RULES include $(LIBCOM)/misc/RULES include $(LIBCOM)/osi/RULES include $(LIBCOM)/yajl/RULES - -# Can't use EXPAND as generated headers must appear -# in O.Common, but EXPAND emits rules for O.$(T_A) -../O.Common/libComVersionNum.h: ../libComVersionNum.h@ - $(EXPAND_TOOL) $(EXPANDFLAGS) $($@_EXPANDFLAGS) $< $@ diff --git a/modules/libcom/src/libComVersion.h b/modules/libcom/src/libComVersion.h@ similarity index 50% rename from modules/libcom/src/libComVersion.h rename to modules/libcom/src/libComVersion.h@ index 60537f9c2..0db39b142 100644 --- a/modules/libcom/src/libComVersion.h +++ b/modules/libcom/src/libComVersion.h@ @@ -5,24 +5,17 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -#ifndef LIBCOMVERSION_H -#define LIBCOMVERSION_H +#ifndef INC_libComVersion_H +#define INC_libComVersion_H + +#define EPICS_LIBCOM_MAJOR_VERSION @EPICS_LIBCOM_MAJOR_VERSION@ +#define EPICS_LIBCOM_MINOR_VERSION @EPICS_LIBCOM_MINOR_VERSION@ +#define EPICS_LIBCOM_MAINTENANCE_VERSION @EPICS_LIBCOM_MAINTENANCE_VERSION@ +#define EPICS_LIBCOM_DEVELOPMENT_FLAG @EPICS_LIBCOM_DEVELOPMENT_FLAG@ #include -#include -#ifndef VERSION_INT -# define VERSION_INT(V,R,M,P) ( ((V)<<24) | ((R)<<16) | ((M)<<8) | (P)) -#endif +#define LIBCOM_VERSION_INT VERSION_INT(EPICS_LIBCOM_MAJOR_VERSION, \ + EPICS_LIBCOM_MINOR_VERSION, EPICS_LIBCOM_MAINTENANCE_VERSION, 0) -/* include generated headers with: - * EPICS_LIBCOM_MAJOR_VERSION - * EPICS_LIBCOM_MINOR_VERSION - * EPICS_LIBCOM_MAINTENANCE_VERSION - * EPICS_LIBCOM_DEVELOPMENT_FLAG - */ -#include "libComVersionNum.h" - -#define LIBCOM_VERSION_INT VERSION_INT(EPICS_LIBCOM_MAJOR_VERSION, EPICS_LIBCOM_MINOR_VERSION, EPICS_LIBCOM_MAINTENANCE_VERSION, 0) - -#endif // LIBCOMVERSION_H +#endif /* INC_libComVersion_H */ diff --git a/modules/libcom/src/libComVersionNum.h@ b/modules/libcom/src/libComVersionNum.h@ deleted file mode 100644 index 3b340cc8f..000000000 --- a/modules/libcom/src/libComVersionNum.h@ +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef LIBCOMVERSION_H -# error include libComVersion.h, not this header -#endif -#define EPICS_LIBCOM_MAJOR_VERSION @EPICS_LIBCOM_MAJOR_VERSION@ -#define EPICS_LIBCOM_MINOR_VERSION @EPICS_LIBCOM_MINOR_VERSION@ -#define EPICS_LIBCOM_MAINTENANCE_VERSION @EPICS_LIBCOM_MAINTENANCE_VERSION@ -#define EPICS_LIBCOM_DEVELOPMENT_FLAG @EPICS_LIBCOM_DEVELOPMENT_FLAG@ From 46fa31020ed4c5d3e4055eb63e4e34ecd341ba0c Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 9 Mar 2020 09:02:31 -0700 Subject: [PATCH 106/216] Com: (WIN32) fix handling of thread joinable flag and refcnt Analogous changes for windows cf. 02a24a144d0c062311212c769926c1e2df5a1a52 --- modules/libcom/src/osi/os/WIN32/osdThread.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/modules/libcom/src/osi/os/WIN32/osdThread.c b/modules/libcom/src/osi/os/WIN32/osdThread.c index 5b498a7ea..455d97b64 100644 --- a/modules/libcom/src/osi/os/WIN32/osdThread.c +++ b/modules/libcom/src/osi/os/WIN32/osdThread.c @@ -54,7 +54,7 @@ typedef struct epicsThreadOSD { DWORD id; unsigned epicsPriority; char isSuspended; - char joinable; + int joinable; } win32ThreadParam; typedef struct epicsThreadPrivateOSD { @@ -577,6 +577,10 @@ epicsThreadId epicsThreadCreateOpt ( pParmWIN32->funptr = pFunc; pParmWIN32->parm = pParm; pParmWIN32->epicsPriority = opts->priority; + if(opts->joinable) { + pParmWIN32->joinable = 1; + epicsAtomicIncrIntT(&pParmWIN32->refcnt); + } { unsigned threadId; @@ -615,11 +619,6 @@ epicsThreadId epicsThreadCreateOpt ( return NULL; } - if(opts->joinable) { - pParmWIN32->joinable = 1; - epicsAtomicIncrIntT(&pParmWIN32->refcnt); - } - return ( epicsThreadId ) pParmWIN32; } @@ -629,7 +628,7 @@ void epicsThreadMustJoin(epicsThreadId id) if(!id) { /* no-op */ - } else if(!pParmWIN32->joinable) { + } else if(epicsAtomicCmpAndSwapIntT(&id->joinable, 1, 0)!=1) { if(epicsThreadGetIdSelf()==id) { fprintf(stderr, "Warning: %s thread self-join of unjoinable\n", pParmWIN32->pName); @@ -640,7 +639,6 @@ void epicsThreadMustJoin(epicsThreadId id) */ cantProceed("Error: %s thread not joinable.\n", pParmWIN32->pName); } - return; } else if(epicsThreadGetIdSelf() != id) { DWORD status = WaitForSingleObject(pParmWIN32->handle, INFINITE); @@ -648,11 +646,9 @@ void epicsThreadMustJoin(epicsThreadId id) /* TODO: signal error? */ } - pParmWIN32->joinable = 0; epicsParmCleanupWIN32(pParmWIN32); } else { /* join self silently does nothing */ - pParmWIN32->joinable = 0; epicsParmCleanupWIN32(pParmWIN32); } } From bac8851132b28579dd9d85a3f0deed08f8d9a0b1 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 23 Mar 2020 18:22:16 -0700 Subject: [PATCH 107/216] Revert "asCaStop() join worker thread" This reverts commit afc31f2f064974e97ef61a9dc6cc58692a1b0a5f. # Conflicts: # modules/database/src/ioc/as/asCa.c --- modules/database/src/ioc/as/asCa.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/modules/database/src/ioc/as/asCa.c b/modules/database/src/ioc/as/asCa.c index 21bb47f5f..d0180448b 100644 --- a/modules/database/src/ioc/as/asCa.c +++ b/modules/database/src/ioc/as/asCa.c @@ -229,23 +229,20 @@ static void asCaTask(void) void asCaStart(void) { - epicsThreadOpts opts = EPICS_THREAD_OPTS_INIT; - - opts.stackSize = epicsThreadGetStackSize(epicsThreadStackBig); - opts.priority = epicsThreadPriorityScanLow - 3; - opts.joinable = 1; - if(asCaDebug) printf("asCaStart called\n"); if(firstTime) { - firstTime = FALSE; + firstTime = FALSE; asCaTaskLock=epicsMutexMustCreate(); asCaTaskWait=epicsEventMustCreate(epicsEventEmpty); asCaTaskAddChannels=epicsEventMustCreate(epicsEventEmpty); asCaTaskClearChannels=epicsEventMustCreate(epicsEventEmpty); - threadid = epicsThreadCreateOpt("asCaTask", (EPICSTHREADFUNC)asCaTask, 0, &opts); - if(threadid==0) { - errMessage(0,"asCaStart: taskSpawn Failure\n"); - } + threadid = epicsThreadCreate("asCaTask", + (epicsThreadPriorityScanLow - 3), + epicsThreadGetStackSize(epicsThreadStackBig), + (EPICSTHREADFUNC)asCaTask,0); + if(threadid==0) { + errMessage(0,"asCaStart: taskSpawn Failure\n"); + } } epicsMutexMustLock(asCaTaskLock); epicsEventSignal(asCaTaskAddChannels); @@ -263,8 +260,6 @@ void asCaStop(void) epicsEventMustWait(asCaTaskWait); if(asCaDebug) printf("asCaStop done\n"); epicsMutexUnlock(asCaTaskLock); - epicsThreadMustJoin(threadid); - threadid = 0; } int ascar(int level) { return ascarFP(stdout,level);} From a8b2bc5c3bbc50b04f1172c35fb763d5d102255b Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 23 Mar 2020 18:24:44 -0700 Subject: [PATCH 108/216] asCa.c normalize indentation whitespace only --- modules/database/src/ioc/as/asCa.c | 208 ++++++++++++++--------------- 1 file changed, 104 insertions(+), 104 deletions(-) diff --git a/modules/database/src/ioc/as/asCa.c b/modules/database/src/ioc/as/asCa.c index d0180448b..b64a6ddc0 100644 --- a/modules/database/src/ioc/as/asCa.c +++ b/modules/database/src/ioc/as/asCa.c @@ -52,7 +52,7 @@ typedef struct { struct dbr_sts_double rtndata; chid chid; } CAPVT; - + static void exceptionCallback(struct exception_handler_args args) { chid chid = args.chid; @@ -77,14 +77,14 @@ static void exceptionCallback(struct exception_handler_args args) writeAccess = (chid ? ca_write_access(chid) : 0); errlogPrintf("dbCa:exceptionCallback stat \"%s\" channel \"%s\"" - " context \"%s\"\n" - " nativeType %s requestType %s" - " nativeCount %ld requestCount %ld %s %s\n", - ca_message(stat),channel,context, - nativeType,requestType, - nativeCount,requestCount, - (readAccess ? "readAccess" : "noReadAccess"), - (writeAccess ? "writeAccess" : "noWriteAccess")); + " context \"%s\"\n" + " nativeType %s requestType %s" + " nativeCount %ld requestCount %ld %s %s\n", + ca_message(stat),channel,context, + nativeType,requestType, + nativeCount,requestCount, + (readAccess ? "readAccess" : "noReadAccess"), + (writeAccess ? "writeAccess" : "noWriteAccess")); } /*connectCallback only handles disconnects*/ @@ -95,13 +95,13 @@ static void connectCallback(struct connection_handler_args arg) ASG *pasg = pasginp->pasg; if(ca_state(chid)!=cs_conn) { - if(!(pasg->inpBad & (1<inpIndex))) { - /*was good so lets make it bad*/ - pasg->inpBad |= (1<inpIndex); - if(!caInitializing) asComputeAsg(pasg); - if(asCaDebug) printf("as connectCallback disconnect %s\n", - ca_name(chid)); - } + if(!(pasg->inpBad & (1<inpIndex))) { + /*was good so lets make it bad*/ + pasg->inpBad |= (1<inpIndex); + if(!caInitializing) asComputeAsg(pasg); + if(asCaDebug) printf("as connectCallback disconnect %s\n", + ca_name(chid)); + } } } @@ -115,52 +115,52 @@ static void eventCallback(struct event_handler_args arg) const struct dbr_sts_double *pdata; if(caStatus!=ECA_NORMAL) { - if(chid) { - epicsPrintf("asCa: eventCallback error %s channel %s\n", - ca_message(caStatus),ca_name(chid)); - } else { - epicsPrintf("asCa: eventCallback error %s chid is null\n", - ca_message(caStatus)); - } - return; + if(chid) { + epicsPrintf("asCa: eventCallback error %s channel %s\n", + ca_message(caStatus),ca_name(chid)); + } else { + epicsPrintf("asCa: eventCallback error %s chid is null\n", + ca_message(caStatus)); + } + return; } pasg = pasginp->pasg; pcapvt = (CAPVT *)pasginp->capvt; if(chid!=pcapvt->chid) { - epicsPrintf("asCa: eventCallback error pcapvt->chid != arg.chid\n"); - return; + epicsPrintf("asCa: eventCallback error pcapvt->chid != arg.chid\n"); + return; } if(ca_state(chid)!=cs_conn || !ca_read_access(chid)) { - if(!(pasg->inpBad & (1<inpIndex))) { - /*was good so lets make it bad*/ - pasg->inpBad |= (1<inpIndex); - if(!caInitializing) asComputeAsg(pasg); - if(asCaDebug) { - printf("as eventCallback %s inpBad ca_state %d" - " ca_read_access %d\n", - ca_name(chid),ca_state(chid),ca_read_access(chid)); - } - } - return; + if(!(pasg->inpBad & (1<inpIndex))) { + /*was good so lets make it bad*/ + pasg->inpBad |= (1<inpIndex); + if(!caInitializing) asComputeAsg(pasg); + if(asCaDebug) { + printf("as eventCallback %s inpBad ca_state %d" + " ca_read_access %d\n", + ca_name(chid),ca_state(chid),ca_read_access(chid)); + } + } + return; } pdata = arg.dbr; pcapvt->rtndata = *pdata; /*structure copy*/ if(pdata->severity==INVALID_ALARM) { pasg->inpBad |= (1<inpIndex); - if(asCaDebug) - printf("as eventCallback %s inpBad because INVALID_ALARM\n", - ca_name(chid)); + if(asCaDebug) + printf("as eventCallback %s inpBad because INVALID_ALARM\n", + ca_name(chid)); } else { pasg->inpBad &= ~((1<inpIndex)); pasg->pavalue[pasginp->inpIndex] = pdata->value; - if(asCaDebug) - printf("as eventCallback %s inpGood data %f\n", - ca_name(chid),pdata->value); + if(asCaDebug) + printf("as eventCallback %s inpGood data %f\n", + ca_name(chid),pdata->value); } pasg->inpChanged |= (1<inpIndex); if(!caInitializing) asComputeAsg(pasg); } - + static void asCaTask(void) { ASG *pasg; @@ -170,79 +170,79 @@ static void asCaTask(void) taskwdInsert(epicsThreadGetIdSelf(),NULL,NULL); SEVCHK(ca_context_create(ca_enable_preemptive_callback), - "asCaTask calling ca_context_create"); + "asCaTask calling ca_context_create"); SEVCHK(ca_add_exception_event(exceptionCallback,NULL), - "ca_add_exception_event"); - while(TRUE) { + "ca_add_exception_event"); + while(TRUE) { epicsEventMustWait(asCaTaskAddChannels); - caInitializing = TRUE; - pasg = (ASG *)ellFirst(&pasbase->asgList); - while(pasg) { - pasginp = (ASGINP *)ellFirst(&pasg->inpList); - while(pasginp) { - pasg->inpBad |= (1<inpIndex); - pcapvt = pasginp->capvt = asCalloc(1,sizeof(CAPVT)); - /*Note calls connectCallback immediately for local Pvs*/ - status = ca_search_and_connect(pasginp->inp,&pcapvt->chid, - connectCallback,pasginp); - if(status!=ECA_NORMAL) { - epicsPrintf("asCa ca_search_and_connect error %s\n", - ca_message(status)); - } - /*Note calls eventCallback immediately for local Pvs*/ - status = ca_add_event(DBR_STS_DOUBLE,pcapvt->chid, - eventCallback,pasginp,0); - if(status!=ECA_NORMAL) { - epicsPrintf("asCa ca_add_event error %s\n", - ca_message(status)); - } - pasginp = (ASGINP *)ellNext((ELLNODE *)pasginp); - } - pasg = (ASG *)ellNext((ELLNODE *)pasg); - } + caInitializing = TRUE; + pasg = (ASG *)ellFirst(&pasbase->asgList); + while(pasg) { + pasginp = (ASGINP *)ellFirst(&pasg->inpList); + while(pasginp) { + pasg->inpBad |= (1<inpIndex); + pcapvt = pasginp->capvt = asCalloc(1,sizeof(CAPVT)); + /*Note calls connectCallback immediately for local Pvs*/ + status = ca_search_and_connect(pasginp->inp,&pcapvt->chid, + connectCallback,pasginp); + if(status!=ECA_NORMAL) { + epicsPrintf("asCa ca_search_and_connect error %s\n", + ca_message(status)); + } + /*Note calls eventCallback immediately for local Pvs*/ + status = ca_add_event(DBR_STS_DOUBLE,pcapvt->chid, + eventCallback,pasginp,0); + if(status!=ECA_NORMAL) { + epicsPrintf("asCa ca_add_event error %s\n", + ca_message(status)); + } + pasginp = (ASGINP *)ellNext((ELLNODE *)pasginp); + } + pasg = (ASG *)ellNext((ELLNODE *)pasg); + } SEVCHK(ca_flush_io(),"asCaTask"); - caInitializing = FALSE; - asComputeAllAsg(); - if(asCaDebug) printf("asCaTask initialized\n"); - epicsEventSignal(asCaTaskWait); + caInitializing = FALSE; + asComputeAllAsg(); + if(asCaDebug) printf("asCaTask initialized\n"); + epicsEventSignal(asCaTaskWait); epicsEventMustWait(asCaTaskClearChannels); - pasg = (ASG *)ellFirst(&pasbase->asgList); - while(pasg) { - pasginp = (ASGINP *)ellFirst(&pasg->inpList); - while(pasginp) { - pcapvt = (CAPVT *)pasginp->capvt; - status = ca_clear_channel(pcapvt->chid); - if(status!=ECA_NORMAL) { - epicsPrintf("asCa ca_clear_channel error %s\n", - ca_message(status)); - } - free(pasginp->capvt); - pasginp->capvt = 0; - pasginp = (ASGINP *)ellNext((ELLNODE *)pasginp); - } - pasg = (ASG *)ellNext((ELLNODE *)pasg); - } - if(asCaDebug) printf("asCaTask has cleared all channels\n"); - epicsEventSignal(asCaTaskWait); + pasg = (ASG *)ellFirst(&pasbase->asgList); + while(pasg) { + pasginp = (ASGINP *)ellFirst(&pasg->inpList); + while(pasginp) { + pcapvt = (CAPVT *)pasginp->capvt; + status = ca_clear_channel(pcapvt->chid); + if(status!=ECA_NORMAL) { + epicsPrintf("asCa ca_clear_channel error %s\n", + ca_message(status)); + } + free(pasginp->capvt); + pasginp->capvt = 0; + pasginp = (ASGINP *)ellNext((ELLNODE *)pasginp); + } + pasg = (ASG *)ellNext((ELLNODE *)pasg); + } + if(asCaDebug) printf("asCaTask has cleared all channels\n"); + epicsEventSignal(asCaTaskWait); } } - + void asCaStart(void) { if(asCaDebug) printf("asCaStart called\n"); if(firstTime) { - firstTime = FALSE; + firstTime = FALSE; asCaTaskLock=epicsMutexMustCreate(); asCaTaskWait=epicsEventMustCreate(epicsEventEmpty); asCaTaskAddChannels=epicsEventMustCreate(epicsEventEmpty); asCaTaskClearChannels=epicsEventMustCreate(epicsEventEmpty); threadid = epicsThreadCreate("asCaTask", - (epicsThreadPriorityScanLow - 3), - epicsThreadGetStackSize(epicsThreadStackBig), - (EPICSTHREADFUNC)asCaTask,0); - if(threadid==0) { - errMessage(0,"asCaStart: taskSpawn Failure\n"); - } + (epicsThreadPriorityScanLow - 3), + epicsThreadGetStackSize(epicsThreadStackBig), + (EPICSTHREADFUNC)asCaTask,0); + if(threadid==0) { + errMessage(0,"asCaStart: taskSpawn Failure\n"); + } } epicsMutexMustLock(asCaTaskLock); epicsEventSignal(asCaTaskAddChannels); @@ -293,8 +293,8 @@ int ascarFP(FILE *fp,int level) else if(state==cs_closed) fprintf(fp,"closed"); else fprintf(fp,"unknown"); fprintf(fp," read:%s write:%s", - (ca_read_access(chid) ? "yes" : "no "), - (ca_write_access(chid) ? "yes" : "no ")); + (ca_read_access(chid) ? "yes" : "no "), + (ca_write_access(chid) ? "yes" : "no ")); fprintf(fp," %s %s\n", ca_name(chid),ca_host_name(chid)); } pasginp = (ASGINP *)ellNext((ELLNODE *)pasginp); From 872009336e131fac0d614d904eb2e28ead3ea794 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Sun, 22 Mar 2020 22:09:23 -0700 Subject: [PATCH 109/216] OSX fix osdFindSymbol RTLD_DEFAULT isn't zero on OSX --- modules/libcom/src/osi/os/posix/osdFindSymbol.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/libcom/src/osi/os/posix/osdFindSymbol.c b/modules/libcom/src/osi/os/posix/osdFindSymbol.c index acfc405e5..084865341 100644 --- a/modules/libcom/src/osi/os/posix/osdFindSymbol.c +++ b/modules/libcom/src/osi/os/posix/osdFindSymbol.c @@ -11,6 +11,12 @@ #define epicsExportSharedSymbols #include "epicsFindSymbol.h" +/* non-POSIX extension available on Linux (glibc at least) and OSX. + */ +#ifndef RTLD_DEFAULT +# define RTLD_DEFAULT 0 +#endif + epicsShareFunc void * epicsLoadLibrary(const char *name) { return dlopen(name, RTLD_LAZY | RTLD_GLOBAL); @@ -23,5 +29,5 @@ epicsShareFunc const char *epicsLoadError(void) epicsShareFunc void * epicsShareAPI epicsFindSymbol(const char *name) { - return dlsym(0, name); + return dlsym(RTLD_DEFAULT, name); } From d3b2298bcba2050932998457dbb081917a2752df Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Sat, 21 Mar 2020 22:13:53 -0700 Subject: [PATCH 110/216] WIN32 fix epicsFindSymbol() error propagation And use thread local to hold error code/message. --- .../libcom/src/osi/os/WIN32/osdFindSymbol.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c b/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c index 6de3c428e..c7553896d 100644 --- a/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c +++ b/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c @@ -11,7 +11,16 @@ #define epicsExportSharedSymbols #include "epicsFindSymbol.h" -static int epicsLoadErrorCode = 0; +#ifdef _MSC_VER +# define STORE static __declspec( thread ) +#elif __GNUC__ +# define STORE static __thread +#else +# define STORE static +#endif + +STORE +int epicsLoadErrorCode = 0; epicsShareFunc void * epicsLoadLibrary(const char *name) { @@ -28,7 +37,7 @@ epicsShareFunc void * epicsLoadLibrary(const char *name) epicsShareFunc const char *epicsLoadError(void) { - static char buffer[100]; + STORE char buffer[100]; FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, @@ -42,5 +51,9 @@ epicsShareFunc const char *epicsLoadError(void) epicsShareFunc void * epicsShareAPI epicsFindSymbol(const char *name) { - return GetProcAddress(0, name); + void* ret = GetProcAddress(0, name); + if(!ret) { + epicsLoadErrorCode = GetLastError(); + } + return ret; } From 24df056bcbdc223578ba0f14d9c72755054177fe Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Sun, 22 Mar 2020 08:33:42 -0700 Subject: [PATCH 111/216] WIN32 fix epicsFindSymbol() Passing zero as to GetProcAddress is undocumented, but seems to be equivalent to passing GetModuleHandle(NULL) which searches only the address space of the executable file. Emulate the effect of dlsym(0, ...) by searching all loaded modules. Probably not so efficient... --- .../libcom/src/osi/os/WIN32/osdFindSymbol.c | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c b/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c index c7553896d..19dc5e59a 100644 --- a/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c +++ b/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c @@ -5,8 +5,13 @@ \*************************************************************************/ /* osi/os/WIN32/osdFindSymbol.c */ +/* avoid need to link against psapi.dll + * requires windows 7 or later + */ +#define NTDDI_VERSION NTDDI_WIN7 #include +#include #define epicsExportSharedSymbols #include "epicsFindSymbol.h" @@ -51,8 +56,22 @@ epicsShareFunc const char *epicsLoadError(void) epicsShareFunc void * epicsShareAPI epicsFindSymbol(const char *name) { - void* ret = GetProcAddress(0, name); + HMODULE dlls[128]; + DWORD ndlls=0u, i; + void* ret = NULL; + + /* As a handle returned by LoadLibrary() isn't available to us, + * try all loaded modules in arbitrary order. + */ + if(K32EnumProcessModules(GetCurrentProcess(), dlls, sizeof(dlls), &ndlls)) { + for(i=0; !ret && i Date: Sat, 21 Mar 2020 12:21:09 -0700 Subject: [PATCH 112/216] add epicsLoadTest --- modules/libcom/test/Makefile | 10 +++ modules/libcom/test/epicsLoadTest.cpp | 91 +++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 modules/libcom/test/epicsLoadTest.cpp diff --git a/modules/libcom/test/Makefile b/modules/libcom/test/Makefile index cf55760a6..3457b1057 100755 --- a/modules/libcom/test/Makefile +++ b/modules/libcom/test/Makefile @@ -260,6 +260,16 @@ iocshTest_SRCS += iocshTest.cpp TESTS += iocshTest TESTFILES += $(wildcard ../iocshTest*.cmd) +TESTPROD_HOST += epicsLoadTest +epicsLoadTest_SRCS += epicsLoadTest.cpp +# test linked against static libCom? +epicsLoadTest_CPPFLAGS_STATIC_YES = -DLINKING_STATIC +epicsLoadTest_CPPFLAGS += $(epicsLoadTest_CPPFLAGS_STATIC_$(STATIC_BUILD)) +# are dynamic libraries built? +epicsLoadTest_CPPFLAGS_SHARED_YES = -DBUILDING_SHARED_LIBRARIES +epicsLoadTest_CPPFLAGS += $(epicsLoadTest_CPPFLAGS_SHARED_$(SHARED_LIBRARIES)) +TESTS += epicsLoadTest + # The testHarness runs all the test programs in a known working order. testHarness_SRCS += epicsRunLibComTests.c diff --git a/modules/libcom/test/epicsLoadTest.cpp b/modules/libcom/test/epicsLoadTest.cpp new file mode 100644 index 000000000..809081072 --- /dev/null +++ b/modules/libcom/test/epicsLoadTest.cpp @@ -0,0 +1,91 @@ +/*************************************************************************\ +* Copyright (c) 2020 Michael Davidsaver +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ + +#include + +#include + +#include "epicsUnitTest.h" +#include "testMain.h" + +#include "envDefs.h" +#include "epicsFindSymbol.h" +#include "epicsThread.h" + +namespace { + +// lookup a symbol from libCom +// which this executable is linked against (maybe statically) +// Doesn't work for static builds on windows +void loadCom() +{ + testDiag("Lookup symbol from Com"); + +#if defined (_WIN32) && defined(LINKING_STATIC) + testTodoBegin("windows static build"); +#endif + + void* ptr = epicsFindSymbol("epicsThreadGetCPUs"); + testOk(ptr==(void*)&epicsThreadGetCPUs, + "%p == %p (epicsThreadGetCPUs) : %s", + ptr, (void*)&epicsThreadGetCPUs, + epicsLoadError()); + + testTodoEnd(); +} + +void loadCA() +{ + testDiag("Load and lookup symbol from libca"); + + std::string libname; + { + std::ostringstream strm; + // running in eg. modules/libcom/test/O.linux-x86_64-debug +#ifdef _WIN32 + strm<<"..\\..\\..\\..\\bin\\"< Date: Thu, 26 Mar 2020 15:55:27 -0500 Subject: [PATCH 113/216] Fixes in link type documentation --- modules/database/src/std/link/links.dbd.pod | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/database/src/std/link/links.dbd.pod b/modules/database/src/std/link/links.dbd.pod index b5ed582f2..a4744ff93 100644 --- a/modules/database/src/std/link/links.dbd.pod +++ b/modules/database/src/std/link/links.dbd.pod @@ -152,7 +152,7 @@ result should be displayed. Equivalent to the C field of a record. =item time An optional string containing a single upper or lower-case letter C ... C -which must correspond to an input provided in the c parameter. When the +which must correspond to an input provided in the C parameter. When the record containing such a link has C set to -2 (epicsTimeEventDeviceTime) the record's timestamp field C
for information on the format +of hardware addresses and database links. + +=head4 Fields related to waveform reading + +The DTYP field must contain the name of the appropriate device support module. +The values retrieved from the input link are placed in an array referenced by +VAL. (If the INP link is a constant, elements can be placed in the array via +dbPuts.) NELM specifies the number of elements that the array will hold, while +FTVL specifies the data type of the elements. + +=fields DTYP, INP, NELM, FTVL + +=head4 Possible data types for FTVL + +=menu menuFtype + +=head3 Operator Display Parameters + +These parameters are used to present meaningful data to the operator. They +display the value and other parameters of the waveform either textually or +graphically. + +=head4 Fields related to I + +EGU is a string of up to 16 characters describing the units that the array data +measures. It is retrieved by the C<<< get_units() >>> record support routine. + +The HOPR and LOPR fields set the upper and lower display limits for array +elements referenced by the VAL field. Both the C<<< get_graphic_double() >>> and +C<<< get_control_double() >>> record support routines retrieve these fields. + +The PREC field determines the floating point precision with which to display the +array values. It is used whenever the C<<< get_precision() >>> record support +routine is called. + +See L for more on the record name (NAME) and +description (DESC) fields. + +=fields EGU, HOPR, LOPR, PREC, NAME, DESC + + +=head3 Alarm Parameters + +The array analog input record has the alarm parameters common to all record types. + +=head3 Monitor Parameters + +These parameters are used to determine when to send monitors placed on the VAL +field. The APST and MPST fields are a menu with choices "Always" and "On +Change". The default is "Always", thus monitors will normally be sent every time +the record processes. Selecting "On Change" causes a 32-bit hash of the VAL +field buffer to be calculated and compared with the previous hash value every +time the record processes; the monitor will only be sent if the hash is +different, indicating that the buffer has changed. Note that there is a small +chance that two different value buffers might result in the same hash value, so +for critical systems "Always" may be a better choice, even though it re-sends +duplicate data. + +=head4 Record fields related to I + +=fields APST, MPST, HASH + +=head4 Menu choices for C and C fields + +=menu aaiPOST + +=head3 Run-time Parameters + +These parameters are used by the run-time code for processing the array analog +input record. They are not configured using a configuration tool. Only the VAL +field is modifiable at run-time. + +VAL references the array where the array analog input record stores its data. The +BPTR field holds the address of the array. + +The NORD field holds a counter of the number of elements that have been read +into the array. + +=fields VAL, BPTR, NORD + +The following fields are used to operate the array analog input record in the +simulation mode. See L for more information on the simulation +mode fields. + +=fields SIOL, SIML, SIMM, SIMS + +=begin html + +
+
+
+ +=end html + +=head2 Record Support + +=head3 Record Support Routines + +=head4 init_record + + static long init_record(aaiRecord *prec, int pass) + +If device support includes C, it is called. + +Checks if device support allocated array space. If not, space for the array is +allocated using NELM and FTVL. The array address is stored in the record. + +This routine initializes SIMM with the value of SIML if SIML type is CONSTANT +link or creates a channel access link if SIML type is PV_LINK. VAL is likewise +initialized if SIOL is CONSTANT or PV_LINK. + +This routine next checks to see that device support is available and a device +support read routine is defined. If either does not exist, an error message is +issued and processing is terminated + +=head4 process + + static long process(aaiRecord *prec) + +See L section below. + +=head4 cvt_dbaddr + + static long cvt_dbaddr(DBADDR *paddr) + +This is called by dbNameToAddr. It makes the dbAddr structure refer to the +actual buffer holding the result. + +=head4 get_array_info + + static long get_array_info(DBADDR *paddr, long *no_elements, long *offset) + +Obtains values from the array referenced by VAL. + +=head4 put_array_info + + static long put_array_info(DBADDR *paddr, long nNew) + +Writes values into the array referenced by VAL. + +=head4 get_units + + static long get_units(DBADDR *paddr, char *units) + +Retrieves EGU. + +=head4 get_prec + + static long get_precision(DBADDR *paddr, long *precision) + +Retrieves PREC if field is VAL field. Otherwise, calls C<<< recGblGetPrec() >>>. + +=head4 get_graphic_double + + static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd) + +Sets the upper display and lower display limits for a field. If the field is VAL +the limits are set to HOPR and LOPR, else if the field has upper and lower +limits defined they will be used, else the upper and lower maximum values for +the field type will be used. + +Sets the following values: + + upper_disp_limit = HOPR + lower_disp_limit = LOPR + +=head4 get_control_double + + static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd) + +Sets the upper control and the lower control limits for a field. If the field is +VAL the limits are set to HOPR and LOPR, else if the field has upper and lower +limits defined they will be used, else the upper and lower maximum values for +the field type will be used. + +Sets the following values + + upper_ctrl_limit = HOPR + lower_ctrl_limit = LOPR + +=head3 Record Processing + +Routine process implements the following algorithm: + +=over + +=item 1. + +Check to see that the appropriate device support module exists. If it doesn't, +an error message is issued and processing is terminated with the PACT field +still set to TRUE. This ensures that processes will no longer be called for this +record. Thus error storms will not occur. + +=item 2. + +Call device support read routine C. + +=item 3. + +If PACT has been changed to TRUE, the device support read routine has started +but has not completed writing the new value. In this case, the processing +routine merely returns, leaving PACT TRUE. + +=item 4. + +Check to see if monitors should be invoked. + +=over + +=item * + +Alarm monitors are invoked if the alarm status or severity has changed. + +=item * + +Archive and value change monitors are invoked if APST or MPST are Always or if +the result of the hash calculation is different. + +=item * + +NSEV and NSTA are reset to 0. + +=back + +=item 5. + +Scan forward link if necessary, set PACT FALSE, and return. + +=back + +=begin html + +
+
+
+ +=end html + +=cut + include "dbCommon.dbd" field(VAL,DBF_NOACCESS) { prompt("Value") @@ -114,3 +390,89 @@ recordtype(aai) { interest(3) } } + +=head2 Device Support + +=head3 Fields Of Interest To Device Support + +Each array analog input record record must have an associated set of device +support routines. The primary responsibility of the device support routines is to +obtain a new array value whenever C is called. The device support +routines are primarily interested in the following fields: + +=fields PACT, DPVT, NSEV, NSTA, INP, NELM, FTVL, BPTR, NORD + +=head3 Device Support Routines + +Device support consists of the following routines: + +=head4 report + + long report(int level) + +This optional routine is called by the IOC command C and is passed the +report level that was requested by the user. +It should print a report on the state of the device support to stdout. +The C parameter may be used to output increasingly more detailed +information at higher levels, or to select different types of information with +different levels. +Level zero should print no more than a small summary. + +=head4 init + + long init(int after) + +This optional routine is called twice at IOC initialization time. +The first call happens before any of the C calls are made, with +the integer parameter C set to 0. +The second call happens after all of the C calls have been made, +with C set to 1. + +=head4 init_record + + long init_record(dbCommon *precord) + +This routine is optional. If provided, it is called by the record support +C routine. + +=head4 get_ioint_info + + long get_ioint_info(int cmd, dbCommon *precord, IOSCANPVT *ppvt) + +This routine is called by the ioEventScan system each time the record is added +or deleted from an I/O event scan list. cmd has the value (0,1) if the +record is being (added to, deleted from) an I/O event list. It must be +provided for any device type that can use the ioEvent scanner. + +=head4 read_aai + + long read_aai(dbCommon *precord) + +This routine must provide a new input value. It returns the following values: + +=over + +=item * + +0: Success. + +=item * + +Other: Error. + +=back + +=head3 Device Support For Soft Records + +The C<<< Soft Channel >>> device support module is provided to read values from +other records and store them in arrays. If INP is a constant link, then read_aai +does nothing. In this case, the record can be used to hold arrays written via +dbPuts. If INP is a database or channel access link, the new array value is read +from the link. NORD is set. + +This module places a value directly in VAL and NORD is set to the number of items +in the array. + +If the INP link type is constant, then NORD is set to zero. + +=cut diff --git a/src/std/rec/aaoRecord.dbd.pod b/src/std/rec/aaoRecord.dbd.pod index 57d842f4f..ed2477c98 100644 --- a/src/std/rec/aaoRecord.dbd.pod +++ b/src/std/rec/aaoRecord.dbd.pod @@ -6,11 +6,287 @@ # EPICS BASE is distributed subject to a Software License Agreement found # in file LICENSE that is included with this distribution. #************************************************************************* + +=title Array Analog Output (aao) + +The array analog output record type is used to write array data. The array data +can contain any of the supported data types. The record is in many ways similar to +the waveform record but outputs arrays instead of reading them. It also allows the +device support to allocate the array storage. + +=recordtype aao + +=cut + +include "menuFtype.dbd" + menu(aaoPOST) { choice(aaoPOST_Always,"Always") choice(aaoPOST_OnChange,"On Change") } + recordtype(aao) { + +=head2 Parameter Fields + +The record-specific fields are described below, grouped by functionality. + +=head3 Scan Parameters + +The array analog output record has the standard fields for specifying under what +circumstances the record will be processed. These fields are listed in L. In addition, L explains how these fields are +used. I/O event scanning is only available when supported by device support. + +=head3 Write Parameters + +These fields are configurable by the user to specify how and where to the record +writes its data. The OUT field determines where the array analog output writes its +output. It can be a hardware address, a channel access or database link, or a +constant. Only in records that use soft device support can the OUT field be a +channel access link, a database link, or a constant. Otherwise, the OUT field must +be a hardware address. See L
for information on the format +of hardware addresses and database links. + +=head4 Fields related to array writing + +The DTYP field must contain the name of the appropriate device support module. The +values in the array referenced by are written to the location specified in the OUT +field. (If the OUT link is a constant, no data are written.) NELM specifies the +maximum number of elements that the array can hold, while FTVL specifies the data +type of the elements. + +=fields DTYP, OUT, NELM, FTVL + +=head4 Possible data types for FTVL + +=menu menuFtype + +=head3 Operator Display Parameters + +These parameters are used to present meaningful data to the operator. They +display the value and other parameters of the waveform either textually or +graphically. + +=head4 Fields related to I + +EGU is a string of up to 16 characters describing the units that the array data +measures. It is retrieved by the C<<< get_units >>> record support routine. + +The HOPR and LOPR fields set the upper and lower display limits for array +elements referenced by the VAL field. Both the C<<< get_graphic_double >>> and +C<<< get_control_double >>> record support routines retrieve these fields. + +The PREC field determines the floating point precision with which to display the +array values. It is used whenever the C<<< get_precision >>> record support +routine is called. + +See L for more on the record name (NAME) and +description (DESC) fields. + +=fields EGU, HOPR, LOPR, PREC, NAME, DESC + + +=head3 Alarm Parameters + +The array analog output record has the alarm parameters common to all record +types. + +=head3 Monitor Parameters + +These parameters are used to determine when to send monitors placed on the VAL +field. The APST and MPST fields are a menu with choices "Always" and "On +Change". The default is "Always", thus monitors will normally be sent every time +the record processes. Selecting "On Change" causes a 32-bit hash of the VAL +field buffer to be calculated and compared with the previous hash value every +time the record processes; the monitor will only be sent if the hash is +different, indicating that the buffer has changed. Note that there is a small +chance that two different value buffers might result in the same hash value, so +for critical systems "Always" may be a better choice, even though it re-sends +duplicate data. + +=head4 Record fields related to I + +=fields APST, MPST, HASH + +=head4 Menu choices for C and C fields + +=menu aaoPOST + +=head3 Run-time Parameters + +These parameters are used by the run-time code for processing the array analog +output record. They are not configured using a configuration tool. Only the VAL +field is modifiable at run-time. + +VAL references the array where the array analog output record stores its data. The +BPTR field holds the address of the array. + +The NORD field holds a counter of the number of elements that have been written to +the output, + +=fields VAL, BPTR, NORD + +The following fields are used to operate the array analog output record in the +simulation mode. See L for more information on the simulation +mode fields. + +=fields SIOL, SIML, SIMM, SIMS + +=begin html + +
+
+
+ +=end html + +=head2 Record Support + +=head3 Record Support Routines + +=head4 init_record + + static long init_record(aaoRecord *prec, int pass) + +If device support includes C, it is called. + +Checks if device support allocated array space. If not, space for the array is +allocated using NELM and FTVL. The array address is stored in the record. + +This routine initializes SIMM with the value of SIML if SIML type is CONSTANT +link or creates a channel access link if SIML type is PV_LINK. VAL is likewise +initialized if SIOL is CONSTANT or PV_LINK. + +This routine next checks to see that device support is available and a device +support write routine is defined. If either does not exist, an error message is +issued and processing is terminated + +=head4 process + + static long process(aaoRecord *prec) + +See L section below. + +=head4 cvt_dbaddr + + static long cvt_dbaddr(DBADDR *paddr) + +This is called by dbNameToAddr. It makes the dbAddr structure refer to the +actual buffer holding the result. + +=head4 get_array_info + + static long get_array_info(DBADDR *paddr, long *no_elements, long *offset) + +Obtains values from the array referenced by VAL. + +=head4 put_array_info + + static long put_array_info(DBADDR *paddr, long nNew) + +Writes values into the array referenced by VAL. + +=head4 get_units + + static long get_units(DBADDR *paddr, char *units) + +Retrieves EGU. + +=head4 get_prec + + static long get_precision(DBADDR *paddr, long *precision) + +Retrieves PREC if field is VAL field. Otherwise, calls C<<< recGblGetPrec() >>>. + +=head4 get_graphic_double + + static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd) + +Sets the upper display and lower display limits for a field. If the field is VAL +the limits are set to HOPR and LOPR, else if the field has upper and lower +limits defined they will be used, else the upper and lower maximum values for +the field type will be used. + +Sets the following values: + + upper_disp_limit = HOPR + lower_disp_limit = LOPR + +=head4 get_control_double + + static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd) + +Sets the upper control and the lower control limits for a field. If the field is +VAL the limits are set to HOPR and LOPR, else if the field has upper and lower +limits defined they will be used, else the upper and lower maximum values for +the field type will be used. + +Sets the following values + + upper_ctrl_limit = HOPR + lower_ctrl_limit = LOPR + +=head3 Record Processing + +Routine process implements the following algorithm: + +=over + +=item 1. + +Check to see that the appropriate device support module exists. If it doesn't, +an error message is issued and processing is terminated with the PACT field +still set to TRUE. This ensures that processes will no longer be called for this +record. Thus error storms will not occur. + +=item 2. + +Call device support write routine C. + +=item 3. + +If PACT has been changed to TRUE, the device support read routine has started +but has not completed writing the new value. In this case, the processing +routine merely returns, leaving PACT TRUE. + +=item 4. + +Check to see if monitors should be invoked. + +=over + +=item * + +Alarm monitors are invoked if the alarm status or severity has changed. + +=item * + +Archive and value change monitors are invoked if APST or MPST are Always or if +the result of the hash calculation is different. + +=item * + +NSEV and NSTA are reset to 0. + +=back + +=item 5. + +Scan forward link if necessary, set PACT FALSE, and return. + +=back + +=begin html + +
+
+
+ +=end html + +=cut + include "dbCommon.dbd" field(VAL,DBF_NOACCESS) { prompt("Value") @@ -114,3 +390,87 @@ recordtype(aao) { interest(3) } } + +=head2 Device Support + +=head3 Fields Of Interest To Device Support + +Each array analog output record record must have an associated set of device +support routines. The primary responsibility of the device support routines is to +write the array data value whenever C is called. The device support +routines are primarily interested in the following fields: + +=fields PACT, DPVT, NSEV, NSTA, OUT, NELM, FTVL, BPTR, NORD + +=head3 Device Support Routines + +Device support consists of the following routines: + +=head4 report + + long report(int level) + +This optional routine is called by the IOC command C and is passed the +report level that was requested by the user. +It should print a report on the state of the device support to stdout. +The C parameter may be used to output increasingly more detailed +information at higher levels, or to select different types of information with +different levels. +Level zero should print no more than a small summary. + +=head4 init + + long init(int after) + +This optional routine is called twice at IOC initialization time. +The first call happens before any of the C calls are made, with +the integer parameter C set to 0. +The second call happens after all of the C calls have been made, +with C set to 1. + +=head4 init_record + + init_record(dbCommon *precord) + +This routine is optional. If provided, it is called by the record support +C routine. + +=head4 get_ioint_info + + long get_ioint_info(int cmd, dbCommon *precord, IOSCANPVT *ppvt) + +This routine is called by the ioEventScan system each time the record is added +or deleted from an I/O event scan list. cmd has the value (0,1) if the +record is being (added to, deleted from) an I/O event list. It must be +provided for any device type that can use the ioEvent scanner. + +=head4 write_aao + + long write_aao(dbCommon *precord) + +This routine must write the array data to output. It returns the following values: + +=over + +=item * + +0: Success. + +=item * + +Other: Error. + +=back + +=head3 Device Support For Soft Records + +The C<<< Soft Channel >>> device support module is provided to write values to +other records and store them in arrays. If OUT is a constant link, then +C does nothing. In this case, the record can be used to hold arrays +written via dbPuts. If OUT is a database or channel access link, the array value +is written to the link. NORD is set to the number of items in the array. + + +If the OUT link type is constant, then NORD is set to zero. + +=cut diff --git a/src/std/rec/stringinRecord.dbd.pod b/src/std/rec/stringinRecord.dbd.pod index ef1d93fa7..ecb17fe83 100644 --- a/src/std/rec/stringinRecord.dbd.pod +++ b/src/std/rec/stringinRecord.dbd.pod @@ -42,7 +42,7 @@ The string input record has the standard fields for specifying under what circumstances it will be processed. These fields are listed in L. In addition, L explains how these fields are used. -=head3 Read Parameters +=head3 Input Specification The INP field determines where the string input record gets its string. It can be a database or channel access link, or a constant. If constant, the VAL field @@ -112,8 +112,6 @@ monitors for VAL. If VAL is not equal to OVAL, then monitors are triggered. =fields OVAL - - The following fields are used to operate the string input in the simulation mode. See L for more information on simulation mode fields. @@ -251,15 +249,48 @@ routines are primarily interested in the following fields: =fields PACT, DPVT, UDF, VAL, INP -=head3 Device Support Routines (devSiSoft.c) +=head3 Device Support Routines + +Device support consists of the following routines: + +=head4 report + + long report(int level) + +This optional routine is called by the IOC command C and is passed the +report level that was requested by the user. +It should print a report on the state of the device support to stdout. +The C parameter may be used to output increasingly more detailed +information at higher levels, or to select different types of information with +different levels. +Level zero should print no more than a small summary. + +=head4 init + + long init(int after) + +This optional routine is called twice at IOC initialization time. +The first call happens before any of the C calls are made, with +the integer parameter C set to 0. +The second call happens after all of the C calls have been made, +with C set to 1. =head4 init_record - long init_record(stringinRecord *prec) + long init_record(dbCommon *prec) This routine is optional. If provided, it is called by the record support C routine. +=head4 get_ioint_info + + long get_ioint_info(int cmd, dbCommon *precord, IOSCANPVT *ppvt) + +This routine is called by the ioEventScan system each time the record is added +or deleted from an I/O event scan list. C has the value (0,1) if the +record is being (added to, deleted from) an I/O event list. It must be +provided for any device type that can use the ioEvent scanner. + =head4 read_stringin long read_stringin(stringinRecord *prec) @@ -276,17 +307,11 @@ This routine must provide a new input value. It returns the following values: =head3 Device Support for Soft Records -The C<<< Soft Channel >>> module places a value directly in VAL. +The C<<< Soft Channel >>> module reads a value directly into VAL. -If the INP link type is constant, the double constant, if non-zero, is converted -to a string and stored into VAL by C, and UDF is set to FALSE. If -the INP link type is PV_LINK, then dbCaAddInlink is called by C. - -read_stringin calls recGblGetLinkValue to read the current value of VAL. See -L. - -If the return status of recGblGetLinkValue is zero, then read_stringin sets UDF -to FALSE. The status of recGblGetLinkValue is returned. +Device support for DTYP C is provided for retrieving strings from environment variables. +C addressing C!!@ !!is used on the C link field to select the +desired environment variable. =cut diff --git a/src/std/rec/stringoutRecord.dbd.pod b/src/std/rec/stringoutRecord.dbd.pod index 773f0a7bf..123632ce8 100644 --- a/src/std/rec/stringoutRecord.dbd.pod +++ b/src/std/rec/stringoutRecord.dbd.pod @@ -334,7 +334,47 @@ primarily interested in the following fields: =fields PACT, DPVT, NSEV, NSTA, VAL, OUT -=head3 Device Support Routines (devSoSoft.c) +=head3 Device Support Routines + +Device support consists of the following routines: + +=head4 report + + long report(int level) + +This optional routine is called by the IOC command C and is passed the +report level that was requested by the user. +It should print a report on the state of the device support to stdout. +The C parameter may be used to output increasingly more detailed +information at higher levels, or to select different types of information with +different levels. +Level zero should print no more than a small summary. + +=head4 init + + long init(int after) + +This optional routine is called twice at IOC initialization time. +The first call happens before any of the C calls are made, with +the integer parameter C set to 0. +The second call happens after all of the C calls have been made, +with C set to 1. + +=head4 init_record + + long init_record(dbCommon *prec) + +This routine is optional. If provided, it is called by the record support +C routine. + +=head4 get_ioint_info + + long get_ioint_info(int cmd, dbCommon *precord, IOSCANPVT *ppvt) + +This routine is called by the ioEventScan system each time the record is added +or deleted from an I/O event scan list. C has the value (0,1) if the +record is being (added to, deleted from) an I/O event list. It must be +provided for any device type that can use the ioEvent scanner. =head4 write_stringout @@ -354,15 +394,9 @@ This routine must output a new value. It returns the following values: The C<<< Soft Channel >>> device support module writes the current value of VAL. -If the OUT link type is PV_LINK, then dbCaAddInlink is called by -C. - -write_so calls recGblPutLinkValue to write the current value of VAL. See -L. - -Device support for DTYP C is provided for writing values to the stdout, stderr, or errlog streams. -C addressing C<@stdout>, C<@stderr> or C<@errlog> is used on the OUT link field to select the desired -stream. +Device support for DTYP C is provided for writing values to the stdout, +stderr, or errlog streams. C addressing C<@stdout>, C<@stderr> or +C<@errlog> is used on the OUT link field to select the desired stream. =cut diff --git a/src/std/rec/waveformRecord.dbd.pod b/src/std/rec/waveformRecord.dbd.pod index dfc944647..fa41b89bd 100644 --- a/src/std/rec/waveformRecord.dbd.pod +++ b/src/std/rec/waveformRecord.dbd.pod @@ -303,7 +303,9 @@ interested in the following fields: Device support consists of the following routines: -=head4 long report(int level) +=head4 report + + long report(int level) This optional routine is called by the IOC command C and is passed the report level that was requested by the user. @@ -313,7 +315,9 @@ information at higher levels, or to select different types of information with different levels. Level zero should print no more than a small summary. -=head4 long init(int after) +=head4 init + + long init(int after) This optional routine is called twice at IOC initialization time. The first call happens before any of the C calls are made, with @@ -323,14 +327,14 @@ with C set to 1. =head4 init_record - init_record(precord) + long init_record(dbCommon *precord) This routine is optional. If provided, it is called by the record support C routine. =head4 get_ioint_info - get_ioint_info(int cmd,struct dbCommon *precord,IOSCANPVT *ppvt) + long get_ioint_info(int cmd, dbCommon *precord, IOSCANPVT *ppvt) This routine is called by the ioEventScan system each time the record is added or deleted from an I/O event scan list. cmd has the value (0,1) if the @@ -339,7 +343,7 @@ provided for any device type that can use the ioEvent scanner. =head4 read_wf - read_wf(precord) + long read_wf(waveformRecord *prec) This routine must provide a new input value. It returns the following values: @@ -361,38 +365,11 @@ The C<<< Soft Channel >>> device support module is provided to read values from other records and store them in arrays. If INP is a constant link, then read_wf does nothing. In this case, the record can be used to hold arrays written via dbPuts. If INP is a database or channel access link, the new array value is read -from the link. NORD is set. +from the link. NORD is set to the number of items in the array. This module places a value directly in VAL. -If the INP link type is constant, then NORD is set to zero. If the INP link type -is PV_LINK, then dbCaAddInlink is called by C. - -read_wf calls recGblGetLinkValue which performs the following steps: - -=over - -=item * - -If the INP link type is CONSTANT recGblGetLinkValue does nothing. - -=item * - -If the INP link type is DB_LINK, then dbGetLink is called to obtain a new input -value. If dbGetLink returns an error, a LINK_ALARM with a severity of -INVALID_ALARM is raised. - -=item * - -If the INP link type is CA_LINK, then dbCaGetLink is called to obtain a new -input value. If dbCaGetLink returns an error, a LINK_ALARM with a severity of -INVALID_ALARM is raised. - -=item * - -NORD is set to the number of values returned and read_wf returns. - -=back +If the INP link type is constant, then NORD is set to zero. =cut From 7f02f8a386f37a24507a0dfd7e51bf69466951a0 Mon Sep 17 00:00:00 2001 From: Freddie Akeroyd Date: Sat, 28 Mar 2020 15:51:49 +0100 Subject: [PATCH 117/216] Exclude VS2012 from -FS option (cherry picked from 7.0 / commit 4aee25e8 and e29a53f0) --- configure/os/CONFIG.win32-x86.win32-x86 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/configure/os/CONFIG.win32-x86.win32-x86 b/configure/os/CONFIG.win32-x86.win32-x86 index 7d6c11b6b..6a5078d60 100644 --- a/configure/os/CONFIG.win32-x86.win32-x86 +++ b/configure/os/CONFIG.win32-x86.win32-x86 @@ -141,13 +141,16 @@ STATIC_LDFLAGS= RANLIB= # -# option needed for parallel builds with Visual Studio 2015 onward -# +# option needed for parallel builds with Visual Studio 2013 onward +# VS2012 and above have VisualStudioVersion, so just need to exclude 2012 (11.0) # -FS Force Synchronous PDB Writes +# ifneq ($(VisualStudioVersion),) +ifneq ($(VisualStudioVersion),11.0) OPT_CXXFLAGS_NO += -FS OPT_CFLAGS_NO += -FS endif +endif # From 933e276e1a751985e796456ca8b0c9e90be81465 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 2 Apr 2020 15:47:10 -0500 Subject: [PATCH 118/216] Rolf Keitel's POD documentation for dbCommon (from the Wiki) I split his two "Fields Common to ..." sections back into separate docs, added links between them all, and made the appropriate build changes. Also added these and the aai/aao records to the documentation index. --- documentation/RecordReference.md | 17 +- src/ioc/db/Makefile | 6 +- src/ioc/db/RULES | 18 +- src/ioc/db/dbCommon.dbd | 261 --------------- src/ioc/db/dbCommon.dbd.pod | 514 ++++++++++++++++++++++++++++++ src/ioc/db/dbCommonInput.pod | 181 +++++++++++ src/ioc/db/dbCommonOutput.pod | 211 ++++++++++++ src/ioc/db/dbCommonRecord.dbd | 12 - src/ioc/db/dbCommonRecord.dbd.pod | 20 ++ 9 files changed, 956 insertions(+), 284 deletions(-) delete mode 100644 src/ioc/db/dbCommon.dbd create mode 100644 src/ioc/db/dbCommon.dbd.pod create mode 100644 src/ioc/db/dbCommonInput.pod create mode 100644 src/ioc/db/dbCommonOutput.pod delete mode 100644 src/ioc/db/dbCommonRecord.dbd create mode 100644 src/ioc/db/dbCommonRecord.dbd.pod diff --git a/documentation/RecordReference.md b/documentation/RecordReference.md index 469c39626..fbd5c1fe3 100644 --- a/documentation/RecordReference.md +++ b/documentation/RecordReference.md @@ -1,9 +1,17 @@ # Record Reference Documentation -The following documentation for the record types and menus include with Base was converted from the old EPICS Wiki pages and updated. This list does not include all of the available record types as some have not been documented yet. +The following documentation for the record types and menus include with Base was +converted from the old EPICS Wiki pages and updated. This list only includes the +record types supplied with Base. + +* [Fields Common to All Record Types](dbCommonRecord.html) +* [Fields Common to Input Record Types](dbCommonInputs.html) +* [Fields Common to Output Record Types](dbCommonOutputs.html) ## Record Types +* [Analog Array Input Record (aai)](aaiRecord.html) +* [Analog Array Output Record (aao)](aaoRecord.html) * [Analog Input Record (ai)](aiRecord.html) * [Analog Output Record (ao)](aoRecord.html) * [Array Subroutine Record (aSub)](aSubRecord.html) @@ -49,4 +57,9 @@ The following documentation for the record types and menus include with Base was ## Corrections and Updates -Corrections to these documents can be submitted as patch files to the EPICS core developers, or as merge requests or pull requests to the 3.15 branch of epics-base. The document sources can be found in the `src/std/rec` and `src/ioc/db` directories in files with extension `.dbd.pod`. The documentation format is an extended version of Perl POD, run `perldoc pod` for details. +Corrections to these documents can be submitted as patch files to the EPICS core +developers, or as merge requests or pull requests to the 3.15 branch of Base. +The document sources can be found in the `src/std/rec` and `src/ioc/db` +directories in files with extension `.dbd.pod`. The documentation source format +is a combination of the EPICS DBD file format with an extended version of Perl's +POD (plain old documentation); run `perldoc pod` for details of POD. diff --git a/src/ioc/db/Makefile b/src/ioc/db/Makefile index 5092092e9..dea95c923 100644 --- a/src/ioc/db/Makefile +++ b/src/ioc/db/Makefile @@ -4,7 +4,7 @@ # Copyright (c) 2002 The Regents of the University of California, as # Operator of Los Alamos National Laboratory. # EPICS BASE is distributed subject to a Software License Agreement found -# in file LICENSE that is included with this distribution. +# in file LICENSE that is included with this distribution. #************************************************************************* # This is a Makefile fragment, see src/ioc/Makefile. @@ -59,6 +59,9 @@ DBDINC += dbCommon dbMenusPod = $(notdir $(wildcard ../db/menu*.dbd.pod)) HTMLS += $(patsubst %.dbd.pod,%.html,$(dbMenusPod)) +HTMLS += dbCommonRecord.html +HTMLS += dbCommonInput.html +HTMLS += dbCommonOutput.html dbCore_SRCS += dbLock.c dbCore_SRCS += dbAccess.c @@ -91,4 +94,3 @@ dbCore_SRCS += chfPlugin.c dbCore_SRCS += dbState.c dbCore_SRCS += dbUnitTest.c dbCore_SRCS += dbServer.c - diff --git a/src/ioc/db/RULES b/src/ioc/db/RULES index 41b07f5af..5fa0a6749 100644 --- a/src/ioc/db/RULES +++ b/src/ioc/db/RULES @@ -6,21 +6,25 @@ # Copyright (c) 2002 The Regents of the University of California, as # Operator of Los Alamos National Laboratory. # EPICS BASE is distributed subject to a Software License Agreement found -# in file LICENSE that is included with this distribution. +# in file LICENSE that is included with this distribution. #************************************************************************* # This is a Makefile fragment, see src/ioc/Makefile. -dbCommon.h$(DEP): $(IOCDIR)/db/dbCommonRecord.dbd $(IOCDIR)/db/RULES - @$(RM) $@ - @$(DBTORECORDTYPEH) -D -I ../db -o $(COMMONDEP_TARGET) $< > $@ +THESE_RULES := $(IOCDIR)/db/RULES -$(COMMON_DIR)/dbCommon.h: $(IOCDIR)/db/dbCommonRecord.dbd $(IOCDIR)/db/RULES +dbCommon.h$(DEP): $(COMMON_DIR)/dbCommonRecord.dbd $(THESE_RULES) + @$(RM) $@ + @$(DBTORECORDTYPEH) -D -I ../db -I $(COMMON_DIR) -o $(COMMONDEP_TARGET) $< > $@ + +$(COMMON_DIR)/dbCommonRecord.html: ../db/dbCommon.dbd.pod + +$(COMMON_DIR)/dbCommon.h: $(COMMON_DIR)/dbCommonRecord.dbd $(THESE_RULES) @$(RM) $(notdir $@) - $(DBTORECORDTYPEH) -I ../db -o $(notdir $@) $< + $(DBTORECORDTYPEH) -I ../db -I $(COMMON_DIR) -o $(notdir $@) $< @$(MV) $(notdir $@) $@ -$(COMMON_DIR)/menuGlobal.dbd: $(IOCDIR)/db/Makefile $(IOCDIR)/db/RULES +$(COMMON_DIR)/menuGlobal.dbd: $(IOCDIR)/db/Makefile $(THESE_RULES) # This is a target-specific variable $(COMMON_DIR)/menuGlobal.dbd: DBDCAT_COMMAND = \ diff --git a/src/ioc/db/dbCommon.dbd b/src/ioc/db/dbCommon.dbd deleted file mode 100644 index aac8e9576..000000000 --- a/src/ioc/db/dbCommon.dbd +++ /dev/null @@ -1,261 +0,0 @@ -#************************************************************************* -# Copyright (c) 2007 UChicago Argonne LLC, as Operator of Argonne -# National Laboratory. -# Copyright (c) 2002 The Regents of the University of California, as -# Operator of Los Alamos National Laboratory. -# EPICS BASE is distributed subject to a Software License Agreement found -# in file LICENSE that is included with this distribution. -#************************************************************************* - %#include "epicsTypes.h" - %#include "link.h" - field(NAME,DBF_STRING) { - prompt("Record Name") - special(SPC_NOMOD) - size(61) - } - field(DESC,DBF_STRING) { - prompt("Descriptor") - promptgroup("10 - Common") - size(41) - } - field(ASG,DBF_STRING) { - prompt("Access Security Group") - promptgroup("10 - Common") - special(SPC_AS) - size(29) - } - field(SCAN,DBF_MENU) { - prompt("Scan Mechanism") - promptgroup("20 - Scan") - special(SPC_SCAN) - interest(1) - menu(menuScan) - } - field(PINI,DBF_MENU) { - prompt("Process at iocInit") - promptgroup("20 - Scan") - interest(1) - menu(menuPini) - } - field(PHAS,DBF_SHORT) { - prompt("Scan Phase") - promptgroup("20 - Scan") - special(SPC_SCAN) - interest(1) - } - field(EVNT,DBF_STRING) { - prompt("Event Name") - promptgroup("20 - Scan") - special(SPC_SCAN) - size(40) - interest(1) - } - field(TSE,DBF_SHORT) { - prompt("Time Stamp Event") - promptgroup("20 - Scan") - interest(1) - } - field(TSEL,DBF_INLINK) { - prompt("Time Stamp Link") - promptgroup("20 - Scan") - interest(1) - } - field(DTYP,DBF_DEVICE) { - prompt("Device Type") - promptgroup("10 - Common") - interest(1) - } - field(DISV,DBF_SHORT) { - prompt("Disable Value") - promptgroup("20 - Scan") - initial("1") - } - field(DISA,DBF_SHORT) { - prompt("Disable") - } - field(SDIS,DBF_INLINK) { - prompt("Scanning Disable") - promptgroup("20 - Scan") - interest(1) - } - %#include "epicsMutex.h" - field(MLOK,DBF_NOACCESS) { - prompt("Monitor lock") - special(SPC_NOMOD) - interest(4) - extra("epicsMutexId mlok") - } - %#include "ellLib.h" - field(MLIS,DBF_NOACCESS) { - prompt("Monitor List") - special(SPC_NOMOD) - interest(4) - extra("ELLLIST mlis") - } - field(DISP,DBF_UCHAR) { - prompt("Disable putField") - } - field(PROC,DBF_UCHAR) { - prompt("Force Processing") - pp(TRUE) - interest(3) - } - field(STAT,DBF_MENU) { - prompt("Alarm Status") - special(SPC_NOMOD) - menu(menuAlarmStat) - initial("UDF") - } - field(SEVR,DBF_MENU) { - prompt("Alarm Severity") - special(SPC_NOMOD) - menu(menuAlarmSevr) - } - field(NSTA,DBF_MENU) { - prompt("New Alarm Status") - special(SPC_NOMOD) - interest(2) - menu(menuAlarmStat) - } - field(NSEV,DBF_MENU) { - prompt("New Alarm Severity") - special(SPC_NOMOD) - interest(2) - menu(menuAlarmSevr) - } - field(ACKS,DBF_MENU) { - prompt("Alarm Ack Severity") - special(SPC_NOMOD) - interest(2) - menu(menuAlarmSevr) - } - field(ACKT,DBF_MENU) { - prompt("Alarm Ack Transient") - promptgroup("70 - Alarm") - special(SPC_NOMOD) - interest(2) - menu(menuYesNo) - initial("YES") - } - field(DISS,DBF_MENU) { - prompt("Disable Alarm Sevrty") - promptgroup("70 - Alarm") - interest(1) - menu(menuAlarmSevr) - } - field(LCNT,DBF_UCHAR) { - prompt("Lock Count") - special(SPC_NOMOD) - interest(2) - } - field(PACT,DBF_UCHAR) { - prompt("Record active") - special(SPC_NOMOD) - interest(1) - } - field(PUTF,DBF_UCHAR) { - prompt("dbPutField process") - special(SPC_NOMOD) - interest(1) - } - field(RPRO,DBF_UCHAR) { - prompt("Reprocess ") - special(SPC_NOMOD) - interest(1) - } - field(ASP,DBF_NOACCESS) { - prompt("Access Security Pvt") - special(SPC_NOMOD) - interest(4) - extra("struct asgMember *asp") - } - field(PPN,DBF_NOACCESS) { - prompt("pprocessNotify") - special(SPC_NOMOD) - interest(4) - extra("struct processNotify *ppn") - } - field(PPNR,DBF_NOACCESS) { - prompt("pprocessNotifyRecord") - special(SPC_NOMOD) - interest(4) - extra("struct processNotifyRecord *ppnr") - } - field(SPVT,DBF_NOACCESS) { - prompt("Scan Private") - special(SPC_NOMOD) - interest(4) - extra("struct scan_element *spvt") - } - field(RSET,DBF_NOACCESS) { - prompt("Address of RSET") - special(SPC_NOMOD) - interest(4) - extra("struct rset *rset") - } - field(DSET,DBF_NOACCESS) { - prompt("DSET address") - special(SPC_NOMOD) - interest(4) - extra("struct dset *dset") - } - field(DPVT,DBF_NOACCESS) { - prompt("Device Private") - special(SPC_NOMOD) - interest(4) - extra("void *dpvt") - } - field(RDES,DBF_NOACCESS) { - prompt("Address of dbRecordType") - special(SPC_NOMOD) - interest(4) - extra("struct dbRecordType *rdes") - } - field(LSET,DBF_NOACCESS) { - prompt("Lock Set") - special(SPC_NOMOD) - interest(4) - extra("struct lockRecord *lset") - } - field(PRIO,DBF_MENU) { - prompt("Scheduling Priority") - promptgroup("20 - Scan") - special(SPC_SCAN) - interest(1) - menu(menuPriority) - } - field(TPRO,DBF_UCHAR) { - prompt("Trace Processing") - } - field(BKPT,DBF_NOACCESS) { - prompt("Break Point") - special(SPC_NOMOD) - interest(1) - extra("char bkpt") - } - field(UDF,DBF_UCHAR) { - prompt("Undefined") - promptgroup("10 - Common") - pp(TRUE) - interest(1) - initial("1") - } - field(UDFS,DBF_MENU) { - prompt("Undefined Alarm Sevrty") - promptgroup("70 - Alarm") - interest(1) - menu(menuAlarmSevr) - initial("INVALID") - } - %#include "epicsTime.h" - field(TIME,DBF_NOACCESS) { - prompt("Time") - special(SPC_NOMOD) - interest(2) - extra("epicsTimeStamp time") - } - field(FLNK,DBF_FWDLINK) { - prompt("Forward Process Link") - promptgroup("20 - Scan") - interest(1) - } diff --git a/src/ioc/db/dbCommon.dbd.pod b/src/ioc/db/dbCommon.dbd.pod new file mode 100644 index 000000000..d3829e1f6 --- /dev/null +++ b/src/ioc/db/dbCommon.dbd.pod @@ -0,0 +1,514 @@ +#************************************************************************* +# Copyright (c) 2007 UChicago Argonne LLC, as Operator of Argonne +# National Laboratory. +# Copyright (c) 2002 The Regents of the University of California, as +# Operator of Los Alamos National Laboratory. +# EPICS BASE is distributed subject to a Software License Agreement found +# in file LICENSE that is included with this distribution. +#************************************************************************* + +=head3 Operator Display Parameters + +The B field contains the record name which must be unique within an +EPICS Channel Access name space. The name is supplied by the application +developer and is the means of identifying a specific record. The name has a +maximum length of 60 characters and should use only this limited set of +characters: + + a-z A-Z 0-9 _ - : [ ] < > ; + +The B field may be set to provide a meaningful description of the +record's purpose. Maximum length is 40 characters. + +=fields NAME, DESC + +=cut + + %#include "epicsTypes.h" + %#include "link.h" + field(NAME,DBF_STRING) { + prompt("Record Name") + special(SPC_NOMOD) + size(61) + } + field(DESC,DBF_STRING) { + prompt("Descriptor") + promptgroup("10 - Common") + size(41) + } + field(ASG,DBF_STRING) { + prompt("Access Security Group") + promptgroup("10 - Common") + special(SPC_AS) + size(29) + } + +=head3 Scan Fields + +These fields contain information related to how and when a record processes. A +few records have unique fields that also affect how they process. These +fields, if any, will be listed and explained in the section for each record. + +The B field specifies the scanning period for periodic record scans or the +scan type for non-periodic record scans. The default set of values for SCAN can +be found in L. + +The choices provided by this menu are: + +=over + +=item * + +C for the record scan to be triggered by other records or Channel +Access + +=item * + +C for event-driven scan + +=item * + +C for interrupt-driven scan + +=item * + +A set of periodic scan intervals + +=back + +Additional periodic scan rates may be defined for individual IOCs by making a +local copy of menuScan.dbd and adding more choices as required. Scan rates +should normally be defined in order, with the fastest rates appearing first. +Scan periods may now be specified in seconds, minutes, hours or Hertz/Hz, and +plural time units will also be accepted (seconds are used if no unit is +mentioned in the choice string). For example the rates given below are all +valid: + + 1 hour + 0.5 hours + 15 minutes + 3 seconds + 1 second + 2 Hertz + +The B field specifies record processing at initialization. If it is set +to YES during database configuration, the record is processed once at IOC +initialization (before the normal scan tasks are started). + +The B field orders the records within a specific SCAN group. This is not +meaningful for passive records. All records of a specified phase are processed +before those with higher phase number. Whenever possible it is better to use +linked passive records to enforce the order of processing rather than a phase +number. + +The B field specifies an event number. This event number is used if the +SCAN field is set to C. All records with scan type C and the +same EVNT value will be processed when a call to post_event for EVNT is made. +The call to post_event is: post_event(short event_number). + +The B field specifies the scheduling priority for processing records +with SCAN=C and asynchronous record completion tasks. + +The B field specifies a "disable value". Record processing is +immediately terminated if the value of this field is equal to the value of the +DISA field, i.e. the record is disabled. Note that field values of a record +can be changed by database put or Channel Access, even if a record is +disabled. + +The B field contains the value that is compared with DISV to determine +if the record is disabled. The value of the DISA field is obtained via SDIS if +SDIS is a database or channel access link. If SDIS is not a database or +channel access link, then DISA can be set via dbPutField or dbPutLink. + +If the B field of a record is written to, the record is processed. + +The B field defines the record's "disable severity". If this field is +not NO_ALARM and the record is disabled, the record will be put into alarm +with this severity and a status of DISABLE_ALARM. + +The B field contains the lock set to which this record belongs. All +records linked in any way via input, output, or forward database links belong +to the same lock set. Lock sets are determined at IOC initialization time, and +are updated whenever a database link is added, removed or altered. + +The B field counts the number of times dbProcess finds the record active +during successive scans, i.e. PACT is TRUE. If dbProcess finds the record +active MAX_LOCK times (currently set to 10) it raises a SCAN_ALARM. + +The B field is TRUE while the record is being processed. For +asynchronous records PACT can be TRUE from the time record processing is +started until the asynchronous completion occurs. As long as PACT is TRUE, +dbProcess will not call the record processing routine. See Application +Developers Guide for details on usage of PACT. + +The B field is a database link to another record (the "target" record). +Processing a record with a specified FLNK field will force processing of the +target record, provided the target record's SCAN field is set to C. + +The B field is for internal use by the scanning system. + +=fields SCAN, PINI, PHAS, EVNT, PRIO, DISV, DISA, SDIS, PROC, DISS, LCNT, PACT, FLNK, SPVT + +=cut + + field(SCAN,DBF_MENU) { + prompt("Scan Mechanism") + promptgroup("20 - Scan") + special(SPC_SCAN) + interest(1) + menu(menuScan) + } + field(PINI,DBF_MENU) { + prompt("Process at iocInit") + promptgroup("20 - Scan") + interest(1) + menu(menuPini) + } + field(PHAS,DBF_SHORT) { + prompt("Scan Phase") + promptgroup("20 - Scan") + special(SPC_SCAN) + interest(1) + } + field(EVNT,DBF_STRING) { + prompt("Event Name") + promptgroup("20 - Scan") + special(SPC_SCAN) + size(40) + interest(1) + } + field(TSE,DBF_SHORT) { + prompt("Time Stamp Event") + promptgroup("20 - Scan") + interest(1) + } + field(TSEL,DBF_INLINK) { + prompt("Time Stamp Link") + promptgroup("20 - Scan") + interest(1) + } + field(DTYP,DBF_DEVICE) { + prompt("Device Type") + promptgroup("10 - Common") + interest(1) + } + field(DISV,DBF_SHORT) { + prompt("Disable Value") + promptgroup("20 - Scan") + initial("1") + } + field(DISA,DBF_SHORT) { + prompt("Disable") + } + field(SDIS,DBF_INLINK) { + prompt("Scanning Disable") + promptgroup("20 - Scan") + interest(1) + } + %#include "epicsMutex.h" + field(MLOK,DBF_NOACCESS) { + prompt("Monitor lock") + special(SPC_NOMOD) + interest(4) + extra("epicsMutexId mlok") + } + %#include "ellLib.h" + field(MLIS,DBF_NOACCESS) { + prompt("Monitor List") + special(SPC_NOMOD) + interest(4) + extra("ELLLIST mlis") + } + field(DISP,DBF_UCHAR) { + prompt("Disable putField") + } + field(PROC,DBF_UCHAR) { + prompt("Force Processing") + pp(TRUE) + interest(3) + } + +=head3 Alarm Fields + +These fields indicate the status and severity of alarms, or else determine the +how and when alarms are triggered. Of course, many records have alarm-related +fields not common to all records. These fields are listed and explained in the +appropriate section on each record. + +The B field contains the current alarm status. + +The B field contains the current alarm severity. + +These two fields are seen outside database access. The B and B +fields are used by the database access, record support, and device support +routines to set new alarm status and severity values. Whenever any software +component discovers an alarm condition, it uses the following macro function: +recGblSetSevr(precord,new_status,new_severity) This ensures that the current +alarm severity is set equal to the highest outstanding alarm. The file alarm.h +defines all allowed alarm status and severity values. + +The B field contains the highest unacknowledged alarm severity. + +The B field specifies if it is necessary to acknowledge transient +alarms. + +The B indicates if the record's value is BnBeBined. Typically +this is caused by a failure in device support, the fact that the record has +never been processed, or that the VAL field currently contains a NaN (not a +number). UDF is initialized to TRUE at IOC initialization. Record and device +support routines which write to the VAL field are responsible for setting UDF. + +=fields STAT, SEVR, NSTA, NSEV, ACKS, ACKT, UDF + +=cut + + field(STAT,DBF_MENU) { + prompt("Alarm Status") + special(SPC_NOMOD) + menu(menuAlarmStat) + initial("UDF") + } + field(SEVR,DBF_MENU) { + prompt("Alarm Severity") + special(SPC_NOMOD) + menu(menuAlarmSevr) + } + field(NSTA,DBF_MENU) { + prompt("New Alarm Status") + special(SPC_NOMOD) + interest(2) + menu(menuAlarmStat) + } + field(NSEV,DBF_MENU) { + prompt("New Alarm Severity") + special(SPC_NOMOD) + interest(2) + menu(menuAlarmSevr) + } + field(ACKS,DBF_MENU) { + prompt("Alarm Ack Severity") + special(SPC_NOMOD) + interest(2) + menu(menuAlarmSevr) + } + field(ACKT,DBF_MENU) { + prompt("Alarm Ack Transient") + promptgroup("70 - Alarm") + special(SPC_NOMOD) + interest(2) + menu(menuYesNo) + initial("YES") + } + field(DISS,DBF_MENU) { + prompt("Disable Alarm Sevrty") + promptgroup("70 - Alarm") + interest(1) + menu(menuAlarmSevr) + } + field(LCNT,DBF_UCHAR) { + prompt("Lock Count") + special(SPC_NOMOD) + interest(2) + } + field(PACT,DBF_UCHAR) { + prompt("Record active") + special(SPC_NOMOD) + interest(1) + } + field(PUTF,DBF_UCHAR) { + prompt("dbPutField process") + special(SPC_NOMOD) + interest(1) + } + field(RPRO,DBF_UCHAR) { + prompt("Reprocess ") + special(SPC_NOMOD) + interest(1) + } + field(ASP,DBF_NOACCESS) { + prompt("Access Security Pvt") + special(SPC_NOMOD) + interest(4) + extra("struct asgMember *asp") + } + field(PPN,DBF_NOACCESS) { + prompt("pprocessNotify") + special(SPC_NOMOD) + interest(4) + extra("struct processNotify *ppn") + } + field(PPNR,DBF_NOACCESS) { + prompt("pprocessNotifyRecord") + special(SPC_NOMOD) + interest(4) + extra("struct processNotifyRecord *ppnr") + } + field(SPVT,DBF_NOACCESS) { + prompt("Scan Private") + special(SPC_NOMOD) + interest(4) + extra("struct scan_element *spvt") + } + +=head3 Device Fields + +The B field contains the address of the Record Support Entry Table. See +the Application Developers Guide for details on usage. + +The B field contains the address of Device Support Entry Table. The +value of this field is determined at IOC initialization time. Record support +routines use this field to locate their device support routines. + +The B field is is for private use of the device support modules. + +=fields RSET, DSET, DPVT + +=cut + + field(RSET,DBF_NOACCESS) { + prompt("Address of RSET") + special(SPC_NOMOD) + interest(4) + extra("struct rset *rset") + } + field(DSET,DBF_NOACCESS) { + prompt("DSET address") + special(SPC_NOMOD) + interest(4) + extra("struct dset *dset") + } + field(DPVT,DBF_NOACCESS) { + prompt("Device Private") + special(SPC_NOMOD) + interest(4) + extra("void *dpvt") + } + field(RDES,DBF_NOACCESS) { + prompt("Address of dbRecordType") + special(SPC_NOMOD) + interest(4) + extra("struct dbRecordType *rdes") + } + field(LSET,DBF_NOACCESS) { + prompt("Lock Set") + special(SPC_NOMOD) + interest(4) + extra("struct lockRecord *lset") + } + field(PRIO,DBF_MENU) { + prompt("Scheduling Priority") + promptgroup("20 - Scan") + special(SPC_SCAN) + interest(1) + menu(menuPriority) + } + +=head3 Debugging Fields + +The B field is used for trace processing. If this field is non-zero a +message is printed whenever this record is processed, and when any other +record in the same lock-set is processed by a database link from this record. + +The B field indicates if there is a breakpoint set at this record. This +supports setting a debug breakpoint in the record processing. STEP through +database processing can be supported using this. + +=fields TPRO, BKPT + + +=head3 Miscellaneous Fields + +The B field contains a character string value defining the access +security group for this record. If left empty, the record is placed in group +DEFAULT. + +The B field is a field for private use of the access security system. + +The B field controls dbPutFields to this record which are normally +issued by channel access. If the field is set to TRUE all dbPutFields +directed to this record are ignored except to the field DISP itself. + +The B field specifies the device type for the record. Each record type +has its own set of device support routines which are specified in +devSup.ASCII. If a record type does not have any associated device support, +DTYP and DSET are meaningless. + +The B field contains the monitor lock. The lock used by the monitor +routines when the monitor list is being used. The list is locked whenever +monitors are being scheduled, invoked, or when monitors are being added to or +removed from the list. This field is accessed only by the dbEvent routines. + +The B field is the head of the list of monitors connected to this +record. Each record support module is responsible for triggering monitors for +any fields that change as a result of record processing. Monitors are present +if mlis count is greater than zero. The call to trigger monitors is: +db_post_event(precord,&data,mask), where "mask" is some combination of +DBE_ALARM, DBE_VALUE, and DBE_LOG. + +The B field contains the address of a putNotify callback. + +The B field contains the next record for PutNotify. + +The B field is set to TRUE if dbPutField caused the current record +processing. + +The B field contains the address of dbRecordType + +The B field specifies a reprocessing of the record when current +processing completes. + +The B
link text + +sub do_pod_link { + # EPICS::PodHtml object and Pod::Simple::PullParserStartToken object + my ($self, $link) = @_; + + my $ret; + + # Links to other EPICS POD files + if ($link->tagname eq 'L' and $link->attr('type') eq 'pod') { + my $to = $link->attr('to'); + my $section = $link->attr('section'); + + $ret = $to ? "$to.html" : ''; + $ret .= "#$section" if $section; + } + else { + # all other links are generated by the parent class + $ret = $self->SUPER::do_pod_link($link); + } + + return $ret; +} + +# Generate the same section IDs as Pod::Simple::XHTML + +sub section_name_tidy { + my($self, $section) = @_; + $section =~ s/^\s+//; + $section =~ s/\s+$//; + $section =~ tr/ /-/; + $section =~ s/[[:cntrl:][:^ascii:]]//g; # drop crazy characters + $section = $self->unicode_escape_url($section); + $section = '_' unless length $section; + return $section; +} + +1; diff --git a/src/tools/EPICS/PodXHtml.pm b/src/tools/EPICS/PodXHtml.pm new file mode 100644 index 000000000..d922c0645 --- /dev/null +++ b/src/tools/EPICS/PodXHtml.pm @@ -0,0 +1,21 @@ +package EPICS::PodXHtml; + +use strict; +use warnings; + +use base 'Pod::Simple::XHTML'; + +# Translate L +# into link text + +sub resolve_pod_page_link { + my ($self, $to, $section) = @_; + + my $ret = $to ? "$to.html" : ''; + $ret .= '#' . $self->idify($self->encode_entities($section), 1) + if $section; + + return $ret; +} + +1; diff --git a/src/tools/Makefile b/src/tools/Makefile index 636717d90..26c0ed99a 100644 --- a/src/tools/Makefile +++ b/src/tools/Makefile @@ -2,7 +2,7 @@ # Copyright (c) 2012 UChicago Argonne LLC, as Operator of Argonne # National Laboratory. # EPICS BASE is distributed subject to a Software License Agreement found -# in file LICENSE that is included with this distribution. +# in file LICENSE that is included with this distribution. #************************************************************************* TOP=../.. @@ -17,6 +17,8 @@ PERL_MODULES += EPICS/Release.pm PERL_MODULES += EPICS/Readfile.pm PERL_MODULES += EPICS/Getopts.pm PERL_MODULES += EPICS/macLib.pm +PERL_MODULES += EPICS/PodHtml.pm +PERL_MODULES += EPICS/PodXHtml.pm PERL_MODULES += DBD.pm PERL_MODULES += DBD/Base.pm @@ -82,8 +84,7 @@ EXPAND += $(PKGCONFIG:%=%@) CLEANS += epics-base-$(T_A).pc@ include $(TOP)/configure/RULES - + epics-base-$(T_A).pc@: ../epics-base-arch.pc@ @$(RM) $@ @$(CP) $< $@ - diff --git a/src/tools/dbdToHtml.pl b/src/tools/dbdToHtml.pl index 7a80dec4c..afbb0a601 100644 --- a/src/tools/dbdToHtml.pl +++ b/src/tools/dbdToHtml.pl @@ -18,10 +18,10 @@ use EPICS::macLib; use EPICS::Readfile; BEGIN { - $::XHTML = eval "require Pod::Simple::XHTML; 1"; + $::XHTML = eval "require EPICS::PodXHtml; 1"; $::ENTITIES = eval "require HTML::Entities; 1"; if (!$::XHTML) { - require Pod::Simple::HTML; + require EPICS::PodHtml; } if (!$::ENTITIES) { my %entities = ( @@ -130,7 +130,7 @@ my $contentType = ''; if ($::XHTML) { - $podHtml = Pod::Simple::XHTML->new(); + $podHtml = EPICS::PodXHtml->new(); $podHtml->html_doctype(<< '__END_DOCTYPE'); new(); + $podHtml = EPICS::PodHtml->new(); $podHtml->html_css('style.css'); $idify = sub { diff --git a/src/tools/podToHtml.pl b/src/tools/podToHtml.pl index 99ee5b426..21bf3a161 100644 --- a/src/tools/podToHtml.pl +++ b/src/tools/podToHtml.pl @@ -9,8 +9,11 @@ use strict; use warnings; +use FindBin qw($Bin); +use lib "$Bin/../../lib/perl"; + use Getopt::Std; -use Pod::Simple::HTML; +use EPICS::PodHtml; our ($opt_o); @@ -27,11 +30,9 @@ if (!$opt_o) { open my $out, '>', $opt_o or die "Can't create $opt_o: $!\n"; -my $podHtml = Pod::Simple::HTML->new(); +my $podHtml = EPICS::PodHtml->new(); $podHtml->html_css('style.css'); -$podHtml->perldoc_url_prefix(''); -$podHtml->perldoc_url_postfix('.html'); $podHtml->set_source($infile); $podHtml->output_string(\my $html); $podHtml->run; From 1533a4f13f9b8b8e1150c252a46c70056cecc800 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 3 Apr 2020 00:33:51 -0500 Subject: [PATCH 120/216] Updates to record POD documentation. --- src/std/rec/aiRecord.dbd.pod | 8 +++- src/std/rec/aoRecord.dbd.pod | 77 ++++++++++++++++++++++-------------- 2 files changed, 55 insertions(+), 30 deletions(-) diff --git a/src/std/rec/aiRecord.dbd.pod b/src/std/rec/aiRecord.dbd.pod index 0673447ff..7e9f7e1c0 100644 --- a/src/std/rec/aiRecord.dbd.pod +++ b/src/std/rec/aiRecord.dbd.pod @@ -190,7 +190,13 @@ noise. The AFTC field sets the time constant on a low-pass filter that delays the reporting of limit alarms until the signal has been within the alarm range for that number of seconds (the default AFTC value of zero retains the previous -behavior). +behavior). The record must be scanned often enough for the filtering action to +work effectively and the alarm severity can only change when the record is +processed, but that processing does not have to be regular; the filter uses the +time since the record last processed in its calculation. Setting AFTC to a +positive number of seconds will delay the record going into or out of a minor +alarm severity or from minor to major severity until the input signal has been +in the alarm range for that number of seconds. =fields HIHI, HIGH, LOW, LOLO, HHSV, HSV, LSV, LLSV, HYST, AFTC, LALM diff --git a/src/std/rec/aoRecord.dbd.pod b/src/std/rec/aoRecord.dbd.pod index 6aaf7d4b7..605e27e12 100644 --- a/src/std/rec/aoRecord.dbd.pod +++ b/src/std/rec/aoRecord.dbd.pod @@ -4,7 +4,7 @@ # Copyright (c) 2002 The Regents of the University of California, as # Operator of Los Alamos National Laboratory. # EPICS BASE is distributed subject to a Software License Agreement found -# in file LICENSE that is included with this distribution. +# in file LICENSE that is included with this distribution. #************************************************************************* =title Analog Output Record (ao) @@ -104,33 +104,32 @@ The LINR field can specify C or C for linear conversions, C for no conversions at all, or the name of a breakpoint table such as C for breakpoint conversions. -Note that the ESLO, EOFF, EGUF, and EGUL fields are only used for linear -conversions. -Also note that none of these fields have any significance for records that use -the Soft Channel device support module. +The EGUF and EGUL fields should be set for C conversions, and the ESLO +and EOFF fields for C conversion. Note that none of these fields have any +significance for records that use the Soft Channel device support module. =over =item EGUF, EGUF -The user must calculate these fields when configuring the database for records +The user must set these fields when configuring the database for records that use C conversions. They are used to calculate the values for ESLO and EOFF. See Conversion Specification for more information on how to calculate these fields. +=item ESLO, EOFF + +Computed by device support from EGUF and EGUL when LINR specifies C. +These values must be supplied by the user when LINR specifies C. +Used only when LINR is C or C. + =item AOFF, ASLO These fields are adjustment parameters for the raw output values. They are applied to the raw output value after conversion from engineering units. -=item ESLO, EOFF - -Computed by device support using EGUF and EGUL when LINR specifies C. -These values must be supplied by the user when LINR specifies C. -Used only when LINR is C or C. - =item ROFF This field can be used to offset the raw value generated by the conversion @@ -168,8 +167,7 @@ addresses. For soft records the output link can be a database link, a channel access link, or a constant value. If the link is a constant, no output -is sent. See Address Specification for information on the format of -database and channel access addresses. +is sent. =fields DTYP, OUT @@ -193,8 +191,8 @@ The PREC field determines the floating point precision with which to display VAL, OVAL and PVAL. It is used whenever the get_precision record support routine is called. -See Fields Common to All Record Types for more on the record name -(NAME) and description (DESC) fields. +See L for more on the record name (NAME) and description (DESC) fields. =fields EGU, HOPR, LOPR, PREC, NAME, DESC @@ -209,9 +207,10 @@ and LOW fields, which must be floating-point values. For each of these fields, there is a corresponding severity field which can be either NO_ALARM, MINOR, or MAJOR. -See Alarm Specification for a complete explanation of alarms and these -fields. See Invalid Alarm Output Action for more information on the -IVOA and IVOV fields. Alarm Fields lists other fields related to a +See L +for more information on the IVOA and IVOV fields. + +L lists other fields related to a alarms that are common to all record types. =fields HIHI, HIGH, LOW, LOLO, HHSV, HSV, LSV, LLSV, HYST, IVOA, IVOV @@ -260,15 +259,15 @@ processing. =fields ORAW, RBV, ORBV, LALM, ALST, MLST, INIT, PBRK, LBRK, PVAL, OMOD -The following fields are used to operate the analog output in the -simulation mode. See Fields Common to Many Record Types for more -information on these fields. +The following fields are used when the record is in simulation mode. See +L for +more information on these fields. =fields SIOL, SIML, SIMM, SIMS =cut - include "dbCommon.dbd" + include "dbCommon.dbd" field(VAL,DBF_DOUBLE) { prompt("Desired Output") promptgroup("50 - Output") @@ -575,6 +574,8 @@ get_precision, get_graphic_double, and get_control_double routines. =item init_record +C + This routine initializes SIMM if SIML is a constant or creates a channel access link if SIML is PV_LINK. If SIOL is PV_LINK a channel access link is created. @@ -606,10 +607,14 @@ then set to FALSE. PVAL is set to VAL. =item process +C + See next section. =item special +C + The only special processing for analog output records is SPC_LINCONV which is invoked whenever either of the fields LINR, EGUF, EGUL or ROFF is changed If the device support routine special_linconv exists it is @@ -620,6 +625,8 @@ re-initialized. =item get_alarm_double +C + Sets the following values: upper_alarm_limit = HIHI @@ -769,7 +776,9 @@ Device support consists of the following routines: =over -=item C +=item report + +C This optional routine is called by the IOC command C and is passed the report level that was requested by the user. @@ -779,7 +788,9 @@ information at higher levels, or to select different types of information with different levels. Level zero should print no more than a small summary. -=item C +=item init + +C This optional routine is called twice at IOC initialization time. The first call happens before any of the C calls are made, with @@ -787,7 +798,9 @@ the integer parameter C set to 0. The second call happens after all of the C calls have been made, with C set to 1. -=item C +=item init_record + +C This optional routine is called by the record initialization code for each ao record instance that has its DTYP field set to use this device support. @@ -809,7 +822,9 @@ should also fetch that value and put it into the record's RVAL or VAL field. The return value should be zero if the RVAL field has been set, or 2 if either the VAL field has been set or if the last output value cannot be retrieved. -=item C +=item get_ioint_info + +C This optional routine is called whenever the record's SCAN field is being changed to or from the value C to find out which I/O Interrupt Scan @@ -837,7 +852,9 @@ thread. The C routine is safe to call from an interrupt service routine on embedded architectures (vxWorks and RTEMS). -=item C +=item write_ao + +C This essential routine is called whenever the record has a new output value to send to the device. It is responsible for performing the write operation, using @@ -856,7 +873,9 @@ that happens the C routine will be called again with PACT still set to TRUE; it should then set it to FALSE to indicate the write has completed, and return. -=item C +=item special_linconv + +C This optional routine should be provided if the record type's unit conversion features are used by the device support's C routine utilizing the From 1687757752610e0303f58d7be18ba1da5261727f Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Mon, 6 Apr 2020 10:57:48 +0200 Subject: [PATCH 121/216] catools: make camonitor handle type changes taken from a patch provided by Dirk Zimoch (in 2014) --- src/ca/client/tools/camonitor.c | 11 +++++++++-- src/ca/client/tools/tool_lib.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ca/client/tools/camonitor.c b/src/ca/client/tools/camonitor.c index a3fdecd55..6799182be 100644 --- a/src/ca/client/tools/camonitor.c +++ b/src/ca/client/tools/camonitor.c @@ -138,7 +138,14 @@ static void connection_handler ( struct connection_handler_args args ) pv *ppv = ( pv * ) ca_puser ( args.chid ); if ( args.op == CA_OP_CONN_UP ) { nConn++; - if (!ppv->onceConnected) { + + if (ppv->onceConnected && ppv->dbfType != ca_field_type(ppv->chid)) { + /* Data type has changed. Rebuild connection with new type. */ + ca_clear_subscription(ppv->evid); + ppv->evid = NULL; + } + + if (!ppv->evid) { ppv->onceConnected = 1; /* Set up pv structure */ /* ------------------- */ @@ -169,7 +176,7 @@ static void connection_handler ( struct connection_handler_args args ) eventMask, event_handler, (void*)ppv, - NULL); + &ppv->evid); } } else if ( args.op == CA_OP_CONN_DOWN ) { diff --git a/src/ca/client/tools/tool_lib.h b/src/ca/client/tools/tool_lib.h index fb5c4af3c..58cf182c0 100644 --- a/src/ca/client/tools/tool_lib.h +++ b/src/ca/client/tools/tool_lib.h @@ -78,6 +78,7 @@ typedef struct epicsTimeStamp tsPreviousS; char firstStampPrinted; char onceConnected; + evid evid; } pv; From ad44c7a501fa38d6e97f15313e4a2ef17e0e93ab Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 8 Apr 2020 17:21:49 -0700 Subject: [PATCH 122/216] update PVA --- modules/pvAccess | 2 +- modules/pvDatabase | 2 +- modules/pva2pva | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/pvAccess b/modules/pvAccess index 2c199fe50..ef4bf9120 160000 --- a/modules/pvAccess +++ b/modules/pvAccess @@ -1 +1 @@ -Subproject commit 2c199fe50c20b9038d87c68924d3aef5f3c2fa45 +Subproject commit ef4bf9120e2d624dab8d25af49d627380c8c98d5 diff --git a/modules/pvDatabase b/modules/pvDatabase index 80baccfd9..634153a28 160000 --- a/modules/pvDatabase +++ b/modules/pvDatabase @@ -1 +1 @@ -Subproject commit 80baccfd9cef394771bde679cee8e047e86cca0f +Subproject commit 634153a28d42e8a41fefb8dea7ec2863c0f36bf2 diff --git a/modules/pva2pva b/modules/pva2pva index 1d9fbbea0..29a6f261d 160000 --- a/modules/pva2pva +++ b/modules/pva2pva @@ -1 +1 @@ -Subproject commit 1d9fbbea0b2abba9cf41439be618580e4cf95d89 +Subproject commit 29a6f261dcd28e213d273d5b2acb0ae7408dfcb2 From 2aecf3142a23a273d346a9289431f0d8a5f275fd Mon Sep 17 00:00:00 2001 From: Martin Konrad Date: Mon, 13 Apr 2020 16:29:24 -0400 Subject: [PATCH 123/216] Explicitly specify worker image --- appveyor.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index ff829f801..bc04839e5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -40,14 +40,18 @@ configuration: # Environment variables: compiler toolchain environment: matrix: - - TOOLCHAIN: 10.0 - - TOOLCHAIN: 11.0 - - TOOLCHAIN: 12.0 - - TOOLCHAIN: 14.0 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + TOOLCHAIN: 10.0 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + TOOLCHAIN: 11.0 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + TOOLCHAIN: 12.0 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + TOOLCHAIN: 14.0 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 TOOLCHAIN: 2017 - - TOOLCHAIN: mingw - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + TOOLCHAIN: mingw # Platform: architecture platform: From 38339b6ccf693355ebc55f84c6a6484657560d21 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 13 Apr 2020 17:56:09 -0500 Subject: [PATCH 124/216] Initialize main thread as OkToBlock --- src/libCom/osi/epicsThread.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libCom/osi/epicsThread.cpp b/src/libCom/osi/epicsThread.cpp index 892d73de0..3e2d5f2e1 100644 --- a/src/libCom/osi/epicsThread.cpp +++ b/src/libCom/osi/epicsThread.cpp @@ -350,5 +350,11 @@ extern "C" { } } // extern "C" -// Ensure the main thread gets a unique ID -epicsThreadId epicsThreadMainId = epicsThreadGetIdSelf(); +static epicsThreadId initMainThread(void) { + epicsThreadId main = epicsThreadGetIdSelf(); + epicsThreadSetOkToBlock(1); + return main; +} + +// Ensure the main thread gets a unique ID and allows blocking I/O +epicsThreadId epicsThreadMainId = initMainThread(); From 0dd5f863ef740dc98b6da11c95292ddfee642140 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 13 Apr 2020 17:57:33 -0500 Subject: [PATCH 125/216] Add some release notes --- documentation/RELEASE_NOTES.md | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/documentation/RELEASE_NOTES.md b/documentation/RELEASE_NOTES.md index 9b35b4a8b..0bb0b8ac9 100644 --- a/documentation/RELEASE_NOTES.md +++ b/documentation/RELEASE_NOTES.md @@ -6,6 +6,47 @@ This version of EPICS Base has not been released yet. +### epicsThread: Main thread defaults to allow blocking I/O + +VxWorks IOCs (and potentially RTEMS IOCs running GeSys) have had problems with +garbled error messages from dbStaticLib routines for some time — messages +printed before `iocInit` were being queued through the errlog thread instead of +being output immediately. This has been fixed by initializing the main thread +with its `OkToBlock` flag set instead of cleared. IOCs running on other +operating systems that use iocsh to execute the startup script previously had +that set anyway in iocsh so were not affected, but this change might cause other +programs that don't use iocsh to change their behavior slightly if they use +`errlogPrintf()`, `epicsPrintf()` or `errPrintf()`. + +### catools: Handle data type changes in camonitor + +The camonitor program didn't properly cope if subscribed to a channel whose data +type changed when its IOC was rebooted without restarting the camonitor program. +This has now been fixed. + +### More Record Reference Documentation + +The remaining record types have had their reference pages moved from the Wiki, +and some new reference pages have been written to cover the analog array and +long string input and output record types plus the printf recor type, none of +which were previously documented. The wiki reference pages covering the fields +common to all, input, and output record types have also been added, thanks to +Rolf Keitel. The POD conversion scripts have also been improved and they now +properly support linking to subsections in a different document, although the +POD changes to add the cross-links that appeared in the original wiki pages +still needs to be done in most cases. + +### Fix build issues with newer MinGW versions + +The `clock_gettime()` routine is no longer used under MinGW since newer versions +don't provide it any more. + +### Fix race for port in RSRV when multiple IOCs start simultaneously + +If multiple IOCs were started at the same time, by systemd say, they could race +to obtain the Channel Access TCP port number 5064. This issue has been fixed. + + ## Changes made between 3.15.6 and 3.15.7 ### GNU Readline detection on Linux From 45cf2ea5ceb7bcbe30788061e13e64f2e4146389 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 14 Apr 2020 16:41:20 -0500 Subject: [PATCH 126/216] Modify the POD to HTML conversion code to work on older Perls --- src/tools/EPICS/PodHtml.pm | 20 ++++++++++++++++++-- src/tools/EPICS/PodXHtml.pm | 23 +++++++++++++++++++++-- src/tools/dbdToHtml.pl | 19 +------------------ 3 files changed, 40 insertions(+), 22 deletions(-) diff --git a/src/tools/EPICS/PodHtml.pm b/src/tools/EPICS/PodHtml.pm index ccfbe4729..785372159 100644 --- a/src/tools/EPICS/PodHtml.pm +++ b/src/tools/EPICS/PodHtml.pm @@ -5,6 +5,20 @@ use warnings; use base 'Pod::Simple::HTML'; +sub encode_entities { + my ($self, $str) = @_; + my %entities = ( + q{>} => 'gt', + q{<} => 'lt', + q{'} => '#39', + q{"} => 'quot', + q{&} => 'amp' + ); + my $ents = join '', keys %entities; + $str =~ s/([$ents])/'&' . $entities{$1} . ';'/ge; + return $str; +} + # Translate L # into link text @@ -18,9 +32,11 @@ sub do_pod_link { if ($link->tagname eq 'L' and $link->attr('type') eq 'pod') { my $to = $link->attr('to'); my $section = $link->attr('section'); + $section = $self->section_escape($section) + if defined $section and length($section .= ''); # (stringify) - $ret = $to ? "$to.html" : ''; - $ret .= "#$section" if $section; + $ret = (defined $to and length $to) ? "$to.html" : ''; + $ret .= "#$section" if defined $section and length $section; } else { # all other links are generated by the parent class diff --git a/src/tools/EPICS/PodXHtml.pm b/src/tools/EPICS/PodXHtml.pm index d922c0645..d39212988 100644 --- a/src/tools/EPICS/PodXHtml.pm +++ b/src/tools/EPICS/PodXHtml.pm @@ -5,15 +5,34 @@ use warnings; use base 'Pod::Simple::XHTML'; +BEGIN { + if ($Pod::Simple::XHTML::VERSION < '3.16') { + # encode_entities() wasn't a method, add it + our *encode_entities = sub { + my ($self, $str) = @_; + my %entities = ( + q{>} => 'gt', + q{<} => 'lt', + q{'} => '#39', + q{"} => 'quot', + q{&} => 'amp' + ); + my $ents = join '', keys %entities; + $str =~ s/([$ents])/'&' . $entities{$1} . ';'/ge; + return $str; + } + } +} + # Translate L # into link text sub resolve_pod_page_link { my ($self, $to, $section) = @_; - my $ret = $to ? "$to.html" : ''; + my $ret = defined $to ? "$to.html" : ''; $ret .= '#' . $self->idify($self->encode_entities($section), 1) - if $section; + if defined $section; return $ret; } diff --git a/src/tools/dbdToHtml.pl b/src/tools/dbdToHtml.pl index afbb0a601..0bfeb19a3 100644 --- a/src/tools/dbdToHtml.pl +++ b/src/tools/dbdToHtml.pl @@ -19,26 +19,9 @@ use EPICS::Readfile; BEGIN { $::XHTML = eval "require EPICS::PodXHtml; 1"; - $::ENTITIES = eval "require HTML::Entities; 1"; if (!$::XHTML) { require EPICS::PodHtml; } - if (!$::ENTITIES) { - my %entities = ( - q{>} => 'gt', - q{<} => 'lt', - q{'} => '#39', - q{"} => 'quot', - q{&} => 'amp', - ); - - sub encode_entities { - my $str = shift; - my $ents = join '', keys %entities; - $str =~ s/([ $ents ])/'&' . ($entities{$1} || sprintf '#x%X', ord $1) . ';'/xge; - return $str; - } - } } use Pod::Usage; @@ -190,7 +173,7 @@ my $pod = join "\n", '=for html
', '', } $dbd->pod, '=for html
', ''; -$podHtml->force_title(encode_entities($title)); +$podHtml->force_title($podHtml->encode_entities($title)); $podHtml->perldoc_url_prefix(''); $podHtml->perldoc_url_postfix('.html'); $podHtml->output_fh($out); From cbf917e8332d620b6a2f60ea9822d1f84467ef28 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Thu, 16 Apr 2020 12:04:16 +0200 Subject: [PATCH 127/216] Improve automated testing rules to allow other test frameworks - make runtests a double-colon rule, so that other test frameworks can add their own recipes independently - only define runtests:: $TESTSCRIPTS rule when there are TESTSCRIPTS (to avoid having it run every time when no TESTSCRIPTS are defined) - $(strip $TAPFILES) inside ifneq to fix trouble when TAPFILES=' ' --- configure/RULES_BUILD | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/configure/RULES_BUILD b/configure/RULES_BUILD index ca05f19c6..8bc94ba33 100644 --- a/configure/RULES_BUILD +++ b/configure/RULES_BUILD @@ -335,10 +335,12 @@ $(MODNAME): %$(MODEXT): %$(EXE) #--------------------------------------------------------------- # Automated testing -runtests: $(TESTSCRIPTS) +ifneq ($(strip $(TESTSCRIPTS)),) +runtests:: $(TESTSCRIPTS) ifdef RUNTESTS_ENABLED -$(PERL) -MTest::Harness -e 'runtests @ARGV if @ARGV;' $^ endif +endif testspec: $(TESTSCRIPTS) @$(RM) $@ @@ -349,7 +351,7 @@ testspec: $(TESTSCRIPTS) $(if $(TESTSPEC_$(OS_CLASS)), @echo "Harness: $(TESTSPEC_$(OS_CLASS))" >> $@) test-results: tapfiles -ifneq ($(TAPFILES),) +ifneq ($(strip $(TAPFILES)),) ifdef RUNTESTS_ENABLED $(PROVE) --failures --ext .tap --exec "$(CAT)" --color $(TAPFILES) endif From 1492baace9374f66a0dcd9b7bdb7babe2a8997c1 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 8 Apr 2020 15:27:21 -0700 Subject: [PATCH 128/216] WIN32: epicsLoadError() strip trailing newlines --- modules/libcom/src/osi/os/WIN32/osdFindSymbol.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c b/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c index 19dc5e59a..743404611 100644 --- a/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c +++ b/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c @@ -43,14 +43,23 @@ epicsShareFunc void * epicsLoadLibrary(const char *name) epicsShareFunc const char *epicsLoadError(void) { STORE char buffer[100]; + DWORD n; - FormatMessage( + n = FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, NULL, epicsLoadErrorCode, 0, buffer, sizeof(buffer)-1, NULL ); + + /* n - number of chars stored excluding nil. + * + * Some messages include a trailing newline, which we strip. + */ + for(; n>=1 && (buffer[n-1]=='\n' || buffer[n-1]=='\r'); n--) + buffer[n-1] = '\0'; + return buffer; } From db2cd68ce3ac9cf0b26a1505a5a39f368b103e7a Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 31 Mar 2020 22:24:31 -0700 Subject: [PATCH 129/216] WIN32: osdFindSymbol() use psapi --- configure/os/CONFIG.linux-x86.win32-x86-mingw | 2 +- configure/os/CONFIG.win32-x86-mingw.win32-x86-mingw | 2 +- modules/libcom/src/osi/os/WIN32/osdFindSymbol.c | 13 +++++++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/configure/os/CONFIG.linux-x86.win32-x86-mingw b/configure/os/CONFIG.linux-x86.win32-x86-mingw index bd75f5ebd..655b33f23 100644 --- a/configure/os/CONFIG.linux-x86.win32-x86-mingw +++ b/configure/os/CONFIG.linux-x86.win32-x86-mingw @@ -21,4 +21,4 @@ LOADABLE_SHRLIB_LDFLAGS = -shared \ GNU_LDLIBS_YES = # Link with system libraries -OP_SYS_LDLIBS = -lws2_32 -ladvapi32 -luser32 -lkernel32 -lwinmm -ldbghelp +OP_SYS_LDLIBS = -lpsapi -lws2_32 -ladvapi32 -luser32 -lkernel32 -lwinmm -ldbghelp diff --git a/configure/os/CONFIG.win32-x86-mingw.win32-x86-mingw b/configure/os/CONFIG.win32-x86-mingw.win32-x86-mingw index a08f19902..8430011c4 100644 --- a/configure/os/CONFIG.win32-x86-mingw.win32-x86-mingw +++ b/configure/os/CONFIG.win32-x86-mingw.win32-x86-mingw @@ -32,4 +32,4 @@ LOADABLE_SHRLIB_LDFLAGS = -shared \ GNU_LDLIBS_YES = # Link with system libraries -OP_SYS_LDLIBS = -lws2_32 -ladvapi32 -luser32 -lkernel32 -lwinmm -ldbghelp +OP_SYS_LDLIBS = -lpsapi -lws2_32 -ladvapi32 -luser32 -lkernel32 -lwinmm -ldbghelp diff --git a/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c b/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c index 743404611..80b3c292b 100644 --- a/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c +++ b/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c @@ -5,10 +5,15 @@ \*************************************************************************/ /* osi/os/WIN32/osdFindSymbol.c */ -/* avoid need to link against psapi.dll - * requires windows 7 or later +/* Avoid need to link against psapi.dll. requires windows 7 or later. + * MinGW doesn't provide wrappers until 6.0, so fallback to psapi.dll */ -#define NTDDI_VERSION NTDDI_WIN7 +#ifdef _MSC_VER +# define NTDDI_VERSION NTDDI_WIN7 +# define epicsEnumProcessModules K32EnumProcessModules +#else +# define epicsEnumProcessModules EnumProcessModules +#endif #include #include @@ -72,7 +77,7 @@ epicsShareFunc void * epicsShareAPI epicsFindSymbol(const char *name) /* As a handle returned by LoadLibrary() isn't available to us, * try all loaded modules in arbitrary order. */ - if(K32EnumProcessModules(GetCurrentProcess(), dlls, sizeof(dlls), &ndlls)) { + if(epicsEnumProcessModules(GetCurrentProcess(), dlls, sizeof(dlls), &ndlls)) { for(i=0; !ret && i Date: Thu, 16 Apr 2020 17:10:53 -0500 Subject: [PATCH 130/216] Added Mark Rivers' tests for the message queue timeout bug --- src/libCom/test/epicsMessageQueueTest.cpp | 49 ++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/src/libCom/test/epicsMessageQueueTest.cpp b/src/libCom/test/epicsMessageQueueTest.cpp index ae090fc47..5e803ea15 100644 --- a/src/libCom/test/epicsMessageQueueTest.cpp +++ b/src/libCom/test/epicsMessageQueueTest.cpp @@ -27,6 +27,7 @@ static volatile int sendExit = 0; static volatile int recvExit = 0; static epicsEventId finished; static unsigned int mediumStack; +static int numReceived; /* * In Numerical Recipes in C: The Art of Scientific Computing (William H. @@ -115,6 +116,21 @@ receiver(void *arg) epicsEventSignal(finished); } +extern "C" void +fastReceiver(void *arg) +{ + epicsMessageQueue *q = (epicsMessageQueue *)arg; + char cbuf[80]; + int len; + numReceived = 0; + while (!recvExit) { + len = q->receive(cbuf, sizeof cbuf, 0.01); + if (len > 0) { + numReceived++; + } + } +} + extern "C" void sender(void *arg) { @@ -140,8 +156,10 @@ extern "C" void messageQueueTest(void *parm) int len; int pass; int want; + int numSent = 0; epicsMessageQueue *q1 = new epicsMessageQueue(4, 20); + epicsMessageQueue *q2 = new epicsMessageQueue(4, 20); testDiag("Simple single-thread tests:"); i = 0; @@ -251,6 +269,35 @@ extern "C" void messageQueueTest(void *parm) testOk(q1->send((void *)msg1, 10) == 0, "Send with no receiver"); epicsThreadSleep(2.0); + testDiag("Single receiver with timeout, single sender with sleep tests:"); + testDiag("These tests last 20 seconds ..."); + epicsThreadCreate("Fast Receiver", epicsThreadPriorityMedium, + mediumStack, fastReceiver, q2); + numSent = 0; + numReceived = 0; + for (i = 0 ; i < 1000 ; i++) { + if (q2->send((void *)msg1, 4) == 0) { + numSent++; + } + epicsThreadSleep(0.011); + } + epicsThreadSleep(1.0); + if (!testOk(numSent == 1000 && numReceived == 1000, "sleep=0.011")) { + testDiag("numSent should be 1000, actual=%d, numReceived should be 1000, actual=%d", numSent, numReceived); + } + numSent = 0; + numReceived = 0; + for (i = 0 ; i < 1000 ; i++) { + if (q2->send((void *)msg1, 4) == 0) { + numSent++; + } + epicsThreadSleep(0.010); + } + epicsThreadSleep(1.0); + if (!testOk(numSent == 1000 && numReceived == 1000, "sleep=0.010")) { + testDiag("numSent should be 1000, actual=%d, numReceived should be 1000, actual=%d", numSent, numReceived); + } + testDiag("Single receiver, single sender tests:"); epicsThreadSetPriority(myThreadId, epicsThreadPriorityHigh); epicsThreadCreate("Receiver one", epicsThreadPriorityMedium, @@ -312,7 +359,7 @@ extern "C" void messageQueueTest(void *parm) MAIN(epicsMessageQueueTest) { - testPlan(62); + testPlan(64); finished = epicsEventMustCreate(epicsEventEmpty); mediumStack = epicsThreadGetStackSize(epicsThreadStackMedium); From a9727fd5cbd6c27d4ecf6a61e6984537c3cbc5fe Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 16 Apr 2020 17:12:25 -0500 Subject: [PATCH 131/216] Ben Franksen's fix for lp: #1868486 --- src/libCom/osi/os/default/osdMessageQueue.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/libCom/osi/os/default/osdMessageQueue.cpp b/src/libCom/osi/os/default/osdMessageQueue.cpp index fabfa1b85..fc50a36b7 100644 --- a/src/libCom/osi/os/default/osdMessageQueue.cpp +++ b/src/libCom/osi/os/default/osdMessageQueue.cpp @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Author W. Eric Norum @@ -50,7 +50,7 @@ struct epicsMessageQueueOSD { ELLLIST receiveQueue; ELLLIST eventFreeList; int numberOfSendersWaiting; - + epicsMutexId mutex; unsigned long capacity; unsigned long maxMessageSize; @@ -335,11 +335,10 @@ myReceive(epicsMessageQueueId pmsg, void *message, unsigned int size, ellAdd(&pmsg->receiveQueue, &threadNode.link); epicsMutexUnlock(pmsg->mutex); - epicsEventStatus status; if (timeout > 0) - status = epicsEventWaitWithTimeout(threadNode.evp->event, timeout); + epicsEventWaitWithTimeout(threadNode.evp->event, timeout); else - status = epicsEventWait(threadNode.evp->event); + epicsEventWait(threadNode.evp->event); epicsMutexMustLock(pmsg->mutex); @@ -349,8 +348,7 @@ myReceive(epicsMessageQueueId pmsg, void *message, unsigned int size, epicsMutexUnlock(pmsg->mutex); - if (threadNode.eventSent && (threadNode.size <= size) && - status == epicsEventOK) + if (threadNode.eventSent && (threadNode.size <= size)) return threadNode.size; return -1; } From 841effe9eebf8e572ebe910e6ec6999a9379739c Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 16 Apr 2020 17:14:58 -0500 Subject: [PATCH 132/216] epicsMessageQueueTest: Shorten the 1R4S tests --- src/libCom/test/epicsMessageQueueTest.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libCom/test/epicsMessageQueueTest.cpp b/src/libCom/test/epicsMessageQueueTest.cpp index 5e803ea15..1bee13c36 100644 --- a/src/libCom/test/epicsMessageQueueTest.cpp +++ b/src/libCom/test/epicsMessageQueueTest.cpp @@ -332,7 +332,7 @@ extern "C" void messageQueueTest(void *parm) * Single receiver, multiple sender tests */ testDiag("Single receiver, multiple sender tests:"); - testDiag("This test lasts 60 seconds..."); + testDiag("This test lasts 30 seconds..."); testOk(!!epicsThreadCreate("Sender 1", epicsThreadPriorityLow, mediumStack, sender, q1), "Created Sender 1"); @@ -346,9 +346,9 @@ extern "C" void messageQueueTest(void *parm) mediumStack, sender, q1), "Created Sender 4"); - for (i = 0; i < 10; i++) { - testDiag("... %2d", 10 - i); - epicsThreadSleep(6.0); + for (i = 0; i < 6; i++) { + testDiag("... %2d", 6 - i); + epicsThreadSleep(5.0); } sendExit = 1; From 648589e6ab234cf95e5cf394bbee6ec4442959e9 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 17 Apr 2020 16:42:18 -0500 Subject: [PATCH 133/216] podToHtml: Add bootstrap search path for EPICS::PodHtml --- src/tools/podToHtml.pl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/tools/podToHtml.pl b/src/tools/podToHtml.pl index 21bf3a161..f661ad3f4 100644 --- a/src/tools/podToHtml.pl +++ b/src/tools/podToHtml.pl @@ -9,8 +9,12 @@ use strict; use warnings; +# To find the EPICS::PodHtml module used below we need to add our lib/perl to +# the lib search path. If the script is running from the src/tools directory +# before everything has been installed though, the search path must include +# our source directory (i.e. $Bin), so we add both here. use FindBin qw($Bin); -use lib "$Bin/../../lib/perl"; +use lib ("$Bin/../../lib/perl", $Bin); use Getopt::Std; use EPICS::PodHtml; From 566ab038d29447c2c6c33e94b493207eb9b0ffa1 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 17 Apr 2020 16:51:48 -0500 Subject: [PATCH 134/216] Make test-results not fail so it shows all results For some reason 'make -k test-results' isn't always doing the -k (continue-on-error) on Windows. --- configure/RULES_BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure/RULES_BUILD b/configure/RULES_BUILD index 8bc94ba33..6145927d2 100644 --- a/configure/RULES_BUILD +++ b/configure/RULES_BUILD @@ -353,7 +353,7 @@ testspec: $(TESTSCRIPTS) test-results: tapfiles ifneq ($(strip $(TAPFILES)),) ifdef RUNTESTS_ENABLED - $(PROVE) --failures --ext .tap --exec "$(CAT)" --color $(TAPFILES) + -$(PROVE) --failures --ext .tap --exec "$(CAT)" --color $(TAPFILES) endif CURRENT_TAPFILES := $(wildcard $(TAPFILES)) From 3790ce4452e145d491604724698db2e4ba212358 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 18 Apr 2020 00:18:11 -0500 Subject: [PATCH 135/216] Have 'make test-results' fail nicely if any tests did Lists the directories with failed tests at the end of the build. It is no longer necessary to use 'make -k' to see the results of all tests after one or more failures as only the top-level test-results recipe will generate a build error. --- .gitignore | 1 + configure/CONFIG_BASE | 11 +++++++++-- configure/RULES_BUILD | 2 +- configure/RULES_DIRS | 9 +++++---- configure/RULES_TOP | 5 +++++ src/tools/Makefile | 1 + src/tools/testFailures.pl | 31 +++++++++++++++++++++++++++++++ 7 files changed, 53 insertions(+), 7 deletions(-) create mode 100644 src/tools/testFailures.pl diff --git a/.gitignore b/.gitignore index 2dd7304c2..27871fffe 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ /include/ /templates/ /configure/*.local +/.tests-failed O.*/ /QtC-* *.orig diff --git a/configure/CONFIG_BASE b/configure/CONFIG_BASE index c979d6d7c..54747d8e3 100644 --- a/configure/CONFIG_BASE +++ b/configure/CONFIG_BASE @@ -68,8 +68,6 @@ DBTOMENUH = $(PERL) $(TOOLS)/dbdToMenuH.pl REGISTERRECORDDEVICEDRIVER = $(PERL) $(TOOLS)/registerRecordDeviceDriver.pl CONVERTRELEASE = $(PERL) $(call FIND_TOOL,convertRelease.pl) FULLPATHNAME = $(PERL) $(TOOLS)/fullPathName.pl -TAPTOJUNIT = $(PERL) $(TOOLS)/tap-to-junit-xml.pl -PROVE = $(PERL) $(TOOLS)/epicsProve.pl #------------------------------------------------------- # tools for installing libraries and products @@ -83,6 +81,15 @@ INSTALL_LIBRARY = $(INSTALL) MKMF = $(PERL) $(TOOLS)/mkmf.pl REPLACEVAR = $(PERL) $(TOOLS)/replaceVAR.pl +#--------------------------------------------------------------- +# Tools for testing +TAPTOJUNIT = $(PERL) $(TOOLS)/tap-to-junit-xml.pl +PROVE = $(PERL) $(TOOLS)/epicsProve.pl +PROVE.tap = $(PROVE) --ext .tap --exec "$(CAT)" + +TEST_FAILURE_FILE = $(TOP)/.tests-failed +PROVE_FAILURE = echo $(abspath .)>> $(TEST_FAILURE_FILE) + #--------------------------------------------------------------- # private versions of lex/yacc from EPICS EYACC = $(TOOLS)/antelope$(HOSTEXE) diff --git a/configure/RULES_BUILD b/configure/RULES_BUILD index 6145927d2..beace64c6 100644 --- a/configure/RULES_BUILD +++ b/configure/RULES_BUILD @@ -353,7 +353,7 @@ testspec: $(TESTSCRIPTS) test-results: tapfiles ifneq ($(strip $(TAPFILES)),) ifdef RUNTESTS_ENABLED - -$(PROVE) --failures --ext .tap --exec "$(CAT)" --color $(TAPFILES) + -$(PROVE.tap) --failures --color $(TAPFILES) || $(PROVE_FAILURE) endif CURRENT_TAPFILES := $(wildcard $(TAPFILES)) diff --git a/configure/RULES_DIRS b/configure/RULES_DIRS index 37cea5e9a..e90006890 100644 --- a/configure/RULES_DIRS +++ b/configure/RULES_DIRS @@ -4,7 +4,7 @@ # Copyright (c) 2002 The Regents of the University of California, as # Operator of Los Alamos National Laboratory. # EPICS BASE is distributed subject to a Software License Agreement found -# in the file LICENSE that is included with this distribution. +# in the file LICENSE that is included with this distribution. #************************************************************************* ARCHS += $(BUILD_ARCHS) @@ -79,14 +79,15 @@ $(foreach arch, $(ARCHS), \ dirPart = $(join $(dir $@), $(word 1, $(subst $(DIVIDER), ,$(notdir $@)))) actionArchPart = $(join $(word 2, $(subst $(DIVIDER), ,$(notdir $@))), \ - $(addprefix $(DIVIDER),$(word 3, $(subst $(DIVIDER), ,$(notdir $@))))) -$(DIRS) $(dirActionTargets) $(dirArchTargets) $(dirActionArchTargets) : + $(addprefix $(DIVIDER),$(word 3, $(subst $(DIVIDER), ,$(notdir $@))))) + +$(DIRS) $(dirActionTargets) $(dirArchTargets) $(dirActionArchTargets): pre-make $(MAKE) -C $(dirPart) $(actionArchPart) $(ARCHS) $(ACTIONS) $(actionArchTargets) :%: \ $(foreach dir, $(DIRS), $(dir)$(DIVIDER)%) -.PHONY : $(DIRS) all host rebuild +.PHONY : $(DIRS) all host rebuild pre-make .PHONY : $(ARCHS) $(ACTIONS) .PHONY : $(dirActionTargets) $(dirArchTargets) .PHONY : $(dirActionArchTargets) diff --git a/configure/RULES_TOP b/configure/RULES_TOP index 176454187..627f4b63c 100644 --- a/configure/RULES_TOP +++ b/configure/RULES_TOP @@ -35,6 +35,11 @@ uninstall$(DIVIDER)%: $(RMDIR) $(addsuffix /$(subst uninstall$(DIVIDER),,$@), \ $(INSTALL_LOCATION_BIN) $(INSTALL_LOCATION_LIB)) +pre-make: + @$(if $(filter test-results, $(MAKECMDGOALS)), \ + $(RM) $(TEST_FAILURE_FILE)) +test-results: + $(PERL) $(TOOLS)/testFailures.pl $(TEST_FAILURE_FILE) help: @echo "Usage: gnumake [options] [target] ..." diff --git a/src/tools/Makefile b/src/tools/Makefile index 26c0ed99a..faa08abbf 100644 --- a/src/tools/Makefile +++ b/src/tools/Makefile @@ -52,6 +52,7 @@ PERL_SCRIPTS += mkmf.pl PERL_SCRIPTS += munch.pl PERL_SCRIPTS += replaceVAR.pl PERL_SCRIPTS += tap-to-junit-xml.pl +PERL_SCRIPTS += testFailures.pl PERL_SCRIPTS += useManifestTool.pl PERL_SCRIPTS += dbdToMenuH.pl diff --git a/src/tools/testFailures.pl b/src/tools/testFailures.pl new file mode 100644 index 000000000..e74dd269f --- /dev/null +++ b/src/tools/testFailures.pl @@ -0,0 +1,31 @@ +#!/usr/bin/env perl +#************************************************************************* +# EPICS BASE is distributed subject to a Software License Agreement found +# in the file LICENSE that is included with this distribution. +#************************************************************************* + +# This file may appear trivial, but it exists to let the build system +# fail the 'make test-results' target with a nice output including a +# summary of the directories where test failures were reported. +# Test results are collected from the .tap files fed to epicsProve.pl +# which returns with an exit status of 0 (success) if all tests passed +# or 1 (failure) if any of the .tap files contained failed tests. +# When epicsProve.pl indicates a failure, the directory that it was +# running in is appended to the file $(TOP)/.tests-failed which this +# program reads in after all the test directories have been visited. +# The exit status of this program is 1 (failure) if any tests failed, +# otherwise 0 (success). + +use strict; +use warnings; + +die "Usage: testFailures.pl .tests-failed\n" + unless @ARGV == 1; + +open FAILURES, '<', shift or + exit 0; + +print "\nTest failures were reported in:\n", + map {" $_\n"} ; + +exit 1; From 91c18c32d461dfe1edb3672e7e5afee01de89a2f Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 18 Apr 2020 00:36:35 -0500 Subject: [PATCH 136/216] Have Appveyor make 'tapfiles test-results' instead of 'runtests' --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index bc04839e5..a76d7c525 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -77,7 +77,7 @@ build_script: - cmd: ci/appveyor-make.bat test_script: - - cmd: ci/appveyor-make.bat runtests + - cmd: ci/appveyor-make.bat tapfiles test-results #---------------------------------# # notifications # From 6e41f2911b9fba25d26ade8affa7f3ab9fb0e3dd Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Sat, 18 Apr 2020 07:33:57 -0700 Subject: [PATCH 137/216] WIN32: GetLastError() returns DWORD --- modules/libcom/src/osi/os/WIN32/osdFindSymbol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c b/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c index 80b3c292b..2753f0959 100644 --- a/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c +++ b/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c @@ -30,7 +30,7 @@ #endif STORE -int epicsLoadErrorCode = 0; +DWORD epicsLoadErrorCode = 0; epicsShareFunc void * epicsLoadLibrary(const char *name) { From aa7c2a647c054fb6417da635efcf1f3a724b5eba Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Sat, 18 Apr 2020 07:35:21 -0700 Subject: [PATCH 138/216] fix epicsLoadError() FORMAT_MESSAGE_IGNORE_INSERTS as no va_list is provided. Handle possibility of n=0 if unable to lookup error. --- .../libcom/src/osi/os/WIN32/osdFindSymbol.c | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c b/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c index 2753f0959..6c1fb401c 100644 --- a/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c +++ b/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c @@ -51,19 +51,27 @@ epicsShareFunc const char *epicsLoadError(void) DWORD n; n = FormatMessage( - FORMAT_MESSAGE_FROM_SYSTEM, + FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, NULL, epicsLoadErrorCode, 0, buffer, sizeof(buffer)-1, NULL ); - /* n - number of chars stored excluding nil. - * - * Some messages include a trailing newline, which we strip. - */ - for(; n>=1 && (buffer[n-1]=='\n' || buffer[n-1]=='\r'); n--) - buffer[n-1] = '\0'; + if(n) { + /* n - number of chars stored excluding nil. + * + * Some messages include a trailing newline, which we strip. + */ + for(; n>=1 && (buffer[n-1]=='\n' || buffer[n-1]=='\r'); n--) + buffer[n-1] = '\0'; + } else { + epicsSnprintf(buffer, sizeof(buffer), + "Unable to format WIN32 error code %lu", + (unsigned long)epicsLoadErrorCode); + buffer[sizeof(buffer)-1] = '\0'; + + } return buffer; } From 9edb9c2050490d405f673da689e6e47309f15635 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Sat, 18 Apr 2020 08:18:03 -0700 Subject: [PATCH 139/216] WIN32: epicsFindSymbol() fix use of EnumProcessModules() --- .../libcom/src/osi/os/WIN32/osdFindSymbol.c | 36 +++++++++++++++---- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c b/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c index 6c1fb401c..c8c74b56d 100644 --- a/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c +++ b/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c @@ -19,6 +19,7 @@ #include #define epicsExportSharedSymbols +#include "epicsStdio.h" #include "epicsFindSymbol.h" #ifdef _MSC_VER @@ -78,23 +79,44 @@ epicsShareFunc const char *epicsLoadError(void) epicsShareFunc void * epicsShareAPI epicsFindSymbol(const char *name) { - HMODULE dlls[128]; - DWORD ndlls=0u, i; + HANDLE proc = GetCurrentProcess(); + HMODULE *dlls=NULL; + DWORD nalloc=0u, needed=0u; void* ret = NULL; /* As a handle returned by LoadLibrary() isn't available to us, * try all loaded modules in arbitrary order. */ - if(epicsEnumProcessModules(GetCurrentProcess(), dlls, sizeof(dlls), &ndlls)) { - for(i=0; !ret && i needed) + nalloc = needed; + + for(i=0, ndlls = nalloc/sizeof(*dlls); !ret && i Date: Sat, 18 Apr 2020 08:21:23 -0700 Subject: [PATCH 140/216] epicsLoadTest: test expected failure --- modules/libcom/test/epicsLoadTest.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/libcom/test/epicsLoadTest.cpp b/modules/libcom/test/epicsLoadTest.cpp index 809081072..3062f3b22 100644 --- a/modules/libcom/test/epicsLoadTest.cpp +++ b/modules/libcom/test/epicsLoadTest.cpp @@ -17,6 +17,11 @@ namespace { +void loadBad() +{ + testOk1(!epicsFindSymbol("noSuchFunction")); +} + // lookup a symbol from libCom // which this executable is linked against (maybe statically) // Doesn't work for static builds on windows @@ -70,13 +75,14 @@ void loadCA() MAIN(epicsLoadTest) { - testPlan(3); + testPlan(4); // reference to ensure linkage when linking statically, // and actually use the result to make extra doubly sure that // this call isn't optimized out by eg. an LTO pass. testDiag("# of CPUs %d", epicsThreadGetCPUs()); + loadBad(); #if defined(__rtems__) || defined(vxWorks) testSkip(3, "Target does not implement epicsFindSymbol()"); #else From c6670e756ed85e8517cdd67f21f3d9d5255d4f88 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Sat, 18 Apr 2020 21:33:17 -0700 Subject: [PATCH 141/216] epicsLoadTest: avoid stdcall name mangling on WIN32 --- modules/libcom/test/epicsLoadTest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/libcom/test/epicsLoadTest.cpp b/modules/libcom/test/epicsLoadTest.cpp index 3062f3b22..77b37f2db 100644 --- a/modules/libcom/test/epicsLoadTest.cpp +++ b/modules/libcom/test/epicsLoadTest.cpp @@ -67,8 +67,8 @@ void loadCA() void *ptr = epicsLoadLibrary(libname.c_str()); testOk(!!ptr, "Loaded %p : %s", ptr, epicsLoadError()); - ptr = epicsFindSymbol("ca_context_create"); - testOk(!!ptr, "ca_context_create %p : %s", ptr, epicsLoadError()); + ptr = epicsFindSymbol("dbf_text"); + testOk(!!ptr, "dbf_text %p : %s", ptr, epicsLoadError()); } } // namespace From 379ea6e58688e8f4ed69aa7fa797971b89a50f15 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Sat, 18 Apr 2020 21:41:47 -0700 Subject: [PATCH 142/216] WIN32: epicsFindSymbol() clear error on success --- modules/libcom/src/osi/os/WIN32/osdFindSymbol.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c b/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c index c8c74b56d..6447971fc 100644 --- a/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c +++ b/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c @@ -39,10 +39,7 @@ epicsShareFunc void * epicsLoadLibrary(const char *name) epicsLoadErrorCode = 0; lib = LoadLibrary(name); - if (lib == NULL) - { - epicsLoadErrorCode = GetLastError(); - } + epicsLoadErrorCode = lib ? 0 : GetLastError(); return lib; } @@ -113,10 +110,7 @@ epicsShareFunc void * epicsShareAPI epicsFindSymbol(const char *name) } } - - if(!ret) { - epicsLoadErrorCode = GetLastError(); - } + epicsLoadErrorCode = ret ? 0 : GetLastError(); free(dlls); return ret; } From be061e108493818cb9265465ce115153cd031d20 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 20 Apr 2020 11:31:33 -0500 Subject: [PATCH 143/216] Tidy up testFailures script slighlty --- src/tools/testFailures.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tools/testFailures.pl b/src/tools/testFailures.pl index e74dd269f..e19d00006 100644 --- a/src/tools/testFailures.pl +++ b/src/tools/testFailures.pl @@ -24,8 +24,10 @@ die "Usage: testFailures.pl .tests-failed\n" open FAILURES, '<', shift or exit 0; +my @failures = ; +close FAILURES; print "\nTest failures were reported in:\n", - map {" $_\n"} ; + (map {" $_"} @failures), "\n"; exit 1; From b6556621314d8fca6fcfdbb911cc14a324f315ee Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 20 Apr 2020 11:33:37 -0500 Subject: [PATCH 144/216] Appveyor: Move 'make test-results' to the on_finish stage --- appveyor.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index a76d7c525..891a4b8b2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -77,7 +77,10 @@ build_script: - cmd: ci/appveyor-make.bat test_script: - - cmd: ci/appveyor-make.bat tapfiles test-results + - cmd: ci/appveyor-make.bat tapfiles + +on_finish: + - cmd: ci/appveyor-make.bat -s test-results #---------------------------------# # notifications # From 582a9dbef58903be3c8c3e168b1e8b1f5d573563 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 21 Apr 2020 01:14:03 -0500 Subject: [PATCH 145/216] Replace pre-make rule with before-actions rules For all standard build ACTIONS, a rule before- is run just before running that action in the subdirectories given by the DIRS variable. Only works in Makefiles that include RULES_DIRS or RULES_TOP. --- configure/RULES_DIRS | 14 ++++++++++---- configure/RULES_TOP | 10 +++++----- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/configure/RULES_DIRS b/configure/RULES_DIRS index e90006890..92d2035dc 100644 --- a/configure/RULES_DIRS +++ b/configure/RULES_DIRS @@ -54,7 +54,7 @@ $(foreach dir, $(DIRS), \ define DEP_template2 $(1)$$(DIVIDER)$(2) : $$(foreach ddir, $$($(1)_DEPEND_DIRS), \ - $$(addsuffix $$(DIVIDER)$(2),$$(ddir))) + $$(addsuffix $$(DIVIDER)$(2),$$(ddir))) | before-$(2) endef $(foreach action, $(ACTIONS), \ $(foreach dir, $(DIRS), \ @@ -81,14 +81,20 @@ dirPart = $(join $(dir $@), $(word 1, $(subst $(DIVIDER), ,$(notdir $@)))) actionArchPart = $(join $(word 2, $(subst $(DIVIDER), ,$(notdir $@))), \ $(addprefix $(DIVIDER),$(word 3, $(subst $(DIVIDER), ,$(notdir $@))))) -$(DIRS) $(dirActionTargets) $(dirArchTargets) $(dirActionArchTargets): pre-make +$(DIRS) $(dirActionTargets) $(dirArchTargets) $(dirActionArchTargets): $(MAKE) -C $(dirPart) $(actionArchPart) +# before-action rules are run once prior to recursing through the +# list of subdirectories and running the action rule in each one. +# See DEP_template2 above for how that rule ordering is achieved. +beforeActions = $(addprefix before-,$(ACTIONS)) +$(beforeActions): + $(ARCHS) $(ACTIONS) $(actionArchTargets) :%: \ $(foreach dir, $(DIRS), $(dir)$(DIVIDER)%) -.PHONY : $(DIRS) all host rebuild pre-make -.PHONY : $(ARCHS) $(ACTIONS) +.PHONY : $(DIRS) all host rebuild +.PHONY : $(ARCHS) $(ACTIONS) $(beforeActions) .PHONY : $(dirActionTargets) $(dirArchTargets) .PHONY : $(dirActionArchTargets) .PHONY : $(actionArchTargets) diff --git a/configure/RULES_TOP b/configure/RULES_TOP index 627f4b63c..d77e2a6c3 100644 --- a/configure/RULES_TOP +++ b/configure/RULES_TOP @@ -35,10 +35,10 @@ uninstall$(DIVIDER)%: $(RMDIR) $(addsuffix /$(subst uninstall$(DIVIDER),,$@), \ $(INSTALL_LOCATION_BIN) $(INSTALL_LOCATION_LIB)) -pre-make: - @$(if $(filter test-results, $(MAKECMDGOALS)), \ - $(RM) $(TEST_FAILURE_FILE)) -test-results: +before-runtests before-test-results: rm-failure-file +rm-failure-file: + @$(RM) $(TEST_FAILURE_FILE) +runtests test-results: $(PERL) $(TOOLS)/testFailures.pl $(TEST_FAILURE_FILE) help: @@ -74,7 +74,7 @@ help: @echo " xxxRecord.o" .PHONY: distclean cvsclean realuninstall archuninstall uninstallDirs -.PHONY: uninstall help +.PHONY: uninstall rm-failure-file help # Include /cfg/TOP_RULES* files from tops defined in RELEASE* files # From d05d8807ec7d72558d9f34712f9734e5e048458a Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 21 Apr 2020 01:17:48 -0500 Subject: [PATCH 146/216] Stop generating the testspec file It was created before modern continuous integration systems came along; Diamond were supposed to run the tests for us, but they didn't last for very long. --- configure/RULES_BUILD | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/configure/RULES_BUILD b/configure/RULES_BUILD index beace64c6..fbac3f765 100644 --- a/configure/RULES_BUILD +++ b/configure/RULES_BUILD @@ -105,11 +105,8 @@ PRODTARGETS += $(PRODNAME) $(MUNCHNAME) $(CTDT_SRCS) $(CTDT_OBJS) $(NMS) TESTPRODTARGETS += $(TESTPRODNAME) $(TESTMUNCHNAME) #--------------------------------------------------------------- -# Test specifications and test result files +# Test result files # -ifneq (,$(strip $(TESTS))) -TARGETS += testspec -endif # Enable testing if this host can run tests on the current target ifneq (,$(findstring $(T_A),$(EPICS_HOST_ARCH) $(CROSS_COMPILER_RUNTEST_ARCHS))) @@ -342,14 +339,6 @@ ifdef RUNTESTS_ENABLED endif endif -testspec: $(TESTSCRIPTS) - @$(RM) $@ - @echo OS-class: $(OS_CLASS) > $@ - @echo Target-arch: $(T_A) >> $@ - $(if $^, @echo Tests: $^ >> $@) - $(if $(TESTFILES), @echo Files: $(TESTFILES) >> $@) - $(if $(TESTSPEC_$(OS_CLASS)), @echo "Harness: $(TESTSPEC_$(OS_CLASS))" >> $@) - test-results: tapfiles ifneq ($(strip $(TAPFILES)),) ifdef RUNTESTS_ENABLED From dfbda1394d675213d1e10dc0e1e7df67b923675d Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 21 Apr 2020 01:39:59 -0500 Subject: [PATCH 147/216] Revert the runtests:: change but in an extensible way Use only %.t files in new TESTSCRIPTS.t var for Perl tests. TAPFILES and JUNITFILES can be appended to by other rules. The runtests and test-results rules have no direct recipes. Added run-tap-tests and tap-results rules, simlified recipe. Make %.tap:%.t and %.xml:%.tap into static pattern rules. --- configure/RULES_BUILD | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/configure/RULES_BUILD b/configure/RULES_BUILD index fbac3f765..28ece67e1 100644 --- a/configure/RULES_BUILD +++ b/configure/RULES_BUILD @@ -108,11 +108,12 @@ TESTPRODTARGETS += $(TESTPRODNAME) $(TESTMUNCHNAME) # Test result files # -# Enable testing if this host can run tests on the current target -ifneq (,$(findstring $(T_A),$(EPICS_HOST_ARCH) $(CROSS_COMPILER_RUNTEST_ARCHS))) +# Enable testing if this host can run tests for the current target +ifneq (,$(filter $(T_A), $(EPICS_HOST_ARCH) $(CROSS_COMPILER_RUNTEST_ARCHS))) RUNTESTS_ENABLED = YES -TAPFILES += $(TESTSCRIPTS:.t=.tap) -JUNITFILES += $(TAPFILES:.tap=.xml) +TESTSCRIPTS.t = $(filter %.t, $(TESTSCRIPTS)) +TAPFILES += $(TESTSCRIPTS.t:.t=.tap) +JUNITFILES += $(TESTSCRIPTS.t:.t=.xml) endif #--------------------------------------------------------------- @@ -332,17 +333,22 @@ $(MODNAME): %$(MODEXT): %$(EXE) #--------------------------------------------------------------- # Automated testing -ifneq ($(strip $(TESTSCRIPTS)),) -runtests:: $(TESTSCRIPTS) +runtests: run-tap-tests +run-tap-tests: $(TESTSCRIPTS.t) +ifneq ($(TESTSCRIPTS.t),) ifdef RUNTESTS_ENABLED - -$(PERL) -MTest::Harness -e 'runtests @ARGV if @ARGV;' $^ + $(PROVE) --failures --color $^ || $(PROVE_FAILURE) endif endif -test-results: tapfiles +tapfiles: $(TAPFILES) +junitfiles: $(JUNITFILES) + +test-results: tap-results +tap-results: $(TAPFILES) ifneq ($(strip $(TAPFILES)),) ifdef RUNTESTS_ENABLED - -$(PROVE.tap) --failures --color $(TAPFILES) || $(PROVE_FAILURE) + $(PROVE.tap) --failures --color $^ || $(PROVE_FAILURE) endif CURRENT_TAPFILES := $(wildcard $(TAPFILES)) @@ -357,16 +363,13 @@ ifneq ($(CURRENT_JUNITFILES),) $(RM) $(CURRENT_JUNITFILES) endif -tapfiles: $(TESTSCRIPTS) $(TAPFILES) -junitfiles: $(JUNITFILES) - # A .tap file is the output from running the associated test script -%.tap: %.t +$(TAPFILES): %.tap: %.t ifdef RUNTESTS_ENABLED -$(PERL) $< -tap > $@ endif -%.xml: %.tap +$(JUNITFILES): %.xml: %.tap $(TAPTOJUNIT) --puretap --output $@ --input $< $* # If there's a perl test script (.plt) available, use it @@ -513,8 +516,8 @@ $(INSTALL_TEMPLATES_SUBDIR)/%: % .PRECIOUS: $(COMMON_INC) .PHONY: all host inc build install clean rebuild buildInstall build_clean -.PHONY: runtests tapfiles clean-tests test-results junitfiles -.PHONY: checkRelease warnRelease noCheckRelease +.PHONY: runtests run-tap-tests tapfiles junitfiles test-results tap-results +.PHONY: clean-tests checkRelease warnRelease noCheckRelease endif # BASE_RULES_BUILD # EOF RULES_BUILD From f10d0d95b0618716c03ce9544962a960b4f1a09b Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Tue, 21 Apr 2020 11:45:50 +0200 Subject: [PATCH 148/216] Apply perl rules for .tap and .xml only to perl tests Don't apply the %.tap: %.t and %.xml: %.tap rules to tap and junit result files from other test frameworks. (They would overwrite the other frameworks' own rules.) --- configure/RULES_BUILD | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/configure/RULES_BUILD b/configure/RULES_BUILD index 28ece67e1..c7f3ba7b6 100644 --- a/configure/RULES_BUILD +++ b/configure/RULES_BUILD @@ -112,8 +112,10 @@ TESTPRODTARGETS += $(TESTPRODNAME) $(TESTMUNCHNAME) ifneq (,$(filter $(T_A), $(EPICS_HOST_ARCH) $(CROSS_COMPILER_RUNTEST_ARCHS))) RUNTESTS_ENABLED = YES TESTSCRIPTS.t = $(filter %.t, $(TESTSCRIPTS)) -TAPFILES += $(TESTSCRIPTS.t:.t=.tap) -JUNITFILES += $(TESTSCRIPTS.t:.t=.xml) +TAPFILES.t += $(TESTSCRIPTS.t:.t=.tap) +JUNITFILES.t += $(TESTSCRIPTS.t:.t=.xml) +TAPFILES += $(TAPFILES.t) +JUNITFILES += $(JUNITFILES.t) endif #--------------------------------------------------------------- @@ -364,12 +366,12 @@ ifneq ($(CURRENT_JUNITFILES),) endif # A .tap file is the output from running the associated test script -$(TAPFILES): %.tap: %.t +$(TAPFILES.t): %.tap: %.t ifdef RUNTESTS_ENABLED -$(PERL) $< -tap > $@ endif -$(JUNITFILES): %.xml: %.tap +$(JUNITFILES.t): %.xml: %.tap $(TAPTOJUNIT) --puretap --output $@ --input $< $* # If there's a perl test script (.plt) available, use it From 199979a44c76459c1daf935caca32b8ba253a6af Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Wed, 22 Apr 2020 12:01:24 +0200 Subject: [PATCH 149/216] ci: move .ci -> .ci-local --- {.ci => .ci-local}/appveyor-make.bat | 0 {.ci => .ci-local}/appveyor-prepare.bat | 0 {.ci => .ci-local}/checkout-modules.sh | 0 {.ci => .ci-local}/travis-build.sh | 0 {.ci => .ci-local}/travis-prepare.sh | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename {.ci => .ci-local}/appveyor-make.bat (100%) rename {.ci => .ci-local}/appveyor-prepare.bat (100%) rename {.ci => .ci-local}/checkout-modules.sh (100%) rename {.ci => .ci-local}/travis-build.sh (100%) rename {.ci => .ci-local}/travis-prepare.sh (100%) diff --git a/.ci/appveyor-make.bat b/.ci-local/appveyor-make.bat similarity index 100% rename from .ci/appveyor-make.bat rename to .ci-local/appveyor-make.bat diff --git a/.ci/appveyor-prepare.bat b/.ci-local/appveyor-prepare.bat similarity index 100% rename from .ci/appveyor-prepare.bat rename to .ci-local/appveyor-prepare.bat diff --git a/.ci/checkout-modules.sh b/.ci-local/checkout-modules.sh similarity index 100% rename from .ci/checkout-modules.sh rename to .ci-local/checkout-modules.sh diff --git a/.ci/travis-build.sh b/.ci-local/travis-build.sh similarity index 100% rename from .ci/travis-build.sh rename to .ci-local/travis-build.sh diff --git a/.ci/travis-prepare.sh b/.ci-local/travis-prepare.sh similarity index 100% rename from .ci/travis-prepare.sh rename to .ci-local/travis-prepare.sh From 1ff64f72a9cb9d94bb88bc912973bdcbc062ec0b Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Thu, 23 Apr 2020 16:00:13 +0200 Subject: [PATCH 150/216] ci: move ci -> .ci-local also rename appveyor.yml -> .appveyor.yml --- appveyor.yml => .appveyor.yml | 0 {ci => .ci-local}/appveyor-make.bat | 0 {ci => .ci-local}/appveyor-prepare.bat | 0 {ci => .ci-local}/travis-build.sh | 0 {ci => .ci-local}/travis-prepare.sh | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename appveyor.yml => .appveyor.yml (100%) rename {ci => .ci-local}/appveyor-make.bat (100%) rename {ci => .ci-local}/appveyor-prepare.bat (100%) rename {ci => .ci-local}/travis-build.sh (100%) rename {ci => .ci-local}/travis-prepare.sh (100%) diff --git a/appveyor.yml b/.appveyor.yml similarity index 100% rename from appveyor.yml rename to .appveyor.yml diff --git a/ci/appveyor-make.bat b/.ci-local/appveyor-make.bat similarity index 100% rename from ci/appveyor-make.bat rename to .ci-local/appveyor-make.bat diff --git a/ci/appveyor-prepare.bat b/.ci-local/appveyor-prepare.bat similarity index 100% rename from ci/appveyor-prepare.bat rename to .ci-local/appveyor-prepare.bat diff --git a/ci/travis-build.sh b/.ci-local/travis-build.sh similarity index 100% rename from ci/travis-build.sh rename to .ci-local/travis-build.sh diff --git a/ci/travis-prepare.sh b/.ci-local/travis-prepare.sh similarity index 100% rename from ci/travis-prepare.sh rename to .ci-local/travis-prepare.sh From 54efe4b7cd70edb1315b43e11a5b9d5f425bad59 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Thu, 23 Apr 2020 17:57:48 +0200 Subject: [PATCH 151/216] Add ci-scripts v2.3.2 (submodule in .ci) --- .ci | 1 + .gitmodules | 4 ++++ 2 files changed, 5 insertions(+) create mode 160000 .ci diff --git a/.ci b/.ci new file mode 160000 index 000000000..ecb7e4366 --- /dev/null +++ b/.ci @@ -0,0 +1 @@ +Subproject commit ecb7e43660200bd5d69e4ffa2a402046cd46e36b diff --git a/.gitmodules b/.gitmodules index 719539280..e537fc586 100644 --- a/.gitmodules +++ b/.gitmodules @@ -22,3 +22,7 @@ path = modules/pva2pva url = https://github.com/epics-base/pva2pva branch = master +[submodule ".ci"] + path = .ci + url = https://github.com/epics-base/ci-scripts + branch = master From 17efb0b82c4a3b07f8072d3f574d12d01e2435ec Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 23 Apr 2020 15:24:39 -0700 Subject: [PATCH 152/216] WIN32: osdFindSymbol.c use PSAPI_VERSION Prefer the more specific PSAPI_VERSION to NTDDI_VERSION. --- modules/libcom/src/osi/os/WIN32/osdFindSymbol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c b/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c index 6447971fc..5731c8afe 100644 --- a/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c +++ b/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c @@ -9,7 +9,7 @@ * MinGW doesn't provide wrappers until 6.0, so fallback to psapi.dll */ #ifdef _MSC_VER -# define NTDDI_VERSION NTDDI_WIN7 +# define PSAPI_VERSION 2 # define epicsEnumProcessModules K32EnumProcessModules #else # define epicsEnumProcessModules EnumProcessModules From a9c8d8d5d307fa17e3d2fa65ccdfb7c832ce8596 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Fri, 24 Apr 2020 15:11:00 +0200 Subject: [PATCH 153/216] Add ci-scripts v2.3.2 (submodule in .ci) --- .ci | 1 + .gitmodules | 4 ++++ 2 files changed, 5 insertions(+) create mode 160000 .ci create mode 100644 .gitmodules diff --git a/.ci b/.ci new file mode 160000 index 000000000..d0f93f192 --- /dev/null +++ b/.ci @@ -0,0 +1 @@ +Subproject commit d0f93f1920b5ccde78766d9f84cca292047933ec diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..271d6c8f0 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule ".ci"] + path = .ci + url = https://github.com/epics-base/ci-scripts + branch = master From 445cbb822116028aea727ef99dbe94925d51e62a Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Fri, 24 Apr 2020 19:26:47 +0200 Subject: [PATCH 154/216] travis-ci: update .travis.yml for ci-scripts - use more EXTRAs on MacOS for make args --- .travis.yml | 133 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 82 insertions(+), 51 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0ae572504..5edb00dcd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,62 +1,93 @@ -language: c +# .travis.yml for use with EPICS Base ci-scripts +# (see: https://github.com/epics-base/ci-scripts) -matrix: - include: - - sudo: false - dist: bionic - compiler: gcc - env: CMPLR=gcc - - sudo: false - dist: xenial - compiler: gcc - env: CMPLR=gcc - - sudo: false - dist: bionic - compiler: gcc - env: CMPLR=gcc CMD_CXXFLAGS=-std=c++11 - - sudo: false - dist: trusty - compiler: gcc - env: CMPLR=gcc STATIC=YES CMD_CXXFLAGS=-std=c++11 - - sudo: false - dist: bionic - compiler: gcc - env: CMPLR=clang - - sudo: false - dist: xenial - compiler: gcc - env: CMPLR=clang - - sudo: false - dist: trusty - compiler: gcc - env: CMPLR=clang STATIC=YES - - sudo: false - dist: trusty - compiler: gcc - env: WINE=32 TEST=NO STATIC=YES - - sudo: false - dist: trusty - compiler: gcc - env: WINE=32 TEST=NO STATIC=NO - - sudo: false - dist: trusty - compiler: gcc - env: RTEMS=4.10 TEST=NO - - sudo: false - dist: trusty - compiler: gcc - env: RTEMS=4.9 TEST=NO - - os: osx - env: CMD_CFLAGS="-mmacosx-version-min=10.7" CMD_CXXFLAGS="-mmacosx-version-min=10.7 -std=c++11 -stdlib=libc++" CMD_LDXFLAGS="-mmacosx-version-min=10.7 -std=c++11 -stdlib=libc++" +language: cpp +compiler: gcc +dist: xenial + +cache: + directories: + - $HOME/.cache + +env: + global: + - SETUP_PATH=.ci-local:.ci + - BASE=SELF addons: apt: packages: + # for all EPICS builds - libreadline6-dev - libncurses5-dev - perl + # for clang compiler - clang + # for mingw builds (32bit and 64bit) - g++-mingw-w64-i686 + - g++-mingw-w64-x86-64 + # for RTEMS cross builds + - qemu-system-x86 + homebrew: + packages: + # for all EPICS builds + - bash + update: true -install: sh ci/travis-prepare.sh Date: Wed, 22 Apr 2020 16:54:23 +0200 Subject: [PATCH 155/216] appveyor: update .appveyor.yml for ci-scripts --- .appveyor.yml | 92 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 65 insertions(+), 27 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index bc04839e5..6a289f6ea 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,11 +1,18 @@ -# AppVeyor configuration for EPICS Base - -# Ralph Lange -# Copyright (c) 2016-2017 ITER Organization +# .appveyor.yml for use with EPICS Base ci-scripts +# (see: https://github.com/epics-base/ci-scripts) # Version format version: base-{branch}-{build} +#---------------------------------# +# build cache # +#---------------------------------# +# The AppVeyor cache allowance is way too small (1GB per account across all projects, branches and jobs) +# to be used for the dependency builds. + +cache: + - C:\Users\appveyor\.tools + #---------------------------------# # repository cloning # #---------------------------------# @@ -16,7 +23,7 @@ init: - git config --global core.autocrlf true # Set clone depth (do not fetch complete history) -clone_depth: 2 +clone_depth: 5 # Skipping commits affecting only specific files skip_commits: @@ -37,47 +44,78 @@ configuration: - dynamic-debug - static-debug -# Environment variables: compiler toolchain +# Environment variables: compiler toolchain, base version, setup file, ... environment: - matrix: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - TOOLCHAIN: 10.0 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - TOOLCHAIN: 11.0 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - TOOLCHAIN: 12.0 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - TOOLCHAIN: 14.0 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - TOOLCHAIN: 2017 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - TOOLCHAIN: mingw + # common / default variables for all jobs + SETUP_PATH: .ci-local:.ci + BASE: SELF -# Platform: architecture + matrix: + - CMP: vs2019 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + - CMP: vs2017 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + - CMP: vs2015 + - CMP: vs2013 + - CMP: vs2012 + - CMP: vs2010 + - CMP: mingw + +# Platform: processor architecture platform: - x86 - x64 -# Matrix configuration: allow specific failing jobs +# Matrix configuration: exclude sets of jobs matrix: exclude: - # VS Express installs don't have the 64 bit compiler + # VS2012 and older installs don't have the 64 bit compiler - platform: x64 - TOOLCHAIN: 10.0 - + CMP: vs2012 + - platform: x64 + CMP: vs2010 + - platform: x64 + CMP: vs2008 + # Exclude more jobs to reduce build time + # Skip 32-bit for "middle-aged" compilers + - platform: x86 + CMP: vs2017 + - platform: x86 + CMP: vs2015 #---------------------------------# # building & testing # #---------------------------------# install: - - cmd: ci/appveyor-prepare.bat + - cmd: git submodule update --init --recursive + - cmd: python .ci/appveyor/do.py prepare build_script: - - cmd: ci/appveyor-make.bat + - cmd: python .ci/appveyor/do.py build test_script: - - cmd: ci/appveyor-make.bat runtests + - cmd: python .ci/appveyor/do.py test + +on_finish: + - ps: Get-ChildItem *.tap -Recurse -Force | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } + - cmd: python .ci/appveyor/do.py build test-results -s + +#---------------------------------# +# debugging # +#---------------------------------# + +## if you want to connect by remote desktop to a failed build, uncomment these lines +## note that you will need to connect within the usual build timeout limit (60 minutes) +## so you may want to adjust the build matrix above to just build the one of interest + +# print the connection info +#init: +# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) + +# block a failed build (until the watchdog barks) +#on_failure: +# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) #---------------------------------# # notifications # From 076175386f9ef220884607a52422364f11a94418 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Fri, 24 Apr 2020 15:24:43 +0200 Subject: [PATCH 156/216] ci: remove old integration in .ci-local --- .ci-local/appveyor-make.bat | 119 --------------------------------- .ci-local/appveyor-prepare.bat | 38 ----------- .ci-local/travis-build.sh | 88 ------------------------ .ci-local/travis-prepare.sh | 24 ------- 4 files changed, 269 deletions(-) delete mode 100644 .ci-local/appveyor-make.bat delete mode 100644 .ci-local/appveyor-prepare.bat delete mode 100644 .ci-local/travis-build.sh delete mode 100644 .ci-local/travis-prepare.sh diff --git a/.ci-local/appveyor-make.bat b/.ci-local/appveyor-make.bat deleted file mode 100644 index 8d976d93d..000000000 --- a/.ci-local/appveyor-make.bat +++ /dev/null @@ -1,119 +0,0 @@ -:: Universal build script for AppVeyor (https://ci.appveyor.com/) -:: Environment: -:: TOOLCHAIN - toolchain version [10.0/11.0/12.0/14.0/2017/mingw] -:: CONFIGURATION - determines EPICS build [dynamic/static] -:: PLATFORM - architecture [x86/x64] -:: -:: All command line args are passed to make - -Setlocal EnableDelayedExpansion - -set "ST=" -if /i "%CONFIGURATION%"=="static" set ST=-static - -set OS=64BIT -if "%PLATFORM%"=="x86" set OS=32BIT - -echo [INFO] Platform: %OS% - -:: Use parallel make, except for 3.14 -set "MAKEARGS=-j2 -Otarget" -if "%APPVEYOR_REPO_BRANCH%"=="3.14" set MAKEARGS= - -if "%TOOLCHAIN%"=="mingw" ( - set "MAKE=mingw32-make" - if "%OS%"=="64BIT" ( - set "EPICS_HOST_ARCH=windows-x64-mingw" - set "INCLUDE=C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\include;%INCLUDE%" - set "PATH=C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;%PATH%" - echo [INFO] MinGW Toolchain 64bit - ) else ( - set "EPICS_HOST_ARCH=win32-x86-mingw" - set "INCLUDE=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\include;%INCLUDE%" - set "PATH=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin;%PATH%" - echo [INFO] MinGW Toolchain 32bit - ) - echo [INFO] Compiler Version - gcc -v - goto Finish -) - -set "VSINSTALL=C:\Program Files (x86)\Microsoft Visual Studio %TOOLCHAIN%" -if not exist "%VSINSTALL%\" set "VSINSTALL=C:\Program Files (x86)\Microsoft Visual Studio\%TOOLCHAIN%\Community" -if not exist "%VSINSTALL%\" goto MSMissing - -set "MAKE=C:\tools\make" - -echo [INFO] APPVEYOR_BUILD_WORKER_IMAGE=%APPVEYOR_BUILD_WORKER_IMAGE% - -if "%OS%"=="64BIT" ( - set EPICS_HOST_ARCH=windows-x64%ST% - :: VS 2017 - if exist "%VSINSTALL%\VC\Auxiliary\Build\vcvars64.bat" ( - call "%VSINSTALL%\VC\Auxiliary\Build\vcvars64.bat" - where cl - if !ERRORLEVEL! NEQ 0 goto MSMissing - goto MSFound - ) - if exist "%VSINSTALL%\VC\vcvarsall.bat" ( - call "%VSINSTALL%\VC\vcvarsall.bat" amd64 - where cl - if !ERRORLEVEL! NEQ 0 ( - call "%VSINSTALL%\VC\vcvarsall.bat" x86_amd64 - where cl - if !ERRORLEVEL! NEQ 0 goto MSMissing - ) - goto MSFound - ) - if exist "%VSINSTALL%\VC\bin\amd64\vcvars64.bat" ( - call "%VSINSTALL%\VC\bin\amd64\vcvars64.bat" - where cl - if !ERRORLEVEL! NEQ 0 goto MSMissing - goto MSFound - ) -) else ( - set EPICS_HOST_ARCH=win32-x86%ST% - :: VS 2017 - if exist "%VSINSTALL%\VC\Auxiliary\Build\vcvars32.bat" ( - call "%VSINSTALL%\VC\Auxiliary\Build\vcvars32.bat" - where cl - if !ERRORLEVEL! NEQ 0 goto MSMissing - goto MSFound - ) - if exist "%VSINSTALL%\VC\vcvarsall.bat" ( - call "%VSINSTALL%\VC\vcvarsall.bat" x86 - where cl - if !ERRORLEVEL! NEQ 0 goto MSMissing - goto MSFound - ) - if exist "%VSINSTALL%\VC\bin\vcvars32.bat" ( - call "%VSINSTALL%\VC\bin\vcvars32.bat" - where cl - if !ERRORLEVEL! NEQ 0 goto MSMissing - goto MSFound - ) - if exist "%VSINSTALL%\Common7\Tools\vsvars32.bat" ( - call "%VSINSTALL%\Common7\Tools\vsvars32.bat" - where cl - if !ERRORLEVEL! NEQ 0 goto MSMissing - goto MSFound - ) -) - -:MSMissing -echo [INFO] Installation for MSVC Toolchain %TOOLCHAIN% / %OS% seems to be missing -exit 1 - -:MSFound -echo [INFO] Microsoft Visual Studio Toolchain %TOOLCHAIN% -echo [INFO] Compiler Version -cl - -:Finish -echo [INFO] EPICS_HOST_ARCH: %EPICS_HOST_ARCH% -echo [INFO] Make version -%MAKE% --version -echo [INFO] Perl version -perl --version - -%MAKE% %MAKEARGS% %* diff --git a/.ci-local/appveyor-prepare.bat b/.ci-local/appveyor-prepare.bat deleted file mode 100644 index a685dbfb3..000000000 --- a/.ci-local/appveyor-prepare.bat +++ /dev/null @@ -1,38 +0,0 @@ -:: Build script for AppVeyor (https://ci.appveyor.com/) -:: Environment: -:: TOOLCHAIN - Toolchain Version [9.0/10.0/11.0/12.0/14.0/mingw] -:: CONFIGURATION - determines EPICS build [dynamic/static, -debug] -:: PLATFORM - "x86" -> use 32bit architecture -:: -:: Prepares an Appveyor build by excuting the following steps -:: - Set up configure\CONFIG_SITE for static vs. dynamic build -:: - Install Mingw (TOOLCHAIN setting) in the in the appropriate flavor -:: - Download and install Make-4.1 from EPICS download page - -Setlocal EnableDelayedExpansion - -set OS=64BIT -if "%PLATFORM%"=="x86" set OS=32BIT - -echo [INFO] Platform: %OS% - -if "%TOOLCHAIN%"=="mingw" ( - echo.%CONFIGURATION% | findstr /C:"static">nul && ( - echo SHARED_LIBRARIES=NO>> configure\CONFIG_SITE - echo STATIC_BUILD=YES>> configure\CONFIG_SITE - echo [INFO] EPICS set up for static build - ) || ( - echo [INFO] EPICS set up for dynamic build - ) - echo.%CONFIGURATION% | findstr /C:"debug">nul && ( - echo HOST_OPT=NO>> configure\CONFIG_SITE - echo [INFO] EPICS set up for debug build - ) || ( - echo [INFO] EPICS set up for optimized build - ) -) - -echo [INFO] Installing Make 4.2.1 from ANL web site -curl -fsS --retry 3 -o C:\tools\make-4.2.1.zip https://epics.anl.gov/download/tools/make-4.2.1-win64.zip -cd \tools -"C:\Program Files\7-Zip\7z" e make-4.2.1.zip diff --git a/.ci-local/travis-build.sh b/.ci-local/travis-build.sh deleted file mode 100644 index e69616aa3..000000000 --- a/.ci-local/travis-build.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/sh -set -e -x - -die() { - echo "$1" >&2 - exit 1 -} - -ticker() { - while true - do - sleep 60 - date -R - [ -r "$1" ] && tail -n10 "$1" - done -} - -CACHEKEY=1 - -EPICS_HOST_ARCH=`perl src/tools/EpicsHostArch.pl` - -[ -e configure/os/CONFIG_SITE.Common.linux-x86 ] || die "Wrong location: $PWD" - -case "$CMPLR" in -clang) - echo "Host compiler is clang" - cat << EOF >> configure/os/CONFIG_SITE.Common.$EPICS_HOST_ARCH -GNU = NO -CMPLR_CLASS = clang -CC = clang -CCC = clang++ -EOF - ;; -*) echo "Host compiler is default";; -esac - -if [ "$STATIC" = "YES" ] -then - echo "Build static libraries/executables" - cat << EOF >> configure/CONFIG_SITE -SHARED_LIBRARIES=NO -STATIC_BUILD=YES -EOF -fi - -# requires wine and g++-mingw-w64-i686 -if [ "$WINE" = "32" ] -then - echo "Cross mingw32" - sed -i -e '/CMPLR_PREFIX/d' configure/os/CONFIG_SITE.linux-x86.win32-x86-mingw - cat << EOF >> configure/os/CONFIG_SITE.linux-x86.win32-x86-mingw -CMPLR_PREFIX=i686-w64-mingw32- -EOF - cat << EOF >> configure/CONFIG_SITE -CROSS_COMPILER_TARGET_ARCHS+=win32-x86-mingw -EOF -fi - -# set RTEMS to eg. "4.9" or "4.10" -# requires qemu, bison, flex, texinfo, install-info -if [ -n "$RTEMS" ] -then - echo "Cross RTEMS${RTEMS} for pc386" - install -d /home/travis/.cache - curl -L "https://github.com/mdavidsaver/rsb/releases/download/travis-20160306-2/rtems${RTEMS}-i386-trusty-20190306-2.tar.gz" \ - | tar -C /home/travis/.cache -xj - - sed -i -e '/^RTEMS_VERSION/d' -e '/^RTEMS_BASE/d' configure/os/CONFIG_SITE.Common.RTEMS - cat << EOF >> configure/os/CONFIG_SITE.Common.RTEMS -RTEMS_VERSION=$RTEMS -RTEMS_BASE=/home/travis/.cache/rtems${RTEMS}-i386 -EOF - cat << EOF >> configure/CONFIG_SITE -CROSS_COMPILER_TARGET_ARCHS+=RTEMS-pc386 -EOF - - # find local qemu-system-i386 - echo -n "Using QEMU: " - type qemu-system-i386 || echo "Missing qemu" -fi - -make -j2 RTEMS_QEMU_FIXUPS=YES CMD_CFLAGS="${CMD_CFLAGS}" CMD_CXXFLAGS="${CMD_CXXFLAGS}" CMD_LDFLAGS="${CMD_LDFLAGS}" - -if [ "$TEST" != "NO" ] -then - make tapfiles - make -s test-results -fi diff --git a/.ci-local/travis-prepare.sh b/.ci-local/travis-prepare.sh deleted file mode 100644 index 393bd80b6..000000000 --- a/.ci-local/travis-prepare.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -set -e -x - -die() { - echo "$1" >&2 - exit 1 -} - -if [ -f /etc/hosts ] -then - # The travis-ci "bionic" image throws us a curveball in /etc/hosts - # by including two entries for localhost. The first for 127.0.1.1 - # which causes epicsSockResolveTest to fail. - # cat /etc/hosts - # ... - # 127.0.1.1 localhost localhost ip4-loopback - # 127.0.0.1 localhost nettuno travis vagrant travis-job-.... - - sudo sed -i -e '/^127\.0\.1\.1/ s|localhost\s*||g' /etc/hosts - - echo "==== /etc/hosts" - cat /etc/hosts - echo "====" -fi From 314e09d8cab21632c6d9212bd6808001cb67915f Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 24 Apr 2020 16:44:49 -0500 Subject: [PATCH 157/216] Build system release notes --- documentation/RELEASE_NOTES.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/documentation/RELEASE_NOTES.md b/documentation/RELEASE_NOTES.md index 0bb0b8ac9..6217fa9a2 100644 --- a/documentation/RELEASE_NOTES.md +++ b/documentation/RELEASE_NOTES.md @@ -6,6 +6,28 @@ This version of EPICS Base has not been released yet. +### Improvements to the self-test build targets + +This release contains changes that make it possible to integrate another test +running and reporting system (such as Google's gtest) into the EPICS build +system. The built-in test-runner and reporting system will continue to be used +by the test programs inside Base however. + +These GNUmake `tapfiles` and `test-results` build targets now collect a list of +the directories that experienced test failures and display those at the end of +running and/or reporting all of the tests. The GNUmake process will also only +exit with an error status after running and/or reporting all of the test +results; previously the `-k` flag to make was needed and even that didn't always +work. + +Continuous Integration systems are recommended to run `make tapfiles` (or if +they can read junittest output instead of TAP `make junitests`) followed by +`make -s test-results` to display the results of the tests. If multiple CPUs are +available the `-j` flag can be used to run tests in parallel, giving the maximum +jobs that should be allowed so `make -j4 tapfiles` for a system with 4 CPUs say. +Running many more jobs than you have CPUs is likely to be slower and is not +recommended. + ### epicsThread: Main thread defaults to allow blocking I/O VxWorks IOCs (and potentially RTEMS IOCs running GeSys) have had problems with From f1cbe93b6c0a8607a7e3cfb732c0eece7c64a029 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 23 Apr 2020 15:43:34 -0700 Subject: [PATCH 158/216] Revert "replace most internal getCurrent() -> getMonotonic()" This reverts commit 4f2228fb1d7527fb5ebc8b2d747c309f1dd7698d except for some test code. --- modules/ca/src/client/CASG.cpp | 4 ++-- modules/ca/src/client/ca_client_context.cpp | 8 ++++---- modules/ca/src/client/cac.cpp | 2 +- modules/ca/src/client/searchTimer.cpp | 2 +- modules/ca/src/client/tcpiiu.cpp | 4 ++-- modules/ca/src/client/udpiiu.cpp | 2 +- modules/database/src/ioc/db/dbPutNotifyBlocker.cpp | 4 ++-- modules/libcom/src/fdmgr/fdManager.cpp | 6 +++--- modules/libcom/src/osi/epicsThread.cpp | 4 ++-- modules/libcom/src/timer/epicsTimer.cpp | 2 +- modules/libcom/src/timer/epicsTimer.h | 2 +- modules/libcom/src/timer/timer.cpp | 6 +++--- modules/libcom/src/timer/timerQueue.cpp | 4 ++-- modules/libcom/src/timer/timerQueueActive.cpp | 4 ++-- modules/libcom/test/epicsTimerTest.cpp | 8 ++++---- 15 files changed, 31 insertions(+), 31 deletions(-) diff --git a/modules/ca/src/client/CASG.cpp b/modules/ca/src/client/CASG.cpp index 4ffb414c7..b2dbaac4d 100644 --- a/modules/ca/src/client/CASG.cpp +++ b/modules/ca/src/client/CASG.cpp @@ -83,7 +83,7 @@ int CASG::block ( return ECA_TIMEOUT; } - cur_time = epicsTime::getMonotonic (); + cur_time = epicsTime::getCurrent (); this->client.flush ( guard ); @@ -121,7 +121,7 @@ int CASG::block ( /* * force a time update */ - cur_time = epicsTime::getMonotonic (); + cur_time = epicsTime::getCurrent (); delay = cur_time - beg_time; } diff --git a/modules/ca/src/client/ca_client_context.cpp b/modules/ca/src/client/ca_client_context.cpp index 3fd0512d6..edd88cd09 100644 --- a/modules/ca/src/client/ca_client_context.cpp +++ b/modules/ca/src/client/ca_client_context.cpp @@ -475,7 +475,7 @@ int ca_client_context::pendIO ( const double & timeout ) } int status = ECA_NORMAL; - epicsTime beg_time = epicsTime::getMonotonic (); + epicsTime beg_time = epicsTime::getCurrent (); double remaining = timeout; epicsGuard < epicsMutex > guard ( this->mutex ); @@ -493,7 +493,7 @@ int ca_client_context::pendIO ( const double & timeout ) this->blockForEventAndEnableCallbacks ( this->ioDone, remaining ); } - double delay = epicsTime::getMonotonic () - beg_time; + double delay = epicsTime::getCurrent () - beg_time; if ( delay < timeout ) { remaining = timeout - delay; } @@ -522,7 +522,7 @@ int ca_client_context::pendEvent ( const double & timeout ) return ECA_EVDISALLOW; } - epicsTime current = epicsTime::getMonotonic (); + epicsTime current = epicsTime::getCurrent (); { epicsGuard < epicsMutex > guard ( this->mutex ); @@ -563,7 +563,7 @@ int ca_client_context::pendEvent ( const double & timeout ) this->noWakeupSincePend = true; } - double elapsed = epicsTime::getMonotonic() - current; + double elapsed = epicsTime::getCurrent() - current; double delay; if ( timeout > elapsed ) { diff --git a/modules/ca/src/client/cac.cpp b/modules/ca/src/client/cac.cpp index 476d1c380..b934b15df 100644 --- a/modules/ca/src/client/cac.cpp +++ b/modules/ca/src/client/cac.cpp @@ -130,7 +130,7 @@ cac::cac ( epicsMutex & callbackControlIn, cacContextNotify & notifyIn ) : _refLocalHostName ( localHostNameCache.getReference () ), - programBeginTime ( epicsTime::getMonotonic() ), + programBeginTime ( epicsTime::getCurrent() ), connTMO ( CA_CONN_VERIFY_PERIOD ), mutex ( mutualExclusionIn ), cbMutex ( callbackControlIn ), diff --git a/modules/ca/src/client/searchTimer.cpp b/modules/ca/src/client/searchTimer.cpp index bb9b9a91c..e55e49eab 100644 --- a/modules/ca/src/client/searchTimer.cpp +++ b/modules/ca/src/client/searchTimer.cpp @@ -43,7 +43,7 @@ searchTimer::searchTimer ( const unsigned indexIn, epicsMutex & mutexIn, bool boostPossibleIn ) : - timeAtLastSend ( epicsTime::getMonotonic () ), + timeAtLastSend ( epicsTime::getCurrent () ), timer ( queueIn.createTimer () ), iiu ( iiuIn ), mutex ( mutexIn ), diff --git a/modules/ca/src/client/tcpiiu.cpp b/modules/ca/src/client/tcpiiu.cpp index 9d174ab84..045f8d57e 100644 --- a/modules/ca/src/client/tcpiiu.cpp +++ b/modules/ca/src/client/tcpiiu.cpp @@ -476,7 +476,7 @@ void tcpRecvThread::run () statusWireIO stat; pComBuf->fillFromWire ( this->iiu, stat ); - epicsTime currentTime = epicsTime::getMonotonic (); + epicsTime currentTime = epicsTime::getCurrent (); { epicsGuard < epicsMutex > guard ( this->iiu.mutex ); @@ -1669,7 +1669,7 @@ bool tcpiiu::sendThreadFlush ( epicsGuard < epicsMutex > & guard ) if ( this->sendQue.occupiedBytes() > 0 ) { while ( comBuf * pBuf = this->sendQue.popNextComBufToSend () ) { - epicsTime current = epicsTime::getMonotonic (); + epicsTime current = epicsTime::getCurrent (); unsigned bytesToBeSent = pBuf->occupiedBytes (); bool success = false; diff --git a/modules/ca/src/client/udpiiu.cpp b/modules/ca/src/client/udpiiu.cpp index 4efa8ba32..6e66d3323 100644 --- a/modules/ca/src/client/udpiiu.cpp +++ b/modules/ca/src/client/udpiiu.cpp @@ -435,7 +435,7 @@ void udpRecvThread::run () } else if ( status > 0 ) { this->iiu.postMsg ( src, this->iiu.recvBuf, - (arrayElementCount) status, epicsTime::getMonotonic() ); + (arrayElementCount) status, epicsTime::getCurrent() ); } } while ( ! this->iiu.shutdownCmd ); diff --git a/modules/database/src/ioc/db/dbPutNotifyBlocker.cpp b/modules/database/src/ioc/db/dbPutNotifyBlocker.cpp index 2215f8468..1a796cdbd 100644 --- a/modules/database/src/ioc/db/dbPutNotifyBlocker.cpp +++ b/modules/database/src/ioc/db/dbPutNotifyBlocker.cpp @@ -144,12 +144,12 @@ void dbPutNotifyBlocker::initiatePutNotify ( break; } if ( beginTimeInit ) { - if ( epicsTime::getMonotonic () - begin > 30.0 ) { + if ( epicsTime::getCurrent () - begin > 30.0 ) { throw cacChannel::requestTimedOut (); } } else { - begin = epicsTime::getMonotonic (); + begin = epicsTime::getCurrent (); beginTimeInit = true; } { diff --git a/modules/libcom/src/fdmgr/fdManager.cpp b/modules/libcom/src/fdmgr/fdManager.cpp index 3bbc64876..50a0f7e3e 100644 --- a/modules/libcom/src/fdmgr/fdManager.cpp +++ b/modules/libcom/src/fdmgr/fdManager.cpp @@ -97,7 +97,7 @@ epicsShareFunc void fdManager::process (double delay) // more than once here so that fd activity get serviced // in a reasonable length of time. // - double minDelay = this->pTimerQueue->process(epicsTime::getMonotonic()); + double minDelay = this->pTimerQueue->process(epicsTime::getCurrent()); if ( minDelay >= delay ) { minDelay = delay; @@ -121,7 +121,7 @@ epicsShareFunc void fdManager::process (double delay) fd_set * pExceptSet = & this->fdSetsPtr[fdrException]; int status = select (this->maxFD, pReadSet, pWriteSet, pExceptSet, &tv); - this->pTimerQueue->process(epicsTime::getMonotonic()); + this->pTimerQueue->process(epicsTime::getCurrent()); if ( status > 0 ) { @@ -204,7 +204,7 @@ epicsShareFunc void fdManager::process (double delay) * of select() */ epicsThreadSleep(minDelay); - this->pTimerQueue->process(epicsTime::getMonotonic()); + this->pTimerQueue->process(epicsTime::getCurrent()); } this->processInProg = false; return; diff --git a/modules/libcom/src/osi/epicsThread.cpp b/modules/libcom/src/osi/epicsThread.cpp index e0f39b895..1d2adaf10 100644 --- a/modules/libcom/src/osi/epicsThread.cpp +++ b/modules/libcom/src/osi/epicsThread.cpp @@ -164,7 +164,7 @@ bool epicsThread::exitWait ( const double delay ) throw () } return true; } - epicsTime exitWaitBegin = epicsTime::getMonotonic (); + epicsTime exitWaitBegin = epicsTime::getCurrent (); double exitWaitElapsed = 0.0; epicsGuard < epicsMutex > guard ( this->mutex ); this->cancel = true; @@ -172,7 +172,7 @@ bool epicsThread::exitWait ( const double delay ) throw () epicsGuardRelease < epicsMutex > unguard ( guard ); this->event.signal (); this->exitEvent.wait ( delay - exitWaitElapsed ); - epicsTime current = epicsTime::getMonotonic (); + epicsTime current = epicsTime::getCurrent (); exitWaitElapsed = current - exitWaitBegin; } if(this->terminated && !joined) { diff --git a/modules/libcom/src/timer/epicsTimer.cpp b/modules/libcom/src/timer/epicsTimer.cpp index 15bebef7f..e55280e7e 100644 --- a/modules/libcom/src/timer/epicsTimer.cpp +++ b/modules/libcom/src/timer/epicsTimer.cpp @@ -173,7 +173,7 @@ extern "C" double epicsShareAPI epicsTimerQueuePassiveProcess ( epicsTimerQueuePassiveId pQueue ) { try { - return pQueue->process ( epicsTime::getMonotonic() ); + return pQueue->process ( epicsTime::getCurrent() ); } catch ( ... ) { return 1.0; diff --git a/modules/libcom/src/timer/epicsTimer.h b/modules/libcom/src/timer/epicsTimer.h index 6e054ed4f..72270f273 100644 --- a/modules/libcom/src/timer/epicsTimer.h +++ b/modules/libcom/src/timer/epicsTimer.h @@ -118,7 +118,7 @@ inline double epicsTimer::getExpireDelay () { epicsTimer::expireInfo info = this->getExpireInfo (); if ( info.active ) { - double delay = info.expireTime - epicsTime::getMonotonic (); + double delay = info.expireTime - epicsTime::getCurrent (); if ( delay < 0.0 ) { delay = 0.0; } diff --git a/modules/libcom/src/timer/timer.cpp b/modules/libcom/src/timer/timer.cpp index 6f0c7ea4a..35d6e47bf 100644 --- a/modules/libcom/src/timer/timer.cpp +++ b/modules/libcom/src/timer/timer.cpp @@ -54,7 +54,7 @@ void timer::destroy () void timer::start ( epicsTimerNotify & notify, double delaySeconds ) { - this->start ( notify, epicsTime::getMonotonic () + delaySeconds ); + this->start ( notify, epicsTime::getCurrent () + delaySeconds ); } void timer::start ( epicsTimerNotify & notify, const epicsTime & expire ) @@ -129,7 +129,7 @@ void timer::privateStart ( epicsTimerNotify & notify, const epicsTime & expire ) debugPrintf ( ("Start of \"%s\" with delay %f at %p preempting %u\n", typeid ( this->notify ).name (), - expire - epicsTime::getMonotonic (), + expire - epicsTime::getCurrent (), this, preemptCount ) ); } @@ -190,7 +190,7 @@ void timer::show ( unsigned int level ) const double delay; if ( this->curState == statePending || this->curState == stateActive ) { try { - delay = this->exp - epicsTime::getMonotonic(); + delay = this->exp - epicsTime::getCurrent(); } catch ( ... ) { delay = - DBL_MAX; diff --git a/modules/libcom/src/timer/timerQueue.cpp b/modules/libcom/src/timer/timerQueue.cpp index a62eab96e..8f7f98e12 100644 --- a/modules/libcom/src/timer/timerQueue.cpp +++ b/modules/libcom/src/timer/timerQueue.cpp @@ -30,7 +30,7 @@ timerQueue::timerQueue ( epicsTimerQueueNotify & notifyIn ) : pExpireTmr ( 0 ), processThread ( 0 ), exceptMsgTimeStamp ( - epicsTime :: getMonotonic () - exceptMsgMinPeriod ), + epicsTime :: getCurrent () - exceptMsgMinPeriod ), cancelPending ( false ) { } @@ -49,7 +49,7 @@ void timerQueue :: char date[64]; double delay; try { - epicsTime cur = epicsTime :: getMonotonic (); + epicsTime cur = epicsTime :: getCurrent (); delay = cur - this->exceptMsgTimeStamp; cur.strftime ( date, sizeof ( date ), "%a %b %d %Y %H:%M:%S.%f" ); diff --git a/modules/libcom/src/timer/timerQueueActive.cpp b/modules/libcom/src/timer/timerQueueActive.cpp index 5751b2428..4db68c00c 100644 --- a/modules/libcom/src/timer/timerQueueActive.cpp +++ b/modules/libcom/src/timer/timerQueueActive.cpp @@ -73,7 +73,7 @@ void timerQueueActive :: _printLastChanceExceptionMessage ( { char date[64]; try { - epicsTime cur = epicsTime :: getMonotonic (); + epicsTime cur = epicsTime :: getCurrent (); cur.strftime ( date, sizeof ( date ), "%a %b %d %Y %H:%M:%S.%f"); } catch ( ... ) { @@ -91,7 +91,7 @@ void timerQueueActive :: run () epics::atomic::set(this->exitFlag, 0); while ( ! this->terminateFlag ) { try { - double delay = this->queue.process ( epicsTime::getMonotonic() ); + double delay = this->queue.process ( epicsTime::getCurrent() ); debugPrintf ( ( "timer thread sleeping for %g sec (max)\n", delay ) ); this->rescheduleEvent.wait ( delay ); } diff --git a/modules/libcom/test/epicsTimerTest.cpp b/modules/libcom/test/epicsTimerTest.cpp index e3b36a8c1..12454b0c2 100644 --- a/modules/libcom/test/epicsTimerTest.cpp +++ b/modules/libcom/test/epicsTimerTest.cpp @@ -159,7 +159,7 @@ void testAccuracy () expireCount = nTimers; for ( i = 0u; i < nTimers; i++ ) { - epicsTime cur = epicsTime::getMonotonic (); + epicsTime cur = epicsTime::getCurrent (); pTimers[i]->setBegin ( cur ); pTimers[i]->start ( cur + pTimers[i]->delay () ); } @@ -256,7 +256,7 @@ void testCancel () testDiag ( "cancelCount = %u", cancelVerify::cancelCount ); testDiag ( "starting %d timers", nTimers ); - epicsTime exp = epicsTime::getMonotonic () + 4.0; + epicsTime exp = epicsTime::getCurrent () + 4.0; for ( i = 0u; i < nTimers; i++ ) { pTimers[i]->start ( exp ); } @@ -342,7 +342,7 @@ void testExpireDestroy () testOk1 ( expireDestroyVerify::destroyCount == 0 ); testDiag ( "starting %d timers", nTimers ); - epicsTime cur = epicsTime::getMonotonic (); + epicsTime cur = epicsTime::getCurrent (); for ( i = 0u; i < nTimers; i++ ) { pTimers[i]->start ( cur ); } @@ -435,7 +435,7 @@ void testPeriodic () testOk1 ( timerCount == nTimers ); testDiag ( "starting %d timers", nTimers ); - epicsTime cur = epicsTime::getMonotonic (); + epicsTime cur = epicsTime::getCurrent (); for ( i = 0u; i < nTimers; i++ ) { pTimers[i]->start ( cur ); } From cd32a7cb1e8c3bca78683c54ea42ede04cf698a6 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Sat, 18 Apr 2020 08:24:37 -0700 Subject: [PATCH 159/216] epicsEventTest: quiet WIN32 noise timeout for WaitForSingleObject() is known to be shorter than expected. --- modules/libcom/test/epicsEventTest.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/libcom/test/epicsEventTest.cpp b/modules/libcom/test/epicsEventTest.cpp index c58e57c11..9a6e48a8f 100644 --- a/modules/libcom/test/epicsEventTest.cpp +++ b/modules/libcom/test/epicsEventTest.cpp @@ -171,6 +171,10 @@ static double eventWaitCheckDelayError( const epicsEventId &id, const double & d #define WAITCOUNT 21 static void eventWaitTest() { +#if defined(_WIN32) || defined(__rtems__) || defined(vxWorks) + testTodoBegin("Known issue with delay calculation"); +#endif + epicsEventId event = epicsEventMustCreate(epicsEventEmpty); double errorSum = eventWaitCheckDelayError(event, 0.0); @@ -181,6 +185,8 @@ static void eventWaitTest() double meanError = errorSum / WAITCOUNT; testOk(meanError < 0.05, "Mean delay error was %.6f sec", meanError); + testTodoEnd(); + epicsEventDestroy(event); } From ce4fb6085ffccd2ad0c29191d221c55341a485a6 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Fri, 24 Apr 2020 20:24:52 -0700 Subject: [PATCH 160/216] iocsh: add usage messages --- documentation/RELEASE_NOTES.md | 9 + modules/database/src/ioc/as/asIocRegister.c | 34 ++-- modules/database/src/ioc/db/dbIocRegister.c | 158 ++++++++++++------ .../src/ioc/dbStatic/dbStaticIocRegister.c | 3 +- modules/libcom/src/iocsh/iocsh.cpp | 21 ++- modules/libcom/src/iocsh/iocsh.h | 1 + 6 files changed, 164 insertions(+), 62 deletions(-) diff --git a/documentation/RELEASE_NOTES.md b/documentation/RELEASE_NOTES.md index 58b27947d..f25059ebf 100644 --- a/documentation/RELEASE_NOTES.md +++ b/documentation/RELEASE_NOTES.md @@ -14,6 +14,15 @@ release. ## EPICS Release 7.0.3.2 +### IOCsh usage messages + +`help ` now prints a descriptive usage message +for many internal IOCsh commands. Try `help *` to +see them all. + +External code which wishes to provide a usage message +should do so through the new `iocshFuncDef::usage` member. + ### Variable names in RELEASE files `configure/RELEASE` files are parsed by both GNUmake and the `convertRelease.pl` diff --git a/modules/database/src/ioc/as/asIocRegister.c b/modules/database/src/ioc/as/asIocRegister.c index d5926a551..2fa79dfb0 100644 --- a/modules/database/src/ioc/as/asIocRegister.c +++ b/modules/database/src/ioc/as/asIocRegister.c @@ -19,7 +19,9 @@ static const iocshArg asSetFilenameArg0 = { "ascf",iocshArgString}; static const iocshArg * const asSetFilenameArgs[] = {&asSetFilenameArg0}; static const iocshFuncDef asSetFilenameFuncDef = - {"asSetFilename",1,asSetFilenameArgs}; + {"asSetFilename",1,asSetFilenameArgs, + "Set path+file name of ACF file.\n" + "No immediate effect. Run as asInit() to (re)load.\n"}; static void asSetFilenameCallFunc(const iocshArgBuf *args) { asSetFilename(args[0].sval); @@ -29,21 +31,25 @@ static void asSetFilenameCallFunc(const iocshArgBuf *args) static const iocshArg asSetSubstitutionsArg0 = { "substitutions",iocshArgString}; static const iocshArg * const asSetSubstitutionsArgs[] = {&asSetSubstitutionsArg0}; static const iocshFuncDef asSetSubstitutionsFuncDef = - {"asSetSubstitutions",1,asSetSubstitutionsArgs}; + {"asSetSubstitutions",1,asSetSubstitutionsArgs, + "Set subtitutions used when reading ACF file.\n" + "No immediate effect. Run as asInit() to (re)load.\n"}; static void asSetSubstitutionsCallFunc(const iocshArgBuf *args) { asSetSubstitutions(args[0].sval); } /* asInit */ -static const iocshFuncDef asInitFuncDef = {"asInit",0}; +static const iocshFuncDef asInitFuncDef = {"asInit",0,0, + "(Re)load ACF file.\n"}; static void asInitCallFunc(const iocshArgBuf *args) { iocshSetError(asInit()); } /* asdbdump */ -static const iocshFuncDef asdbdumpFuncDef = {"asdbdump",0}; +static const iocshFuncDef asdbdumpFuncDef = {"asdbdump",0,0, + "Dump processed ACF file (as read).\n"}; static void asdbdumpCallFunc(const iocshArgBuf *args) { asdbdump(); @@ -52,7 +58,8 @@ static void asdbdumpCallFunc(const iocshArgBuf *args) /* aspuag */ static const iocshArg aspuagArg0 = { "uagname",iocshArgString}; static const iocshArg * const aspuagArgs[] = {&aspuagArg0}; -static const iocshFuncDef aspuagFuncDef = {"aspuag",1,aspuagArgs}; +static const iocshFuncDef aspuagFuncDef = {"aspuag",1,aspuagArgs, + "Show members of User Access Group.\n"}; static void aspuagCallFunc(const iocshArgBuf *args) { aspuag(args[0].sval); @@ -61,7 +68,8 @@ static void aspuagCallFunc(const iocshArgBuf *args) /* asphag */ static const iocshArg asphagArg0 = { "hagname",iocshArgString}; static const iocshArg * const asphagArgs[] = {&asphagArg0}; -static const iocshFuncDef asphagFuncDef = {"asphag",1,asphagArgs}; +static const iocshFuncDef asphagFuncDef = {"asphag",1,asphagArgs, + "Show members of Host Access Group.\n"}; static void asphagCallFunc(const iocshArgBuf *args) { asphag(args[0].sval); @@ -70,7 +78,8 @@ static void asphagCallFunc(const iocshArgBuf *args) /* asprules */ static const iocshArg asprulesArg0 = { "asgname",iocshArgString}; static const iocshArg * const asprulesArgs[] = {&asprulesArg0}; -static const iocshFuncDef asprulesFuncDef = {"asprules",1,asprulesArgs}; +static const iocshFuncDef asprulesFuncDef = {"asprules",1,asprulesArgs, + "List rules of an Access Security Group.\n"}; static void asprulesCallFunc(const iocshArgBuf *args) { asprules(args[0].sval); @@ -80,7 +89,8 @@ static void asprulesCallFunc(const iocshArgBuf *args) static const iocshArg aspmemArg0 = { "asgname",iocshArgString}; static const iocshArg aspmemArg1 = { "clients",iocshArgInt}; static const iocshArg * const aspmemArgs[] = {&aspmemArg0,&aspmemArg1}; -static const iocshFuncDef aspmemFuncDef = {"aspmem",2,aspmemArgs}; +static const iocshFuncDef aspmemFuncDef = {"aspmem",2,aspmemArgs, + "List members of Access Security Group.\n"}; static void aspmemCallFunc(const iocshArgBuf *args) { aspmem(args[0].sval,args[1].ival); @@ -89,9 +99,10 @@ static void aspmemCallFunc(const iocshArgBuf *args) /* astac */ static const iocshArg astacArg0 = { "recordname",iocshArgString}; static const iocshArg astacArg1 = { "user",iocshArgString}; -static const iocshArg astacArg2 = { "location",iocshArgString}; +static const iocshArg astacArg2 = { "host",iocshArgString}; static const iocshArg * const astacArgs[] = {&astacArg0,&astacArg1,&astacArg2}; -static const iocshFuncDef astacFuncDef = {"astac",3,astacArgs}; +static const iocshFuncDef astacFuncDef = {"astac",3,astacArgs, + "Test Access Security privlages granted to user+host.\n"}; static void astacCallFunc(const iocshArgBuf *args) { astac(args[0].sval,args[1].sval,args[2].sval); @@ -100,7 +111,8 @@ static void astacCallFunc(const iocshArgBuf *args) /* ascar */ static const iocshArg ascarArg0 = { "level",iocshArgInt}; static const iocshArg * const ascarArgs[] = {&ascarArg0}; -static const iocshFuncDef ascarFuncDef = {"ascar",1,ascarArgs}; +static const iocshFuncDef ascarFuncDef = {"ascar",1,ascarArgs, + "Report status of PVs used in INP*() Access Security rules.\n"}; static void ascarCallFunc(const iocshArgBuf *args) { ascar(args[0].ival); diff --git a/modules/database/src/ioc/db/dbIocRegister.c b/modules/database/src/ioc/db/dbIocRegister.c index afb31151d..2c3a81393 100644 --- a/modules/database/src/ioc/db/dbIocRegister.c +++ b/modules/database/src/ioc/db/dbIocRegister.c @@ -55,56 +55,69 @@ static void dbLoadRecordsCallFunc(const iocshArgBuf *args) /* dbb */ static const iocshArg dbbArg0 = { "record name",iocshArgString}; static const iocshArg * const dbbArgs[1] = {&dbbArg0}; -static const iocshFuncDef dbbFuncDef = {"dbb",1,dbbArgs}; +static const iocshFuncDef dbbFuncDef = {"dbb",1,dbbArgs, + "Add breakpoint to a lock set.\n"}; static void dbbCallFunc(const iocshArgBuf *args) { dbb(args[0].sval);} /* dbd */ static const iocshArg dbdArg0 = { "record name",iocshArgString}; static const iocshArg * const dbdArgs[1] = {&dbdArg0}; -static const iocshFuncDef dbdFuncDef = {"dbd",1,dbdArgs}; +static const iocshFuncDef dbdFuncDef = {"dbd",1,dbdArgs, + "Remove breakpoint from a record.\n"}; static void dbdCallFunc(const iocshArgBuf *args) { dbd(args[0].sval);} /* dbc */ static const iocshArg dbcArg0 = { "record name",iocshArgString}; static const iocshArg * const dbcArgs[1] = {&dbcArg0}; -static const iocshFuncDef dbcFuncDef = {"dbc",1,dbcArgs}; +static const iocshFuncDef dbcFuncDef = {"dbc",1,dbcArgs, + "Continue processing in a lock set.\n"}; static void dbcCallFunc(const iocshArgBuf *args) { dbc(args[0].sval);} /* dbs */ static const iocshArg dbsArg0 = { "record name",iocshArgString}; static const iocshArg * const dbsArgs[1] = {&dbsArg0}; -static const iocshFuncDef dbsFuncDef = {"dbs",1,dbsArgs}; +static const iocshFuncDef dbsFuncDef = {"dbs",1,dbsArgs, + "Step through record processing.\n"}; static void dbsCallFunc(const iocshArgBuf *args) { dbs(args[0].sval);} /* dbstat */ -static const iocshFuncDef dbstatFuncDef = {"dbstat",0}; +static const iocshFuncDef dbstatFuncDef = {"dbstat",0,0, + "print list of stopped records, and breakpoints set in locksets.\n"}; static void dbstatCallFunc(const iocshArgBuf *args) { dbstat();} /* dbp */ static const iocshArg dbpArg0 = { "record name",iocshArgString}; static const iocshArg dbpArg1 = { "interest level",iocshArgInt}; static const iocshArg * const dbpArgs[2] = {&dbpArg0,&dbpArg1}; -static const iocshFuncDef dbpFuncDef = {"dbp",2,dbpArgs}; +static const iocshFuncDef dbpFuncDef = {"dbp",2,dbpArgs, + "print stopped record.\n"}; static void dbpCallFunc(const iocshArgBuf *args) { dbp(args[0].sval,args[1].ival);} /* dbap */ static const iocshArg dbapArg0 = { "record name",iocshArgString}; static const iocshArg * const dbapArgs[1] = {&dbapArg0}; -static const iocshFuncDef dbapFuncDef = {"dbap",1,dbapArgs}; +static const iocshFuncDef dbapFuncDef = {"dbap",1,dbapArgs, + "toggle printing after processing a certain record.\n"}; static void dbapCallFunc(const iocshArgBuf *args) { dbap(args[0].sval);} /* dbsr */ static const iocshArg dbsrArg0 = { "interest level",iocshArgInt}; static const iocshArg * const dbsrArgs[1] = {&dbsrArg0}; -static const iocshFuncDef dbsrFuncDef = {"dbsr",1,dbsrArgs}; +static const iocshFuncDef dbsrFuncDef = {"dbsr",1,dbsrArgs, + "Database Server Report.\n"}; static void dbsrCallFunc(const iocshArgBuf *args) { dbsr(args[0].ival);} /* dbcar */ static const iocshArg dbcarArg0 = { "record name",iocshArgString}; static const iocshArg dbcarArg1 = { "level",iocshArgInt}; static const iocshArg * const dbcarArgs[2] = {&dbcarArg0,&dbcarArg1}; -static const iocshFuncDef dbcarFuncDef = {"dbcar",2,dbcarArgs}; +static const iocshFuncDef dbcarFuncDef = {"dbcar",2,dbcarArgs, + "Database Channel Access Report.\n" + "Shows status of Channel Access links (CA_LINK).\n" + "interest level 0 - Shows statistics for all links.\n" + " 1 - Shows info. of only disconnected links.\n" + " 2 - Shows info. for all links.\n"}; static void dbcarCallFunc(const iocshArgBuf *args) { dbcar(args[0].sval,args[1].ival); @@ -114,7 +127,8 @@ static void dbcarCallFunc(const iocshArgBuf *args) static const iocshArg dbjlrArg0 = { "record name",iocshArgString}; static const iocshArg dbjlrArg1 = { "level",iocshArgInt}; static const iocshArg * const dbjlrArgs[2] = {&dbjlrArg0,&dbjlrArg1}; -static const iocshFuncDef dbjlrFuncDef = {"dbjlr",2,dbjlrArgs}; +static const iocshFuncDef dbjlrFuncDef = {"dbjlr",2,dbjlrArgs, + "Database JSON link Report.\n"}; static void dbjlrCallFunc(const iocshArgBuf *args) { dbjlr(args[0].sval,args[1].ival); @@ -124,7 +138,9 @@ static void dbjlrCallFunc(const iocshArgBuf *args) static const iocshArg dbelArg0 = { "record name",iocshArgString}; static const iocshArg dbelArg1 = { "level",iocshArgInt}; static const iocshArg * const dbelArgs[2] = {&dbelArg0,&dbelArg1}; -static const iocshFuncDef dbelFuncDef = {"dbel",2,dbelArgs}; +static const iocshFuncDef dbelFuncDef = {"dbel",2,dbelArgs, + "Database event list.\n" + "Show information on dbEvent subscriptions.\n"}; static void dbelCallFunc(const iocshArgBuf *args) { dbel(args[0].sval, args[1].ival); @@ -133,14 +149,18 @@ static void dbelCallFunc(const iocshArgBuf *args) /* dba */ static const iocshArg dbaArg0 = { "record name",iocshArgString}; static const iocshArg * const dbaArgs[1] = {&dbaArg0}; -static const iocshFuncDef dbaFuncDef = {"dba",1,dbaArgs}; +static const iocshFuncDef dbaFuncDef = {"dba",1,dbaArgs, + "dbAddr info.\n"}; static void dbaCallFunc(const iocshArgBuf *args) { dba(args[0].sval);} /* dbl */ static const iocshArg dblArg0 = { "record type",iocshArgString}; static const iocshArg dblArg1 = { "fields",iocshArgString}; static const iocshArg * const dblArgs[] = {&dblArg0,&dblArg1}; -static const iocshFuncDef dblFuncDef = {"dbl",2,dblArgs}; +static const iocshFuncDef dblFuncDef = {"dbl",2,dblArgs, + "Database list.\n" + "List record/field names.\n" + "With no arguments, lists all record names.\n"}; static void dblCallFunc(const iocshArgBuf *args) { dbl(args[0].sval,args[1].sval); @@ -149,38 +169,46 @@ static void dblCallFunc(const iocshArgBuf *args) /* dbnr */ static const iocshArg dbnrArg0 = { "verbose",iocshArgInt}; static const iocshArg * const dbnrArgs[1] = {&dbnrArg0}; -static const iocshFuncDef dbnrFuncDef = {"dbnr",1,dbnrArgs}; +static const iocshFuncDef dbnrFuncDef = {"dbnr",1,dbnrArgs, + "List stats on record alias()s.\n"}; static void dbnrCallFunc(const iocshArgBuf *args) { dbnr(args[0].ival);} /* dbli */ static const iocshArg dbliArg0 = { "pattern",iocshArgString}; static const iocshArg * const dbliArgs[1] = {&dbliArg0}; -static const iocshFuncDef dbliFuncDef = {"dbli",1,dbliArgs}; +static const iocshFuncDef dbliFuncDef = {"dbli",1,dbliArgs, + "List info() tags with names matching pattern.\n"}; static void dbliCallFunc(const iocshArgBuf *args) { dbli(args[0].sval);} /* dbla */ static const iocshArg dblaArg0 = { "pattern",iocshArgString}; static const iocshArg * const dblaArgs[1] = {&dblaArg0}; -static const iocshFuncDef dblaFuncDef = {"dbla",1,dblaArgs}; +static const iocshFuncDef dblaFuncDef = {"dbla",1,dblaArgs, + "List record alias()s by alias name pattern.\n"}; static void dblaCallFunc(const iocshArgBuf *args) { dbla(args[0].sval);} /* dbgrep */ static const iocshArg dbgrepArg0 = { "pattern",iocshArgString}; static const iocshArg * const dbgrepArgs[1] = {&dbgrepArg0}; -static const iocshFuncDef dbgrepFuncDef = {"dbgrep",1,dbgrepArgs}; +static const iocshFuncDef dbgrepFuncDef = {"dbgrep",1,dbgrepArgs, + "List record names matching pattern.\n"}; static void dbgrepCallFunc(const iocshArgBuf *args) { dbgrep(args[0].sval);} /* dbgf */ static const iocshArg dbgfArg0 = { "record name",iocshArgString}; static const iocshArg * const dbgfArgs[1] = {&dbgfArg0}; -static const iocshFuncDef dbgfFuncDef = {"dbgf",1,dbgfArgs}; +static const iocshFuncDef dbgfFuncDef = {"dbgf",1,dbgfArgs, + "Database Get Field.\n" + "Print current value of record field.\n"}; static void dbgfCallFunc(const iocshArgBuf *args) { dbgf(args[0].sval);} /* dbpf */ static const iocshArg dbpfArg0 = { "record name",iocshArgString}; static const iocshArg dbpfArg1 = { "value",iocshArgString}; static const iocshArg * const dbpfArgs[2] = {&dbpfArg0,&dbpfArg1}; -static const iocshFuncDef dbpfFuncDef = {"dbpf",2,dbpfArgs}; +static const iocshFuncDef dbpfFuncDef = {"dbpf",2,dbpfArgs, + "Database Put Field.\n" + "Change value of record field.\n"}; static void dbpfCallFunc(const iocshArgBuf *args) { dbpf(args[0].sval,args[1].sval);} @@ -188,27 +216,33 @@ static void dbpfCallFunc(const iocshArgBuf *args) static const iocshArg dbprArg0 = { "record name",iocshArgString}; static const iocshArg dbprArg1 = { "interest level",iocshArgInt}; static const iocshArg * const dbprArgs[2] = {&dbprArg0,&dbprArg1}; -static const iocshFuncDef dbprFuncDef = {"dbpr",2,dbprArgs}; +static const iocshFuncDef dbprFuncDef = {"dbpr",2,dbprArgs, + "Database Print Record.\n" + "Print values of record fields.\n"}; static void dbprCallFunc(const iocshArgBuf *args) { dbpr(args[0].sval,args[1].ival);} /* dbtr */ static const iocshArg dbtrArg0 = { "record name",iocshArgString}; static const iocshArg * const dbtrArgs[1] = {&dbtrArg0}; -static const iocshFuncDef dbtrFuncDef = {"dbtr",1,dbtrArgs}; +static const iocshFuncDef dbtrFuncDef = {"dbtr",1,dbtrArgs, + "Process record and then some fields.\n"}; static void dbtrCallFunc(const iocshArgBuf *args) { dbtr(args[0].sval);} /* dbtgf */ static const iocshArg dbtgfArg0 = { "record name",iocshArgString}; static const iocshArg * const dbtgfArgs[1] = {&dbtgfArg0}; -static const iocshFuncDef dbtgfFuncDef = {"dbtgf",1,dbtgfArgs}; +static const iocshFuncDef dbtgfFuncDef = {"dbtgf",1,dbtgfArgs, + "Database Test Get Field.\n" + "Get field with different DBR_* types"}; static void dbtgfCallFunc(const iocshArgBuf *args) { dbtgf(args[0].sval);} /* dbtpf */ static const iocshArg dbtpfArg0 = { "record name",iocshArgString}; static const iocshArg dbtpfArg1 = { "value",iocshArgString}; static const iocshArg * const dbtpfArgs[2] = {&dbtpfArg0,&dbtpfArg1}; -static const iocshFuncDef dbtpfFuncDef = {"dbtpf",2,dbtpfArgs}; +static const iocshFuncDef dbtpfFuncDef = {"dbtpf",2,dbtpfArgs, + "Database Test Put Field.\n"}; static void dbtpfCallFunc(const iocshArgBuf *args) { dbtpf(args[0].sval,args[1].sval);} @@ -216,25 +250,29 @@ static void dbtpfCallFunc(const iocshArgBuf *args) static const iocshArg dbiorArg0 = { "driver name",iocshArgString}; static const iocshArg dbiorArg1 = { "interest level",iocshArgInt}; static const iocshArg * const dbiorArgs[] = {&dbiorArg0,&dbiorArg1}; -static const iocshFuncDef dbiorFuncDef = {"dbior",2,dbiorArgs}; +static const iocshFuncDef dbiorFuncDef = {"dbior",2,dbiorArgs, + "Driver Report.\n"}; static void dbiorCallFunc(const iocshArgBuf *args) { dbior(args[0].sval,args[1].ival);} /* dbhcr */ -static const iocshFuncDef dbhcrFuncDef = {"dbhcr",0,0}; +static const iocshFuncDef dbhcrFuncDef = {"dbhcr",0,0, + "Database Report Device Config.\n"}; static void dbhcrCallFunc(const iocshArgBuf *args) { dbhcr();} /* gft */ static const iocshArg gftArg0 = { "record name",iocshArgString}; static const iocshArg * const gftArgs[1] = {&gftArg0}; -static const iocshFuncDef gftFuncDef = {"gft",1,gftArgs}; +static const iocshFuncDef gftFuncDef = {"gft",1,gftArgs, + "Report dbChannel info and value.\n"}; static void gftCallFunc(const iocshArgBuf *args) { gft(args[0].sval);} /* pft */ static const iocshArg pftArg0 = { "record name",iocshArgString}; static const iocshArg pftArg1 = { "value",iocshArgString}; static const iocshArg * const pftArgs[2] = {&pftArg0,&pftArg1}; -static const iocshFuncDef pftFuncDef = {"pft",2,pftArgs}; +static const iocshFuncDef pftFuncDef = {"pft",2,pftArgs, + "dbChannel put value.\n"}; static void pftCallFunc(const iocshArgBuf *args) { pft(args[0].sval,args[1].sval);} @@ -242,12 +280,16 @@ static void pftCallFunc(const iocshArgBuf *args) static const iocshArg dbtpnArg0 = { "record name",iocshArgString}; static const iocshArg dbtpnArg1 = { "value",iocshArgString}; static const iocshArg * const dbtpnArgs[2] = {&dbtpnArg0,&dbtpnArg1}; -static const iocshFuncDef dbtpnFuncDef = {"dbtpn",2,dbtpnArgs}; +static const iocshFuncDef dbtpnFuncDef = {"dbtpn",2,dbtpnArgs, + "Database Put Notify\n" + "Without value, begin async. processing and get\n" + "With value, begin put, process, and get"}; static void dbtpnCallFunc(const iocshArgBuf *args) { dbtpn(args[0].sval,args[1].sval);} /* dbNotifyDump */ -static const iocshFuncDef dbNotifyDumpFuncDef = {"dbNotifyDump",0,0}; +static const iocshFuncDef dbNotifyDumpFuncDef = {"dbNotifyDump",0,0, + "Report status of any active async processing with completion notification.\n"}; static void dbNotifyDumpCallFunc(const iocshArgBuf *args) { dbNotifyDump();} /* dbPutAttribute */ @@ -257,7 +299,8 @@ static const iocshArg dbPutAttrArg2 = { "value",iocshArgString}; static const iocshArg * const dbPutAttrArgs[] = {&dbPutAttrArg0, &dbPutAttrArg1, &dbPutAttrArg2}; static const iocshFuncDef dbPutAttrFuncDef = - {"dbPutAttribute",3,dbPutAttrArgs}; + {"dbPutAttribute",3,dbPutAttrArgs, + "Set/Create record attribute.\n"}; static void dbPutAttrCallFunc(const iocshArgBuf *args) { dbPutAttribute(args[0].sval,args[1].sval,args[2].sval);} @@ -265,7 +308,8 @@ static void dbPutAttrCallFunc(const iocshArgBuf *args) static const iocshArg tpnArg0 = { "record name",iocshArgString}; static const iocshArg tpnArg1 = { "value",iocshArgString}; static const iocshArg * const tpnArgs[2] = {&tpnArg0,&tpnArg1}; -static const iocshFuncDef tpnFuncDef = {"tpn",2,tpnArgs}; +static const iocshFuncDef tpnFuncDef = {"tpn",2,tpnArgs, + "Begin async. process and get.\n"}; static void tpnCallFunc(const iocshArgBuf *args) { tpn(args[0].sval,args[1].sval);} @@ -273,7 +317,8 @@ static void tpnCallFunc(const iocshArgBuf *args) static const iocshArg dblsrArg0 = { "record name",iocshArgString}; static const iocshArg dblsrArg1 = { "interest level",iocshArgInt}; static const iocshArg * const dblsrArgs[2] = {&dblsrArg0,&dblsrArg1}; -static const iocshFuncDef dblsrFuncDef = {"dblsr",2,dblsrArgs}; +static const iocshFuncDef dblsrFuncDef = {"dblsr",2,dblsrArgs, + "Database Lockset report.\n"}; static void dblsrCallFunc(const iocshArgBuf *args) { dblsr(args[0].sval,args[1].ival);} @@ -281,7 +326,8 @@ static void dblsrCallFunc(const iocshArgBuf *args) static const iocshArg dbLockShowLockedArg0 = { "interest level",iocshArgInt}; static const iocshArg * const dbLockShowLockedArgs[1] = {&dbLockShowLockedArg0}; static const iocshFuncDef dbLockShowLockedFuncDef = - {"dbLockShowLocked",1,dbLockShowLockedArgs}; + {"dbLockShowLocked",1,dbLockShowLockedArgs, + "Show Locksets which are currently locked.\n"}; static void dbLockShowLockedCallFunc(const iocshArgBuf *args) { dbLockShowLocked(args[0].ival);} @@ -290,7 +336,9 @@ static const iocshArg scanOnceSetQueueSizeArg0 = { "size",iocshArgInt}; static const iocshArg * const scanOnceSetQueueSizeArgs[1] = {&scanOnceSetQueueSizeArg0}; static const iocshFuncDef scanOnceSetQueueSizeFuncDef = - {"scanOnceSetQueueSize",1,scanOnceSetQueueSizeArgs}; + {"scanOnceSetQueueSize",1,scanOnceSetQueueSizeArgs, + "Change size of Scan once queue.\n" + "Must be called before iocInit().\n"}; static void scanOnceSetQueueSizeCallFunc(const iocshArgBuf *args) { scanOnceSetQueueSize(args[0].ival); @@ -301,7 +349,8 @@ static const iocshArg scanOnceQueueShowArg0 = { "reset",iocshArgInt}; static const iocshArg * const scanOnceQueueShowArgs[1] = {&scanOnceQueueShowArg0}; static const iocshFuncDef scanOnceQueueShowFuncDef = - {"scanOnceQueueShow",1,scanOnceQueueShowArgs}; + {"scanOnceQueueShow",1,scanOnceQueueShowArgs, + "Show details and statitics of scan once queue processing.\n"}; static void scanOnceQueueShowCallFunc(const iocshArgBuf *args) { scanOnceQueueShow(args[0].ival); @@ -310,21 +359,24 @@ static void scanOnceQueueShowCallFunc(const iocshArgBuf *args) /* scanppl */ static const iocshArg scanpplArg0 = { "rate",iocshArgDouble}; static const iocshArg * const scanpplArgs[1] = {&scanpplArg0}; -static const iocshFuncDef scanpplFuncDef = {"scanppl",1,scanpplArgs}; +static const iocshFuncDef scanpplFuncDef = {"scanppl",1,scanpplArgs, + "print periodic scan lists.\n"}; static void scanpplCallFunc(const iocshArgBuf *args) { scanppl(args[0].dval);} /* scanpel */ static const iocshArg scanpelArg0 = { "event name",iocshArgString}; static const iocshArg * const scanpelArgs[1] = {&scanpelArg0}; -static const iocshFuncDef scanpelFuncDef = {"scanpel",1,scanpelArgs}; +static const iocshFuncDef scanpelFuncDef = {"scanpel",1,scanpelArgs, + "Print info for records with SCAN = \"Event\".\n"}; static void scanpelCallFunc(const iocshArgBuf *args) { scanpel(args[0].sval);} /* postEvent */ static const iocshArg postEventArg0 = { "event name",iocshArgString}; static const iocshArg * const postEventArgs[1] = {&postEventArg0}; -static const iocshFuncDef postEventFuncDef = {"postEvent",1,postEventArgs}; +static const iocshFuncDef postEventFuncDef = {"postEvent",1,postEventArgs, + "Manually scan all records with EVNT == name.\n"}; static void postEventCallFunc(const iocshArgBuf *args) { EVENTPVT pel = eventNameToHandle(args[0].sval); @@ -332,7 +384,8 @@ static void postEventCallFunc(const iocshArgBuf *args) } /* scanpiol */ -static const iocshFuncDef scanpiolFuncDef = {"scanpiol",0}; +static const iocshFuncDef scanpiolFuncDef = {"scanpiol",0,0, + "Print info for records with SCAN = \"I/O Intr\".\n"}; static void scanpiolCallFunc(const iocshArgBuf *args) { scanpiol();} /* callbackSetQueueSize */ @@ -340,7 +393,9 @@ static const iocshArg callbackSetQueueSizeArg0 = { "bufsize",iocshArgInt}; static const iocshArg * const callbackSetQueueSizeArgs[1] = {&callbackSetQueueSizeArg0}; static const iocshFuncDef callbackSetQueueSizeFuncDef = - {"callbackSetQueueSize",1,callbackSetQueueSizeArgs}; + {"callbackSetQueueSize",1,callbackSetQueueSizeArgs, + "Change depth of queue for callback workers.\n" + "Must be called before iocInit().\n"}; static void callbackSetQueueSizeCallFunc(const iocshArgBuf *args) { callbackSetQueueSize(args[0].ival); @@ -351,7 +406,8 @@ static const iocshArg callbackQueueShowArg0 = { "reset", iocshArgInt}; static const iocshArg * const callbackQueueShowArgs[1] = {&callbackQueueShowArg0}; static const iocshFuncDef callbackQueueShowFuncDef = - {"callbackQueueShow",1,callbackQueueShowArgs}; + {"callbackQueueShow",1,callbackQueueShowArgs, + "Show status of callback thread processing queue.\n"}; static void callbackQueueShowCallFunc(const iocshArgBuf *args) { callbackQueueShow(args[0].ival); @@ -363,7 +419,10 @@ static const iocshArg callbackParallelThreadsArg1 = { "priority", iocshArgString static const iocshArg * const callbackParallelThreadsArgs[2] = {&callbackParallelThreadsArg0,&callbackParallelThreadsArg1}; static const iocshFuncDef callbackParallelThreadsFuncDef = - {"callbackParallelThreads",2,callbackParallelThreadsArgs}; + {"callbackParallelThreads",2,callbackParallelThreadsArgs, + "Configure multiple workers for a given callback queue priority level.\n" + "priority may be omitted or \"*\" to act on all priorities\n" + "or one of LOW, MEDIUM, or HIGH.\n"}; static void callbackParallelThreadsCallFunc(const iocshArgBuf *args) { callbackParallelThreads(args[0].ival, args[1].sval); @@ -372,7 +431,8 @@ static void callbackParallelThreadsCallFunc(const iocshArgBuf *args) /* dbStateCreate */ static const iocshArg dbStateArgName = { "name", iocshArgString }; static const iocshArg * const dbStateCreateArgs[] = { &dbStateArgName }; -static const iocshFuncDef dbStateCreateFuncDef = { "dbStateCreate", 1, dbStateCreateArgs }; +static const iocshFuncDef dbStateCreateFuncDef = { "dbStateCreate", 1, dbStateCreateArgs, + "Allocate new state name for \"state\" filter.\n"}; static void dbStateCreateCallFunc (const iocshArgBuf *args) { dbStateCreate(args[0].sval); @@ -380,7 +440,8 @@ static void dbStateCreateCallFunc (const iocshArgBuf *args) /* dbStateSet */ static const iocshArg * const dbStateSetArgs[] = { &dbStateArgName }; -static const iocshFuncDef dbStateSetFuncDef = { "dbStateSet", 1, dbStateSetArgs }; +static const iocshFuncDef dbStateSetFuncDef = { "dbStateSet", 1, dbStateSetArgs, + "Change state to set for \"state\" filter.\n"}; static void dbStateSetCallFunc (const iocshArgBuf *args) { dbStateId sid = dbStateFind(args[0].sval); @@ -391,7 +452,8 @@ static void dbStateSetCallFunc (const iocshArgBuf *args) /* dbStateClear */ static const iocshArg * const dbStateClearArgs[] = { &dbStateArgName }; -static const iocshFuncDef dbStateClearFuncDef = { "dbStateClear", 1, dbStateClearArgs }; +static const iocshFuncDef dbStateClearFuncDef = { "dbStateClear", 1, dbStateClearArgs, + "Change state to clear for \"state\" filter.\n" }; static void dbStateClearCallFunc (const iocshArgBuf *args) { dbStateId sid = dbStateFind(args[0].sval); @@ -403,7 +465,8 @@ static void dbStateClearCallFunc (const iocshArgBuf *args) /* dbStateShow */ static const iocshArg dbStateShowArg1 = { "level", iocshArgInt }; static const iocshArg * const dbStateShowArgs[] = { &dbStateArgName, &dbStateShowArg1 }; -static const iocshFuncDef dbStateShowFuncDef = { "dbStateShow", 2, dbStateShowArgs }; +static const iocshFuncDef dbStateShowFuncDef = { "dbStateShow", 2, dbStateShowArgs, + "Show set/clear status of named state. (cf. \"state\" filter)\n" }; static void dbStateShowCallFunc (const iocshArgBuf *args) { dbStateId sid = dbStateFind(args[0].sval); @@ -415,7 +478,8 @@ static void dbStateShowCallFunc (const iocshArgBuf *args) /* dbStateShowAll */ static const iocshArg dbStateShowAllArg0 = { "level", iocshArgInt }; static const iocshArg * const dbStateShowAllArgs[] = { &dbStateShowAllArg0 }; -static const iocshFuncDef dbStateShowAllFuncDef = { "dbStateShowAll", 1, dbStateShowAllArgs }; +static const iocshFuncDef dbStateShowAllFuncDef = { "dbStateShowAll", 1, dbStateShowAllArgs, + "Show set/clear status of all named states. (cf. \"state\" filter)\n" }; static void dbStateShowAllCallFunc (const iocshArgBuf *args) { dbStateShowAll(args[0].ival); diff --git a/modules/database/src/ioc/dbStatic/dbStaticIocRegister.c b/modules/database/src/ioc/dbStatic/dbStaticIocRegister.c index 65acc198d..d7c02b6e0 100644 --- a/modules/database/src/ioc/dbStatic/dbStaticIocRegister.c +++ b/modules/database/src/ioc/dbStatic/dbStaticIocRegister.c @@ -22,7 +22,8 @@ static const iocshArg argRecType = { "recordTypeName", iocshArgString}; /* dbDumpPath */ static const iocshArg * const dbDumpPathArgs[] = {&argPdbbase}; -static const iocshFuncDef dbDumpPathFuncDef = {"dbDumpPath",1,dbDumpPathArgs}; +static const iocshFuncDef dbDumpPathFuncDef = {"dbDumpPath",1,dbDumpPathArgs, + "Dump .db/.dbd file search path.\n"}; static void dbDumpPathCallFunc(const iocshArgBuf *args) { dbDumpPath(*iocshPpdbbase); diff --git a/modules/libcom/src/iocsh/iocsh.cpp b/modules/libcom/src/iocsh/iocsh.cpp index 97d1101f6..0492156e7 100644 --- a/modules/libcom/src/iocsh/iocsh.cpp +++ b/modules/libcom/src/iocsh/iocsh.cpp @@ -442,7 +442,10 @@ stopRedirect(const char *filename, int lineno, struct iocshRedirect *redirect) static const iocshArg helpArg0 = { "[command ...]",iocshArgArgv}; static const iocshArg *helpArgs[1] = {&helpArg0}; static const iocshFuncDef helpFuncDef = - {"help",1,helpArgs}; + {"help",1,helpArgs, + "With no arguments, list available command names.\n" + "With arguments, list arguments and usage for command(s).\n" + "Command names may contain wildcards\n"}; static void helpCallFunc(const iocshArgBuf *args) { int argc = args[0].aval.ac; @@ -485,6 +488,9 @@ static void helpCallFunc(const iocshArgBuf *args) for (pcmd = iocshCommandHead ; pcmd != NULL ; pcmd = pcmd->next) { piocshFuncDef = pcmd->def.pFuncDef; if (epicsStrGlobMatch(piocshFuncDef->name, argv[iarg]) != 0) { + if(piocshFuncDef->usage) { + fputs("\nUsage: ", epicsGetStdout()); + } fputs(piocshFuncDef->name, epicsGetStdout()); for (int a = 0 ; a < piocshFuncDef->nargs ; a++) { const char *cp = piocshFuncDef->arg[a]->name; @@ -497,6 +503,9 @@ static void helpCallFunc(const iocshArgBuf *args) } } fprintf(epicsGetStdout(),"\n");; + if(piocshFuncDef->usage) { + fprintf(epicsGetStdout(), "\n%s", piocshFuncDef->usage); + } } } } @@ -1159,7 +1168,12 @@ static void iocshRunCallFunc(const iocshArgBuf *args) /* on */ static const iocshArg onArg0 = { "'error' 'continue' | 'break' | 'wait' [value] | 'halt'", iocshArgArgv }; static const iocshArg *onArgs[1] = {&onArg0}; -static const iocshFuncDef onFuncDef = {"on", 1, onArgs}; +static const iocshFuncDef onFuncDef = {"on", 1, onArgs, + "Change IOC shell error handling.\n" + " continue (default) - Ignores error and continue with next commands.\n" + " break - Return to caller without executing futher commands.\n" + " halt - Suspend process.\n" + " wait - stall process for [value] seconds, the continue.\n"}; static void onCallFunc(const iocshArgBuf *args) { iocshContext *context = (iocshContext *) epicsThreadPrivateGet(iocshContextId); @@ -1225,7 +1239,8 @@ static void commentCallFunc(const iocshArgBuf *) /* exit */ static const iocshFuncDef exitFuncDef = - {"exit",0,0}; + {"exit",0,0, + "Return to caller. IOCs exit() from process.\n"}; static void exitCallFunc(const iocshArgBuf *) { } diff --git a/modules/libcom/src/iocsh/iocsh.h b/modules/libcom/src/iocsh/iocsh.h index a63af64ce..4b87f3dd7 100644 --- a/modules/libcom/src/iocsh/iocsh.h +++ b/modules/libcom/src/iocsh/iocsh.h @@ -62,6 +62,7 @@ typedef struct iocshFuncDef { const char *name; int nargs; const iocshArg * const *arg; + const char* usage; }iocshFuncDef; typedef void (*iocshCallFunc)(const iocshArgBuf *argBuf); From 44ed397517127e1b961babf7aeefc71aa8656e09 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Sat, 25 Apr 2020 14:15:54 +0200 Subject: [PATCH 161/216] travis-ci: update .travis.yml for ci-scripts --- .travis.yml | 132 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 81 insertions(+), 51 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1e7d45212..5edb00dcd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,63 +1,93 @@ -language: c +# .travis.yml for use with EPICS Base ci-scripts +# (see: https://github.com/epics-base/ci-scripts) -matrix: - include: - - sudo: false - dist: bionic - compiler: gcc - env: CMPLR=gcc - - sudo: false - dist: xenial - compiler: gcc - env: CMPLR=gcc - - sudo: false - dist: bionic - compiler: gcc - env: CMPLR=gcc CMD_CXXFLAGS=-std=c++11 - - sudo: false - dist: trusty - compiler: gcc - env: CMPLR=gcc STATIC=YES CMD_CXXFLAGS=-std=c++11 - - sudo: false - dist: bionic - compiler: gcc - env: CMPLR=clang - - sudo: false - dist: xenial - compiler: gcc - env: CMPLR=clang - - sudo: false - dist: trusty - compiler: gcc - env: CMPLR=clang STATIC=YES - - sudo: false - dist: trusty - compiler: gcc - env: WINE=32 TEST=NO STATIC=YES - - sudo: false - dist: trusty - compiler: gcc - env: WINE=32 TEST=NO STATIC=NO - - sudo: false - dist: trusty - compiler: gcc - env: RTEMS=4.10 - - sudo: false - dist: trusty - compiler: gcc - env: RTEMS=4.9 - - os: osx - env: CMD_CFLAGS="-mmacosx-version-min=10.7" CMD_CXXFLAGS="-mmacosx-version-min=10.7 -std=c++11 -stdlib=libc++" CMD_LDXFLAGS="-mmacosx-version-min=10.7 -std=c++11 -stdlib=libc++" +language: cpp +compiler: gcc +dist: xenial + +cache: + directories: + - $HOME/.cache + +env: + global: + - SETUP_PATH=.ci-local:.ci + - BASE=SELF addons: apt: packages: + # for all EPICS builds - libreadline6-dev - libncurses5-dev - perl + # for clang compiler - clang + # for mingw builds (32bit and 64bit) - g++-mingw-w64-i686 + - g++-mingw-w64-x86-64 + # for RTEMS cross builds - qemu-system-x86 + homebrew: + packages: + # for all EPICS builds + - bash + update: true + +install: + - ./.ci/travis/prepare.sh + script: - - .ci/travis-prepare.sh - - .ci/travis-build.sh + - ./.ci/travis/build.sh + +# Define build jobs + +jobs: + include: + +# Different configurations of default gcc and clang +# (the DIST settings are just FYI on the travis-ci.org site) + - dist: bionic + env: DIST=bionic + + - env: DIST=xenial + + - dist: bionic + env: DIST=bionic EXTRA="CMD_CXXFLAGS=-std=c++11" + + - dist: trusty + env: DIST=trusty STATIC=YES EXTRA="CMD_CXXFLAGS=-std=c++11" + + - dist: bionic + compiler: clang + env: DIST=bionic + + - compiler: clang + env: DIST=xenial + + - dist: trusty + compiler: clang + env: DIST=trusty STATIC=YES + +# Cross-compilations to Windows using MinGW and WINE + + - env: WINE=32 TEST=NO STATIC=YES + compiler: mingw + + - env: WINE=32 TEST=NO STATIC=NO + compiler: mingw + +# Cross-compilation to RTEMS + + - env: RTEMS=4.10 TEST=NO + + - env: RTEMS=4.9 TEST=NO + +# MacOS build + + - os: osx + env: + - EXTRA="CMD_CFLAGS=-mmacosx-version-min=10.7" + - EXTRA1="CMD_CXXFLAGS=-mmacosx-version-min=10.7 -std=c++11 -stdlib=libc++" + - EXTRA2="CMD_LDXFLAGS=-mmacosx-version-min=10.7 -std=c++11 -stdlib=libc++" + compiler: clang From 958af54895e1ab056ed5f14dac760a097e0b0675 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Sat, 25 Apr 2020 14:18:15 +0200 Subject: [PATCH 162/216] appveyor: update .appveyor.yml for ci-scripts --- .appveyor.yml | 92 ++++++++++++++++++++++++++------------------------- 1 file changed, 47 insertions(+), 45 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index eb311fcdf..6a289f6ea 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,11 +1,18 @@ -# AppVeyor configuration for EPICS Base - -# Ralph Lange -# Copyright (c) 2016-2017 ITER Organization +# .appveyor.yml for use with EPICS Base ci-scripts +# (see: https://github.com/epics-base/ci-scripts) # Version format version: base-{branch}-{build} +#---------------------------------# +# build cache # +#---------------------------------# +# The AppVeyor cache allowance is way too small (1GB per account across all projects, branches and jobs) +# to be used for the dependency builds. + +cache: + - C:\Users\appveyor\.tools + #---------------------------------# # repository cloning # #---------------------------------# @@ -16,7 +23,7 @@ init: - git config --global core.autocrlf true # Set clone depth (do not fetch complete history) -clone_depth: 50 +clone_depth: 5 # Skipping commits affecting only specific files skip_commits: @@ -37,51 +44,44 @@ configuration: - dynamic-debug - static-debug -# Environment variables: compiler toolchain +# Environment variables: compiler toolchain, base version, setup file, ... environment: - matrix: - - TOOLCHAIN: mingw - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - - TOOLCHAIN: 2019 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - - TOOLCHAIN: 2017 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - - TOOLCHAIN: 14.0 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - - TOOLCHAIN: 12.0 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - - TOOLCHAIN: 11.0 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - - TOOLCHAIN: 10.0 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + # common / default variables for all jobs + SETUP_PATH: .ci-local:.ci + BASE: SELF -# Platform: architecture + matrix: + - CMP: vs2019 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + - CMP: vs2017 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + - CMP: vs2015 + - CMP: vs2013 + - CMP: vs2012 + - CMP: vs2010 + - CMP: mingw + +# Platform: processor architecture platform: - x86 - x64 -# Matrix configuration: allow specific failing jobs +# Matrix configuration: exclude sets of jobs matrix: exclude: - # VS Express installs don't have the 64 bit compiler + # VS2012 and older installs don't have the 64 bit compiler - platform: x64 - TOOLCHAIN: 10.0 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - # Exclude to reduce total job runtime - # skip 64-bit for older and 32-bit for newer + CMP: vs2012 - platform: x64 - TOOLCHAIN: 11.0 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + CMP: vs2010 + - platform: x64 + CMP: vs2008 + # Exclude more jobs to reduce build time + # Skip 32-bit for "middle-aged" compilers - platform: x86 - TOOLCHAIN: mingw - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + CMP: vs2017 - platform: x86 - TOOLCHAIN: 2019 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - - platform: x86 - TOOLCHAIN: 2017 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - + CMP: vs2015 #---------------------------------# # building & testing # @@ -89,18 +89,17 @@ matrix: install: - cmd: git submodule update --init --recursive - - cmd: .ci/appveyor-prepare.bat + - cmd: python .ci/appveyor/do.py prepare build_script: - - cmd: .ci/appveyor-make.bat + - cmd: python .ci/appveyor/do.py build test_script: - - cmd: .ci/appveyor-make.bat tapfiles + - cmd: python .ci/appveyor/do.py test on_finish: - ps: Get-ChildItem *.tap -Recurse -Force | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } - - cmd: .ci/appveyor-make.bat -s test-results - + - cmd: python .ci/appveyor/do.py build test-results -s #---------------------------------# # debugging # @@ -110,10 +109,13 @@ on_finish: ## note that you will need to connect within the usual build timeout limit (60 minutes) ## so you may want to adjust the build matrix above to just build the one of interest -#on_failure: +# print the connection info +#init: # - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) -# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) +# block a failed build (until the watchdog barks) +#on_failure: +# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) #---------------------------------# # notifications # From 65e7a3e3efa0f4244d0a7adc5e5268fd026f8062 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Thu, 23 Apr 2020 14:48:22 +0200 Subject: [PATCH 163/216] ci: remove old integration in .ci-local --- .ci-local/appveyor-make.bat | 132 --------------------------------- .ci-local/appveyor-prepare.bat | 52 ------------- .ci-local/checkout-modules.sh | 8 -- .ci-local/travis-build.sh | 78 ------------------- .ci-local/travis-prepare.sh | 24 ------ 5 files changed, 294 deletions(-) delete mode 100644 .ci-local/appveyor-make.bat delete mode 100644 .ci-local/appveyor-prepare.bat delete mode 100755 .ci-local/checkout-modules.sh delete mode 100755 .ci-local/travis-build.sh delete mode 100755 .ci-local/travis-prepare.sh diff --git a/.ci-local/appveyor-make.bat b/.ci-local/appveyor-make.bat deleted file mode 100644 index eb127c5ce..000000000 --- a/.ci-local/appveyor-make.bat +++ /dev/null @@ -1,132 +0,0 @@ -:: Universal build script for AppVeyor (https://ci.appveyor.com/) -:: Environment: -:: TOOLCHAIN - toolchain version [10.0/11.0/12.0/14.0/2017/2019/mingw] -:: CONFIGURATION - determines EPICS build [dynamic/static] -:: PLATFORM - architecture [x86/x64] -:: -:: All command line args are passed to make - -Setlocal EnableDelayedExpansion - -:: we do not currently have a combined static and debug EPICS_HOST_ARCH target -:: So a combined debug and static target will appear to be just static -:: but debug will have been specified in CONFIG_SITE by appveyor-prepare.bat -set "ST=" -echo.%CONFIGURATION% | findstr /C:"debug">nul && ( - set "ST=-debug" -) -echo.%CONFIGURATION% | findstr /C:"static">nul && ( - set "ST=-static" -) - -set MY_OS=64BIT -if "%PLATFORM%"=="x86" set MY_OS=32BIT - -echo [INFO] Platform: %MY_OS% - -:: Use parallel make, except for 3.14 -set "MAKEARGS=-j2 -Otarget" -if "%APPVEYOR_REPO_BRANCH%"=="3.14" set MAKEARGS= - -if "%TOOLCHAIN%"=="mingw" ( - set "MAKE=mingw32-make" - if "%MY_OS%"=="64BIT" ( - set "EPICS_HOST_ARCH=windows-x64-mingw" - set "INCLUDE=C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\include;%INCLUDE%" - set "PATH=C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;%PATH%" - echo [INFO] MinGW Toolchain 64bit - ) else ( - set "EPICS_HOST_ARCH=win32-x86-mingw" - set "INCLUDE=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\include;%INCLUDE%" - set "PATH=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin;%PATH%" - echo [INFO] MinGW Toolchain 32bit - ) - echo [INFO] Compiler Version - gcc -v - goto Finish -) - -if "%TOOLCHAIN%"=="2019" ( - echo [INFO] Setting strawberry perl path - set "PATH=c:\strawberry\perl\site\bin;C:\strawberry\perl\bin;%PATH%" -) - -set "VSINSTALL=C:\Program Files (x86)\Microsoft Visual Studio %TOOLCHAIN%" -if not exist "%VSINSTALL%\" set "VSINSTALL=C:\Program Files (x86)\Microsoft Visual Studio\%TOOLCHAIN%\Community" -if not exist "%VSINSTALL%\" goto MSMissing - -set "MAKE=C:\tools\make" - -echo [INFO] APPVEYOR_BUILD_WORKER_IMAGE=%APPVEYOR_BUILD_WORKER_IMAGE% - -if "%MY_OS%"=="64BIT" ( - set EPICS_HOST_ARCH=windows-x64%ST% - :: VS 2017/2019 - if exist "%VSINSTALL%\VC\Auxiliary\Build\vcvars64.bat" ( - call "%VSINSTALL%\VC\Auxiliary\Build\vcvars64.bat" - where cl - if !ERRORLEVEL! NEQ 0 goto MSMissing - goto MSFound - ) - if exist "%VSINSTALL%\VC\vcvarsall.bat" ( - call "%VSINSTALL%\VC\vcvarsall.bat" amd64 - where cl - if !ERRORLEVEL! NEQ 0 ( - call "%VSINSTALL%\VC\vcvarsall.bat" x86_amd64 - where cl - if !ERRORLEVEL! NEQ 0 goto MSMissing - ) - goto MSFound - ) - if exist "%VSINSTALL%\VC\bin\amd64\vcvars64.bat" ( - call "%VSINSTALL%\VC\bin\amd64\vcvars64.bat" - where cl - if !ERRORLEVEL! NEQ 0 goto MSMissing - goto MSFound - ) -) else ( - set EPICS_HOST_ARCH=win32-x86%ST% - :: VS 2017/2019 - if exist "%VSINSTALL%\VC\Auxiliary\Build\vcvars32.bat" ( - call "%VSINSTALL%\VC\Auxiliary\Build\vcvars32.bat" - where cl - if !ERRORLEVEL! NEQ 0 goto MSMissing - goto MSFound - ) - if exist "%VSINSTALL%\VC\vcvarsall.bat" ( - call "%VSINSTALL%\VC\vcvarsall.bat" x86 - where cl - if !ERRORLEVEL! NEQ 0 goto MSMissing - goto MSFound - ) - if exist "%VSINSTALL%\VC\bin\vcvars32.bat" ( - call "%VSINSTALL%\VC\bin\vcvars32.bat" - where cl - if !ERRORLEVEL! NEQ 0 goto MSMissing - goto MSFound - ) - if exist "%VSINSTALL%\Common7\Tools\vsvars32.bat" ( - call "%VSINSTALL%\Common7\Tools\vsvars32.bat" - where cl - if !ERRORLEVEL! NEQ 0 goto MSMissing - goto MSFound - ) -) - -:MSMissing -echo [INFO] Installation for MSVC Toolchain %TOOLCHAIN% / %MY_OS% seems to be missing -exit 1 - -:MSFound -echo [INFO] Microsoft Visual Studio Toolchain %TOOLCHAIN% -echo [INFO] Compiler Version -cl - -:Finish -echo [INFO] EPICS_HOST_ARCH: %EPICS_HOST_ARCH% -echo [INFO] Make version -%MAKE% --version -echo [INFO] Perl version -perl --version - -%MAKE% %MAKEARGS% %* diff --git a/.ci-local/appveyor-prepare.bat b/.ci-local/appveyor-prepare.bat deleted file mode 100644 index 312223d16..000000000 --- a/.ci-local/appveyor-prepare.bat +++ /dev/null @@ -1,52 +0,0 @@ -:: Build script for AppVeyor (https://ci.appveyor.com/) -:: Environment: -:: TOOLCHAIN - Toolchain Version [9.0/10.0/11.0/12.0/14.0/mingw] -:: CONFIGURATION - determines EPICS build [dynamic/static, -debug] -:: PLATFORM - "x86" -> use 32bit architecture -:: -:: Prepares an Appveyor build by excuting the following steps -:: - Set up configure\CONFIG_SITE for static vs. dynamic build -:: - Install Mingw (TOOLCHAIN setting) in the in the appropriate flavor -:: - Download and install Make-4.1 from EPICS download page - -Setlocal EnableDelayedExpansion - -set MY_OS=64BIT -if "%PLATFORM%"=="x86" set MY_OS=32BIT - -echo [INFO] Platform: %MY_OS% - -:: with MSVC either static or debug can be handled as part -:: of EPICS_HOST_ARCH but not both. So we set the appropriate -:: options in CONFIG_SITE. For mingw and cygwin they are missing -:: some static and debug targets so set things here too -echo.%CONFIGURATION% | findstr /C:"static">nul && ( - echo SHARED_LIBRARIES=NO>> configure\CONFIG_SITE - echo STATIC_BUILD=YES>> configure\CONFIG_SITE - echo [INFO] EPICS set up for static build -) || ( - echo [INFO] EPICS set up for dynamic build -) - -echo.%CONFIGURATION% | findstr /C:"debug">nul && ( - echo HOST_OPT=NO>> configure\CONFIG_SITE - echo [INFO] EPICS set up for debug build -) || ( - echo [INFO] EPICS set up for optimized build -) - -echo [INFO] Installing Make 4.2.1 from ANL web site -curl -fsS --retry 3 -o C:\tools\make-4.2.1.zip https://epics.anl.gov/download/tools/make-4.2.1-win64.zip -cd \tools -"C:\Program Files\7-Zip\7z" e make-4.2.1.zip - -set "PERLVER=5.30.0.1" -if "%TOOLCHAIN%"=="2019" ( - echo [INFO] Installing Strawberry Perl %PERLVER% - curl -fsS --retry 3 -o C:\tools\perl-%PERLVER%.zip http://strawberryperl.com/download/%PERLVER%/strawberry-perl-%PERLVER%-64bit.zip - cd \tools - "C:\Program Files\7-Zip\7z" x perl-%PERLVER%.zip -oC:\strawberry - cd \strawberry - :: we set PATH in appveyor-build.bat - call relocation.pl.bat -) diff --git a/.ci-local/checkout-modules.sh b/.ci-local/checkout-modules.sh deleted file mode 100755 index 69070adb7..000000000 --- a/.ci-local/checkout-modules.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -# Checkout submodules on their appropriate branches -# - -git submodule foreach '\ - git checkout `git config -f $toplevel/.gitmodules submodule.$name.branch` && \ - git pull ' diff --git a/.ci-local/travis-build.sh b/.ci-local/travis-build.sh deleted file mode 100755 index bf6d605d1..000000000 --- a/.ci-local/travis-build.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/sh -set -e -x - -die() { - echo "$1" >&2 - exit 1 -} - -CACHEKEY=1 - -export EPICS_HOST_ARCH=`perl src/tools/EpicsHostArch.pl` - -[ -e configure/os/CONFIG_SITE.Common.linux-x86 ] || die "Wrong location: $PWD" - -case "$CMPLR" in -clang) - echo "Host compiler is clang" - cat << EOF >> configure/os/CONFIG_SITE.Common.$EPICS_HOST_ARCH -GNU = NO -CMPLR_CLASS = clang -CC = clang -CCC = clang++ -EOF - ;; -*) echo "Host compiler is default";; -esac - -if [ "$STATIC" = "YES" ] -then - echo "Build static libraries/executables" - cat << EOF >> configure/CONFIG_SITE -SHARED_LIBRARIES=NO -STATIC_BUILD=YES -EOF -fi - -# requires wine and g++-mingw-w64-i686 -if [ "$WINE" = "32" ] -then - echo "Cross mingw32" - sed -i -e '/CMPLR_PREFIX/d' configure/os/CONFIG_SITE.linux-x86.win32-x86-mingw - cat << EOF >> configure/os/CONFIG_SITE.linux-x86.win32-x86-mingw -CMPLR_PREFIX=i686-w64-mingw32- -EOF - cat << EOF >> configure/CONFIG_SITE -CROSS_COMPILER_TARGET_ARCHS+=win32-x86-mingw -EOF -fi - -# set RTEMS to eg. "4.9" or "4.10" -if [ -n "$RTEMS" ] -then - echo "Cross RTEMS${RTEMS} for pc386" - curl -L "https://github.com/mdavidsaver/rsb/releases/download/20171203-${RTEMS}/i386-rtems${RTEMS}-trusty-20171203-${RTEMS}.tar.bz2" \ - | tar -C / -xmj - - sed -i -e '/^RTEMS_VERSION/d' -e '/^RTEMS_BASE/d' configure/os/CONFIG_SITE.Common.RTEMS - cat << EOF >> configure/os/CONFIG_SITE.Common.RTEMS -RTEMS_VERSION=$RTEMS -RTEMS_BASE=$HOME/.rtems -EOF - cat << EOF >> configure/CONFIG_SITE -CROSS_COMPILER_TARGET_ARCHS += RTEMS-pc386-qemu -EOF - - # find local qemu-system-i386 - echo -n "Using QEMU: " - type qemu-system-i386 || echo "Missing qemu" -fi - -make -j2 RTEMS_QEMU_FIXUPS=YES CMD_CFLAGS="${CMD_CFLAGS}" CMD_CXXFLAGS="${CMD_CXXFLAGS}" CMD_LDFLAGS="${CMD_LDFLAGS}" - -if [ "$TEST" != "NO" ] -then - export EPICS_TEST_IMPRECISE_TIMING=YES - make -j2 tapfiles - make -s test-results -fi diff --git a/.ci-local/travis-prepare.sh b/.ci-local/travis-prepare.sh deleted file mode 100755 index 393bd80b6..000000000 --- a/.ci-local/travis-prepare.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -set -e -x - -die() { - echo "$1" >&2 - exit 1 -} - -if [ -f /etc/hosts ] -then - # The travis-ci "bionic" image throws us a curveball in /etc/hosts - # by including two entries for localhost. The first for 127.0.1.1 - # which causes epicsSockResolveTest to fail. - # cat /etc/hosts - # ... - # 127.0.1.1 localhost localhost ip4-loopback - # 127.0.0.1 localhost nettuno travis vagrant travis-job-.... - - sudo sed -i -e '/^127\.0\.1\.1/ s|localhost\s*||g' /etc/hosts - - echo "==== /etc/hosts" - cat /etc/hosts - echo "====" -fi From 0aa6e9603bf1dcd689986577af056365d2745980 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Fri, 24 Apr 2020 19:18:01 +0200 Subject: [PATCH 164/216] Update .ci submodule to v2.3.3 - fix appveyor issue when building base - fix RTEMS cross build for Base 3.15 - run tests using parallel make --- .ci | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci b/.ci index d0f93f192..e91a58837 160000 --- a/.ci +++ b/.ci @@ -1 +1 @@ -Subproject commit d0f93f1920b5ccde78766d9f84cca292047933ec +Subproject commit e91a5883704e9fa57792953436eb7020baf37063 From e0015ef5f332ab9ce083e0e807b7a44317909142 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Sat, 25 Apr 2020 14:19:07 +0200 Subject: [PATCH 165/216] Update .ci submodule to v2.3.3 - fix appveyor issue when building base - fix RTEMS cross build for Base 3.15 - run tests using parallel make --- .ci | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci b/.ci index ecb7e4366..e91a58837 160000 --- a/.ci +++ b/.ci @@ -1 +1 @@ -Subproject commit ecb7e43660200bd5d69e4ffa2a402046cd46e36b +Subproject commit e91a5883704e9fa57792953436eb7020baf37063 From 8709fbb63fbc317b9573349c6b913280cb7d34f3 Mon Sep 17 00:00:00 2001 From: Hinko Kocevar Date: Tue, 24 Mar 2020 11:41:06 +0100 Subject: [PATCH 166/216] add missing newline --- modules/database/src/ioc/db/recGbl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/database/src/ioc/db/recGbl.c b/modules/database/src/ioc/db/recGbl.c index 5ff4730fe..50d27b15b 100644 --- a/modules/database/src/ioc/db/recGbl.c +++ b/modules/database/src/ioc/db/recGbl.c @@ -272,7 +272,7 @@ void recGblGetTimeStampSimm(void *pvoid, const epicsEnum16 simm, struct link *si if (!dbLinkIsConstant(plink)) { if (plink->flags & DBLINK_FLAG_TSELisTIME) { if (dbGetTimeStamp(plink, &prec->time)) - errlogPrintf("recGblGetTimeStamp: dbGetTimeStamp failed for %s.TSEL", + errlogPrintf("recGblGetTimeStamp: dbGetTimeStamp failed for %s.TSEL\n", prec->name); return; } From fd5edce919ba5a24469faf28d3453086a3ac4df1 Mon Sep 17 00:00:00 2001 From: Martin Konrad Date: Thu, 13 Feb 2020 16:55:01 +0000 Subject: [PATCH 167/216] Warn if deprecated state record is used --- documentation/RELEASE_NOTES.md | 6 ++++++ modules/database/src/std/rec/stateRecord.c | 16 +++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/documentation/RELEASE_NOTES.md b/documentation/RELEASE_NOTES.md index a5ddca33d..41813be23 100644 --- a/documentation/RELEASE_NOTES.md +++ b/documentation/RELEASE_NOTES.md @@ -54,6 +54,12 @@ caget is itself being run from a shell script. caRepeater will now understand the '-v' argument to retain stdin/out/err which may be necessary to see any error messages it may emit. +### `state` record deprecated + +IOCs now emit a warning when a database file containing the `state` record is +loaded. This record has been deprecated for a while and will be removed +beginning with EPICS 7.1. Consider using the `stringin` record instead. + ## EPICS Release 7.0.3.1 **IMPORTANT NOTE:** *Some record types in this release will not be compatible diff --git a/modules/database/src/std/rec/stateRecord.c b/modules/database/src/std/rec/stateRecord.c index fd5b9fba5..78eee9936 100644 --- a/modules/database/src/std/rec/stateRecord.c +++ b/modules/database/src/std/rec/stateRecord.c @@ -28,6 +28,7 @@ #include "errMdef.h" #include "recSup.h" #include "recGbl.h" +#include "errlog.h" #define GEN_SIZE_OFFSET #include "stateRecord.h" @@ -37,7 +38,7 @@ /* Create RSET - Record Support Entry Table*/ #define report NULL #define initialize NULL -#define init_record NULL +static long init_record(struct dbCommon *prec, int pass); static long process(struct dbCommon *); #define special NULL #define get_value NULL @@ -77,6 +78,19 @@ epicsExportAddress(rset,stateRSET); static void monitor(stateRecord *); +static long init_record(struct dbCommon *prec, int pass) +{ + if(pass == 0) { + errlogPrintf( + "WARNING: Using deprecated record type \"state\" for record " + "\"%s\".\nThis record type will be removed beginning with EPICS " + "7.1. Please replace it\nby a stringin record.\n", + prec->name + ); + } + return 0; +} + static long process(struct dbCommon *pcommon) { struct stateRecord *prec = (struct stateRecord *)pcommon; From 5d5e552a7ec6ef69459c97b0081aa775372a6290 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 14 Nov 2019 12:35:53 -0800 Subject: [PATCH 168/216] de-init hooks --- modules/database/src/ioc/misc/iocInit.c | 13 +++++++++++-- modules/libcom/src/iocsh/initHooks.h | 8 ++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/modules/database/src/ioc/misc/iocInit.c b/modules/database/src/ioc/misc/iocInit.c index dae83683b..4ce35ba18 100644 --- a/modules/database/src/ioc/misc/iocInit.c +++ b/modules/database/src/ioc/misc/iocInit.c @@ -710,20 +710,27 @@ int iocShutdown(void) { if (iocState == iocVoid) return 0; + initHookAnnounce(initHookAtShutdown); + iterateRecords(doCloseLinks, NULL); + initHookAnnounce(initHookAfterCloseLinks); if (iocBuildMode == buildIsolated) { /* stop and "join" threads */ scanStop(); + initHookAnnounce(initHookAfterStopScan); callbackStop(); - } - else + initHookAnnounce(initHookAfterStopCallback); + } else { dbStopServers(); + } dbCaShutdown(); /* must be before dbFreeRecord and dbChannelExit */ + initHookAnnounce(initHookAfterStopLinks); if (iocBuildMode == buildIsolated) { /* free resources */ + initHookAnnounce(initHookBeforeFree); scanCleanup(); callbackCleanup(); @@ -738,6 +745,8 @@ int iocShutdown(void) iocState = iocVoid; iocBuildMode = buildServers; + + initHookAnnounce(initHookAfterShutdown); return 0; } diff --git a/modules/libcom/src/iocsh/initHooks.h b/modules/libcom/src/iocsh/initHooks.h index 429a768db..261568e9d 100644 --- a/modules/libcom/src/iocsh/initHooks.h +++ b/modules/libcom/src/iocsh/initHooks.h @@ -47,6 +47,14 @@ typedef enum { initHookAfterDatabasePaused, initHookAfterIocPaused, /* End of iocPause command */ + initHookAtShutdown, /* Start of iocShutdown commands */ + initHookAfterCloseLinks, + initHookAfterStopScan, /* triggered only by unittest code. testIocShutdownOk() */ + initHookAfterStopCallback, /* triggered only by unittest code. testIocShutdownOk() */ + initHookAfterStopLinks, + initHookBeforeFree, /* triggered only by unittest code. testIocShutdownOk() */ + initHookAfterShutdown, /* End of iocShutdown commands */ + /* Deprecated states, provided for backwards compatibility. * These states are announced at the same point they were before, * but will not be repeated if the IOC gets paused and restarted. From 298c8706ece05c977e3db080330d155ef341735b Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 30 Apr 2020 22:59:58 -0500 Subject: [PATCH 169/216] osdMessageQueue: Rename freeEventNode() -> destroyEventNode() --- src/libCom/osi/os/default/osdMessageQueue.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libCom/osi/os/default/osdMessageQueue.cpp b/src/libCom/osi/os/default/osdMessageQueue.cpp index fc50a36b7..81d0fa015 100644 --- a/src/libCom/osi/os/default/osdMessageQueue.cpp +++ b/src/libCom/osi/os/default/osdMessageQueue.cpp @@ -106,7 +106,7 @@ epicsShareFunc epicsMessageQueueId epicsShareAPI epicsMessageQueueCreate( } static void -freeEventNode(struct eventNode *enode) +destroyEventNode(struct eventNode *enode) { epicsEventDestroy(enode->event); free(enode); @@ -119,7 +119,7 @@ epicsMessageQueueDestroy(epicsMessageQueueId pmsg) while ((evp = reinterpret_cast < struct eventNode * > ( ellGet(&pmsg->eventFreeList) ) ) != NULL) { - freeEventNode(evp); + destroyEventNode(evp); } epicsMutexDestroy(pmsg->mutex); free(pmsg->buf); From cf2fef2405aee3469fd4f9d82ccebc77bd4454e6 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 30 Apr 2020 23:27:43 -0500 Subject: [PATCH 170/216] osdMessageQueue: Return sooner on -ve timeout It appears that previously a negative timeout actually implemented a 'wait forever', but the VxWorks and RTEMS implementations both check for (timeout <= 0) and return immediately if nothing can be done without waiting. --- src/libCom/osi/os/default/osdMessageQueue.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/libCom/osi/os/default/osdMessageQueue.cpp b/src/libCom/osi/os/default/osdMessageQueue.cpp index 81d0fa015..c93be4d97 100644 --- a/src/libCom/osi/os/default/osdMessageQueue.cpp +++ b/src/libCom/osi/os/default/osdMessageQueue.cpp @@ -165,7 +165,7 @@ mySend(epicsMessageQueueId pmsg, void *message, unsigned int size, /* * Return if not allowed to wait */ - if (timeout == 0) { + if (timeout <= 0) { epicsMutexUnlock(pmsg->mutex); return -1; } @@ -186,11 +186,8 @@ mySend(epicsMessageQueueId pmsg, void *message, unsigned int size, epicsMutexUnlock(pmsg->mutex); - epicsEventStatus status; - if (timeout > 0) - status = epicsEventWaitWithTimeout(threadNode.evp->event, timeout); - else - status = epicsEventWait(threadNode.evp->event); + epicsEventStatus status = + epicsEventWaitWithTimeout(threadNode.evp->event, timeout); epicsMutexMustLock(pmsg->mutex); @@ -304,7 +301,7 @@ myReceive(epicsMessageQueueId pmsg, void *message, unsigned int size, /* * Return if not allowed to wait */ - if (timeout == 0) { + if (timeout <= 0) { epicsMutexUnlock(pmsg->mutex); return -1; } @@ -335,10 +332,11 @@ myReceive(epicsMessageQueueId pmsg, void *message, unsigned int size, ellAdd(&pmsg->receiveQueue, &threadNode.link); epicsMutexUnlock(pmsg->mutex); - if (timeout > 0) + /* + * Wait for a message to arrive + */ + epicsEventStatus status = epicsEventWaitWithTimeout(threadNode.evp->event, timeout); - else - epicsEventWait(threadNode.evp->event); epicsMutexMustLock(pmsg->mutex); From 183c3b2a3e1fa2a55cd918b94ef4d7c486e11bf4 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 30 Apr 2020 23:38:51 -0500 Subject: [PATCH 171/216] osdMessageQueue: Clear eventNode before returning it Introduced freeEventNode() which ensures eventNodes don't have a signalled event in them before returning the node to the freeList. Callers pass the status from epicsEventWaitWithTimeout() to indicate whether it was signalled or not. If it timed out we must trigger it and Wait to clear the event state. --- src/libCom/osi/os/default/osdMessageQueue.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/libCom/osi/os/default/osdMessageQueue.cpp b/src/libCom/osi/os/default/osdMessageQueue.cpp index c93be4d97..0e1d1fc22 100644 --- a/src/libCom/osi/os/default/osdMessageQueue.cpp +++ b/src/libCom/osi/os/default/osdMessageQueue.cpp @@ -145,6 +145,16 @@ getEventNode(epicsMessageQueueId pmsg) return evp; } +static void +freeEventNode(epicsMessageQueueId pmsg, eventNode *evp, epicsEventStatus status) +{ + if (status == epicsEventWaitTimeout) { + epicsEventSignal(evp->event); + epicsEventWait(evp->event); + } + ellAdd(&pmsg->eventFreeList, &evp->link); +} + static int mySend(epicsMessageQueueId pmsg, void *message, unsigned int size, double timeout) @@ -195,7 +205,7 @@ mySend(epicsMessageQueueId pmsg, void *message, unsigned int size, ellDelete(&pmsg->sendQueue, &threadNode.link); pmsg->numberOfSendersWaiting--; - ellAdd(&pmsg->eventFreeList, &threadNode.evp->link); + freeEventNode(pmsg, threadNode.evp, status); if ((pmsg->full && (ellFirst(&pmsg->receiveQueue) == NULL)) || status != epicsEventOK) { @@ -342,7 +352,8 @@ myReceive(epicsMessageQueueId pmsg, void *message, unsigned int size, if (!threadNode.eventSent) ellDelete(&pmsg->receiveQueue, &threadNode.link); - ellAdd(&pmsg->eventFreeList, &threadNode.evp->link); + + freeEventNode(pmsg, threadNode.evp, status); epicsMutexUnlock(pmsg->mutex); From aeed7cfbddc979c5bc668d668052ef96cb5d84c5 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 30 Apr 2020 23:55:30 -0500 Subject: [PATCH 172/216] osdMessageQueue: This is the mirror of Heinz Junkes' earlier fix When sending a message, if the queue is full so we have to wait, we create a threadNode with an eventNode in it and stick it on the sendQueue, then wait for a receiver to signal that event, waking us. If we awoke due to a timeout but a receiver was actually waking us up anyway (i.e. eventSent was set), we shouldn't give up. --- src/libCom/osi/os/default/osdMessageQueue.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libCom/osi/os/default/osdMessageQueue.cpp b/src/libCom/osi/os/default/osdMessageQueue.cpp index 0e1d1fc22..cdb3afba9 100644 --- a/src/libCom/osi/os/default/osdMessageQueue.cpp +++ b/src/libCom/osi/os/default/osdMessageQueue.cpp @@ -207,8 +207,7 @@ mySend(epicsMessageQueueId pmsg, void *message, unsigned int size, freeEventNode(pmsg, threadNode.evp, status); - if ((pmsg->full && (ellFirst(&pmsg->receiveQueue) == NULL)) || - status != epicsEventOK) { + if (pmsg->full && (ellFirst(&pmsg->receiveQueue) == NULL)) { epicsMutexUnlock(pmsg->mutex); return -1; } From 084557bd3e6de8795f65b0f6cff7914fa4ec930b Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 1 May 2020 00:12:32 -0500 Subject: [PATCH 173/216] osdMessageQueue: Don't wake our sender until we're ready for it Move the code that wakes up the next sending task to after we've added our threadNode to the receiveQueue. He still has to wait for us to release the Mutex though, so this might make no difference. This commit also changes when we decrement the number of waiting senders so it always happens immediately after a threadNode gets taken off the sendQueue by the code that removed it. --- src/libCom/osi/os/default/osdMessageQueue.cpp | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/libCom/osi/os/default/osdMessageQueue.cpp b/src/libCom/osi/os/default/osdMessageQueue.cpp index cdb3afba9..38e4f764d 100644 --- a/src/libCom/osi/os/default/osdMessageQueue.cpp +++ b/src/libCom/osi/os/default/osdMessageQueue.cpp @@ -201,9 +201,10 @@ mySend(epicsMessageQueueId pmsg, void *message, unsigned int size, epicsMutexMustLock(pmsg->mutex); - if(!threadNode.eventSent) + if (!threadNode.eventSent) { ellDelete(&pmsg->sendQueue, &threadNode.link); - pmsg->numberOfSendersWaiting--; + pmsg->numberOfSendersWaiting--; + } freeEventNode(pmsg, threadNode.evp, status); @@ -300,6 +301,7 @@ myReceive(epicsMessageQueueId pmsg, void *message, unsigned int size, */ if ((pthr = reinterpret_cast < struct threadNode * > ( ellGet(&pmsg->sendQueue) ) ) != NULL) { + pmsg->numberOfSendersWaiting--; pthr->eventSent = true; epicsEventSignal(pthr->evp->event); } @@ -316,16 +318,7 @@ myReceive(epicsMessageQueueId pmsg, void *message, unsigned int size, } /* - * Wake up the oldest task waiting to send - */ - if ((pthr = reinterpret_cast < struct threadNode * > - ( ellGet(&pmsg->sendQueue) ) ) != NULL) { - pthr->eventSent = true; - epicsEventSignal(pthr->evp->event); - } - - /* - * Wait for message to arrive + * Indicate that we're waiting */ struct threadNode threadNode; threadNode.evp = getEventNode(pmsg); @@ -339,6 +332,17 @@ myReceive(epicsMessageQueueId pmsg, void *message, unsigned int size, } ellAdd(&pmsg->receiveQueue, &threadNode.link); + + /* + * Wake up the oldest task waiting to send + */ + if ((pthr = reinterpret_cast < struct threadNode * > + ( ellGet(&pmsg->sendQueue) ) ) != NULL) { + pmsg->numberOfSendersWaiting--; + pthr->eventSent = true; + epicsEventSignal(pthr->evp->event); + } + epicsMutexUnlock(pmsg->mutex); /* From ceb13797a600da82bd73d52dded14fd6ee35d423 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 1 May 2020 00:13:02 -0500 Subject: [PATCH 174/216] Cosmetic --- src/libCom/osi/os/default/osdMessageQueue.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libCom/osi/os/default/osdMessageQueue.cpp b/src/libCom/osi/os/default/osdMessageQueue.cpp index 38e4f764d..3f95c4f40 100644 --- a/src/libCom/osi/os/default/osdMessageQueue.cpp +++ b/src/libCom/osi/os/default/osdMessageQueue.cpp @@ -408,7 +408,8 @@ epicsMessageQueuePending(epicsMessageQueueId pmsg) epicsShareFunc void epicsShareAPI epicsMessageQueueShow(epicsMessageQueueId pmsg, int level) { - printf("Message Queue Used:%d Slots:%lu", epicsMessageQueuePending(pmsg), pmsg->capacity); + printf("Message Queue Used:%d Slots:%lu", + epicsMessageQueuePending(pmsg), pmsg->capacity); if (level >= 1) printf(" Maximum size:%lu", pmsg->maxMessageSize); printf("\n"); From 34e0b2f305ecef38f699d150086a76ee962a52cb Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 4 May 2020 11:56:14 -0500 Subject: [PATCH 175/216] osdMessageQueue: Undo change to -ve timeout handling The internal mySend() and myReceive() routines do expect a timeout of -1 to mean wait forever, see the epicsMessageQueueSend() and epicsMessageQueueReceive() API routines. --- src/libCom/osi/os/default/osdMessageQueue.cpp | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/libCom/osi/os/default/osdMessageQueue.cpp b/src/libCom/osi/os/default/osdMessageQueue.cpp index 3f95c4f40..d99e23b70 100644 --- a/src/libCom/osi/os/default/osdMessageQueue.cpp +++ b/src/libCom/osi/os/default/osdMessageQueue.cpp @@ -173,15 +173,15 @@ mySend(epicsMessageQueueId pmsg, void *message, unsigned int size, if ((pmsg->numberOfSendersWaiting > 0) || (pmsg->full && (ellFirst(&pmsg->receiveQueue) == NULL))) { /* - * Return if not allowed to wait + * Return if not allowed to wait. NB -1 means wait forever. */ - if (timeout <= 0) { + if (timeout == 0) { epicsMutexUnlock(pmsg->mutex); return -1; } /* - * Wait + * Indicate that we're waiting */ struct threadNode threadNode; threadNode.evp = getEventNode(pmsg); @@ -196,12 +196,17 @@ mySend(epicsMessageQueueId pmsg, void *message, unsigned int size, epicsMutexUnlock(pmsg->mutex); - epicsEventStatus status = + /* + * Wait for receiver to wake us + */ + epicsEventStatus status = timeout < 0 ? + epicsEventWait(threadNode.evp->event) : epicsEventWaitWithTimeout(threadNode.evp->event, timeout); epicsMutexMustLock(pmsg->mutex); if (!threadNode.eventSent) { + /* Receiver didn't take us off the sendQueue, do it ourselves */ ellDelete(&pmsg->sendQueue, &threadNode.link); pmsg->numberOfSendersWaiting--; } @@ -209,6 +214,7 @@ mySend(epicsMessageQueueId pmsg, void *message, unsigned int size, freeEventNode(pmsg, threadNode.evp, status); if (pmsg->full && (ellFirst(&pmsg->receiveQueue) == NULL)) { + /* State of the queue didn't change, exit */ epicsMutexUnlock(pmsg->mutex); return -1; } @@ -310,9 +316,9 @@ myReceive(epicsMessageQueueId pmsg, void *message, unsigned int size, } /* - * Return if not allowed to wait + * Return if not allowed to wait. NB -1 means wait forever. */ - if (timeout <= 0) { + if (timeout == 0) { epicsMutexUnlock(pmsg->mutex); return -1; } @@ -348,7 +354,8 @@ myReceive(epicsMessageQueueId pmsg, void *message, unsigned int size, /* * Wait for a message to arrive */ - epicsEventStatus status = + epicsEventStatus status = timeout < 0 ? + epicsEventWait(threadNode.evp->event) : epicsEventWaitWithTimeout(threadNode.evp->event, timeout); epicsMutexMustLock(pmsg->mutex); From 089954aaab0ef6c43da77305bc28b807f1686930 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 7 May 2020 13:12:12 -0500 Subject: [PATCH 176/216] MessageQueue Tests: Extend Mark's sleep tests --- src/libCom/test/epicsMessageQueueTest.cpp | 133 ++++++++++++++++------ 1 file changed, 101 insertions(+), 32 deletions(-) diff --git a/src/libCom/test/epicsMessageQueueTest.cpp b/src/libCom/test/epicsMessageQueueTest.cpp index 1bee13c36..b793ce2cd 100644 --- a/src/libCom/test/epicsMessageQueueTest.cpp +++ b/src/libCom/test/epicsMessageQueueTest.cpp @@ -27,7 +27,10 @@ static volatile int sendExit = 0; static volatile int recvExit = 0; static epicsEventId finished; static unsigned int mediumStack; -static int numReceived; + +#define SLEEPY_TESTS 500 +static int numSent, numReceived; +static epicsEventId complete; /* * In Numerical Recipes in C: The Art of Scientific Computing (William H. @@ -124,11 +127,95 @@ fastReceiver(void *arg) int len; numReceived = 0; while (!recvExit) { - len = q->receive(cbuf, sizeof cbuf, 0.01); + len = q->receive(cbuf, sizeof cbuf, 0.010); if (len > 0) { numReceived++; } } + recvExit = 0; + epicsEventSignal(complete); +} + +void sleepySender(epicsMessageQueue *q, double delay) +{ + testDiag("sleepySender: sending every %.3f seconds", delay); + epicsThreadCreate("Fast Receiver", epicsThreadPriorityMedium, + mediumStack, fastReceiver, q); + + numSent = 0; + numReceived = 0; + for (int i = 0 ; i < SLEEPY_TESTS ; i++) { + if (q->send((void *)msg1, 4) == 0) { + numSent++; + } + epicsThreadSleep(delay); + } + epicsThreadSleep(1.0); + testOk(numSent == SLEEPY_TESTS, "Sent %d (should be %d)", + numSent, SLEEPY_TESTS); + testOk(numReceived == SLEEPY_TESTS, "Received %d (should be %d)", + numReceived, SLEEPY_TESTS); + + recvExit = 1; + while (q->send((void *)msg1, 4) != 0) + epicsThreadSleep(0.01); + epicsEventMustWait(complete); +} + +extern "C" void +fastSender(void *arg) +{ + epicsMessageQueue *q = (epicsMessageQueue *)arg; + numSent = 0; + + // Send first withough timeout + q->send((void *)msg1, 4); + numSent++; + + // The rest have a timeout + while (!sendExit) { + if (q->send((void *)msg1, 4, 0.010) == 0) { + numSent++; + } + } + sendExit = 0; + epicsEventSignal(complete); +} + +void sleepyReceiver(epicsMessageQueue *q, double delay) +{ + testDiag("sleepyReceiver: acquiring every %.3f seconds", delay); + + // Fill the queue + for (int i = q->pending(); i < 4 ;i++) { + q->send((void *)msg1, 4); + } + + epicsThreadCreate("Fast Sender", epicsThreadPriorityMedium, + mediumStack, fastSender, q); + epicsThreadSleep(0.5); + + char cbuf[80]; + int len; + numReceived = 0; + + for (int i = 0 ; i < SLEEPY_TESTS ; i++) { + len = q->receive(cbuf, sizeof cbuf); + if (len > 0) { + numReceived++; + } + epicsThreadSleep(delay); + } + + testOk(numSent == SLEEPY_TESTS, "Sent %d (should be %d)", + numSent, SLEEPY_TESTS); + testOk(numReceived == SLEEPY_TESTS, "Received %d (should be %d)", + numReceived, SLEEPY_TESTS); + + sendExit = 1; + while (q->receive(cbuf, sizeof cbuf) <= 0) + epicsThreadSleep(0.01); + epicsEventMustWait(complete); } extern "C" void @@ -156,7 +243,6 @@ extern "C" void messageQueueTest(void *parm) int len; int pass; int want; - int numSent = 0; epicsMessageQueue *q1 = new epicsMessageQueue(4, 20); epicsMessageQueue *q2 = new epicsMessageQueue(4, 20); @@ -269,34 +355,17 @@ extern "C" void messageQueueTest(void *parm) testOk(q1->send((void *)msg1, 10) == 0, "Send with no receiver"); epicsThreadSleep(2.0); - testDiag("Single receiver with timeout, single sender with sleep tests:"); - testDiag("These tests last 20 seconds ..."); - epicsThreadCreate("Fast Receiver", epicsThreadPriorityMedium, - mediumStack, fastReceiver, q2); - numSent = 0; - numReceived = 0; - for (i = 0 ; i < 1000 ; i++) { - if (q2->send((void *)msg1, 4) == 0) { - numSent++; - } - epicsThreadSleep(0.011); - } - epicsThreadSleep(1.0); - if (!testOk(numSent == 1000 && numReceived == 1000, "sleep=0.011")) { - testDiag("numSent should be 1000, actual=%d, numReceived should be 1000, actual=%d", numSent, numReceived); - } - numSent = 0; - numReceived = 0; - for (i = 0 ; i < 1000 ; i++) { - if (q2->send((void *)msg1, 4) == 0) { - numSent++; - } - epicsThreadSleep(0.010); - } - epicsThreadSleep(1.0); - if (!testOk(numSent == 1000 && numReceived == 1000, "sleep=0.010")) { - testDiag("numSent should be 1000, actual=%d, numReceived should be 1000, actual=%d", numSent, numReceived); - } + testDiag("6 Single receiver single sender 'Sleepy timeout' tests,"); + testDiag(" these should take about %.2f seconds each:", + SLEEPY_TESTS * 0.010); + + complete = epicsEventMustCreate(epicsEventEmpty); + sleepySender(q2, 0.009); + sleepySender(q2, 0.010); + sleepySender(q2, 0.011); + sleepyReceiver(q2, 0.009); + sleepyReceiver(q2, 0.010); + sleepyReceiver(q2, 0.011); testDiag("Single receiver, single sender tests:"); epicsThreadSetPriority(myThreadId, epicsThreadPriorityHigh); @@ -359,7 +428,7 @@ extern "C" void messageQueueTest(void *parm) MAIN(epicsMessageQueueTest) { - testPlan(64); + testPlan(74); finished = epicsEventMustCreate(epicsEventEmpty); mediumStack = epicsThreadGetStackSize(epicsThreadStackMedium); From 2e7ed02a606bbebe3cf961670a8b782fd6915705 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 7 May 2020 13:13:26 -0500 Subject: [PATCH 177/216] Allow/expect MinGW to fail epicsStackTraceTest #5 --- src/libCom/test/epicsStackTraceTest.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/libCom/test/epicsStackTraceTest.c b/src/libCom/test/epicsStackTraceTest.c index 69cb499f2..246abe4d8 100644 --- a/src/libCom/test/epicsStackTraceTest.c +++ b/src/libCom/test/epicsStackTraceTest.c @@ -1,11 +1,11 @@ -/* +/* * Copyright: Stanford University / SLAC National Laboratory. * * EPICS BASE is distributed subject to a Software License Agreement found - * in file LICENSE that is included with this distribution. + * in file LICENSE that is included with this distribution. * * Author: Till Straumann , 2014 - */ + */ /* * Check stack trace functionality @@ -135,14 +135,14 @@ findNumOcc(const char *buf) } /* We should find an address close to epicsStackTraceRecurseGbl twice */ for (i=0; i= (char*)epicsStackTraceRecurseGbl && (char*)ptrs[i] < (char*)epicsStackTraceRecurseGbl + WINDOW_SZ ) { - rval ++; + rval ++; if ( test_debug ) testDiag("found address %p again\n", ptrs[i]); } @@ -167,7 +167,7 @@ MAIN(epicsStackTraceTest) testPlan(5); - features = epicsStackTraceGetFeatures(); + features = epicsStackTraceGetFeatures(); all_features = EPICS_STACKTRACE_LCL_SYMBOLS | EPICS_STACKTRACE_GBL_SYMBOLS @@ -217,7 +217,13 @@ MAIN(epicsStackTraceTest) } if ( (features & EPICS_STACKTRACE_ADDRESSES) ) { +#ifdef _MINGW + testTodoBegin("MinGW, might fail"); +#endif testOk( numFound > 0, "dumping addresses" ); +#ifdef _MINGW + testTodoEnd(); +#endif } else { testSkip(1 , "no support for dumping addresses on this platform"); } From a09b1c856925209a4bed8c6b6f38a2b149542be1 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 13 May 2020 00:34:33 -0500 Subject: [PATCH 178/216] Applied all doxy-libcom changes to latest headers --- modules/libcom/src/as/asTrapWrite.h | 79 +++- modules/libcom/src/bucketLib/bucketLib.h | 155 +++++-- modules/libcom/src/calc/postfix.h | 340 +++++++++++++-- modules/libcom/src/cppStd/epicsAlgorithm.h | 76 +++- modules/libcom/src/dbmf/dbmf.h | 96 ++++- modules/libcom/src/ellLib/ellLib.h | 168 +++++++- modules/libcom/src/env/envDefs.h | 201 +++++++-- modules/libcom/src/macLib/macLib.h | 358 +++++++++++----- modules/libcom/src/misc/adjustment.h | 14 +- modules/libcom/src/misc/alarm.h | 106 +++-- modules/libcom/src/misc/alarmString.h | 19 +- modules/libcom/src/misc/cantProceed.h | 54 ++- modules/libcom/src/misc/dbDefs.h | 41 +- modules/libcom/src/misc/epicsExit.h | 62 ++- modules/libcom/src/misc/epicsExport.h | 123 +++++- modules/libcom/src/misc/epicsUnitTest.h | 244 ++++++++++- modules/libcom/src/misc/shareLib.h | 124 +++--- modules/libcom/src/osi/compilerDependencies.h | 9 +- modules/libcom/src/osi/devLib.h | 128 +++--- modules/libcom/src/osi/devLibVME.h | 380 +++++++++++------ modules/libcom/src/osi/devLibVMEImpl.h | 92 ++-- modules/libcom/src/osi/epicsAssert.h | 46 +- modules/libcom/src/osi/epicsEvent.h | 150 ++++++- modules/libcom/src/osi/epicsGeneralTime.h | 119 +++++- modules/libcom/src/osi/epicsMessageQueue.h | 233 ++++++++++- modules/libcom/src/osi/epicsMutex.h | 170 +++++++- modules/libcom/src/osi/epicsReadline.h | 26 +- modules/libcom/src/osi/epicsSignal.h | 13 +- modules/libcom/src/osi/epicsTempFile.h | 11 +- modules/libcom/src/osi/epicsThread.h | 120 +++++- modules/libcom/src/osi/epicsTime.h | 394 ++++++++++++++---- .../libcom/src/osi/os/default/epicsMMIODef.h | 12 +- modules/libcom/src/osi/osiPoolStatus.h | 28 +- modules/libcom/src/ring/epicsRingBytes.h | 102 ++++- modules/libcom/src/ring/epicsRingPointer.h | 155 ++++++- modules/libcom/src/yajl/yajl_alloc.h | 8 +- modules/libcom/src/yajl/yajl_common.h | 35 +- modules/libcom/src/yajl/yajl_gen.h | 67 +-- modules/libcom/src/yajl/yajl_parse.h | 67 +-- 39 files changed, 3709 insertions(+), 916 deletions(-) diff --git a/modules/libcom/src/as/asTrapWrite.h b/modules/libcom/src/as/asTrapWrite.h index b8033cb94..7bce659cb 100644 --- a/modules/libcom/src/as/asTrapWrite.h +++ b/modules/libcom/src/as/asTrapWrite.h @@ -6,8 +6,15 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/*asTrapWrite.h*/ -/* Author: Marty Kraimer Date: 07NOV2000 */ + +/** + * @file asTrapWrite.h + * @brief API for monitoring external put operations to an IOC. + * @author Marty Kraimer + * + * The access security subsystem provides an API asTrapWrite that makes + * put/write requests visible to any facility that registers a listener. + */ #ifndef INCasTrapWriteh #define INCasTrapWriteh @@ -18,37 +25,65 @@ extern "C" { #endif +/** + * @brief The message passed to registered listeners. + */ typedef struct asTrapWriteMessage { - const char *userid; - const char *hostid; - void *serverSpecific; - void *userPvt; - int dbrType; /* Data type from ca/db_access.h, NOT dbFldTypes.h */ - int no_elements; - void *data; /* Might be NULL if no data is available */ + const char *userid; /**< @brief Userid of whoever orginated the request. */ + const char *hostid; /**< @brief Hostid of whoever orginated the request. */ + void *serverSpecific; /**< @brief A field for use by the server. + * + * Any listener that uses this field must know what type of + * server is forwarding the put requests. This pointer holds + * the value the server provides to asTrapWriteWithData(), which + * for RSRV is the dbChannel pointer for the target field. + */ + void *userPvt; /**< @brief A field for use by the @ref asTrapWriteListener. + * + * When the listener is called before the write, this has the + * value 0. The listener can give it any value it desires + * and it will have the same value when the listener gets + * called again after the write. */ + int dbrType; /**< @brief Data type from ca/db_access.h, NOT dbFldTypes.h */ + int no_elements; /**< @brief Array length */ + void *data; /**< @brief Might be NULL if no data is available */ } asTrapWriteMessage; - +/** + * @brief An identifier needed to unregister an listener. + */ typedef void *asTrapWriteId; + +/** + * @brief Pointer to a listener function. + * + * Each registered listener function is called twice for every put; once + * before and once after the write is performed. + * The listener may set @c userPvt in the first call and retrieve it in the + * second call. + * + * Each asTrapWriteMessage can change or may be deleted after the user's + * asTrapWriteListener returns + * + * The listener function is called by a server thread so it must not block + * or do anything that causes a delay. +*/ typedef void(*asTrapWriteListener)(asTrapWriteMessage *pmessage,int after); +/** + * @brief Register function to be called on asTrapWriteListener. + * @param func The listener function to be called. + * @return A listener identifier for unregistering this listener. + */ epicsShareFunc asTrapWriteId epicsShareAPI asTrapWriteRegisterListener( asTrapWriteListener func); +/** + * @brief Unregister asTrapWriteListener. + * @param id Listener identifier from asTrapWriteRegisterListener(). + */ epicsShareFunc void epicsShareAPI asTrapWriteUnregisterListener( asTrapWriteId id); -/* - * asTrapWriteListener is called before and after the write is performed. - * The listener can set userPvt on the before call and retrieve it after - * after = (0,1) (before,after) the put. - * - * Each asTrapWriteMessage can change or may be deleted after - * the user's asTrapWriteListener returns - * - * asTrapWriteListener delays the associated server thread so it must not - * do anything that causes to to block. -*/ - #ifdef __cplusplus } #endif diff --git a/modules/libcom/src/bucketLib/bucketLib.h b/modules/libcom/src/bucketLib/bucketLib.h index 60d73b459..a461cfd8a 100644 --- a/modules/libcom/src/bucketLib/bucketLib.h +++ b/modules/libcom/src/bucketLib/bucketLib.h @@ -4,16 +4,19 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* - * Author: Jeffrey O. Hill - * hill@luke.lanl.gov - * (505) 665 1831 - * Date: 9-93 +/** + * @file bucketLib.h + * @author Jeffrey O. Hill + * @brief A hash table. Do not use for new code. * - * NOTES: - * .01 Storage for identifier must persist until an item is deleted + * @details + * A hash table for which keys may be unsigned integers, pointers, or + * strings. This API is used by the IOC's Channel Access Server, but + * it should not be used by other code. + * + * @note Storage for identifiers must persist until an item is deleted */ #ifndef INCbucketLibh @@ -27,10 +30,13 @@ extern "C" { #include "epicsTypes.h" #include "shareLib.h" +/** @brief Internal: bucket identifier */ typedef unsigned BUCKETID; +/** @brief Internal: bucket key type */ typedef enum {bidtUnsigned, bidtPointer, bidtString} buckTypeOfId; +/** @brief Internal: bucket item structure */ typedef struct item{ struct item *pItem; const void *pId; @@ -38,6 +44,7 @@ typedef struct item{ buckTypeOfId type; }ITEM; +/** @brief Internal: Hash table structure */ typedef struct bucket{ ITEM **pTable; void *freeListPVT; @@ -45,47 +52,147 @@ typedef struct bucket{ unsigned hashIdNBits; unsigned nInUse; }BUCKET; - -epicsShareFunc BUCKET * epicsShareAPI bucketCreate (unsigned nHashTableEntries); -epicsShareFunc int epicsShareAPI bucketFree (BUCKET *prb); -epicsShareFunc int epicsShareAPI bucketShow (BUCKET *pb); - -/* - * !! Identifier must exist (and remain constant) at the specified address until - * the item is deleted from the bucket !! +/** + * @brief Creates a new hash table + * @param nHashTableEntries Table size + * @return Pointer to the newly created hash table, or NULL. */ -epicsShareFunc int epicsShareAPI bucketAddItemUnsignedId (BUCKET *prb, +epicsShareFunc BUCKET * epicsShareAPI bucketCreate (unsigned nHashTableEntries); +/** + * @brief Release memory used by a hash table + * @param *prb Pointer to the hash table + * @return S_bucket_success + * @note All items must be deleted from the hash table before calling this. + */ +epicsShareFunc int epicsShareAPI bucketFree (BUCKET *prb); +/** + * @brief Display information about a hash table + * @param *prb Pointer to the hash table + * @return S_bucket_success + */ +epicsShareFunc int epicsShareAPI bucketShow (BUCKET *prb); + +/** + * @brief Add an item identified by an unsigned int to the table + * @param *prb Pointer to the hash table + * @param *pId Pointer to the identifier + * @param *pApp Pointer to the payload + * @return Status value + */ +epicsShareFunc int epicsShareAPI bucketAddItemUnsignedId (BUCKET *prb, const unsigned *pId, const void *pApp); -epicsShareFunc int epicsShareAPI bucketAddItemPointerId (BUCKET *prb, +/** + * @brief Add an item identified by a pointer to the table + * @param *prb Pointer to the hash table + * @param *pId Pointer to the identifier + * @param *pApp Pointer to the payload + * @return Status value + */ +epicsShareFunc int epicsShareAPI bucketAddItemPointerId (BUCKET *prb, void * const *pId, const void *pApp); -epicsShareFunc int epicsShareAPI bucketAddItemStringId (BUCKET *prb, +/** + * @brief Add an item identified by a string to the table + * @param *prb Pointer to the hash table + * @param *pId Pointer to the identifier + * @param *pApp Pointer to the payload + * @return Status value + */ +epicsShareFunc int epicsShareAPI bucketAddItemStringId (BUCKET *prb, const char *pId, const void *pApp); - +/** + * @brief Remove an item identified by a string from the table + * @param *prb Pointer to the hash table + * @param *pId Pointer to the identifier + * @return Status value + */ epicsShareFunc int epicsShareAPI bucketRemoveItemUnsignedId (BUCKET *prb, const unsigned *pId); +/** + * @brief Remove an item identified by a pointer from the table + * @param *prb Pointer to the hash table + * @param *pId Pointer to the identifier + * @return Status value + */ epicsShareFunc int epicsShareAPI bucketRemoveItemPointerId (BUCKET *prb, void * const *pId); +/** + * @brief Remove an item identified by a string from the table + * @param *prb Pointer to the hash table + * @param *pId Pointer to the identifier + * @return Status value + */ epicsShareFunc int epicsShareAPI bucketRemoveItemStringId (BUCKET *prb, const char *pId); - +/** + * @brief Find an item identified by an unsigned int in the table + * @param *prb Pointer to the hash table + * @param *pId Pointer to the identifier + * @return Item's payload pointer, or NULL if not found + */ epicsShareFunc void * epicsShareAPI bucketLookupItemUnsignedId (BUCKET *prb, const unsigned *pId); +/** + * @brief Find an item identified by a pointer in the table + * @param *prb Pointer to the hash table + * @param *pId Pointer to the identifier + * @return Item's payload pointer, or NULL if not found + */ epicsShareFunc void * epicsShareAPI bucketLookupItemPointerId (BUCKET *prb, void * const *pId); +/** + * @brief Find an item identified by a string in the table + * @param *prb Pointer to the hash table + * @param *pId Pointer to the identifier + * @return Item's payload pointer, or NULL if not found + */ epicsShareFunc void * epicsShareAPI bucketLookupItemStringId (BUCKET *prb, const char *pId); +/** + * @brief Find and delete an item identified by an unsigned int from the table + * @param *prb Pointer to the hash table + * @param *pId Pointer to the identifier + * @return Item's payload pointer, or NULL if not found + */ epicsShareFunc void * epicsShareAPI bucketLookupAndRemoveItemUnsignedId (BUCKET *prb, const unsigned *pId); +/** + * @brief Find and delete an item identified by a pointer from the table + * @param *prb Pointer to the hash table + * @param *pId Pointer to the identifier + * @return Item's payload pointer, or NULL if not found + */ epicsShareFunc void * epicsShareAPI bucketLookupAndRemoveItemPointerId (BUCKET *prb, void * const *pId); +/** + * @brief Find and delete an item identified by a string from the table + * @param *prb Pointer to the hash table + * @param *pId Pointer to the identifier + * @return Item's payload pointer, or NULL if not found + */ epicsShareFunc void * epicsShareAPI bucketLookupAndRemoveItemStringId (BUCKET *prb, const char *pId); -/* - * Status returned by bucketLib functions + /** + * @name Status values returned by some bucketLib functions + * @{ + */ +/** + * @brief A synonym for S_bucket_success */ #define BUCKET_SUCCESS S_bucket_success +/** + * @brief Success, must be 0. + */ #define S_bucket_success 0 +/** + * @brief Memory allocation failed + */ #define S_bucket_noMemory (M_bucket | 1) /*Memory allocation failed*/ +/** + * @brief Identifier already in use + */ #define S_bucket_idInUse (M_bucket | 2) /*Identifier already in use*/ +/** + * @brief Unknown identifier + */ #define S_bucket_uknId (M_bucket | 3) /*Unknown identifier*/ +/** @} */ #ifdef __cplusplus } #endif #endif /*INCbucketLibh*/ - diff --git a/modules/libcom/src/calc/postfix.h b/modules/libcom/src/calc/postfix.h index b90492012..d811300ed 100644 --- a/modules/libcom/src/calc/postfix.h +++ b/modules/libcom/src/calc/postfix.h @@ -4,11 +4,16 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* postfix.h - * Original Author: Bob Dalesio - * Date: 9-21-88 +/** + * @file postfix.h + * @author Bob Dalesio, Andrew Johnson + * + * @brief The API for the EPICS Calculation Engine + * + * Defines macros and the routines provided by the calculation engine for + * subsystems that need to evaluate mathematical expressions. */ #ifndef INCpostfixh @@ -16,69 +21,340 @@ #include "shareLib.h" +/** @brief Number of input arguments to a calc expression (A-L) */ #define CALCPERFORM_NARGS 12 +/** @brief Size of the internal partial result stack */ #define CALCPERFORM_STACK 80 -#define INFIX_TO_POSTFIX_SIZE(n) ((n)*21/6) -/* The above expression is an estimate of the maximum postfix buffer - * size needed for a given infix expression buffer (the argument must count - * the trailing nil byte in the input expression string). The actual size +/** + * @name Postfix and Infix Buffer Sizes + * @{ + */ +/** + * @brief Calculate required size of postfix buffer from infix + * + * This macro calculates the maximum size of postfix buffer needed for an + * infix expression buffer of a given size. The argument @c n must count + * the trailing nil byte in the input expression string. The actual size * needed is never larger than this value, although it is actually a * few bytes smaller for some sizes. * * The maximum expansion from infix to postfix is for the sub-expression - * .1?.1: + @code + .1?.1: +@endcode * which is 6 characters long and results in 21 bytes of postfix: - * .1 => LITERAL_DOUBLE + 8 byte value - * ? => COND_IF - * .1 => LITERAL_DOUBLE + 8 byte value - * : => COND_ELSE - * ... - * => COND_END +@code + .1 => LITERAL_DOUBLE + 8 byte value + ? => COND_IF + .1 => LITERAL_DOUBLE + 8 byte value + : => COND_ELSE + ... + => COND_END +@endcode * For other short expressions the factor 21/6 always gives a big enough * postfix buffer (proven by hand, look at '1+' and '.1+' as well). */ +#define INFIX_TO_POSTFIX_SIZE(n) ((n)*21/6) -/* These are not hard limits, just default sizes for the database */ +/** + * @brief Size of a "standard" infix string. + * + * This is not a hard limit, just the default size for the database + */ #define MAX_INFIX_SIZE 100 +/** + * @brief Size of a "standard" postfix buffer. + * + * This is not a hard limit, just the default size for the database + */ #define MAX_POSTFIX_SIZE INFIX_TO_POSTFIX_SIZE(MAX_INFIX_SIZE) +/** @} */ -/* Error numbers from postfix */ +/** @name Calc Engine Error Codes +* @note Changes in these errors must also be made in calcErrorStr(). + * @{ + */ -#define CALC_ERR_NONE 0 /* No error */ -#define CALC_ERR_TOOMANY 1 /* Too many results returned */ -#define CALC_ERR_BAD_LITERAL 2 /* Bad numeric literal */ -#define CALC_ERR_BAD_ASSIGNMENT 3 /* Bad assignment target */ -#define CALC_ERR_BAD_SEPERATOR 4 /* Comma without parentheses */ -#define CALC_ERR_PAREN_NOT_OPEN 5 /* Close parenthesis without open */ -#define CALC_ERR_PAREN_OPEN 6 /* Open parenthesis at end of expression */ -#define CALC_ERR_CONDITIONAL 7 /* Unbalanced conditional ?: operators */ -#define CALC_ERR_INCOMPLETE 8 /* Incomplete expression, operand missing */ -#define CALC_ERR_UNDERFLOW 9 /* Runtime stack would underflow */ -#define CALC_ERR_OVERFLOW 10 /* Runtime stack would overflow */ -#define CALC_ERR_SYNTAX 11 /* Syntax error */ -#define CALC_ERR_NULL_ARG 12 /* NULL or empty input argument */ -#define CALC_ERR_INTERNAL 13 /* Internal error, bad element type */ -/* Changes in the above errors must also be made in calcErrorStr() */ +/** @brief No error */ +#define CALC_ERR_NONE 0 +/** @brief Too many results returned */ +#define CALC_ERR_TOOMANY 1 +/** @brief Bad numeric literal */ +#define CALC_ERR_BAD_LITERAL 2 +/** @brief Bad assignment target */ +#define CALC_ERR_BAD_ASSIGNMENT 3 +/** @brief Comma without parentheses */ +#define CALC_ERR_BAD_SEPERATOR 4 +/** @brief Close parenthesis without open */ +#define CALC_ERR_PAREN_NOT_OPEN 5 +/** @brief Open parenthesis at end of expression */ +#define CALC_ERR_PAREN_OPEN 6 +/** @brief Unbalanced conditional ?: operators */ +#define CALC_ERR_CONDITIONAL 7 +/** @brief Incomplete expression, operand missing */ +#define CALC_ERR_INCOMPLETE 8 +/** @brief Runtime stack would underflow */ +#define CALC_ERR_UNDERFLOW 9 +/** @brief Runtime stack would overflow */ +#define CALC_ERR_OVERFLOW 10 +/** @brief Syntax error */ +#define CALC_ERR_SYNTAX 11 +/** @brief NULL or empty input argument */ +#define CALC_ERR_NULL_ARG 12 +/** @brief Internal error, bad element type */ +#define CALC_ERR_INTERNAL 13 +/** @} */ #ifdef __cplusplus extern "C" { #endif +/** @brief Compile an infix expression into postfix byte-code + * + * Converts an expression from an infix string to postfix byte-code + * + * @param pinfix Pointer to the infix string + * @param ppostfix Pointer to the postfix buffer + * @param perror Place to return an error code + * @return Non-zero value in event of error + * + * It is the callers's responsibility to ensure that \c ppostfix points + * to sufficient storage to hold the postfix expression. The macro + * INFIX_TO_POSTFIX_SIZE(n) can be used to calculate an appropriate + * postfix buffer size from the length of the infix buffer. + * + * @note "n" must count the terminating nil byte too. + * + * -# The **infix expressions** that can be used are very similar + * to the C expression syntax, but with some additions and subtle + * differences in operator meaning and precedence. The string may + * contain a series of expressions separated by a semi-colon character ';' + * any one of which may actually provide the calculation result; however + * all of the other expressions included must assign their result to + * a variable. All alphabetic elements described below are case independent, + * so upper and lower case letters may be used and mixed in the variable + * and function names as desired. Spaces may be used anywhere within an + * expression except between the characters that make up a single expression element. + * + * -# ***Numeric Literals*** + * The simplest expression element is a numeric literal, any (positive) + * number expressed using the standard floating point syntax that can be stored + * as a double precision value. This now includes the values Infinity and + * NaN (not a number). Note that negative numbers will be encoded as a + * positive literal to which the unary negate operator is applied. + * + * - Examples: + * - 1 + * - 2.718281828459 + * - Inf + * + * -# ***Constants*** + * There are three trigonometric constants available to any expression + * which return a value: + * - pi returns the value of the mathematical constant pi. + * - D2R evaluates to pi/180 which, when used as a multiplier, + * converts an angle from degrees to radians. + * - R2D evaluates to 180/pi which as a multiplier converts an angle + * from radians to degrees. + * + * -# ***Variables*** + * Variables are used to provide inputs to an expression, and are named + * using the single letters A through L inclusive or the keyword VAL which + * refers to the previous result of this calculation. The software that + * makes use of the expression evaluation code should document how the + * individual variables are given values; for the calc record type the input + * links INPA through INPL can be used to obtain these from other record fields, + * and VAL refers to the the VAL field (which can be overwritten from outside + * the record via Channel Access or a database link). + * + * -# ***Variable Assignment Operator*** + * Recently added is the ability to assign the result of a sub-expression to + * any of the single letter variables, which can then be used in another + * sub-expression. The variable assignment operator is the character pair + * := and must immediately follow the name of the variable to receive the + * expression value. Since the infix string must return exactly one value, every + * expression string must have exactly one sub-expression that is not an + * assignment, which can appear anywhere in the string. Sub-expressions within + * the string are separated by a semi-colon character. + * + * - Examples: + * - B; B:=A + * - i:=i+1; a*sin(i*D2R) + * + * -# ***Arithmetic Operators*** + * The usual binary arithmetic operators are provided: + - * and / with their + * usual relative precedence and left-to-right associativity, and - may also + * be used as a unary negate operator where it has a higher precedence and + * associates from right to left. There is no unary plus operator, so numeric + * literals cannot begin with a + sign. + * + * - Examples: + * - a*b + c + * - a/-4 - b + * + * Three other binary operators are also provided: % is the integer modulo operator, + * while the synonymous operators ** and ^ raise their left operand to the power of + * the right operand. % has the same precedence and associativity as * and /, while + * the power operators associate left-to-right and have a precedence in between * and + * unary minus. + * + * - Examples: + * - e:=a%10; + * - d:=a/10%10; + * - c:=a/100%10; + * - b:=a/1000%10; + * - b*4096+c*256+d*16+e + * - sqrt(a**2 + b**2) + * + * -# ***Algebraic Functions*** + * Various algebraic functions are available which take parameters inside + * parentheses. The parameter seperator is a comma. + * + * - Absolute value: abs(a) + * - Exponential ea: exp(a) + * - Logarithm, base 10: log(a) + * - Natural logarithm (base e): ln(a) or loge(a) + * - n parameter maximum value: max(a, b, ...) + * - n parameter minimum value: min(a, b, ...) + * - Square root: sqr(a) or sqrt(a) + * + * -# ***Trigonometric Functions*** + * Standard circular trigonometric functions, with angles expressed in radians: + * - Sine: sin(a) + * - Cosine: cos(a) + * - Tangent: tan(a) + * - Arcsine: asin(a) + * - Arccosine: acos(a) + * - Arctangent: atan(a) + * - 2 parameter arctangent: atan2(a, b) + * @note Note that these arguments are the reverse of the ANSI C function, + * so while C would return arctan(a/b) the calc expression engine returns arctan(b/a) + * + * -# ***Hyperbolic Trigonometry*** + * The basic hyperbolic functions are provided, but no inverse functions + * (which are not provided by the ANSI C math library either). + * - Hyperbolic sine: sinh(a) + * - Hyperbolic cosine: cosh(a) + * - Hyperbolic tangent: tanh(a) + * + * -# ***Numeric Functions*** + * The numeric functions perform operations related to the floating point + * numeric representation and truncation or rounding. + * - Round up to next integer: ceil(a) + * - Round down to next integer: floor(a) + * - Round to nearest integer: nint(a) + * - Test for infinite result: isinf(a) + * - Test for any non-numeric values: isnan(a, ...) + * - Test for all finite, numeric values: finite(a, ...) + * - Random number between 0 and 1: rndm + * + * -# ***Boolean Operators*** + * These operators regard their arguments as true or false, where 0.0 is + * false and any other value is true. + * + * - Boolean and: a && b + * - Boolean or: a || b + * - Boolean not: !a + * + * -# ***Bitwise Operators*** + * The bitwise operators convert their arguments to an integer (by truncation), + * perform the appropriate bitwise operation and convert back to a floating point + * value. Unlike in C though, ^ is not a bitwise exclusive-or operator. + * + * - Bitwise and: a & b or a and b + * - Bitwise or: a | b or a or b + * - Bitwise exclusive or: a xor b + * - Bitwise not (ones complement): ~a or not a + * - Bitwise left shift: a << b + * - Bitwise right shift: a >> b + * + * -# ***Relational Operators*** + * Standard numeric comparisons between two values: + * + * - Less than: a < b + * - Less than or equal to: a <= b + * - Equal to: a = b or a == b + * - Greater than or equal to: a >= b + * - Greater than: a > b + * - Not equal to: a != b or a # b + * + * -# ***Conditional Operator*** + * Expressions can use the C conditional operator, which has a lower + * precedence than all of the other operators except for the assignment operator. + * + * - condition ? true result : false result + * - Example: + * - a < 360 ? a+1 : 0 + * + * -# ***Parentheses*** + * Sub-expressions can be placed within parentheses to override operator precence rules. + * Parentheses can be nested to any depth, but the intermediate value stack used by + * the expression evaluation engine is limited to 80 results (which require an + * expression at least 321 characters long to reach). + */ epicsShareFunc long postfix(const char *pinfix, char *ppostfix, short *perror); +/** @brief Run the calculation engine + * + * Evaluates the postfix expression against a set ot input values. + * + * @param parg Pointer to an array of double values for the arguments A-L + * that can appear in the expression. Note that the argument values may be + * modified if the expression uses the assignment operator. + * @param presult Where to put the calculated result, which may be a NaN or Infinity. + * @param ppostfix The postfix expression created by postfix(). + * @return Status value 0 for OK, or non-zero if an error is discovered + * during the evaluation process. + */ epicsShareFunc long calcPerform(double *parg, double *presult, const char *ppostfix); +/** @brief Find the inputs and outputs of an expression + * + * Software using the calc subsystem may need to know what expression + * arguments are used and/or modified by a particular expression. It can + * discover this from the postfix string by calling calcArgUsage(), which + * takes two pointers @c pinputs and @c pstores to a pair of unsigned long + * bitmaps which return that information to the caller. Passing a NULL value + * for either of these pointers is legal if only the other is needed. + * + * The least signficant bit (bit 0) of the bitmap at @c *pinputs will be set + * if the expression depends on the argument A, and so on through bit 11 for + * the argument L. An argument that is not used until after a value has been + * assigned to it will not be set in the pinputs bitmap, thus the bits can + * be used to determine whether a value needs to be supplied for their + * associated argument or not for the purposes of evaluating the expression. + * + * Bit 0 of the bitmap at @c *pstores will be set if the expression assigns + * a value to the argument A, bit 1 for argument B etc. + * @param ppostfix A postfix expression created by postfix(). + * @param pinputs Bitmap pointer. + * @param pstores Bitmap pointer. + * @return The return value will be non-zero if the ppostfix expression was + * illegal, otherwise 0. + */ epicsShareFunc long calcArgUsage(const char *ppostfix, unsigned long *pinputs, unsigned long *pstores); +/** @brief Convert an error code to a string. + * + * Gives out a printable version of an individual error code. + * The error codes are macros defined here with names starting @c CALC_ERR_ + * @param error Error code + * @return A string representation of the error code + */ epicsShareFunc const char * calcErrorStr(short error); +/** @brief Disassemble a postfix expression + * + * Convert the byte-code stream to text and print to stdout. + * @param pinst postfix instructions + */ epicsShareFunc void calcExprDump(const char *pinst); diff --git a/modules/libcom/src/cppStd/epicsAlgorithm.h b/modules/libcom/src/cppStd/epicsAlgorithm.h index 20850242d..b79732894 100644 --- a/modules/libcom/src/cppStd/epicsAlgorithm.h +++ b/modules/libcom/src/cppStd/epicsAlgorithm.h @@ -3,71 +3,105 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ -// epicsAlgorithm.h -// Authors: Jeff Hill & Andrew Johnson +/** + * @file epicsAlgorithm.h + * @author Jeff Hill & Andrew Johnson + * + * @brief Contains a few templates out of the C++ standard header algorithm + * + * @note The templates are provided here in a much smaller file. Standard algorithm + * contains many templates for sorting and searching through C++ template containers + * which are not used in EPICS. If all you need from there is std::min(), + * std::max() and/or std::swap() your code may compile faster if you include + * epicsAlgorithm.h and use epicsMin(), epicsMax() and epicsSwap() instead. + * + * The C++ standard only requires types to be less-than comparable, so + * the epicsMin and epicsMax templates only use operator <. + */ #ifndef __EPICS_ALGORITHM_H__ #define __EPICS_ALGORITHM_H__ #include "epicsMath.h" -// The C++ standard only requires types to be less-than comparable, so -// the epicsMin and epicsMax templates only use operator < - -// epicsMin +/** + * Returns the smaller of a or b compared using a inline const T& epicsMin (const T& a, const T& b) { return (b < a) ? b : a; } -// If b is a NaN the above template returns a, but should return NaN. -// These specializations ensure that epicsMin(x,NaN) == NaN - +/** + * Returns the smaller of a or b compared using a inline const float& epicsMin (const float& a, const float& b) { return (b < a) || isnan(b) ? b : a; } +/** + * Returns the smaller of a or b compared using a inline const double& epicsMin (const double& a, const double& b) { return (b < a) || isnan(b) ? b : a; } - -// epicsMax - +/** + * Returns the larger of a or b compared using a inline const T& epicsMax (const T& a, const T& b) { return (a < b) ? b : a; } -// If b is a NaN the above template returns a, but should return NaN. -// These specializations ensure that epicsMax(x,NaN) == NaN - +/** + * Returns the larger of a or b compared using a inline const float& epicsMax (const float& a, const float& b) { return (a < b) || isnan(b) ? b : a; } +/** + * Returns the larger of a or b compared using a inline const double& epicsMax (const double& a, const double& b) { return (a < b) || isnan(b) ? b : a; } - -// epicsSwap - +/** + * Swaps the values of a and b. + * + * @note The data type must support both copy-construction and assignment. + * + */ template inline void epicsSwap(T& a, T& b) { diff --git a/modules/libcom/src/dbmf/dbmf.h b/modules/libcom/src/dbmf/dbmf.h index 2c8a28f2c..d8f768a74 100644 --- a/modules/libcom/src/dbmf/dbmf.h +++ b/modules/libcom/src/dbmf/dbmf.h @@ -3,15 +3,33 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* - * Author: Jim Kowalkowski and Marty Kraimer - * Date: 4/97 + +/** + * @file dbmf.h + * @author Jim Kowalkowski, Marty Kraimer * - * A library to manage storage that is allocated and then freed. + * @brief A library to manage storage that is allocated and quickly freed. + * + * Database Macro/Free describes a facility that prevents memory fragmentation + * when temporary storage is being allocated and freed a short time later, at + * the same time that much longer-lived storage is also being allocated, such + * as when parsing items for the IOC database while also creating records. + * + * Routines whin iocCore like dbLoadDatabase() have the following attributes: + * - They repeatedly call malloc() followed soon afterwards by a call to + * free() the temporaryily allocated storage. + * - Between those calls to malloc() and free(), additional calls to + * malloc() are made that do NOT have an associated free(). + * + * @note In some environment, e.g. vxWorks, this behavior causes severe memory + * fragmentation. + * + * @note This facility should NOT be used by code that allocates storage and + * then keeps it for a considerable period of time before releasing. Such code + * should consider using the freeList library. */ #ifndef DBMF_H #define DBMF_H @@ -23,25 +41,71 @@ extern "C" { #endif +/** + * @brief Initialize the facility + * @param size The maximum size request from dbmfMalloc() that will be + * allocated from the dbmf pool (Size is always made a multiple of 8). + * @param chunkItems Each time malloc() must be called size*chunkItems bytes + * are allocated. + * @return 0 on success, -1 if already initialized + * + * @note If dbmfInit() is not called before one of the other routines then it + * is automatically called with size=64 and chunkItems=10 + */ epicsShareFunc int dbmfInit(size_t size, int chunkItems); +/** + * @brief Allocate memory. + * @param bytes If bytes > size then malloc() is used to allocate the memory. + * @return Pointer to the newly-allocated memory, or NULL on failure. + */ epicsShareFunc void * dbmfMalloc(size_t bytes); +/** + * @brief Duplicate a string. + * + * Create a copy of the input string. + * @param str Pointer to the null-terminated string to be copied. + * @return A pointer to the new copy, or NULL on failure. + */ epicsShareFunc char * dbmfStrdup(const char *str); +/** + * @brief Duplicate a string (up to len bytes). + * + * Copy at most len bytes of the input string into a new buffer. If no nil + * terminator is seen in the first @c len bytes a nil terminator is added. + * @param str Pointer to the null-terminated string to be copied. + * @param len Max number of bytes to copy. + * @return A pointer to the new string, or NULL on failure. + */ epicsShareFunc char * dbmfStrndup(const char *str, size_t len); +/** + * @brief Concatenate three strings. + + * Returns a pointer to a null-terminated string made by concatenating the + * three input strings. + * @param lhs Start string to which the others get concatenated to (left part). + * @param mid Next string to be concatenated to the lhs (mid part). + * @param rhs Last string to be concatenated to the lhs+mid (right part). + * @return A pointer to the new string, or NULL on failure. + */ epicsShareFunc char * dbmfStrcat3(const char *lhs, const char *mid, const char *rhs); +/** + * @brief Free the memory allocated by dbmfMalloc. + * @param bytes Pointer to memory obtained from dbmfMalloc(), dbmfStrdup(), + * dbmfStrndup() or dbmfStrcat3(). + */ epicsShareFunc void dbmfFree(void *bytes); +/** + * @brief Free all chunks that contain only free items. + */ epicsShareFunc void dbmfFreeChunks(void); +/** + * @brief Show the status of the dbmf memory pool. + * @param level Detail level. + * @return 0. + */ epicsShareFunc int dbmfShow(int level); -/* Rules: - * 1) Size is always made a multiple of 8. - * 2) if dbmfInit is not called before one of the other routines then it - * is automatically called with size=64 and chunkItems=10 - * 3) These routines should only be used to allocate storage that will - * shortly thereafter be freed. - * 4) dbmfFreeChunks can only free chunks that contain only free items -*/ - #ifdef __cplusplus } #endif diff --git a/modules/libcom/src/ellLib/ellLib.h b/modules/libcom/src/ellLib/ellLib.h index 52b58d169..776f556f4 100644 --- a/modules/libcom/src/ellLib/ellLib.h +++ b/modules/libcom/src/ellLib/ellLib.h @@ -6,10 +6,23 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* - * Author: John Winans (ANL) - * Andrew Johnson +/** + * @file ellLib.h + * @author John Winans (ANL) + * @author Andrew Johnson (ANL) + * + * @brief A doubly-linked list library + * + * This provides similar functionality to the VxWorks lstLib library. + * + * Supports the creation and maintenance of a doubly-linked list. The user + * supplies a list descriptor (type ELLLIST) that will contain pointers to + * the first and last nodes in the list, and a count of the number of + * nodes in the list. The nodes in the list can be any user-defined structure, + * but they must reserve space for two pointers as their first elements. + * Both the forward and backward chains are terminated with a NULL pointer. */ + #ifndef INC_ellLib_H #define INC_ellLib_H @@ -19,46 +32,185 @@ extern "C" { #endif +/** @brief List node type. + * + * A list node (@c ELLNODE) must be embedded in the structure to be placed + * on the list, ideally as the first member of that structure. + * + * If the node is elsewhere in the structure, care must be taken to convert + * between the structure pointer and the node pointer and back every time when + * calling routines in the ellLib API. The ellFree() and ellFree2() routines + * cannot be used with such a list. + */ typedef struct ELLNODE { - struct ELLNODE *next; - struct ELLNODE *previous; + struct ELLNODE *next; /**< @brief Pointer to next node in list */ + struct ELLNODE *previous; /**< @brief Pointer to previous node in list */ } ELLNODE; +/** @brief Value of a terminal node + */ #define ELLNODE_INIT {NULL, NULL} +/** @brief List header type + */ typedef struct ELLLIST { - ELLNODE node; - int count; + ELLNODE node; /**< @brief Pointers to the first and last nodes on list */ + int count; /**< @brief Number of nodes on the list */ } ELLLIST; +/** @brief Value of an empty list + */ #define ELLLIST_INIT {ELLNODE_INIT, 0} +/** @brief Pointer to free() for use by ellFree() macro. + * + * This is required for use on Windows, where each DLL has its own free() + * function. The ellFree() macro passes the application's version of free() + * to the ellFree2() function. + */ typedef void (*FREEFUNC)(void *); +/** @brief Initialize a list type + * @param PLIST Pointer to list header to be initialized + */ #define ellInit(PLIST) {\ (PLIST)->node.next = (PLIST)->node.previous = NULL;\ (PLIST)->count = 0;\ } +/** @brief Report the number of nodes in a list + * @param PLIST Pointer to list descriptor + * @return Number of nodes in the list + */ #define ellCount(PLIST) ((PLIST)->count) +/** @brief Find the first node in list + * @param PLIST Pointer to list descriptor + * @return Pointer to first node in the list + */ #define ellFirst(PLIST) ((PLIST)->node.next) +/** @brief Find the last node in list + * @param PLIST Pointer to list descriptor + * @return Pointer to last node in the list + */ #define ellLast(PLIST) ((PLIST)->node.previous) +/** @brief Find the next node in list + * @param PNODE Pointer to node whose successor is to be found + * @return Pointer to the node following @c PNODE + */ #define ellNext(PNODE) ((PNODE)->next) +/** @brief Find the previous node in list + * @param PNODE Pointer to node whose predecessor is to be found + * @return Pointer to the node prior to @c PNODE + */ #define ellPrevious(PNODE) ((PNODE)->previous) +/** @brief Free up the list + * @param PLIST List for which to free all nodes + */ #define ellFree(PLIST) ellFree2(PLIST, free) +/** + * @brief Adds a node to the end of a list + * @param pList Pointer to list descriptor + * @param pNode Pointer to node to be added + */ epicsShareFunc void ellAdd (ELLLIST *pList, ELLNODE *pNode); +/** + * @brief Concatenates a list to the end of another list. + * The list to be added is left empty. Either list (or both) + * can be empty at the beginning of the operation. + * @param pDstList Destination list + * @param pAddList List to be added to @c pDstList + */ epicsShareFunc void ellConcat (ELLLIST *pDstList, ELLLIST *pAddList); +/** + * @brief Deletes a node from a list. + * @param pList Pointer to list descriptor + * @param pNode Pointer to node to be deleted + */ epicsShareFunc void ellDelete (ELLLIST *pList, ELLNODE *pNode); +/** + * @brief Extract a sublist from a list. + * @param pSrcList Pointer to source list + * @param pStartNode First node in @c pSrcList to be extracted + * @param pEndNode Last node in @c pSrcList to be extracted + * @param pDstList Pointer to list where to put extracted list + */ epicsShareFunc void ellExtract (ELLLIST *pSrcList, ELLNODE *pStartNode, ELLNODE *pEndNode, ELLLIST *pDstList); +/** + * @brief Deletes and returns the first node from a list + * @param pList Pointer to list from which to get node + * @return Pointer to the first node from the list, or NULL if the list is empty + */ epicsShareFunc ELLNODE * ellGet (ELLLIST *pList); +/** + * @brief Deletes and returns the last node from a list. + * @param pList Pointer to list from which to get node + * @return Pointer to the last node from the list, or NULL if the list is empty + */ epicsShareFunc ELLNODE * ellPop (ELLLIST *pList); +/** + * @brief Inserts a node into a list immediately after a specific node + * @param plist Pointer to list into which to insert node + * @param pPrev Pointer to the node after which to insert + * @param pNode Pointer to the node to be inserted + * @note If @c pPrev is NULL @c pNode will be inserted at the head of the list + */ epicsShareFunc void ellInsert (ELLLIST *plist, ELLNODE *pPrev, ELLNODE *pNode); +/** + * @brief Find the Nth node in a list + * @param pList Pointer to list from which to find node + * @param nodeNum Index of the node to be found + * @return Pointer to the element at index @c nodeNum in pList, or NULL if + * there is no such node in the list. + * @note The first node has index 1. + */ epicsShareFunc ELLNODE * ellNth (ELLLIST *pList, int nodeNum); +/** + * @brief Find the list node @c nStep steps away from a specified node + * @param pNode The known node + * @param nStep How many steps to take, may be negative to step backwards + * @return Pointer to the node @c nStep nodes from @c pNode, or NULL if there + * is no such node in the list. + */ epicsShareFunc ELLNODE * ellNStep (ELLNODE *pNode, int nStep); +/** + * @brief Find the index of a specific node in a list + * @param pList Pointer to list to search + * @param pNode Pointer to node to search for + * @return The node's index, or -1 if it cannot be found on the list. + * @note The first node has index 1. + */ epicsShareFunc int ellFind (ELLLIST *pList, ELLNODE *pNode); + typedef int (*pListCmp)(const ELLNODE* A, const ELLNODE* B); -epicsShareFunc void ellSortStable(ELLLIST *pList, pListCmp); +/** + * @author Michael Davidsaver + * @date 2016 + * + * @brief Stable (MergeSort) of a given list. + * @param pList Pointer to list to be sorted + * @param pListCmp Compare function to be used + * @note The comparison function cmp(A,B) is expected + * to return -1 for AB. + * + * @note Use of mergesort algorithm based on analysis by + * http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html + */ +epicsShareFunc void ellSortStable(ELLLIST *pList, pListCmp pListCmp); +/** + * @brief Free all the nodes in a list. + * + * This routine empties a list, calling freeFunc() for every node on it. + * @param pList List from which to free all nodes + * @param freeFunc The free() routine to be called + * @note The nodes in the list are free()'d on the assumption that the node + * structures were malloc()'d one-at-a-time and that the ELLNODE structure is + * the first member of the parent structure. + */ epicsShareFunc void ellFree2 (ELLLIST *pList, FREEFUNC freeFunc); +/** + * @brief Verifies that the list is consistent + * @param pList List to be verified + */ epicsShareFunc void ellVerify (ELLLIST *pList); #ifdef __cplusplus diff --git a/modules/libcom/src/env/envDefs.h b/modules/libcom/src/env/envDefs.h index 2490702a6..12dd601b5 100644 --- a/modules/libcom/src/env/envDefs.h +++ b/modules/libcom/src/env/envDefs.h @@ -4,26 +4,27 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* - * Author: Roger A. Cole - * Date: 07-20-91 + +/** + * @file envDefs.h + * @author Roger A. Cole * + * @brief Routines to get and set EPICS environment parameters. + * + * This file defines environment parameters used by EPICS and the + * routines used to get and set those parameter values. + * + * The ENV_PARAM's declared here are defined in the generated file + * envData.c by the bldEnvData.pl Perl script, which parses this file + * and the build system's CONFIG_ENV and CONFIG_SITE_ENV files. + * User programs can define their own environment parameters for their + * own use--the only caveat is that such parameters aren't automatically + * setup by EPICS. + * + * @note bldEnvData.pl looks for "epicsShareExtern const ENV_PARAM ;" */ -/**************************************************************************** -* TITLE envDefs.h - definitions for environment get/set routines -* -* DESCRIPTION -* This file defines the environment parameters for EPICS. These -* ENV_PARAM's are created in envData.c by bldEnvData for -* use by EPICS programs running under UNIX and VxWorks. -* -* User programs can define their own environment parameters for their -* own use--the only caveat is that such parameters aren't automatically -* setup by EPICS. -* -*****************************************************************************/ #ifndef envDefsH #define envDefsH @@ -34,14 +35,14 @@ extern "C" { #include "shareLib.h" +/** + * @brief A structure to hold a single environment parameter + */ typedef struct envParam { - char *name; /* text name of the parameter */ - char *pdflt; + char *name; /**< @brief Name of the parameter */ + char *pdflt; /**< @brief Default value */ } ENV_PARAM; -/* - * bldEnvData.pl looks for "epicsShareExtern const ENV_PARAM ;" - */ epicsShareExtern const ENV_PARAM EPICS_CA_ADDR_LIST; epicsShareExtern const ENV_PARAM EPICS_CA_CONN_TMO; epicsShareExtern const ENV_PARAM EPICS_CA_AUTO_ADDR_LIST; @@ -57,7 +58,7 @@ epicsShareExtern const ENV_PARAM EPICS_CAS_IGNORE_ADDR_LIST; epicsShareExtern const ENV_PARAM EPICS_CAS_AUTO_BEACON_ADDR_LIST; epicsShareExtern const ENV_PARAM EPICS_CAS_BEACON_ADDR_LIST; epicsShareExtern const ENV_PARAM EPICS_CAS_SERVER_PORT; -epicsShareExtern const ENV_PARAM EPICS_CA_BEACON_PERIOD; /* deprecated */ +epicsShareExtern const ENV_PARAM EPICS_CA_BEACON_PERIOD; /**< @brief deprecated */ epicsShareExtern const ENV_PARAM EPICS_CAS_BEACON_PERIOD; epicsShareExtern const ENV_PARAM EPICS_CAS_BEACON_PORT; epicsShareExtern const ENV_PARAM EPICS_BUILD_COMPILER_CLASS; @@ -74,30 +75,167 @@ epicsShareExtern const ENV_PARAM EPICS_IOC_LOG_FILE_COMMAND; epicsShareExtern const ENV_PARAM IOCSH_PS1; epicsShareExtern const ENV_PARAM IOCSH_HISTSIZE; epicsShareExtern const ENV_PARAM IOCSH_HISTEDIT_DISABLE; - epicsShareExtern const ENV_PARAM *env_param_list[]; struct in_addr; -epicsShareFunc char * epicsShareAPI +/** + * @brief Get value of a configuration parameter + * + * Gets the value of a configuration parameter from the environment + * and copies it into the caller's buffer. If the parameter isn't + * set in the environment, the default value for the parameter is + * copied instead. If neither provides a non-empty string the buffer + * is set to '\0' and NULL is returned. + * + * @param pParam Pointer to config param structure. + * @param bufDim Dimension of parameter buffer + * @param pBuf Pointer to parameter buffer + * @return Pointer to the environment variable value string, or + * NULL if no parameter value and default value was empty. + */ +epicsShareFunc char * epicsShareAPI envGetConfigParam(const ENV_PARAM *pParam, int bufDim, char *pBuf); -epicsShareFunc const char * epicsShareAPI + +/** + * @brief Get a configuration parameter's value or default string. + * + * @param pParam Pointer to config param structure. + * @return Pointer to the environment variable value string, or to + * the default value for the parameter, or NULL if those strings + * were empty or not set. + */ +epicsShareFunc const char * epicsShareAPI envGetConfigParamPtr(const ENV_PARAM *pParam); -epicsShareFunc long epicsShareAPI + +/** + * @brief Print the value of a configuration parameter. + * + * @param pParam Pointer to config param structure. + * @return 0 + */ +epicsShareFunc long epicsShareAPI envPrtConfigParam(const ENV_PARAM *pParam); -epicsShareFunc long epicsShareAPI + +/** + * @brief Get value of an inet addr config parameter. + * + * Gets the value of a configuration parameter and copies it into + * the caller's (struct in_addr) buffer. If the configuration parameter + * isn't found in the environment, the default value for that parameter + * will be used. The resulting string is converted from a dotted-quad + * format or looked up using the DNS and copied into the inet structure. + * + * If no parameter is found and there is no default, then -1 is + * returned and the callers buffer is unmodified. + * + * @param pParam Pointer to config param structure. + * @param pAddr Pointer to struct to receive inet addr. + * @return 0, or -1 if an error is encountered + */ +epicsShareFunc long epicsShareAPI envGetInetAddrConfigParam(const ENV_PARAM *pParam, struct in_addr *pAddr); -epicsShareFunc long epicsShareAPI + +/** + * @brief Get value of a double configuration parameter. + * + * Gets the value of a configuration parameter, converts it into a + * @c double value and copies that into the caller's buffer. If the + * configuration parameter isn't found in the environment, the + * default value for the parameter is used instead. + * + * If no parameter is found and there is no default, then -1 is + * returned and the callers buffer is unmodified. + * + * @param pParam Pointer to config param structure. + * @param pDouble Pointer to place to store value. + * @return 0, or -1 if an error is encountered + */ +epicsShareFunc long epicsShareAPI envGetDoubleConfigParam(const ENV_PARAM *pParam, double *pDouble); -epicsShareFunc long epicsShareAPI + +/** + * @brief Get value of a long configuration parameter. + * + * Gets the value of a configuration parameter, converts it into a + * @c long value and copies that into the caller's buffer. If the + * configuration parameter isn't found in the environment, the + * default value for the parameter is used instead. + * + * If no parameter is found and there is no default, then -1 is + * returned and the callers buffer is unmodified. + * + * @param pParam Pointer to config param structure. + * @param pLong Pointer to place to store value. + * @return 0, or -1 if an error is encountered + */ +epicsShareFunc long epicsShareAPI envGetLongConfigParam(const ENV_PARAM *pParam, long *pLong); -epicsShareFunc unsigned short epicsShareAPI envGetInetPortConfigParam + +/** + * @brief Get value of a port number configuration parameter. + * + * Returns the value of a configuration parameter that represents + * an inet port number. If no environment variable is found the + * default parameter value is used, and if that is also unset the + * @c defaultPort argument returned instead. The integer value must + * fall between the values IPPORT_USERRESERVED and USHRT_MAX or the + * @c defaultPort argument will be substituted instead. + * + * @param pEnv Pointer to config param structure. + * @param defaultPort Port number to be used if environment settings invalid. + * @return Port number. + */ +epicsShareFunc unsigned short epicsShareAPI envGetInetPortConfigParam (const ENV_PARAM *pEnv, unsigned short defaultPort); +/** + * @brief Get value of a boolean configuration parameter. + * + * Gets the value of a configuration parameter, and puts the value + * 0 or 1 into the caller's buffer depending on the value. If the + * configuration parameter isn't found in the environment, the + * default value for the parameter is used instead. + * + * A value is treated as True (1) if it compares equal to the + * string "yes" with a case-independent string comparison. All + * other strings are treated as False (0). + * + * If no parameter is found and there is no default, then -1 is + * returned and the callers buffer is unmodified. + * + * @param pParam Pointer to config param structure. + * @param pBool Pointer to place to store value. + * @return 0, or -1 if an error is encountered + */ epicsShareFunc long epicsShareAPI envGetBoolConfigParam(const ENV_PARAM *pParam, int *pBool); + +/** + * @brief Prints all configuration parameters and their current value. + * + * @return 0 + */ epicsShareFunc long epicsShareAPI epicsPrtEnvParams(void); + +/** + * @brief Set an environment variable's value + * + * The setenv() routine is not available on all operating systems. + * This routine provides a portable alternative for all EPICS targets. + * @param name Environment variable name. + * @param value New value for environment variable. + */ epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *value); +/** + * @brief Clear the value of an environment variable + * @param name Environment variable name. + */ epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name); +/** + * @brief Print value of an environment variable, or all variables + * + * @param name Environment variable name, or NULL to show all. + */ epicsShareFunc void epicsShareAPI epicsEnvShow (const char *name); #ifdef __cplusplus @@ -105,4 +243,3 @@ epicsShareFunc void epicsShareAPI epicsEnvShow (const char *name); #endif #endif /*envDefsH*/ - diff --git a/modules/libcom/src/macLib/macLib.h b/modules/libcom/src/macLib/macLib.h index 14ecdaa3f..3be57cdce 100644 --- a/modules/libcom/src/macLib/macLib.h +++ b/modules/libcom/src/macLib/macLib.h @@ -4,20 +4,26 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* - * Definitions for macro substitution library (macLib) +/** + * @file macLib.h + * @brief Text macro substitution routines + * @author William Lupton, W. M. Keck Observatory * - * William Lupton, W. M. Keck Observatory + * This general purpose macro substitution library + * is used for all macro substitutions in EPICS Base. + * + * Most routines return 0 (OK) on success, -1 (ERROR) on failure, + * or small positive values for extra info. + * The macGetValue() and macExpandString() routines depart from this + * and return information both on success / failure and on value length. + * Errors and warnings are reported using errlogPrintf(). */ #ifndef INCmacLibH #define INCmacLibH -/* - * EPICS include files needed by this file - */ #include "ellLib.h" #include "shareLib.h" @@ -25,137 +31,275 @@ extern "C" { #endif -/* - * Maximum size of macro name or value string (simpler to make fixed) +/** @brief Maximum size of a macro name or value */ #define MAC_SIZE 256 -/* - * Macro substitution context. One of these contexts is allocated each time - * macCreateHandle() is called +/** @brief Macro substitution context, for use by macLib routines only. + * + * An application may have multiple active contexts if desired. */ typedef struct { - long magic; /* magic number (used for authentication) */ - int dirty; /* values need expanding from raw values? */ - int level; /* scoping level */ - int debug; /* debugging level */ - ELLLIST list; /* macro name / value list */ - int flags; /* operating mode flags */ + long magic; /**< @brief magic number (used for authentication) */ + int dirty; /**< @brief values need expanding from raw values? */ + int level; /**< @brief scoping level */ + int debug; /**< @brief debugging level */ + ELLLIST list; /**< @brief macro name / value list */ + int flags; /**< @brief operating mode flags */ } MAC_HANDLE; -/* - * Function prototypes (core library) +/** @name Core Library + * The core library provides a minimal set of basic operations. + * @{ */ -epicsShareFunc long /* 0 = OK; <0 = ERROR */ + +/** + * @brief Creates a new macro substitution context. + * @return 0 = OK; <0 = ERROR + */ +epicsShareFunc long epicsShareAPI macCreateHandle( - MAC_HANDLE **handle, /* address of variable to receive pointer */ - /* to new macro substitution context */ + MAC_HANDLE **handle, /**< pointer to variable to receive pointer + to new macro substitution context */ - const char * pairs[] /* pointer to NULL-terminated array of */ - /* {name,value} pair strings; a NULL */ - /* value implies undefined; a NULL */ - /* argument implies no macros */ + const char * pairs[] /**< pointer to NULL-terminated array of + {name,value} pair strings. A NULL + value implies undefined; a NULL @c pairs + argument implies no macros. */ ); - +/** + * @brief Disable or enable warning messages. + * + * The macExpandString() routine prints warnings when it cant expand a macro. + * This routine can be used to silence those warnings. A non zero value will + * suppress the warning messages from subsequent library routines given the + * same @c handle. + */ epicsShareFunc void epicsShareAPI macSuppressWarning( - MAC_HANDLE *handle, /* opaque handle */ + MAC_HANDLE *handle, /**< opaque handle */ - int falseTrue /*0 means issue, 1 means suppress*/ + int falseTrue /**< 0 means issue, 1 means suppress*/ ); -epicsShareFunc long /* strlen(dest), <0 if any macros are */ - /* undefined */ -epicsShareAPI macExpandString( - MAC_HANDLE *handle, /* opaque handle */ - - const char *src, /* source string */ - - char *dest, /* destination string */ - - long capacity /* capacity of destination buffer (dest) */ -); - - -epicsShareFunc long /* strlen(value) */ -epicsShareAPI macPutValue( - MAC_HANDLE *handle, /* opaque handle */ - - const char *name, /* macro name */ - - const char *value /* macro value */ -); - -epicsShareFunc long /* strlen(value), <0 if undefined */ -epicsShareAPI macGetValue( - MAC_HANDLE *handle, /* opaque handle */ - - const char *name, /* macro name or reference */ - - char *value, /* string to receive macro value or name */ - /* argument if macro is undefined */ - - long capacity /* capacity of destination buffer (value) */ -); - -epicsShareFunc long /* 0 = OK; <0 = ERROR */ -epicsShareAPI macDeleteHandle( - MAC_HANDLE *handle /* opaque handle */ -); - -epicsShareFunc long /* 0 = OK; <0 = ERROR */ -epicsShareAPI macPushScope( - MAC_HANDLE *handle /* opaque handle */ -); - -epicsShareFunc long /* 0 = OK; <0 = ERROR */ -epicsShareAPI macPopScope( - MAC_HANDLE *handle /* opaque handle */ -); - -epicsShareFunc long /* 0 = OK; <0 = ERROR */ -epicsShareAPI macReportMacros( - MAC_HANDLE *handle /* opaque handle */ -); - -/* - * Function prototypes (utility library) +/** + * @brief Expand a string which may contain macro references. + * @return Returns the length of the expanded string, <0 if any macro are + * undefined + * + * This routine parses the @c src string looking for macro references and + * passes any it finds to macGetValue() for translation. + * + * @note The return value is similar to that of macGetValue(). Its absolute + * value is the number of characters copied to @c dest. If the return value + * is negative, at least one undefined macro was left unexpanded. */ -epicsShareFunc long /* #defns encountered; <0 = ERROR */ +epicsShareFunc long +epicsShareAPI macExpandString( + MAC_HANDLE *handle, /**< opaque handle */ + + const char *src, /**< source string */ + + char *dest, /**< destination string */ + + long capacity /**< capacity of destination buffer (dest) */ +); + +/** + * @brief Sets the value of a specific macro. + * @return Returns the length of the value string. + * @note If @c value is NULL, all instances of @c name are undefined at + * all scoping levels (the named macro doesn't have to exist in this case). + * Macros referenced in @c value need not be defined at this point. + */ +epicsShareFunc long +epicsShareAPI macPutValue( + MAC_HANDLE *handle, /**< opaque handle */ + + const char *name, /**< macro name */ + + const char *value /**< macro value */ +); + +/** + * @brief Returns the value of a macro + * @return Returns the length of the value string, <0 if undefined + * + * @c value will be zero-terminated if the length of the value is less than + * @c capacity. The return value is the number of characters copied to + * @c value (see below for behavior if the macro is undefined). If @c capacity + * is zero, no characters will be copied to @c value (which may be NULL) + * and the call can be used to check whether the macro is defined. + * + * @note Truncation of the value is not reported, applications should assume + * that truncation has occurred if the return value is equal to capacity. + * + * If the macro is undefined, the macro reference will be returned in + * the value string (if permitted by maxlen) and the function value will + * be _minus_ the number of characters copied. Note that treatment of + * @c capacity is intended to be consistent with the strncpy() routine. + * + * If the value contains macro references, these references will be + * expanded recursively. This expansion will detect a direct or indirect + * self reference. + * + * Macro references begin with a "$" immediately followed by either a + * "(" or a "{" character. The macro name comes next, and may optionally + * be succeeded by an "=" and a default value, which will be returned if + * the named macro is undefined at the moment of expansion. A reference + * is terminated by the matching ")" or "}" character. + */ +epicsShareFunc long +epicsShareAPI macGetValue( + MAC_HANDLE *handle, /**< opaque handle */ + + const char *name, /**< macro name or reference */ + + char *value, /**< string to receive macro value or name + argument if macro is undefined */ + + long capacity /**< capacity of destination buffer (value) */ +); +/** + * @brief Marks a handle invalid, and frees all storage associated with it + * @return 0 = OK; <0 = ERROR + * @note Note that this does not free any strings into which macro values have + * been returned. Macro values are always returned into strings which + * were pre-allocated by the caller. + */ +epicsShareFunc long +epicsShareAPI macDeleteHandle( + MAC_HANDLE *handle /**< opaque handle */ +); +/** + * @brief Marks the start of a new scoping level + * @return 0 = OK; <0 = ERROR + * + * Marks all macro definitions added after this call as belonging + * to another scope. These macros will be lost on a macPopScope() + * call and those at the current scope will be re-instated. + */ +epicsShareFunc long +epicsShareAPI macPushScope( + MAC_HANDLE *handle /**< opaque handle */ +); +/** + * @brief Retrieve the last pushed scope (like stack operations) + * @return 0 = OK; <0 = ERROR + * + * See macPushScope() + */ +epicsShareFunc long +epicsShareAPI macPopScope( + MAC_HANDLE *handle /**< opaque handle */ +); +/** + * @brief Reports details of current definitions + * @return 0 = OK; <0 = ERROR + * This sends details of current definitions to standard output, + * and is intended purely for debugging purposes. + */ +epicsShareFunc long +epicsShareAPI macReportMacros( + MAC_HANDLE *handle /**< opaque handle */ +); +/** @} */ + +/** @name Utility Library + * These convenience functions are intended for applications to use and + * provide a more convenient interface for some purposes. + * @{ + */ + +/** + * @brief Parse macro definitions into an array of {name, value} pairs. + * @return Number of macros found; <0 = ERROR + * + * This takes a set of macro definitions in "a=xxx,b=yyy" format and + * converts them into an array of pointers to character strings which + * are, in order, "first name", "first value", "second name", "second + * value" etc. The array is terminated with two NULL pointers and all + * storage is allocated contiguously so that it can be freed with a + * single call to free(). + * + * This routine is independent of any handle and provides a generally + * useful service which may be used elsewhere. Any macro references in + * values are not expanded at this point since the referenced macros may + * be defined or redefined before the macro actually has to be + * translated. + * + * Shell-style escapes and quotes are supported, as are things like + * "A=B,B=$(C$(A)),CA=CA,CB=CB" (sets B to "CB"). White space is + * significant within values but ignored elsewhere (i.e. surrounding "=" + * and "," characters). + * + * The function returns the number of definitions encountered, or -1 if + * the supplied string is invalid. + */ +epicsShareFunc long epicsShareAPI macParseDefns( - MAC_HANDLE *handle, /* opaque handle; can be NULL if default */ - /* special characters are to be used */ + MAC_HANDLE *handle, /**< opaque handle; may be NULL if debug + messages are not required. */ - const char *defns, /* macro definitions in "a=xxx,b=yyy" */ - /* format */ + const char *defns, /**< macro definitions in "a=xxx,b=yyy" + format */ - char **pairs[] /* address of variable to receive pointer */ - /* to NULL-terminated array of {name, */ - /* value} pair strings; all storage is */ - /* allocated contiguously */ + char **pairs[] /**< address of variable to receive pointer + to NULL-terminated array of {name, + value} pair strings; all storage is + allocated contiguously */ ); -epicsShareFunc long /* #macros defined; <0 = ERROR */ +/** + * @brief Install set of {name, value} pairs as definitions + * @return Number of macros defined; <0 = ERROR + * + * This takes an array of pairs as defined above and installs them as + * definitions by calling macPutValue(). The pairs array is terminated + * by a NULL pointer. + */ +epicsShareFunc long epicsShareAPI macInstallMacros( - MAC_HANDLE *handle, /* opaque handle */ + MAC_HANDLE *handle, /**< opaque handle */ - char *pairs[] /* pointer to NULL-terminated array of */ - /* {name,value} pair strings; a NULL */ - /* value implies undefined; a NULL */ - /* argument implies no macros */ + char *pairs[] /**< pointer to NULL-terminated array of + {name,value} pair strings; a NULL + value implies undefined; a NULL + argument implies no macros */ ); -epicsShareFunc char * /* expanded string; NULL if any undefined macros */ +/** + * @brief Expand environment variables in a string. + * @return Expanded string; NULL if any undefined macros were used. + * + * This routine expands a string which may contain macros that are + * environment variables. It parses the string looking for such + * references and passes them to macGetValue() for translation. It uses + * malloc() to allocate space for the expanded string and returns a + * pointer to this null-terminated string. It returns NULL if the source + * string contains any undefined references. + */ +epicsShareFunc char * epicsShareAPI macEnvExpand( - const char *str /* string to be expanded */ + const char *str /**< string to be expanded */ ); -epicsShareFunc char * /* expanded string; NULL if any undefined macros */ +/** + * @brief Expands macros and environment variables in a string. + * @return Expanded string; NULL if any undefined macros were used. + * + * This routine is similar to macEnvExpand() but allows an optional handle + * to be passed in that may contain additional macro definitions. + * These macros are appended to the set of macros from environment + * variables when expanding the string. + */ +epicsShareFunc char * epicsShareAPI macDefExpand( - const char *str, /* string to be expanded */ - MAC_HANDLE *macros /* opaque handle; can be NULL if default */ - /* special characters are to be used */ + const char *str, /**< string to be expanded */ + MAC_HANDLE *macros /**< opaque handle; may be NULL if only + environment variables are to be used */ ); +/** @} */ #ifdef __cplusplus } diff --git a/modules/libcom/src/misc/adjustment.h b/modules/libcom/src/misc/adjustment.h index 3f152039f..f330bcd9d 100644 --- a/modules/libcom/src/misc/adjustment.h +++ b/modules/libcom/src/misc/adjustment.h @@ -5,9 +5,15 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* src/libCom/adjustment.h */ + +/** + * @file adjustment.h + * @brief Declare function `adjustToWorstCaseAlignment` + * + * Declares a single function `adjustToWorstCaseAlignment`. + */ #ifndef INCadjustmenth #define INCadjustmenth @@ -17,6 +23,9 @@ extern "C" { #endif +/** returns a value larger or equal than `size`, that is an exact + multiple of the worst case alignment for the architecture on + which the routine is executed. */ epicsShareFunc size_t adjustToWorstCaseAlignment(size_t size); #ifdef __cplusplus @@ -25,4 +34,3 @@ epicsShareFunc size_t adjustToWorstCaseAlignment(size_t size); #endif /*INCadjustmenth*/ - diff --git a/modules/libcom/src/misc/alarm.h b/modules/libcom/src/misc/alarm.h index 58e2b7313..fc6adedf6 100644 --- a/modules/libcom/src/misc/alarm.h +++ b/modules/libcom/src/misc/alarm.h @@ -4,13 +4,17 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* Alarm definitions, must match menuAlarmSevr.dbd and menuAlarmStat.dbd */ -/* - * Authors: Bob Dalesio and Marty Kraimer - * Date: 11-7-90 +/** + * @file alarm.h + * @brief Alarm severity and status/condition values + * @author Bob Dalesio and Marty Kraimer + * + * These alarm definitions must match the related + * menuAlarmSevr.dbd and menuAlarmStat.dbd files + * found in the IOC database module. */ #ifndef INC_alarm_H @@ -22,54 +26,68 @@ extern "C" { #endif - +/** + * @brief The NO_ALARM value can be used as both a severity and a status. + */ #define NO_ALARM 0 -/* ALARM SEVERITIES - must match menuAlarmSevr.dbd */ - +/** + * @brief Alarm severity values + * @note These must match the choices in menuAlarmSevr.dbd + */ typedef enum { - epicsSevNone = NO_ALARM, - epicsSevMinor, - epicsSevMajor, - epicsSevInvalid, - ALARM_NSEV + epicsSevNone = NO_ALARM, /**< No alarm */ + epicsSevMinor, /**< Minor alarm severity */ + epicsSevMajor, /**< Major alarm severity */ + epicsSevInvalid, /**< Invalid alarm severity */ + ALARM_NSEV /**< Number of alarm severities */ } epicsAlarmSeverity; +/** + * @name Original macros for alarm severity values + * @{ + */ #define firstEpicsAlarmSev epicsSevNone #define MINOR_ALARM epicsSevMinor #define MAJOR_ALARM epicsSevMajor #define INVALID_ALARM epicsSevInvalid #define lastEpicsAlarmSev epicsSevInvalid +/** @} */ - -/* ALARM STATUS - must match menuAlarmStat.dbd */ - +/** + * @brief Alarm status/condition values + * @note These must match the choices in menuAlarmStat.dbd + */ typedef enum { - epicsAlarmNone = NO_ALARM, - epicsAlarmRead, - epicsAlarmWrite, - epicsAlarmHiHi, - epicsAlarmHigh, - epicsAlarmLoLo, - epicsAlarmLow, - epicsAlarmState, - epicsAlarmCos, - epicsAlarmComm, - epicsAlarmTimeout, - epicsAlarmHwLimit, - epicsAlarmCalc, - epicsAlarmScan, - epicsAlarmLink, - epicsAlarmSoft, - epicsAlarmBadSub, - epicsAlarmUDF, - epicsAlarmDisable, - epicsAlarmSimm, - epicsAlarmReadAccess, - epicsAlarmWriteAccess, - ALARM_NSTATUS + epicsAlarmNone = NO_ALARM, /**< No alarm */ + epicsAlarmRead, /**< Read alarm (read error) */ + epicsAlarmWrite, /**< Write alarm (write error) */ + epicsAlarmHiHi, /**< High high limit alarm */ + epicsAlarmHigh, /**< High limit alarm */ + epicsAlarmLoLo, /**< Low low limit alarm */ + epicsAlarmLow, /**< Low limit alarm */ + epicsAlarmState, /**< State alarm (e.g. off/on) */ + epicsAlarmCos, /**< Change of state alarm */ + epicsAlarmComm, /**< Communication alarm */ + epicsAlarmTimeout, /**< Timeout alarm */ + epicsAlarmHwLimit, /**< Hardware limit alarm */ + epicsAlarmCalc, /**< Calculation expression error */ + epicsAlarmScan, /**< Scan alarm, e.g. record not processed (10 times) or not in desired scan list */ + epicsAlarmLink, /**< Link alarm */ + epicsAlarmSoft, /**< Soft alarm, e.g. in sub record if subroutine gives error */ + epicsAlarmBadSub, /**< Bad subroutine alarm, e.g. in sub record subroutine not defined */ + epicsAlarmUDF, /**< Undefined value alarm, e.g. record never processed */ + epicsAlarmDisable, /**< Record disabled using DISV/DISA fields */ + epicsAlarmSimm, /**< Record is in simulation mode */ + epicsAlarmReadAccess, /**< Read access permission problem */ + epicsAlarmWriteAccess, /**< Write access permission problem */ + ALARM_NSTATUS /**< Number of alarm conditions */ } epicsAlarmCondition; +/** + * @name Original macros for alarm status/condition values + * @{ + */ #define firstEpicsAlarmCond epicsAlarmNone #define READ_ALARM epicsAlarmRead #define WRITE_ALARM epicsAlarmWrite @@ -93,11 +111,15 @@ typedef enum { #define READ_ACCESS_ALARM epicsAlarmReadAccess #define WRITE_ACCESS_ALARM epicsAlarmWriteAccess #define lastEpicsAlarmCond epicsAlarmWriteAccess +/** @} */ - -/* Name string arrays */ - +/** + * @brief How to convert an alarm severity into a string + */ epicsShareExtern const char *epicsAlarmSeverityStrings [ALARM_NSEV]; +/** + * @brief How to convert an alarm condition/status into a string + */ epicsShareExtern const char *epicsAlarmConditionStrings [ALARM_NSTATUS]; diff --git a/modules/libcom/src/misc/alarmString.h b/modules/libcom/src/misc/alarmString.h index ab320f058..0ac92d74b 100644 --- a/modules/libcom/src/misc/alarmString.h +++ b/modules/libcom/src/misc/alarmString.h @@ -4,13 +4,16 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* - * This file is deprecated, use alarm.h instead. +/** + * @file alarmString.h + * @brief Deprecated, use alarm.h instead * - * Old string names for alarm status and severity values + * How to convert alarm status and severity values into a string for printing. + * + * @note This file is deprecated, use alarm.h instead. */ #ifndef INC_alarmString_H @@ -22,9 +25,13 @@ extern "C" { #endif -/* Old versions of alarmString.h defined these names: */ - +/** + * @brief An alias for epicsAlarmSeverityStrings + */ #define alarmSeverityString epicsAlarmSeverityStrings +/** + * @brief An alias for epicsAlarmConditionStrings + */ #define alarmStatusString epicsAlarmConditionStrings diff --git a/modules/libcom/src/misc/cantProceed.h b/modules/libcom/src/misc/cantProceed.h index 437f96802..4fa91811a 100644 --- a/modules/libcom/src/misc/cantProceed.h +++ b/modules/libcom/src/misc/cantProceed.h @@ -4,8 +4,23 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ + +/** + * @file cantProceed.h + * @brief Routines for code that can't continue or return after an error. + * + * This is the EPICS equivalent of a Kernel Panic, except that the effect + * is to halt only the thread that detects the error. + */ + +/* callocMustSucceed() and mallocMustSucceed() can be + * used in place of calloc() and malloc(). If size or count are zero, or the + * memory allocation fails, they output a message and call cantProceed(). + */ + + #ifndef INCcantProceedh #define INCcantProceedh @@ -18,9 +33,42 @@ extern "C" { #endif -epicsShareFunc void cantProceed(const char *errorMessage, ...) EPICS_PRINTF_STYLE(1,2); -epicsShareFunc void * callocMustSucceed(size_t count, size_t size, const char *errorMessage); +/** @brief Suspend this thread, the caller cannot continue or return. + * + * The effect of calling this is to print the error message followed by + * the name of the thread that is being suspended. A stack trace will + * also be shown if supported by the OS, and the thread is suspended + * inside an infinite loop. + * @param errorMessage A printf-style error message describing the error. + * @param ... Any parameters required for the error message. + */ +epicsShareFunc void cantProceed(const char *errorMessage, ...) + EPICS_PRINTF_STYLE(1,2); + +/** @name Memory Allocation Functions + * These versions of calloc() and malloc() never fail, they suspend the + * thread if the OS is unable to allocate the requested memory at the current + * time. If the thread is resumed, they will re-try the memory allocation, + * and will only return after it succeeds. These routines should only be used + * while an IOC is starting up; code that runs after iocInit() should fail + * gracefully when memory runs out. + */ +/** @{ */ +/** @brief A calloc() that never returns NULL. + * @param count Number of objects. + * @param size Size of each object. + * @param errorMessage What this memory is needed for. + * @return Pointer to zeroed allocated memory. + */ +epicsShareFunc void * callocMustSucceed(size_t count, size_t size, + const char *errorMessage); +/** @brief A malloc() that never returns NULL. + * @param size Size of block to allocate. + * @param errorMessage What this memory is needed for. + * @return Pointer to allocated memory. + */ epicsShareFunc void * mallocMustSucceed(size_t size, const char *errorMessage); +/** @} */ #ifdef __cplusplus } diff --git a/modules/libcom/src/misc/dbDefs.h b/modules/libcom/src/misc/dbDefs.h index e1de3f200..16d3e06eb 100644 --- a/modules/libcom/src/misc/dbDefs.h +++ b/modules/libcom/src/misc/dbDefs.h @@ -4,11 +4,16 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* - * Author: Marty Kraimer - * Date: 6-1-90 + +/** + * @file dbDefs.h + * @author Marty Kraimer + * + * @brief Miscellaneous macro definitions. + * + * This file defines several miscellaneous macros. */ #ifndef INC_dbDefs_H @@ -26,22 +31,31 @@ #endif #define FALSE 0 -/* deprecated, use static */ +/** @brief Deprecated synonym for @c static */ #ifndef LOCAL # define LOCAL static #endif -/* number of elements in an array */ +/** @brief Number of elements in array */ #ifndef NELEMENTS # define NELEMENTS(array) (sizeof (array) / sizeof ((array) [0])) #endif -/* byte offset of member in structure - deprecated, use offsetof */ +/** @brief Deprecated synonym for @c offsetof */ #ifndef OFFSET # define OFFSET(structure, member) offsetof(structure, member) #endif -/* Subtract member byte offset, returning pointer to parent object */ +/** @brief Find parent object from a member pointer + * + * Subtracts the byte offset of the member in the structure from the + * pointer to the member itself, giving a pointer to parent strucure. + * @param ptr Pointer to a member data field of a structure + * @param structure Type name of the parent structure + * @param member Field name of the data member + * @return Pointer to the parent structure + * @note Both GCC and Clang will type-check this macro. + */ #ifndef CONTAINER # ifdef __GNUC__ # define CONTAINER(ptr, structure, member) ({ \ @@ -54,15 +68,18 @@ # endif #endif -/*Process Variable Name Size */ -/* PVNAME_STRINGSZ includes the nil terminator */ +/** @brief Size of a record name including the nil terminator */ #define PVNAME_STRINGSZ 61 +/** @brief Size of a record name without the nil terminator */ #define PVNAME_SZ (PVNAME_STRINGSZ - 1) -/* Buffer size for the string representation of a DBF_*LINK field */ +/** + * @def PVLINK_STRINGSZ + * @brief Buffer size for the string representation of a DBF_*LINK field + */ #define PVLINK_STRINGSZ 1024 -/* dbAccess enums/menus can have up to this many choices */ +/** @brief dbAccess enums/menus can have up to this many choices */ #define DB_MAX_CHOICES 30 #endif /* INC_dbDefs_H */ diff --git a/modules/libcom/src/misc/epicsExit.h b/modules/libcom/src/misc/epicsExit.h index 3e961cbc1..0f1873f8d 100644 --- a/modules/libcom/src/misc/epicsExit.h +++ b/modules/libcom/src/misc/epicsExit.h @@ -7,6 +7,18 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ /*epicsExit.h*/ +/** + * @file epicsExit.h + * + * @brief Extended replacement for the Posix exit and atexit routines. + * + * This is an extended replacement for the Posix exit and atexit routines, which + * also provides a pointer argument to pass to the exit handlers. This facility + * was created because of problems on vxWorks and windows with the implementation + * of atexit, i.e. neither of these systems implement exit and atexit according + * to the POSIX standard. + */ + #ifndef epicsExith #define epicsExith #include @@ -15,15 +27,63 @@ extern "C" { #endif +/** + * @brief Pointer to a callback function that is to be called + * by the epicsExit subsystem. + */ typedef void (*epicsExitFunc)(void *arg); +/** + * @brief Calls epicsExitCallAtExits(), then the OS exit() routine. + * @param status Passed to exit() + */ epicsShareFunc void epicsExit(int status); +/** + * @brief Arrange to call epicsExit() later from a low priority thread. + * + * This delays the actual call to exit() so it doesn't run in this thread. + * @param status Passed to exit() + */ epicsShareFunc void epicsExitLater(int status); +/** + * @brief Internal routine that runs the registered exit routines. + * + * Calls each of the functions registered by prior calls to epicsAtExit + * in reverse order of their registration. + * @note Most applications will not call this routine directly. + */ epicsShareFunc void epicsExitCallAtExits(void); +/** + * @brief Register a function and an associated context parameter + * @param func Function to be called when epicsExitCallAtExits is invoked. + * @param arg Context parameter for the function. + * @param name Function name + */ epicsShareFunc int epicsAtExit3(epicsExitFunc func, void *arg, const char* name); -#define epicsAtExit(F,A) epicsAtExit3(F,A,#F) +/** + * @brief Convenience macro to register a function and context value to be + * run when the process exits. + * @param F Function to be called at process shutdown. + * @param A Context parameter for the function. + */ +#define epicsAtExit(F,A) epicsAtExit3(F,A,#F) +/** + * @brief Internal routine that runs the registered thread exit routines. + * + * Calls each of the functions that were registered in the current thread by + * calling epicsAtThreadExit(), in reverse order of their registration. + * @note This routine is called automatically when an epicsThread's main + * entry routine returns. It will not be run if the thread gets stopped by + * some other method. + */ epicsShareFunc void epicsExitCallAtThreadExits(void); +/** + * @brief Register a function and an context value to be run by this thread + * when it returns from its entry routine. + * @param func Function be called at thread completion. + * @param arg Context parameter for the function. + */ epicsShareFunc int epicsAtThreadExit(epicsExitFunc func, void *arg); diff --git a/modules/libcom/src/misc/epicsExport.h b/modules/libcom/src/misc/epicsExport.h index dea8dd67a..719555eaf 100644 --- a/modules/libcom/src/misc/epicsExport.h +++ b/modules/libcom/src/misc/epicsExport.h @@ -1,5 +1,3 @@ -/*epicsExport.h */ - /*************************************************************************\ * Copyright (c) 2002 The University of Chicago, as Operator of Argonne * National Laboratory. @@ -7,37 +5,122 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -#ifndef INCepicsExporth -#define INCepicsExporth + +#ifndef INC_epicsExport_H +#define INC_epicsExport_H + +/** @file epicsExport.h + * @brief Exporting IOC objects. + * + * This header is unique, as it defines epicsExportSharedSymbols and thus + * triggers a transition between importing declarations from other libraries, + * to exporting symbols from our own library. The comments in shareLib.h + * provide more information. + * + * This header should be included with a trailing comment to make it stand + * out from other includes, something like this: + @code + #include // defines epicsExportSharedSymbols + @endcode + */ + +#define epicsExportSharedSymbols +#include #ifdef __cplusplus extern "C" { #endif -#define epicsExportSharedSymbols -#include - typedef void (*REGISTRAR)(void); -#define EPICS_EXPORT_POBJ(typ,obj) pvar_ ## typ ## _ ## obj -#define EPICS_EXPORT_PFUNC(obj) pvar_func_ ## obj +/** @brief Generate a name for an export object. + * @param typ Object's data type. + * @param obj Object's name. + * @return C identifier for the export object. + */ +#define EPICS_EXPORT_POBJ(typ, obj) pvar_ ## typ ## _ ## obj -#define epicsExportAddress(typ,obj) \ -epicsShareExtern typ *EPICS_EXPORT_POBJ(typ,obj); \ -epicsShareDef typ *EPICS_EXPORT_POBJ(typ,obj) = (typ *)(char *)&obj +/** @brief Generate a name for an export function object. + * @param fun Function's name. + * @return C identifier for the export object. + */ +#define EPICS_EXPORT_PFUNC(fun) EPICS_EXPORT_POBJ(func, fun) -#define epicsExportRegistrar(func) \ -epicsShareFunc REGISTRAR EPICS_EXPORT_PFUNC(func) = (REGISTRAR)(void*)&func +/** @brief Declare an object for exporting. + * + * The epicsExportAddress() macro must be used to declare any IOC object + * that is also named in a DBD file. For example a record support source + * file must contain a statement like: + @code + epicsExportAddress(rset, myRSET); + @endcode + * + * A device support source file must contain a statement like: + @code + epicsExportAddress(dset, devMyName); + @endcode + * Note that the @p typ parameter for a device support entry table must be + * spelled @c dset even if the @p obj was actually declared as some other + * type, say using @c typed_dset . + * + * A driver support source file must contain a statement like: + @code + epicsExportAddress(drvet, drvName); + @endcode + * + * A variable named in a DBD @c variable statement must be declared with: + @code + int myDebug = 0; + epicsExportAddress(int, myDebug); + @endcode + * Only @c int and @c double are currently supported for DBD variables. + * + * @param typ Object's data type. + * @param obj Object's name. + */ +#define epicsExportAddress(typ, obj) \ + epicsShareExtern typ *EPICS_EXPORT_POBJ(typ,obj); \ + epicsShareDef typ *EPICS_EXPORT_POBJ(typ, obj) = (typ *) (char *) &obj -#define epicsRegisterFunction(func) \ -static void register_func_ ## func(void) { \ - registryFunctionAdd(#func,(REGISTRYFUNCTION)func);} \ -epicsExportRegistrar(register_func_ ## func) +/** @brief Declare a registrar function for exporting. + * + * The epicsExportRegistrar() macro must be used to declare a registrar + * function that is named in a DBD \c registrar statement. For example: + @code + static void myRegistrar(void) { + ... + } + epicsExportRegistrar(myRegistrar); + @endcode + * + * @param fun Registrar function's name. + */ +#define epicsExportRegistrar(fun) \ + epicsShareFunc REGISTRAR EPICS_EXPORT_PFUNC(fun) = (REGISTRAR) &fun + +/** @brief Declare and register a function for exporting. + * + * The epicsRegisterFunction() macro must be used to declare and register + * a function that is named in a DBD @c function statement and called by + * one or more subroutine or aSub records. For example: + @code + epicsRegisterFunction(mySubInit); + epicsRegisterFunction(mySubProcess); + @endcode +* + * @param fun Function's name + */ +#define epicsRegisterFunction(fun) \ + static void register_func_ ## fun(void) \ + { \ + registryFunctionAdd(#fun, (REGISTRYFUNCTION) fun); \ + } \ + epicsExportRegistrar(register_func_ ## fun) #ifdef __cplusplus } #endif -#endif /* epicsExporth */ +#endif /* INC_epicsExport_H */ diff --git a/modules/libcom/src/misc/epicsUnitTest.h b/modules/libcom/src/misc/epicsUnitTest.h index b0199333e..28bb55dce 100644 --- a/modules/libcom/src/misc/epicsUnitTest.h +++ b/modules/libcom/src/misc/epicsUnitTest.h @@ -5,8 +5,142 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* - * Author: Andrew Johnson +/** + * @file epicsUnitTest.h + * @brief Unit test routines + * @author Andrew Johnson + * + * The unit test routines make it easy for a test program to generate output + * that is compatible with the Test Anything Protocol and can thus be used with + * Perl's automated Test::Harness as well as generating human-readable output. + * The routines detect whether they are being run automatically and print a + * summary of the results at the end if not. + + * A test program starts with a call to testPlan(), announcing how many tests + * are to be conducted. If this number is not known a value of zero can be + * used during development, but it is recommended that the correct value be + * substituted after the test program has been completed. + * + * Individual test results are reported using any of testOk(), testOk1(), + * testOkV(), testPass() or testFail(). The testOk() call takes and also + * returns a logical pass/fail result (zero means failure, any other value + * is success) and a printf-like format string and arguments which describe + * the test. The convenience macro testOk1() is provided which stringifies its + * single condition argument, reducing the effort needed when writing test + * programs. The individual testPass() and testFail() routines can be used when + * the test program takes a different path on success than on failure, but one + * or other must always be called for any particular test. The testOkV() routine + * is a varargs form of testOk() included for internal purposes which may prove + * useful in some cases. + * + * If some program condition or failure makes it impossible to run some tests, + * the testSkip() routine can be used to indicate how many tests are being omitted + * from the run, thus keeping the test counts correct; the constant string why is + * displayed as an explanation to the user (this string is not printf-like). + * + * If some tests are expected to fail because functionality in the module under + * test has not yet been fully implemented, these tests may still be executed, + * wrapped between calls to testTodoBegin() and testTodoEnd(). testTodoBegin() + * takes a constant string indicating why these tests are not expected to + * succeed. This modifies the counting of the results so the wrapped tests will not + * be recorded as failures. + * + * Additional information can be supplied using the testDiag() routine, which + * displays the relevent information as a comment in the result output. None of + * the printable strings passed to any testXxx() routine should contain a newline + * '\n' character, newlines will be added by the test routines as part of the + * Test Anything Protocol. For multiple lines of diagnostic output, call + * testDiag() as many times as necessary. + * + * If at any time the test program is unable to continue for some catastrophic + * reason, calling testAbort() with an appropriate message will ensure that the + * test harness understands this. testAbort() does not return, but calls the ANSI + * C routine abort() to cause the program to stop immediately. + * + * After all of the tests have been completed, the return value from + * testDone() can be used as the return status code from the program's main() + * routine. + * + * On vxWorks and RTEMS, an alternative test harness can be used to run a + * series of tests in order and summarize the results from them all at the end + * just like the Perl harness does. The routine testHarness() is called once at + * the beginning of the test harness program. Each test program is run by + * passing its main routine name to the runTest() macro which expands into a call + * to the runTestFunc() routine. The last test program or the harness program + * itself must finish by calling testHarnessDone() which triggers the summary + * mechanism to generate its result outputs (from an epicsAtExit() callback + * routine). + * + * ### IOC Testing + * + * Some tests require the context of an IOC to be run. This conflicts with the + * idea of running multiple tests within a test harness, as iocInit() is only + * allowed to be called once, and some parts of the full IOC (e.g. the rsrv CA + * server) can not be shut down cleanly. The function iocBuildIsolated() allows + * to start an IOC without its Channel Access parts, so that it can be shutdown + * quite cleanly using iocShutdown(). This feature is only intended to be used + * from test programs, do not use it on productional IOCs. After building the + * IOC using iocBuildIsolated() or iocBuild(), it has to be started by calling + * iocRun(). The suggested call sequence in a test program that needs to run the + * IOC without Channel Access is: +@code +#include "iocInit.h" + +MAIN(iocTest) +{ + iocBuildIsolated() || iocRun(); + + ... test code ... + + iocShutdown(); + dbFreeBase(pdbbase); + registryFree(); + pdbbase = NULL; + return testDone(); +} +@endcode + + * The part from iocBuildIsolated() to iocShutdown() can be repeated to + * execute multiple tests within one executable or harness. + * + * To make it easier to create a single test program that can be built for + * both the embedded and workstation operating system harnesses, the header file + * testMain.h provides a convenience macro MAIN() that adjusts the name of the + * test program according to the platform it is running on: main() on + * workstations and a regular function name on embedded systems. + * + * ### Example + * + * The following is a simple example of a test program using the epicsUnitTest + * routines: +@code +#include +#include "epicsUnitTest.h" +#include "testMain.h" + +MAIN(mathTest) +{ + testPlan(3); + testOk(sin(0.0) == 0.0, "Sine starts"); + testOk(cos(0.0) == 1.0, "Cosine continues"); + if (!testOk1(M_PI == 4.0*atan(1.0))) + testDiag("4 * atan(1) = %g", 4.0 * atan(1.0)); + return testDone(); +} +@endcode + + * The output from running the above program looks like this: +@code +1..3 +ok 1 - Sine starts +ok 2 - Cosine continues +ok 3 - M_PI == 4.0*atan(1.0) + + Results + ======= + Tests: 3 + Passed: 3 = 100% +@endcode */ #ifndef INC_epicsUnitTest_H @@ -21,35 +155,111 @@ extern "C" { #endif +/** @brief Declare the test plan, required. + * @param tests Number of tests to be run. May be zero if not known but the + * test harness then can't tell if the program dies prematurely. + */ epicsShareFunc void testPlan(int tests); -epicsShareFunc int testOkV(int pass, const char *fmt, va_list pvar); -epicsShareFunc int testOk(int pass, const char *fmt, ...) - EPICS_PRINTF_STYLE(2, 3); -epicsShareFunc void testPass(const char *fmt, ...) - EPICS_PRINTF_STYLE(1, 2); -epicsShareFunc void testFail(const char *fmt, ...) - EPICS_PRINTF_STYLE(1, 2); -epicsShareFunc void testSkip(int skip, const char *why); -epicsShareFunc void testTodoBegin(const char *why); -epicsShareFunc void testTodoEnd(void); -epicsShareFunc int testDiag(const char *fmt, ...) - EPICS_PRINTF_STYLE(1, 2); -epicsShareFunc void testAbort(const char *fmt, ...) - EPICS_PRINTF_STYLE(1, 2); -epicsShareFunc int testDone(void); +/** @name Announcing Test Results + * Routines that declare individual test results. + */ +/** @{ */ +/** @brief Test result with printf-style description. + * @param pass True/False value indicating result. + * @param fmt A printf-style format string describing the test. + * @param ... Any parameters required for the format string. + * @return The value of \p pass. + */ +epicsShareFunc int testOk(int pass, const char *fmt, ...) + EPICS_PRINTF_STYLE(2, 3); +/** @brief Test result using condition as description + * @param cond Condition to be evaluated and displayed. + * @return The value of \p cond. + */ #define testOk1(cond) testOk(cond, "%s", #cond) +/** @brief Test result with var-args description. + * @param pass True/False value indicating result. + * @param fmt A printf-style format string describing the test. + * @param pvar A var-args pointer to any parameters for the format string. + * @return The value of \p pass. + */ +epicsShareFunc int testOkV(int pass, const char *fmt, va_list pvar); +/** @brief Passing test result with printf-style description. + * @param fmt A printf-style format string describing the test. + * @param ... Any parameters required for the format string. + * @return The value of \p pass. + */ +epicsShareFunc void testPass(const char *fmt, ...) + EPICS_PRINTF_STYLE(1, 2); +/** @brief Failing test result with printf-style description. + * @param fmt A printf-style format string describing the test. + * @param ... Any parameters required for the format string. + */ +epicsShareFunc void testFail(const char *fmt, ...) + EPICS_PRINTF_STYLE(1, 2); +/** @} */ + +/** @name Missing or Failing Tests + * @brief Routines for handling special situations. + */ +/** @{ */ + +/** @brief Place-holders for tests that can't be run. + * @param skip How many tests are being skipped. + * @param why Reason for skipping these tests. + */ +epicsShareFunc void testSkip(int skip, const char *why); +/** @brief Mark the start of a group of tests that are expected to fail + * @param why Reason for expected failures. + */ +epicsShareFunc void testTodoBegin(const char *why); +/** @brief Mark the end of a failing test group. + */ +epicsShareFunc void testTodoEnd(void); +/** @brief Stop testing, program cannot continue. + * @param fmt A printf-style format string giving the reason for stopping. + * @param ... Any parameters required for the format string. + */ +epicsShareFunc void testAbort(const char *fmt, ...) + EPICS_PRINTF_STYLE(1, 2); +/** @} */ + +/** @brief Output additional diagnostics + * @param fmt A printf-style format string containing diagnostic information. + * @param ... Any parameters required for the format string. + */ +epicsShareFunc int testDiag(const char *fmt, ...) + EPICS_PRINTF_STYLE(1, 2); +/** @brief Mark the end of testing. + */ +epicsShareFunc int testDone(void); epicsShareFunc int testImpreciseTiming(void); +/** @name Test Harness for Embedded OSs + * These routines are used to create a test-harness that can run + * multiple test programs, collect their names and results, then + * display a summary at the end of testing. + */ +/** @{ */ + typedef int (*TESTFUNC)(void); +/** @brief Initialize test harness + */ epicsShareFunc void testHarness(void); epicsShareFunc void testHarnessExit(void *dummy); epicsShareFunc void runTestFunc(const char *name, TESTFUNC func); +/** @brief Run a test program + * @param func Name of the test program. + */ #define runTest(func) runTestFunc(#func, func) +/** @brief Declare all test programs finished + */ #define testHarnessDone() testHarnessExit(0) +/** @} */ #ifdef __cplusplus } diff --git a/modules/libcom/src/misc/shareLib.h b/modules/libcom/src/misc/shareLib.h index 0d376d64a..22f6fa235 100644 --- a/modules/libcom/src/misc/shareLib.h +++ b/modules/libcom/src/misc/shareLib.h @@ -4,38 +4,48 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* - * Compiler specific key words to set up external symbols and entry points +/** + * @file shareLib.h + * @brief Mark external symbols and entry points for shared libraries. + * + * This is the header file for the "decorated names" that appear in + * header files, e.g. + * + * #define epicsExportSharedSymbols + * epicsShareFunc int epicsShareAPI a_func(int arg); + * + * These are needed to properly create DLLs on MS Windows. + * + * ### USAGE * - * USAGE: * There are two distinct classes of keywords in this file: * - * 1) epicsShareAPI - specifies a multi-language calling mechanism. On windows + * -# epicsShareAPI - specifies a multi-language calling mechanism. On windows * this is the pascal calling convention which is used by visual basic and other * high level tools. This is only necessary if a C/C++ function needs to be called * from other languages or from high level tools. The epicsShareAPI keyword - * must be present between the function's returned data type and the function's - * name. All compilers targeting windows accept the __stdcall keyword in this + * must be present between the function's returned data type and the function's + * name. All compilers targeting windows accept the __stdcall keyword in this * location. Functions with variable argument lists should not use the epicsShareAPI * keyword because __stdcall (pascal) calling convention cannot support variable * length ed argument lists. * - * int epicsShareAPI myExtFunc ( int arg ); - * int epicsShareAPI myExtFunc ( int arg ) {} + * int epicsShareAPI myExtFunc ( int arg ); + * int epicsShareAPI myExtFunc ( int arg ) {} * - * ** NOTE ** The epicsShareAPI attribute is deprecated and has been removed + * @note The epicsShareAPI attribute is deprecated and has been removed * from all IOC-specific APIs. Most libCom APIs still use it, but * it may get removed from these at some point in the future. * - * 2) epicsShare{Func,Class,Extern,Def} - specifies shareable library (DLL) - * export/import related information in the source code. On windows these keywords - * allow faster dispatching of calls to DLLs because more is known at compile time. + * -# epicsShare{Func,Class,Extern,Def} - specifies shareable library (DLL) + * export/import related information in the source code. On windows these keywords + * allow faster dispatching of calls to DLLs because more is known at compile time. * It is also not necessary to maintain a linker input files specifying the DLL - * entry points. This maintenance can be more laborious with C++ decorated symbol - * names. These keywords are only necessary if the address of a function or data - * internal to a shareable library (DLL) needs to be visible outside of this shareable + * entry points. This maintenance can be more laborious with C++ decorated symbol + * names. These keywords are only necessary if the address of a function or data + * internal to a shareable library (DLL) needs to be visible outside of this shareable * library (DLL). All compilers targeting windows accept the __declspec(dllexport) * and __declspec(dllimport) keywords. For GCC version 4 and above the first three * keywords specify a visibility attribute of "default", which marks the symbol as @@ -43,23 +53,23 @@ * significantly reduce the number of symbols exported to a shared library. See the * URL below for more information. * - * In header files declare references to externally visible variables, classes and + * In header files declare references to externally visible variables, classes and * functions like this: * - * #include "shareLib.h" - * epicsShareFunc int myExtFunc ( int arg ); - * epicsShareExtern int myExtVar; - * class epicsShareClass myClass { int func ( void ); }; + * #include "shareLib.h" + * epicsShareFunc int myExtFunc ( int arg ); + * epicsShareExtern int myExtVar; + * class epicsShareClass myClass { int func ( void ); }; * * In the implementation file, however, you write: * - * #include - * #define epicsExportSharedSymbols - * #include + * #include + * #define epicsExportSharedSymbols + * #include * - * epicsShareDef int myExtVar = 4; - * int myExtFunc ( int arg ) {} - * int myClass::func ( void ) {} + * epicsShareDef int myExtVar = 4; + * int myExtFunc ( int arg ) {} + * int myClass::func ( void ) {} * * By default shareLib.h sets the DLL import / export keywords to import from * a DLL so that, for DLL consumers (users), nothing special must be done. However, @@ -67,34 +77,42 @@ * which functions are exported from the DLL and which of them are imported * from other DLLs. * - * You must first #include what you import and then define epicsExportSharedSymbols - * only right before you #include the prototypes for what you implement! You must - * include shareLib.h again each time that the state of the import/ export keywords - * changes, but this usually occurs as a side effect of including the shareable - * libraries header file(s). + * You must first @c \#include what you import and then @c \#define + * @c epicsExportSharedSymbols only right before you @c \#include the + * prototypes for what you implement! You must include shareLib.h again each + * time that the state of the import/export keywords changes, but this + * usually occurs as a side effect of including the shareable libraries header + * file(s). * - * Frequently a header file for a shareable library exported interface will - * have some preprocessor switches like this if this header file must also + * ### Deprecated Usage + * + * The construct described below is used in some EPICS header files bit is + * no longer recommended as it makes it difficult to diagnose the incorrect + * inclusion of headers that are the wrong side of an \c epicsExportSharedSymbols + * marker. + * + * Sometimes a header file for a shareable library exported interface will + * have some preprocessor switches like this if this header file must also * include header files describing interfaces to other shareable libraries. * - * #ifdef epicsExportSharedSymbols - * # define interfacePDQ_epicsExportSharedSymbols - * # undef epicsExportSharedSymbols - * #endif + * #ifdef epicsExportSharedSymbols + * # define interfacePDQ_epicsExportSharedSymbols + * # undef epicsExportSharedSymbols + * #endif * - * #include "epicsTypes.h" - * #include "epicsTime.h" + * #include "epicsTypes.h" + * #include "epicsTime.h" * - * #ifdef interfacePDQ_epicsExportSharedSymbols - * # define epicsExportSharedSymbols - * # include "shareLib.h" - * #endif + * #ifdef interfacePDQ_epicsExportSharedSymbols + * # define epicsExportSharedSymbols + * # include "shareLib.h" + * #endif * - * epicsShareFunc int myExtFunc ( int arg ); - * epicsShareExtern int myExtVar; - * class epicsShareClass myClass {}; + * epicsShareFunc int myExtFunc ( int arg ); + * epicsShareExtern int myExtVar; + * class epicsShareClass myClass {}; * - * Fortunately, the above is only the concern of library authors and will have no + * Fortunately, the above is only the concern of library authors and will have no * impact on persons using functions and or external data from a library. */ @@ -132,7 +150,7 @@ # define epicsShareFunc # endif # endif -# define epicsShareDef +# define epicsShareDef # define epicsShareAPI __stdcall /* function removes arguments */ # define READONLY const @@ -162,18 +180,18 @@ */ #elif defined(VAXC) - /* + /* * VAXC creates FORTRAN common blocks when * we use "extern int fred"/"int fred=4". Therefore, * the initialization is not loaded unless we * call a function in that object module. * * DEC CXX does not have this problem. - * We suspect (but do not know) that DEC C + * We suspect (but do not know) that DEC C * also does not have this problem. */ -# define epicsShareExtern globalref -# define epicsShareDef globaldef +# define epicsShareExtern globalref +# define epicsShareDef globaldef # define READONLY const # define epicsShareClass # define epicsShareFunc diff --git a/modules/libcom/src/osi/compilerDependencies.h b/modules/libcom/src/osi/compilerDependencies.h index 0b333d74e..dc089ced8 100644 --- a/modules/libcom/src/osi/compilerDependencies.h +++ b/modules/libcom/src/osi/compilerDependencies.h @@ -7,10 +7,11 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* - * Author: - * Jeffrey O. Hill - * johill@lanl.gov +/** + * @file compilerDependencies.h + * @author Jeffrey O. Hill johill@lanl.gov + * @brief Compiler specific declarations + * */ #ifndef compilerDependencies_h diff --git a/modules/libcom/src/osi/devLib.h b/modules/libcom/src/osi/devLib.h index 729f9b932..8b0735058 100644 --- a/modules/libcom/src/osi/devLib.h +++ b/modules/libcom/src/osi/devLib.h @@ -8,93 +8,125 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* devLib.h */ -/* - * Original Author: Marty Kraimer - * Author: Jeff Hill - * Date: 03-10-93 +/** + * @file devLib.h + * @brief API for accessing hardware devices, originally over VMEbus + * @author Marty Kraimer and Jeff Hill + * + * Support for allocation of common device resources */ #ifndef EPICSDEVLIB_H #define EPICSDEVLIB_H -/* - * Support macros - */ - -/* - * Normalize a digital value and convert it to type TYPE - * - * Ex: - * float f; - * int d; - * f = devNormalizeDigital(d,12) - * +/** + * @name Macros for normalizing values + * @warning Deprecated, we don't know of any code currently using these. + * @{ */ +/** @brief Create a bit mask for a given number of bits */ #define devCreateMask(NBITS) ((1<<(NBITS))-1) +/** @brief Normalize a raw integer value and convert it to type double */ #define devDigToNml(DIGITAL,NBITS) \ (((double)(DIGITAL))/devCreateMask(NBITS)) +/** @brief Convert a normalized value to a raw integer */ #define devNmlToDig(NORMAL,NBITS) \ (((long)(NORMAL)) * devCreateMask(NBITS)) + /** @} */ -/* - * - * Alignment mask - * (for use when testing to see if the proper number of least - * significant bits are zero) - * +/** + * @name Macros for pointer alignment + * @warning Deprecated, we don't know of any code currently using these. + * @{ */ +/** @brief Create an alignment mask for CTYPE */ #define devCreateAlignmentMask(CTYPE)\ (sizeof(CTYPE)>sizeof(double)?sizeof(double)-1:sizeof(CTYPE)-1) -/* - * pointer aligned test - * (returns true if the pointer is on the worst case alignemnt - * boundary for its type) +/** @brief Check Pointer alignment, returns true if the pointer @c PTR + * is suitably aligned for its data type */ #define devPtrAlignTest(PTR) (!(devCreateAlignmentMask(*PTR)&(long)(PTR))) +/** @} */ -/* - * error codes (and messages) associated with devLib.c +/** + * @name Error status values returned by devLib routines + * @{ */ #define S_dev_success 0 -#define S_dev_vectorInUse (M_devLib| 1) /*interrupt vector in use*/ -#define S_dev_vecInstlFail (M_devLib| 2) /*interrupt vector install failed*/ -#define S_dev_uknIntType (M_devLib| 3) /*Unrecognized interrupt type*/ +/** @brief Interrupt vector in use */ +#define S_dev_vectorInUse (M_devLib| 1) /*Interrupt vector in use*/ +/** @brief Interrupt vector install failed */ +#define S_dev_vecInstlFail (M_devLib| 2) /*Interrupt vector install failed*/ +/** @brief Unrecognized interrupt type */ +#define S_dev_uknIntType (M_devLib| 3) /*Unrecognized interrupt type*/ +/** @brief Interrupt vector not in use by caller */ #define S_dev_vectorNotInUse (M_devLib| 4) /*Interrupt vector not in use by caller*/ +/** @brief Invalid VME A16 address */ #define S_dev_badA16 (M_devLib| 5) /*Invalid VME A16 address*/ +/** @brief Invalid VME A24 address */ #define S_dev_badA24 (M_devLib| 6) /*Invalid VME A24 address*/ +/** @brief Invalid VME A32 address */ #define S_dev_badA32 (M_devLib| 7) /*Invalid VME A32 address*/ +/** @brief Unrecognized address space type */ #define S_dev_uknAddrType (M_devLib| 8) /*Unrecognized address space type*/ -#define S_dev_addressOverlap (M_devLib| 9) /*Specified device address overlaps another device*/ -#define S_dev_identifyOverlap (M_devLib| 10) /*This device already owns the address range*/ -#define S_dev_addrMapFail (M_devLib| 11) /*unable to map address*/ -#define S_dev_intDisconnect (M_devLib| 12) /*Interrupt at vector disconnected from an EPICS device*/ -#define S_dev_internal (M_devLib| 13) /*Internal failure*/ -#define S_dev_intEnFail (M_devLib| 14) /*unable to enable interrupt level*/ -#define S_dev_intDissFail (M_devLib| 15) /*unable to disable interrupt level*/ -#define S_dev_noMemory (M_devLib| 16) /*Memory allocation failed*/ -#define S_dev_addressNotFound (M_devLib| 17) /*Specified device address unregistered*/ +/** @brief Specified device address overlaps another device */ +#define S_dev_addressOverlap (M_devLib| 9) /*Specified device address overlaps another device*/ +/** @brief This device already owns the address range */ +#define S_dev_identifyOverlap (M_devLib| 10) /*This device already owns the address range*/ +/** @brief Unable to map address */ +#define S_dev_addrMapFail (M_devLib| 11) /*Unable to map address*/ +/** @brief Interrupt at vector disconnected from an EPICS device */ +#define S_dev_intDisconnect (M_devLib| 12) /*Interrupt at vector disconnected from an EPICS device*/ +/** @brief Internal failure */ +#define S_dev_internal (M_devLib| 13) /*Internal failure*/ +/** @brief Unable to enable interrupt level */ +#define S_dev_intEnFail (M_devLib| 14) /*Unable to enable interrupt level*/ +/** @brief Unable to disable interrupt level */ +#define S_dev_intDissFail (M_devLib| 15) /*Unable to disable interrupt level*/ +/** @brief Memory allocation failed */ +#define S_dev_noMemory (M_devLib| 16) /*Memory allocation failed*/ +/** @brief Specified device address unregistered */ +#define S_dev_addressNotFound (M_devLib| 17) /*Specified device address unregistered*/ +/** @brief No device at specified address */ #define S_dev_noDevice (M_devLib| 18) /*No device at specified address*/ +/** @brief Wrong device type found at specified address */ #define S_dev_wrongDevice (M_devLib| 19) /*Wrong device type found at specified address*/ +/** @brief Signal number (offset) to large */ #define S_dev_badSignalNumber (M_devLib| 20) /*Signal number (offset) to large*/ +/** @brief Signal count to large */ #define S_dev_badSignalCount (M_devLib| 21) /*Signal count to large*/ +/** @brief Device does not support requested operation */ #define S_dev_badRequest (M_devLib| 22) /*Device does not support requested operation*/ -#define S_dev_highValue (M_devLib| 23) /*Parameter to high*/ -#define S_dev_lowValue (M_devLib| 24) /*Parameter to low*/ +/** @brief Parameter too high */ +#define S_dev_highValue (M_devLib| 23) /*Parameter too high*/ +/** @brief Parameter too low */ +#define S_dev_lowValue (M_devLib| 24) /*Parameter too low*/ +/** @brief Specified address is ambiguous (more than one device responds) */ #define S_dev_multDevice (M_devLib| 25) /*Specified address is ambiguous (more than one device responds)*/ +/** @brief Device self test failed */ #define S_dev_badSelfTest (M_devLib| 26) /*Device self test failed*/ +/** @brief Device failed during initialization */ #define S_dev_badInit (M_devLib| 27) /*Device failed during initialization*/ +/** @brief Input exceeds Hardware Limit */ #define S_dev_hdwLimit (M_devLib| 28) /*Input exceeds Hardware Limit*/ +/** @brief Unable to locate address space for device */ #define S_dev_deviceDoesNotFit (M_devLib| 29) /*Unable to locate address space for device*/ -#define S_dev_deviceTMO (M_devLib| 30) /*device timed out*/ -#define S_dev_badFunction (M_devLib| 31) /*bad function pointer*/ -#define S_dev_badVector (M_devLib| 32) /*bad interrupt vector*/ -#define S_dev_badArgument (M_devLib| 33) /*bad function argument*/ +/** @brief Device timed out */ +#define S_dev_deviceTMO (M_devLib| 30) /*Device timed out*/ +/** @brief Bad function pointer */ +#define S_dev_badFunction (M_devLib| 31) /*Bad function pointer*/ +/** @brief Bad interrupt vector */ +#define S_dev_badVector (M_devLib| 32) /*Bad interrupt vector*/ +/** @brief Bad function argument */ +#define S_dev_badArgument (M_devLib| 33) /*Bad function argument*/ +/** @brief Invalid ISA address */ #define S_dev_badISA (M_devLib| 34) /*Invalid ISA address*/ +/** @brief Invalid VME CR/CSR address */ #define S_dev_badCRCSR (M_devLib| 35) /*Invalid VME CR/CSR address*/ +/** @brief Synonym for S_dev_intEnFail */ #define S_dev_vxWorksIntEnFail S_dev_intEnFail - +/** @} */ #endif /* EPICSDEVLIB_H */ diff --git a/modules/libcom/src/osi/devLibVME.h b/modules/libcom/src/osi/devLibVME.h index 4fb17f0c2..45db8f473 100644 --- a/modules/libcom/src/osi/devLibVME.h +++ b/modules/libcom/src/osi/devLibVME.h @@ -4,14 +4,23 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* devLib.h */ -/* - * Original Author: Marty Kraimer - * Author: Jeff Hill - * Date: 03-10-93 +/** + * @file devLibVME.h + * @author Marty Kraimer, Jeff Hill + * @brief API for accessing hardware devices, mosty over VMEbus. + * + * API for accessing hardware devices. The original APIs here were for + * written for use with VMEbus but additional routines were added for + * ISA-bus (but not fully implemented inside EPICS Base and may never + * have been actually used). + * + * If all VMEbus drivers register with these routines then addressing + * conflicts caused by multiple device/drivers trying to use the same + * VME addresses will be detected. This API also makes it easy for a + * single driver to be written that works on both VxWorks and RTEMS. */ #ifndef INCdevLibh @@ -27,23 +36,17 @@ extern "C" { #endif -/* - * epdevAddressType & EPICStovxWorksAddrType - * devLib.c must change in unison - */ +/** @brief The available bus address types */ typedef enum { - atVMEA16, - atVMEA24, - atVMEA32, - atISA, /* memory mapped ISA access (until now only on PC) */ - atVMECSR, /* VME-64 CR/CSR address space */ - atLast /* atLast must be the last enum in this list */ - } epicsAddressType; + atVMEA16, /**< @brief VME short I/O. */ + atVMEA24, /**< @brief VME standard I/O. */ + atVMEA32, /**< @brief VME extended I/O. */ + atISA, /**< @brief Memory mapped ISA access. */ + atVMECSR, /**< @brief VME-64 CR/CSR address space. */ + atLast /**< @brief Invalid, must be the last entry. */ +} epicsAddressType; -/* - * pointer to an array of strings for each of - * the above address types - */ +/** @brief A string representation of each of the bus address types */ epicsShareExtern const char *epicsAddressTypeName[]; #ifdef __cplusplus @@ -61,41 +64,54 @@ epicsShareExtern const char *epicsAddressTypeName[]; extern "C" { #endif -/* - * General API +/** @brief Print a map of registered bus addresses. * - * This section applies to all bus types + * Display a table of registsred bus address ranges, including the owner of + * each registered address. + * @return 0, or an error status value */ +epicsShareFunc long devAddressMap(void); -epicsShareFunc long devAddressMap(void); /* print an address map */ - -/* - * devBusToLocalAddr() +/** @brief Translate a bus address to a pointer the CPU can use. * - * OSI routine to translate bus addresses their local CPU address mapping + * Given a bus address, returns a pointer to that location in the CPU's + * memory map, or an error if direct access isn't currently possible. + * @param addrType The bus address type. + * @param busAddr Bus address to be translated. + * @param *ppLocalAddr Where to put the CPU pointer. + * @return 0, or an error status value. */ epicsShareFunc long devBusToLocalAddr ( epicsAddressType addrType, size_t busAddr, volatile void **ppLocalAddr); -/* - * devReadProbe() + +/** @brief Probe the bus for reading from a specific address. * - * a bus error safe "wordSize" read at the specified address which returns - * unsuccessful status if the device isnt present + * Performs a bus-error-safe @c wordSize atomic read from a specific + * address and returns an error if this caused a bus error. + * @param wordSize The word size to read: 1, 2, 4 or 8 bytes. + * @param ptr Pointer to the location in the CPU's memory map to read. + * @param pValueRead Where to put the value read. + * @return 0, or an error status value if the location could not be + * accessed or the read caused a bus error. */ epicsShareFunc long devReadProbe ( unsigned wordSize, volatile const void *ptr, void *pValueRead); -/* - * devNoResponseProbe() +/** @brief Read-probe a range of bus addresses, looking for empty space. * - * Verifies that no devices respond at naturally aligned words - * within the specified address range. Return success if no devices - * respond. Returns an error if a device does respond or if - * a physical address for a naturally aligned word cant be mapped. - * Checks all naturally aligned word sizes between char and long for - * the entire specified range of bytes. + * Verifies that no device responds at any naturally aligned addresses + * within the given range. Tries to read every aligned address at every + * word size between char and long over the entire range, returning + * success only if none of the reads succeed. + * @warning This routine may be slow and have a very bad effect on a busy + * VMEbus. Every read probe of an unused address will hold onto the VMEbus + * for the global bus timeout period. + * @param addrType The bus address type. + * @param base First address base to probe. + * @param size Range of bus addresses to test, in bytes. + * @return 0 if no devices respond, or an error status value. */ epicsShareFunc long devNoResponseProbe( epicsAddressType addrType, @@ -103,29 +119,71 @@ epicsShareFunc long devNoResponseProbe( size_t size ); -/* - * devWriteProbe +/** @brief Probe the bus for writing to a specific address. * - * a bus error safe "wordSize" write at the specified address which returns - * unsuccessful status if the device isnt present + * Performs a bus-error-safe @c wordSize atomic write to a specific + * address and returns an error if this caused a bus error. + * @param wordSize The word size to write: 1, 2, 4 or 8 bytes. + * @param ptr Pointer to the location in the CPU's memory map to write to. + * @param pValueWritten The value to write. + * @return 0, or an error status value if the location could not be + * accessed or the write caused a bus error. */ epicsShareFunc long devWriteProbe ( unsigned wordSize, volatile void *ptr, const void *pValueWritten); +/** @brief Register a bus address range with a name. + * + * The devLib code keeps a list of all bus address ranges registered with + * this routine and returns an error if a later call attempts to register + * any addresses that overlap with a range already registered. The call to + * registering a range also converts the given base address into a pointer + * in the CPU address space for the driver to use (see devBusToLocalAddr()). + * @param pOwnerName Name of a driver that will own this range. + * @param addrType The bus address type. + * @param logicalBaseAddress The bus start address. + * @param size Number of bytes to reserve. + * @param pPhysicalAddress Where to put the converted CPU pointer. + * @return 0, or an error status. + */ epicsShareFunc long devRegisterAddress( const char *pOwnerName, epicsAddressType addrType, size_t logicalBaseAddress, - size_t size, /* bytes */ + size_t size, volatile void **pPhysicalAddress); +/** @brief Release a bus address range previously registered. + * + * Release an address range that was previously registered by a call to + * devRegisterAddress() or devAllocAddress(). + * @param addrType The bus address type. + * @param logicalBaseAddress The bus start address. + * @param pOwnerName The name of the driver that owns this range. + * @return 0, or an error status. + */ epicsShareFunc long devUnregisterAddress( epicsAddressType addrType, size_t logicalBaseAddress, const char *pOwnerName); -/* - * allocate and register an unoccupied address block +/** @brief Allocate and register an unoccupied address block. + * + * Asks devLib to allocate an address block of a particular address type. + * This is useful for devices that appear in more than one address space + * and can program the base address of one window using registers found + * in another window. As with devRegisterAddress() this call also converts + * the new base address into a pointer in the CPU address space for the + * driver to use (see devBusToLocalAddr()). + * @note This routine calls devNoResponseProbe() to find an unoccupied + * block in the bus address space, so using it may have a bad effect on a + * busy VMEbus at allocation time; see the warning above. + * @param pOwnerName Name of a driver that will own this range. + * @param addrType The bus address type. + * @param size Number of bytes to be allocated. + * @param alignment How many low bits in the address must all be zero. + * @param pLocalAddress Where to put the CPU pointer. + * @return 0, or an error status value. */ epicsShareFunc long devAllocAddress( const char *pOwnerName, @@ -134,117 +192,185 @@ epicsShareFunc long devAllocAddress( unsigned alignment, /*n ls bits zero in addr*/ volatile void **pLocalAddress); -/* - * VME API - * - * Functions in this section apply only to the VME bus type +/** @name VME Interrupt Management + * Routines to manage VME interrupts. + * @{ */ - -/* - * connect ISR to a VME interrupt vector +/** @brief Connect an ISR up to a VME interrupt vector. + * + * Interrupt Service Routines (ISRs) are normally written in C, and get + * passed a context parameter given with them to this connection routine. + * + * There are many restrictions on the routines that an ISR may call; see + * epicsEvent.h, epicsInterrupt.h, epicsMessageQueue.h, epicsRingBytes.h, + * epicsRingPointer.h and epicsTime.h for some APIs known to be suitable. + * It is safest just to trigger a high-priority task to handle any + * complex work that must happen as a result of the interrupt. + * @param vectorNumber VME interrupt vector number. + * @param pFunction The ISR to be called. + * @param parameter Context parameter for the ISR. + * @return 0, or an error status value. */ epicsShareFunc long devConnectInterruptVME( unsigned vectorNumber, void (*pFunction)(void *), void *parameter); -/* - * disconnect ISR from a VME interrupt vector +/** @brief Disconnect an ISR from its VME interrupt vector. * - * The parameter pFunction should be set to the C function pointer that - * was connected. It is used as a key to prevent a driver from inadvertently - * removing an interrupt handler that it didn't install + * Device drivers may disconnect an ISR they connected earlier using this + * routine. In addition to taking the @c vectorNumber the ISR itself is + * required and used as a check to prevent a driver from inadvertently + * removing an interrupt handler that it didn't install. + * + * On a PowerPC target running VxWorks, this routine will always return + * with an error status. + * @param vectorNumber VME interrupt vector number. + * @param pFunction The ISR to be disconnected. + * @return 0, or an error status value. */ epicsShareFunc long devDisconnectInterruptVME( unsigned vectorNumber, void (*pFunction)(void *)); -/* - * determine if a VME interrupt vector is in use +/** @brief Determine if a VME interrupt vector is in use. * - * returns boolean + * On a PowerPC target running VxWorks this routine will always return + * false, indicating that a vector is unused. + * @param vectorNumber Interrupt vector number. + * @return True if vector has an ISR attached, otherwise false. */ epicsShareFunc int devInterruptInUseVME (unsigned vectorNumber); -/* - * enable VME interrupt level +/** @brief Enable a VME interrupt level onto the CPU. + * + * The VMEbus allows multiple CPU boards to be installed in the same + * backplane. When this is done, the differente VME interrupt levels + * must be assigned to the CPUs since they cannot be shared. This + * routine tells the VME interface that it should connect interrupts + * from the indicated interrupt level to a CPU interrupt line. + * @param level VMEbus interrupt level to enable, 1-7. + * @return 0, or an error status value. */ epicsShareFunc long devEnableInterruptLevelVME (unsigned level); -/* - * disable VME interrupt level +/** @brief Disable a VME interrupt level. + * + * This routine is the reverse of devEnableInterruptLevelVME(). + * @note This routine should not normally be used, even by a + * driver that enabled the interrupt level. Disabling a VME + * interrupt level should only be done by software that knows + * for certain that no other interrupting device is also using + * that VME interrupt level. + * @param level VMEbus interrupt level to disable, 1-7. + * @return 0, or an error status value. */ epicsShareFunc long devDisableInterruptLevelVME (unsigned level); +/** @} */ -/* - * Routines to allocate and free memory in the A24 memory region. - * +/** @name Memory for VME DMA Operations + * These routines manage memory that can be directly accessed + * from the VMEbus in the A24 address space by another bus master + * such as a DMA controller. + * @{ + */ +/** @brief malloc() for VME drivers that support DMA. + * + * Allocate memory of a given size from a region that can be + * accessed from the VMEbus in the A24 address space. + * @param size How many bytes to allocate + * @return A pointer to the memory allocated, or NULL. + */ +epicsShareFunc void *devLibA24Malloc(size_t size); + +/** @brief calloc() for VME drivers that support DMA. + * + * Allocate and zero-fill a block of memory of a given size from + * a region that can be accessed from the VMEbus in the A24 + * address space. + * @param size How many bytes to allocate and zero. + * @return A pointer to the memory allocated, or NULL. + */ +epicsShareFunc void *devLibA24Calloc(size_t size); + +/** @brief free() for VME drivers that support DMA. + * + * Free a block of memory that was allocated using either + * devLibA24Malloc() or devLibA24Calloc(). + * @param pBlock Block to be released. */ -epicsShareFunc void *devLibA24Malloc(size_t); -epicsShareFunc void *devLibA24Calloc(size_t); epicsShareFunc void devLibA24Free(void *pBlock); +/** @} */ -/* - * ISA API - * - * Functions in this section apply only to the ISA bus type +/** @name ISA Interrupt Management + * Routines to manage ISAbus interrupts. + * @note These routines may not have been used for a very long time; + * some appear to have never been implemented at all. They may vanish + * with no notice from future versions of EPICS Base. Nobody is using + * the PC's ISA-bus any more are they? + * @{ */ -/* - * connect ISR to an ISA interrupt level - * (not implemented) - * (API should be reviewed) +/** + * Connect ISR to a ISA interrupt. + * @warning Not implemented! + * @param interruptLevel Bus interrupt level to connect to. + * @param pFunction C function pointer to connect to. + * @param parameter Parameter to the called function. + * @return Returns success or error. */ epicsShareFunc long devConnectInterruptISA( unsigned interruptLevel, void (*pFunction)(void *), void *parameter); -/* - * disconnect ISR from an ISA interrupt level - * (not implemented) - * (API should be reviewed) - * - * The parameter pFunction should be set to the C function pointer that - * was connected. It is used as a key to prevent a driver from inadvertently - * removing an interrupt handler that it didn't install +/** + * Disconnect ISR from a ISA interrupt level. + * @warning Not implemented! + * @param interruptLevel Interrupt level. + * @param pFunction C function pointer that was connected. + * @return returns success or error. */ epicsShareFunc long devDisconnectInterruptISA( unsigned interruptLevel, void (*pFunction)(void *)); -/* - * determine if an ISA interrupt level is in use - * (not implemented) - * - * returns boolean +/** + * Determine if an ISA interrupt level is in use + * @warning Not implemented! + * @param interruptLevel Interrupt level. + * @return Returns True/False. */ epicsShareFunc int devInterruptLevelInUseISA (unsigned interruptLevel); -/* - * enable ISA interrupt level +/** + * Enable ISA interrupt level + * @param level Interrupt level. + * @return Returns True/False. */ epicsShareFunc long devEnableInterruptLevelISA (unsigned level); -/* - * disable ISA interrupt level +/** + * Disable ISA interrupt level + * @param level Interrupt level. + * @return Returns True/False. */ epicsShareFunc long devDisableInterruptLevelISA (unsigned level); - -/* - * Deprecated interface - */ +/** @} */ #ifndef NO_DEVLIB_OLD_INTERFACE +/** + * @name Deprecated Interfaces + * @{ + */ typedef enum {intVME, intVXI, intISA} epicsInterruptType; -/* - * NOTE: this routine has been deprecated. It exists +/** + * @note This routine has been deprecated. It exists * for backwards compatibility purposes only. - * - * Please use one of devConnectInterruptVME, devConnectInterruptPCI, - * devConnectInterruptISA etc. devConnectInterrupt will be removed + * Please use one of devConnectInterruptVME(), devConnectInterruptPCI(), + * devConnectInterruptISA() instead. devConnectInterrupt() will be removed * in a future release. */ epicsShareFunc long devConnectInterrupt( @@ -253,50 +379,48 @@ epicsShareFunc long devConnectInterrupt( void (*pFunction)(void *), void *parameter); -/* - * NOTE: this routine has been deprecated. It exists +/** + * @note This routine has been deprecated. It exists * for backwards compatibility purposes only. - * - * Please use one of devDisconnectInterruptVME, devDisconnectInterruptPCI, - * devDisconnectInterruptISA etc. devDisconnectInterrupt will be removed - * in a future release. + * Please use one of devDisconnectInterruptVME(), devDisconnectInterruptPCI(), + * devDisconnectInterruptISA() instead. devDisconnectInterrupt() will + * be removed in a future release. */ epicsShareFunc long devDisconnectInterrupt( epicsInterruptType intType, unsigned vectorNumber, void (*pFunction)(void *)); -/* - * NOTE: this routine has been deprecated. It exists +/** + * @note This routine has been deprecated. It exists * for backwards compatibility purposes only. - * - * Please use one of devEnableInterruptLevelVME, devEnableInterruptLevelPCI, - * devEnableInterruptLevelISA etc. devEnableInterruptLevel will be removed - * in a future release. + * Please use one of devEnableInterruptLevelVME(), devEnableInterruptLevelPCI(), + * devEnableInterruptLevelISA() instead. devEnableInterruptLevel() will + * be removed in a future release. */ epicsShareFunc long devEnableInterruptLevel( epicsInterruptType intType, unsigned level); -/* - * NOTE: this routine has been deprecated. It exists +/** + * @note This routine has been deprecated. It exists * for backwards compatibility purposes only. - * - * Please use one of devDisableInterruptLevelVME, devDisableInterruptLevelISA, - * devDisableInterruptLevelPCI etc. devDisableInterruptLevel will be removed - * in a future release. + * Please use one of devDisableInterruptLevelVME(), devDisableInterruptLevelISA(), + * devDisableInterruptLevelPCI() instead. devDisableInterruptLevel() will + * be removed in a future release. */ epicsShareFunc long devDisableInterruptLevel ( epicsInterruptType intType, unsigned level); -/* - * NOTE: this routine has been deprecated. It exists +/** + * @note This routine has been deprecated. It exists * for backwards compatibility purposes only. - * - * Please use devNoResponseProbe(). locationProbe() will be removed + * Please use devNoResponseProbe() instead. locationProbe() will be removed * in a future release. */ epicsShareFunc long locationProbe (epicsAddressType addrType, char *pLocation); +/** @} */ + #endif /* NO_DEVLIB_OLD_INTERFACE */ #ifdef __cplusplus diff --git a/modules/libcom/src/osi/devLibVMEImpl.h b/modules/libcom/src/osi/devLibVMEImpl.h index e479d869c..e3fd826f4 100644 --- a/modules/libcom/src/osi/devLibVMEImpl.h +++ b/modules/libcom/src/osi/devLibVMEImpl.h @@ -6,14 +6,13 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* devLibImpl.h */ -/* - * Original Author: Marty Kraimer - * Author: Jeff Hill - * Date: 03-10-93 +/** + * @file devLibVMEImpl.h + * @author Marty Kraimer, Jeff Hill + * @brief An interface from devLibVME.c to its OS-specific implementations. */ #ifndef INCdevLibImplh @@ -27,72 +26,57 @@ extern "C" { #endif -/* - * virtual OS layer for devLib.c +/** + * @brief A table of function pointers for devLibVME implementations * - * The global virtual OS table pdevLibVME controls + * The global virtual OS table \ref pdevLibVME controls * the behaviour of the functions defined in devLib.h. * All of which call into the functions found in this table * to perform system specific tasks. */ typedef struct devLibVME { - /* - * maps logical address to physical address, but does not detect - * two device drivers that are using the same address range - */ - long (*pDevMapAddr) (epicsAddressType addrType, unsigned options, - size_t logicalAddress, size_t size, volatile void **ppPhysicalAddress); + /** @brief Map a bus address to the CPU's address space. */ + long (*pDevMapAddr) (epicsAddressType addrType, unsigned options, + size_t logicalAddress, size_t size, volatile void **ppPhysicalAddress); - /* - * a bus error safe "wordSize" read at the specified address which returns - * unsuccessful status if the device isnt present - */ - long (*pDevReadProbe) (unsigned wordSize, volatile const void *ptr, void *pValueRead); + /** @brief Read a word, detect and protect against bus errors. */ + long (*pDevReadProbe) (unsigned wordSize, volatile const void *ptr, + void *pValueRead); + /** @brief Write a word, detect and protect against bus errors. */ + long (*pDevWriteProbe) (unsigned wordSize, volatile void *ptr, + const void *pValueWritten); - /* - * a bus error safe "wordSize" write at the specified address which returns - * unsuccessful status if the device isnt present - */ - long (*pDevWriteProbe) (unsigned wordSize, volatile void *ptr, const void *pValueWritten); + /** @brief Connect ISR to a VME interrupt vector. */ + long (*pDevConnectInterruptVME) (unsigned vectorNumber, + void (*pFunction)(void *), void *parameter); + /** @brief Disconnect ISR from a VME interrupt vector. */ + long (*pDevDisconnectInterruptVME) (unsigned vectorNumber, + void (*pFunction)(void *)); - /* - * connect ISR to a VME interrupt vector - * (required for backwards compatibility) - */ - long (*pDevConnectInterruptVME) (unsigned vectorNumber, - void (*pFunction)(void *), void *parameter); + /** @brief Enable VME interrupt level to CPU. */ + long (*pDevEnableInterruptLevelVME) (unsigned level); + /** @brief Disable VME interrupt level to CPU. */ + long (*pDevDisableInterruptLevelVME) (unsigned level); - /* - * disconnect ISR from a VME interrupt vector - * (required for backwards compatibility) - */ - long (*pDevDisconnectInterruptVME) (unsigned vectorNumber, - void (*pFunction)(void *)); + /** @brief Malloc a block accessible from the VME A24 address space. */ + void *(*pDevA24Malloc)(size_t nbytes); + /** @brief Free a block allocated for the VME A24 address space. */ + void (*pDevA24Free)(void *pBlock); - /* - * enable VME interrupt level - */ - long (*pDevEnableInterruptLevelVME) (unsigned level); + /** @brief Init devLib */ + long (*pDevInit)(void); - /* - * disable VME interrupt level - */ - long (*pDevDisableInterruptLevelVME) (unsigned level); - /* malloc/free A24 address space */ - void *(*pDevA24Malloc)(size_t nbytes); - void (*pDevA24Free)(void *pBlock); - long (*pDevInit)(void); - - /* - * test if VME interrupt has an ISR connected - */ - int (*pDevInterruptInUseVME) (unsigned vectorNumber); + /** @brief Check if interrupt vector has an ISR connected. */ + int (*pDevInterruptInUseVME)(unsigned vectorNumber); }devLibVME; +/** @brief Pointer to the entry table used by devLibVME routines. */ epicsShareExtern devLibVME *pdevLibVME; #ifndef NO_DEVLIB_COMPAT +/** @brief An alias for pdevLibVME */ # define pdevLibVirtualOS pdevLibVME +/** @brief A type definition for devLibVME */ typedef devLibVME devLibVirtualOS; #endif diff --git a/modules/libcom/src/osi/epicsAssert.h b/modules/libcom/src/osi/epicsAssert.h index 6f83d3a82..df6d4593e 100644 --- a/modules/libcom/src/osi/epicsAssert.h +++ b/modules/libcom/src/osi/epicsAssert.h @@ -4,14 +4,39 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* - * EPICS assert + +/**@file epicsAssert.h + * @author Jeffery O. Hill * - * Author: Jeffrey O. Hill - * Date: 022795 - */ + * @brief An EPICS-specific replacement for ANSI C's assert. + * + * To use this version just include: + @code + #define epicsAssertAuthor "Code Author my@email.address" + #include + @endcode + * instead of + @code + #include + @endcode + * + * If an assert() fails, it calls errlog indicating the program's author, file name, and + * line number. Under each OS there are specialized instructions assisting the user to + * diagnose the problem and generate a good bug report. For instance, under vxWorks, + * there are instructions on how to generate a stack trace, and on posix there are + * instructions about saving the core file. After printing the message the calling thread + * is suspended. An author may, before the above include line, optionally define a + * preprocessor macro named epicsAssertAuthor as a string that provides their name and + * email address if they wish to be contacted when the assertion fires. + * + * This header also provides a compile-time assertion macro STATIC_ASSERT() + * which can be used to check a constant-expression at compile-time. The C or + * C++ compiler will flag an error if the expresstion evaluates to 0. The + * STATIC_ASSERT() macro can only be used where a @c typedef is syntactically + * legal. + **/ #ifndef INC_epicsAssert_H #define INC_epicsAssert_H @@ -25,6 +50,7 @@ extern "C" { #ifndef epicsAssertAuthor +/**@brief Optional string giving the author's name */ # define epicsAssertAuthor 0 #endif @@ -34,9 +60,13 @@ extern "C" { # define assert(ignore) ((void) 0) #else /* NDEBUG */ +/**@private */ epicsShareFunc void epicsAssert (const char *pFile, const unsigned line, const char *pExp, const char *pAuthorName); +/**@brief Declare that a condition should be true. + * @param exp Expression that should evaluate to True. + */ # define assert(exp) ((exp) ? (void)0 : \ epicsAssert(__FILE__, __LINE__, #exp, epicsAssertAuthor)) @@ -49,6 +79,10 @@ epicsShareFunc void epicsAssert (const char *pFile, const unsigned line, #else #define STATIC_JOIN(x, y) STATIC_JOIN2(x, y) #define STATIC_JOIN2(x, y) x ## y + +/**@brief Declare a condition that should be true at compile-time. + * @param expr A C/C++ const-expression that should evaluate to True. + */ #define STATIC_ASSERT(expr) \ typedef int STATIC_JOIN(static_assert_failed_at_line_, __LINE__) \ [ (expr) ? 1 : -1 ] EPICS_UNUSED diff --git a/modules/libcom/src/osi/epicsEvent.h b/modules/libcom/src/osi/epicsEvent.h index e77d9a5ce..50a7ee22a 100644 --- a/modules/libcom/src/osi/epicsEvent.h +++ b/modules/libcom/src/osi/epicsEvent.h @@ -4,26 +4,62 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ + +/**@file epicsEvent.h + * + * @brief APIs for the epicsEvent binary semaphore. + * + * Defines the C++ and C API's for a simple binary semaphore. If multiple threads are + * waiting on the same event, only one of them will be woken when the event is signalled. + * + * The primary use of an event semaphore is for thread synchronization. An example of using an + * event semaphore is a consumer thread that processes requests from one or more producer threads. + * For example: + * + * When creating the consumer thread also create an epicsEvent. + @code + epicsEvent *pevent = new epicsEvent; + @endcode + * The consumer thread has code containing: + @code + while(1) { + pevent->wait(); + while( {more work} ) { + {process work} + } + } + @endcode + * Producers create requests and issue the statement: + @code + pevent->trigger(); + @endcode + **/ + #ifndef epicsEventh #define epicsEventh #include "shareLib.h" +/** @brief An identifier for an epicsEvent for use with the C API */ typedef struct epicsEventOSD *epicsEventId; +/** @brief Return status from several C API routines. */ typedef enum { epicsEventOK = 0, epicsEventWaitTimeout, epicsEventError } epicsEventStatus; -/* Backwards compatibility */ +/** @brief Old name provided for backwards compatibility */ #define epicsEventWaitStatus epicsEventStatus +/** @brief Old name provided for backwards compatibility */ #define epicsEventWaitOK epicsEventOK +/** @brief Old name provided for backwards compatibility */ #define epicsEventWaitError epicsEventError +/** @brief Possible initial states of a new epicsEvent */ typedef enum { epicsEventEmpty, epicsEventFull @@ -31,15 +67,50 @@ typedef enum { #ifdef __cplusplus +/**@brief A binary semaphore. + * + * An epicsEvent is a binary semaphore that can be empty or full. + * When empty, a wait() issued before the next call to trigger() will block. + * When full, the next call to wait() will empty the event and return + * immediately. Multiple calls to trigger() may occur between wait() calls + * but will have the same effect as a single trigger(), filling the event. + **/ class epicsShareClass epicsEvent { public: + /**@brief Constructor. + * @param initial State when created, empty (the default) or full. + **/ epicsEvent ( epicsEventInitialState initial = epicsEventEmpty ); + /**@brief Destroy the epicsEvent and any resources it holds. No calls to + * wait() can be active when this call is made. + **/ ~epicsEvent (); + /**@brief Trigger the event i.e. ensures the next or current call to wait + * completes. This method may be called from a vxWorks or RTEMS interrupt + * handler. + **/ void trigger (); + /**@brief Signal is a synonym for trigger(). + **/ void signal () { this->trigger(); } - void wait (); /* blocks until full */ - bool wait ( double timeOut ); /* false if still empty at time out */ - bool tryWait (); /* false if empty */ + /**@brief Wait for the event. + * @note Blocks until full. + **/ + void wait (); + /**@brief Wait for the event or until the specified timeout. + * @param timeOut The timeout delay in seconds. + * @return True if the event was triggered, False if it timed out. + **/ + bool wait ( double timeOut ); + /**@brief Similar to wait() except that if the event is currenly empty the + * call will return immediately. + * @return True if the event was full (triggered), False if empty. + **/ + bool tryWait (); + /**@brief Display information about the semaphore. + * @note The information displayed is architecture dependant. + * @param level An unsigned int for the level of information to be displayed. + **/ void show ( unsigned level ) const; class invalidSemaphore; /* exception payload */ @@ -52,22 +123,91 @@ private: extern "C" { #endif /*__cplusplus */ +/**@brief Create an epicsEvent for use from C code, or return NULL. + * + * @param initialState Starting state, @c epicsEventEmpty or @c epicsEventFull. + * @return An identifier for the new event, or NULL if one not be created. + **/ epicsShareFunc epicsEventId epicsEventCreate( epicsEventInitialState initialState); + +/**@brief Create an epicsEvent for use from C code. + * + * This routine does not return if the object could not be created. + * @param initialState Starting state, @c epicsEventEmpty or @c epicsEventFull. + * @return An identifier for the new event. + **/ epicsShareFunc epicsEventId epicsEventMustCreate ( epicsEventInitialState initialState); + +/**@brief Destroy an epicsEvent and any resources it holds. + * + * No calls to any epicsEventWait routines can be active when this call is made. + * @param id The event identifier. + **/ epicsShareFunc void epicsEventDestroy(epicsEventId id); + +/**@brief Trigger an event i.e. ensures the next or current call to wait + * completes. + * + * @note This method may be called from a VxWorks or RTEMS interrupt + * handler. + * @param id The event identifier. + * @return Status indicator. + **/ epicsShareFunc epicsEventStatus epicsEventTrigger( epicsEventId id); + +/**@brief Trigger an event. + * + * This routine does not return if the identifier is invalid. + * @param id The event identifier. + */ epicsShareFunc void epicsEventMustTrigger(epicsEventId id); + +/**@brief A synonym for epicsEventTrigger(). + * @param ID The event identifier. + * @return Status indicator. + **/ #define epicsEventSignal(ID) epicsEventMustTrigger(ID) + +/**@brief Wait for an event. + * @note Blocks until full. + * @param id The event identifier. + * @return Status indicator. + **/ epicsShareFunc epicsEventStatus epicsEventWait( epicsEventId id); + +/**@brief Wait for an event (see epicsEventWait()). + * + * This routine does not return if the identifier is invalid. + * @param id The event identifier. + */ epicsShareFunc void epicsEventMustWait(epicsEventId id); + +/**@brief Wait an the event or until the specified timeout period is over. + * @note Blocks until full or timeout. + * @param id The event identifier. + * @param timeOut The timeout delay in seconds. + * @return Status indicator. + **/ epicsShareFunc epicsEventStatus epicsEventWaitWithTimeout( epicsEventId id, double timeOut); + +/**@brief Similar to wait() except that if the event is currenly empty the + * call will return immediately with status @c epicsEventWaitTimeout. + * @param id The event identifier. + * @return Status indicator, @c epicsEventWaitTimeout when the event is empty. + **/ epicsShareFunc epicsEventStatus epicsEventTryWait( epicsEventId id); + +/**@brief Display information about the semaphore. + * @note The information displayed is architecture dependant. + * @param id The event identifier. + * @param level An unsigned int for the level of information to be displayed. + **/ epicsShareFunc void epicsEventShow( epicsEventId id, unsigned int level); diff --git a/modules/libcom/src/osi/epicsGeneralTime.h b/modules/libcom/src/osi/epicsGeneralTime.h index 6bbb0b21b..73304cfbc 100644 --- a/modules/libcom/src/osi/epicsGeneralTime.h +++ b/modules/libcom/src/osi/epicsGeneralTime.h @@ -7,6 +7,32 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ +/**@file epicsGeneralTime.h + * + * @brief The generalTime framework provides a mechanism for several time providers to be + * present within the system. + * + * There are two types of time provider, one type provides the current wall-clock + * time, the other provides Event System times. Each time provider is registered with + * a priority, and installed providers are queried in priority order whenever a time + * is requested, until one returns successfully. Thus there is a fallback from higher + * priority providers (smaller value of priority) to lower priority providers (larger + * value of priority) if the highest priority ones fail. Each architecture has a "last + * resort" provider, installed at priority 999, usually based on the system clock, which + * is used in the absence of any other provider. + * + * Targets running VxWorks and RTEMS have an NTP provider installed at priority 100. + * + * Registered providers may also add an interrupt-safe routine that will be called from + * the epicsTimeGetCurrentInt() or epicsTimeGetEventInt() API routines. These interfaces + * cannot check the priority queue, so will only succeed if the last-used provider has + * registered a suitable routine. + * + * @note There are two interfaces to this framework, epicsGeneralTime.h for consumers + * to obtain a time and query the framework, and generalTimeSup.h for providers + * that can supply timestamps. + **/ + #ifndef INC_epicsGeneralTime_H #define INC_epicsGeneralTime_H @@ -16,28 +42,109 @@ extern "C" { #endif +/**@def NUM_TIME_EVENTS + * @brief The number of time events that are validated. + * + * Time Events numbered 0 through (NUM_TIME_EVENTS-1) are validated by code in + * epicsGeneralTime.c that tests for advancing timestamps and enforces that + * restriction. + * + * @note Event numbers greater than or equal to NUM_TIME_EVENTS are now allowed + * if supported by a custom time provider which should provide its own advancing + * timestamp validation. + **/ #define NUM_TIME_EVENTS 256 -/* Time Events numbered 0 through (NUM_TIME_EVENTS-1) are validated by */ -/* code in epicsGeneralTime.c that tests for advancing timestamps and */ -/* enforces that restriction. Event numbers greater than or equal to */ -/* NUM_TIME_EVENTS are now allowed if supported by a custom time provider */ -/* which should provide its own advancing timestamp validation. */ +/**@brief Initialise the framework. + * + * This routine is called automatically by any function that requires the + * framework. It does not need to be called explicitly. + **/ epicsShareFunc void generalTime_Init(void); +/**@brief Install a Time Event time provider that returns the current time for any + * Time event number. + * + * @note This is optional as it is site policy whether the last resort for a Time + * Event time in the absence of any working provider should be a failure, or the + * current time. + **/ epicsShareFunc int installLastResortEventProvider(void); +/**@brief Reset the internal counter of the number of times the time returned was + * earlier than when previously requested. + * + * Used by device support for binary out record + * with: + @code + DTYP = "General Time" + OUT = "@RSTERRCNT" + @endcode + **/ epicsShareFunc void generalTimeResetErrorCounts(void); + +/**@brief Return the internal counter of the number of times the time returned was + * earlier than when previously requested. + * + * Used by device support for longin record + * with: + @code + DTYP = "General Time" + INP = "@GETERRCNT" + @endcode + * + * @return Reset error counts + **/ epicsShareFunc int generalTimeGetErrorCounts(void); +/**@brief Return the nume of the provider that last returned a valid current time, or + * NULL if none. + * + * Used by stringin device support with: + @code + DTYP = "General Time" + INP = "@BESTTCP" + @endcode + * + * @return Provider name + **/ epicsShareFunc const char * generalTimeCurrentProviderName(void); + +/**@brief Return the name of the provider that last returned a valid Time Event time, or + * NULL of none. + * + * Used by stringin device support with: + @code + DTYP = "General Time" + INP = "@BESTTEP" + @endcode + * + * @return Provider name + **/ epicsShareFunc const char * generalTimeEventProviderName(void); + +/**@brief Return the name of the registered current time provider that has the highest + * priority. + * + * Used by stringin device support with: + @code + DTYP = "General Time" + INP = "@TOPTCP" + @endcode + * + * @return Provider name + **/ epicsShareFunc const char * generalTimeHighestCurrentName(void); -/* Original names, for compatibility */ +/** @brief Old name provided for backwards compatibility */ #define generalTimeCurrentTpName generalTimeCurrentProviderName +/** @brief Old name provided for backwards compatibility */ #define generalTimeEventTpName generalTimeEventProviderName +/**@brief Provide information about the installed providers and their current best times. + * + * @param interest Desired interest level to report + **/ epicsShareFunc long generalTimeReport(int interest); #ifdef __cplusplus diff --git a/modules/libcom/src/osi/epicsMessageQueue.h b/modules/libcom/src/osi/epicsMessageQueue.h index c6a98fd47..7150eab44 100644 --- a/modules/libcom/src/osi/epicsMessageQueue.h +++ b/modules/libcom/src/osi/epicsMessageQueue.h @@ -5,17 +5,18 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* - * Author W. Eric Norum - * norume@aps.anl.gov - * 630 252 4793 + +/** + * \file epicsMessageQueue.h + * \author W. Eric Norum + * + * \brief A C++ and a C facility for communication between threads. + * + * Each C function corresponds to one of the C++ methods. */ -/* - * Interthread message passing - */ #ifndef epicsMessageQueueh #define epicsMessageQueueh @@ -26,22 +27,135 @@ typedef struct epicsMessageQueueOSD *epicsMessageQueueId; #ifdef __cplusplus +/** Provides methods for sending messages between threads on a first in, + * first out basis. It is designed so that a single message queue can + * be used with multiple writer and reader threads. + * + * A C++ epicsMessageQueue cannot be assigned to, copy-constructed, or + * constructed without giving the capacity and max-imumMessageSize + * arguments. + * + * The C++ compiler will object to some of the statements below: + * \code{.cpp} + * epicsMessageQueue mq0(); // Error: default constructor is private + * epicsMessageQueue mq1(10, 20); // OK + * epicsMessageQueue mq2(t1); // Error: copy constructor is private + * epicsMessageQueue*pmq; // OK, pointer + * *pmq = mq1; // Error: assignment operator is private + * pmq = &mq1; // OK, pointer assignment and address-of + * \endcode + **/ class epicsShareClass epicsMessageQueue { public: + + /** + * \brief Constructor. + * \param capacity Maximum number of messages to queue + * \param maximumMessageSize Number of bytes of the largest + * message that may be queued + **/ epicsMessageQueue ( unsigned int capacity, unsigned int maximumMessageSize ); + + /** + * \brief Destructor. + **/ ~epicsMessageQueue (); + + /** + * \brief Try to send a message. + * \note On VxWorks and RTEMS this method may be called from + * an interrupt handler. + * \returns 0 if the message was sent to a receiver or queued for + * future delivery. + * \returns -1 if no more messages can be queued or if the message + * is larger than the queue's maximum message size. + **/ int trySend ( void *message, unsigned int messageSize ); - int send ( void *message, unsigned int messageSize); + + /** + * \brief Send a message. + * \returns 0 if the message was sent to a receiver or queued for + * future delivery. + * \returns -1 if the message is larger than the queue's maximum + * message size. + **/ + int send ( void *message, unsigned int messageSize ); + + /** + * \brief Send a message or timeout. + * \returns 0 if the message was sent to a receiver or queued for + * future delivery. + * \returns -1 if the timeout was reached before the + * message could be sent or queued, or if the message is larger + * than the queue's maximum message size. + **/ int send ( void *message, unsigned int messageSize, double timeout ); + + /** + * \brief Try to receive a message. + * If the queue holds at least one message, + * the first message on the queue is moved to the specified location + * and the length of that message is returned. + * + * If the received message is larger than the specified message size + * the implementation may either return -1, or truncate the + * message. It is most efficient if the messageBufferSize is equal + * to the maximumMessageSize with which the message queue was + * created. + * \returns Number of bytes in the message. + * \returns -1 if the message queue is empty, or the buffer too small. + **/ int tryReceive ( void *message, unsigned int size ); + + /** + * \brief Fetch the next message on the queue. + * Wait for a message to be sent if the queue is empty, then move + * the first message queued to the specified location. + * + * If the received message is larger than the specified message size + * the implementation may either return -1, or truncate the + * message. It is most efficient if the messageBufferSize is equal + * to the maximumMessageSize with which the message queue was + * created. + * \returns Number of bytes in the message. + * \returns -1 if the buffer is too small for the message. + **/ int receive ( void *message, unsigned int size ); + + /** + * \brief Wait for a message to be queued. + * Wait up to \p timeout seconds for a message to be sent if the queue + * is empty, then move the first message to the specified location. + * + * If the received message is larger than the specified + * messageBufferSize it may either return -1, or truncate the + * message. It is most efficient if the messageBufferSize is equal + * to the maximumMessageSize with which the message queue was + * created. + * \returns Number of bytes in the message. + * \returns -1 if a message is not received within the timeout + * interval. + **/ int receive ( void *message, unsigned int size, double timeout ); + + /** + * \brief Displays some information about the message queue. + * \param level Controls the amount of information displayed. + **/ void show ( unsigned int level = 0 ); + + /** + * \brief How many messages are queued. + * \returns The number of messages presently in the queue. + **/ unsigned int pending (); -private: /* Prevent compiler-generated member functions */ - /* default constructor, copy constructor, assignment operator */ +private: + /** + * Prevent compiler-generated member functions default constructor, + * copy constructor, assignment operator. + **/ epicsMessageQueue(); epicsMessageQueue(const epicsMessageQueue &); epicsMessageQueue& operator=(const epicsMessageQueue &); @@ -52,39 +166,136 @@ private: /* Prevent compiler-generated member functions */ extern "C" { #endif /*__cplusplus */ +/** + * \brief Create a message queue. + * \param capacity Maximum number of messages to queue + * \param maximumMessageSize Number of bytes of the largest + * message that may be queued + * \return An identifier for the new queue, or 0. + **/ epicsShareFunc epicsMessageQueueId epicsShareAPI epicsMessageQueueCreate( unsigned int capacity, unsigned int maximumMessageSize); + +/** + * \brief Destroy a message queue, release all its memory. + **/ epicsShareFunc void epicsShareAPI epicsMessageQueueDestroy( epicsMessageQueueId id); + +/** + * \brief Try to send a message. + * \note On VxWorks and RTEMS this routine may be called from + * an interrupt handler. + * \returns 0 if the message was sent to a receiver or queued for + * future delivery. + * \returns -1 if no more messages can be queued or if the message + * is larger than the queue's maximum message size. + **/ epicsShareFunc int epicsShareAPI epicsMessageQueueTrySend( epicsMessageQueueId id, void *message, unsigned int messageSize); + +/** + * \brief Send a message. + * \returns 0 if the message was sent to a receiver or queued for + * future delivery. + * \returns -1 if the message is larger than the queue's maximum + * message size. + **/ epicsShareFunc int epicsShareAPI epicsMessageQueueSend( epicsMessageQueueId id, void *message, unsigned int messageSize); + +/** + * \brief Send a message or timeout. + * \returns 0 if the message was sent to a receiver or queued for + * future delivery. + * \returns -1 if the timeout was reached before the + * message could be sent or queued, or if the message is larger + * than the queue's maximum message size. + **/ epicsShareFunc int epicsShareAPI epicsMessageQueueSendWithTimeout( epicsMessageQueueId id, void *message, unsigned int messageSize, double timeout); + +/** + * \brief Try to receive a message. + * + * If the queue holds at least one message, + * the first message on the queue is moved to the specified location + * and the length of that message is returned. + * + * If the received message is larger than the specified message size + * the implementation may either return -1, or truncate the + * message. It is most efficient if the messageBufferSize is equal + * to the maximumMessageSize with which the message queue was + * created. + * \returns Number of bytes in the message. + * \returns -1 if the message queue is empty, or the buffer too small. + **/ epicsShareFunc int epicsShareAPI epicsMessageQueueTryReceive( epicsMessageQueueId id, void *message, unsigned int size); + +/** + * \brief Fetch the next message on the queue. + * + * Wait for a message to be sent if the queue is empty, then move the + * first message queued to the specified location. + * + * If the received message is larger than the specified message size + * the implementation may either return -1, or truncate the + * message. It is most efficient if the messageBufferSize is equal + * to the maximumMessageSize with which the message queue was + * created. + * \returns Number of bytes in the message. + * \returns -1 if the buffer is too small for the message. + **/ epicsShareFunc int epicsShareAPI epicsMessageQueueReceive( epicsMessageQueueId id, void *message, unsigned int size); + +/** + * \brief Wait for a message to be queued. + * + * Wait up to \p timeout seconds for a message to be sent if the queue + * is empty, then move the first message to the specified location. + * + * If the received message is larger than the specified message buffer + * size the implementation may either return -1, or truncate the + * message. It is most efficient if the messageBufferSize is equal + * to the maximumMessageSize with which the message queue was + * created. + * \returns Number of bytes in the message. + * \returns -1 if a message is not received within the timeout + * interval. + **/ epicsShareFunc int epicsShareAPI epicsMessageQueueReceiveWithTimeout( epicsMessageQueueId id, void *message, unsigned int size, double timeout); + +/** + * \brief How many messages are queued. + * \param id Message queue identifier. + * \returns The number of messages presently in the queue. + **/ epicsShareFunc int epicsShareAPI epicsMessageQueuePending( epicsMessageQueueId id); + +/** + * \brief Displays some information about the message queue. + * \param id Message queue identifier. + * \param level Controls the amount of information displayed. + **/ epicsShareFunc void epicsShareAPI epicsMessageQueueShow( epicsMessageQueueId id, int level); diff --git a/modules/libcom/src/osi/epicsMutex.h b/modules/libcom/src/osi/epicsMutex.h index 070efd0e4..84d57adc0 100644 --- a/modules/libcom/src/osi/epicsMutex.h +++ b/modules/libcom/src/osi/epicsMutex.h @@ -3,10 +3,34 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ + +/**@file epicsMutex.h + * + * @brief APIs for the epicsMutex mutual exclusion semaphore + * + * Mutual exclusion semaphores are for situations requiring exclusive access to + * resources. An epicsMutex may be claimed recursively, i.e. taken more than + * once by a thread, which must release it as many times as it was taken. + * Recursive usage is common for a set of routines that call each other while + * working on an exclusive resource. + * + * The typical C++ use of a mutual exclusion semaphore is: + @code + epicsMutex *plock = new epicsMutex; + ... + ... + plock->lock(); + // process resources + plock->unlock(); + @endcode + * + * @note The implementation: + * - MUST implement recursive locking + * - SHOULD implement priority inheritance and deletion safety if possible. + **/ #ifndef epicsMutexh #define epicsMutexh @@ -14,9 +38,14 @@ #include "shareLib.h" +/**@brief An identifier for an epicsMutex for use with the C API */ typedef struct epicsMutexParm *epicsMutexId; + +/** Return status from some C API routines. */ typedef enum { - epicsMutexLockOK,epicsMutexLockTimeout,epicsMutexLockError + epicsMutexLockOK = 0, + epicsMutexLockTimeout, + epicsMutexLockError } epicsMutexLockStatus; #ifdef __cplusplus @@ -24,31 +53,82 @@ typedef enum { #include "compilerDependencies.h" #include "epicsGuard.h" +/**@brief Create a C++ epicsMutex with current filename and line number + */ #define newEpicsMutex new epicsMutex(__FILE__,__LINE__) +/**@brief The C++ API for an epicsMutex. + */ class epicsShareClass epicsMutex { public: typedef epicsGuard guard_t; typedef epicsGuard release_t; class mutexCreateFailed; /* exception payload */ class invalidMutex; /* exception payload */ + #if !defined(__GNUC__) || __GNUC__<4 || (__GNUC__==4 && __GNUC_MINOR__<8) + /**@brief Create a mutual exclusion semaphore. + **/ epicsMutex (); + + /**@brief Create a mutual exclusion semaphore with source location. + * + * @note The newEpicsMutex macro simplifies using this constructor. + * @param *pFileName Source file name. + * @param lineno Source line number + **/ epicsMutex ( const char *pFileName, int lineno ); #else + /**@brief Create a mutual exclusion semaphore. + * @param *pFileName Source file name. + * @param lineno Source line number + **/ epicsMutex ( const char *pFileName = __builtin_FILE(), int lineno = __builtin_LINE() ); #endif + + /**@brief Delete the semaphore and its resources. + **/ ~epicsMutex (); + + /**@brief Display information about the semaphore. + * + * @note Results are architecture dependant. + * + * @param level Desired information level to report + **/ void show ( unsigned level ) const; - void lock (); /* blocks until success */ + + /**@brief Claim the semaphore, waiting until it's free if currently owned + * owned by a different thread. + * + * This call blocks until the calling thread can get exclusive access to + * the semaphore. + * @note After a successful lock(), additional recursive locks may be + * issued by the same thread, but each must have an associated unlock(). + **/ + void lock (); + + /**@brief Release the semaphore. + * + * @note If a thread issues recursive locks, it must call unlock() as many + * times as it calls lock(). + **/ void unlock (); - bool tryLock (); /* true if successful */ + + /**@brief Similar to lock() except that the call returns immediately if the + * semaphore is currently owned by another thread, giving the value false. + * + * @return True if the resource is now owned by the caller. + * @return False if some other thread already owns the resource. + **/ + bool tryLock (); private: epicsMutexId id; epicsMutex ( const epicsMutex & ); epicsMutex & operator = ( const epicsMutex & ); }; +/**@brief A semaphore for locating deadlocks in C++ code. */ class epicsShareClass epicsDeadlockDetectMutex { public: typedef epicsGuard guard_t; @@ -74,36 +154,96 @@ private: extern "C" { #endif /*__cplusplus*/ +/**@brief Create an epicsMutex semaphore for use from C code. + * + * This macro stores the source location of the creation call in the mutex. + * @return An identifier for the mutex, or NULL if one could not be created. + **/ #define epicsMutexCreate() epicsMutexOsiCreate(__FILE__,__LINE__) +/**@brief Internal API, used by epicsMutexCreate(). */ epicsShareFunc epicsMutexId epicsShareAPI epicsMutexOsiCreate( const char *pFileName,int lineno); + +/**@brief Create an epicsMutex semaphore for use from C code. + * + * This macro stores the source location of the creation call in the mutex. + * The routine does not return if the object could not be created. + * @return An identifier for the mutex. + **/ #define epicsMutexMustCreate() epicsMutexOsiMustCreate(__FILE__,__LINE__) +/**@brief Internal API, used by epicsMutexMustCreate(). */ epicsShareFunc epicsMutexId epicsShareAPI epicsMutexOsiMustCreate( const char *pFileName,int lineno); + +/**@brief Destroy an epicsMutex semaphore. + * @param id The mutex identifier. + **/ epicsShareFunc void epicsShareAPI epicsMutexDestroy(epicsMutexId id); + +/**@brief Release the semaphore. + * @param id The mutex identifier. + * @note If a thread issues recursive locks, it must call epicsMutexUnlock() + * as many times as it calls epicsMutexLock() or equivalents. + **/ epicsShareFunc void epicsShareAPI epicsMutexUnlock(epicsMutexId id); + +/**@brief Claim the semaphore, waiting until it's free if currently owned + * owned by a different thread. + * + * This call blocks until the calling thread can get exclusive access to + * the semaphore. + * @note After a successful lock(), additional recursive locks may be + * issued by the same thread, but each must have an associated unlock(). + * @param id The mutex identifier. + * @return Status indicator. + **/ epicsShareFunc epicsMutexLockStatus epicsShareAPI epicsMutexLock( epicsMutexId id); + +/**@brief Claim a semaphore (see epicsMutexLock()). + * + * This routine does not return if the identifier is invalid. + * @param ID The mutex identifier. + **/ #define epicsMutexMustLock(ID) { \ epicsMutexLockStatus status = epicsMutexLock(ID); \ assert(status == epicsMutexLockOK); \ } + +/**@brief Similar to epicsMutexLock() except that the call returns immediately, + * with the return status indicating if the semaphore is currently owned by + * this thread or another thread. + * + * @return \c epicsMutexLockOK if the resource is now owned by the caller. + * @return \c epicsMutexLockTimeout if some other thread owns the resource. + **/ epicsShareFunc epicsMutexLockStatus epicsShareAPI epicsMutexTryLock( epicsMutexId id); + +/**@brief Display information about the semaphore. + * + * @note Results are architecture dependant. + * + * @param id The mutex identifier. + * @param level Desired information level to report + **/ epicsShareFunc void epicsShareAPI epicsMutexShow( epicsMutexId id,unsigned int level); + +/**@brief Display information about all epicsMutex semaphores. + * + * @note Results are architecture dependant. + * + * @param onlyLocked Non-zero to show only locked semaphores. + * @param level Desired information level to report + **/ epicsShareFunc void epicsShareAPI epicsMutexShowAll( int onlyLocked,unsigned int level); -/*NOTES: - epicsMutex MUST implement recursive locking - epicsMutex should implement priority inheritance and deletion safe -*/ - -/* - * The following is the interface to the OS dependent - * implementation and should NOT be called directly by - * user code +/**@privatesection + * The following are interfaces to the OS dependent + * implementation and should NOT be called directly by + * user code. */ struct epicsMutexOSD * epicsMutexOsdCreate(void); void epicsMutexOsdDestroy(struct epicsMutexOSD *); diff --git a/modules/libcom/src/osi/epicsReadline.h b/modules/libcom/src/osi/epicsReadline.h index 1d0e8b761..ab3faa160 100644 --- a/modules/libcom/src/osi/epicsReadline.h +++ b/modules/libcom/src/osi/epicsReadline.h @@ -6,6 +6,16 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ + +/** + * @file epicsReadline.h + * @brief Command-line editing functions + * @author Eric Norum + * + * Provides a generalized API for command line history and line-editing. + * The implementation of this API can call GNU Readline, libtecla, and on + * VxWorks the ledLib routines, according to the EPICS build configuration. + */ #ifndef INC_epicsReadline_H #define INC_epicsReadline_H @@ -15,9 +25,23 @@ extern "C" { #include #include - +/** + * @brief Create a command-line context + * @param in Filehandle to read from + * @returns Command-line context + */ epicsShareFunc void * epicsShareAPI epicsReadlineBegin (FILE *in); +/** + * @brief Read a line of input + * @param prompt Prompt string + * @param context To read from + * @returns Line read + */ epicsShareFunc char * epicsShareAPI epicsReadline (const char *prompt, void *context); +/** + * @brief Destroy a command-line context + * @param context Command-line context to destroy + */ epicsShareFunc void epicsShareAPI epicsReadlineEnd (void *context); #ifdef __cplusplus diff --git a/modules/libcom/src/osi/epicsSignal.h b/modules/libcom/src/osi/epicsSignal.h index 79adf71d1..f976ee040 100644 --- a/modules/libcom/src/osi/epicsSignal.h +++ b/modules/libcom/src/osi/epicsSignal.h @@ -16,30 +16,33 @@ extern "C" { #include "shareLib.h" -/* +/** \file epicsSignal.h + * \brief OS-independent routines for ignoring Posix signals + * * The requests in this interface are typically ignored on OS that do not implement * POSIX signals. */ struct epicsThreadOSD; -/* +/** Ignore the SIGHUP signal. * Required to avoid problems with soft IOCs getting SIGHUPs when a * Channel Access client disconnects */ epicsShareFunc void epicsShareAPI epicsSignalInstallSigHupIgnore ( void ); -/* +/** Ignore the SIGPIPE signal. * Required to avoid terminating a process which is blocking in a * socket send() call when the SIGPIPE signal is generated by the OS. */ epicsShareFunc void epicsShareAPI epicsSignalInstallSigPipeIgnore ( void ); -/* - * required only if shutdown() and close() do not interrupt a thread blocking in +/** Ignore the SIGALRM signal. + * Required only if shutdown() and close() do not interrupt a thread blocking in * a socket system call */ epicsShareFunc void epicsShareAPI epicsSignalInstallSigAlarmIgnore ( void ); +/** Raise a SIGALRM signal to a specific epicsThread */ epicsShareFunc void epicsShareAPI epicsSignalRaiseSigAlarm ( struct epicsThreadOSD * ); #ifdef __cplusplus diff --git a/modules/libcom/src/osi/epicsTempFile.h b/modules/libcom/src/osi/epicsTempFile.h index e20879d04..210e69740 100644 --- a/modules/libcom/src/osi/epicsTempFile.h +++ b/modules/libcom/src/osi/epicsTempFile.h @@ -4,10 +4,13 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* epicsTempFile.h */ +/** + * \file epicsTempFile.h + * \brief OS-independent way to create temporary files. + **/ #ifndef INC_epicsTempFile_H #define INC_epicsTempFile_H @@ -20,6 +23,10 @@ extern "C" { #endif +/** + * \brief Create and open a temporary file. + * \return NULL or a FILE pointer to a temporary file. + **/ epicsShareFunc FILE * epicsShareAPI epicsTempFile(void); #ifdef __cplusplus diff --git a/modules/libcom/src/osi/epicsThread.h b/modules/libcom/src/osi/epicsThread.h index da16a0b25..b154e83e6 100644 --- a/modules/libcom/src/osi/epicsThread.h +++ b/modules/libcom/src/osi/epicsThread.h @@ -5,8 +5,53 @@ * Operator of Los Alamos National Laboratory. * Copyright (c) 2013 ITER Organization. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ + +/** + * \file epicsThread.h + * + * \brief C++ and C descriptions for a thread. + * + * The epicsThread API is meant as a somewhat minimal interface for + * multithreaded applications. It can be implementedon a wide variety of + * systems with the restriction that the system MUST support a + * multithreaded environment. + * A POSIX pthreads version is provided. + * + * The interface provides the following thread facilities, + * with restrictions as noted: + * - Life cycle: a thread starts life as a result of a call to + * epicsThreadCreate. It terminates when the thread function returns. + * It should not return until it has released all resources it uses. + * If a thread is expected to terminate as a natural part of its life + * cycle then the thread function must return. + * - epicsThreadOnce: this provides the ability to have an + * initialization function that is guaranteed to be called exactly + * once. + * - main: if a main routine finishes its work but wants to leave other + * threads running it can call epicsThreadExitMain, which should be + * the last statement in main. + * - Priorities: ranges between 0 and 99 with a higher number meaning + * higher priority. A number of constants are defined for iocCore + * specific threads. The underlying implementation may collapse the + * range 0 to 99 into a smaller range; even a single priority. User + * code should never rely on the existence of multiple thread + * priorities to guarantee correct behavior. + * - Stack Size: epicsThreadCreate accepts a stack size parameter. Three + * generic sizes are available: small, medium,and large. Portable code + * should always use one of the generic sizes. Some implementation may + * ignore the stack size request and use a system default instead. + * Virtual memory systems providing generous stack sizes can be + * expected to use the system default. + * - epicsThreadId: every epicsThread has an Id which gets returned by + * epicsThreadCreate and is valid as long as that thread still exists. + * A value of 0 always means no thread. If a threadId is used after + * the thread has terminated,the results are not defined (but will + * normally lead to bad things happening). Thus code that looks after + * other threads MUST be aware of threads terminating. + */ + #ifndef epicsThreadh #define epicsThreadh @@ -36,7 +81,7 @@ typedef void (*EPICSTHREADFUNC)(void *parm); #define epicsThreadPriorityIocsh 91 #define epicsThreadPriorityBaseMax 91 -/* stack sizes for each stackSizeClass are implementation and CPU dependent */ +/** Stack sizes for each stackSizeClass are implementation and CPU dependent. */ typedef enum { epicsThreadStackSmall, epicsThreadStackMedium, epicsThreadStackBig } epicsThreadStackSizeClass; @@ -45,11 +90,15 @@ typedef enum { epicsThreadBooleanStatusFail, epicsThreadBooleanStatusSuccess } epicsThreadBooleanStatus; -/** Lookup target specific default stack size */ +/** + * Get a stack size value that can be given to epicsThreadCreate(). + * \param size one of the values epicsThreadStackSmall, + * epicsThreadStackMedium or epicsThreadStackBig. + **/ epicsShareFunc unsigned int epicsShareAPI epicsThreadGetStackSize( epicsThreadStackSizeClass size); -/* (epicsThreadId)0 is guaranteed to be an invalid thread id */ +/** (epicsThreadId)0 is guaranteed to be an invalid thread id */ typedef struct epicsThreadOSD *epicsThreadId; typedef epicsThreadId epicsThreadOnceId; @@ -57,9 +106,13 @@ typedef epicsThreadId epicsThreadOnceId; /** Perform one-time initialization. * - * Run the provided function if it has not run, and is not running. + * Run the provided function if it has not run, and is not running in + * some other thread. * - * @post The provided function has been run. + * For each unique epicsThreadOnceId, epicsThreadOnce guarantees that + * -# myInitFunc will only be called only once. + * -# myInitFunc will have returned before any other epicsThreadOnce + * call using the same epicsThreadOnceId returns. * * @code * static epicsThreadOnceId onceId = EPICS_THREAD_ONCE_INIT; @@ -72,12 +125,19 @@ typedef epicsThreadId epicsThreadOnceId; epicsShareFunc void epicsShareAPI epicsThreadOnce( epicsThreadOnceId *id, EPICSTHREADFUNC, void *arg); -/* When real-time scheduling is active, attempt any post-init operations +/** + * When real-time scheduling is active, attempt any post-init operations * that preserve real-time performance. For POSIX targets this locks the * process into RAM, preventing swap-related VM faults. - */ + **/ epicsShareFunc void epicsThreadRealtimeLock(void); +/** + * If the main routine is done but wants to let other threads run it can + * call this routine. This should be the last call in main, except the + * final return. On most systems epicsThreadExitMain never returns.This + * must only be called by the main thread. + **/ epicsShareFunc void epicsShareAPI epicsThreadExitMain(void); /** For use with epicsThreadCreateOpt() */ @@ -156,7 +216,11 @@ epicsShareFunc epicsThreadBooleanStatus epicsShareAPI /** Test if two thread IDs actually refer to the same OS thread */ epicsShareFunc int epicsShareAPI epicsThreadIsEqual( epicsThreadId id1, epicsThreadId id2); -/** Test if thread has been suspended with epicsThreadSuspendSelf() */ +/** How and why a thread can be suspended is implementation dependent. A + * thread calling epicsThreadSuspendSelf() should result in this routine + * returning true for that thread, but a thread may also be suspended + * for other reasons. + **/ epicsShareFunc int epicsShareAPI epicsThreadIsSuspended(epicsThreadId id); /** @brief Block the calling thread for at least the specified time. * @param seconds Time to wait in seconds. Values <=0 blocks for the shortest possible time. @@ -206,7 +270,18 @@ epicsShareFunc const char * epicsShareAPI epicsThreadGetNameSelf(void); epicsShareFunc void epicsShareAPI epicsThreadGetName( epicsThreadId id, char *name, size_t size); +/** + * Is it OK for a thread to block? This can be called by support code + * that does not know if it is called in a thread that should not block. + * For example the errlog system calls this to decide when messages + * should be displayed on the console. + **/ epicsShareFunc int epicsShareAPI epicsThreadIsOkToBlock(void); +/** + * When a thread is started the default is that it is not allowed to + * block. This method can be called to change the state. For example + * iocsh calls this to specify that it is OK to block. + **/ epicsShareFunc void epicsShareAPI epicsThreadSetOkToBlock(int isOkToBlock); /** Print to stdout information about all running EPICS threads. @@ -217,11 +292,32 @@ epicsShareFunc void epicsShareAPI epicsThreadShowAll(unsigned int level); epicsShareFunc void epicsShareAPI epicsThreadShow( epicsThreadId id,unsigned int level); -/* Hooks called when a thread starts, map function called once for every thread */ +/** + * Hooks called when a thread starts, map function called once for every thread. + **/ typedef void (*EPICS_THREAD_HOOK_ROUTINE)(epicsThreadId id); + +/** + * Register a routine to be called by every new thread before the thread + * function gets run. Hook routines will often register a thread exit + * routine with epicsAtThreadExit() to release thread-specific resources + * they have allocated. + */ epicsShareFunc int epicsThreadHookAdd(EPICS_THREAD_HOOK_ROUTINE hook); + +/** + * Remove routine from the list of hooks run at thread creation time. + **/ epicsShareFunc int epicsThreadHookDelete(EPICS_THREAD_HOOK_ROUTINE hook); + +/** + * Print the current list of hook function pointers. + **/ epicsShareFunc void epicsThreadHooksShow(void); + +/** + * Call func once for every known thread. + **/ epicsShareFunc void epicsThreadMap(EPICS_THREAD_HOOK_ROUTINE func); /** Thread local storage */ @@ -331,7 +427,7 @@ private: epicsThread ( const epicsThread & ); epicsThread & operator = ( const epicsThread & ); friend void epicsThreadCallEntryPoint ( void * ); - void printLastChanceExceptionMessage ( + void printLastChanceExceptionMessage ( const char * pExceptionTypeName, const char * pExceptionContext ); /* exceptions */ @@ -346,7 +442,7 @@ protected: }; template < class T > -class epicsThreadPrivate : +class epicsThreadPrivate : private epicsThreadPrivateBase { public: epicsThreadPrivate (); diff --git a/modules/libcom/src/osi/epicsTime.h b/modules/libcom/src/osi/epicsTime.h index e9ec71aaf..579d08adc 100644 --- a/modules/libcom/src/osi/epicsTime.h +++ b/modules/libcom/src/osi/epicsTime.h @@ -4,10 +4,13 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* epicsTime.h */ -/* Author Jeffrey O. Hill */ +/** \file epicsTime.h + * \brief EPICS time-stamps (epicsTimeStamp), epicsTime C++ class + * and C functions for handling wall-clock times. + * \author Jeffrey O. Hill + */ #ifndef epicsTimehInclude #define epicsTimehInclude @@ -19,139 +22,294 @@ #include "osdTime.h" #include "errMdef.h" -/* The EPICS Epoch is 00:00:00 Jan 1, 1990 UTC */ +/** \brief The EPICS Epoch is 00:00:00 Jan 1, 1990 UTC */ #define POSIX_TIME_AT_EPICS_EPOCH 631152000u -/* epics time stamp for C interface*/ +/** \brief EPICS time stamp, for use from C code. + * + * Because it uses an unsigned 32-bit integer to hold the seconds count, an + * epicsTimeStamp can safely represent time stamps until the year 2106. + */ typedef struct epicsTimeStamp { - epicsUInt32 secPastEpoch; /* seconds since 0000 Jan 1, 1990 */ - epicsUInt32 nsec; /* nanoseconds within second */ + epicsUInt32 secPastEpoch; /**< \brief seconds since 0000 Jan 1, 1990 */ + epicsUInt32 nsec; /**< \brief nanoseconds within second */ } epicsTimeStamp; -/*TS_STAMP is deprecated */ +/** \brief Old time-stamp data type, deprecated. + * \deprecated TS_STAMP was provided for compatibility with Base-3.13 code. + * It will be removed in some future release of EPICS 7. + */ #define TS_STAMP epicsTimeStamp +/** \struct timespec + * \brief Defined by POSIX Real Time + * + * This is defined by POSIX Real Time. It requires two mandatory fields: + * \li time_t tv_sec - Number of seconds since 1970 (The POSIX epoch) + * \li long tv_nsec - nanoseconds within a second + */ struct timespec; /* POSIX real time */ + +/** \struct timeval + * \brief BSD and SRV5 Unix timestamp + * + * BSD and SRV5 Unix timestamp. It has two fields: + * \li time_t tv_sec - Number of seconds since 1970 (The POSIX epoch) + * \li time_t tv_nsec - nanoseconds within a second + */ struct timeval; /* BSD */ + +/** \struct l_fp + * \brief Network Time Protocol timestamp + * + * Network Time Protocol timestamp. The fields are: + * \li \c lui - Number of seconds since 1900 (The NTP epoch) + * \li \c luf - Fraction of a second. For example 0x800000000 represents 1/2 second. + */ struct l_fp; /* NTP timestamp */ #ifdef __cplusplus -/* - * extend ANSI C RTL "struct tm" to include nano seconds within a second - * and a struct tm that is adjusted for the local timezone +/** \brief C++ only ANSI C struct tm with nanoseconds, local timezone + * + * Extend ANSI C "struct tm" to include nano seconds within a second + * and a struct tm that is adjusted for the local timezone. */ struct local_tm_nano_sec { - struct tm ansi_tm; /* ANSI C time details */ - unsigned long nSec; /* nano seconds extension */ + struct tm ansi_tm; /**< \brief ANSI C time details */ + unsigned long nSec; /**< \brief nanoseconds extension */ }; -/* - * extend ANSI C RTL "struct tm" to includes nano seconds within a second - * and a struct tm that is adjusted for GMT (UTC) +/** \brief C++ only ANSI C sruct tm with nanoseconds, UTC + * + * Extend ANSI C "struct tm" to include nanoseconds within a second + * and a struct tm that is adjusted for GMT (UTC). */ struct gm_tm_nano_sec { - struct tm ansi_tm; /* ANSI C time details */ - unsigned long nSec; /* nano seconds extension */ + struct tm ansi_tm; /**< \brief ANSI C time details */ + unsigned long nSec; /**< \brief nanoseconds extension */ }; -/* - * wrapping this in a struct allows conversion to and - * from ANSI time_t but does not allow unexpected - * conversions to occur +/** \brief C++ only ANSI C time_t + * + * This is for converting to/from the ANSI C \c time_t. Since \c time_t + * is usually an elementary type providing a conversion operator from + * \c time_t to/from epicsTime could cause undesirable implicit + * conversions. Providing a conversion operator to/from the + * \c time_t_wrapper instead prevents implicit conversions. */ struct time_t_wrapper { time_t ts; }; +/** \brief C++ Event number wrapper class + * + * Stores an event number for use by the epicsTime::getEvent() static + * class method. + */ class epicsShareClass epicsTimeEvent { public: - epicsTimeEvent (const int &number); - operator int () const; + epicsTimeEvent (const int &number); /**< \brief Constructor */ + operator int () const; /**< \brief Extractor */ private: int eventNumber; }; - + +/** \brief C++ time stamp object + * + * Holds an EPICS time stamp, and provides conversion functions for both + * input and output from/to other types. + * + * \note Time conversions: The epicsTime implementation will properly + * convert between the various formats from the beginning of the EPICS + * epoch until at least 2038. Unless the underlying architecture support + * has defective POSIX, BSD/SRV5, or standard C time support the EPICS + * implementation should be valid until 2106. + */ class epicsShareClass epicsTime { public: - /* exceptions */ + /// \brief Exception: Time provider problem class unableToFetchCurrentTime {}; + /// \brief Exception: Bad field(s) in struct tm class formatProblemWithStructTM {}; + /** \brief The default constructor sets the time to the EPICS epoch. */ epicsTime (); + /** \brief Get time of event system event. + * + * Returns an epicsTime indicating when the associated event system + * event last occurred. + */ static epicsTime getEvent ( const epicsTimeEvent & ); + /** \brief Get current clock time + * + * Returns an epicsTime containing the current time. For example: + * \code{.cpp} + * epicsTime now = epicsTime::getCurrent(); + * \endcode + */ static epicsTime getCurrent (); + /** \brief Get current monotonic time + * + * Returns an epicsTime containing the current monotonic time, a + * high-resolution OS clock that counts at a steady rate, never + * going backwards or jumping forwards. This time is only useful + * for measuring time differences. + */ static epicsTime getMonotonic (); - /* convert to and from EPICS epicsTimeStamp format */ + /** \name epicsTimeStamp conversions + * Convert to and from EPICS epicsTimeStamp format + * @{ */ + /** \brief Convert to epicsTimeStamp */ operator epicsTimeStamp () const; + /** \brief Construct from epicsTimeStamp */ epicsTime ( const epicsTimeStamp & ts ); + /** \brief Assign from epicsTimeStamp */ epicsTime & operator = ( const epicsTimeStamp & ); + /** @} */ - /* convert to and from ANSI time_t */ + /** \name ANSI C time_t conversions + * Convert to and from ANSI C \c time_t wrapper . + * @{ */ + /** \brief Convert to ANSI C \c time_t */ operator time_t_wrapper () const; + /** \brief Construct from ANSI C \c time_t */ epicsTime ( const time_t_wrapper & ); + /** \brief Assign from ANSI C \c time_t */ epicsTime & operator = ( const time_t_wrapper & ); + /** @} */ - /* - * convert to and from ANSI Cs "struct tm" (with nano seconds) - * adjusted for the local time zone - */ + /** \name ANSI C struct tm local-time conversions + * Convert to and from ANSI Cs struct tm (with nano seconds), + * adjusted for the local time zone. + * @{ */ + /** \brief Convert to struct tm in local time zone */ operator local_tm_nano_sec () const; + /** \brief Construct from struct tm in local time zone */ epicsTime ( const local_tm_nano_sec & ); + /** \brief Assign from struct tm in local time zone */ epicsTime & operator = ( const local_tm_nano_sec & ); + /** @} */ - /* - * convert to and from ANSI Cs "struct tm" (with nano seconds) - * adjusted for GM time (UTC) - */ + /** \name ANSI C struct tm UTC conversions + * Convert to and from ANSI Cs struct tm (with nano seconds), + * adjusted for Greenwich Mean Time (UTC). + * @{ */ + /** \brief Convert to struct tm in UTC/GMT */ operator gm_tm_nano_sec () const; + /** \brief Construct from struct tm in UTC/GMT */ epicsTime ( const gm_tm_nano_sec & ); + /** \brief Assign from struct tm in UTC */ epicsTime & operator = ( const gm_tm_nano_sec & ); + /** @} */ - /* convert to and from POSIX RTs "struct timespec" */ + /** \name POSIX RT struct timespec conversions + * Convert to and from the POSIX RealTime struct timespec + * format. + * @{ */ + /** \brief Convert to struct timespec */ operator struct timespec () const; + /** \brief Construct from struct timespec */ epicsTime ( const struct timespec & ); + /** \brief Assign from struct timespec */ epicsTime & operator = ( const struct timespec & ); + /** @} */ - /* convert to and from BSDs "struct timeval" */ + /** \name BSD's struct timeval conversions + * Convert to and from the BSD struct timeval format. + * @{ */ + /** \brief Convert to struct timeval */ operator struct timeval () const; + /** \brief Construct from struct timeval */ epicsTime ( const struct timeval & ); + /** \brief Assign from struct timeval */ epicsTime & operator = ( const struct timeval & ); + /** @} */ - /* convert to and from NTP timestamp format */ + /** \name NTP timestamp conversions + * Convert to and from the NTP timestamp structure \c l_fp + * @{ */ + /** \brief Convert to NTP format */ operator l_fp () const; + /** \brief Construct from NTP format */ epicsTime ( const l_fp & ); + /** \brief Assign from NTP format */ epicsTime & operator = ( const l_fp & ); + /** @} */ - /* convert to and from WIN32s FILETIME (implemented only on WIN32) */ + /** \name WIN32 FILETIME conversions + * Convert to and from WIN32s _FILETIME + * \note These are only implemented on Windows targets. + * @{ */ + /** \brief Convert to Windows struct _FILETIME */ operator struct _FILETIME () const; + /** \brief Constuct from Windows struct _FILETIME */ epicsTime ( const struct _FILETIME & ); + /** \brief Assign from Windows struct _FILETIME */ epicsTime & operator = ( const struct _FILETIME & ); + /** @} */ - /* arithmetic operators */ - double operator- ( const epicsTime & ) const; /* returns seconds */ - epicsTime operator+ ( const double & ) const; /* add rhs seconds */ - epicsTime operator- ( const double & ) const; /* subtract rhs seconds */ - epicsTime operator+= ( const double & ); /* add rhs seconds */ - epicsTime operator-= ( const double & ); /* subtract rhs seconds */ + /** \name Arithmetic operators + * Standard operators involving epicsTime objects and time differences + * which are always expressed as a \c double in seconds. + * @{ */ + /// \brief \p lhs minus \p rhs, in seconds + double operator- ( const epicsTime & ) const; + /// \brief \p lhs plus rhs seconds + epicsTime operator+ ( const double & ) const; + /// \brief \p lhs minus rhs seconds + epicsTime operator- ( const double & ) const; + /// \brief add rhs seconds to \p lhs + epicsTime operator+= ( const double & ); + /// \brief subtract rhs seconds from \p lhs + epicsTime operator-= ( const double & ); + /** @} */ - /* comparison operators */ - bool operator == ( const epicsTime & ) const; - bool operator != ( const epicsTime & ) const; - bool operator <= ( const epicsTime & ) const; - bool operator < ( const epicsTime & ) const; - bool operator >= ( const epicsTime & ) const; - bool operator > ( const epicsTime & ) const; + /** \name Comparison operators + * Standard comparisons between epicsTime objects. + * @{ */ + /// \brief \p lhs equals \p rhs + bool operator == ( const epicsTime & ) const; + /// \brief \p lhs not equal to \p rhs + bool operator != ( const epicsTime & ) const; + /// \brief \p rhs no later than \p lhs + bool operator <= ( const epicsTime & ) const; + /// \brief \p lhs was before \p rhs + bool operator < ( const epicsTime & ) const; + /// \brief \p rhs not before \p lhs + bool operator >= ( const epicsTime & ) const; + /// \brief \p lhs was after \p rhs + bool operator > ( const epicsTime & ) const; + /** @} */ - /* convert current state to user-specified string */ + /** \brief Convert to string in user-specified format + * + * This method extends the standard C library routine strftime(). + * See your OS documentation for details about the standard routine. + * The epicsTime method adds support for printing the fractional + * portion of the time. It searches the format string for the + * sequence %0nf where \a n is the desired precision, + * and uses this format to convert the fractional seconds with the + * requested precision. For example: + * \code{.cpp} + * epicsTime time = epicsTime::getCurrent(); + * char buf[30]; + * time.strftime(buf, 30, "%Y-%m-%d %H:%M:%S.%06f"); + * printf("%s\n", buf); + * \endcode + * This will print the current time in the format: + * \code + * 2001-01-26 20:50:29.813505 + * \endcode + */ size_t strftime ( char * pBuff, size_t bufLength, const char * pFormat ) const; - /* dump current state to standard out */ + /** \brief Dump current state to standard out */ void show ( unsigned interestLevel ) const; private: @@ -173,98 +331,179 @@ private: extern "C" { #endif /* __cplusplus */ -/* epicsTime routines return S_time_ error status values */ +/** \name Return status values + * epicsTime routines return \c S_time_ error status values: + * @{ + */ +/** \brief Success */ #define epicsTimeOK 0 +/** \brief No time provider */ #define S_time_noProvider (M_time| 1) /*No time provider*/ +/** \brief Bad event number */ #define S_time_badEvent (M_time| 2) /*Bad event number*/ +/** \brief Invalid arguments */ #define S_time_badArgs (M_time| 3) /*Invalid arguments*/ +/** \brief Out of memory */ #define S_time_noMemory (M_time| 4) /*Out of memory*/ +/** \brief Provider not synchronized */ #define S_time_unsynchronized (M_time| 5) /*Provider not synchronized*/ -#define S_time_timezone (M_time| 6) /*Invalid timeone*/ +/** \brief Invalid timezone */ +#define S_time_timezone (M_time| 6) /*Invalid timezone*/ +/** \brief Time conversion error */ #define S_time_conversion (M_time| 7) /*Time conversion error*/ +/** @} */ -/*Some special values for eventNumber*/ +/** \name epicsTimeEvent numbers + * Some special values for eventNumber: + * @{ + */ #define epicsTimeEventCurrentTime 0 #define epicsTimeEventBestTime -1 #define epicsTimeEventDeviceTime -2 +/** @} */ -/* These are implemented in the "generalTime" framework */ +/** \name generalTime functions + * These are implemented in the "generalTime" framework: + * @{ + */ +/** \brief Get current time into \p *pDest */ epicsShareFunc int epicsShareAPI epicsTimeGetCurrent ( epicsTimeStamp * pDest ); +/** \brief Get time of event \p eventNumber into \p *pDest */ epicsShareFunc int epicsShareAPI epicsTimeGetEvent ( epicsTimeStamp *pDest, int eventNumber); +/** \brief Get monotonic time into \p *pDest */ epicsShareFunc int epicsTimeGetMonotonic ( epicsTimeStamp * pDest ); +/** @} */ -/* These are callable from an Interrupt Service Routine */ +/** \name ISR-callable + * These routines may be called from an Interrupt Service Routine, and + * will return a value from the last current time or event time provider + * that sucessfully returned a result from the equivalent non-ISR routine. + * @{ + */ +/** \brief Get current time into \p *pDest (ISR-safe) */ epicsShareFunc int epicsTimeGetCurrentInt(epicsTimeStamp *pDest); +/** \brief Get time of event \p eventNumber into \p *pDest (ISR-safe) */ epicsShareFunc int epicsTimeGetEventInt(epicsTimeStamp *pDest, int eventNumber); +/** @} */ -/* convert to and from ANSI C's "time_t" */ +/** \name ANSI C time_t conversions + * Convert to and from ANSI C \c time_t + * @{ + */ +/** \brief Convert epicsTimeStamp to ANSI C \c time_t */ epicsShareFunc int epicsShareAPI epicsTimeToTime_t ( time_t * pDest, const epicsTimeStamp * pSrc ); +/** \brief Convert ANSI C \c time_t to epicsTimeStamp */ epicsShareFunc int epicsShareAPI epicsTimeFromTime_t ( epicsTimeStamp * pDest, time_t src ); +/** @} */ -/* convert to and from ANSI C's "struct tm" with nano seconds */ +/** \name ANSI C struct tm conversions + * Convert to and from ANSI C's struct tm with nanoseconds + * @{ + */ +/** \brief Convert epicsTimeStamp to struct tm in local time zone */ epicsShareFunc int epicsShareAPI epicsTimeToTM ( struct tm * pDest, unsigned long * pNSecDest, const epicsTimeStamp * pSrc ); +/** \brief Convert epicsTimeStamp to struct tm in UTC/GMT */ epicsShareFunc int epicsShareAPI epicsTimeToGMTM ( struct tm * pDest, unsigned long * pNSecDest, const epicsTimeStamp * pSrc ); +/** \brief Set epicsTimeStamp from struct tm in local time zone */ epicsShareFunc int epicsShareAPI epicsTimeFromTM ( epicsTimeStamp * pDest, const struct tm * pSrc, unsigned long nSecSrc ); +/** \brief Set epicsTimeStamp from struct tm in UTC/GMT */ epicsShareFunc int epicsShareAPI epicsTimeFromGMTM ( epicsTimeStamp * pDest, const struct tm * pSrc, unsigned long nSecSrc ); +/** @} */ -/* convert to and from POSIX RT's "struct timespec" */ +/** \name POSIX RT struct timespec conversions + * Convert to and from the POSIX RealTime struct timespec + * format. + * @{ */ +/** \brief Convert epicsTimeStamp to struct timespec */ epicsShareFunc int epicsShareAPI epicsTimeToTimespec ( struct timespec * pDest, const epicsTimeStamp * pSrc ); +/** \brief Set epicsTimeStamp from struct timespec */ epicsShareFunc int epicsShareAPI epicsTimeFromTimespec ( epicsTimeStamp * pDest, const struct timespec * pSrc ); +/** @} */ -/* convert to and from BSD's "struct timeval" */ +/** \name BSD's struct timeval conversions + * Convert to and from the BSD struct timeval format. + * @{ */ +/** \brief Convert epicsTimeStamp to struct timeval */ epicsShareFunc int epicsShareAPI epicsTimeToTimeval ( struct timeval * pDest, const epicsTimeStamp * pSrc ); +/** \brief Set epicsTimeStamp from struct timeval */ epicsShareFunc int epicsShareAPI epicsTimeFromTimeval ( epicsTimeStamp * pDest, const struct timeval * pSrc ); +/** @} */ -/*arithmetic operations */ +/** \name Arithmetic operations + * Arithmetic operations on epicsTimeStamp objects and time differences + * which are always expressed as a \c double in seconds. + * @{ */ +/** \brief Time difference between \p left and \p right in seconds. */ epicsShareFunc double epicsShareAPI epicsTimeDiffInSeconds ( const epicsTimeStamp * pLeft, const epicsTimeStamp * pRight );/* left - right */ +/** \brief Add some number of seconds to \p dest */ epicsShareFunc void epicsShareAPI epicsTimeAddSeconds ( epicsTimeStamp * pDest, double secondsToAdd ); /* adds seconds to *pDest */ +/** @} */ -/*comparison operations: returns (0,1) if (false,true) */ +/** \name Comparison operators + * Comparisons between epicsTimeStamp objects, returning 0=false, 1=true. + * @{ */ +/** \brief \p left equals \p right */ epicsShareFunc int epicsShareAPI epicsTimeEqual ( const epicsTimeStamp * pLeft, const epicsTimeStamp * pRight); +/** \brief \p left not equal to \p right */ epicsShareFunc int epicsShareAPI epicsTimeNotEqual ( const epicsTimeStamp * pLeft, const epicsTimeStamp * pRight); +/** \brief \p left was before \p right */ epicsShareFunc int epicsShareAPI epicsTimeLessThan ( - const epicsTimeStamp * pLeft, const epicsTimeStamp * pRight); /*true if left < right */ + const epicsTimeStamp * pLeft, const epicsTimeStamp * pRight); +/** \brief \p right was no later than \p left */ epicsShareFunc int epicsShareAPI epicsTimeLessThanEqual ( - const epicsTimeStamp * pLeft, const epicsTimeStamp * pRight); /*true if left <= right) */ + const epicsTimeStamp * pLeft, const epicsTimeStamp * pRight); +/** \brief \p left was after \p right */ epicsShareFunc int epicsShareAPI epicsTimeGreaterThan ( - const epicsTimeStamp * pLeft, const epicsTimeStamp * pRight); /*true if left > right */ + const epicsTimeStamp * pLeft, const epicsTimeStamp * pRight); +/** \brief \p right was not before \p left */ epicsShareFunc int epicsShareAPI epicsTimeGreaterThanEqual ( - const epicsTimeStamp * pLeft, const epicsTimeStamp * pRight); /*true if left >= right */ + const epicsTimeStamp * pLeft, const epicsTimeStamp * pRight); +/** @} */ -/*convert to ASCII string */ +/** \brief Convert epicsTimeStamp to string. See epicsTime::strftime() */ epicsShareFunc size_t epicsShareAPI epicsTimeToStrftime ( char * pBuff, size_t bufLength, const char * pFormat, const epicsTimeStamp * pTS ); -/* dump current state to standard out */ +/** \brief Dump current state to stdout */ epicsShareFunc void epicsShareAPI epicsTimeShow ( const epicsTimeStamp *, unsigned interestLevel ); -/* OS dependent reentrant versions of the ANSI C interface because */ -/* vxWorks gmtime_r interface does not match POSIX standards */ +/** \name Reentrant time_t to struct tm conversions + * OS-specific reentrant versions of the ANSI C interface because the + * vxWorks \c gmtime_r interface does not match POSIX standards + * @{ */ +/** \brief Break down a \c time_t into a struct tm in the local timezone */ epicsShareFunc int epicsShareAPI epicsTime_localtime ( const time_t * clock, struct tm * result ); +/** \brief Break down a \c time_t into a struct tm in the UTC timezone */ epicsShareFunc int epicsShareAPI epicsTime_gmtime ( const time_t * clock, struct tm * result ); +/** @} */ -/* Advertised monotonic counter resolution (may not be accurate). - * Minimum non-zero difference between two calls to epicsMonotonicGet() +/** \name Monotonic time routines +* @{ */ +/** \brief Monotonic time resolution, may not be accurate. Returns the + * minimum non-zero time difference between two calls to epicsMonotonicGet() + * in units of nanoseconds. */ epicsShareFunc epicsUInt64 epicsMonotonicResolution(void); -/* Fetch monotonic counter, return is nano-seconds since an unspecified time */ +/** \brief Fetch monotonic counter, returns the number of nanoseconds since + * some unspecified time. */ epicsShareFunc epicsUInt64 epicsMonotonicGet(void); +/** @} */ #ifdef EPICS_EXPOSE_LIBCOM_MONOTONIC_PRIVATE epicsShareFunc void osdMonotonicInit(void); @@ -366,4 +605,3 @@ inline epicsTime & epicsTime::operator = ( const time_t_wrapper & rhs ) #endif /* __cplusplus */ #endif /* epicsTimehInclude */ - diff --git a/modules/libcom/src/osi/os/default/epicsMMIODef.h b/modules/libcom/src/osi/os/default/epicsMMIODef.h index dc4bb4cb7..04890bb5a 100644 --- a/modules/libcom/src/osi/os/default/epicsMMIODef.h +++ b/modules/libcom/src/osi/os/default/epicsMMIODef.h @@ -4,8 +4,14 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* - * Author: Michael Davidsaver +/** + * @file epicsMMIODef.h + * @brief Memory Mapped I/O + * + * Definitions related to Memory Mapped I/O + * + * @author Michael Davidsaver + * @ingroup mmio */ #ifndef EPICSMMIODEF_H @@ -271,4 +277,6 @@ bswap32(epicsUInt32 value) *@note All read and write operations have an implicit read or write barrier. */ + /** @} */ + #endif /* EPICSMMIODEF_H */ diff --git a/modules/libcom/src/osi/osiPoolStatus.h b/modules/libcom/src/osi/osiPoolStatus.h index b0207f185..45bc1eaf9 100644 --- a/modules/libcom/src/osi/osiPoolStatus.h +++ b/modules/libcom/src/osi/osiPoolStatus.h @@ -7,16 +7,15 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ +/**@file osiPoolStatus.h + * @author Jeff Hill + * @brief Functions to check the state of the system memory pool. + * + **/ + #ifndef INC_osiPoolStatus_H #define INC_osiPoolStatus_H -/* - * Author: Jeff Hill - * - * Functions which interrogate the state of the system wide pool - * - */ - #include #include "shareLib.h" @@ -24,12 +23,17 @@ extern "C" { #endif -/* - * tests to see if there is sufficent space for a block of the requested size - * along with whatever additional free space is necessary to keep the system running - * reliably +/**@brief Checks if a memory block of a specific size can be safely allocated. * - * this routine is called quite frequently so an efficent implementation is important + * The meaning of "safely allocated" is target-specific, some additional free + * space is usually necessary to keep the system running reliably. + * On vxWorks this returns True if at least 100000 bytes is free. + * + * @note This routine is called quite frequently by the IOC so an efficent + * implementation is important. + * + * @param contiguousBlockSize Block size to check. + * @return True if the requested memory should be available. */ epicsShareFunc int epicsShareAPI osiSufficentSpaceInPool ( size_t contiguousBlockSize ); diff --git a/modules/libcom/src/ring/epicsRingBytes.h b/modules/libcom/src/ring/epicsRingBytes.h index 3dc0081ad..ef51ba577 100644 --- a/modules/libcom/src/ring/epicsRingBytes.h +++ b/modules/libcom/src/ring/epicsRingBytes.h @@ -7,11 +7,21 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ - -/* - * Author: Marty Kraimer Date: 15JUL99 - * Eric Norum - * Ralph Lange +/** + * @file epicsRingBytes.h + * @author Marty Kraimer, Eric Norum, Ralph Lange + * @brief A circular buffer to store bytes + * + * @details + * EpicsRingBytes provides a C API for creating and using ring buffers + * (first in first out circular buffers) that store bytes. The unlocked + * variant is designed so that one writer thread and one reader thread + * can access the ring simultaneously without requiring mutual exclusion. + * The locked variant uses an epicsSpinLock, and works with any numbers of + * writer and reader threads. + * @note If there is only one writer it is not necessary to lock for puts. + * If there is a single reader it is not necessary to lock for gets. + * epicsRingBytesLocked uses a spinlock. */ #ifndef INCepicsRingBytesh @@ -23,35 +33,103 @@ extern "C" { #include "shareLib.h" +/** @brief An identifier for a ring buffer */ typedef void *epicsRingBytesId; typedef void const *epicsRingBytesIdConst; +/** + * @brief Create a new ring buffer + * @param nbytes Size of ring buffer to create + * @return Ring buffer Id or NULL on failure + */ epicsShareFunc epicsRingBytesId epicsShareAPI epicsRingBytesCreate(int nbytes); -/* Same, but secured by a spinlock */ +/** + * @brief Create a new ring buffer, secured by a spinlock + * @param nbytes Size of ring buffer to create + * @return Ring buffer Id or NULL on failure + */ epicsShareFunc epicsRingBytesId epicsShareAPI epicsRingBytesLockedCreate(int nbytes); +/** + * @brief Delete the ring buffer and free any associated memory + * @param id RingbufferID returned by epicsRingBytesCreate() + */ epicsShareFunc void epicsShareAPI epicsRingBytesDelete(epicsRingBytesId id); +/** + * @brief Read data out of the ring buffer + * @param id RingbufferID returned by epicsRingBytesCreate() + * @param value Where to put the data fetched from the buffer + * @param nbytes Maximum number of bytes to get + * @return The number of bytes actually fetched + */ epicsShareFunc int epicsShareAPI epicsRingBytesGet( epicsRingBytesId id, char *value,int nbytes); +/** + * @brief Write data into the ring buffer + * @param id RingbufferID returned by epicsRingBytesCreate() + * @param value Source of the data to be put into the buffer + * @param nbytes How many bytes to put + * @return The number of bytes actually stored, zero if not enough space + */ epicsShareFunc int epicsShareAPI epicsRingBytesPut( epicsRingBytesId id, char *value,int nbytes); +/** + * @brief Make the ring buffer empty + * @param id RingbufferID returned by epicsRingBytesCreate() + * @note Should only be used when both gets and puts are locked out. + */ epicsShareFunc void epicsShareAPI epicsRingBytesFlush(epicsRingBytesId id); +/** + * @brief Return the number of free bytes in the ring buffer + * @param id RingbufferID returned by epicsRingBytesCreate() + * @return The number of free bytes in the ring buffer + */ epicsShareFunc int epicsShareAPI epicsRingBytesFreeBytes(epicsRingBytesId id); +/** + * @brief Return the number of bytes currently stored in the ring buffer + * @param id RingbufferID returned by epicsRingBytesCreate() + * @return The number of bytes currently stored in the ring buffer + */ epicsShareFunc int epicsShareAPI epicsRingBytesUsedBytes(epicsRingBytesId id); +/** + * @brief Return the size of the ring buffer + * @param id RingbufferID returned by epicsRingBytesCreate() + * @return Return the size of the ring buffer, i.e., nbytes specified in + * the call to epicsRingBytesCreate(). + */ epicsShareFunc int epicsShareAPI epicsRingBytesSize(epicsRingBytesId id); +/** + * @brief Test if the ring buffer is currently empty. + * @param id RingbufferID returned by epicsRingBytesCreate() + * @return 1 if the buffer is empty, otherwise 0 + */ epicsShareFunc int epicsShareAPI epicsRingBytesIsEmpty(epicsRingBytesId id); +/** + * @brief Test if the ring buffer is currently full. + * @param id RingbufferID returned by epicsRingBytesCreate() + * @return 1 if the buffer is full, otherwise 0 + */ epicsShareFunc int epicsShareAPI epicsRingBytesIsFull(epicsRingBytesId id); +/** + * @brief See how full a ring buffer has been since it was last checked. + * + * Returns the maximum amount of data the ring buffer has held in bytes + * since the water mark was last reset. A new ring buffer starts with a + * water mark of 0. + * @param id RingbufferID returned by epicsRingBytesCreate() + * @return Actual Highwater mark + */ epicsShareFunc int epicsShareAPI epicsRingBytesHighWaterMark(epicsRingBytesIdConst id); +/** + * @brief Reset the Highwater mark of the ring buffer. + * + * The Highwater mark will be set to the current usage + * @param id RingbufferID returned by epicsRingBytesCreate() + */ epicsShareFunc void epicsShareAPI epicsRingBytesResetHighWaterMark(epicsRingBytesId id); #ifdef __cplusplus } #endif -/* NOTES - If there is only one writer it is not necessary to lock for put - If there is a single reader it is not necessary to lock for puts - - epicsRingBytesLocked uses a spinlock. -*/ #endif /* INCepicsRingBytesh */ diff --git a/modules/libcom/src/ring/epicsRingPointer.h b/modules/libcom/src/ring/epicsRingPointer.h index 68bf8f5a6..c50128247 100644 --- a/modules/libcom/src/ring/epicsRingPointer.h +++ b/modules/libcom/src/ring/epicsRingPointer.h @@ -7,40 +7,92 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ - -/* - * Author: Marty Kraimer Date: 15JUL99 - * Ralph Lange +/** + * @file epicsRingPointer.h + * @brief A circular buffer to store pointers + * @author Marty Kraimer, Ralph Lange + * + * @details + * epicsRingPointer.h provides both C and C++ APIs for creating and using ring + * buffers (first in first out circular buffers) that store pointers. The + * unlocked kind is designed so that one writer thread and one reader thread + * can access the ring simultaneously without requiring mutual exclusion. The + * locked variant uses an epicsSpinLock, and works with any numbers of writer + * and reader threads. + * @note If there is only one writer it is not necessary to lock pushes. + * If there is a single reader it is not necessary to lock pops. + * epicsRingPointerLocked uses a spinlock. */ #ifndef INCepicsRingPointerh #define INCepicsRingPointerh -/* NOTES - * If there is only one writer it is not necessary to lock push - * If there is a single reader it is not necessary to lock pop - * - * epicsRingPointerLocked uses a spinlock. - */ #include "epicsSpin.h" #include "shareLib.h" #ifdef __cplusplus +/** + * @brief A C++ template class providing methods for creating and using a ring + * buffer (a first in, first out circular buffer) that stores pointers to + * objects of the template type. + */ template class epicsRingPointer { public: /* Functions */ + /**@brief Constructor + * @param size Maximum number of elements (pointers) that can be stored + * @param locked If true, the spin lock secured variant is created + */ epicsRingPointer(int size, bool locked); + /**@brief Destructor + */ ~epicsRingPointer(); + /**@brief Push a new entry on the ring + * @return True on success, False if the buffer was full + */ bool push(T *p); + /**@brief Take an element off the ring + * @return The element, or NULL if the ring was empty + */ T* pop(); + /**@brief Remove all elements from the ring. + * @note If this operation is performed on a ring buffer of the + * unsecured kind, all access to the ring should be locked. + */ void flush(); + /**@brief Get how much free space remains in the ring + * @return The number of additional elements the ring could hold. + */ int getFree() const; + /**@brief Get how many elements are stored on the ring + * @return The number of elements currently stored. + */ int getUsed() const; + /**@brief Get the size of the ring + * @return The @c size specified when the ring was created. + */ int getSize() const; + /**@brief Test if the ring is currently empty + * @return True if the ring is empty, otherwise false. + */ bool isEmpty() const; + /**@brief Test if the ring is currently full + * @return True if the ring is full, otherwise false. + */ bool isFull() const; + /**@brief See how full the ring has got since it was last checked. + * + * Returns the maximum number of elements the ring + * buffer has held since the water mark was last reset. + * A new ring buffer starts with a water mark of 0. + * @return Actual highwater mark + */ int getHighWaterMark() const; + /**@brief Reset high water mark + * + * High water mark will be set to the current usage + */ void resetHighWaterMark(); private: /* Prevent compiler-generated member functions */ @@ -62,24 +114,93 @@ private: /* Data */ extern "C" { #endif /*__cplusplus */ +/** @brief An identifier for the C API to a ring buffer storing pointers */ typedef void *epicsRingPointerId; typedef void const *epicsRingPointerIdConst; - +/** + * @brief Create a new ring buffer + * @param size Size of ring buffer to create + * @return Ring buffer identifier or NULL on failure + */ epicsShareFunc epicsRingPointerId epicsShareAPI epicsRingPointerCreate(int size); -/* Same, but secured by a spinlock */ +/** + * @brief Create a new ring buffer, secured by a spinlock + * @param size Size of ring buffer to create + * @return Ring buffer identifier or NULL on failure + */ epicsShareFunc epicsRingPointerId epicsShareAPI epicsRingPointerLockedCreate(int size); +/** + * @brief Delete the ring buffer and free any associated memory + * @param id Ring buffer identifier + */ epicsShareFunc void epicsShareAPI epicsRingPointerDelete(epicsRingPointerId id); -/*ringPointerPush returns (0,1) if p (was not, was) put on ring*/ +/** + * @brief Push pointer into the ring buffer + * @param id Ring buffer identifier + * @param p Pointer to be pushed to the ring + * @return 1 if the pointer was successfully pushed, 0 if the buffer was full + */ epicsShareFunc int epicsShareAPI epicsRingPointerPush(epicsRingPointerId id,void *p); -/*ringPointerPop returns 0 if ring is empty*/ +/** + * @brief Take an element off the ring + * @param id Ring buffer identifier + * @return The pointer from the buffer, or NULL if the ring was empty + */ epicsShareFunc void* epicsShareAPI epicsRingPointerPop(epicsRingPointerId id) ; +/** + * @brief Remove all elements from the ring + * @param id Ring buffer identifier + * @note If this operation is performed on a ring buffer of the unsecured + * kind, all access to the ring should be locked. + */ epicsShareFunc void epicsShareAPI epicsRingPointerFlush(epicsRingPointerId id); +/** + * @brief Return the amount of empty space in the ring buffer + * @param id Ring buffer identifier + * @return The number of additional elements it could hold. + */ epicsShareFunc int epicsShareAPI epicsRingPointerGetFree(epicsRingPointerId id); +/** + * @brief Return the number of elements stored in the ring buffer + * @param id Ring buffer identifier + * @return The number of elements stored in the ring buffer + */ epicsShareFunc int epicsShareAPI epicsRingPointerGetUsed(epicsRingPointerId id); +/** + * @brief Return the size of the ring + * @param id Ring buffer identifier + * @return The size of the ring buffer, i.e. the value of @c size + * given when the ring was created. + */ epicsShareFunc int epicsShareAPI epicsRingPointerGetSize(epicsRingPointerId id); +/** + * @brief Check if the ring buffer is currently empty + * @param id Ring buffer identifier + * @return 1 if the ring is empty, otherwise 0 + */ epicsShareFunc int epicsShareAPI epicsRingPointerIsEmpty(epicsRingPointerId id); +/** + * @brief Check if the ring buffer is currently full + * @param id Ring buffer identifier + * @return 1 if the ring buffer is full, otherwise 0 + */ epicsShareFunc int epicsShareAPI epicsRingPointerIsFull(epicsRingPointerId id); +/** + * @brief Get the Highwater mark of the ring buffer + * + * Returns the largest number of elements the ring buffer has held since + * the water mark was last reset. A new ring buffer starts with a + * water mark of 0. + * @param id Ring buffer identifier + * @return Actual Highwater mark + */ epicsShareFunc int epicsShareAPI epicsRingPointerGetHighWaterMark(epicsRingPointerIdConst id); +/** + * @brief Reset the Highwater mark of the ring buffer + * + * The Highwater mark will be set to the current usage + * @param id Ring buffer identifier + */ epicsShareFunc void epicsShareAPI epicsRingPointerResetHighWaterMark(epicsRingPointerId id); /* This routine was incorrectly named in previous releases */ @@ -92,12 +213,6 @@ epicsShareFunc void epicsShareAPI epicsRingPointerResetHighWaterMark(epicsRingPo /* INLINE FUNCTIONS */ -/* Algorithm note - * Space is allocated for one additional element. - * A put request is rejected if the it would cause nextPush to equal nextPop - * The algorithm does not require locking puts for a single writer - * or locking of gets for a single reader - */ #ifdef __cplusplus template diff --git a/modules/libcom/src/yajl/yajl_alloc.h b/modules/libcom/src/yajl/yajl_alloc.h index 433b16c9d..406310ac0 100644 --- a/modules/libcom/src/yajl/yajl_alloc.h +++ b/modules/libcom/src/yajl/yajl_alloc.h @@ -16,8 +16,12 @@ /** * \file yajl_alloc.h - * default memory allocation routines for yajl which use malloc/realloc and - * free + * \brief Memory allocation macros for yajl + * \author Lloyd Hilaiel + * + * These macros are used inside YAJL instead of directly calling + * malloc(), realloc() or free(). They call the equivalent method + * in their \ref yajl_alloc_funcs parameter \a afs. */ #ifndef __YAJL_ALLOC_H__ diff --git a/modules/libcom/src/yajl/yajl_common.h b/modules/libcom/src/yajl/yajl_common.h index 4bc63eead..001de8def 100644 --- a/modules/libcom/src/yajl/yajl_common.h +++ b/modules/libcom/src/yajl/yajl_common.h @@ -26,47 +26,54 @@ extern "C" { #endif +/** \file yajl_common.h + * \brief Common routines and macros used by other YAJL APIs. + * \author Lloyd Hilaiel + */ + /** YAJL API history in brief * - * Originally macro not defined - * YAJL 1.0.12 - * Bundled with EPICS Base 3.15.0.1 + * This macro was not defined in the + * YAJL 1.0.12 version that was + * bundled with EPICS Base 3.15.0.1 * * YAJL 2.1.0 - * Changes argument type for yajl_integer() from 'int' to 'long long' - * Changes argument type for yajl_string() and yajl_map_key() from 'unsigned' to 'size_t' - * Replacement of struct yajl_parser_config with yajl_config() - * Replacement of yajl_parse_complete() with yajl_complete_parse() + * \li Changes argument type for yajl_integer() from \c int to \c long \c long + * \li Changes argument type for yajl_string() and yajl_map_key() from \c unsigned to \c size_t + * \li Replacement of struct yajl_parser_config with yajl_config() + * \li Replacement of yajl_parse_complete() with yajl_complete_parse() */ #define EPICS_YAJL_VERSION VERSION_INT(2,1,0,0) +/** Maximum generation depth for YAJL's JSON generation routines */ #define YAJL_MAX_DEPTH 128 +/** Symbol decoration for Microsoft builds */ #define YAJL_API epicsShareFunc -/** pointer to a malloc function, supporting client overriding memory +/** Pointer to a malloc() function, supporting client overriding memory * allocation routines */ typedef void * (*yajl_malloc_func)(void *ctx, size_t sz); -/** pointer to a free function, supporting client overriding memory +/** Pointer to a free() function, supporting client overriding memory * allocation routines */ typedef void (*yajl_free_func)(void *ctx, void * ptr); -/** pointer to a realloc function which can resize an allocation. */ +/** Pointer to a realloc() function which can resize an allocation. */ typedef void * (*yajl_realloc_func)(void *ctx, void * ptr, size_t sz); /** A structure which can be passed to yajl_*_alloc routines to allow the * client to specify memory allocation functions to be used. */ typedef struct { - /** pointer to a function that can allocate uninitialized memory */ + /** Pointer to a function that can allocate uninitialized memory */ yajl_malloc_func malloc; - /** pointer to a function that can resize memory allocations */ + /** Pointer to a function that can resize memory allocations */ yajl_realloc_func realloc; - /** pointer to a function that can free memory allocated using + /** Pointer to a function that can free memory allocated using * reallocFunction or mallocFunction */ yajl_free_func free; - /** a context pointer that will be passed to above allocation routines */ + /** A context pointer that will be passed to above allocation routines */ void * ctx; } yajl_alloc_funcs; diff --git a/modules/libcom/src/yajl/yajl_gen.h b/modules/libcom/src/yajl/yajl_gen.h index 3ea05e555..233f7d141 100644 --- a/modules/libcom/src/yajl/yajl_gen.h +++ b/modules/libcom/src/yajl/yajl_gen.h @@ -16,7 +16,8 @@ /** * \file yajl_gen.h - * Interface to YAJL's JSON generation facilities. + * \brief Interface to YAJL's JSON generation facilities. + * \author Lloyd Hilaiel */ #ifndef __YAJL_GEN_H__ @@ -27,49 +28,49 @@ #ifdef __cplusplus extern "C" { #endif - /** generator status codes */ + /** Generator status codes */ typedef enum { - /** no error */ + /** No error */ yajl_gen_status_ok = 0, - /** at a point where a map key is generated, a function other than - * yajl_gen_string was called */ + /** At a point where a map key is generated, a function other than + * yajl_gen_string() was called */ yajl_gen_keys_must_be_strings, /** YAJL's maximum generation depth was exceeded. see - * YAJL_MAX_DEPTH */ + * \ref YAJL_MAX_DEPTH */ yajl_max_depth_exceeded, /** A generator function (yajl_gen_XXX) was called while in an error * state */ yajl_gen_in_error_state, /** A complete JSON document has been generated */ yajl_gen_generation_complete, - /** yajl_gen_double was passed an invalid floating point value + /** yajl_gen_double() was passed an invalid floating point value * (infinity or NaN). */ yajl_gen_invalid_number, /** A print callback was passed in, so there is no internal * buffer to get from */ yajl_gen_no_buf, - /** returned from yajl_gen_string() when the yajl_gen_validate_utf8 + /** Returned from yajl_gen_string() when the yajl_gen_validate_utf8() * option is enabled and an invalid was passed by client code. */ yajl_gen_invalid_string } yajl_gen_status; - /** an opaque handle to a generator */ + /** An opaque handle to a generator */ typedef struct yajl_gen_t * yajl_gen; - /** a callback used for "printing" the results. */ + /** A callback used for "printing" the results. */ typedef void (*yajl_print_t)(void * ctx, const char * str, size_t len); - /** configuration parameters for the parser, these may be passed to + /** Configuration parameters for the parser, these may be passed to * yajl_gen_config() along with option specific argument(s). In general, * all configuration parameters default to *off*. */ typedef enum { - /** generate indented (beautiful) output */ + /** Generate indented (beautiful) output */ yajl_gen_beautify = 0x01, /** - * Set an indent string which is used when yajl_gen_beautify + * Set an indent string which is used when yajl_gen_beautify() * is enabled. Maybe something like \\t or some number of * spaces. The default is four spaces ' '. */ @@ -77,11 +78,12 @@ extern "C" { /** * Set a function and context argument that should be used to * output generated json. the function should conform to the - * yajl_print_t prototype while the context argument is a + * yajl_print_t() prototype while the context argument is a * void * of your choosing. * - * example: + * Example: \code{.cpp} * yajl_gen_config(g, yajl_gen_print_callback, myFunc, myVoidPtr); + * \endcode */ yajl_gen_print_callback = 0x04, /** @@ -91,7 +93,7 @@ extern "C" { */ yajl_gen_validate_utf8 = 0x08, /** - * the forward solidus (slash or '/' in human) is not required to be + * The forward solidus (slash or '/' in human) is not required to be * escaped in json text. By default, YAJL will not escape it in the * iterest of saving bytes. Setting this flag will cause YAJL to * always escape '/' in generated JSON strings. @@ -99,51 +101,62 @@ extern "C" { yajl_gen_escape_solidus = 0x10 } yajl_gen_option; - /** allow the modification of generator options subsequent to handle - * allocation (via yajl_alloc) + /** Allow the modification of generator options subsequent to handle + * allocation (via yajl_alloc()) * \returns zero in case of errors, non-zero otherwise */ YAJL_API int yajl_gen_config(yajl_gen g, yajl_gen_option opt, ...); - /** allocate a generator handle - * \param allocFuncs an optional pointer to a structure which allows + /** Allocate a generator handle + * \param allocFuncs An optional pointer to a structure which allows * the client to overide the memory allocation * used by yajl. May be NULL, in which case - * malloc/free/realloc will be used. + * malloc(), free() and realloc() will be used. * * \returns an allocated handle on success, NULL on failure (bad params) */ YAJL_API yajl_gen yajl_gen_alloc(const yajl_alloc_funcs * allocFuncs); - /** free a generator handle */ + /** Free a generator handle */ YAJL_API void yajl_gen_free(yajl_gen handle); + /** Generate an integer number. */ YAJL_API yajl_gen_status yajl_gen_integer(yajl_gen hand, long long int number); - /** generate a floating point number. number may not be infinity or + /** Generate a floating point number. \p number may not be infinity or * NaN, as these have no representation in JSON. In these cases the - * generator will return 'yajl_gen_invalid_number' */ + * generator will return \ref yajl_gen_invalid_number */ YAJL_API yajl_gen_status yajl_gen_double(yajl_gen hand, double number); + /** Generate a number from the string given in \p num. */ YAJL_API yajl_gen_status yajl_gen_number(yajl_gen hand, const char * num, size_t len); + /** Generate a string value or map key from \p str. */ YAJL_API yajl_gen_status yajl_gen_string(yajl_gen hand, const unsigned char * str, size_t len); + /** Generate a \c null value. */ YAJL_API yajl_gen_status yajl_gen_null(yajl_gen hand); + /** Generate a \c true or \c false value from \p boolean. */ YAJL_API yajl_gen_status yajl_gen_bool(yajl_gen hand, int boolean); + /** Start generating a JSON map. This should be followed by calls to + * yajl_gen_string() to provide a key and another yajl_gen routine + * to provide the value associated with that key. */ YAJL_API yajl_gen_status yajl_gen_map_open(yajl_gen hand); + /** Finish generating a JSON map. */ YAJL_API yajl_gen_status yajl_gen_map_close(yajl_gen hand); + /** Start generating a JSON array. */ YAJL_API yajl_gen_status yajl_gen_array_open(yajl_gen hand); + /** Finish generating a JSON array. */ YAJL_API yajl_gen_status yajl_gen_array_close(yajl_gen hand); - /** access the null terminated generator buffer. If incrementally - * outputing JSON, one should call yajl_gen_clear to clear the + /** Access the null terminated generator buffer. If incrementally + * outputing JSON, one should call yajl_gen_clear() to clear the * buffer. This allows stream generation. */ YAJL_API yajl_gen_status yajl_gen_get_buf(yajl_gen hand, const unsigned char ** buf, size_t * len); - /** clear yajl's output buffer, but maintain all internal generation + /** Clear yajl's output buffer, but maintain all internal generation * state. This function will not "reset" the generator state, and is * intended to enable incremental JSON outputing. */ YAJL_API void yajl_gen_clear(yajl_gen hand); diff --git a/modules/libcom/src/yajl/yajl_parse.h b/modules/libcom/src/yajl/yajl_parse.h index f113c7cf4..663a3a864 100644 --- a/modules/libcom/src/yajl/yajl_parse.h +++ b/modules/libcom/src/yajl/yajl_parse.h @@ -16,7 +16,8 @@ /** * \file yajl_parse.h - * Interface to YAJL's JSON stream parsing facilities. + * \brief Interface to YAJL's JSON stream parsing facilities. + * \author Lloyd Hilaiel */ #ifndef __YAJL_PARSE_H__ @@ -27,47 +28,45 @@ #ifdef __cplusplus extern "C" { #endif - /** error codes returned from this interface */ + /** Error codes returned from this interface */ typedef enum { - /** no error was encountered */ + /** No error was encountered */ yajl_status_ok, - /** a client callback returned zero, stopping the parse */ + /** A client callback returned zero, stopping the parse */ yajl_status_client_canceled, - /** An error occured during the parse. Call yajl_get_error for + /** An error occured during the parse. Call yajl_get_error() for * more information about the encountered error */ yajl_status_error } yajl_status; - /** attain a human readable, english, string for an error */ + /** Attain a human readable, english, string for an error */ YAJL_API const char * yajl_status_to_string(yajl_status code); - /** an opaque handle to a parser */ + /** An opaque handle to a parser */ typedef struct yajl_handle_t * yajl_handle; - /** yajl is an event driven parser. this means as json elements are + /** YAJL is an event driven parser. This means as json elements are * parsed, you are called back to do something with the data. The * functions in this table indicate the various events for which * you will be called back. Each callback accepts a "context" - * pointer, this is a void * that is passed into the yajl_parse + * pointer, this is a void * that is passed into the yajl_parse() * function which the client code may use to pass around context. * * All callbacks return an integer. If non-zero, the parse will * continue. If zero, the parse will be canceled and - * yajl_status_client_canceled will be returned from the parse. + * yajl_status_client_canceled() will be returned from the parse. * - * \attention { + * \attention * A note about the handling of numbers: - * * yajl will only convert numbers that can be represented in a * double or a 64 bit (long long) int. All other numbers will - * be passed to the client in string form using the yajl_number - * callback. Furthermore, if yajl_number is not NULL, it will - * always be used to return numbers, that is yajl_integer and - * yajl_double will be ignored. If yajl_number is NULL but one - * of yajl_integer or yajl_double are defined, parsing of a + * be passed to the client in string form using the yajl_number() + * callback. Furthermore, if yajl_number() is not NULL, it will + * always be used to return numbers, that is yajl_integer() and + * yajl_double() will be ignored. If yajl_number() is NULL but one + * of yajl_integer() or yajl_double() are defined, parsing of a * number larger than is representable in a double or 64 bit * integer will result in a parse error. - * } */ typedef struct { int (* yajl_null)(void * ctx); @@ -79,7 +78,7 @@ extern "C" { int (* yajl_number)(void * ctx, const char * numberVal, size_t numberLen); - /** strings are returned as pointers into the JSON text when, + /** Strings are returned as pointers into the JSON text when, * possible, as a result, they are _not_ null padded */ int (* yajl_string)(void * ctx, const unsigned char * stringVal, size_t stringLen); @@ -93,8 +92,8 @@ extern "C" { int (* yajl_end_array)(void * ctx); } yajl_callbacks; - /** allocate a parser handle - * \param callbacks a yajl callbacks structure specifying the + /** Allocate a parser handle + * \param callbacks A yajl callbacks structure specifying the * functions to call when different JSON entities * are encountered in the input text. May be NULL, * which is only useful for validation. @@ -107,7 +106,7 @@ extern "C" { void * ctx); - /** configuration parameters for the parser, these may be passed to + /** Configuration parameters for the parser, these may be passed to * yajl_config() along with option specific argument(s). In general, * all configuration parameters default to *off*. */ typedef enum { @@ -115,8 +114,9 @@ extern "C" { * JSON input. Non-standard, but rather fun * arguments: toggled off with integer zero, on otherwise. * - * example: + * Example: \code{.cpp} * yajl_config(h, yajl_allow_comments, 1); // turn comment support on + * \endcode */ yajl_allow_comments = 0x01, /** @@ -125,8 +125,9 @@ extern "C" { * this option makes parsing slightly more expensive (~7% depending * on processor and compiler in use) * - * example: + * Example: \code{.cpp} * yajl_config(h, yajl_dont_validate_strings, 1); // disable utf8 checking + * \endcode */ yajl_dont_validate_strings = 0x02, /** @@ -157,17 +158,17 @@ extern "C" { yajl_allow_partial_values = 0x10 } yajl_option; - /** allow the modification of parser options subsequent to handle - * allocation (via yajl_alloc) + /** Allow the modification of parser options subsequent to handle + * allocation (via yajl_alloc()) * \returns zero in case of errors, non-zero otherwise */ YAJL_API int yajl_config(yajl_handle h, yajl_option opt, ...); - /** free a parser handle */ + /** Free a parser handle */ YAJL_API void yajl_free(yajl_handle handle); /** Parse some json! - * \param hand - a handle to the json parser allocated with yajl_alloc + * \param hand - a handle to the json parser allocated with yajl_alloc() * \param jsonText - a pointer to the UTF8 json text to be parsed * \param jsonTextLength - the length, in bytes, of input text */ @@ -182,11 +183,11 @@ extern "C" { * yajl can't know whether another digit is next or some character * that would terminate the integer token. * - * \param hand - a handle to the json parser allocated with yajl_alloc + * \param hand - a handle to the json parser allocated with yajl_alloc() */ YAJL_API yajl_status yajl_complete_parse(yajl_handle hand); - /** get an error string describing the state of the + /** Get an error string describing the state of the * parse. * * If verbose is non-zero, the message will include the JSON @@ -194,14 +195,14 @@ extern "C" { * the specific char. * * \returns A dynamically allocated string will be returned which should - * be freed with yajl_free_error + * be freed with yajl_free_error() */ YAJL_API unsigned char * yajl_get_error(yajl_handle hand, int verbose, const unsigned char * jsonText, size_t jsonTextLength); /** - * get the amount of data consumed from the last chunk passed to YAJL. + * Get the amount of data consumed from the last chunk passed to YAJL. * * In the case of a successful parse this can help you understand if * the entire buffer was consumed (which will allow you to handle @@ -214,7 +215,7 @@ extern "C" { */ YAJL_API size_t yajl_get_bytes_consumed(yajl_handle hand); - /** free an error returned from yajl_get_error */ + /** Free an error returned from yajl_get_error() */ YAJL_API void yajl_free_error(yajl_handle hand, unsigned char * str); #ifdef __cplusplus From 59c68807b6eb3525619bb210897b1520a1a9b96c Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 13 May 2020 15:26:34 -0500 Subject: [PATCH 179/216] Heinz Junkes' fix for lp: #1812084 Build failure on RTEMS I reduced some of the code duplication from his original. --- src/libCom/osi/os/RTEMS/osdThread.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/libCom/osi/os/RTEMS/osdThread.c b/src/libCom/osi/os/RTEMS/osdThread.c index c19279ecf..8cbfc7086 100644 --- a/src/libCom/osi/os/RTEMS/osdThread.c +++ b/src/libCom/osi/os/RTEMS/osdThread.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -615,6 +616,23 @@ showInternalTaskInfo (rtems_id tid) } thread = *the_thread; _Thread_Enable_dispatch(); + + /* This looks a bit weird, but it has to support RTEMS versions both before + * and after 4.10.2 when threads changed how their priorities are stored. + */ + int policy; + struct sched_param sp; + rtems_task_priority real_priority, current_priority; + rtems_status_code sc = pthread_getschedparam(tid, &policy, &sp); + if (sc == RTEMS_SUCCESSFUL) { + real_priority = sp.sched_priority; + sc = rtems_task_set_priority(tid, RTEMS_CURRENT_PRIORITY, ¤t_priority); + } + if (sc != RTEMS_SUCCESSFUL) { + fprintf(epicsGetStdout(),"%-30s", " *** RTEMS task gone! ***"); + return; + } + /* * Show both real and current priorities if they differ. * Note that the epicsThreadGetOsiPriorityValue routine is not used here. @@ -622,17 +640,17 @@ showInternalTaskInfo (rtems_id tid) * that priority should be displayed, not the value truncated to * the EPICS range. */ - epicsPri = 199-thread.real_priority; + epicsPri = 199-real_priority; if (epicsPri < 0) fprintf(epicsGetStdout()," <0"); else if (epicsPri > 99) fprintf(epicsGetStdout()," >99"); else fprintf(epicsGetStdout()," %4d", epicsPri); - if (thread.current_priority == thread.real_priority) - fprintf(epicsGetStdout(),"%4d ", (int)thread.current_priority); + if (current_priority == real_priority) + fprintf(epicsGetStdout(),"%4d ", (int)current_priority); else - fprintf(epicsGetStdout(),"%4d/%-3d", (int)thread.real_priority, (int)thread.current_priority); + fprintf(epicsGetStdout(),"%4d/%-3d", (int)real_priority, (int)current_priority); showBitmap (bitbuf, thread.current_state, taskState); fprintf(epicsGetStdout(),"%8.8s", bitbuf); if (thread.current_state & (STATES_WAITING_FOR_SEMAPHORE | From b03e2f376bf8bd126dacc684b34afc35c309fd92 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 13 May 2020 16:11:31 -0500 Subject: [PATCH 180/216] eMQTest: Start each test with a new (empty) queue If fastReceiver() took more than 0.01 seconds to exit, sleepySender() might have pushed a second message onto the queue after setting recvExit, so there would be an extra message in the queue for the next test, which I was seeing on Appveyor. That's my current theory... --- src/libCom/test/epicsMessageQueueTest.cpp | 36 +++++++++++------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/libCom/test/epicsMessageQueueTest.cpp b/src/libCom/test/epicsMessageQueueTest.cpp index b793ce2cd..f23683c84 100644 --- a/src/libCom/test/epicsMessageQueueTest.cpp +++ b/src/libCom/test/epicsMessageQueueTest.cpp @@ -136,16 +136,16 @@ fastReceiver(void *arg) epicsEventSignal(complete); } -void sleepySender(epicsMessageQueue *q, double delay) +void sleepySender(double delay) { testDiag("sleepySender: sending every %.3f seconds", delay); + epicsMessageQueue q(4, 20); epicsThreadCreate("Fast Receiver", epicsThreadPriorityMedium, - mediumStack, fastReceiver, q); + mediumStack, fastReceiver, &q); numSent = 0; - numReceived = 0; for (int i = 0 ; i < SLEEPY_TESTS ; i++) { - if (q->send((void *)msg1, 4) == 0) { + if (q.send((void *)msg1, 4) == 0) { numSent++; } epicsThreadSleep(delay); @@ -157,7 +157,7 @@ void sleepySender(epicsMessageQueue *q, double delay) numReceived, SLEEPY_TESTS); recvExit = 1; - while (q->send((void *)msg1, 4) != 0) + while (q.send((void *)msg1, 4) != 0) epicsThreadSleep(0.01); epicsEventMustWait(complete); } @@ -182,17 +182,18 @@ fastSender(void *arg) epicsEventSignal(complete); } -void sleepyReceiver(epicsMessageQueue *q, double delay) +void sleepyReceiver(double delay) { testDiag("sleepyReceiver: acquiring every %.3f seconds", delay); + epicsMessageQueue q(4, 20); // Fill the queue - for (int i = q->pending(); i < 4 ;i++) { - q->send((void *)msg1, 4); + for (int i = q.pending(); i < 4 ;i++) { + q.send((void *)msg1, 4); } epicsThreadCreate("Fast Sender", epicsThreadPriorityMedium, - mediumStack, fastSender, q); + mediumStack, fastSender, &q); epicsThreadSleep(0.5); char cbuf[80]; @@ -200,7 +201,7 @@ void sleepyReceiver(epicsMessageQueue *q, double delay) numReceived = 0; for (int i = 0 ; i < SLEEPY_TESTS ; i++) { - len = q->receive(cbuf, sizeof cbuf); + len = q.receive(cbuf, sizeof cbuf); if (len > 0) { numReceived++; } @@ -213,7 +214,7 @@ void sleepyReceiver(epicsMessageQueue *q, double delay) numReceived, SLEEPY_TESTS); sendExit = 1; - while (q->receive(cbuf, sizeof cbuf) <= 0) + while (q.receive(cbuf, sizeof cbuf) <= 0) epicsThreadSleep(0.01); epicsEventMustWait(complete); } @@ -245,7 +246,6 @@ extern "C" void messageQueueTest(void *parm) int want; epicsMessageQueue *q1 = new epicsMessageQueue(4, 20); - epicsMessageQueue *q2 = new epicsMessageQueue(4, 20); testDiag("Simple single-thread tests:"); i = 0; @@ -360,12 +360,12 @@ extern "C" void messageQueueTest(void *parm) SLEEPY_TESTS * 0.010); complete = epicsEventMustCreate(epicsEventEmpty); - sleepySender(q2, 0.009); - sleepySender(q2, 0.010); - sleepySender(q2, 0.011); - sleepyReceiver(q2, 0.009); - sleepyReceiver(q2, 0.010); - sleepyReceiver(q2, 0.011); + sleepySender(0.009); + sleepySender(0.010); + sleepySender(0.011); + sleepyReceiver(0.009); + sleepyReceiver(0.010); + sleepyReceiver(0.011); testDiag("Single receiver, single sender tests:"); epicsThreadSetPriority(myThreadId, epicsThreadPriorityHigh); From 2f28ce94f4c4965f9a887a0e72bcd272f1aefd90 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 15 May 2020 11:36:45 -0500 Subject: [PATCH 181/216] Release Notes changes for 3.15.8 --- documentation/RELEASE_NOTES.md | 45 +++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/documentation/RELEASE_NOTES.md b/documentation/RELEASE_NOTES.md index 6217fa9a2..fbcf72aaa 100644 --- a/documentation/RELEASE_NOTES.md +++ b/documentation/RELEASE_NOTES.md @@ -1,10 +1,28 @@ # EPICS Base Release 3.15.8 -This version of EPICS Base has not been released yet. +## Changes made between 3.15.7 and 3.15.8 -## Changes made on the 3.15 branch since 3.15.7 +### Bug fixes + +The following launchpad bugs have fixes included in this release: + +- [lp: 1812084](https://bugs.launchpad.net/epics-base/+bug/1812084), Build + failure on RTEMS 4.10.2 +- [lp: 1829770](https://bugs.launchpad.net/epics-base/+bug/1829770), event + record device support broken with constant INP +- [lp: 1829919](https://bugs.launchpad.net/epics-base/+bug/1829919), IOC + segfaults when calling dbLoadRecords after iocInit +- [lp: 1838792](https://bugs.launchpad.net/epics-base/+bug/1838792), epicsCalc + bit-wise operators on aarch64 +- [lp: 1841608](https://bugs.launchpad.net/epics-base/+bug/1841608), logClient + falsely sends error logs on all connections +- [lp: 1853168](https://bugs.launchpad.net/epics-base/+bug/1853168), undefined + reference to `clock_gettime()` +- [lp: 1862328](https://bugs.launchpad.net/epics-base/+bug/1862328), Race + condition on IOC start leaves rsrv unresponsive +- [lp: 1868486](https://bugs.launchpad.net/epics-base/+bug/1868486), + epicsMessageQueue lost messages - ### Improvements to the self-test build targets @@ -28,6 +46,25 @@ jobs that should be allowed so `make -j4 tapfiles` for a system with 4 CPUs say. Running many more jobs than you have CPUs is likely to be slower and is not recommended. +### Calc Engine Fixes and Enhancements + +The code that implements bit operations for Calc expressions has been reworked +to better handle some CPU architectures and compilers. As part of this work a +new operator has been added: `>>>` performs a logical right-shift, inserting +zero bits into the most significant bits (the operator `>>` is an arithmetic +right-shift which copies the sign bit as it shifts the value rightwards). + +### IOC logClient Changes + +The IOC's error logging system has been updated significantly to fix a number +of issues including: + + - Only send errlog messages to iocLogClient listeners + - Try to minimize lost messages while the log server is down: + + Detect disconnects sooner + + Don't discard the buffer on disconnect + + Flush the buffer immediately after a server reconnects + ### epicsThread: Main thread defaults to allow blocking I/O VxWorks IOCs (and potentially RTEMS IOCs running GeSys) have had problems with @@ -50,7 +87,7 @@ This has now been fixed. The remaining record types have had their reference pages moved from the Wiki, and some new reference pages have been written to cover the analog array and -long string input and output record types plus the printf recor type, none of +long string input and output record types plus the printf record type, none of which were previously documented. The wiki reference pages covering the fields common to all, input, and output record types have also been added, thanks to Rolf Keitel. The POD conversion scripts have also been improved and they now From c7e42fab3c10f6b0c7464482f507e8ffac502937 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 15 May 2020 12:00:23 -0500 Subject: [PATCH 182/216] Set version number to 3.15.8, clear snapshot --- configure/CONFIG_BASE_VERSION | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/configure/CONFIG_BASE_VERSION b/configure/CONFIG_BASE_VERSION index 16a54b1e5..eaeb0f2de 100644 --- a/configure/CONFIG_BASE_VERSION +++ b/configure/CONFIG_BASE_VERSION @@ -4,7 +4,7 @@ # Copyright (c) 2002 The Regents of the University of California, as # Operator of Los Alamos National Laboratory. # EPICS BASE is distributed subject to a Software License Agreement found -# in the file LICENSE that is included with this distribution. +# in the file LICENSE that is included with this distribution. #************************************************************************* # # EPICS Version information @@ -27,23 +27,19 @@ EPICS_VERSION = 3 EPICS_REVISION = 15 # EPICS_MODIFICATION must be a number >=0 and <256 -EPICS_MODIFICATION = 7 +EPICS_MODIFICATION = 8 # EPICS_PATCH_LEVEL must be a number (win32 resource file requirement) # Not included if zero -EPICS_PATCH_LEVEL = 1 +EPICS_PATCH_LEVEL = 0 # This will end in -DEV between official releases -EPICS_DEV_SNAPSHOT=-DEV +#EPICS_DEV_SNAPSHOT=-DEV #EPICS_DEV_SNAPSHOT=-pre1 #EPICS_DEV_SNAPSHOT=-pre1-DEV -#EPICS_DEV_SNAPSHOT=-pre2 -#EPICS_DEV_SNAPSHOT=-pre2-DEV #EPICS_DEV_SNAPSHOT=-rc1 #EPICS_DEV_SNAPSHOT=-rc1-DEV -#EPICS_DEV_SNAPSHOT=-rc2 -#EPICS_DEV_SNAPSHOT=-rc2-DEV -#EPICS_DEV_SNAPSHOT= +EPICS_DEV_SNAPSHOT= # No changes should be needed below here From e923790c41e208304ea9fba92e5e068c69ce0e4b Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 15 May 2020 12:09:24 -0500 Subject: [PATCH 183/216] Update versions after tagging --- configure/CONFIG_BASE_VERSION | 6 +++--- documentation/KnownProblems.html | 8 ++++---- documentation/RELEASE_NOTES.md | 9 ++++++++- documentation/RecordReference.md | 4 ++-- documentation/ReleaseChecklist.html | 16 ++++++++-------- 5 files changed, 25 insertions(+), 18 deletions(-) diff --git a/configure/CONFIG_BASE_VERSION b/configure/CONFIG_BASE_VERSION index eaeb0f2de..f7141a82e 100644 --- a/configure/CONFIG_BASE_VERSION +++ b/configure/CONFIG_BASE_VERSION @@ -31,15 +31,15 @@ EPICS_MODIFICATION = 8 # EPICS_PATCH_LEVEL must be a number (win32 resource file requirement) # Not included if zero -EPICS_PATCH_LEVEL = 0 +EPICS_PATCH_LEVEL = 1 # This will end in -DEV between official releases -#EPICS_DEV_SNAPSHOT=-DEV +EPICS_DEV_SNAPSHOT=-DEV #EPICS_DEV_SNAPSHOT=-pre1 #EPICS_DEV_SNAPSHOT=-pre1-DEV #EPICS_DEV_SNAPSHOT=-rc1 #EPICS_DEV_SNAPSHOT=-rc1-DEV -EPICS_DEV_SNAPSHOT= +#EPICS_DEV_SNAPSHOT= # No changes should be needed below here diff --git a/documentation/KnownProblems.html b/documentation/KnownProblems.html index 307d98d5a..ac5ba3af5 100644 --- a/documentation/KnownProblems.html +++ b/documentation/KnownProblems.html @@ -4,17 +4,17 @@ - Known Problems in R3.15.8 + Known Problems in R3.15.9 -

EPICS Base R3.15.8: Known Problems

+

EPICS Base R3.15.9: Known Problems

Any patch files linked below should be applied at the root of the -base-3.15.8 tree. Download them, then use the GNU Patch program as +base-3.15.9 tree. Download them, then use the GNU Patch program as follows:

-
% cd /path/to/base-3.15.8
+
% cd /path/to/base-3.15.9
 % patch -p1 < /path/to/file.patch

The following significant problems have been reported with this diff --git a/documentation/RELEASE_NOTES.md b/documentation/RELEASE_NOTES.md index fbcf72aaa..0dfb8866c 100644 --- a/documentation/RELEASE_NOTES.md +++ b/documentation/RELEASE_NOTES.md @@ -1,4 +1,11 @@ -# EPICS Base Release 3.15.8 +# EPICS Base Release 3.15.9 + +This version of EPICS Base has not been released yet. + +## Changes made on the 3.15 branch since 3.15.8 + + + ## Changes made between 3.15.7 and 3.15.8 diff --git a/documentation/RecordReference.md b/documentation/RecordReference.md index fbd5c1fe3..a13f83dd2 100644 --- a/documentation/RecordReference.md +++ b/documentation/RecordReference.md @@ -5,8 +5,8 @@ converted from the old EPICS Wiki pages and updated. This list only includes the record types supplied with Base. * [Fields Common to All Record Types](dbCommonRecord.html) -* [Fields Common to Input Record Types](dbCommonInputs.html) -* [Fields Common to Output Record Types](dbCommonOutputs.html) +* [Fields Common to Input Record Types](dbCommonInput.html) +* [Fields Common to Output Record Types](dbCommonOutput.html) ## Record Types diff --git a/documentation/ReleaseChecklist.html b/documentation/ReleaseChecklist.html index af0f1dad2..c4bacbfec 100644 --- a/documentation/ReleaseChecklist.html +++ b/documentation/ReleaseChecklist.html @@ -136,17 +136,17 @@ relevent roles unless the Release Manager designates otherwise:

Tag the module in Git, using these tag conventions:
  • - R3.15.8-pre1 + R3.15.9-pre1 — pre-release tag
  • - R3.15.8-rc1 + R3.15.9-rc1 — release candidate tag
cd base-3.15
- git tag -m 'ANJ: Tagged for 3.15.8-rc1' R3.15.8-rc1 + git tag -m 'ANJ: Tagged for 3.15.9-rc1' R3.15.9-rc1
@@ -158,11 +158,11 @@ relevent roles unless the Release Manager designates otherwise:

files and directories that are only used for continuous integration:
cd base-3.15
- git archive --prefix=base-3.15.8-rc1/ --output=base-3.15.8-rc1.tar.gz R3.15.8-rc1 configure documentation LICENSE Makefile README src startup + git archive --prefix=base-3.15.9-rc1/ --output=base-3.15.9-rc1.tar.gz R3.15.9-rc1 configure documentation LICENSE Makefile README src startup
Create a GPG signature file of the tarfile as follows:
- gpg --armor --sign --detach-sig base-3.15.8-rc1.tar.gz + gpg --armor --sign --detach-sig base-3.15.9-rc1.tar.gz
@@ -274,7 +274,7 @@ relevent roles unless the Release Manager designates otherwise:

Tag the module in Git:
cd base-3.15
- git tag -m 'ANJ: Tagged for 3.15.8' R3.15.8 + git tag -m 'ANJ: Tagged for 3.15.9' R3.15.9
@@ -285,11 +285,11 @@ relevent roles unless the Release Manager designates otherwise:

generates a gzipped tarfile directly from the repository:
cd base-3.15
- git archive --prefix=base-3.15.8/ --output=base-3.15.8.tar.gz R3.15.8 configure documentation LICENSE Makefile README src startup + git archive --prefix=base-3.15.9/ --output=base-3.15.9.tar.gz R3.15.9 configure documentation LICENSE Makefile README src startup
Create a GPG signature file of the tarfile as follows:
- gpg --armor --sign --detach-sig base-3.15.8.tar.gz + gpg --armor --sign --detach-sig base-3.15.9.tar.gz
From 9142eca87895cf26c8c088486926c29defcccf15 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 19 May 2020 18:04:26 -0500 Subject: [PATCH 184/216] Unify doxygen keywords to use '\' not '@' --- modules/libcom/src/as/asTrapWrite.h | 63 ++--- modules/libcom/src/bucketLib/bucketLib.h | 152 ++++++------ modules/libcom/src/calc/postfix.h | 112 ++++----- modules/libcom/src/cppStd/epicsAlgorithm.h | 18 +- modules/libcom/src/dbmf/dbmf.h | 64 ++--- modules/libcom/src/ellLib/ellLib.h | 171 +++++++------- modules/libcom/src/env/envDefs.h | 104 ++++----- modules/libcom/src/iocsh/iocsh.h | 22 +- modules/libcom/src/macLib/macLib.h | 104 ++++----- modules/libcom/src/misc/adjustment.h | 4 +- modules/libcom/src/misc/alarm.h | 24 +- modules/libcom/src/misc/alarmString.h | 10 +- modules/libcom/src/misc/cantProceed.h | 30 +-- modules/libcom/src/misc/dbDefs.h | 34 +-- modules/libcom/src/misc/epicsExit.h | 42 ++-- modules/libcom/src/misc/epicsExport.h | 72 +++--- modules/libcom/src/misc/epicsUnitTest.h | 104 ++++----- modules/libcom/src/misc/shareLib.h | 10 +- modules/libcom/src/misc/unixFileName.h | 4 +- modules/libcom/src/osi/compilerDependencies.h | 6 +- modules/libcom/src/osi/devLib.h | 98 ++++---- modules/libcom/src/osi/devLibVME.h | 220 +++++++++--------- modules/libcom/src/osi/devLibVMEImpl.h | 36 +-- modules/libcom/src/osi/epicsAssert.h | 26 +-- modules/libcom/src/osi/epicsEvent.h | 132 +++++------ modules/libcom/src/osi/epicsGeneralTime.h | 64 ++--- modules/libcom/src/osi/epicsMutex.h | 112 ++++----- modules/libcom/src/osi/epicsReadline.h | 24 +- modules/libcom/src/osi/epicsThread.h | 54 +++-- modules/libcom/src/osi/os/WIN32/osiFileName.h | 4 +- .../libcom/src/osi/os/cygwin32/osiFileName.h | 4 +- .../libcom/src/osi/os/default/epicsMMIODef.h | 82 +++---- modules/libcom/src/osi/osiPoolStatus.h | 14 +- modules/libcom/src/ring/epicsRingBytes.h | 94 ++++---- modules/libcom/src/ring/epicsRingPointer.h | 136 +++++------ 35 files changed, 1127 insertions(+), 1123 deletions(-) diff --git a/modules/libcom/src/as/asTrapWrite.h b/modules/libcom/src/as/asTrapWrite.h index 7bce659cb..8f93fa1ee 100644 --- a/modules/libcom/src/as/asTrapWrite.h +++ b/modules/libcom/src/as/asTrapWrite.h @@ -8,9 +8,9 @@ \*************************************************************************/ /** - * @file asTrapWrite.h - * @brief API for monitoring external put operations to an IOC. - * @author Marty Kraimer + * \file asTrapWrite.h + * \brief API for monitoring external put operations to an IOC. + * \author Marty Kraimer * * The access security subsystem provides an API asTrapWrite that makes * put/write requests visible to any facility that registers a listener. @@ -26,40 +26,43 @@ extern "C" { #endif /** - * @brief The message passed to registered listeners. + * \brief The message passed to registered listeners. */ typedef struct asTrapWriteMessage { - const char *userid; /**< @brief Userid of whoever orginated the request. */ - const char *hostid; /**< @brief Hostid of whoever orginated the request. */ - void *serverSpecific; /**< @brief A field for use by the server. - * - * Any listener that uses this field must know what type of - * server is forwarding the put requests. This pointer holds - * the value the server provides to asTrapWriteWithData(), which - * for RSRV is the dbChannel pointer for the target field. - */ - void *userPvt; /**< @brief A field for use by the @ref asTrapWriteListener. - * - * When the listener is called before the write, this has the - * value 0. The listener can give it any value it desires - * and it will have the same value when the listener gets - * called again after the write. */ - int dbrType; /**< @brief Data type from ca/db_access.h, NOT dbFldTypes.h */ - int no_elements; /**< @brief Array length */ - void *data; /**< @brief Might be NULL if no data is available */ + const char *userid; /**< \brief Userid of whoever orginated the request. */ + const char *hostid; /**< \brief Hostid of whoever orginated the request. */ + /** \brief A field for use by the server. + * + * Any listener that uses this field must know what type of + * server is forwarding the put requests. This pointer holds + * the value the server provides to asTrapWriteWithData(), which + * for RSRV is the dbChannel pointer for the target field. + */ + void *serverSpecific; + /** \brief A field for use by the \ref asTrapWriteListener. + * + * When the listener is called before the write, this has the + * value 0. The listener can give it any value it desires + * and it will have the same value when the listener gets + * called again after the write. + */ + void *userPvt; + int dbrType; /**< \brief Data type from ca/db_access.h, NOT dbFldTypes.h */ + int no_elements; /**< \brief Array length */ + void *data; /**< \brief Might be NULL if no data is available */ } asTrapWriteMessage; /** - * @brief An identifier needed to unregister an listener. + * \brief An identifier needed to unregister an listener. */ typedef void *asTrapWriteId; /** - * @brief Pointer to a listener function. + * \brief Pointer to a listener function. * * Each registered listener function is called twice for every put; once * before and once after the write is performed. - * The listener may set @c userPvt in the first call and retrieve it in the + * The listener may set \c userPvt in the first call and retrieve it in the * second call. * * Each asTrapWriteMessage can change or may be deleted after the user's @@ -71,15 +74,15 @@ typedef void *asTrapWriteId; typedef void(*asTrapWriteListener)(asTrapWriteMessage *pmessage,int after); /** - * @brief Register function to be called on asTrapWriteListener. - * @param func The listener function to be called. - * @return A listener identifier for unregistering this listener. + * \brief Register function to be called on asTrapWriteListener. + * \param func The listener function to be called. + * \return A listener identifier for unregistering this listener. */ epicsShareFunc asTrapWriteId epicsShareAPI asTrapWriteRegisterListener( asTrapWriteListener func); /** - * @brief Unregister asTrapWriteListener. - * @param id Listener identifier from asTrapWriteRegisterListener(). + * \brief Unregister asTrapWriteListener. + * \param id Listener identifier from asTrapWriteRegisterListener(). */ epicsShareFunc void epicsShareAPI asTrapWriteUnregisterListener( asTrapWriteId id); diff --git a/modules/libcom/src/bucketLib/bucketLib.h b/modules/libcom/src/bucketLib/bucketLib.h index a461cfd8a..0336d6e18 100644 --- a/modules/libcom/src/bucketLib/bucketLib.h +++ b/modules/libcom/src/bucketLib/bucketLib.h @@ -7,16 +7,16 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ /** - * @file bucketLib.h - * @author Jeffrey O. Hill - * @brief A hash table. Do not use for new code. + * \file bucketLib.h + * \author Jeffrey O. Hill + * \brief A hash table. Do not use for new code. * - * @details + * \details * A hash table for which keys may be unsigned integers, pointers, or * strings. This API is used by the IOC's Channel Access Server, but * it should not be used by other code. * - * @note Storage for identifiers must persist until an item is deleted + * \note Storage for identifiers must persist until an item is deleted */ #ifndef INCbucketLibh @@ -30,13 +30,13 @@ extern "C" { #include "epicsTypes.h" #include "shareLib.h" -/** @brief Internal: bucket identifier */ +/** \brief Internal: bucket identifier */ typedef unsigned BUCKETID; -/** @brief Internal: bucket key type */ +/** \brief Internal: bucket key type */ typedef enum {bidtUnsigned, bidtPointer, bidtString} buckTypeOfId; -/** @brief Internal: bucket item structure */ +/** \brief Internal: bucket item structure */ typedef struct item{ struct item *pItem; const void *pId; @@ -44,7 +44,7 @@ typedef struct item{ buckTypeOfId type; }ITEM; -/** @brief Internal: Hash table structure */ +/** \brief Internal: Hash table structure */ typedef struct bucket{ ITEM **pTable; void *freeListPVT; @@ -53,140 +53,140 @@ typedef struct bucket{ unsigned nInUse; }BUCKET; /** - * @brief Creates a new hash table - * @param nHashTableEntries Table size - * @return Pointer to the newly created hash table, or NULL. + * \brief Creates a new hash table + * \param nHashTableEntries Table size + * \return Pointer to the newly created hash table, or NULL. */ epicsShareFunc BUCKET * epicsShareAPI bucketCreate (unsigned nHashTableEntries); /** - * @brief Release memory used by a hash table - * @param *prb Pointer to the hash table - * @return S_bucket_success - * @note All items must be deleted from the hash table before calling this. + * \brief Release memory used by a hash table + * \param *prb Pointer to the hash table + * \return S_bucket_success + * \note All items must be deleted from the hash table before calling this. */ epicsShareFunc int epicsShareAPI bucketFree (BUCKET *prb); /** - * @brief Display information about a hash table - * @param *prb Pointer to the hash table - * @return S_bucket_success + * \brief Display information about a hash table + * \param *prb Pointer to the hash table + * \return S_bucket_success */ epicsShareFunc int epicsShareAPI bucketShow (BUCKET *prb); /** - * @brief Add an item identified by an unsigned int to the table - * @param *prb Pointer to the hash table - * @param *pId Pointer to the identifier - * @param *pApp Pointer to the payload - * @return Status value + * \brief Add an item identified by an unsigned int to the table + * \param *prb Pointer to the hash table + * \param *pId Pointer to the identifier + * \param *pApp Pointer to the payload + * \return Status value */ epicsShareFunc int epicsShareAPI bucketAddItemUnsignedId (BUCKET *prb, const unsigned *pId, const void *pApp); /** - * @brief Add an item identified by a pointer to the table - * @param *prb Pointer to the hash table - * @param *pId Pointer to the identifier - * @param *pApp Pointer to the payload - * @return Status value + * \brief Add an item identified by a pointer to the table + * \param *prb Pointer to the hash table + * \param *pId Pointer to the identifier + * \param *pApp Pointer to the payload + * \return Status value */ epicsShareFunc int epicsShareAPI bucketAddItemPointerId (BUCKET *prb, void * const *pId, const void *pApp); /** - * @brief Add an item identified by a string to the table - * @param *prb Pointer to the hash table - * @param *pId Pointer to the identifier - * @param *pApp Pointer to the payload - * @return Status value + * \brief Add an item identified by a string to the table + * \param *prb Pointer to the hash table + * \param *pId Pointer to the identifier + * \param *pApp Pointer to the payload + * \return Status value */ epicsShareFunc int epicsShareAPI bucketAddItemStringId (BUCKET *prb, const char *pId, const void *pApp); /** - * @brief Remove an item identified by a string from the table - * @param *prb Pointer to the hash table - * @param *pId Pointer to the identifier - * @return Status value + * \brief Remove an item identified by a string from the table + * \param *prb Pointer to the hash table + * \param *pId Pointer to the identifier + * \return Status value */ epicsShareFunc int epicsShareAPI bucketRemoveItemUnsignedId (BUCKET *prb, const unsigned *pId); /** - * @brief Remove an item identified by a pointer from the table - * @param *prb Pointer to the hash table - * @param *pId Pointer to the identifier - * @return Status value + * \brief Remove an item identified by a pointer from the table + * \param *prb Pointer to the hash table + * \param *pId Pointer to the identifier + * \return Status value */ epicsShareFunc int epicsShareAPI bucketRemoveItemPointerId (BUCKET *prb, void * const *pId); /** - * @brief Remove an item identified by a string from the table - * @param *prb Pointer to the hash table - * @param *pId Pointer to the identifier - * @return Status value + * \brief Remove an item identified by a string from the table + * \param *prb Pointer to the hash table + * \param *pId Pointer to the identifier + * \return Status value */ epicsShareFunc int epicsShareAPI bucketRemoveItemStringId (BUCKET *prb, const char *pId); /** - * @brief Find an item identified by an unsigned int in the table - * @param *prb Pointer to the hash table - * @param *pId Pointer to the identifier - * @return Item's payload pointer, or NULL if not found + * \brief Find an item identified by an unsigned int in the table + * \param *prb Pointer to the hash table + * \param *pId Pointer to the identifier + * \return Item's payload pointer, or NULL if not found */ epicsShareFunc void * epicsShareAPI bucketLookupItemUnsignedId (BUCKET *prb, const unsigned *pId); /** - * @brief Find an item identified by a pointer in the table - * @param *prb Pointer to the hash table - * @param *pId Pointer to the identifier - * @return Item's payload pointer, or NULL if not found + * \brief Find an item identified by a pointer in the table + * \param *prb Pointer to the hash table + * \param *pId Pointer to the identifier + * \return Item's payload pointer, or NULL if not found */ epicsShareFunc void * epicsShareAPI bucketLookupItemPointerId (BUCKET *prb, void * const *pId); /** - * @brief Find an item identified by a string in the table - * @param *prb Pointer to the hash table - * @param *pId Pointer to the identifier - * @return Item's payload pointer, or NULL if not found + * \brief Find an item identified by a string in the table + * \param *prb Pointer to the hash table + * \param *pId Pointer to the identifier + * \return Item's payload pointer, or NULL if not found */ epicsShareFunc void * epicsShareAPI bucketLookupItemStringId (BUCKET *prb, const char *pId); /** - * @brief Find and delete an item identified by an unsigned int from the table - * @param *prb Pointer to the hash table - * @param *pId Pointer to the identifier - * @return Item's payload pointer, or NULL if not found + * \brief Find and delete an item identified by an unsigned int from the table + * \param *prb Pointer to the hash table + * \param *pId Pointer to the identifier + * \return Item's payload pointer, or NULL if not found */ epicsShareFunc void * epicsShareAPI bucketLookupAndRemoveItemUnsignedId (BUCKET *prb, const unsigned *pId); /** - * @brief Find and delete an item identified by a pointer from the table - * @param *prb Pointer to the hash table - * @param *pId Pointer to the identifier - * @return Item's payload pointer, or NULL if not found + * \brief Find and delete an item identified by a pointer from the table + * \param *prb Pointer to the hash table + * \param *pId Pointer to the identifier + * \return Item's payload pointer, or NULL if not found */ epicsShareFunc void * epicsShareAPI bucketLookupAndRemoveItemPointerId (BUCKET *prb, void * const *pId); /** - * @brief Find and delete an item identified by a string from the table - * @param *prb Pointer to the hash table - * @param *pId Pointer to the identifier - * @return Item's payload pointer, or NULL if not found + * \brief Find and delete an item identified by a string from the table + * \param *prb Pointer to the hash table + * \param *pId Pointer to the identifier + * \return Item's payload pointer, or NULL if not found */ epicsShareFunc void * epicsShareAPI bucketLookupAndRemoveItemStringId (BUCKET *prb, const char *pId); /** - * @name Status values returned by some bucketLib functions + * \name Status values returned by some bucketLib functions * @{ */ /** - * @brief A synonym for S_bucket_success + * \brief A synonym for S_bucket_success */ #define BUCKET_SUCCESS S_bucket_success /** - * @brief Success, must be 0. + * \brief Success, must be 0. */ #define S_bucket_success 0 /** - * @brief Memory allocation failed + * \brief Memory allocation failed */ #define S_bucket_noMemory (M_bucket | 1) /*Memory allocation failed*/ /** - * @brief Identifier already in use + * \brief Identifier already in use */ #define S_bucket_idInUse (M_bucket | 2) /*Identifier already in use*/ /** - * @brief Unknown identifier + * \brief Unknown identifier */ #define S_bucket_uknId (M_bucket | 3) /*Unknown identifier*/ /** @} */ diff --git a/modules/libcom/src/calc/postfix.h b/modules/libcom/src/calc/postfix.h index d811300ed..6bdbc1ae0 100644 --- a/modules/libcom/src/calc/postfix.h +++ b/modules/libcom/src/calc/postfix.h @@ -7,10 +7,10 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ /** - * @file postfix.h - * @author Bob Dalesio, Andrew Johnson + * \file postfix.h + * \author Bob Dalesio, Andrew Johnson * - * @brief The API for the EPICS Calculation Engine + * \brief The API for the EPICS Calculation Engine * * Defines macros and the routines provided by the calculation engine for * subsystems that need to evaluate mathematical expressions. @@ -21,50 +21,50 @@ #include "shareLib.h" -/** @brief Number of input arguments to a calc expression (A-L) */ +/** \brief Number of input arguments to a calc expression (A-L) */ #define CALCPERFORM_NARGS 12 -/** @brief Size of the internal partial result stack */ +/** \brief Size of the internal partial result stack */ #define CALCPERFORM_STACK 80 /** - * @name Postfix and Infix Buffer Sizes + * \name Postfix and Infix Buffer Sizes * @{ */ /** - * @brief Calculate required size of postfix buffer from infix + * \brief Calculate required size of postfix buffer from infix * * This macro calculates the maximum size of postfix buffer needed for an - * infix expression buffer of a given size. The argument @c n must count + * infix expression buffer of a given size. The argument \c n must count * the trailing nil byte in the input expression string. The actual size * needed is never larger than this value, although it is actually a * few bytes smaller for some sizes. * * The maximum expansion from infix to postfix is for the sub-expression - @code + \code .1?.1: -@endcode +\endcode * which is 6 characters long and results in 21 bytes of postfix: -@code +\code .1 => LITERAL_DOUBLE + 8 byte value ? => COND_IF .1 => LITERAL_DOUBLE + 8 byte value : => COND_ELSE ... => COND_END -@endcode +\endcode * For other short expressions the factor 21/6 always gives a big enough * postfix buffer (proven by hand, look at '1+' and '.1+' as well). */ #define INFIX_TO_POSTFIX_SIZE(n) ((n)*21/6) /** - * @brief Size of a "standard" infix string. + * \brief Size of a "standard" infix string. * * This is not a hard limit, just the default size for the database */ #define MAX_INFIX_SIZE 100 /** - * @brief Size of a "standard" postfix buffer. + * \brief Size of a "standard" postfix buffer. * * This is not a hard limit, just the default size for the database */ @@ -72,38 +72,38 @@ /** @} */ -/** @name Calc Engine Error Codes -* @note Changes in these errors must also be made in calcErrorStr(). +/** \name Calc Engine Error Codes +* \note Changes in these errors must also be made in calcErrorStr(). * @{ */ -/** @brief No error */ +/** \brief No error */ #define CALC_ERR_NONE 0 -/** @brief Too many results returned */ +/** \brief Too many results returned */ #define CALC_ERR_TOOMANY 1 -/** @brief Bad numeric literal */ +/** \brief Bad numeric literal */ #define CALC_ERR_BAD_LITERAL 2 -/** @brief Bad assignment target */ +/** \brief Bad assignment target */ #define CALC_ERR_BAD_ASSIGNMENT 3 -/** @brief Comma without parentheses */ +/** \brief Comma without parentheses */ #define CALC_ERR_BAD_SEPERATOR 4 -/** @brief Close parenthesis without open */ +/** \brief Close parenthesis without open */ #define CALC_ERR_PAREN_NOT_OPEN 5 -/** @brief Open parenthesis at end of expression */ +/** \brief Open parenthesis at end of expression */ #define CALC_ERR_PAREN_OPEN 6 -/** @brief Unbalanced conditional ?: operators */ +/** \brief Unbalanced conditional ?: operators */ #define CALC_ERR_CONDITIONAL 7 -/** @brief Incomplete expression, operand missing */ +/** \brief Incomplete expression, operand missing */ #define CALC_ERR_INCOMPLETE 8 -/** @brief Runtime stack would underflow */ +/** \brief Runtime stack would underflow */ #define CALC_ERR_UNDERFLOW 9 -/** @brief Runtime stack would overflow */ +/** \brief Runtime stack would overflow */ #define CALC_ERR_OVERFLOW 10 -/** @brief Syntax error */ +/** \brief Syntax error */ #define CALC_ERR_SYNTAX 11 -/** @brief NULL or empty input argument */ +/** \brief NULL or empty input argument */ #define CALC_ERR_NULL_ARG 12 -/** @brief Internal error, bad element type */ +/** \brief Internal error, bad element type */ #define CALC_ERR_INTERNAL 13 /** @} */ @@ -112,21 +112,21 @@ extern "C" { #endif -/** @brief Compile an infix expression into postfix byte-code +/** \brief Compile an infix expression into postfix byte-code * * Converts an expression from an infix string to postfix byte-code * - * @param pinfix Pointer to the infix string - * @param ppostfix Pointer to the postfix buffer - * @param perror Place to return an error code - * @return Non-zero value in event of error + * \param pinfix Pointer to the infix string + * \param ppostfix Pointer to the postfix buffer + * \param perror Place to return an error code + * \return Non-zero value in event of error * * It is the callers's responsibility to ensure that \c ppostfix points * to sufficient storage to hold the postfix expression. The macro * INFIX_TO_POSTFIX_SIZE(n) can be used to calculate an appropriate * postfix buffer size from the length of the infix buffer. * - * @note "n" must count the terminating nil byte too. + * \note "n" must count the terminating nil byte too. * * -# The **infix expressions** that can be used are very similar * to the C expression syntax, but with some additions and subtle @@ -230,7 +230,7 @@ extern "C" { * - Arccosine: acos(a) * - Arctangent: atan(a) * - 2 parameter arctangent: atan2(a, b) - * @note Note that these arguments are the reverse of the ANSI C function, + * \note Note that these arguments are the reverse of the ANSI C function, * so while C would return arctan(a/b) the calc expression engine returns arctan(b/a) * * -# ***Hyperbolic Trigonometry*** @@ -298,62 +298,62 @@ extern "C" { epicsShareFunc long postfix(const char *pinfix, char *ppostfix, short *perror); -/** @brief Run the calculation engine +/** \brief Run the calculation engine * * Evaluates the postfix expression against a set ot input values. * - * @param parg Pointer to an array of double values for the arguments A-L + * \param parg Pointer to an array of double values for the arguments A-L * that can appear in the expression. Note that the argument values may be * modified if the expression uses the assignment operator. - * @param presult Where to put the calculated result, which may be a NaN or Infinity. - * @param ppostfix The postfix expression created by postfix(). - * @return Status value 0 for OK, or non-zero if an error is discovered + * \param presult Where to put the calculated result, which may be a NaN or Infinity. + * \param ppostfix The postfix expression created by postfix(). + * \return Status value 0 for OK, or non-zero if an error is discovered * during the evaluation process. */ epicsShareFunc long calcPerform(double *parg, double *presult, const char *ppostfix); -/** @brief Find the inputs and outputs of an expression +/** \brief Find the inputs and outputs of an expression * * Software using the calc subsystem may need to know what expression * arguments are used and/or modified by a particular expression. It can * discover this from the postfix string by calling calcArgUsage(), which - * takes two pointers @c pinputs and @c pstores to a pair of unsigned long + * takes two pointers \c pinputs and \c pstores to a pair of unsigned long * bitmaps which return that information to the caller. Passing a NULL value * for either of these pointers is legal if only the other is needed. * - * The least signficant bit (bit 0) of the bitmap at @c *pinputs will be set + * The least signficant bit (bit 0) of the bitmap at \c *pinputs will be set * if the expression depends on the argument A, and so on through bit 11 for * the argument L. An argument that is not used until after a value has been * assigned to it will not be set in the pinputs bitmap, thus the bits can * be used to determine whether a value needs to be supplied for their * associated argument or not for the purposes of evaluating the expression. * - * Bit 0 of the bitmap at @c *pstores will be set if the expression assigns + * Bit 0 of the bitmap at \c *pstores will be set if the expression assigns * a value to the argument A, bit 1 for argument B etc. - * @param ppostfix A postfix expression created by postfix(). - * @param pinputs Bitmap pointer. - * @param pstores Bitmap pointer. - * @return The return value will be non-zero if the ppostfix expression was + * \param ppostfix A postfix expression created by postfix(). + * \param pinputs Bitmap pointer. + * \param pstores Bitmap pointer. + * \return The return value will be non-zero if the ppostfix expression was * illegal, otherwise 0. */ epicsShareFunc long calcArgUsage(const char *ppostfix, unsigned long *pinputs, unsigned long *pstores); -/** @brief Convert an error code to a string. +/** \brief Convert an error code to a string. * * Gives out a printable version of an individual error code. - * The error codes are macros defined here with names starting @c CALC_ERR_ - * @param error Error code - * @return A string representation of the error code + * The error codes are macros defined here with names starting \c CALC_ERR_ + * \param error Error code + * \return A string representation of the error code */ epicsShareFunc const char * calcErrorStr(short error); -/** @brief Disassemble a postfix expression +/** \brief Disassemble a postfix expression * * Convert the byte-code stream to text and print to stdout. - * @param pinst postfix instructions + * \param pinst postfix instructions */ epicsShareFunc void calcExprDump(const char *pinst); diff --git a/modules/libcom/src/cppStd/epicsAlgorithm.h b/modules/libcom/src/cppStd/epicsAlgorithm.h index b79732894..e2043cf26 100644 --- a/modules/libcom/src/cppStd/epicsAlgorithm.h +++ b/modules/libcom/src/cppStd/epicsAlgorithm.h @@ -7,12 +7,12 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ /** - * @file epicsAlgorithm.h - * @author Jeff Hill & Andrew Johnson + * \file epicsAlgorithm.h + * \author Jeff Hill & Andrew Johnson * - * @brief Contains a few templates out of the C++ standard header algorithm + * \brief Contains a few templates out of the C++ standard header algorithm * - * @note The templates are provided here in a much smaller file. Standard algorithm + * \note The templates are provided here in a much smaller file. Standard algorithm * contains many templates for sorting and searching through C++ template containers * which are not used in EPICS. If all you need from there is std::min(), * std::max() and/or std::swap() your code may compile faster if you include @@ -41,7 +41,7 @@ inline const T& epicsMin (const T& a, const T& b) /** * Returns the smaller of a or b compared using a @@ -53,7 +53,7 @@ inline const float& epicsMin (const float& a, const float& b) /** * Returns the smaller of a or b compared using a @@ -75,7 +75,7 @@ inline const T& epicsMax (const T& a, const T& b) /** * Returns the larger of a or b compared using a @@ -87,7 +87,7 @@ inline const float& epicsMax (const float& a, const float& b) /** * Returns the larger of a or b compared using a @@ -99,7 +99,7 @@ inline const double& epicsMax (const double& a, const double& b) /** * Swaps the values of a and b. * - * @note The data type must support both copy-construction and assignment. + * \note The data type must support both copy-construction and assignment. * */ template diff --git a/modules/libcom/src/dbmf/dbmf.h b/modules/libcom/src/dbmf/dbmf.h index d8f768a74..ef9787500 100644 --- a/modules/libcom/src/dbmf/dbmf.h +++ b/modules/libcom/src/dbmf/dbmf.h @@ -8,10 +8,10 @@ \*************************************************************************/ /** - * @file dbmf.h - * @author Jim Kowalkowski, Marty Kraimer + * \file dbmf.h + * \author Jim Kowalkowski, Marty Kraimer * - * @brief A library to manage storage that is allocated and quickly freed. + * \brief A library to manage storage that is allocated and quickly freed. * * Database Macro/Free describes a facility that prevents memory fragmentation * when temporary storage is being allocated and freed a short time later, at @@ -24,10 +24,10 @@ * - Between those calls to malloc() and free(), additional calls to * malloc() are made that do NOT have an associated free(). * - * @note In some environment, e.g. vxWorks, this behavior causes severe memory + * \note In some environment, e.g. vxWorks, this behavior causes severe memory * fragmentation. * - * @note This facility should NOT be used by code that allocates storage and + * \note This facility should NOT be used by code that allocates storage and * then keeps it for a considerable period of time before releasing. Such code * should consider using the freeList library. */ @@ -42,67 +42,67 @@ extern "C" { #endif /** - * @brief Initialize the facility - * @param size The maximum size request from dbmfMalloc() that will be + * \brief Initialize the facility + * \param size The maximum size request from dbmfMalloc() that will be * allocated from the dbmf pool (Size is always made a multiple of 8). - * @param chunkItems Each time malloc() must be called size*chunkItems bytes + * \param chunkItems Each time malloc() must be called size*chunkItems bytes * are allocated. - * @return 0 on success, -1 if already initialized + * \return 0 on success, -1 if already initialized * - * @note If dbmfInit() is not called before one of the other routines then it + * \note If dbmfInit() is not called before one of the other routines then it * is automatically called with size=64 and chunkItems=10 */ epicsShareFunc int dbmfInit(size_t size, int chunkItems); /** - * @brief Allocate memory. - * @param bytes If bytes > size then malloc() is used to allocate the memory. - * @return Pointer to the newly-allocated memory, or NULL on failure. + * \brief Allocate memory. + * \param bytes If bytes > size then malloc() is used to allocate the memory. + * \return Pointer to the newly-allocated memory, or NULL on failure. */ epicsShareFunc void * dbmfMalloc(size_t bytes); /** - * @brief Duplicate a string. + * \brief Duplicate a string. * * Create a copy of the input string. - * @param str Pointer to the null-terminated string to be copied. - * @return A pointer to the new copy, or NULL on failure. + * \param str Pointer to the null-terminated string to be copied. + * \return A pointer to the new copy, or NULL on failure. */ epicsShareFunc char * dbmfStrdup(const char *str); /** - * @brief Duplicate a string (up to len bytes). + * \brief Duplicate a string (up to len bytes). * * Copy at most len bytes of the input string into a new buffer. If no nil - * terminator is seen in the first @c len bytes a nil terminator is added. - * @param str Pointer to the null-terminated string to be copied. - * @param len Max number of bytes to copy. - * @return A pointer to the new string, or NULL on failure. + * terminator is seen in the first \c len bytes a nil terminator is added. + * \param str Pointer to the null-terminated string to be copied. + * \param len Max number of bytes to copy. + * \return A pointer to the new string, or NULL on failure. */ epicsShareFunc char * dbmfStrndup(const char *str, size_t len); /** - * @brief Concatenate three strings. + * \brief Concatenate three strings. * Returns a pointer to a null-terminated string made by concatenating the * three input strings. - * @param lhs Start string to which the others get concatenated to (left part). - * @param mid Next string to be concatenated to the lhs (mid part). - * @param rhs Last string to be concatenated to the lhs+mid (right part). - * @return A pointer to the new string, or NULL on failure. + * \param lhs Start string to which the others get concatenated to (left part). + * \param mid Next string to be concatenated to the lhs (mid part). + * \param rhs Last string to be concatenated to the lhs+mid (right part). + * \return A pointer to the new string, or NULL on failure. */ epicsShareFunc char * dbmfStrcat3(const char *lhs, const char *mid, const char *rhs); /** - * @brief Free the memory allocated by dbmfMalloc. - * @param bytes Pointer to memory obtained from dbmfMalloc(), dbmfStrdup(), + * \brief Free the memory allocated by dbmfMalloc. + * \param bytes Pointer to memory obtained from dbmfMalloc(), dbmfStrdup(), * dbmfStrndup() or dbmfStrcat3(). */ epicsShareFunc void dbmfFree(void *bytes); /** - * @brief Free all chunks that contain only free items. + * \brief Free all chunks that contain only free items. */ epicsShareFunc void dbmfFreeChunks(void); /** - * @brief Show the status of the dbmf memory pool. - * @param level Detail level. - * @return 0. + * \brief Show the status of the dbmf memory pool. + * \param level Detail level. + * \return 0. */ epicsShareFunc int dbmfShow(int level); diff --git a/modules/libcom/src/ellLib/ellLib.h b/modules/libcom/src/ellLib/ellLib.h index 776f556f4..8448fee2d 100644 --- a/modules/libcom/src/ellLib/ellLib.h +++ b/modules/libcom/src/ellLib/ellLib.h @@ -7,16 +7,16 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ /** - * @file ellLib.h - * @author John Winans (ANL) - * @author Andrew Johnson (ANL) + * \file ellLib.h + * \author John Winans (ANL) + * \author Andrew Johnson (ANL) * - * @brief A doubly-linked list library + * \brief A doubly-linked list library * * This provides similar functionality to the VxWorks lstLib library. * * Supports the creation and maintenance of a doubly-linked list. The user - * supplies a list descriptor (type ELLLIST) that will contain pointers to + * supplies a list descriptor (type \c ELLLIST) that will contain pointers to * the first and last nodes in the list, and a count of the number of * nodes in the list. The nodes in the list can be any user-defined structure, * but they must reserve space for two pointers as their first elements. @@ -32,9 +32,9 @@ extern "C" { #endif -/** @brief List node type. +/** \brief List node type. * - * A list node (@c ELLNODE) must be embedded in the structure to be placed + * A list node (an \c ELLNODE) must be embedded in the structure to be placed * on the list, ideally as the first member of that structure. * * If the node is elsewhere in the structure, care must be taken to convert @@ -43,26 +43,26 @@ extern "C" { * cannot be used with such a list. */ typedef struct ELLNODE { - struct ELLNODE *next; /**< @brief Pointer to next node in list */ - struct ELLNODE *previous; /**< @brief Pointer to previous node in list */ + struct ELLNODE *next; /**< \brief Pointer to next node in list */ + struct ELLNODE *previous; /**< \brief Pointer to previous node in list */ } ELLNODE; -/** @brief Value of a terminal node +/** \brief Value of a terminal node */ #define ELLNODE_INIT {NULL, NULL} -/** @brief List header type +/** \brief List header type */ typedef struct ELLLIST { - ELLNODE node; /**< @brief Pointers to the first and last nodes on list */ - int count; /**< @brief Number of nodes on the list */ + ELLNODE node; /**< \brief Pointers to the first and last nodes on list */ + int count; /**< \brief Number of nodes on the list */ } ELLLIST; -/** @brief Value of an empty list +/** \brief Value of an empty list */ #define ELLLIST_INIT {ELLNODE_INIT, 0} -/** @brief Pointer to free() for use by ellFree() macro. +/** \brief Pointer to free() for use by ellFree() macro. * * This is required for use on Windows, where each DLL has its own free() * function. The ellFree() macro passes the application's version of free() @@ -70,146 +70,143 @@ typedef struct ELLLIST { */ typedef void (*FREEFUNC)(void *); -/** @brief Initialize a list type - * @param PLIST Pointer to list header to be initialized +/** \brief Initialize a list type + * \param PLIST Pointer to list header to be initialized */ #define ellInit(PLIST) {\ (PLIST)->node.next = (PLIST)->node.previous = NULL;\ (PLIST)->count = 0;\ } -/** @brief Report the number of nodes in a list - * @param PLIST Pointer to list descriptor - * @return Number of nodes in the list +/** \brief Report the number of nodes in a list + * \param PLIST Pointer to list descriptor + * \return Number of nodes in the list */ #define ellCount(PLIST) ((PLIST)->count) -/** @brief Find the first node in list - * @param PLIST Pointer to list descriptor - * @return Pointer to first node in the list +/** \brief Find the first node in list + * \param PLIST Pointer to list descriptor + * \return Pointer to first node in the list */ #define ellFirst(PLIST) ((PLIST)->node.next) -/** @brief Find the last node in list - * @param PLIST Pointer to list descriptor - * @return Pointer to last node in the list +/** \brief Find the last node in list + * \param PLIST Pointer to list descriptor + * \return Pointer to last node in the list */ #define ellLast(PLIST) ((PLIST)->node.previous) -/** @brief Find the next node in list - * @param PNODE Pointer to node whose successor is to be found - * @return Pointer to the node following @c PNODE +/** \brief Find the next node in list + * \param PNODE Pointer to node whose successor is to be found + * \return Pointer to the node following \c PNODE */ #define ellNext(PNODE) ((PNODE)->next) -/** @brief Find the previous node in list - * @param PNODE Pointer to node whose predecessor is to be found - * @return Pointer to the node prior to @c PNODE +/** \brief Find the previous node in list + * \param PNODE Pointer to node whose predecessor is to be found + * \return Pointer to the node prior to \c PNODE */ #define ellPrevious(PNODE) ((PNODE)->previous) -/** @brief Free up the list - * @param PLIST List for which to free all nodes +/** \brief Free up the list + * \param PLIST List for which to free all nodes */ #define ellFree(PLIST) ellFree2(PLIST, free) /** - * @brief Adds a node to the end of a list - * @param pList Pointer to list descriptor - * @param pNode Pointer to node to be added + * \brief Adds a node to the end of a list + * \param pList Pointer to list descriptor + * \param pNode Pointer to node to be added */ epicsShareFunc void ellAdd (ELLLIST *pList, ELLNODE *pNode); /** - * @brief Concatenates a list to the end of another list. + * \brief Concatenates a list to the end of another list. * The list to be added is left empty. Either list (or both) * can be empty at the beginning of the operation. - * @param pDstList Destination list - * @param pAddList List to be added to @c pDstList + * \param pDstList Destination list + * \param pAddList List to be added to \c pDstList */ epicsShareFunc void ellConcat (ELLLIST *pDstList, ELLLIST *pAddList); /** - * @brief Deletes a node from a list. - * @param pList Pointer to list descriptor - * @param pNode Pointer to node to be deleted + * \brief Deletes a node from a list. + * \param pList Pointer to list descriptor + * \param pNode Pointer to node to be deleted */ epicsShareFunc void ellDelete (ELLLIST *pList, ELLNODE *pNode); /** - * @brief Extract a sublist from a list. - * @param pSrcList Pointer to source list - * @param pStartNode First node in @c pSrcList to be extracted - * @param pEndNode Last node in @c pSrcList to be extracted - * @param pDstList Pointer to list where to put extracted list + * \brief Extract a sublist from a list. + * \param pSrcList Pointer to source list + * \param pStartNode First node in \c pSrcList to be extracted + * \param pEndNode Last node in \c pSrcList to be extracted + * \param pDstList Pointer to list where to put extracted list */ epicsShareFunc void ellExtract (ELLLIST *pSrcList, ELLNODE *pStartNode, ELLNODE *pEndNode, ELLLIST *pDstList); /** - * @brief Deletes and returns the first node from a list - * @param pList Pointer to list from which to get node - * @return Pointer to the first node from the list, or NULL if the list is empty + * \brief Deletes and returns the first node from a list + * \param pList Pointer to list from which to get node + * \return Pointer to the first node from the list, or NULL if the list is empty */ epicsShareFunc ELLNODE * ellGet (ELLLIST *pList); /** - * @brief Deletes and returns the last node from a list. - * @param pList Pointer to list from which to get node - * @return Pointer to the last node from the list, or NULL if the list is empty + * \brief Deletes and returns the last node from a list. + * \param pList Pointer to list from which to get node + * \return Pointer to the last node from the list, or NULL if the list is empty */ epicsShareFunc ELLNODE * ellPop (ELLLIST *pList); /** - * @brief Inserts a node into a list immediately after a specific node - * @param plist Pointer to list into which to insert node - * @param pPrev Pointer to the node after which to insert - * @param pNode Pointer to the node to be inserted - * @note If @c pPrev is NULL @c pNode will be inserted at the head of the list + * \brief Inserts a node into a list immediately after a specific node + * \param plist Pointer to list into which to insert node + * \param pPrev Pointer to the node after which to insert + * \param pNode Pointer to the node to be inserted + * \note If \c pPrev is NULL \c pNode will be inserted at the head of the list */ epicsShareFunc void ellInsert (ELLLIST *plist, ELLNODE *pPrev, ELLNODE *pNode); /** - * @brief Find the Nth node in a list - * @param pList Pointer to list from which to find node - * @param nodeNum Index of the node to be found - * @return Pointer to the element at index @c nodeNum in pList, or NULL if + * \brief Find the Nth node in a list + * \param pList Pointer to list from which to find node + * \param nodeNum Index of the node to be found + * \return Pointer to the element at index \c nodeNum in pList, or NULL if * there is no such node in the list. - * @note The first node has index 1. + * \note The first node has index 1. */ epicsShareFunc ELLNODE * ellNth (ELLLIST *pList, int nodeNum); /** - * @brief Find the list node @c nStep steps away from a specified node - * @param pNode The known node - * @param nStep How many steps to take, may be negative to step backwards - * @return Pointer to the node @c nStep nodes from @c pNode, or NULL if there + * \brief Find the list node \c nStep steps away from a specified node + * \param pNode The known node + * \param nStep How many steps to take, may be negative to step backwards + * \return Pointer to the node \c nStep nodes from \c pNode, or NULL if there * is no such node in the list. */ epicsShareFunc ELLNODE * ellNStep (ELLNODE *pNode, int nStep); /** - * @brief Find the index of a specific node in a list - * @param pList Pointer to list to search - * @param pNode Pointer to node to search for - * @return The node's index, or -1 if it cannot be found on the list. - * @note The first node has index 1. + * \brief Find the index of a specific node in a list + * \param pList Pointer to list to search + * \param pNode Pointer to node to search for + * \return The node's index, or -1 if it cannot be found on the list. + * \note The first node has index 1. */ epicsShareFunc int ellFind (ELLLIST *pList, ELLNODE *pNode); typedef int (*pListCmp)(const ELLNODE* A, const ELLNODE* B); /** - * @author Michael Davidsaver - * @date 2016 - * - * @brief Stable (MergeSort) of a given list. - * @param pList Pointer to list to be sorted - * @param pListCmp Compare function to be used - * @note The comparison function cmp(A,B) is expected + * \brief Stable (MergeSort) of a given list. + * \param pList Pointer to list to be sorted + * \param pListCmp Compare function to be used + * \note The comparison function cmp(A,B) is expected * to return -1 for AB. * - * @note Use of mergesort algorithm based on analysis by + * \note Use of mergesort algorithm based on analysis by * http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html */ epicsShareFunc void ellSortStable(ELLLIST *pList, pListCmp pListCmp); /** - * @brief Free all the nodes in a list. + * \brief Free all the nodes in a list. * * This routine empties a list, calling freeFunc() for every node on it. - * @param pList List from which to free all nodes - * @param freeFunc The free() routine to be called - * @note The nodes in the list are free()'d on the assumption that the node + * \param pList List from which to free all nodes + * \param freeFunc The free() routine to be called + * \note The nodes in the list are free()'d on the assumption that the node * structures were malloc()'d one-at-a-time and that the ELLNODE structure is * the first member of the parent structure. */ epicsShareFunc void ellFree2 (ELLLIST *pList, FREEFUNC freeFunc); /** - * @brief Verifies that the list is consistent - * @param pList List to be verified + * \brief Verifies that the list is consistent + * \param pList List to be verified */ epicsShareFunc void ellVerify (ELLLIST *pList); diff --git a/modules/libcom/src/env/envDefs.h b/modules/libcom/src/env/envDefs.h index 12dd601b5..7f4859063 100644 --- a/modules/libcom/src/env/envDefs.h +++ b/modules/libcom/src/env/envDefs.h @@ -8,10 +8,10 @@ \*************************************************************************/ /** - * @file envDefs.h - * @author Roger A. Cole + * \file envDefs.h + * \author Roger A. Cole * - * @brief Routines to get and set EPICS environment parameters. + * \brief Routines to get and set EPICS environment parameters. * * This file defines environment parameters used by EPICS and the * routines used to get and set those parameter values. @@ -23,7 +23,7 @@ * own use--the only caveat is that such parameters aren't automatically * setup by EPICS. * - * @note bldEnvData.pl looks for "epicsShareExtern const ENV_PARAM ;" + * \note bldEnvData.pl looks for "epicsShareExtern const ENV_PARAM ;" */ #ifndef envDefsH @@ -36,11 +36,11 @@ extern "C" { #include "shareLib.h" /** - * @brief A structure to hold a single environment parameter + * \brief A structure to hold a single environment parameter */ typedef struct envParam { - char *name; /**< @brief Name of the parameter */ - char *pdflt; /**< @brief Default value */ + char *name; /**< \brief Name of the parameter */ + char *pdflt; /**< \brief Default value */ } ENV_PARAM; epicsShareExtern const ENV_PARAM EPICS_CA_ADDR_LIST; @@ -58,7 +58,7 @@ epicsShareExtern const ENV_PARAM EPICS_CAS_IGNORE_ADDR_LIST; epicsShareExtern const ENV_PARAM EPICS_CAS_AUTO_BEACON_ADDR_LIST; epicsShareExtern const ENV_PARAM EPICS_CAS_BEACON_ADDR_LIST; epicsShareExtern const ENV_PARAM EPICS_CAS_SERVER_PORT; -epicsShareExtern const ENV_PARAM EPICS_CA_BEACON_PERIOD; /**< @brief deprecated */ +epicsShareExtern const ENV_PARAM EPICS_CA_BEACON_PERIOD; /**< \brief deprecated */ epicsShareExtern const ENV_PARAM EPICS_CAS_BEACON_PERIOD; epicsShareExtern const ENV_PARAM EPICS_CAS_BEACON_PORT; epicsShareExtern const ENV_PARAM EPICS_BUILD_COMPILER_CLASS; @@ -80,7 +80,7 @@ epicsShareExtern const ENV_PARAM *env_param_list[]; struct in_addr; /** - * @brief Get value of a configuration parameter + * \brief Get value of a configuration parameter * * Gets the value of a configuration parameter from the environment * and copies it into the caller's buffer. If the parameter isn't @@ -88,20 +88,20 @@ struct in_addr; * copied instead. If neither provides a non-empty string the buffer * is set to '\0' and NULL is returned. * - * @param pParam Pointer to config param structure. - * @param bufDim Dimension of parameter buffer - * @param pBuf Pointer to parameter buffer - * @return Pointer to the environment variable value string, or + * \param pParam Pointer to config param structure. + * \param bufDim Dimension of parameter buffer + * \param pBuf Pointer to parameter buffer + * \return Pointer to the environment variable value string, or * NULL if no parameter value and default value was empty. */ epicsShareFunc char * epicsShareAPI envGetConfigParam(const ENV_PARAM *pParam, int bufDim, char *pBuf); /** - * @brief Get a configuration parameter's value or default string. + * \brief Get a configuration parameter's value or default string. * - * @param pParam Pointer to config param structure. - * @return Pointer to the environment variable value string, or to + * \param pParam Pointer to config param structure. + * \return Pointer to the environment variable value string, or to * the default value for the parameter, or NULL if those strings * were empty or not set. */ @@ -109,16 +109,16 @@ epicsShareFunc const char * epicsShareAPI envGetConfigParamPtr(const ENV_PARAM *pParam); /** - * @brief Print the value of a configuration parameter. + * \brief Print the value of a configuration parameter. * - * @param pParam Pointer to config param structure. - * @return 0 + * \param pParam Pointer to config param structure. + * \return 0 */ epicsShareFunc long epicsShareAPI envPrtConfigParam(const ENV_PARAM *pParam); /** - * @brief Get value of an inet addr config parameter. + * \brief Get value of an inet addr config parameter. * * Gets the value of a configuration parameter and copies it into * the caller's (struct in_addr) buffer. If the configuration parameter @@ -129,67 +129,67 @@ epicsShareFunc long epicsShareAPI * If no parameter is found and there is no default, then -1 is * returned and the callers buffer is unmodified. * - * @param pParam Pointer to config param structure. - * @param pAddr Pointer to struct to receive inet addr. - * @return 0, or -1 if an error is encountered + * \param pParam Pointer to config param structure. + * \param pAddr Pointer to struct to receive inet addr. + * \return 0, or -1 if an error is encountered */ epicsShareFunc long epicsShareAPI envGetInetAddrConfigParam(const ENV_PARAM *pParam, struct in_addr *pAddr); /** - * @brief Get value of a double configuration parameter. + * \brief Get value of a double configuration parameter. * * Gets the value of a configuration parameter, converts it into a - * @c double value and copies that into the caller's buffer. If the + * \c double value and copies that into the caller's buffer. If the * configuration parameter isn't found in the environment, the * default value for the parameter is used instead. * * If no parameter is found and there is no default, then -1 is * returned and the callers buffer is unmodified. * - * @param pParam Pointer to config param structure. - * @param pDouble Pointer to place to store value. - * @return 0, or -1 if an error is encountered + * \param pParam Pointer to config param structure. + * \param pDouble Pointer to place to store value. + * \return 0, or -1 if an error is encountered */ epicsShareFunc long epicsShareAPI envGetDoubleConfigParam(const ENV_PARAM *pParam, double *pDouble); /** - * @brief Get value of a long configuration parameter. + * \brief Get value of a long configuration parameter. * * Gets the value of a configuration parameter, converts it into a - * @c long value and copies that into the caller's buffer. If the + * \c long value and copies that into the caller's buffer. If the * configuration parameter isn't found in the environment, the * default value for the parameter is used instead. * * If no parameter is found and there is no default, then -1 is * returned and the callers buffer is unmodified. * - * @param pParam Pointer to config param structure. - * @param pLong Pointer to place to store value. - * @return 0, or -1 if an error is encountered + * \param pParam Pointer to config param structure. + * \param pLong Pointer to place to store value. + * \return 0, or -1 if an error is encountered */ epicsShareFunc long epicsShareAPI envGetLongConfigParam(const ENV_PARAM *pParam, long *pLong); /** - * @brief Get value of a port number configuration parameter. + * \brief Get value of a port number configuration parameter. * * Returns the value of a configuration parameter that represents * an inet port number. If no environment variable is found the * default parameter value is used, and if that is also unset the - * @c defaultPort argument returned instead. The integer value must + * \c defaultPort argument returned instead. The integer value must * fall between the values IPPORT_USERRESERVED and USHRT_MAX or the - * @c defaultPort argument will be substituted instead. + * \c defaultPort argument will be substituted instead. * - * @param pEnv Pointer to config param structure. - * @param defaultPort Port number to be used if environment settings invalid. - * @return Port number. + * \param pEnv Pointer to config param structure. + * \param defaultPort Port number to be used if environment settings invalid. + * \return Port number. */ epicsShareFunc unsigned short epicsShareAPI envGetInetPortConfigParam (const ENV_PARAM *pEnv, unsigned short defaultPort); /** - * @brief Get value of a boolean configuration parameter. + * \brief Get value of a boolean configuration parameter. * * Gets the value of a configuration parameter, and puts the value * 0 or 1 into the caller's buffer depending on the value. If the @@ -203,38 +203,38 @@ epicsShareFunc unsigned short epicsShareAPI envGetInetPortConfigParam * If no parameter is found and there is no default, then -1 is * returned and the callers buffer is unmodified. * - * @param pParam Pointer to config param structure. - * @param pBool Pointer to place to store value. - * @return 0, or -1 if an error is encountered + * \param pParam Pointer to config param structure. + * \param pBool Pointer to place to store value. + * \return 0, or -1 if an error is encountered */ epicsShareFunc long epicsShareAPI envGetBoolConfigParam(const ENV_PARAM *pParam, int *pBool); /** - * @brief Prints all configuration parameters and their current value. + * \brief Prints all configuration parameters and their current value. * - * @return 0 + * \return 0 */ epicsShareFunc long epicsShareAPI epicsPrtEnvParams(void); /** - * @brief Set an environment variable's value + * \brief Set an environment variable's value * * The setenv() routine is not available on all operating systems. * This routine provides a portable alternative for all EPICS targets. - * @param name Environment variable name. - * @param value New value for environment variable. + * \param name Environment variable name. + * \param value New value for environment variable. */ epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *value); /** - * @brief Clear the value of an environment variable - * @param name Environment variable name. + * \brief Clear the value of an environment variable + * \param name Environment variable name. */ epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name); /** - * @brief Print value of an environment variable, or all variables + * \brief Print value of an environment variable, or all variables * - * @param name Environment variable name, or NULL to show all. + * \param name Environment variable name, or NULL to show all. */ epicsShareFunc void epicsShareAPI epicsEnvShow (const char *name); diff --git a/modules/libcom/src/iocsh/iocsh.h b/modules/libcom/src/iocsh/iocsh.h index 4b87f3dd7..e69bd3c7b 100644 --- a/modules/libcom/src/iocsh/iocsh.h +++ b/modules/libcom/src/iocsh/iocsh.h @@ -85,27 +85,27 @@ epicsShareFunc const iocshVarDef * epicsShareAPI iocshFindVariable( /* This should only be called when iocsh is no longer needed*/ epicsShareFunc void epicsShareAPI iocshFree(void); -/** shorthand for @code iocshLoad(pathname, NULL) @endcode */ +/** shorthand for \code iocshLoad(pathname, NULL) \endcode */ epicsShareFunc int epicsShareAPI iocsh(const char *pathname); -/** shorthand for @code iocshRun(cmd, NULL) @endcode */ +/** shorthand for \code iocshRun(cmd, NULL) \endcode */ epicsShareFunc int epicsShareAPI iocshCmd(const char *cmd); /** Read and evaluate IOC shell commands from the given file. - * @param pathname Path to script file - * @param macros NULL or a comma seperated list of macro definitions. eg. "VAR1=x,VAR2=y" - * @return 0 on success, non-zero on error + * \param pathname Path to script file + * \param macros NULL or a comma seperated list of macro definitions. eg. "VAR1=x,VAR2=y" + * \return 0 on success, non-zero on error */ epicsShareFunc int epicsShareAPI iocshLoad(const char *pathname, const char* macros); /** Evaluate a single IOC shell command - * @param cmd Command string. eg. "echo \"something or other\"" - * @param macros NULL or a comma seperated list of macro definitions. eg. "VAR1=x,VAR2=y" - * @return 0 on success, non-zero on error + * \param cmd Command string. eg. "echo \"something or other\"" + * \param macros NULL or a comma seperated list of macro definitions. eg. "VAR1=x,VAR2=y" + * \return 0 on success, non-zero on error */ epicsShareFunc int epicsShareAPI iocshRun(const char *cmd, const char* macros); -/** @brief Signal error from an IOC shell function. +/** \brief Signal error from an IOC shell function. * - * @param err 0 - success (no op), !=0 - error - * @return The err argument value. + * \param err 0 - success (no op), !=0 - error + * \return The err argument value. */ epicsShareFunc int iocshSetError(int err); diff --git a/modules/libcom/src/macLib/macLib.h b/modules/libcom/src/macLib/macLib.h index 3be57cdce..8e75d3801 100644 --- a/modules/libcom/src/macLib/macLib.h +++ b/modules/libcom/src/macLib/macLib.h @@ -7,9 +7,9 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ /** - * @file macLib.h - * @brief Text macro substitution routines - * @author William Lupton, W. M. Keck Observatory + * \file macLib.h + * \brief Text macro substitution routines + * \author William Lupton, W. M. Keck Observatory * * This general purpose macro substitution library * is used for all macro substitutions in EPICS Base. @@ -31,31 +31,31 @@ extern "C" { #endif -/** @brief Maximum size of a macro name or value +/** \brief Maximum size of a macro name or value */ #define MAC_SIZE 256 -/** @brief Macro substitution context, for use by macLib routines only. +/** \brief Macro substitution context, for use by macLib routines only. * * An application may have multiple active contexts if desired. */ typedef struct { - long magic; /**< @brief magic number (used for authentication) */ - int dirty; /**< @brief values need expanding from raw values? */ - int level; /**< @brief scoping level */ - int debug; /**< @brief debugging level */ - ELLLIST list; /**< @brief macro name / value list */ - int flags; /**< @brief operating mode flags */ + long magic; /**< \brief magic number (used for authentication) */ + int dirty; /**< \brief values need expanding from raw values? */ + int level; /**< \brief scoping level */ + int debug; /**< \brief debugging level */ + ELLLIST list; /**< \brief macro name / value list */ + int flags; /**< \brief operating mode flags */ } MAC_HANDLE; -/** @name Core Library +/** \name Core Library * The core library provides a minimal set of basic operations. * @{ */ /** - * @brief Creates a new macro substitution context. - * @return 0 = OK; <0 = ERROR + * \brief Creates a new macro substitution context. + * \return 0 = OK; <0 = ERROR */ epicsShareFunc long epicsShareAPI macCreateHandle( @@ -64,16 +64,16 @@ epicsShareAPI macCreateHandle( const char * pairs[] /**< pointer to NULL-terminated array of {name,value} pair strings. A NULL - value implies undefined; a NULL @c pairs + value implies undefined; a NULL \c pairs argument implies no macros. */ ); /** - * @brief Disable or enable warning messages. + * \brief Disable or enable warning messages. * * The macExpandString() routine prints warnings when it cant expand a macro. * This routine can be used to silence those warnings. A non zero value will * suppress the warning messages from subsequent library routines given the - * same @c handle. + * same \c handle. */ epicsShareFunc void epicsShareAPI macSuppressWarning( @@ -83,15 +83,15 @@ epicsShareAPI macSuppressWarning( ); /** - * @brief Expand a string which may contain macro references. - * @return Returns the length of the expanded string, <0 if any macro are + * \brief Expand a string which may contain macro references. + * \return Returns the length of the expanded string, <0 if any macro are * undefined * - * This routine parses the @c src string looking for macro references and + * This routine parses the \c src string looking for macro references and * passes any it finds to macGetValue() for translation. * - * @note The return value is similar to that of macGetValue(). Its absolute - * value is the number of characters copied to @c dest. If the return value + * \note The return value is similar to that of macGetValue(). Its absolute + * value is the number of characters copied to \c dest. If the return value * is negative, at least one undefined macro was left unexpanded. */ epicsShareFunc long @@ -106,11 +106,11 @@ epicsShareAPI macExpandString( ); /** - * @brief Sets the value of a specific macro. - * @return Returns the length of the value string. - * @note If @c value is NULL, all instances of @c name are undefined at + * \brief Sets the value of a specific macro. + * \return Returns the length of the value string. + * \note If \c value is NULL, all instances of \c name are undefined at * all scoping levels (the named macro doesn't have to exist in this case). - * Macros referenced in @c value need not be defined at this point. + * Macros referenced in \c value need not be defined at this point. */ epicsShareFunc long epicsShareAPI macPutValue( @@ -122,22 +122,22 @@ epicsShareAPI macPutValue( ); /** - * @brief Returns the value of a macro - * @return Returns the length of the value string, <0 if undefined + * \brief Returns the value of a macro + * \return Returns the length of the value string, <0 if undefined * - * @c value will be zero-terminated if the length of the value is less than - * @c capacity. The return value is the number of characters copied to - * @c value (see below for behavior if the macro is undefined). If @c capacity - * is zero, no characters will be copied to @c value (which may be NULL) + * \c value will be zero-terminated if the length of the value is less than + * \c capacity. The return value is the number of characters copied to + * \c value (see below for behavior if the macro is undefined). If \c capacity + * is zero, no characters will be copied to \c value (which may be NULL) * and the call can be used to check whether the macro is defined. * - * @note Truncation of the value is not reported, applications should assume + * \note Truncation of the value is not reported, applications should assume * that truncation has occurred if the return value is equal to capacity. * * If the macro is undefined, the macro reference will be returned in * the value string (if permitted by maxlen) and the function value will * be _minus_ the number of characters copied. Note that treatment of - * @c capacity is intended to be consistent with the strncpy() routine. + * \c capacity is intended to be consistent with the strncpy() routine. * * If the value contains macro references, these references will be * expanded recursively. This expansion will detect a direct or indirect @@ -161,9 +161,9 @@ epicsShareAPI macGetValue( long capacity /**< capacity of destination buffer (value) */ ); /** - * @brief Marks a handle invalid, and frees all storage associated with it - * @return 0 = OK; <0 = ERROR - * @note Note that this does not free any strings into which macro values have + * \brief Marks a handle invalid, and frees all storage associated with it + * \return 0 = OK; <0 = ERROR + * \note Note that this does not free any strings into which macro values have * been returned. Macro values are always returned into strings which * were pre-allocated by the caller. */ @@ -172,8 +172,8 @@ epicsShareAPI macDeleteHandle( MAC_HANDLE *handle /**< opaque handle */ ); /** - * @brief Marks the start of a new scoping level - * @return 0 = OK; <0 = ERROR + * \brief Marks the start of a new scoping level + * \return 0 = OK; <0 = ERROR * * Marks all macro definitions added after this call as belonging * to another scope. These macros will be lost on a macPopScope() @@ -184,8 +184,8 @@ epicsShareAPI macPushScope( MAC_HANDLE *handle /**< opaque handle */ ); /** - * @brief Retrieve the last pushed scope (like stack operations) - * @return 0 = OK; <0 = ERROR + * \brief Retrieve the last pushed scope (like stack operations) + * \return 0 = OK; <0 = ERROR * * See macPushScope() */ @@ -194,8 +194,8 @@ epicsShareAPI macPopScope( MAC_HANDLE *handle /**< opaque handle */ ); /** - * @brief Reports details of current definitions - * @return 0 = OK; <0 = ERROR + * \brief Reports details of current definitions + * \return 0 = OK; <0 = ERROR * This sends details of current definitions to standard output, * and is intended purely for debugging purposes. */ @@ -205,15 +205,15 @@ epicsShareAPI macReportMacros( ); /** @} */ -/** @name Utility Library +/** \name Utility Library * These convenience functions are intended for applications to use and * provide a more convenient interface for some purposes. * @{ */ /** - * @brief Parse macro definitions into an array of {name, value} pairs. - * @return Number of macros found; <0 = ERROR + * \brief Parse macro definitions into an array of {name, value} pairs. + * \return Number of macros found; <0 = ERROR * * This takes a set of macro definitions in "a=xxx,b=yyy" format and * converts them into an array of pointers to character strings which @@ -251,8 +251,8 @@ epicsShareAPI macParseDefns( ); /** - * @brief Install set of {name, value} pairs as definitions - * @return Number of macros defined; <0 = ERROR + * \brief Install set of {name, value} pairs as definitions + * \return Number of macros defined; <0 = ERROR * * This takes an array of pairs as defined above and installs them as * definitions by calling macPutValue(). The pairs array is terminated @@ -269,8 +269,8 @@ epicsShareAPI macInstallMacros( ); /** - * @brief Expand environment variables in a string. - * @return Expanded string; NULL if any undefined macros were used. + * \brief Expand environment variables in a string. + * \return Expanded string; NULL if any undefined macros were used. * * This routine expands a string which may contain macros that are * environment variables. It parses the string looking for such @@ -285,8 +285,8 @@ epicsShareAPI macEnvExpand( ); /** - * @brief Expands macros and environment variables in a string. - * @return Expanded string; NULL if any undefined macros were used. + * \brief Expands macros and environment variables in a string. + * \return Expanded string; NULL if any undefined macros were used. * * This routine is similar to macEnvExpand() but allows an optional handle * to be passed in that may contain additional macro definitions. diff --git a/modules/libcom/src/misc/adjustment.h b/modules/libcom/src/misc/adjustment.h index f330bcd9d..c256569f1 100644 --- a/modules/libcom/src/misc/adjustment.h +++ b/modules/libcom/src/misc/adjustment.h @@ -9,8 +9,8 @@ \*************************************************************************/ /** - * @file adjustment.h - * @brief Declare function `adjustToWorstCaseAlignment` + * \file adjustment.h + * \brief Declare function `adjustToWorstCaseAlignment` * * Declares a single function `adjustToWorstCaseAlignment`. */ diff --git a/modules/libcom/src/misc/alarm.h b/modules/libcom/src/misc/alarm.h index fc6adedf6..edaaf1e5f 100644 --- a/modules/libcom/src/misc/alarm.h +++ b/modules/libcom/src/misc/alarm.h @@ -8,9 +8,9 @@ \*************************************************************************/ /** - * @file alarm.h - * @brief Alarm severity and status/condition values - * @author Bob Dalesio and Marty Kraimer + * \file alarm.h + * \brief Alarm severity and status/condition values + * \author Bob Dalesio and Marty Kraimer * * These alarm definitions must match the related * menuAlarmSevr.dbd and menuAlarmStat.dbd files @@ -27,13 +27,13 @@ extern "C" { #endif /** - * @brief The NO_ALARM value can be used as both a severity and a status. + * \brief The NO_ALARM value can be used as both a severity and a status. */ #define NO_ALARM 0 /** - * @brief Alarm severity values - * @note These must match the choices in menuAlarmSevr.dbd + * \brief Alarm severity values + * \note These must match the choices in menuAlarmSevr.dbd */ typedef enum { epicsSevNone = NO_ALARM, /**< No alarm */ @@ -44,7 +44,7 @@ typedef enum { } epicsAlarmSeverity; /** - * @name Original macros for alarm severity values + * \name Original macros for alarm severity values * @{ */ #define firstEpicsAlarmSev epicsSevNone @@ -55,8 +55,8 @@ typedef enum { /** @} */ /** - * @brief Alarm status/condition values - * @note These must match the choices in menuAlarmStat.dbd + * \brief Alarm status/condition values + * \note These must match the choices in menuAlarmStat.dbd */ typedef enum { epicsAlarmNone = NO_ALARM, /**< No alarm */ @@ -85,7 +85,7 @@ typedef enum { } epicsAlarmCondition; /** - * @name Original macros for alarm status/condition values + * \name Original macros for alarm status/condition values * @{ */ #define firstEpicsAlarmCond epicsAlarmNone @@ -114,11 +114,11 @@ typedef enum { /** @} */ /** - * @brief How to convert an alarm severity into a string + * \brief How to convert an alarm severity into a string */ epicsShareExtern const char *epicsAlarmSeverityStrings [ALARM_NSEV]; /** - * @brief How to convert an alarm condition/status into a string + * \brief How to convert an alarm condition/status into a string */ epicsShareExtern const char *epicsAlarmConditionStrings [ALARM_NSTATUS]; diff --git a/modules/libcom/src/misc/alarmString.h b/modules/libcom/src/misc/alarmString.h index 0ac92d74b..d2741b567 100644 --- a/modules/libcom/src/misc/alarmString.h +++ b/modules/libcom/src/misc/alarmString.h @@ -8,12 +8,12 @@ \*************************************************************************/ /** - * @file alarmString.h - * @brief Deprecated, use alarm.h instead + * \file alarmString.h + * \brief Deprecated, use alarm.h instead * * How to convert alarm status and severity values into a string for printing. * - * @note This file is deprecated, use alarm.h instead. + * \note This file is deprecated, use alarm.h instead. */ #ifndef INC_alarmString_H @@ -26,11 +26,11 @@ extern "C" { #endif /** - * @brief An alias for epicsAlarmSeverityStrings + * \brief An alias for epicsAlarmSeverityStrings */ #define alarmSeverityString epicsAlarmSeverityStrings /** - * @brief An alias for epicsAlarmConditionStrings + * \brief An alias for epicsAlarmConditionStrings */ #define alarmStatusString epicsAlarmConditionStrings diff --git a/modules/libcom/src/misc/cantProceed.h b/modules/libcom/src/misc/cantProceed.h index 4fa91811a..5fb3ef0f8 100644 --- a/modules/libcom/src/misc/cantProceed.h +++ b/modules/libcom/src/misc/cantProceed.h @@ -8,8 +8,8 @@ \*************************************************************************/ /** - * @file cantProceed.h - * @brief Routines for code that can't continue or return after an error. + * \file cantProceed.h + * \brief Routines for code that can't continue or return after an error. * * This is the EPICS equivalent of a Kernel Panic, except that the effect * is to halt only the thread that detects the error. @@ -33,19 +33,19 @@ extern "C" { #endif -/** @brief Suspend this thread, the caller cannot continue or return. +/** \brief Suspend this thread, the caller cannot continue or return. * * The effect of calling this is to print the error message followed by * the name of the thread that is being suspended. A stack trace will * also be shown if supported by the OS, and the thread is suspended * inside an infinite loop. - * @param errorMessage A printf-style error message describing the error. - * @param ... Any parameters required for the error message. + * \param errorMessage A printf-style error message describing the error. + * \param ... Any parameters required for the error message. */ epicsShareFunc void cantProceed(const char *errorMessage, ...) EPICS_PRINTF_STYLE(1,2); -/** @name Memory Allocation Functions +/** \name Memory Allocation Functions * These versions of calloc() and malloc() never fail, they suspend the * thread if the OS is unable to allocate the requested memory at the current * time. If the thread is resumed, they will re-try the memory allocation, @@ -54,18 +54,18 @@ epicsShareFunc void cantProceed(const char *errorMessage, ...) * gracefully when memory runs out. */ /** @{ */ -/** @brief A calloc() that never returns NULL. - * @param count Number of objects. - * @param size Size of each object. - * @param errorMessage What this memory is needed for. - * @return Pointer to zeroed allocated memory. +/** \brief A calloc() that never returns NULL. + * \param count Number of objects. + * \param size Size of each object. + * \param errorMessage What this memory is needed for. + * \return Pointer to zeroed allocated memory. */ epicsShareFunc void * callocMustSucceed(size_t count, size_t size, const char *errorMessage); -/** @brief A malloc() that never returns NULL. - * @param size Size of block to allocate. - * @param errorMessage What this memory is needed for. - * @return Pointer to allocated memory. +/** \brief A malloc() that never returns NULL. + * \param size Size of block to allocate. + * \param errorMessage What this memory is needed for. + * \return Pointer to allocated memory. */ epicsShareFunc void * mallocMustSucceed(size_t size, const char *errorMessage); /** @} */ diff --git a/modules/libcom/src/misc/dbDefs.h b/modules/libcom/src/misc/dbDefs.h index 16d3e06eb..5de0cd922 100644 --- a/modules/libcom/src/misc/dbDefs.h +++ b/modules/libcom/src/misc/dbDefs.h @@ -8,10 +8,10 @@ \*************************************************************************/ /** - * @file dbDefs.h - * @author Marty Kraimer + * \file dbDefs.h + * \author Marty Kraimer * - * @brief Miscellaneous macro definitions. + * \brief Miscellaneous macro definitions. * * This file defines several miscellaneous macros. */ @@ -31,30 +31,30 @@ #endif #define FALSE 0 -/** @brief Deprecated synonym for @c static */ +/** \brief Deprecated synonym for \c static */ #ifndef LOCAL # define LOCAL static #endif -/** @brief Number of elements in array */ +/** \brief Number of elements in array */ #ifndef NELEMENTS # define NELEMENTS(array) (sizeof (array) / sizeof ((array) [0])) #endif -/** @brief Deprecated synonym for @c offsetof */ +/** \brief Deprecated synonym for \c offsetof */ #ifndef OFFSET # define OFFSET(structure, member) offsetof(structure, member) #endif -/** @brief Find parent object from a member pointer +/** \brief Find parent object from a member pointer * * Subtracts the byte offset of the member in the structure from the * pointer to the member itself, giving a pointer to parent strucure. - * @param ptr Pointer to a member data field of a structure - * @param structure Type name of the parent structure - * @param member Field name of the data member - * @return Pointer to the parent structure - * @note Both GCC and Clang will type-check this macro. + * \param ptr Pointer to a member data field of a structure + * \param structure Type name of the parent structure + * \param member Field name of the data member + * \return Pointer to the parent structure + * \note Both GCC and Clang will type-check this macro. */ #ifndef CONTAINER # ifdef __GNUC__ @@ -68,18 +68,18 @@ # endif #endif -/** @brief Size of a record name including the nil terminator */ +/** \brief Size of a record name including the nil terminator */ #define PVNAME_STRINGSZ 61 -/** @brief Size of a record name without the nil terminator */ +/** \brief Size of a record name without the nil terminator */ #define PVNAME_SZ (PVNAME_STRINGSZ - 1) /** - * @def PVLINK_STRINGSZ - * @brief Buffer size for the string representation of a DBF_*LINK field + * \def PVLINK_STRINGSZ + * \brief Buffer size for the string representation of a DBF_*LINK field */ #define PVLINK_STRINGSZ 1024 -/** @brief dbAccess enums/menus can have up to this many choices */ +/** \brief dbAccess enums/menus can have up to this many choices */ #define DB_MAX_CHOICES 30 #endif /* INC_dbDefs_H */ diff --git a/modules/libcom/src/misc/epicsExit.h b/modules/libcom/src/misc/epicsExit.h index 0f1873f8d..23c40f8d1 100644 --- a/modules/libcom/src/misc/epicsExit.h +++ b/modules/libcom/src/misc/epicsExit.h @@ -8,9 +8,9 @@ \*************************************************************************/ /*epicsExit.h*/ /** - * @file epicsExit.h + * \file epicsExit.h * - * @brief Extended replacement for the Posix exit and atexit routines. + * \brief Extended replacement for the Posix exit and atexit routines. * * This is an extended replacement for the Posix exit and atexit routines, which * also provides a pointer argument to pass to the exit handlers. This facility @@ -28,61 +28,61 @@ extern "C" { #endif /** - * @brief Pointer to a callback function that is to be called + * \brief Pointer to a callback function that is to be called * by the epicsExit subsystem. */ typedef void (*epicsExitFunc)(void *arg); /** - * @brief Calls epicsExitCallAtExits(), then the OS exit() routine. - * @param status Passed to exit() + * \brief Calls epicsExitCallAtExits(), then the OS exit() routine. + * \param status Passed to exit() */ epicsShareFunc void epicsExit(int status); /** - * @brief Arrange to call epicsExit() later from a low priority thread. + * \brief Arrange to call epicsExit() later from a low priority thread. * * This delays the actual call to exit() so it doesn't run in this thread. - * @param status Passed to exit() + * \param status Passed to exit() */ epicsShareFunc void epicsExitLater(int status); /** - * @brief Internal routine that runs the registered exit routines. + * \brief Internal routine that runs the registered exit routines. * * Calls each of the functions registered by prior calls to epicsAtExit * in reverse order of their registration. - * @note Most applications will not call this routine directly. + * \note Most applications will not call this routine directly. */ epicsShareFunc void epicsExitCallAtExits(void); /** - * @brief Register a function and an associated context parameter - * @param func Function to be called when epicsExitCallAtExits is invoked. - * @param arg Context parameter for the function. - * @param name Function name + * \brief Register a function and an associated context parameter + * \param func Function to be called when epicsExitCallAtExits is invoked. + * \param arg Context parameter for the function. + * \param name Function name */ epicsShareFunc int epicsAtExit3(epicsExitFunc func, void *arg, const char* name); /** - * @brief Convenience macro to register a function and context value to be + * \brief Convenience macro to register a function and context value to be * run when the process exits. - * @param F Function to be called at process shutdown. - * @param A Context parameter for the function. + * \param F Function to be called at process shutdown. + * \param A Context parameter for the function. */ #define epicsAtExit(F,A) epicsAtExit3(F,A,#F) /** - * @brief Internal routine that runs the registered thread exit routines. + * \brief Internal routine that runs the registered thread exit routines. * * Calls each of the functions that were registered in the current thread by * calling epicsAtThreadExit(), in reverse order of their registration. - * @note This routine is called automatically when an epicsThread's main + * \note This routine is called automatically when an epicsThread's main * entry routine returns. It will not be run if the thread gets stopped by * some other method. */ epicsShareFunc void epicsExitCallAtThreadExits(void); /** - * @brief Register a function and an context value to be run by this thread + * \brief Register a function and an context value to be run by this thread * when it returns from its entry routine. - * @param func Function be called at thread completion. - * @param arg Context parameter for the function. + * \param func Function be called at thread completion. + * \param arg Context parameter for the function. */ epicsShareFunc int epicsAtThreadExit(epicsExitFunc func, void *arg); diff --git a/modules/libcom/src/misc/epicsExport.h b/modules/libcom/src/misc/epicsExport.h index 719555eaf..13b27b19e 100644 --- a/modules/libcom/src/misc/epicsExport.h +++ b/modules/libcom/src/misc/epicsExport.h @@ -11,8 +11,8 @@ #ifndef INC_epicsExport_H #define INC_epicsExport_H -/** @file epicsExport.h - * @brief Exporting IOC objects. +/** \file epicsExport.h + * \brief Exporting IOC objects. * * This header is unique, as it defines epicsExportSharedSymbols and thus * triggers a transition between importing declarations from other libraries, @@ -21,9 +21,9 @@ * * This header should be included with a trailing comment to make it stand * out from other includes, something like this: - @code + \code #include // defines epicsExportSharedSymbols - @endcode + \endcode */ #define epicsExportSharedSymbols @@ -35,82 +35,82 @@ extern "C" { typedef void (*REGISTRAR)(void); -/** @brief Generate a name for an export object. - * @param typ Object's data type. - * @param obj Object's name. - * @return C identifier for the export object. +/** \brief Generate a name for an export object. + * \param typ Object's data type. + * \param obj Object's name. + * \return C identifier for the export object. */ #define EPICS_EXPORT_POBJ(typ, obj) pvar_ ## typ ## _ ## obj -/** @brief Generate a name for an export function object. - * @param fun Function's name. - * @return C identifier for the export object. +/** \brief Generate a name for an export function object. + * \param fun Function's name. + * \return C identifier for the export object. */ #define EPICS_EXPORT_PFUNC(fun) EPICS_EXPORT_POBJ(func, fun) -/** @brief Declare an object for exporting. +/** \brief Declare an object for exporting. * * The epicsExportAddress() macro must be used to declare any IOC object * that is also named in a DBD file. For example a record support source * file must contain a statement like: - @code + \code epicsExportAddress(rset, myRSET); - @endcode + \endcode * * A device support source file must contain a statement like: - @code + \code epicsExportAddress(dset, devMyName); - @endcode - * Note that the @p typ parameter for a device support entry table must be - * spelled @c dset even if the @p obj was actually declared as some other - * type, say using @c typed_dset . + \endcode + * Note that the \p typ parameter for a device support entry table must be + * spelled \c dset even if the \p obj was actually declared as some other + * type, say using \c typed_dset . * * A driver support source file must contain a statement like: - @code + \code epicsExportAddress(drvet, drvName); - @endcode + \endcode * - * A variable named in a DBD @c variable statement must be declared with: - @code + * A variable named in a DBD \c variable statement must be declared with: + \code int myDebug = 0; epicsExportAddress(int, myDebug); - @endcode - * Only @c int and @c double are currently supported for DBD variables. + \endcode + * Only \c int and \c double are currently supported for DBD variables. * - * @param typ Object's data type. - * @param obj Object's name. + * \param typ Object's data type. + * \param obj Object's name. */ #define epicsExportAddress(typ, obj) \ epicsShareExtern typ *EPICS_EXPORT_POBJ(typ,obj); \ epicsShareDef typ *EPICS_EXPORT_POBJ(typ, obj) = (typ *) (char *) &obj -/** @brief Declare a registrar function for exporting. +/** \brief Declare a registrar function for exporting. * * The epicsExportRegistrar() macro must be used to declare a registrar * function that is named in a DBD \c registrar statement. For example: - @code + \code static void myRegistrar(void) { ... } epicsExportRegistrar(myRegistrar); - @endcode + \endcode * - * @param fun Registrar function's name. + * \param fun Registrar function's name. */ #define epicsExportRegistrar(fun) \ epicsShareFunc REGISTRAR EPICS_EXPORT_PFUNC(fun) = (REGISTRAR) &fun -/** @brief Declare and register a function for exporting. +/** \brief Declare and register a function for exporting. * * The epicsRegisterFunction() macro must be used to declare and register - * a function that is named in a DBD @c function statement and called by + * a function that is named in a DBD \c function statement and called by * one or more subroutine or aSub records. For example: - @code + \code epicsRegisterFunction(mySubInit); epicsRegisterFunction(mySubProcess); - @endcode + \endcode * - * @param fun Function's name + * \param fun Function's name */ #define epicsRegisterFunction(fun) \ static void register_func_ ## fun(void) \ diff --git a/modules/libcom/src/misc/epicsUnitTest.h b/modules/libcom/src/misc/epicsUnitTest.h index 28bb55dce..31aac6dc1 100644 --- a/modules/libcom/src/misc/epicsUnitTest.h +++ b/modules/libcom/src/misc/epicsUnitTest.h @@ -6,9 +6,9 @@ \*************************************************************************/ /** - * @file epicsUnitTest.h - * @brief Unit test routines - * @author Andrew Johnson + * \file epicsUnitTest.h + * \brief Unit test routines + * \author Andrew Johnson * * The unit test routines make it easy for a test program to generate output * that is compatible with the Test Anything Protocol and can thus be used with @@ -83,7 +83,7 @@ * IOC using iocBuildIsolated() or iocBuild(), it has to be started by calling * iocRun(). The suggested call sequence in a test program that needs to run the * IOC without Channel Access is: -@code +\code #include "iocInit.h" MAIN(iocTest) @@ -98,7 +98,7 @@ MAIN(iocTest) pdbbase = NULL; return testDone(); } -@endcode +\endcode * The part from iocBuildIsolated() to iocShutdown() can be repeated to * execute multiple tests within one executable or harness. @@ -113,7 +113,7 @@ MAIN(iocTest) * * The following is a simple example of a test program using the epicsUnitTest * routines: -@code +\code #include #include "epicsUnitTest.h" #include "testMain.h" @@ -127,10 +127,10 @@ MAIN(mathTest) testDiag("4 * atan(1) = %g", 4.0 * atan(1.0)); return testDone(); } -@endcode +\endcode * The output from running the above program looks like this: -@code +\code 1..3 ok 1 - Sine starts ok 2 - Cosine continues @@ -140,7 +140,7 @@ ok 3 - M_PI == 4.0*atan(1.0) ======= Tests: 3 Passed: 3 = 100% -@endcode +\endcode */ #ifndef INC_epicsUnitTest_H @@ -155,90 +155,90 @@ ok 3 - M_PI == 4.0*atan(1.0) extern "C" { #endif -/** @brief Declare the test plan, required. - * @param tests Number of tests to be run. May be zero if not known but the +/** \brief Declare the test plan, required. + * \param tests Number of tests to be run. May be zero if not known but the * test harness then can't tell if the program dies prematurely. */ epicsShareFunc void testPlan(int tests); -/** @name Announcing Test Results +/** \name Announcing Test Results * Routines that declare individual test results. */ /** @{ */ -/** @brief Test result with printf-style description. - * @param pass True/False value indicating result. - * @param fmt A printf-style format string describing the test. - * @param ... Any parameters required for the format string. - * @return The value of \p pass. +/** \brief Test result with printf-style description. + * \param pass True/False value indicating result. + * \param fmt A printf-style format string describing the test. + * \param ... Any parameters required for the format string. + * \return The value of \p pass. */ epicsShareFunc int testOk(int pass, const char *fmt, ...) EPICS_PRINTF_STYLE(2, 3); -/** @brief Test result using condition as description - * @param cond Condition to be evaluated and displayed. - * @return The value of \p cond. +/** \brief Test result using condition as description + * \param cond Condition to be evaluated and displayed. + * \return The value of \p cond. */ #define testOk1(cond) testOk(cond, "%s", #cond) -/** @brief Test result with var-args description. - * @param pass True/False value indicating result. - * @param fmt A printf-style format string describing the test. - * @param pvar A var-args pointer to any parameters for the format string. - * @return The value of \p pass. +/** \brief Test result with var-args description. + * \param pass True/False value indicating result. + * \param fmt A printf-style format string describing the test. + * \param pvar A var-args pointer to any parameters for the format string. + * \return The value of \p pass. */ epicsShareFunc int testOkV(int pass, const char *fmt, va_list pvar); -/** @brief Passing test result with printf-style description. - * @param fmt A printf-style format string describing the test. - * @param ... Any parameters required for the format string. - * @return The value of \p pass. +/** \brief Passing test result with printf-style description. + * \param fmt A printf-style format string describing the test. + * \param ... Any parameters required for the format string. + * \return The value of \p pass. */ epicsShareFunc void testPass(const char *fmt, ...) EPICS_PRINTF_STYLE(1, 2); -/** @brief Failing test result with printf-style description. - * @param fmt A printf-style format string describing the test. - * @param ... Any parameters required for the format string. +/** \brief Failing test result with printf-style description. + * \param fmt A printf-style format string describing the test. + * \param ... Any parameters required for the format string. */ epicsShareFunc void testFail(const char *fmt, ...) EPICS_PRINTF_STYLE(1, 2); /** @} */ -/** @name Missing or Failing Tests - * @brief Routines for handling special situations. +/** \name Missing or Failing Tests + * \brief Routines for handling special situations. */ /** @{ */ -/** @brief Place-holders for tests that can't be run. - * @param skip How many tests are being skipped. - * @param why Reason for skipping these tests. +/** \brief Place-holders for tests that can't be run. + * \param skip How many tests are being skipped. + * \param why Reason for skipping these tests. */ epicsShareFunc void testSkip(int skip, const char *why); -/** @brief Mark the start of a group of tests that are expected to fail - * @param why Reason for expected failures. +/** \brief Mark the start of a group of tests that are expected to fail + * \param why Reason for expected failures. */ epicsShareFunc void testTodoBegin(const char *why); -/** @brief Mark the end of a failing test group. +/** \brief Mark the end of a failing test group. */ epicsShareFunc void testTodoEnd(void); -/** @brief Stop testing, program cannot continue. - * @param fmt A printf-style format string giving the reason for stopping. - * @param ... Any parameters required for the format string. +/** \brief Stop testing, program cannot continue. + * \param fmt A printf-style format string giving the reason for stopping. + * \param ... Any parameters required for the format string. */ epicsShareFunc void testAbort(const char *fmt, ...) EPICS_PRINTF_STYLE(1, 2); /** @} */ -/** @brief Output additional diagnostics - * @param fmt A printf-style format string containing diagnostic information. - * @param ... Any parameters required for the format string. +/** \brief Output additional diagnostics + * \param fmt A printf-style format string containing diagnostic information. + * \param ... Any parameters required for the format string. */ epicsShareFunc int testDiag(const char *fmt, ...) EPICS_PRINTF_STYLE(1, 2); -/** @brief Mark the end of testing. +/** \brief Mark the end of testing. */ epicsShareFunc int testDone(void); epicsShareFunc int testImpreciseTiming(void); -/** @name Test Harness for Embedded OSs +/** \name Test Harness for Embedded OSs * These routines are used to create a test-harness that can run * multiple test programs, collect their names and results, then * display a summary at the end of testing. @@ -246,17 +246,17 @@ int testImpreciseTiming(void); /** @{ */ typedef int (*TESTFUNC)(void); -/** @brief Initialize test harness +/** \brief Initialize test harness */ epicsShareFunc void testHarness(void); epicsShareFunc void testHarnessExit(void *dummy); epicsShareFunc void runTestFunc(const char *name, TESTFUNC func); -/** @brief Run a test program - * @param func Name of the test program. +/** \brief Run a test program + * \param func Name of the test program. */ #define runTest(func) runTestFunc(#func, func) -/** @brief Declare all test programs finished +/** \brief Declare all test programs finished */ #define testHarnessDone() testHarnessExit(0) /** @} */ diff --git a/modules/libcom/src/misc/shareLib.h b/modules/libcom/src/misc/shareLib.h index 22f6fa235..108069781 100644 --- a/modules/libcom/src/misc/shareLib.h +++ b/modules/libcom/src/misc/shareLib.h @@ -7,8 +7,8 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ /** - * @file shareLib.h - * @brief Mark external symbols and entry points for shared libraries. + * \file shareLib.h + * \brief Mark external symbols and entry points for shared libraries. * * This is the header file for the "decorated names" that appear in * header files, e.g. @@ -35,7 +35,7 @@ * int epicsShareAPI myExtFunc ( int arg ); * int epicsShareAPI myExtFunc ( int arg ) {} * - * @note The epicsShareAPI attribute is deprecated and has been removed + * \note The epicsShareAPI attribute is deprecated and has been removed * from all IOC-specific APIs. Most libCom APIs still use it, but * it may get removed from these at some point in the future. * @@ -77,8 +77,8 @@ * which functions are exported from the DLL and which of them are imported * from other DLLs. * - * You must first @c \#include what you import and then @c \#define - * @c epicsExportSharedSymbols only right before you @c \#include the + * You must first \c \#include what you import and then \c \#define + * \c epicsExportSharedSymbols only right before you \c \#include the * prototypes for what you implement! You must include shareLib.h again each * time that the state of the import/export keywords changes, but this * usually occurs as a side effect of including the shareable libraries header diff --git a/modules/libcom/src/misc/unixFileName.h b/modules/libcom/src/misc/unixFileName.h index 9d7af252c..0b6edb92e 100644 --- a/modules/libcom/src/misc/unixFileName.h +++ b/modules/libcom/src/misc/unixFileName.h @@ -24,13 +24,13 @@ extern "C" { #define OSI_PATH_SEPARATOR "/" /** Return the absolute path of the current executable. - @returns NULL or the path. Caller must free() + \return NULL or the path. Caller must free() */ epicsShareFunc char *epicsGetExecName(void); /** Return the absolute path of the directory containing the current executable. - @returns NULL or the path. Caller must free() + \return NULL or the path. Caller must free() */ epicsShareFunc char *epicsGetExecDir(void); diff --git a/modules/libcom/src/osi/compilerDependencies.h b/modules/libcom/src/osi/compilerDependencies.h index dc089ced8..82c89322b 100644 --- a/modules/libcom/src/osi/compilerDependencies.h +++ b/modules/libcom/src/osi/compilerDependencies.h @@ -8,9 +8,9 @@ \*************************************************************************/ /** - * @file compilerDependencies.h - * @author Jeffrey O. Hill johill@lanl.gov - * @brief Compiler specific declarations + * \file compilerDependencies.h + * \author Jeffrey O. Hill johill@lanl.gov + * \brief Compiler specific declarations * */ diff --git a/modules/libcom/src/osi/devLib.h b/modules/libcom/src/osi/devLib.h index 8b0735058..0f263bd90 100644 --- a/modules/libcom/src/osi/devLib.h +++ b/modules/libcom/src/osi/devLib.h @@ -10,9 +10,9 @@ \*************************************************************************/ /** - * @file devLib.h - * @brief API for accessing hardware devices, originally over VMEbus - * @author Marty Kraimer and Jeff Hill + * \file devLib.h + * \brief API for accessing hardware devices, originally over VMEbus + * \author Marty Kraimer and Jeff Hill * * Support for allocation of common device resources */ @@ -20,111 +20,111 @@ #define EPICSDEVLIB_H /** - * @name Macros for normalizing values - * @warning Deprecated, we don't know of any code currently using these. + * \name Macros for normalizing values + * \warning Deprecated, we don't know of any code currently using these. * @{ */ -/** @brief Create a bit mask for a given number of bits */ +/** \brief Create a bit mask for a given number of bits */ #define devCreateMask(NBITS) ((1<<(NBITS))-1) -/** @brief Normalize a raw integer value and convert it to type double */ +/** \brief Normalize a raw integer value and convert it to type double */ #define devDigToNml(DIGITAL,NBITS) \ (((double)(DIGITAL))/devCreateMask(NBITS)) -/** @brief Convert a normalized value to a raw integer */ +/** \brief Convert a normalized value to a raw integer */ #define devNmlToDig(NORMAL,NBITS) \ (((long)(NORMAL)) * devCreateMask(NBITS)) /** @} */ /** - * @name Macros for pointer alignment - * @warning Deprecated, we don't know of any code currently using these. + * \name Macros for pointer alignment + * \warning Deprecated, we don't know of any code currently using these. * @{ */ -/** @brief Create an alignment mask for CTYPE */ +/** \brief Create an alignment mask for CTYPE */ #define devCreateAlignmentMask(CTYPE)\ (sizeof(CTYPE)>sizeof(double)?sizeof(double)-1:sizeof(CTYPE)-1) -/** @brief Check Pointer alignment, returns true if the pointer @c PTR +/** \brief Check Pointer alignment, returns true if the pointer \c PTR * is suitably aligned for its data type */ #define devPtrAlignTest(PTR) (!(devCreateAlignmentMask(*PTR)&(long)(PTR))) /** @} */ /** - * @name Error status values returned by devLib routines + * \name Error status values returned by devLib routines * @{ */ #define S_dev_success 0 -/** @brief Interrupt vector in use */ +/** \brief Interrupt vector in use */ #define S_dev_vectorInUse (M_devLib| 1) /*Interrupt vector in use*/ -/** @brief Interrupt vector install failed */ +/** \brief Interrupt vector install failed */ #define S_dev_vecInstlFail (M_devLib| 2) /*Interrupt vector install failed*/ -/** @brief Unrecognized interrupt type */ +/** \brief Unrecognized interrupt type */ #define S_dev_uknIntType (M_devLib| 3) /*Unrecognized interrupt type*/ -/** @brief Interrupt vector not in use by caller */ +/** \brief Interrupt vector not in use by caller */ #define S_dev_vectorNotInUse (M_devLib| 4) /*Interrupt vector not in use by caller*/ -/** @brief Invalid VME A16 address */ +/** \brief Invalid VME A16 address */ #define S_dev_badA16 (M_devLib| 5) /*Invalid VME A16 address*/ -/** @brief Invalid VME A24 address */ +/** \brief Invalid VME A24 address */ #define S_dev_badA24 (M_devLib| 6) /*Invalid VME A24 address*/ -/** @brief Invalid VME A32 address */ +/** \brief Invalid VME A32 address */ #define S_dev_badA32 (M_devLib| 7) /*Invalid VME A32 address*/ -/** @brief Unrecognized address space type */ +/** \brief Unrecognized address space type */ #define S_dev_uknAddrType (M_devLib| 8) /*Unrecognized address space type*/ -/** @brief Specified device address overlaps another device */ +/** \brief Specified device address overlaps another device */ #define S_dev_addressOverlap (M_devLib| 9) /*Specified device address overlaps another device*/ -/** @brief This device already owns the address range */ +/** \brief This device already owns the address range */ #define S_dev_identifyOverlap (M_devLib| 10) /*This device already owns the address range*/ -/** @brief Unable to map address */ +/** \brief Unable to map address */ #define S_dev_addrMapFail (M_devLib| 11) /*Unable to map address*/ -/** @brief Interrupt at vector disconnected from an EPICS device */ +/** \brief Interrupt at vector disconnected from an EPICS device */ #define S_dev_intDisconnect (M_devLib| 12) /*Interrupt at vector disconnected from an EPICS device*/ -/** @brief Internal failure */ +/** \brief Internal failure */ #define S_dev_internal (M_devLib| 13) /*Internal failure*/ -/** @brief Unable to enable interrupt level */ +/** \brief Unable to enable interrupt level */ #define S_dev_intEnFail (M_devLib| 14) /*Unable to enable interrupt level*/ -/** @brief Unable to disable interrupt level */ +/** \brief Unable to disable interrupt level */ #define S_dev_intDissFail (M_devLib| 15) /*Unable to disable interrupt level*/ -/** @brief Memory allocation failed */ +/** \brief Memory allocation failed */ #define S_dev_noMemory (M_devLib| 16) /*Memory allocation failed*/ -/** @brief Specified device address unregistered */ +/** \brief Specified device address unregistered */ #define S_dev_addressNotFound (M_devLib| 17) /*Specified device address unregistered*/ -/** @brief No device at specified address */ +/** \brief No device at specified address */ #define S_dev_noDevice (M_devLib| 18) /*No device at specified address*/ -/** @brief Wrong device type found at specified address */ +/** \brief Wrong device type found at specified address */ #define S_dev_wrongDevice (M_devLib| 19) /*Wrong device type found at specified address*/ -/** @brief Signal number (offset) to large */ +/** \brief Signal number (offset) to large */ #define S_dev_badSignalNumber (M_devLib| 20) /*Signal number (offset) to large*/ -/** @brief Signal count to large */ +/** \brief Signal count to large */ #define S_dev_badSignalCount (M_devLib| 21) /*Signal count to large*/ -/** @brief Device does not support requested operation */ +/** \brief Device does not support requested operation */ #define S_dev_badRequest (M_devLib| 22) /*Device does not support requested operation*/ -/** @brief Parameter too high */ +/** \brief Parameter too high */ #define S_dev_highValue (M_devLib| 23) /*Parameter too high*/ -/** @brief Parameter too low */ +/** \brief Parameter too low */ #define S_dev_lowValue (M_devLib| 24) /*Parameter too low*/ -/** @brief Specified address is ambiguous (more than one device responds) */ +/** \brief Specified address is ambiguous (more than one device responds) */ #define S_dev_multDevice (M_devLib| 25) /*Specified address is ambiguous (more than one device responds)*/ -/** @brief Device self test failed */ +/** \brief Device self test failed */ #define S_dev_badSelfTest (M_devLib| 26) /*Device self test failed*/ -/** @brief Device failed during initialization */ +/** \brief Device failed during initialization */ #define S_dev_badInit (M_devLib| 27) /*Device failed during initialization*/ -/** @brief Input exceeds Hardware Limit */ +/** \brief Input exceeds Hardware Limit */ #define S_dev_hdwLimit (M_devLib| 28) /*Input exceeds Hardware Limit*/ -/** @brief Unable to locate address space for device */ +/** \brief Unable to locate address space for device */ #define S_dev_deviceDoesNotFit (M_devLib| 29) /*Unable to locate address space for device*/ -/** @brief Device timed out */ +/** \brief Device timed out */ #define S_dev_deviceTMO (M_devLib| 30) /*Device timed out*/ -/** @brief Bad function pointer */ +/** \brief Bad function pointer */ #define S_dev_badFunction (M_devLib| 31) /*Bad function pointer*/ -/** @brief Bad interrupt vector */ +/** \brief Bad interrupt vector */ #define S_dev_badVector (M_devLib| 32) /*Bad interrupt vector*/ -/** @brief Bad function argument */ +/** \brief Bad function argument */ #define S_dev_badArgument (M_devLib| 33) /*Bad function argument*/ -/** @brief Invalid ISA address */ +/** \brief Invalid ISA address */ #define S_dev_badISA (M_devLib| 34) /*Invalid ISA address*/ -/** @brief Invalid VME CR/CSR address */ +/** \brief Invalid VME CR/CSR address */ #define S_dev_badCRCSR (M_devLib| 35) /*Invalid VME CR/CSR address*/ -/** @brief Synonym for S_dev_intEnFail */ +/** \brief Synonym for S_dev_intEnFail */ #define S_dev_vxWorksIntEnFail S_dev_intEnFail /** @} */ diff --git a/modules/libcom/src/osi/devLibVME.h b/modules/libcom/src/osi/devLibVME.h index 45db8f473..fbf8b399a 100644 --- a/modules/libcom/src/osi/devLibVME.h +++ b/modules/libcom/src/osi/devLibVME.h @@ -8,9 +8,9 @@ \*************************************************************************/ /** - * @file devLibVME.h - * @author Marty Kraimer, Jeff Hill - * @brief API for accessing hardware devices, mosty over VMEbus. + * \file devLibVME.h + * \author Marty Kraimer, Jeff Hill + * \brief API for accessing hardware devices, mosty over VMEbus. * * API for accessing hardware devices. The original APIs here were for * written for use with VMEbus but additional routines were added for @@ -36,17 +36,17 @@ extern "C" { #endif -/** @brief The available bus address types */ +/** \brief The available bus address types */ typedef enum { - atVMEA16, /**< @brief VME short I/O. */ - atVMEA24, /**< @brief VME standard I/O. */ - atVMEA32, /**< @brief VME extended I/O. */ - atISA, /**< @brief Memory mapped ISA access. */ - atVMECSR, /**< @brief VME-64 CR/CSR address space. */ - atLast /**< @brief Invalid, must be the last entry. */ + atVMEA16, /**< \brief VME short I/O. */ + atVMEA24, /**< \brief VME standard I/O. */ + atVMEA32, /**< \brief VME extended I/O. */ + atISA, /**< \brief Memory mapped ISA access. */ + atVMECSR, /**< \brief VME-64 CR/CSR address space. */ + atLast /**< \brief Invalid, must be the last entry. */ } epicsAddressType; -/** @brief A string representation of each of the bus address types */ +/** \brief A string representation of each of the bus address types */ epicsShareExtern const char *epicsAddressTypeName[]; #ifdef __cplusplus @@ -64,54 +64,54 @@ epicsShareExtern const char *epicsAddressTypeName[]; extern "C" { #endif -/** @brief Print a map of registered bus addresses. +/** \brief Print a map of registered bus addresses. * * Display a table of registsred bus address ranges, including the owner of * each registered address. - * @return 0, or an error status value + * \return 0, or an error status value */ epicsShareFunc long devAddressMap(void); -/** @brief Translate a bus address to a pointer the CPU can use. +/** \brief Translate a bus address to a pointer the CPU can use. * * Given a bus address, returns a pointer to that location in the CPU's * memory map, or an error if direct access isn't currently possible. - * @param addrType The bus address type. - * @param busAddr Bus address to be translated. - * @param *ppLocalAddr Where to put the CPU pointer. - * @return 0, or an error status value. + * \param addrType The bus address type. + * \param busAddr Bus address to be translated. + * \param *ppLocalAddr Where to put the CPU pointer. + * \return 0, or an error status value. */ epicsShareFunc long devBusToLocalAddr ( epicsAddressType addrType, size_t busAddr, volatile void **ppLocalAddr); -/** @brief Probe the bus for reading from a specific address. +/** \brief Probe the bus for reading from a specific address. * - * Performs a bus-error-safe @c wordSize atomic read from a specific + * Performs a bus-error-safe \c wordSize atomic read from a specific * address and returns an error if this caused a bus error. - * @param wordSize The word size to read: 1, 2, 4 or 8 bytes. - * @param ptr Pointer to the location in the CPU's memory map to read. - * @param pValueRead Where to put the value read. - * @return 0, or an error status value if the location could not be + * \param wordSize The word size to read: 1, 2, 4 or 8 bytes. + * \param ptr Pointer to the location in the CPU's memory map to read. + * \param pValueRead Where to put the value read. + * \return 0, or an error status value if the location could not be * accessed or the read caused a bus error. */ epicsShareFunc long devReadProbe ( unsigned wordSize, volatile const void *ptr, void *pValueRead); -/** @brief Read-probe a range of bus addresses, looking for empty space. +/** \brief Read-probe a range of bus addresses, looking for empty space. * * Verifies that no device responds at any naturally aligned addresses * within the given range. Tries to read every aligned address at every * word size between char and long over the entire range, returning * success only if none of the reads succeed. - * @warning This routine may be slow and have a very bad effect on a busy + * \warning This routine may be slow and have a very bad effect on a busy * VMEbus. Every read probe of an unused address will hold onto the VMEbus * for the global bus timeout period. - * @param addrType The bus address type. - * @param base First address base to probe. - * @param size Range of bus addresses to test, in bytes. - * @return 0 if no devices respond, or an error status value. + * \param addrType The bus address type. + * \param base First address base to probe. + * \param size Range of bus addresses to test, in bytes. + * \return 0 if no devices respond, or an error status value. */ epicsShareFunc long devNoResponseProbe( epicsAddressType addrType, @@ -119,32 +119,32 @@ epicsShareFunc long devNoResponseProbe( size_t size ); -/** @brief Probe the bus for writing to a specific address. +/** \brief Probe the bus for writing to a specific address. * - * Performs a bus-error-safe @c wordSize atomic write to a specific + * Performs a bus-error-safe \c wordSize atomic write to a specific * address and returns an error if this caused a bus error. - * @param wordSize The word size to write: 1, 2, 4 or 8 bytes. - * @param ptr Pointer to the location in the CPU's memory map to write to. - * @param pValueWritten The value to write. - * @return 0, or an error status value if the location could not be + * \param wordSize The word size to write: 1, 2, 4 or 8 bytes. + * \param ptr Pointer to the location in the CPU's memory map to write to. + * \param pValueWritten The value to write. + * \return 0, or an error status value if the location could not be * accessed or the write caused a bus error. */ epicsShareFunc long devWriteProbe ( unsigned wordSize, volatile void *ptr, const void *pValueWritten); -/** @brief Register a bus address range with a name. +/** \brief Register a bus address range with a name. * * The devLib code keeps a list of all bus address ranges registered with * this routine and returns an error if a later call attempts to register * any addresses that overlap with a range already registered. The call to * registering a range also converts the given base address into a pointer * in the CPU address space for the driver to use (see devBusToLocalAddr()). - * @param pOwnerName Name of a driver that will own this range. - * @param addrType The bus address type. - * @param logicalBaseAddress The bus start address. - * @param size Number of bytes to reserve. - * @param pPhysicalAddress Where to put the converted CPU pointer. - * @return 0, or an error status. + * \param pOwnerName Name of a driver that will own this range. + * \param addrType The bus address type. + * \param logicalBaseAddress The bus start address. + * \param size Number of bytes to reserve. + * \param pPhysicalAddress Where to put the converted CPU pointer. + * \return 0, or an error status. */ epicsShareFunc long devRegisterAddress( const char *pOwnerName, @@ -153,21 +153,21 @@ epicsShareFunc long devRegisterAddress( size_t size, volatile void **pPhysicalAddress); -/** @brief Release a bus address range previously registered. +/** \brief Release a bus address range previously registered. * * Release an address range that was previously registered by a call to * devRegisterAddress() or devAllocAddress(). - * @param addrType The bus address type. - * @param logicalBaseAddress The bus start address. - * @param pOwnerName The name of the driver that owns this range. - * @return 0, or an error status. + * \param addrType The bus address type. + * \param logicalBaseAddress The bus start address. + * \param pOwnerName The name of the driver that owns this range. + * \return 0, or an error status. */ epicsShareFunc long devUnregisterAddress( epicsAddressType addrType, size_t logicalBaseAddress, const char *pOwnerName); -/** @brief Allocate and register an unoccupied address block. +/** \brief Allocate and register an unoccupied address block. * * Asks devLib to allocate an address block of a particular address type. * This is useful for devices that appear in more than one address space @@ -175,15 +175,15 @@ epicsShareFunc long devUnregisterAddress( * in another window. As with devRegisterAddress() this call also converts * the new base address into a pointer in the CPU address space for the * driver to use (see devBusToLocalAddr()). - * @note This routine calls devNoResponseProbe() to find an unoccupied + * \note This routine calls devNoResponseProbe() to find an unoccupied * block in the bus address space, so using it may have a bad effect on a * busy VMEbus at allocation time; see the warning above. - * @param pOwnerName Name of a driver that will own this range. - * @param addrType The bus address type. - * @param size Number of bytes to be allocated. - * @param alignment How many low bits in the address must all be zero. - * @param pLocalAddress Where to put the CPU pointer. - * @return 0, or an error status value. + * \param pOwnerName Name of a driver that will own this range. + * \param addrType The bus address type. + * \param size Number of bytes to be allocated. + * \param alignment How many low bits in the address must all be zero. + * \param pLocalAddress Where to put the CPU pointer. + * \return 0, or an error status value. */ epicsShareFunc long devAllocAddress( const char *pOwnerName, @@ -192,11 +192,11 @@ epicsShareFunc long devAllocAddress( unsigned alignment, /*n ls bits zero in addr*/ volatile void **pLocalAddress); -/** @name VME Interrupt Management +/** \name VME Interrupt Management * Routines to manage VME interrupts. * @{ */ -/** @brief Connect an ISR up to a VME interrupt vector. +/** \brief Connect an ISR up to a VME interrupt vector. * * Interrupt Service Routines (ISRs) are normally written in C, and get * passed a context parameter given with them to this connection routine. @@ -206,105 +206,105 @@ epicsShareFunc long devAllocAddress( * epicsRingPointer.h and epicsTime.h for some APIs known to be suitable. * It is safest just to trigger a high-priority task to handle any * complex work that must happen as a result of the interrupt. - * @param vectorNumber VME interrupt vector number. - * @param pFunction The ISR to be called. - * @param parameter Context parameter for the ISR. - * @return 0, or an error status value. + * \param vectorNumber VME interrupt vector number. + * \param pFunction The ISR to be called. + * \param parameter Context parameter for the ISR. + * \return 0, or an error status value. */ epicsShareFunc long devConnectInterruptVME( unsigned vectorNumber, void (*pFunction)(void *), void *parameter); -/** @brief Disconnect an ISR from its VME interrupt vector. +/** \brief Disconnect an ISR from its VME interrupt vector. * * Device drivers may disconnect an ISR they connected earlier using this - * routine. In addition to taking the @c vectorNumber the ISR itself is + * routine. In addition to taking the \c vectorNumber the ISR itself is * required and used as a check to prevent a driver from inadvertently * removing an interrupt handler that it didn't install. * * On a PowerPC target running VxWorks, this routine will always return * with an error status. - * @param vectorNumber VME interrupt vector number. - * @param pFunction The ISR to be disconnected. - * @return 0, or an error status value. + * \param vectorNumber VME interrupt vector number. + * \param pFunction The ISR to be disconnected. + * \return 0, or an error status value. */ epicsShareFunc long devDisconnectInterruptVME( unsigned vectorNumber, void (*pFunction)(void *)); -/** @brief Determine if a VME interrupt vector is in use. +/** \brief Determine if a VME interrupt vector is in use. * * On a PowerPC target running VxWorks this routine will always return * false, indicating that a vector is unused. - * @param vectorNumber Interrupt vector number. - * @return True if vector has an ISR attached, otherwise false. + * \param vectorNumber Interrupt vector number. + * \return True if vector has an ISR attached, otherwise false. */ epicsShareFunc int devInterruptInUseVME (unsigned vectorNumber); -/** @brief Enable a VME interrupt level onto the CPU. +/** \brief Enable a VME interrupt level onto the CPU. * * The VMEbus allows multiple CPU boards to be installed in the same * backplane. When this is done, the differente VME interrupt levels * must be assigned to the CPUs since they cannot be shared. This * routine tells the VME interface that it should connect interrupts * from the indicated interrupt level to a CPU interrupt line. - * @param level VMEbus interrupt level to enable, 1-7. - * @return 0, or an error status value. + * \param level VMEbus interrupt level to enable, 1-7. + * \return 0, or an error status value. */ epicsShareFunc long devEnableInterruptLevelVME (unsigned level); -/** @brief Disable a VME interrupt level. +/** \brief Disable a VME interrupt level. * * This routine is the reverse of devEnableInterruptLevelVME(). - * @note This routine should not normally be used, even by a + * \note This routine should not normally be used, even by a * driver that enabled the interrupt level. Disabling a VME * interrupt level should only be done by software that knows * for certain that no other interrupting device is also using * that VME interrupt level. - * @param level VMEbus interrupt level to disable, 1-7. - * @return 0, or an error status value. + * \param level VMEbus interrupt level to disable, 1-7. + * \return 0, or an error status value. */ epicsShareFunc long devDisableInterruptLevelVME (unsigned level); /** @} */ -/** @name Memory for VME DMA Operations +/** \name Memory for VME DMA Operations * These routines manage memory that can be directly accessed * from the VMEbus in the A24 address space by another bus master * such as a DMA controller. * @{ */ -/** @brief malloc() for VME drivers that support DMA. +/** \brief malloc() for VME drivers that support DMA. * * Allocate memory of a given size from a region that can be * accessed from the VMEbus in the A24 address space. - * @param size How many bytes to allocate - * @return A pointer to the memory allocated, or NULL. + * \param size How many bytes to allocate + * \return A pointer to the memory allocated, or NULL. */ epicsShareFunc void *devLibA24Malloc(size_t size); -/** @brief calloc() for VME drivers that support DMA. +/** \brief calloc() for VME drivers that support DMA. * * Allocate and zero-fill a block of memory of a given size from * a region that can be accessed from the VMEbus in the A24 * address space. - * @param size How many bytes to allocate and zero. - * @return A pointer to the memory allocated, or NULL. + * \param size How many bytes to allocate and zero. + * \return A pointer to the memory allocated, or NULL. */ epicsShareFunc void *devLibA24Calloc(size_t size); -/** @brief free() for VME drivers that support DMA. +/** \brief free() for VME drivers that support DMA. * * Free a block of memory that was allocated using either * devLibA24Malloc() or devLibA24Calloc(). - * @param pBlock Block to be released. + * \param pBlock Block to be released. */ epicsShareFunc void devLibA24Free(void *pBlock); /** @} */ -/** @name ISA Interrupt Management +/** \name ISA Interrupt Management * Routines to manage ISAbus interrupts. - * @note These routines may not have been used for a very long time; + * \note These routines may not have been used for a very long time; * some appear to have never been implemented at all. They may vanish * with no notice from future versions of EPICS Base. Nobody is using * the PC's ISA-bus any more are they? @@ -313,11 +313,11 @@ epicsShareFunc void devLibA24Free(void *pBlock); /** * Connect ISR to a ISA interrupt. - * @warning Not implemented! - * @param interruptLevel Bus interrupt level to connect to. - * @param pFunction C function pointer to connect to. - * @param parameter Parameter to the called function. - * @return Returns success or error. + * \warning Not implemented! + * \param interruptLevel Bus interrupt level to connect to. + * \param pFunction C function pointer to connect to. + * \param parameter Parameter to the called function. + * \return Returns success or error. */ epicsShareFunc long devConnectInterruptISA( unsigned interruptLevel, @@ -326,10 +326,10 @@ epicsShareFunc long devConnectInterruptISA( /** * Disconnect ISR from a ISA interrupt level. - * @warning Not implemented! - * @param interruptLevel Interrupt level. - * @param pFunction C function pointer that was connected. - * @return returns success or error. + * \warning Not implemented! + * \param interruptLevel Interrupt level. + * \param pFunction C function pointer that was connected. + * \return returns success or error. */ epicsShareFunc long devDisconnectInterruptISA( unsigned interruptLevel, @@ -337,23 +337,23 @@ epicsShareFunc long devDisconnectInterruptISA( /** * Determine if an ISA interrupt level is in use - * @warning Not implemented! - * @param interruptLevel Interrupt level. - * @return Returns True/False. + * \warning Not implemented! + * \param interruptLevel Interrupt level. + * \return Returns True/False. */ epicsShareFunc int devInterruptLevelInUseISA (unsigned interruptLevel); /** * Enable ISA interrupt level - * @param level Interrupt level. - * @return Returns True/False. + * \param level Interrupt level. + * \return Returns True/False. */ epicsShareFunc long devEnableInterruptLevelISA (unsigned level); /** * Disable ISA interrupt level - * @param level Interrupt level. - * @return Returns True/False. + * \param level Interrupt level. + * \return Returns True/False. */ epicsShareFunc long devDisableInterruptLevelISA (unsigned level); /** @} */ @@ -361,13 +361,13 @@ epicsShareFunc long devDisableInterruptLevelISA (unsigned level); #ifndef NO_DEVLIB_OLD_INTERFACE /** - * @name Deprecated Interfaces + * \name Deprecated Interfaces * @{ */ typedef enum {intVME, intVXI, intISA} epicsInterruptType; /** - * @note This routine has been deprecated. It exists + * \note This routine has been deprecated. It exists * for backwards compatibility purposes only. * Please use one of devConnectInterruptVME(), devConnectInterruptPCI(), * devConnectInterruptISA() instead. devConnectInterrupt() will be removed @@ -380,7 +380,7 @@ epicsShareFunc long devConnectInterrupt( void *parameter); /** - * @note This routine has been deprecated. It exists + * \note This routine has been deprecated. It exists * for backwards compatibility purposes only. * Please use one of devDisconnectInterruptVME(), devDisconnectInterruptPCI(), * devDisconnectInterruptISA() instead. devDisconnectInterrupt() will @@ -392,7 +392,7 @@ epicsShareFunc long devDisconnectInterrupt( void (*pFunction)(void *)); /** - * @note This routine has been deprecated. It exists + * \note This routine has been deprecated. It exists * for backwards compatibility purposes only. * Please use one of devEnableInterruptLevelVME(), devEnableInterruptLevelPCI(), * devEnableInterruptLevelISA() instead. devEnableInterruptLevel() will @@ -402,7 +402,7 @@ epicsShareFunc long devEnableInterruptLevel( epicsInterruptType intType, unsigned level); /** - * @note This routine has been deprecated. It exists + * \note This routine has been deprecated. It exists * for backwards compatibility purposes only. * Please use one of devDisableInterruptLevelVME(), devDisableInterruptLevelISA(), * devDisableInterruptLevelPCI() instead. devDisableInterruptLevel() will @@ -412,7 +412,7 @@ epicsShareFunc long devDisableInterruptLevel ( epicsInterruptType intType, unsigned level); /** - * @note This routine has been deprecated. It exists + * \note This routine has been deprecated. It exists * for backwards compatibility purposes only. * Please use devNoResponseProbe() instead. locationProbe() will be removed * in a future release. diff --git a/modules/libcom/src/osi/devLibVMEImpl.h b/modules/libcom/src/osi/devLibVMEImpl.h index e3fd826f4..c9fea8d00 100644 --- a/modules/libcom/src/osi/devLibVMEImpl.h +++ b/modules/libcom/src/osi/devLibVMEImpl.h @@ -10,9 +10,9 @@ \*************************************************************************/ /** - * @file devLibVMEImpl.h - * @author Marty Kraimer, Jeff Hill - * @brief An interface from devLibVME.c to its OS-specific implementations. + * \file devLibVMEImpl.h + * \author Marty Kraimer, Jeff Hill + * \brief An interface from devLibVME.c to its OS-specific implementations. */ #ifndef INCdevLibImplh @@ -27,7 +27,7 @@ extern "C" { #endif /** - * @brief A table of function pointers for devLibVME implementations + * \brief A table of function pointers for devLibVME implementations * * The global virtual OS table \ref pdevLibVME controls * the behaviour of the functions defined in devLib.h. @@ -35,48 +35,48 @@ extern "C" { * to perform system specific tasks. */ typedef struct devLibVME { - /** @brief Map a bus address to the CPU's address space. */ + /** \brief Map a bus address to the CPU's address space. */ long (*pDevMapAddr) (epicsAddressType addrType, unsigned options, size_t logicalAddress, size_t size, volatile void **ppPhysicalAddress); - /** @brief Read a word, detect and protect against bus errors. */ + /** \brief Read a word, detect and protect against bus errors. */ long (*pDevReadProbe) (unsigned wordSize, volatile const void *ptr, void *pValueRead); - /** @brief Write a word, detect and protect against bus errors. */ + /** \brief Write a word, detect and protect against bus errors. */ long (*pDevWriteProbe) (unsigned wordSize, volatile void *ptr, const void *pValueWritten); - /** @brief Connect ISR to a VME interrupt vector. */ + /** \brief Connect ISR to a VME interrupt vector. */ long (*pDevConnectInterruptVME) (unsigned vectorNumber, void (*pFunction)(void *), void *parameter); - /** @brief Disconnect ISR from a VME interrupt vector. */ + /** \brief Disconnect ISR from a VME interrupt vector. */ long (*pDevDisconnectInterruptVME) (unsigned vectorNumber, void (*pFunction)(void *)); - /** @brief Enable VME interrupt level to CPU. */ + /** \brief Enable VME interrupt level to CPU. */ long (*pDevEnableInterruptLevelVME) (unsigned level); - /** @brief Disable VME interrupt level to CPU. */ + /** \brief Disable VME interrupt level to CPU. */ long (*pDevDisableInterruptLevelVME) (unsigned level); - /** @brief Malloc a block accessible from the VME A24 address space. */ + /** \brief Malloc a block accessible from the VME A24 address space. */ void *(*pDevA24Malloc)(size_t nbytes); - /** @brief Free a block allocated for the VME A24 address space. */ + /** \brief Free a block allocated for the VME A24 address space. */ void (*pDevA24Free)(void *pBlock); - /** @brief Init devLib */ + /** \brief Init devLib */ long (*pDevInit)(void); - /** @brief Check if interrupt vector has an ISR connected. */ + /** \brief Check if interrupt vector has an ISR connected. */ int (*pDevInterruptInUseVME)(unsigned vectorNumber); }devLibVME; -/** @brief Pointer to the entry table used by devLibVME routines. */ +/** \brief Pointer to the entry table used by devLibVME routines. */ epicsShareExtern devLibVME *pdevLibVME; #ifndef NO_DEVLIB_COMPAT -/** @brief An alias for pdevLibVME */ +/** \brief An alias for pdevLibVME */ # define pdevLibVirtualOS pdevLibVME -/** @brief A type definition for devLibVME */ +/** \brief A type definition for devLibVME */ typedef devLibVME devLibVirtualOS; #endif diff --git a/modules/libcom/src/osi/epicsAssert.h b/modules/libcom/src/osi/epicsAssert.h index df6d4593e..8df8a2e86 100644 --- a/modules/libcom/src/osi/epicsAssert.h +++ b/modules/libcom/src/osi/epicsAssert.h @@ -7,20 +7,20 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/**@file epicsAssert.h - * @author Jeffery O. Hill +/**\file epicsAssert.h + * \author Jeffery O. Hill * - * @brief An EPICS-specific replacement for ANSI C's assert. + * \brief An EPICS-specific replacement for ANSI C's assert. * * To use this version just include: - @code + \code #define epicsAssertAuthor "Code Author my@email.address" #include - @endcode + \endcode * instead of - @code + \code #include - @endcode + \endcode * * If an assert() fails, it calls errlog indicating the program's author, file name, and * line number. Under each OS there are specialized instructions assisting the user to @@ -34,7 +34,7 @@ * This header also provides a compile-time assertion macro STATIC_ASSERT() * which can be used to check a constant-expression at compile-time. The C or * C++ compiler will flag an error if the expresstion evaluates to 0. The - * STATIC_ASSERT() macro can only be used where a @c typedef is syntactically + * STATIC_ASSERT() macro can only be used where a \c typedef is syntactically * legal. **/ @@ -50,7 +50,7 @@ extern "C" { #ifndef epicsAssertAuthor -/**@brief Optional string giving the author's name */ +/**\brief Optional string giving the author's name */ # define epicsAssertAuthor 0 #endif @@ -64,8 +64,8 @@ extern "C" { epicsShareFunc void epicsAssert (const char *pFile, const unsigned line, const char *pExp, const char *pAuthorName); -/**@brief Declare that a condition should be true. - * @param exp Expression that should evaluate to True. +/**\brief Declare that a condition should be true. + * \param exp Expression that should evaluate to True. */ # define assert(exp) ((exp) ? (void)0 : \ epicsAssert(__FILE__, __LINE__, #exp, epicsAssertAuthor)) @@ -80,8 +80,8 @@ epicsShareFunc void epicsAssert (const char *pFile, const unsigned line, #define STATIC_JOIN(x, y) STATIC_JOIN2(x, y) #define STATIC_JOIN2(x, y) x ## y -/**@brief Declare a condition that should be true at compile-time. - * @param expr A C/C++ const-expression that should evaluate to True. +/**\brief Declare a condition that should be true at compile-time. + * \param expr A C/C++ const-expression that should evaluate to True. */ #define STATIC_ASSERT(expr) \ typedef int STATIC_JOIN(static_assert_failed_at_line_, __LINE__) \ diff --git a/modules/libcom/src/osi/epicsEvent.h b/modules/libcom/src/osi/epicsEvent.h index 50a7ee22a..c97cb4d8a 100644 --- a/modules/libcom/src/osi/epicsEvent.h +++ b/modules/libcom/src/osi/epicsEvent.h @@ -7,9 +7,9 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/**@file epicsEvent.h +/**\file epicsEvent.h * - * @brief APIs for the epicsEvent binary semaphore. + * \brief APIs for the epicsEvent binary semaphore. * * Defines the C++ and C API's for a simple binary semaphore. If multiple threads are * waiting on the same event, only one of them will be woken when the event is signalled. @@ -19,22 +19,22 @@ * For example: * * When creating the consumer thread also create an epicsEvent. - @code + \code epicsEvent *pevent = new epicsEvent; - @endcode + \endcode * The consumer thread has code containing: - @code + \code while(1) { pevent->wait(); while( {more work} ) { {process work} } } - @endcode + \endcode * Producers create requests and issue the statement: - @code + \code pevent->trigger(); - @endcode + \endcode **/ #ifndef epicsEventh @@ -42,24 +42,24 @@ #include "shareLib.h" -/** @brief An identifier for an epicsEvent for use with the C API */ +/** \brief An identifier for an epicsEvent for use with the C API */ typedef struct epicsEventOSD *epicsEventId; -/** @brief Return status from several C API routines. */ +/** \brief Return status from several C API routines. */ typedef enum { epicsEventOK = 0, epicsEventWaitTimeout, epicsEventError } epicsEventStatus; -/** @brief Old name provided for backwards compatibility */ +/** \brief Old name provided for backwards compatibility */ #define epicsEventWaitStatus epicsEventStatus -/** @brief Old name provided for backwards compatibility */ +/** \brief Old name provided for backwards compatibility */ #define epicsEventWaitOK epicsEventOK -/** @brief Old name provided for backwards compatibility */ +/** \brief Old name provided for backwards compatibility */ #define epicsEventWaitError epicsEventError -/** @brief Possible initial states of a new epicsEvent */ +/** \brief Possible initial states of a new epicsEvent */ typedef enum { epicsEventEmpty, epicsEventFull @@ -67,7 +67,7 @@ typedef enum { #ifdef __cplusplus -/**@brief A binary semaphore. +/**\brief A binary semaphore. * * An epicsEvent is a binary semaphore that can be empty or full. * When empty, a wait() issued before the next call to trigger() will block. @@ -77,39 +77,39 @@ typedef enum { **/ class epicsShareClass epicsEvent { public: - /**@brief Constructor. - * @param initial State when created, empty (the default) or full. + /**\brief Constructor. + * \param initial State when created, empty (the default) or full. **/ epicsEvent ( epicsEventInitialState initial = epicsEventEmpty ); - /**@brief Destroy the epicsEvent and any resources it holds. No calls to + /**\brief Destroy the epicsEvent and any resources it holds. No calls to * wait() can be active when this call is made. **/ ~epicsEvent (); - /**@brief Trigger the event i.e. ensures the next or current call to wait + /**\brief Trigger the event i.e. ensures the next or current call to wait * completes. This method may be called from a vxWorks or RTEMS interrupt * handler. **/ void trigger (); - /**@brief Signal is a synonym for trigger(). + /**\brief Signal is a synonym for trigger(). **/ void signal () { this->trigger(); } - /**@brief Wait for the event. - * @note Blocks until full. + /**\brief Wait for the event. + * \note Blocks until full. **/ void wait (); - /**@brief Wait for the event or until the specified timeout. - * @param timeOut The timeout delay in seconds. - * @return True if the event was triggered, False if it timed out. + /**\brief Wait for the event or until the specified timeout. + * \param timeOut The timeout delay in seconds. + * \return True if the event was triggered, False if it timed out. **/ bool wait ( double timeOut ); - /**@brief Similar to wait() except that if the event is currenly empty the + /**\brief Similar to wait() except that if the event is currenly empty the * call will return immediately. - * @return True if the event was full (triggered), False if empty. + * \return True if the event was full (triggered), False if empty. **/ bool tryWait (); - /**@brief Display information about the semaphore. - * @note The information displayed is architecture dependant. - * @param level An unsigned int for the level of information to be displayed. + /**\brief Display information about the semaphore. + * \note The information displayed is architecture dependant. + * \param level An unsigned int for the level of information to be displayed. **/ void show ( unsigned level ) const; @@ -123,90 +123,90 @@ private: extern "C" { #endif /*__cplusplus */ -/**@brief Create an epicsEvent for use from C code, or return NULL. +/**\brief Create an epicsEvent for use from C code, or return NULL. * - * @param initialState Starting state, @c epicsEventEmpty or @c epicsEventFull. - * @return An identifier for the new event, or NULL if one not be created. + * \param initialState Starting state, \c epicsEventEmpty or \c epicsEventFull. + * \return An identifier for the new event, or NULL if one not be created. **/ epicsShareFunc epicsEventId epicsEventCreate( epicsEventInitialState initialState); -/**@brief Create an epicsEvent for use from C code. +/**\brief Create an epicsEvent for use from C code. * * This routine does not return if the object could not be created. - * @param initialState Starting state, @c epicsEventEmpty or @c epicsEventFull. - * @return An identifier for the new event. + * \param initialState Starting state, \c epicsEventEmpty or \c epicsEventFull. + * \return An identifier for the new event. **/ epicsShareFunc epicsEventId epicsEventMustCreate ( epicsEventInitialState initialState); -/**@brief Destroy an epicsEvent and any resources it holds. +/**\brief Destroy an epicsEvent and any resources it holds. * * No calls to any epicsEventWait routines can be active when this call is made. - * @param id The event identifier. + * \param id The event identifier. **/ epicsShareFunc void epicsEventDestroy(epicsEventId id); -/**@brief Trigger an event i.e. ensures the next or current call to wait +/**\brief Trigger an event i.e. ensures the next or current call to wait * completes. * - * @note This method may be called from a VxWorks or RTEMS interrupt + * \note This method may be called from a VxWorks or RTEMS interrupt * handler. - * @param id The event identifier. - * @return Status indicator. + * \param id The event identifier. + * \return Status indicator. **/ epicsShareFunc epicsEventStatus epicsEventTrigger( epicsEventId id); -/**@brief Trigger an event. +/**\brief Trigger an event. * * This routine does not return if the identifier is invalid. - * @param id The event identifier. + * \param id The event identifier. */ epicsShareFunc void epicsEventMustTrigger(epicsEventId id); -/**@brief A synonym for epicsEventTrigger(). - * @param ID The event identifier. - * @return Status indicator. +/**\brief A synonym for epicsEventTrigger(). + * \param ID The event identifier. + * \return Status indicator. **/ #define epicsEventSignal(ID) epicsEventMustTrigger(ID) -/**@brief Wait for an event. - * @note Blocks until full. - * @param id The event identifier. - * @return Status indicator. +/**\brief Wait for an event. + * \note Blocks until full. + * \param id The event identifier. + * \return Status indicator. **/ epicsShareFunc epicsEventStatus epicsEventWait( epicsEventId id); -/**@brief Wait for an event (see epicsEventWait()). +/**\brief Wait for an event (see epicsEventWait()). * * This routine does not return if the identifier is invalid. - * @param id The event identifier. + * \param id The event identifier. */ epicsShareFunc void epicsEventMustWait(epicsEventId id); -/**@brief Wait an the event or until the specified timeout period is over. - * @note Blocks until full or timeout. - * @param id The event identifier. - * @param timeOut The timeout delay in seconds. - * @return Status indicator. +/**\brief Wait an the event or until the specified timeout period is over. + * \note Blocks until full or timeout. + * \param id The event identifier. + * \param timeOut The timeout delay in seconds. + * \return Status indicator. **/ epicsShareFunc epicsEventStatus epicsEventWaitWithTimeout( epicsEventId id, double timeOut); -/**@brief Similar to wait() except that if the event is currenly empty the - * call will return immediately with status @c epicsEventWaitTimeout. - * @param id The event identifier. - * @return Status indicator, @c epicsEventWaitTimeout when the event is empty. +/**\brief Similar to wait() except that if the event is currenly empty the + * call will return immediately with status \c epicsEventWaitTimeout. + * \param id The event identifier. + * \return Status indicator, \c epicsEventWaitTimeout when the event is empty. **/ epicsShareFunc epicsEventStatus epicsEventTryWait( epicsEventId id); -/**@brief Display information about the semaphore. - * @note The information displayed is architecture dependant. - * @param id The event identifier. - * @param level An unsigned int for the level of information to be displayed. +/**\brief Display information about the semaphore. + * \note The information displayed is architecture dependant. + * \param id The event identifier. + * \param level An unsigned int for the level of information to be displayed. **/ epicsShareFunc void epicsEventShow( epicsEventId id, unsigned int level); diff --git a/modules/libcom/src/osi/epicsGeneralTime.h b/modules/libcom/src/osi/epicsGeneralTime.h index 73304cfbc..8f494b376 100644 --- a/modules/libcom/src/osi/epicsGeneralTime.h +++ b/modules/libcom/src/osi/epicsGeneralTime.h @@ -7,9 +7,9 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/**@file epicsGeneralTime.h +/**\file epicsGeneralTime.h * - * @brief The generalTime framework provides a mechanism for several time providers to be + * \brief The generalTime framework provides a mechanism for several time providers to be * present within the system. * * There are two types of time provider, one type provides the current wall-clock @@ -28,7 +28,7 @@ * cannot check the priority queue, so will only succeed if the last-used provider has * registered a suitable routine. * - * @note There are two interfaces to this framework, epicsGeneralTime.h for consumers + * \note There are two interfaces to this framework, epicsGeneralTime.h for consumers * to obtain a time and query the framework, and generalTimeSup.h for providers * that can supply timestamps. **/ @@ -42,108 +42,108 @@ extern "C" { #endif -/**@def NUM_TIME_EVENTS - * @brief The number of time events that are validated. +/**\def NUM_TIME_EVENTS + * \brief The number of time events that are validated. * * Time Events numbered 0 through (NUM_TIME_EVENTS-1) are validated by code in * epicsGeneralTime.c that tests for advancing timestamps and enforces that * restriction. * - * @note Event numbers greater than or equal to NUM_TIME_EVENTS are now allowed + * \note Event numbers greater than or equal to NUM_TIME_EVENTS are now allowed * if supported by a custom time provider which should provide its own advancing * timestamp validation. **/ #define NUM_TIME_EVENTS 256 -/**@brief Initialise the framework. +/**\brief Initialise the framework. * * This routine is called automatically by any function that requires the * framework. It does not need to be called explicitly. **/ epicsShareFunc void generalTime_Init(void); -/**@brief Install a Time Event time provider that returns the current time for any +/**\brief Install a Time Event time provider that returns the current time for any * Time event number. * - * @note This is optional as it is site policy whether the last resort for a Time + * \note This is optional as it is site policy whether the last resort for a Time * Event time in the absence of any working provider should be a failure, or the * current time. **/ epicsShareFunc int installLastResortEventProvider(void); -/**@brief Reset the internal counter of the number of times the time returned was +/**\brief Reset the internal counter of the number of times the time returned was * earlier than when previously requested. * * Used by device support for binary out record * with: - @code + \code DTYP = "General Time" OUT = "@RSTERRCNT" - @endcode + \endcode **/ epicsShareFunc void generalTimeResetErrorCounts(void); -/**@brief Return the internal counter of the number of times the time returned was +/**\brief Return the internal counter of the number of times the time returned was * earlier than when previously requested. * * Used by device support for longin record * with: - @code + \code DTYP = "General Time" INP = "@GETERRCNT" - @endcode + \endcode * - * @return Reset error counts + * \return Reset error counts **/ epicsShareFunc int generalTimeGetErrorCounts(void); -/**@brief Return the nume of the provider that last returned a valid current time, or +/**\brief Return the nume of the provider that last returned a valid current time, or * NULL if none. * * Used by stringin device support with: - @code + \code DTYP = "General Time" INP = "@BESTTCP" - @endcode + \endcode * - * @return Provider name + * \return Provider name **/ epicsShareFunc const char * generalTimeCurrentProviderName(void); -/**@brief Return the name of the provider that last returned a valid Time Event time, or +/**\brief Return the name of the provider that last returned a valid Time Event time, or * NULL of none. * * Used by stringin device support with: - @code + \code DTYP = "General Time" INP = "@BESTTEP" - @endcode + \endcode * - * @return Provider name + * \return Provider name **/ epicsShareFunc const char * generalTimeEventProviderName(void); -/**@brief Return the name of the registered current time provider that has the highest +/**\brief Return the name of the registered current time provider that has the highest * priority. * * Used by stringin device support with: - @code + \code DTYP = "General Time" INP = "@TOPTCP" - @endcode + \endcode * - * @return Provider name + * \return Provider name **/ epicsShareFunc const char * generalTimeHighestCurrentName(void); -/** @brief Old name provided for backwards compatibility */ +/** \brief Old name provided for backwards compatibility */ #define generalTimeCurrentTpName generalTimeCurrentProviderName -/** @brief Old name provided for backwards compatibility */ +/** \brief Old name provided for backwards compatibility */ #define generalTimeEventTpName generalTimeEventProviderName -/**@brief Provide information about the installed providers and their current best times. +/**\brief Provide information about the installed providers and their current best times. * - * @param interest Desired interest level to report + * \param interest Desired interest level to report **/ epicsShareFunc long generalTimeReport(int interest); diff --git a/modules/libcom/src/osi/epicsMutex.h b/modules/libcom/src/osi/epicsMutex.h index 84d57adc0..89a3410f9 100644 --- a/modules/libcom/src/osi/epicsMutex.h +++ b/modules/libcom/src/osi/epicsMutex.h @@ -7,9 +7,9 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/**@file epicsMutex.h +/**\file epicsMutex.h * - * @brief APIs for the epicsMutex mutual exclusion semaphore + * \brief APIs for the epicsMutex mutual exclusion semaphore * * Mutual exclusion semaphores are for situations requiring exclusive access to * resources. An epicsMutex may be claimed recursively, i.e. taken more than @@ -18,16 +18,16 @@ * working on an exclusive resource. * * The typical C++ use of a mutual exclusion semaphore is: - @code + \code epicsMutex *plock = new epicsMutex; ... ... plock->lock(); // process resources plock->unlock(); - @endcode + \endcode * - * @note The implementation: + * \note The implementation: * - MUST implement recursive locking * - SHOULD implement priority inheritance and deletion safety if possible. **/ @@ -38,7 +38,7 @@ #include "shareLib.h" -/**@brief An identifier for an epicsMutex for use with the C API */ +/**\brief An identifier for an epicsMutex for use with the C API */ typedef struct epicsMutexParm *epicsMutexId; /** Return status from some C API routines. */ @@ -53,11 +53,11 @@ typedef enum { #include "compilerDependencies.h" #include "epicsGuard.h" -/**@brief Create a C++ epicsMutex with current filename and line number +/**\brief Create a C++ epicsMutex with current filename and line number */ #define newEpicsMutex new epicsMutex(__FILE__,__LINE__) -/**@brief The C++ API for an epicsMutex. +/**\brief The C++ API for an epicsMutex. */ class epicsShareClass epicsMutex { public: @@ -67,59 +67,59 @@ public: class invalidMutex; /* exception payload */ #if !defined(__GNUC__) || __GNUC__<4 || (__GNUC__==4 && __GNUC_MINOR__<8) - /**@brief Create a mutual exclusion semaphore. + /**\brief Create a mutual exclusion semaphore. **/ epicsMutex (); - /**@brief Create a mutual exclusion semaphore with source location. + /**\brief Create a mutual exclusion semaphore with source location. * - * @note The newEpicsMutex macro simplifies using this constructor. - * @param *pFileName Source file name. - * @param lineno Source line number + * \note The newEpicsMutex macro simplifies using this constructor. + * \param *pFileName Source file name. + * \param lineno Source line number **/ epicsMutex ( const char *pFileName, int lineno ); #else - /**@brief Create a mutual exclusion semaphore. - * @param *pFileName Source file name. - * @param lineno Source line number + /**\brief Create a mutual exclusion semaphore. + * \param *pFileName Source file name. + * \param lineno Source line number **/ epicsMutex ( const char *pFileName = __builtin_FILE(), int lineno = __builtin_LINE() ); #endif - /**@brief Delete the semaphore and its resources. + /**\brief Delete the semaphore and its resources. **/ ~epicsMutex (); - /**@brief Display information about the semaphore. + /**\brief Display information about the semaphore. * - * @note Results are architecture dependant. + * \note Results are architecture dependant. * - * @param level Desired information level to report + * \param level Desired information level to report **/ void show ( unsigned level ) const; - /**@brief Claim the semaphore, waiting until it's free if currently owned + /**\brief Claim the semaphore, waiting until it's free if currently owned * owned by a different thread. * * This call blocks until the calling thread can get exclusive access to * the semaphore. - * @note After a successful lock(), additional recursive locks may be + * \note After a successful lock(), additional recursive locks may be * issued by the same thread, but each must have an associated unlock(). **/ void lock (); - /**@brief Release the semaphore. + /**\brief Release the semaphore. * - * @note If a thread issues recursive locks, it must call unlock() as many + * \note If a thread issues recursive locks, it must call unlock() as many * times as it calls lock(). **/ void unlock (); - /**@brief Similar to lock() except that the call returns immediately if the + /**\brief Similar to lock() except that the call returns immediately if the * semaphore is currently owned by another thread, giving the value false. * - * @return True if the resource is now owned by the caller. - * @return False if some other thread already owns the resource. + * \return True if the resource is now owned by the caller. + * \return False if some other thread already owns the resource. **/ bool tryLock (); private: @@ -128,7 +128,7 @@ private: epicsMutex & operator = ( const epicsMutex & ); }; -/**@brief A semaphore for locating deadlocks in C++ code. */ +/**\brief A semaphore for locating deadlocks in C++ code. */ class epicsShareClass epicsDeadlockDetectMutex { public: typedef epicsGuard guard_t; @@ -154,88 +154,88 @@ private: extern "C" { #endif /*__cplusplus*/ -/**@brief Create an epicsMutex semaphore for use from C code. +/**\brief Create an epicsMutex semaphore for use from C code. * * This macro stores the source location of the creation call in the mutex. - * @return An identifier for the mutex, or NULL if one could not be created. + * \return An identifier for the mutex, or NULL if one could not be created. **/ #define epicsMutexCreate() epicsMutexOsiCreate(__FILE__,__LINE__) -/**@brief Internal API, used by epicsMutexCreate(). */ +/**\brief Internal API, used by epicsMutexCreate(). */ epicsShareFunc epicsMutexId epicsShareAPI epicsMutexOsiCreate( const char *pFileName,int lineno); -/**@brief Create an epicsMutex semaphore for use from C code. +/**\brief Create an epicsMutex semaphore for use from C code. * * This macro stores the source location of the creation call in the mutex. * The routine does not return if the object could not be created. - * @return An identifier for the mutex. + * \return An identifier for the mutex. **/ #define epicsMutexMustCreate() epicsMutexOsiMustCreate(__FILE__,__LINE__) -/**@brief Internal API, used by epicsMutexMustCreate(). */ +/**\brief Internal API, used by epicsMutexMustCreate(). */ epicsShareFunc epicsMutexId epicsShareAPI epicsMutexOsiMustCreate( const char *pFileName,int lineno); -/**@brief Destroy an epicsMutex semaphore. - * @param id The mutex identifier. +/**\brief Destroy an epicsMutex semaphore. + * \param id The mutex identifier. **/ epicsShareFunc void epicsShareAPI epicsMutexDestroy(epicsMutexId id); -/**@brief Release the semaphore. - * @param id The mutex identifier. - * @note If a thread issues recursive locks, it must call epicsMutexUnlock() +/**\brief Release the semaphore. + * \param id The mutex identifier. + * \note If a thread issues recursive locks, it must call epicsMutexUnlock() * as many times as it calls epicsMutexLock() or equivalents. **/ epicsShareFunc void epicsShareAPI epicsMutexUnlock(epicsMutexId id); -/**@brief Claim the semaphore, waiting until it's free if currently owned +/**\brief Claim the semaphore, waiting until it's free if currently owned * owned by a different thread. * * This call blocks until the calling thread can get exclusive access to * the semaphore. - * @note After a successful lock(), additional recursive locks may be + * \note After a successful lock(), additional recursive locks may be * issued by the same thread, but each must have an associated unlock(). - * @param id The mutex identifier. - * @return Status indicator. + * \param id The mutex identifier. + * \return Status indicator. **/ epicsShareFunc epicsMutexLockStatus epicsShareAPI epicsMutexLock( epicsMutexId id); -/**@brief Claim a semaphore (see epicsMutexLock()). +/**\brief Claim a semaphore (see epicsMutexLock()). * * This routine does not return if the identifier is invalid. - * @param ID The mutex identifier. + * \param ID The mutex identifier. **/ #define epicsMutexMustLock(ID) { \ epicsMutexLockStatus status = epicsMutexLock(ID); \ assert(status == epicsMutexLockOK); \ } -/**@brief Similar to epicsMutexLock() except that the call returns immediately, +/**\brief Similar to epicsMutexLock() except that the call returns immediately, * with the return status indicating if the semaphore is currently owned by * this thread or another thread. * - * @return \c epicsMutexLockOK if the resource is now owned by the caller. - * @return \c epicsMutexLockTimeout if some other thread owns the resource. + * \return \c epicsMutexLockOK if the resource is now owned by the caller. + * \return \c epicsMutexLockTimeout if some other thread owns the resource. **/ epicsShareFunc epicsMutexLockStatus epicsShareAPI epicsMutexTryLock( epicsMutexId id); -/**@brief Display information about the semaphore. +/**\brief Display information about the semaphore. * - * @note Results are architecture dependant. + * \note Results are architecture dependant. * - * @param id The mutex identifier. - * @param level Desired information level to report + * \param id The mutex identifier. + * \param level Desired information level to report **/ epicsShareFunc void epicsShareAPI epicsMutexShow( epicsMutexId id,unsigned int level); -/**@brief Display information about all epicsMutex semaphores. +/**\brief Display information about all epicsMutex semaphores. * - * @note Results are architecture dependant. + * \note Results are architecture dependant. * - * @param onlyLocked Non-zero to show only locked semaphores. - * @param level Desired information level to report + * \param onlyLocked Non-zero to show only locked semaphores. + * \param level Desired information level to report **/ epicsShareFunc void epicsShareAPI epicsMutexShowAll( int onlyLocked,unsigned int level); diff --git a/modules/libcom/src/osi/epicsReadline.h b/modules/libcom/src/osi/epicsReadline.h index ab3faa160..78c233119 100644 --- a/modules/libcom/src/osi/epicsReadline.h +++ b/modules/libcom/src/osi/epicsReadline.h @@ -8,9 +8,9 @@ \*************************************************************************/ /** - * @file epicsReadline.h - * @brief Command-line editing functions - * @author Eric Norum + * \file epicsReadline.h + * \brief Command-line editing functions + * \author Eric Norum * * Provides a generalized API for command line history and line-editing. * The implementation of this API can call GNU Readline, libtecla, and on @@ -26,21 +26,21 @@ extern "C" { #include #include /** - * @brief Create a command-line context - * @param in Filehandle to read from - * @returns Command-line context + * \brief Create a command-line context + * \param in Filehandle to read from + * \return Command-line context */ epicsShareFunc void * epicsShareAPI epicsReadlineBegin (FILE *in); /** - * @brief Read a line of input - * @param prompt Prompt string - * @param context To read from - * @returns Line read + * \brief Read a line of input + * \param prompt Prompt string + * \param context To read from + * \return Line read */ epicsShareFunc char * epicsShareAPI epicsReadline (const char *prompt, void *context); /** - * @brief Destroy a command-line context - * @param context Command-line context to destroy + * \brief Destroy a command-line context + * \param context Command-line context to destroy */ epicsShareFunc void epicsShareAPI epicsReadlineEnd (void *context); diff --git a/modules/libcom/src/osi/epicsThread.h b/modules/libcom/src/osi/epicsThread.h index b154e83e6..b25c3cd7c 100644 --- a/modules/libcom/src/osi/epicsThread.h +++ b/modules/libcom/src/osi/epicsThread.h @@ -65,6 +65,9 @@ extern "C" { typedef void (*EPICSTHREADFUNC)(void *parm); +/** @name Some Named Thread Priorities + * @{ + */ #define epicsThreadPriorityMax 99 #define epicsThreadPriorityMin 0 @@ -80,6 +83,7 @@ typedef void (*EPICSTHREADFUNC)(void *parm); #define epicsThreadPriorityScanHigh 70 #define epicsThreadPriorityIocsh 91 #define epicsThreadPriorityBaseMax 91 +/** @} */ /** Stack sizes for each stackSizeClass are implementation and CPU dependent. */ typedef enum { @@ -114,13 +118,13 @@ typedef epicsThreadId epicsThreadOnceId; * -# myInitFunc will have returned before any other epicsThreadOnce * call using the same epicsThreadOnceId returns. * - * @code + * \code * static epicsThreadOnceId onceId = EPICS_THREAD_ONCE_INIT; * static void myInitFunc(void *arg) { ... } * static void some Function(void) { * epicsThreadOnce(&onceId, &myInitFunc, NULL); * } - * @endcode + * \endcode */ epicsShareFunc void epicsShareAPI epicsThreadOnce( epicsThreadOnceId *id, EPICSTHREADFUNC, void *arg); @@ -163,12 +167,12 @@ typedef struct epicsThreadOpts { #define EPICS_THREAD_OPTS_INIT { \ epicsThreadPriorityLow, epicsThreadStackMedium, 0} -/** @brief Allocate and start a new OS thread. - * @param name A name describing this thread. Appears in various log and error message. - * @param funptr The thread main function. - * @param parm Passed to thread main function. - * @param opts Modifiers for the new thread, or NULL to use target specific defaults. - * @return NULL on error +/** \brief Allocate and start a new OS thread. + * \param name A name describing this thread. Appears in various log and error message. + * \param funptr The thread main function. + * \param parm Passed to thread main function. + * \param opts Modifiers for the new thread, or NULL to use target specific defaults. + * \return NULL on error */ epicsShareFunc epicsThreadId epicsThreadCreateOpt ( const char * name, @@ -222,14 +226,14 @@ epicsShareFunc int epicsShareAPI epicsThreadIsEqual( * for other reasons. **/ epicsShareFunc int epicsShareAPI epicsThreadIsSuspended(epicsThreadId id); -/** @brief Block the calling thread for at least the specified time. - * @param seconds Time to wait in seconds. Values <=0 blocks for the shortest possible time. +/** \brief Block the calling thread for at least the specified time. + * \param seconds Time to wait in seconds. Values <=0 blocks for the shortest possible time. */ epicsShareFunc void epicsShareAPI epicsThreadSleep(double seconds); -/** @brief Query a value approximating the OS timer/scheduler resolution. - * @return A value in seconds >=0 +/** \brief Query a value approximating the OS timer/scheduler resolution. + * \return A value in seconds >=0 * - * @warning On targets other than vxWorks and RTEMS, the quantum value often isn't + * \warning On targets other than vxWorks and RTEMS, the quantum value often isn't * meaningful. Use of this function is discouraged in portable code. */ epicsShareFunc double epicsShareAPI epicsThreadSleepQuantum(void); @@ -238,23 +242,23 @@ epicsShareFunc double epicsShareAPI epicsThreadSleepQuantum(void); */ epicsShareFunc epicsThreadId epicsShareAPI epicsThreadGetIdSelf(void); /** Attempt to find the first instance of a thread by name. - * @return An epicsThreadId, or NULL if no such thread is currently running. + * \return An epicsThreadId, or NULL if no such thread is currently running. * Note that a non-NULL ID may still be invalid if this call races * with thread exit. * - * @warning Safe use of this function requires external knowledge that this + * \warning Safe use of this function requires external knowledge that this * thread will not return. */ epicsShareFunc epicsThreadId epicsShareAPI epicsThreadGetId(const char *name); /** Return a value approximating the number of threads which this target * can run in parallel. This value is advisory. - * @return >=1 + * \return >=1 */ epicsShareFunc int epicsThreadGetCPUs(void); /** Return the name of the current thread. * - * @return Never NULL. Storage lifetime tied to epicsThreadId. + * \return Never NULL. Storage lifetime tied to epicsThreadId. * * This is either a copy of the string passed to epicsThread*Create*(), * or an arbitrary unique string for non-EPICS threads. @@ -285,7 +289,7 @@ epicsShareFunc int epicsShareAPI epicsThreadIsOkToBlock(void); epicsShareFunc void epicsShareAPI epicsThreadSetOkToBlock(int isOkToBlock); /** Print to stdout information about all running EPICS threads. - * @param level 0 prints minimal output. Higher values print more details. + * \param level 0 prints minimal output. Higher values print more details. */ epicsShareFunc void epicsShareAPI epicsThreadShowAll(unsigned int level); /** Print info about a single EPICS thread. */ @@ -356,18 +360,18 @@ public: extern "C" void epicsThreadCallEntryPoint ( void * ); -/** @brief An OS thread +/** \brief An OS thread * * A wrapper around the epicsThread* C API. * - * @note Threads must be start() ed. + * \note Threads must be start() ed. */ class epicsShareClass epicsThread { public: /** Create a new thread with the provided information. * * cf. epicsThreadOpts - * @note Threads must be start() ed. + * \note Threads must be start() ed. * @throws epicsThread::unableToCreateThread on error. */ epicsThread ( epicsThreadRunable &,const char *name, unsigned int stackSize, @@ -378,11 +382,11 @@ public: //! Wait for the thread epicsRunnable::run() to return. void exitWait () throw (); //! Wait for the thread epicsRunnable::run() to return. - //! @param delay Wait up to this many seconds. - //! @returns true if run() returned. false on timeout. + //! \param delay Wait up to this many seconds. + //! \return true if run() returned. false on timeout. bool exitWait ( const double delay ) throw (); //! @throws A special exitException which will be caught and ignored. - //! @note This exitException doesn't not derive from std::exception + //! \note This exitException doesn't not derive from std::exception static void exit (); //! cf. epicsThreadResume() void resume () throw (); @@ -396,7 +400,7 @@ public: void setPriority ( unsigned int ) throw (); bool priorityIsEqual ( const epicsThread & ) const throw (); bool isSuspended () const throw (); - //! @return true if call through this thread's epicsRunnable::run() + //! \return true if call through this thread's epicsRunnable::run() bool isCurrentThread () const throw (); bool operator == ( const epicsThread & ) const throw (); //! Say something interesting about this thread to stdout. diff --git a/modules/libcom/src/osi/os/WIN32/osiFileName.h b/modules/libcom/src/osi/os/WIN32/osiFileName.h index ced745f71..bba2d55c1 100644 --- a/modules/libcom/src/osi/os/WIN32/osiFileName.h +++ b/modules/libcom/src/osi/os/WIN32/osiFileName.h @@ -25,13 +25,13 @@ extern "C" { #define OSI_PATH_SEPARATOR "\\" /** Return the absolute path of the current executable. - @returns NULL or the path. Caller must free() + * \return NULL or the path. Caller must free() */ epicsShareFunc char *epicsGetExecName(void); /** Return the absolute path of the directory containing the current executable. - @returns NULL or the path. Caller must free() + * \return NULL or the path. Caller must free() */ epicsShareFunc char *epicsGetExecDir(void); diff --git a/modules/libcom/src/osi/os/cygwin32/osiFileName.h b/modules/libcom/src/osi/os/cygwin32/osiFileName.h index 1e7799098..76562f3e4 100644 --- a/modules/libcom/src/osi/os/cygwin32/osiFileName.h +++ b/modules/libcom/src/osi/os/cygwin32/osiFileName.h @@ -24,13 +24,13 @@ extern "C" { #define OSI_PATH_SEPARATOR "\\" /** Return the absolute path of the current executable. - @returns NULL or the path. Caller must free() + \return NULL or the path. Caller must free() */ epicsShareFunc char *epicsGetExecName(void); /** Return the absolute path of the directory containing the current executable. - @returns NULL or the path. Caller must free() + \return NULL or the path. Caller must free() */ epicsShareFunc char *epicsGetExecDir(void); diff --git a/modules/libcom/src/osi/os/default/epicsMMIODef.h b/modules/libcom/src/osi/os/default/epicsMMIODef.h index 04890bb5a..114a67c6e 100644 --- a/modules/libcom/src/osi/os/default/epicsMMIODef.h +++ b/modules/libcom/src/osi/os/default/epicsMMIODef.h @@ -5,12 +5,12 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ /** - * @file epicsMMIODef.h - * @brief Memory Mapped I/O + * \file epicsMMIODef.h + * \brief Memory Mapped I/O * * Definitions related to Memory Mapped I/O * - * @author Michael Davidsaver + * \author Michael Davidsaver * @ingroup mmio */ @@ -32,7 +32,7 @@ *@{ */ -/** @brief Read a single byte. +/** \brief Read a single byte. */ static EPICS_ALWAYS_INLINE epicsUInt8 @@ -41,7 +41,7 @@ ioread8(volatile void* addr) return *(volatile epicsUInt8*)(addr); } -/** @brief Write a single byte. +/** \brief Write a single byte. */ static EPICS_ALWAYS_INLINE void @@ -50,7 +50,7 @@ iowrite8(volatile void* addr, epicsUInt8 val) *(volatile epicsUInt8*)(addr) = val; } -/** @brief Read two bytes in host order. +/** \brief Read two bytes in host order. * Not byte swapping */ static EPICS_ALWAYS_INLINE @@ -60,7 +60,7 @@ nat_ioread16(volatile void* addr) return *(volatile epicsUInt16*)(addr); } -/** @brief Write two byte in host order. +/** \brief Write two byte in host order. * Not byte swapping */ static EPICS_ALWAYS_INLINE @@ -70,7 +70,7 @@ nat_iowrite16(volatile void* addr, epicsUInt16 val) *(volatile epicsUInt16*)(addr) = val; } -/** @brief Read four bytes in host order. +/** \brief Read four bytes in host order. * Not byte swapping */ static EPICS_ALWAYS_INLINE @@ -80,7 +80,7 @@ nat_ioread32(volatile void* addr) return *(volatile epicsUInt32*)(addr); } -/** @brief Write four byte in host order. +/** \brief Write four byte in host order. * Not byte swapping */ static EPICS_ALWAYS_INLINE @@ -157,50 +157,50 @@ bswap32(epicsUInt32 value) # error Unable to determine native byte order #endif -/** @def bswap16 - * @brief Unconditional two byte swap +/** \def bswap16 + * \brief Unconditional two byte swap */ -/** @def bswap32 - * @brief Unconditional four byte swap +/** \def bswap32 + * \brief Unconditional four byte swap */ -/** @def be_ioread16 - * @brief Read two byte in big endian order. +/** \def be_ioread16 + * \brief Read two byte in big endian order. */ -/** @def be_iowrite16 - * @brief Write two byte in big endian order. +/** \def be_iowrite16 + * \brief Write two byte in big endian order. */ -/** @def be_ioread32 - * @brief Read four byte in big endian order. +/** \def be_ioread32 + * \brief Read four byte in big endian order. */ -/** @def be_iowrite32 - * @brief Write four byte in big endian order. +/** \def be_iowrite32 + * \brief Write four byte in big endian order. */ -/** @def le_ioread16 - * @brief Read two byte in little endian order. +/** \def le_ioread16 + * \brief Read two byte in little endian order. */ -/** @def le_iowrite16 - * @brief Write two byte in little endian order. +/** \def le_iowrite16 + * \brief Write two byte in little endian order. */ -/** @def le_ioread32 - * @brief Read four byte in little endian order. +/** \def le_ioread32 + * \brief Read four byte in little endian order. */ -/** @def le_iowrite32 - * @brief Write four byte in little endian order. +/** \def le_iowrite32 + * \brief Write four byte in little endian order. */ /** @ingroup mmio *@{ */ -/** @brief Explicit read memory barrier +/** \brief Explicit read memory barrier * Prevents reordering of reads around it. */ #define rbarr() do{}while(0) -/** @brief Explicit write memory barrier +/** \brief Explicit write memory barrier * Prevents reordering of writes around it. */ #define wbarr() do{}while(0) -/** @brief Explicit read/write memory barrier +/** \brief Explicit read/write memory barrier * Prevents reordering of reads or writes around it. */ #define rwbarr() do{}while(0) @@ -239,30 +239,30 @@ bswap32(epicsUInt32 value) * *@b PCI * - @code + \code be_iowrite16(base+off, 14); var = be_ioread16(base+off); - @endcode + \endcode * *@b VME * - @code + \code nat_iowrite16(base+off, 14); var = nat_ioread16(base+off); - @endcode + \endcode * *@subsection mmioexle Little endian device * *@b PCI - @code + \code le_iowrite16(base+off, 14); var = le_ioread16(base+off); - @endcode + \endcode *@b VME - @code + \code nat_iowrite16(base+off, bswap16(14)); var = bswap16(nat_iowrite16(base+off)); - @endcode + \endcode *This difference arises because VME bridges implement hardware byte *swapping on little endian systems, while PCI bridges do not. *Software accessing PCI devices must know if byte swapping is required. @@ -274,7 +274,7 @@ bswap32(epicsUInt32 value) * *Software accessing VME must @b not do conditional swapping. * - *@note All read and write operations have an implicit read or write barrier. + *\note All read and write operations have an implicit read or write barrier. */ /** @} */ diff --git a/modules/libcom/src/osi/osiPoolStatus.h b/modules/libcom/src/osi/osiPoolStatus.h index 45bc1eaf9..197d5fc96 100644 --- a/modules/libcom/src/osi/osiPoolStatus.h +++ b/modules/libcom/src/osi/osiPoolStatus.h @@ -7,9 +7,9 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/**@file osiPoolStatus.h - * @author Jeff Hill - * @brief Functions to check the state of the system memory pool. +/**\file osiPoolStatus.h + * \author Jeff Hill + * \brief Functions to check the state of the system memory pool. * **/ @@ -23,17 +23,17 @@ extern "C" { #endif -/**@brief Checks if a memory block of a specific size can be safely allocated. +/**\brief Checks if a memory block of a specific size can be safely allocated. * * The meaning of "safely allocated" is target-specific, some additional free * space is usually necessary to keep the system running reliably. * On vxWorks this returns True if at least 100000 bytes is free. * - * @note This routine is called quite frequently by the IOC so an efficent + * \note This routine is called quite frequently by the IOC so an efficent * implementation is important. * - * @param contiguousBlockSize Block size to check. - * @return True if the requested memory should be available. + * \param contiguousBlockSize Block size to check. + * \return True if the requested memory should be available. */ epicsShareFunc int epicsShareAPI osiSufficentSpaceInPool ( size_t contiguousBlockSize ); diff --git a/modules/libcom/src/ring/epicsRingBytes.h b/modules/libcom/src/ring/epicsRingBytes.h index ef51ba577..870d44093 100644 --- a/modules/libcom/src/ring/epicsRingBytes.h +++ b/modules/libcom/src/ring/epicsRingBytes.h @@ -8,18 +8,18 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ /** - * @file epicsRingBytes.h - * @author Marty Kraimer, Eric Norum, Ralph Lange - * @brief A circular buffer to store bytes + * \file epicsRingBytes.h + * \author Marty Kraimer, Eric Norum, Ralph Lange + * \brief A circular buffer to store bytes * - * @details + * \details * EpicsRingBytes provides a C API for creating and using ring buffers * (first in first out circular buffers) that store bytes. The unlocked * variant is designed so that one writer thread and one reader thread * can access the ring simultaneously without requiring mutual exclusion. * The locked variant uses an epicsSpinLock, and works with any numbers of * writer and reader threads. - * @note If there is only one writer it is not necessary to lock for puts. + * \note If there is only one writer it is not necessary to lock for puts. * If there is a single reader it is not necessary to lock for gets. * epicsRingBytesLocked uses a spinlock. */ @@ -33,97 +33,97 @@ extern "C" { #include "shareLib.h" -/** @brief An identifier for a ring buffer */ +/** \brief An identifier for a ring buffer */ typedef void *epicsRingBytesId; typedef void const *epicsRingBytesIdConst; /** - * @brief Create a new ring buffer - * @param nbytes Size of ring buffer to create - * @return Ring buffer Id or NULL on failure + * \brief Create a new ring buffer + * \param nbytes Size of ring buffer to create + * \return Ring buffer Id or NULL on failure */ epicsShareFunc epicsRingBytesId epicsShareAPI epicsRingBytesCreate(int nbytes); /** - * @brief Create a new ring buffer, secured by a spinlock - * @param nbytes Size of ring buffer to create - * @return Ring buffer Id or NULL on failure + * \brief Create a new ring buffer, secured by a spinlock + * \param nbytes Size of ring buffer to create + * \return Ring buffer Id or NULL on failure */ epicsShareFunc epicsRingBytesId epicsShareAPI epicsRingBytesLockedCreate(int nbytes); /** - * @brief Delete the ring buffer and free any associated memory - * @param id RingbufferID returned by epicsRingBytesCreate() + * \brief Delete the ring buffer and free any associated memory + * \param id RingbufferID returned by epicsRingBytesCreate() */ epicsShareFunc void epicsShareAPI epicsRingBytesDelete(epicsRingBytesId id); /** - * @brief Read data out of the ring buffer - * @param id RingbufferID returned by epicsRingBytesCreate() - * @param value Where to put the data fetched from the buffer - * @param nbytes Maximum number of bytes to get - * @return The number of bytes actually fetched + * \brief Read data out of the ring buffer + * \param id RingbufferID returned by epicsRingBytesCreate() + * \param value Where to put the data fetched from the buffer + * \param nbytes Maximum number of bytes to get + * \return The number of bytes actually fetched */ epicsShareFunc int epicsShareAPI epicsRingBytesGet( epicsRingBytesId id, char *value,int nbytes); /** - * @brief Write data into the ring buffer - * @param id RingbufferID returned by epicsRingBytesCreate() - * @param value Source of the data to be put into the buffer - * @param nbytes How many bytes to put - * @return The number of bytes actually stored, zero if not enough space + * \brief Write data into the ring buffer + * \param id RingbufferID returned by epicsRingBytesCreate() + * \param value Source of the data to be put into the buffer + * \param nbytes How many bytes to put + * \return The number of bytes actually stored, zero if not enough space */ epicsShareFunc int epicsShareAPI epicsRingBytesPut( epicsRingBytesId id, char *value,int nbytes); /** - * @brief Make the ring buffer empty - * @param id RingbufferID returned by epicsRingBytesCreate() - * @note Should only be used when both gets and puts are locked out. + * \brief Make the ring buffer empty + * \param id RingbufferID returned by epicsRingBytesCreate() + * \note Should only be used when both gets and puts are locked out. */ epicsShareFunc void epicsShareAPI epicsRingBytesFlush(epicsRingBytesId id); /** - * @brief Return the number of free bytes in the ring buffer - * @param id RingbufferID returned by epicsRingBytesCreate() - * @return The number of free bytes in the ring buffer + * \brief Return the number of free bytes in the ring buffer + * \param id RingbufferID returned by epicsRingBytesCreate() + * \return The number of free bytes in the ring buffer */ epicsShareFunc int epicsShareAPI epicsRingBytesFreeBytes(epicsRingBytesId id); /** - * @brief Return the number of bytes currently stored in the ring buffer - * @param id RingbufferID returned by epicsRingBytesCreate() - * @return The number of bytes currently stored in the ring buffer + * \brief Return the number of bytes currently stored in the ring buffer + * \param id RingbufferID returned by epicsRingBytesCreate() + * \return The number of bytes currently stored in the ring buffer */ epicsShareFunc int epicsShareAPI epicsRingBytesUsedBytes(epicsRingBytesId id); /** - * @brief Return the size of the ring buffer - * @param id RingbufferID returned by epicsRingBytesCreate() - * @return Return the size of the ring buffer, i.e., nbytes specified in + * \brief Return the size of the ring buffer + * \param id RingbufferID returned by epicsRingBytesCreate() + * \return Return the size of the ring buffer, i.e., nbytes specified in * the call to epicsRingBytesCreate(). */ epicsShareFunc int epicsShareAPI epicsRingBytesSize(epicsRingBytesId id); /** - * @brief Test if the ring buffer is currently empty. - * @param id RingbufferID returned by epicsRingBytesCreate() - * @return 1 if the buffer is empty, otherwise 0 + * \brief Test if the ring buffer is currently empty. + * \param id RingbufferID returned by epicsRingBytesCreate() + * \return 1 if the buffer is empty, otherwise 0 */ epicsShareFunc int epicsShareAPI epicsRingBytesIsEmpty(epicsRingBytesId id); /** - * @brief Test if the ring buffer is currently full. - * @param id RingbufferID returned by epicsRingBytesCreate() - * @return 1 if the buffer is full, otherwise 0 + * \brief Test if the ring buffer is currently full. + * \param id RingbufferID returned by epicsRingBytesCreate() + * \return 1 if the buffer is full, otherwise 0 */ epicsShareFunc int epicsShareAPI epicsRingBytesIsFull(epicsRingBytesId id); /** - * @brief See how full a ring buffer has been since it was last checked. + * \brief See how full a ring buffer has been since it was last checked. * * Returns the maximum amount of data the ring buffer has held in bytes * since the water mark was last reset. A new ring buffer starts with a * water mark of 0. - * @param id RingbufferID returned by epicsRingBytesCreate() - * @return Actual Highwater mark + * \param id RingbufferID returned by epicsRingBytesCreate() + * \return Actual Highwater mark */ epicsShareFunc int epicsShareAPI epicsRingBytesHighWaterMark(epicsRingBytesIdConst id); /** - * @brief Reset the Highwater mark of the ring buffer. + * \brief Reset the Highwater mark of the ring buffer. * * The Highwater mark will be set to the current usage - * @param id RingbufferID returned by epicsRingBytesCreate() + * \param id RingbufferID returned by epicsRingBytesCreate() */ epicsShareFunc void epicsShareAPI epicsRingBytesResetHighWaterMark(epicsRingBytesId id); diff --git a/modules/libcom/src/ring/epicsRingPointer.h b/modules/libcom/src/ring/epicsRingPointer.h index c50128247..8ecdcec81 100644 --- a/modules/libcom/src/ring/epicsRingPointer.h +++ b/modules/libcom/src/ring/epicsRingPointer.h @@ -8,18 +8,18 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ /** - * @file epicsRingPointer.h - * @brief A circular buffer to store pointers - * @author Marty Kraimer, Ralph Lange + * \file epicsRingPointer.h + * \brief A circular buffer to store pointers + * \author Marty Kraimer, Ralph Lange * - * @details + * \details * epicsRingPointer.h provides both C and C++ APIs for creating and using ring * buffers (first in first out circular buffers) that store pointers. The * unlocked kind is designed so that one writer thread and one reader thread * can access the ring simultaneously without requiring mutual exclusion. The * locked variant uses an epicsSpinLock, and works with any numbers of writer * and reader threads. - * @note If there is only one writer it is not necessary to lock pushes. + * \note If there is only one writer it is not necessary to lock pushes. * If there is a single reader it is not necessary to lock pops. * epicsRingPointerLocked uses a spinlock. */ @@ -33,63 +33,63 @@ #ifdef __cplusplus /** - * @brief A C++ template class providing methods for creating and using a ring + * \brief A C++ template class providing methods for creating and using a ring * buffer (a first in, first out circular buffer) that stores pointers to * objects of the template type. */ template class epicsRingPointer { public: /* Functions */ - /**@brief Constructor - * @param size Maximum number of elements (pointers) that can be stored - * @param locked If true, the spin lock secured variant is created + /**\brief Constructor + * \param size Maximum number of elements (pointers) that can be stored + * \param locked If true, the spin lock secured variant is created */ epicsRingPointer(int size, bool locked); - /**@brief Destructor + /**\brief Destructor */ ~epicsRingPointer(); - /**@brief Push a new entry on the ring - * @return True on success, False if the buffer was full + /**\brief Push a new entry on the ring + * \return True on success, False if the buffer was full */ bool push(T *p); - /**@brief Take an element off the ring - * @return The element, or NULL if the ring was empty + /**\brief Take an element off the ring + * \return The element, or NULL if the ring was empty */ T* pop(); - /**@brief Remove all elements from the ring. - * @note If this operation is performed on a ring buffer of the + /**\brief Remove all elements from the ring. + * \note If this operation is performed on a ring buffer of the * unsecured kind, all access to the ring should be locked. */ void flush(); - /**@brief Get how much free space remains in the ring - * @return The number of additional elements the ring could hold. + /**\brief Get how much free space remains in the ring + * \return The number of additional elements the ring could hold. */ int getFree() const; - /**@brief Get how many elements are stored on the ring - * @return The number of elements currently stored. + /**\brief Get how many elements are stored on the ring + * \return The number of elements currently stored. */ int getUsed() const; - /**@brief Get the size of the ring - * @return The @c size specified when the ring was created. + /**\brief Get the size of the ring + * \return The \c size specified when the ring was created. */ int getSize() const; - /**@brief Test if the ring is currently empty - * @return True if the ring is empty, otherwise false. + /**\brief Test if the ring is currently empty + * \return True if the ring is empty, otherwise false. */ bool isEmpty() const; - /**@brief Test if the ring is currently full - * @return True if the ring is full, otherwise false. + /**\brief Test if the ring is currently full + * \return True if the ring is full, otherwise false. */ bool isFull() const; - /**@brief See how full the ring has got since it was last checked. + /**\brief See how full the ring has got since it was last checked. * * Returns the maximum number of elements the ring * buffer has held since the water mark was last reset. * A new ring buffer starts with a water mark of 0. - * @return Actual highwater mark + * \return Actual highwater mark */ int getHighWaterMark() const; - /**@brief Reset high water mark + /**\brief Reset high water mark * * High water mark will be set to the current usage */ @@ -114,92 +114,92 @@ private: /* Data */ extern "C" { #endif /*__cplusplus */ -/** @brief An identifier for the C API to a ring buffer storing pointers */ +/** \brief An identifier for the C API to a ring buffer storing pointers */ typedef void *epicsRingPointerId; typedef void const *epicsRingPointerIdConst; /** - * @brief Create a new ring buffer - * @param size Size of ring buffer to create - * @return Ring buffer identifier or NULL on failure + * \brief Create a new ring buffer + * \param size Size of ring buffer to create + * \return Ring buffer identifier or NULL on failure */ epicsShareFunc epicsRingPointerId epicsShareAPI epicsRingPointerCreate(int size); /** - * @brief Create a new ring buffer, secured by a spinlock - * @param size Size of ring buffer to create - * @return Ring buffer identifier or NULL on failure + * \brief Create a new ring buffer, secured by a spinlock + * \param size Size of ring buffer to create + * \return Ring buffer identifier or NULL on failure */ epicsShareFunc epicsRingPointerId epicsShareAPI epicsRingPointerLockedCreate(int size); /** - * @brief Delete the ring buffer and free any associated memory - * @param id Ring buffer identifier + * \brief Delete the ring buffer and free any associated memory + * \param id Ring buffer identifier */ epicsShareFunc void epicsShareAPI epicsRingPointerDelete(epicsRingPointerId id); /** - * @brief Push pointer into the ring buffer - * @param id Ring buffer identifier - * @param p Pointer to be pushed to the ring - * @return 1 if the pointer was successfully pushed, 0 if the buffer was full + * \brief Push pointer into the ring buffer + * \param id Ring buffer identifier + * \param p Pointer to be pushed to the ring + * \return 1 if the pointer was successfully pushed, 0 if the buffer was full */ epicsShareFunc int epicsShareAPI epicsRingPointerPush(epicsRingPointerId id,void *p); /** - * @brief Take an element off the ring - * @param id Ring buffer identifier - * @return The pointer from the buffer, or NULL if the ring was empty + * \brief Take an element off the ring + * \param id Ring buffer identifier + * \return The pointer from the buffer, or NULL if the ring was empty */ epicsShareFunc void* epicsShareAPI epicsRingPointerPop(epicsRingPointerId id) ; /** - * @brief Remove all elements from the ring - * @param id Ring buffer identifier - * @note If this operation is performed on a ring buffer of the unsecured + * \brief Remove all elements from the ring + * \param id Ring buffer identifier + * \note If this operation is performed on a ring buffer of the unsecured * kind, all access to the ring should be locked. */ epicsShareFunc void epicsShareAPI epicsRingPointerFlush(epicsRingPointerId id); /** - * @brief Return the amount of empty space in the ring buffer - * @param id Ring buffer identifier - * @return The number of additional elements it could hold. + * \brief Return the amount of empty space in the ring buffer + * \param id Ring buffer identifier + * \return The number of additional elements it could hold. */ epicsShareFunc int epicsShareAPI epicsRingPointerGetFree(epicsRingPointerId id); /** - * @brief Return the number of elements stored in the ring buffer - * @param id Ring buffer identifier - * @return The number of elements stored in the ring buffer + * \brief Return the number of elements stored in the ring buffer + * \param id Ring buffer identifier + * \return The number of elements stored in the ring buffer */ epicsShareFunc int epicsShareAPI epicsRingPointerGetUsed(epicsRingPointerId id); /** - * @brief Return the size of the ring - * @param id Ring buffer identifier - * @return The size of the ring buffer, i.e. the value of @c size + * \brief Return the size of the ring + * \param id Ring buffer identifier + * \return The size of the ring buffer, i.e. the value of \c size * given when the ring was created. */ epicsShareFunc int epicsShareAPI epicsRingPointerGetSize(epicsRingPointerId id); /** - * @brief Check if the ring buffer is currently empty - * @param id Ring buffer identifier - * @return 1 if the ring is empty, otherwise 0 + * \brief Check if the ring buffer is currently empty + * \param id Ring buffer identifier + * \return 1 if the ring is empty, otherwise 0 */ epicsShareFunc int epicsShareAPI epicsRingPointerIsEmpty(epicsRingPointerId id); /** - * @brief Check if the ring buffer is currently full - * @param id Ring buffer identifier - * @return 1 if the ring buffer is full, otherwise 0 + * \brief Check if the ring buffer is currently full + * \param id Ring buffer identifier + * \return 1 if the ring buffer is full, otherwise 0 */ epicsShareFunc int epicsShareAPI epicsRingPointerIsFull(epicsRingPointerId id); /** - * @brief Get the Highwater mark of the ring buffer + * \brief Get the Highwater mark of the ring buffer * * Returns the largest number of elements the ring buffer has held since * the water mark was last reset. A new ring buffer starts with a * water mark of 0. - * @param id Ring buffer identifier - * @return Actual Highwater mark + * \param id Ring buffer identifier + * \return Actual Highwater mark */ epicsShareFunc int epicsShareAPI epicsRingPointerGetHighWaterMark(epicsRingPointerIdConst id); /** - * @brief Reset the Highwater mark of the ring buffer + * \brief Reset the Highwater mark of the ring buffer * * The Highwater mark will be set to the current usage - * @param id Ring buffer identifier + * \param id Ring buffer identifier */ epicsShareFunc void epicsShareAPI epicsRingPointerResetHighWaterMark(epicsRingPointerId id); From b0cd3518e45e24caf017ae638ec75949d0f77eb2 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Wed, 20 May 2020 15:49:11 +0200 Subject: [PATCH 185/216] doc: add description of improved simulation mode - improve sections in dbCommonInput/dbCommonOutput --- modules/database/src/ioc/db/dbCommonInput.pod | 97 ++++++++++++------- .../database/src/ioc/db/dbCommonOutput.pod | 50 +++++++--- 2 files changed, 101 insertions(+), 46 deletions(-) diff --git a/modules/database/src/ioc/db/dbCommonInput.pod b/modules/database/src/ioc/db/dbCommonInput.pod index ee27b60a9..079277002 100644 --- a/modules/database/src/ioc/db/dbCommonInput.pod +++ b/modules/database/src/ioc/db/dbCommonInput.pod @@ -85,56 +85,72 @@ support read routine normally returns the status from C. =head3 Input Simulation Fields -The B field controls simulation mode. It has either the value YES or NO. -By setting this field to YES, the record can be switched into simulation mode -of operation. While in simulation mode, input will be obtained from SIOL -instead of INP. +The B field controls simulation mode. +By setting this field to YES or RAW, the record can be switched into +simulation mode of operation. +While in simulation mode, input will be obtained from SIOL instead of INP. -Ths B specifies the simulation mode location. This field can be a +The B field specifies the simulation mode location. This field can be a constant, a database link, or a channel access link. If SIML is a database or channel access link, then SIMM is read from SIML. If SIML is a constant link -then SIMM is initialized with the constant value but can be changed via -dbPuts. +then SIMM is initialized with the constant value, but can be changed via +database or channel access puts. -Ths B field contains the simulation value. This is the record's input +The B field contains the simulation value. This is the record's input value, in engineering units, when the record is switched into simulation mode, -i.e. when SIMM is set to YES. +i.e., SIMM is set to YES or RAW. If the record type supports conversion, +setting SIMM to RAW causes SVAL to be written to RVAL and the conversion to +be done. The B field is a link that can be used to fetch the simulation value. The link can be a constant, a database link, or a channel access link. If SIOL is a database or channel access link, then SVAL is read from SIOL. If SIOL is a constant link then SVAL is initialized with the constant value but can be -changed via dbPuts. +changed via database or channel access puts. The B field specifies the simulation mode alarm severity. When this field is set to a value other than NO_ALARM and the record is in simulation -mode, it will be put into alarm with this severity and a status of SIMM. +mode, it will be put into alarm with this severity and a status of SIMM_ALARM. + +The B field specifies a delay (in seconds) to implement asynchronous +processing in simulation mode. A positive SDLY value will be used as delay +between the first and second phase of processing in simulation mode. +A negative value (default) specifies synchronous processing. + +The B field specifies the SCAN mechanism to be used in simulation mode. +This is specifically useful for 'I/O Intr' scanned records, which would +otherwise never be scanned in simulation mode. =head3 Simulation Mode for Input Records An input record can be switched into simulation mode of operation by setting -the value of SIMM to YES or RAW. During simulation, the record will be put -into alarm with a severity of SIMS and a status of SIMM_ALARM. While in -simulation mode, input values will be read from SIOL instead of INP: - - -- (SIMM = NO?) INP (if supported and directed by device support, -> RVAL -- convert -> VAL), (else -> VAL) - / +the value of SIMM to YES or RAW. +During simulation, the record will be put into alarm with a severity of SIMS +and a status of SIMM_ALARM. + -- (SIMM = NO?) + / (if supported and directed by device support, + / INP -> RVAL -- convert -> VAL), + (else INP -> VAL) SIML -> SIMM \ - -- (SIMM = YES?) SIOL -> SVAL -> VAL + -- (SIMM = YES?) SIOL -> SVAL -> VAL \ -- (SIMM = RAW?) SIOL -> SVAL -> RVAL -- convert -> VAL -A record can be switched into simulation mode of operation by setting the -value of SIMM to YES. During simulation, the record will be put into alarm -with a severity of SIMS and a status of SIMM_ALARM. While in simulation mode, -input values, in engineering units, will be obtained from SIOL instead of INP. -Also, while the record is in simulation mode, there will be no raw value -conversion and no calls to device support when the record is processed. +If SIMM is set to YES, the input value, in engineering units, will be obtained +from SIOL instead of INP and directly written to the VAL field. +If SIMM is set to RAW, the value read through SIOL will be truncated and +written to the RVAL field, followed by the regular raw value conversion. +While the record is in simulation mode, there will be no calls to device +support when the record is processed. -Normally input records contain a private readValue() routine which performs +If SIOL contains a link, a TSE setting of "time from device" (-2) is honored +in simulation mode by taking the time stamp from the record that SIOL points +to. + +Normally input records contain a private C routine which performs the following steps: =over @@ -159,19 +175,30 @@ return code, and return. =item * -If SIMM is YES, then call C to read the input value from SIOL -into SVAL. If success, then set VAL to SVAL and UDF to FALSE and set status to -2 (don't convert) if input record supports conversion. If SIMS is greater than -zero, set alarm status to SIMM and severity to SIMS. Set status to the return -code from recGblGetLinkValue and return. +If SIMM is YES or RAW, then + +=over =item * -If SIMM is RAW, then call C to read the input value from SIOL -into SVAL. If success, then set RVAL to SVAL and UDF to FALSE and set status -to 0 (convert) if input record supports conversion. If SIMS is greater than -zero, set alarm status to SIMM and severity to SIMS. Set status to the return -code from recGblGetLinkValue and return. +Set alarm status to SIMM_ALARM and severity to SIMS, +if SIMS is greater than zero. + +=item * + +If the record simulation processing is synchronous (SDLY < 0) or the record is +in the second phase of an asynchronous processing, call C +to read the input value from SIOL into SVAL. +Set status to the return code from C. +If the call succeeded and SIMM is YES, write the value to VAL and set the +status to 2 (don't convert), +if SIMM is RAW and the record type supports conversion, cast the value to RVAL +and leave the status as 0 (convert). + +Otherwise (record is in first phase of an asynchronous processing), set up a +callback processing with the delay specified in SDLY. + +=back =item * diff --git a/modules/database/src/ioc/db/dbCommonOutput.pod b/modules/database/src/ioc/db/dbCommonOutput.pod index 8a2c0ac0f..b60468269 100644 --- a/modules/database/src/ioc/db/dbCommonOutput.pod +++ b/modules/database/src/ioc/db/dbCommonOutput.pod @@ -142,27 +142,36 @@ If IVOA not one of the above, an error message is generated. =back -=head3 Simulation Fields +=head3 Output Simulation Fields The B field controls simulation mode. It has either the value YES or NO. By setting this field to YES, the record can be switched into simulation mode of operation. While in simulation mode, output will be forwarded through SIOL instead of OUT. -Ths B specifies the simulation mode location. This field can be a +The B field specifies the simulation mode location. This field can be a constant, a database link, or a channel access link. If SIML is a database or channel access link, then SIMM is read from SIML. If SIML is a constant link -then SIMM is initialized with the constant value but can be changed via -dbPuts. +then SIMM is initialized with the constant value, but can be changed via +database or channel access puts. The B field is a link that the output value is written to when the record is in simulation mode. The B field specifies the simulation mode alarm severity. When this field is set to a value other than NO_ALARM and the record is in simulation -mode, it will be put into alarm with this severity and a status of SIMM. +mode, it will be put into alarm with this severity and a status of SIMM_ALARM. -=head3 Simulation Mode +The B field specifies a delay (in seconds) to implement asynchronous +processing in simulation mode. A positive SDLY value will be used as delay +between the first and second phase of processing in simulation mode. +A negative value (default) specifies synchronous processing. + +The B field specifies the SCAN mechanism to be used in simulation mode. +This is specifically useful for 'I/O Intr' scanned records, which would +otherwise never be scanned in simulation mode. + +=head3 Simulation Mode for Output Records An output record can be switched into simulation mode of operation by setting the value of SIMM to YES. During simulation, the record will be put into alarm @@ -198,14 +207,33 @@ return code, and return. =item * -If SIMM is YES, then call C to write the output value from VAL or -OVAL to SIOL. Set alarm status to SIMM and severity to SIMS, if SIMS is -greater than zero. Set status to the return code from C and -return. +If SIMM is YES, then + +=over =item * -If SIMM not one of the above, a SOFT alarm with a severity of INVALID is +Set alarm status to SIMM_ALARM and severity to SIMS, +if SIMS is greater than zero. + +=item * + +If the record simulation processing is synchronous (SDLY < 0) or the record is +in the second phase of an asynchronous processing, call C +to write the output value from VAL or OVAL to SIOL. + +Otherwise (record is in first phase of an asynchronous processing), set up a +callback processing with the delay specified in SDLY. + +=item * + +Set status to the return code from C and return. + +=back + +=item * + +If SIMM is not YES or NO, a SOFT alarm with a severity of INVALID is raised, and return status is set to -1. =back From 799e72b1e338ffb79e1c1f4699a3d56f0cd43706 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 20 May 2020 13:38:09 -0700 Subject: [PATCH 186/216] libCom: actually use libComAPI.h in libCom --- modules/database/src/ioc/db/callback.c | 2 +- modules/database/src/ioc/db/dbAccess.c | 8 +- modules/database/src/ioc/db/dbConvert.c | 4 +- modules/database/src/ioc/db/dbFastLinkConv.c | 4 +- modules/database/src/ioc/db/db_convert.h | 4 +- modules/database/src/ioc/db/recGbl.c | 2 +- .../database/src/ioc/dbStatic/dbFldTypes.h | 2 +- .../database/src/ioc/dbStatic/dbLexRoutines.c | 10 +- .../database/src/ioc/dbStatic/dbStaticLib.c | 2 +- .../database/src/ioc/dbStatic/dbStaticRun.c | 2 +- modules/libcom/src/as/asLib.h | 80 ++++++++-------- modules/libcom/src/as/asLibRoutines.c | 69 +++++++------- modules/libcom/src/as/asTrapWrite.c | 9 +- modules/libcom/src/as/asTrapWrite.h | 6 +- modules/libcom/src/bucketLib/bucketLib.c | 31 +++--- modules/libcom/src/bucketLib/bucketLib.h | 32 +++---- modules/libcom/src/calc/calcPerform.c | 5 +- modules/libcom/src/calc/postfix.c | 9 +- modules/libcom/src/calc/postfix.h | 12 +-- modules/libcom/src/cvtFast/cvtFast.c | 1 - modules/libcom/src/cvtFast/cvtFast.h | 32 +++---- .../libcom/src/cxxTemplates/epicsSingleton.h | 4 +- .../src/cxxTemplates/epicsSingletonMutex.cpp | 1 - modules/libcom/src/cxxTemplates/resourceLib.h | 4 +- modules/libcom/src/dbmf/dbmf.c | 1 - modules/libcom/src/dbmf/dbmf.h | 18 ++-- modules/libcom/src/ellLib/ellLib.c | 1 - modules/libcom/src/ellLib/ellLib.h | 28 +++--- modules/libcom/src/ellLib/ellSort.c | 1 - modules/libcom/src/env/bldEnvData.pl | 6 +- modules/libcom/src/env/envDefs.h | 94 +++++++++---------- modules/libcom/src/env/envSubr.c | 19 ++-- modules/libcom/src/error/errSymLib.c | 1 - modules/libcom/src/error/errSymTbl.h | 16 ++-- modules/libcom/src/error/errlog.c | 3 +- modules/libcom/src/error/errlog.h | 46 ++++----- modules/libcom/src/fdmgr/fdManager.cpp | 11 +-- modules/libcom/src/fdmgr/fdManager.h | 16 ++-- modules/libcom/src/fdmgr/fdmgr.cpp | 39 ++++---- modules/libcom/src/fdmgr/fdmgr.h | 20 ++-- modules/libcom/src/flex/flex.c | 1 - modules/libcom/src/freeList/freeList.h | 14 +-- modules/libcom/src/freeList/freeListLib.c | 13 ++- modules/libcom/src/gpHash/gpHash.h | 18 ++-- modules/libcom/src/gpHash/gpHashLib.c | 17 ++-- modules/libcom/src/iocsh/initHooks.c | 1 - modules/libcom/src/iocsh/initHooks.h | 10 +- modules/libcom/src/iocsh/iocsh.cpp | 23 +++-- modules/libcom/src/iocsh/iocsh.h | 26 ++--- modules/libcom/src/iocsh/libComRegister.c | 3 +- modules/libcom/src/iocsh/libComRegister.h | 4 +- modules/libcom/src/iocsh/registry.c | 13 ++- modules/libcom/src/iocsh/registry.h | 14 +-- modules/libcom/src/log/iocLog.c | 9 +- modules/libcom/src/log/iocLog.h | 10 +- modules/libcom/src/log/logClient.c | 11 +-- modules/libcom/src/log/logClient.h | 14 +-- modules/libcom/src/macLib/macCore.c | 19 ++-- modules/libcom/src/macLib/macEnv.c | 5 +- modules/libcom/src/macLib/macLib.h | 54 +++++------ modules/libcom/src/macLib/macUtil.c | 5 +- modules/libcom/src/misc/aToIPAddr.c | 3 +- modules/libcom/src/misc/adjustment.c | 3 +- modules/libcom/src/misc/adjustment.h | 4 +- modules/libcom/src/misc/alarm.h | 6 +- modules/libcom/src/misc/alarmString.c | 5 +- modules/libcom/src/misc/cantProceed.c | 7 +- modules/libcom/src/misc/cantProceed.h | 8 +- modules/libcom/src/misc/epicsConvert.c | 3 +- modules/libcom/src/misc/epicsConvert.h | 4 +- modules/libcom/src/misc/epicsExit.c | 13 ++- modules/libcom/src/misc/epicsExit.h | 14 +-- modules/libcom/src/misc/epicsStdlib.c | 33 ++++--- modules/libcom/src/misc/epicsStdlib.h | 30 +++--- modules/libcom/src/misc/epicsString.c | 1 - modules/libcom/src/misc/epicsString.h | 30 +++--- modules/libcom/src/misc/epicsTypes.h | 22 ++--- modules/libcom/src/misc/epicsUnitTest.c | 1 - modules/libcom/src/misc/epicsUnitTest.h | 32 +++---- .../src/misc/ipAddrToAsciiAsynchronous.cpp | 1 - .../src/misc/ipAddrToAsciiAsynchronous.h | 8 +- modules/libcom/src/misc/truncateFile.c | 3 +- modules/libcom/src/misc/unixFileName.h | 6 +- modules/libcom/src/osi/devLibVME.c | 1 - modules/libcom/src/osi/devLibVME.h | 56 +++++------ modules/libcom/src/osi/devLibVMEImpl.h | 4 +- modules/libcom/src/osi/epicsAssert.h | 4 +- modules/libcom/src/osi/epicsAtomicDefault.h | 8 +- modules/libcom/src/osi/epicsEvent.cpp | 7 +- modules/libcom/src/osi/epicsEvent.h | 24 ++--- modules/libcom/src/osi/epicsFindSymbol.h | 8 +- modules/libcom/src/osi/epicsGeneralTime.c | 5 +- modules/libcom/src/osi/epicsGeneralTime.h | 18 ++-- modules/libcom/src/osi/epicsInterrupt.h | 10 +- modules/libcom/src/osi/epicsMath.cpp | 5 +- modules/libcom/src/osi/epicsMessageQueue.cpp | 1 - modules/libcom/src/osi/epicsMessageQueue.h | 24 ++--- modules/libcom/src/osi/epicsMutex.cpp | 17 ++-- modules/libcom/src/osi/epicsMutex.h | 22 ++--- modules/libcom/src/osi/epicsReadline.c | 7 +- modules/libcom/src/osi/epicsReadline.h | 8 +- modules/libcom/src/osi/epicsSignal.h | 10 +- modules/libcom/src/osi/epicsSpin.h | 14 +-- modules/libcom/src/osi/epicsStackTrace.c | 1 - modules/libcom/src/osi/epicsStackTrace.h | 6 +- modules/libcom/src/osi/epicsStackTracePvt.h | 8 +- modules/libcom/src/osi/epicsStdio.c | 27 +++--- modules/libcom/src/osi/epicsStdio.h | 32 +++---- modules/libcom/src/osi/epicsTempFile.h | 4 +- modules/libcom/src/osi/epicsThread.cpp | 9 +- modules/libcom/src/osi/epicsThread.h | 80 ++++++++-------- modules/libcom/src/osi/epicsTime.cpp | 41 ++++---- modules/libcom/src/osi/epicsTime.h | 66 ++++++------- modules/libcom/src/osi/generalTimeSup.h | 12 +-- modules/libcom/src/osi/os/Darwin/epicsMath.h | 6 +- modules/libcom/src/osi/os/Darwin/osdEnv.c | 7 +- .../libcom/src/osi/os/Darwin/osdFindAddr.c | 1 - .../libcom/src/osi/os/Darwin/osdMonotonic.c | 1 - modules/libcom/src/osi/os/Darwin/osdTime.cpp | 3 +- modules/libcom/src/osi/os/Darwin/osdTime.h | 2 +- modules/libcom/src/osi/os/Darwin/osdgetexec.c | 1 - modules/libcom/src/osi/os/Linux/osdThread.h | 6 +- .../libcom/src/osi/os/Linux/osdThreadExtra.c | 5 +- modules/libcom/src/osi/os/Linux/osdTime.h | 2 +- modules/libcom/src/osi/os/Linux/osdgetexec.c | 1 - .../libcom/src/osi/os/RTEMS/epicsAtomicOSD.h | 2 +- modules/libcom/src/osi/os/RTEMS/epicsMath.h | 6 +- modules/libcom/src/osi/os/RTEMS/osdEnv.c | 7 +- .../libcom/src/osi/os/RTEMS/osdFindSymbol.c | 7 +- .../libcom/src/osi/os/RTEMS/osdMessageQueue.c | 17 ++-- modules/libcom/src/osi/os/RTEMS/osdMutex.c | 2 +- .../libcom/src/osi/os/RTEMS/osdPoolStatus.c | 3 +- modules/libcom/src/osi/os/RTEMS/osdProcess.c | 5 +- modules/libcom/src/osi/os/RTEMS/osdSignal.cpp | 9 +- modules/libcom/src/osi/os/RTEMS/osdThread.c | 10 +- .../libcom/src/osi/os/RTEMS/osdThreadExtra.c | 5 +- modules/libcom/src/osi/os/WIN32/epicsGetopt.c | 5 +- modules/libcom/src/osi/os/WIN32/epicsGetopt.h | 8 +- modules/libcom/src/osi/os/WIN32/epicsMath.h | 6 +- .../WIN32/epicsSocketConvertErrnoToString.cpp | 1 - .../libcom/src/osi/os/WIN32/epicsTempFile.c | 3 +- .../libcom/src/osi/os/WIN32/osdBackTrace.cpp | 1 - modules/libcom/src/osi/os/WIN32/osdEnv.c | 7 +- modules/libcom/src/osi/os/WIN32/osdEvent.c | 17 ++-- modules/libcom/src/osi/os/WIN32/osdFindAddr.c | 1 - .../libcom/src/osi/os/WIN32/osdFindSymbol.c | 7 +- .../libcom/src/osi/os/WIN32/osdMonotonic.c | 1 - modules/libcom/src/osi/os/WIN32/osdMutex.c | 3 +- modules/libcom/src/osi/os/WIN32/osdNetIntf.c | 5 +- .../libcom/src/osi/os/WIN32/osdPoolStatus.c | 3 +- modules/libcom/src/osi/os/WIN32/osdProcess.c | 5 +- modules/libcom/src/osi/os/WIN32/osdSignal.cpp | 9 +- modules/libcom/src/osi/os/WIN32/osdSock.c | 17 ++-- modules/libcom/src/osi/os/WIN32/osdSock.h | 2 +- .../src/osi/os/WIN32/osdSockUnsentCount.c | 1 - modules/libcom/src/osi/os/WIN32/osdStdio.c | 5 +- modules/libcom/src/osi/os/WIN32/osdStrtod.h | 2 +- modules/libcom/src/osi/os/WIN32/osdThread.c | 59 ++++++------ .../libcom/src/osi/os/WIN32/osdThreadExtra.c | 5 +- modules/libcom/src/osi/os/WIN32/osdTime.cpp | 5 +- modules/libcom/src/osi/os/WIN32/osdgetexec.c | 1 - modules/libcom/src/osi/os/WIN32/osiFileName.h | 6 +- .../src/osi/os/WIN32/systemCallIntMech.cpp | 1 - .../libcom/src/osi/os/cygwin32/devLibVMEOSD.c | 3 +- .../libcom/src/osi/os/cygwin32/osdStrtod.h | 2 +- .../libcom/src/osi/os/cygwin32/osiFileName.h | 6 +- .../src/osi/os/cygwin32/systemCallIntMech.cpp | 1 - .../libcom/src/osi/os/default/devLibVMEOSD.c | 3 +- .../libcom/src/osi/os/default/epicsMMIODef.h | 2 +- .../epicsSocketConvertErrnoToString.cpp | 1 - modules/libcom/src/osi/os/default/osdAssert.c | 1 - .../src/osi/os/default/osdBackTrace.cpp | 1 - modules/libcom/src/osi/os/default/osdEnv.c | 7 +- .../libcom/src/osi/os/default/osdFindAddr.c | 1 - .../libcom/src/osi/os/default/osdFindSymbol.c | 7 +- .../libcom/src/osi/os/default/osdInterrupt.c | 9 +- .../src/osi/os/default/osdMessageQueue.cpp | 21 ++--- .../libcom/src/osi/os/default/osdNetIntf.c | 5 +- .../libcom/src/osi/os/default/osdPoolStatus.c | 3 +- .../libcom/src/osi/os/default/osdSignal.cpp | 9 +- .../src/osi/os/default/osdSockAddrReuse.cpp | 5 +- modules/libcom/src/osi/os/default/osdSpin.c | 1 - .../src/osi/os/default/osdThreadExtra.c | 5 +- .../src/osi/os/default/osdThreadHooks.c | 15 ++- .../libcom/src/osi/os/default/osdgetexec.c | 1 - modules/libcom/src/osi/os/freebsd/osdTime.h | 2 +- .../libcom/src/osi/os/freebsd/osdgetexec.c | 1 - modules/libcom/src/osi/os/iOS/epicsMath.h | 6 +- modules/libcom/src/osi/os/iOS/osdEnv.c | 7 +- modules/libcom/src/osi/os/iOS/osdMonotonic.c | 1 - modules/libcom/src/osi/os/iOS/osdTime.h | 2 +- .../src/osi/os/posix/epicsAtomicOSD.cpp | 1 - .../libcom/src/osi/os/posix/epicsAtomicOSD.h | 8 +- modules/libcom/src/osi/os/posix/epicsMath.h | 6 +- .../libcom/src/osi/os/posix/epicsTempFile.c | 3 +- .../libcom/src/osi/os/posix/osdElfFindAddr.c | 3 +- modules/libcom/src/osi/os/posix/osdEvent.c | 15 ++- .../src/osi/os/posix/osdExecinfoBackTrace.cpp | 1 - .../libcom/src/osi/os/posix/osdFindSymbol.c | 7 +- .../libcom/src/osi/os/posix/osdMonotonic.c | 1 - modules/libcom/src/osi/os/posix/osdMutex.c | 1 - modules/libcom/src/osi/os/posix/osdProcess.c | 5 +- modules/libcom/src/osi/os/posix/osdSignal.cpp | 9 +- modules/libcom/src/osi/os/posix/osdSock.c | 11 +-- modules/libcom/src/osi/os/posix/osdSpin.c | 1 - modules/libcom/src/osi/os/posix/osdStdio.c | 5 +- modules/libcom/src/osi/os/posix/osdThread.c | 65 +++++++------ modules/libcom/src/osi/os/posix/osdThread.h | 6 +- .../libcom/src/osi/os/posix/osdThreadExtra.c | 5 +- modules/libcom/src/osi/os/posix/osdTime.cpp | 3 +- modules/libcom/src/osi/os/posix/osdTime.h | 2 +- .../src/osi/os/posix/systemCallIntMech.cpp | 1 - .../src/osi/os/solaris/epicsAtomicOSD.h | 6 +- modules/libcom/src/osi/os/solaris/epicsMath.h | 6 +- .../src/osi/os/solaris/osdBackTrace.cpp | 1 - modules/libcom/src/osi/os/solaris/osdEnv.c | 7 +- modules/libcom/src/osi/os/solaris/osdStrtod.h | 2 +- .../libcom/src/osi/os/solaris/osdgetexec.c | 1 - modules/libcom/src/osi/os/vxWorks/epicsMath.h | 6 +- modules/libcom/src/osi/os/vxWorks/osdEnv.c | 7 +- .../libcom/src/osi/os/vxWorks/osdFindSymbol.c | 4 +- .../src/osi/os/vxWorks/osdMessageQueue.cpp | 5 +- .../libcom/src/osi/os/vxWorks/osdPoolStatus.c | 3 +- .../libcom/src/osi/os/vxWorks/osdProcess.c | 5 +- .../libcom/src/osi/os/vxWorks/osdSignal.cpp | 9 +- modules/libcom/src/osi/os/vxWorks/osdSock.c | 11 +-- modules/libcom/src/osi/os/vxWorks/osdThread.c | 6 +- .../src/osi/os/vxWorks/osdThreadExtra.c | 5 +- modules/libcom/src/osi/osiClockTime.c | 1 - modules/libcom/src/osi/osiNTPTime.c | 1 - modules/libcom/src/osi/osiPoolStatus.h | 4 +- modules/libcom/src/osi/osiProcess.h | 6 +- modules/libcom/src/osi/osiSock.c | 11 +-- modules/libcom/src/osi/osiSock.h | 44 ++++----- modules/libcom/src/pool/epicsThreadPool.h | 32 +++---- modules/libcom/src/pool/poolJob.c | 1 - modules/libcom/src/pool/threadPool.c | 5 +- modules/libcom/src/ring/epicsRingBytes.c | 27 +++--- modules/libcom/src/ring/epicsRingBytes.h | 28 +++--- modules/libcom/src/ring/epicsRingPointer.cpp | 27 +++--- modules/libcom/src/ring/epicsRingPointer.h | 28 +++--- modules/libcom/src/taskwd/taskwd.c | 3 +- modules/libcom/src/taskwd/taskwd.h | 18 ++-- modules/libcom/src/timer/epicsTimer.cpp | 41 ++++---- modules/libcom/src/timer/epicsTimer.h | 58 ++++++------ modules/libcom/src/timer/timer.cpp | 1 - modules/libcom/src/timer/timerQueue.cpp | 1 - modules/libcom/src/timer/timerQueueActive.cpp | 1 - .../libcom/src/timer/timerQueueActiveMgr.cpp | 1 - .../libcom/src/timer/timerQueuePassive.cpp | 1 - 250 files changed, 1286 insertions(+), 1434 deletions(-) diff --git a/modules/database/src/ioc/db/callback.c b/modules/database/src/ioc/db/callback.c index bbd798ed4..c2272a4f4 100644 --- a/modules/database/src/ioc/db/callback.c +++ b/modules/database/src/ioc/db/callback.c @@ -65,7 +65,7 @@ static cbQueueSet callbackQueue[NUM_CALLBACK_PRIORITIES]; int callbackThreadsDefault = 1; /* Don't know what a reasonable default is (yet). * For the time being: parallel means 2 if not explicitly specified */ -epicsShareDef int callbackParallelThreadsDefault = 2; +int callbackParallelThreadsDefault = 2; epicsExportAddress(int,callbackParallelThreadsDefault); /* Timer for Delayed Requests */ diff --git a/modules/database/src/ioc/db/dbAccess.c b/modules/database/src/ioc/db/dbAccess.c index b2788b0d9..799b6a79f 100644 --- a/modules/database/src/ioc/db/dbAccess.c +++ b/modules/database/src/ioc/db/dbAccess.c @@ -62,15 +62,15 @@ #include "recSup.h" #include "special.h" -epicsShareDef struct dbBase *pdbbase = 0; -epicsShareDef volatile int interruptAccept=FALSE; +struct dbBase *pdbbase = 0; +volatile int interruptAccept=FALSE; -epicsShareDef int dbAccessDebugPUTF = 0; +int dbAccessDebugPUTF = 0; epicsExportAddress(int, dbAccessDebugPUTF); /* Hook Routines */ -epicsShareDef DB_LOAD_RECORDS_HOOK_ROUTINE dbLoadRecordsHook = NULL; +DB_LOAD_RECORDS_HOOK_ROUTINE dbLoadRecordsHook = NULL; static short mapDBFToDBR[DBF_NTYPES] = { /* DBF_STRING => */ DBR_STRING, diff --git a/modules/database/src/ioc/db/dbConvert.c b/modules/database/src/ioc/db/dbConvert.c index 5d2c71f4c..a1654c6ad 100644 --- a/modules/database/src/ioc/db/dbConvert.c +++ b/modules/database/src/ioc/db/dbConvert.c @@ -1704,7 +1704,7 @@ static long putEnumEnum PUT_NOCONVERT(epicsEnum16, epicsEnum16) DBR_FLOAT, DBR_DOUBLE, DBR_ENUM ***************************************************************************/ -epicsShareDef GETCONVERTFUNC dbGetConvertRoutine[DBF_DEVICE+1][DBR_ENUM+1] = { +GETCONVERTFUNC dbGetConvertRoutine[DBF_DEVICE+1][DBR_ENUM+1] = { /* source is a DBF_STRING */ {getStringString, getStringChar, getStringUchar, getStringShort, getStringUshort, @@ -1775,7 +1775,7 @@ epicsShareDef GETCONVERTFUNC dbGetConvertRoutine[DBF_DEVICE+1][DBR_ENUM+1] = { DBF_MENU, DBF_DEVICE ***************************************************************************/ -epicsShareDef PUTCONVERTFUNC dbPutConvertRoutine[DBR_ENUM+1][DBF_DEVICE+1] = { +PUTCONVERTFUNC dbPutConvertRoutine[DBR_ENUM+1][DBF_DEVICE+1] = { /* source is a DBR_STRING */ {putStringString, putStringChar, putStringUchar, putStringShort, putStringUshort, putStringLong, putStringUlong, putStringInt64, putStringUInt64, diff --git a/modules/database/src/ioc/db/dbFastLinkConv.c b/modules/database/src/ioc/db/dbFastLinkConv.c index 1d94bc95e..9c719890b 100644 --- a/modules/database/src/ioc/db/dbFastLinkConv.c +++ b/modules/database/src/ioc/db/dbFastLinkConv.c @@ -1390,7 +1390,7 @@ static long cvt_device_st( * NULL implies the conversion is not supported. */ -epicsShareDef long (*dbFastGetConvertRoutine[DBF_DEVICE+1][DBR_ENUM+1])() = { +long (*dbFastGetConvertRoutine[DBF_DEVICE+1][DBR_ENUM+1])() = { /* Convert DBF_STRING to ... */ { cvt_st_st, cvt_st_c, cvt_st_uc, cvt_st_s, cvt_st_us, cvt_st_l, cvt_st_ul, cvt_st_q, cvt_st_uq, cvt_st_f, cvt_st_d, cvt_st_e }, @@ -1446,7 +1446,7 @@ epicsShareDef long (*dbFastGetConvertRoutine[DBF_DEVICE+1][DBR_ENUM+1])() = { * NULL implies the conversion is not supported. */ -epicsShareDef long (*dbFastPutConvertRoutine[DBR_ENUM+1][DBF_DEVICE+1])() = { +long (*dbFastPutConvertRoutine[DBR_ENUM+1][DBF_DEVICE+1])() = { /* Convert DBR_STRING to ... */ { cvt_st_st, cvt_st_c, cvt_st_uc, cvt_st_s, cvt_st_us, cvt_st_l, cvt_st_ul, cvt_st_q, cvt_st_uq, cvt_st_f, cvt_st_d, cvt_st_e, cvt_st_menu, cvt_st_device}, diff --git a/modules/database/src/ioc/db/db_convert.h b/modules/database/src/ioc/db/db_convert.h index d06164f02..530eba569 100644 --- a/modules/database/src/ioc/db/db_convert.h +++ b/modules/database/src/ioc/db/db_convert.h @@ -40,7 +40,7 @@ epicsShareExtern long (*dbFastPutConvertRoutine[newDBR_ENUM+1][newDBF_DEVICE+1]) epicsShareExtern unsigned short dbDBRoldToDBFnew[DBR_DOUBLE+1]; epicsShareExtern unsigned short dbDBRnewToDBRold[newDBR_ENUM+1]; #ifdef DB_CONVERT_GBLSOURCE -epicsShareDef unsigned short dbDBRoldToDBFnew[DBR_DOUBLE+1] = { +unsigned short dbDBRoldToDBFnew[DBR_DOUBLE+1] = { 0, /*DBR_STRING to DBF_STRING*/ 3, /*DBR_INT to DBF_SHORT*/ 9, /*DBR_FLOAT to DBF_FLOAT*/ @@ -49,7 +49,7 @@ epicsShareDef unsigned short dbDBRoldToDBFnew[DBR_DOUBLE+1] = { 5, /*DBR_LONG to DBF_LONG*/ 10 /*DBR_DOUBLE to DBF_DOUBLE*/ }; -epicsShareDef unsigned short dbDBRnewToDBRold[newDBR_ENUM+1] = { +unsigned short dbDBRnewToDBRold[newDBR_ENUM+1] = { 0, /*DBR_STRING to DBR_STRING*/ 4, /*DBR_CHAR to DBR_CHAR*/ 4, /*DBR_UCHAR to DBR_CHAR*/ diff --git a/modules/database/src/ioc/db/recGbl.c b/modules/database/src/ioc/db/recGbl.c index 50d27b15b..8fd90bbda 100644 --- a/modules/database/src/ioc/db/recGbl.c +++ b/modules/database/src/ioc/db/recGbl.c @@ -48,7 +48,7 @@ /* Hook Routines */ -epicsShareDef RECGBL_ALARM_HOOK_ROUTINE recGblAlarmHook = NULL; +RECGBL_ALARM_HOOK_ROUTINE recGblAlarmHook = NULL; /* local routines */ static void getMaxRangeValues(short field_type, double *pupper_limit, diff --git a/modules/database/src/ioc/dbStatic/dbFldTypes.h b/modules/database/src/ioc/dbStatic/dbFldTypes.h index ba1a69573..5a2848951 100644 --- a/modules/database/src/ioc/dbStatic/dbFldTypes.h +++ b/modules/database/src/ioc/dbStatic/dbFldTypes.h @@ -50,7 +50,7 @@ typedef struct mapdbfType{ epicsShareExtern mapdbfType pamapdbfType[]; #ifdef DBFLDTYPES_GBLSOURCE -epicsShareDef mapdbfType pamapdbfType[DBF_NTYPES] = { +mapdbfType pamapdbfType[DBF_NTYPES] = { {"DBF_STRING",DBF_STRING}, {"DBF_CHAR",DBF_CHAR}, {"DBF_UCHAR",DBF_UCHAR}, diff --git a/modules/database/src/ioc/dbStatic/dbLexRoutines.c b/modules/database/src/ioc/dbStatic/dbLexRoutines.c index 628b8e0d2..e06070b0a 100644 --- a/modules/database/src/ioc/dbStatic/dbLexRoutines.c +++ b/modules/database/src/ioc/dbStatic/dbLexRoutines.c @@ -40,18 +40,18 @@ /*global declarations*/ -epicsShareDef char *makeDbdDepends=0; +char *makeDbdDepends=0; -epicsShareDef int dbRecordsOnceOnly=0; +int dbRecordsOnceOnly=0; epicsExportAddress(int,dbRecordsOnceOnly); -epicsShareDef int dbBptNotMonotonic=0; +int dbBptNotMonotonic=0; epicsExportAddress(int,dbBptNotMonotonic); -epicsShareDef int dbQuietMacroWarnings=0; +int dbQuietMacroWarnings=0; epicsExportAddress(int,dbQuietMacroWarnings); -epicsShareDef int dbRecordsAbcSorted=0; +int dbRecordsAbcSorted=0; epicsExportAddress(int,dbRecordsAbcSorted); /*private routines */ diff --git a/modules/database/src/ioc/dbStatic/dbStaticLib.c b/modules/database/src/ioc/dbStatic/dbStaticLib.c index 7f5f1f885..d05ca15e1 100644 --- a/modules/database/src/ioc/dbStatic/dbStaticLib.c +++ b/modules/database/src/ioc/dbStatic/dbStaticLib.c @@ -60,7 +60,7 @@ STATIC_ASSERT(messagesize >= 21); static char *ppstring[5]={" NPP"," PP"," CA"," CP"," CPP"}; static char *msstring[4]={" NMS"," MS"," MSI"," MSS"}; -epicsShareDef maplinkType pamaplinkType[LINK_NTYPES] = { +maplinkType pamaplinkType[LINK_NTYPES] = { {"CONSTANT",CONSTANT}, {"PV_LINK",PV_LINK}, {"VME_IO",VME_IO}, diff --git a/modules/database/src/ioc/dbStatic/dbStaticRun.c b/modules/database/src/ioc/dbStatic/dbStaticRun.c index 46cbf982a..461bf5894 100644 --- a/modules/database/src/ioc/dbStatic/dbStaticRun.c +++ b/modules/database/src/ioc/dbStatic/dbStaticRun.c @@ -31,7 +31,7 @@ #include "devSup.h" #include "special.h" -epicsShareDef int dbConvertStrict = 0; +int dbConvertStrict = 0; epicsExportAddress(int, dbConvertStrict); static long do_nothing(struct dbCommon *precord) { return 0; } diff --git a/modules/libcom/src/as/asLib.h b/modules/libcom/src/as/asLib.h index 528ce6ed9..652e9d56f 100644 --- a/modules/libcom/src/as/asLib.h +++ b/modules/libcom/src/as/asLib.h @@ -12,7 +12,7 @@ #ifndef INCasLibh #define INCasLibh -#include "shareLib.h" +#include "libComAPI.h" #include "ellLib.h" #include "errMdef.h" #include "errlog.h" @@ -24,7 +24,7 @@ extern "C" { /* 0 - Use (unverified) client provided host name string. * 1 - Use actual client IP address. HAG() are resolved to IPs at ACF load time. */ -epicsShareExtern int asCheckClientIP; +LIBCOM_API extern int asCheckClientIP; typedef struct asgMember *ASMEMBERPVT; typedef struct asgClient *ASCLIENTPVT; @@ -67,63 +67,63 @@ void *asTrapWriteBefore(ASCLIENTPVT asClientPvt, asTrapWriteWithData(asClientPvt, user, host, addr, 0, 0, NULL) -epicsShareFunc long epicsShareAPI asInitialize(ASINPUTFUNCPTR inputfunction); -epicsShareFunc long epicsShareAPI asInitFile( +LIBCOM_API long epicsStdCall asInitialize(ASINPUTFUNCPTR inputfunction); +LIBCOM_API long epicsStdCall asInitFile( const char *filename,const char *substitutions); -epicsShareFunc long epicsShareAPI asInitFP(FILE *fp,const char *substitutions); -epicsShareFunc long epicsShareAPI asInitMem(const char *acf, const char *substitutions); +LIBCOM_API long epicsStdCall asInitFP(FILE *fp,const char *substitutions); +LIBCOM_API long epicsStdCall asInitMem(const char *acf, const char *substitutions); /*caller must provide permanent storage for asgName*/ -epicsShareFunc long epicsShareAPI asAddMember( +LIBCOM_API long epicsStdCall asAddMember( ASMEMBERPVT *asMemberPvt,const char *asgName); -epicsShareFunc long epicsShareAPI asRemoveMember(ASMEMBERPVT *asMemberPvt); +LIBCOM_API long epicsStdCall asRemoveMember(ASMEMBERPVT *asMemberPvt); /*caller must provide permanent storage for newAsgName*/ -epicsShareFunc long epicsShareAPI asChangeGroup( +LIBCOM_API long epicsStdCall asChangeGroup( ASMEMBERPVT *asMemberPvt,const char *newAsgName); -epicsShareFunc void * epicsShareAPI asGetMemberPvt(ASMEMBERPVT asMemberPvt); -epicsShareFunc void epicsShareAPI asPutMemberPvt( +LIBCOM_API void * epicsStdCall asGetMemberPvt(ASMEMBERPVT asMemberPvt); +LIBCOM_API void epicsStdCall asPutMemberPvt( ASMEMBERPVT asMemberPvt,void *userPvt); /*client must provide permanent storage for user and host*/ -epicsShareFunc long epicsShareAPI asAddClient( +LIBCOM_API long epicsStdCall asAddClient( ASCLIENTPVT *asClientPvt,ASMEMBERPVT asMemberPvt, int asl,const char *user,char *host); /*client must provide permanent storage for user and host*/ -epicsShareFunc long epicsShareAPI asChangeClient( +LIBCOM_API long epicsStdCall asChangeClient( ASCLIENTPVT asClientPvt,int asl,const char *user,char *host); -epicsShareFunc long epicsShareAPI asRemoveClient(ASCLIENTPVT *asClientPvt); -epicsShareFunc void * epicsShareAPI asGetClientPvt(ASCLIENTPVT asClientPvt); -epicsShareFunc void epicsShareAPI asPutClientPvt( +LIBCOM_API long epicsStdCall asRemoveClient(ASCLIENTPVT *asClientPvt); +LIBCOM_API void * epicsStdCall asGetClientPvt(ASCLIENTPVT asClientPvt); +LIBCOM_API void epicsStdCall asPutClientPvt( ASCLIENTPVT asClientPvt,void *userPvt); -epicsShareFunc long epicsShareAPI asRegisterClientCallback( +LIBCOM_API long epicsStdCall asRegisterClientCallback( ASCLIENTPVT asClientPvt, ASCLIENTCALLBACK pcallback); -epicsShareFunc long epicsShareAPI asComputeAllAsg(void); +LIBCOM_API long epicsStdCall asComputeAllAsg(void); /* following declared below after ASG is declared -epicsShareFunc long epicsShareAPI asComputeAsg(ASG *pasg); +LIBCOM_API long epicsStdCall asComputeAsg(ASG *pasg); */ -epicsShareFunc long epicsShareAPI asCompute(ASCLIENTPVT asClientPvt); -epicsShareFunc int epicsShareAPI asDump( +LIBCOM_API long epicsStdCall asCompute(ASCLIENTPVT asClientPvt); +LIBCOM_API int epicsStdCall asDump( void (*memcallback)(ASMEMBERPVT,FILE *), void (*clientcallback)(ASCLIENTPVT,FILE *),int verbose); -epicsShareFunc int epicsShareAPI asDumpFP(FILE *fp, +LIBCOM_API int epicsStdCall asDumpFP(FILE *fp, void (*memcallback)(ASMEMBERPVT,FILE *), void (*clientcallback)(ASCLIENTPVT,FILE *),int verbose); -epicsShareFunc int epicsShareAPI asDumpUag(const char *uagname); -epicsShareFunc int epicsShareAPI asDumpUagFP(FILE *fp,const char *uagname); -epicsShareFunc int epicsShareAPI asDumpHag(const char *hagname); -epicsShareFunc int epicsShareAPI asDumpHagFP(FILE *fp,const char *hagname); -epicsShareFunc int epicsShareAPI asDumpRules(const char *asgname); -epicsShareFunc int epicsShareAPI asDumpRulesFP(FILE *fp,const char *asgname); -epicsShareFunc int epicsShareAPI asDumpMem(const char *asgname, +LIBCOM_API int epicsStdCall asDumpUag(const char *uagname); +LIBCOM_API int epicsStdCall asDumpUagFP(FILE *fp,const char *uagname); +LIBCOM_API int epicsStdCall asDumpHag(const char *hagname); +LIBCOM_API int epicsStdCall asDumpHagFP(FILE *fp,const char *hagname); +LIBCOM_API int epicsStdCall asDumpRules(const char *asgname); +LIBCOM_API int epicsStdCall asDumpRulesFP(FILE *fp,const char *asgname); +LIBCOM_API int epicsStdCall asDumpMem(const char *asgname, void (*memcallback)(ASMEMBERPVT,FILE *),int clients); -epicsShareFunc int epicsShareAPI asDumpMemFP(FILE *fp,const char *asgname, +LIBCOM_API int epicsStdCall asDumpMemFP(FILE *fp,const char *asgname, void (*memcallback)(ASMEMBERPVT,FILE *),int clients); -epicsShareFunc int epicsShareAPI asDumpHash(void); -epicsShareFunc int epicsShareAPI asDumpHashFP(FILE *fp); +LIBCOM_API int epicsStdCall asDumpHash(void); +LIBCOM_API int epicsStdCall asDumpHashFP(FILE *fp); -epicsShareFunc void * epicsShareAPI asTrapWriteBeforeWithData( +LIBCOM_API void * epicsStdCall asTrapWriteBeforeWithData( const char *userid, const char *hostid, void *addr, int dbrType, int no_elements, void *data); -epicsShareFunc void epicsShareAPI asTrapWriteAfterWrite(void *pvt); +LIBCOM_API void epicsStdCall asTrapWriteAfterWrite(void *pvt); #define S_asLib_clientsExist (M_asLib| 1) /*Client Exists*/ #define S_asLib_noUag (M_asLib| 2) /*User Access Group does not exist*/ @@ -141,7 +141,7 @@ epicsShareFunc void epicsShareAPI asTrapWriteAfterWrite(void *pvt); #define S_asLib_noMemory (M_asLib|14) /*access security: no Memory */ /*Private declarations */ -epicsShareExtern int asActive; +LIBCOM_API extern int asActive; /* definition of access rights*/ typedef enum{asNOACCESS,asREAD,asWRITE} asAccessRights; @@ -156,7 +156,7 @@ typedef struct asBase{ struct gphPvt *phash; } ASBASE; -epicsShareExtern volatile ASBASE *pasbase; +LIBCOM_API extern volatile ASBASE *pasbase; /*Defs for User Access Groups*/ typedef struct{ @@ -238,11 +238,11 @@ typedef struct asgClient { int trapMask; } ASGCLIENT; -epicsShareFunc long epicsShareAPI asComputeAsg(ASG *pasg); +LIBCOM_API long epicsStdCall asComputeAsg(ASG *pasg); /*following is "friend" function*/ -epicsShareFunc void * epicsShareAPI asCalloc(size_t nobj,size_t size); -epicsShareFunc char * epicsShareAPI asStrdup(unsigned char *str); -epicsShareFunc void asFreeAll(ASBASE *pasbase); +LIBCOM_API void * epicsStdCall asCalloc(size_t nobj,size_t size); +LIBCOM_API char * epicsStdCall asStrdup(unsigned char *str); +LIBCOM_API void asFreeAll(ASBASE *pasbase); #ifdef __cplusplus } #endif diff --git a/modules/libcom/src/as/asLibRoutines.c b/modules/libcom/src/as/asLibRoutines.c index e19b63990..1d9f80cb1 100644 --- a/modules/libcom/src/as/asLibRoutines.c +++ b/modules/libcom/src/as/asLibRoutines.c @@ -14,7 +14,6 @@ #include #include -#define epicsExportSharedSymbols #include "osiSock.h" #include "epicsTypes.h" #include "epicsStdio.h" @@ -36,9 +35,9 @@ static epicsMutexId asLock; #define UNLOCK epicsMutexUnlock(asLock) /*following must be global because asCa nneeds it*/ -epicsShareDef ASBASE volatile *pasbase=NULL; +ASBASE volatile *pasbase=NULL; static ASBASE *pasbasenew=NULL; -epicsShareDef int asActive = FALSE; +int asActive = FALSE; static void *freeListPvt = NULL; @@ -82,7 +81,7 @@ static void asInitializeOnce(void *arg) osiSockAttach(); asLock = epicsMutexMustCreate(); } -long epicsShareAPI asInitialize(ASINPUTFUNCPTR inputfunction) +long epicsStdCall asInitialize(ASINPUTFUNCPTR inputfunction) { ASG *pasg; long status; @@ -167,7 +166,7 @@ long epicsShareAPI asInitialize(ASINPUTFUNCPTR inputfunction) return(0); } -long epicsShareAPI asInitFile(const char *filename,const char *substitutions) +long epicsStdCall asInitFile(const char *filename,const char *substitutions) { FILE *fp; long status; @@ -222,7 +221,7 @@ static int myInputFunction(char *buf, int max_size) return(n); } -long epicsShareAPI asInitFP(FILE *fp,const char *substitutions) +long epicsStdCall asInitFP(FILE *fp,const char *substitutions) { char buffer[BUF_SIZE]; char mac_buffer[BUF_SIZE]; @@ -272,7 +271,7 @@ static int memInputFunction(char *buf, int max_size) return ret; } -long epicsShareAPI asInitMem(const char *acf, const char *substitutions) +long epicsStdCall asInitMem(const char *acf, const char *substitutions) { long ret = S_asLib_InitFailed; if(!acf) return ret; @@ -284,7 +283,7 @@ long epicsShareAPI asInitMem(const char *acf, const char *substitutions) return ret; } -long epicsShareAPI asAddMember(ASMEMBERPVT *pasMemberPvt,const char *asgName) +long epicsStdCall asAddMember(ASMEMBERPVT *pasMemberPvt,const char *asgName) { long status; @@ -295,7 +294,7 @@ long epicsShareAPI asAddMember(ASMEMBERPVT *pasMemberPvt,const char *asgName) return(status); } -long epicsShareAPI asRemoveMember(ASMEMBERPVT *asMemberPvt) +long epicsStdCall asRemoveMember(ASMEMBERPVT *asMemberPvt) { ASGMEMBER *pasgmember; @@ -320,7 +319,7 @@ long epicsShareAPI asRemoveMember(ASMEMBERPVT *asMemberPvt) return(0); } -long epicsShareAPI asChangeGroup(ASMEMBERPVT *asMemberPvt,const char *newAsgName) +long epicsStdCall asChangeGroup(ASMEMBERPVT *asMemberPvt,const char *newAsgName) { ASGMEMBER *pasgmember; long status; @@ -341,7 +340,7 @@ long epicsShareAPI asChangeGroup(ASMEMBERPVT *asMemberPvt,const char *newAsgName return(status); } -void * epicsShareAPI asGetMemberPvt(ASMEMBERPVT asMemberPvt) +void * epicsStdCall asGetMemberPvt(ASMEMBERPVT asMemberPvt) { ASGMEMBER *pasgmember = asMemberPvt; @@ -350,7 +349,7 @@ void * epicsShareAPI asGetMemberPvt(ASMEMBERPVT asMemberPvt) return(pasgmember->userPvt); } -void epicsShareAPI asPutMemberPvt(ASMEMBERPVT asMemberPvt,void *userPvt) +void epicsStdCall asPutMemberPvt(ASMEMBERPVT asMemberPvt,void *userPvt) { ASGMEMBER *pasgmember = asMemberPvt; @@ -360,7 +359,7 @@ void epicsShareAPI asPutMemberPvt(ASMEMBERPVT asMemberPvt,void *userPvt) return; } -long epicsShareAPI asAddClient(ASCLIENTPVT *pasClientPvt,ASMEMBERPVT asMemberPvt, +long epicsStdCall asAddClient(ASCLIENTPVT *pasClientPvt,ASMEMBERPVT asMemberPvt, int asl,const char *user,char *host) { ASGMEMBER *pasgmember = asMemberPvt; @@ -388,7 +387,7 @@ long epicsShareAPI asAddClient(ASCLIENTPVT *pasClientPvt,ASMEMBERPVT asMemberPvt return(status); } -long epicsShareAPI asChangeClient( +long epicsStdCall asChangeClient( ASCLIENTPVT asClientPvt,int asl,const char *user,char *host) { ASGCLIENT *pasgclient = asClientPvt; @@ -410,7 +409,7 @@ long epicsShareAPI asChangeClient( return(status); } -long epicsShareAPI asRemoveClient(ASCLIENTPVT *asClientPvt) +long epicsStdCall asRemoveClient(ASCLIENTPVT *asClientPvt) { ASGCLIENT *pasgclient = *asClientPvt; ASGMEMBER *pasgMember; @@ -431,7 +430,7 @@ long epicsShareAPI asRemoveClient(ASCLIENTPVT *asClientPvt) return(0); } -long epicsShareAPI asRegisterClientCallback(ASCLIENTPVT asClientPvt, +long epicsStdCall asRegisterClientCallback(ASCLIENTPVT asClientPvt, ASCLIENTCALLBACK pcallback) { ASGCLIENT *pasgclient = asClientPvt; @@ -445,7 +444,7 @@ long epicsShareAPI asRegisterClientCallback(ASCLIENTPVT asClientPvt, return(0); } -void * epicsShareAPI asGetClientPvt(ASCLIENTPVT asClientPvt) +void * epicsStdCall asGetClientPvt(ASCLIENTPVT asClientPvt) { ASGCLIENT *pasgclient = asClientPvt; @@ -454,7 +453,7 @@ void * epicsShareAPI asGetClientPvt(ASCLIENTPVT asClientPvt) return(pasgclient->userPvt); } -void epicsShareAPI asPutClientPvt(ASCLIENTPVT asClientPvt,void *userPvt) +void epicsStdCall asPutClientPvt(ASCLIENTPVT asClientPvt,void *userPvt) { ASGCLIENT *pasgclient = asClientPvt; if(!asActive) return; @@ -464,7 +463,7 @@ void epicsShareAPI asPutClientPvt(ASCLIENTPVT asClientPvt,void *userPvt) UNLOCK; } -long epicsShareAPI asComputeAllAsg(void) +long epicsStdCall asComputeAllAsg(void) { long status; @@ -475,7 +474,7 @@ long epicsShareAPI asComputeAllAsg(void) return(status); } -long epicsShareAPI asComputeAsg(ASG *pasg) +long epicsStdCall asComputeAsg(ASG *pasg) { long status; @@ -486,7 +485,7 @@ long epicsShareAPI asComputeAsg(ASG *pasg) return(status); } -long epicsShareAPI asCompute(ASCLIENTPVT asClientPvt) +long epicsStdCall asCompute(ASCLIENTPVT asClientPvt) { long status; @@ -502,7 +501,7 @@ long epicsShareAPI asCompute(ASCLIENTPVT asClientPvt) static const char *asAccessName[] = {"NONE","READ","WRITE"}; static const char *asTrapOption[] = {"NOTRAPWRITE","TRAPWRITE"}; static const char *asLevelName[] = {"ASL0","ASL1"}; -int epicsShareAPI asDump( +int epicsStdCall asDump( void (*memcallback)(struct asgMember *,FILE *), void (*clientcallback)(struct asgClient *,FILE *), int verbose) @@ -510,7 +509,7 @@ int epicsShareAPI asDump( return asDumpFP(stdout,memcallback,clientcallback,verbose); } -int epicsShareAPI asDumpFP( +int epicsStdCall asDumpFP( FILE *fp, void (*memcallback)(struct asgMember *,FILE *), void (*clientcallback)(struct asgClient *,FILE *), @@ -655,12 +654,12 @@ int epicsShareAPI asDumpFP( return(0); } -int epicsShareAPI asDumpUag(const char *uagname) +int epicsStdCall asDumpUag(const char *uagname) { return asDumpUagFP(stdout,uagname); } -int epicsShareAPI asDumpUagFP(FILE *fp,const char *uagname) +int epicsStdCall asDumpUagFP(FILE *fp,const char *uagname) { UAG *puag; UAGNAME *puagname; @@ -686,12 +685,12 @@ int epicsShareAPI asDumpUagFP(FILE *fp,const char *uagname) return(0); } -int epicsShareAPI asDumpHag(const char *hagname) +int epicsStdCall asDumpHag(const char *hagname) { return asDumpHagFP(stdout,hagname); } -int epicsShareAPI asDumpHagFP(FILE *fp,const char *hagname) +int epicsStdCall asDumpHagFP(FILE *fp,const char *hagname) { HAG *phag; HAGNAME *phagname; @@ -717,12 +716,12 @@ int epicsShareAPI asDumpHagFP(FILE *fp,const char *hagname) return(0); } -int epicsShareAPI asDumpRules(const char *asgname) +int epicsStdCall asDumpRules(const char *asgname) { return asDumpRulesFP(stdout,asgname); } -int epicsShareAPI asDumpRulesFP(FILE *fp,const char *asgname) +int epicsStdCall asDumpRulesFP(FILE *fp,const char *asgname) { ASG *pasg; ASGINP *pasginp; @@ -801,13 +800,13 @@ int epicsShareAPI asDumpRulesFP(FILE *fp,const char *asgname) return(0); } -int epicsShareAPI asDumpMem(const char *asgname,void (*memcallback)(ASMEMBERPVT,FILE *), +int epicsStdCall asDumpMem(const char *asgname,void (*memcallback)(ASMEMBERPVT,FILE *), int clients) { return asDumpMemFP(stdout,asgname,memcallback,clients); } -int epicsShareAPI asDumpMemFP(FILE *fp,const char *asgname, +int epicsStdCall asDumpMemFP(FILE *fp,const char *asgname, void (*memcallback)(ASMEMBERPVT,FILE *),int clients) { ASG *pasg; @@ -858,12 +857,12 @@ int epicsShareAPI asDumpMemFP(FILE *fp,const char *asgname, return(0); } -epicsShareFunc int epicsShareAPI asDumpHash(void) +LIBCOM_API int epicsStdCall asDumpHash(void) { return asDumpHashFP(stdout); } -epicsShareFunc int epicsShareAPI asDumpHashFP(FILE *fp) +LIBCOM_API int epicsStdCall asDumpHashFP(FILE *fp) { if(!asActive) return(0); gphDumpFP(fp,pasbase->phash); @@ -872,14 +871,14 @@ epicsShareFunc int epicsShareAPI asDumpHashFP(FILE *fp) /*Start of private routines*/ /* asCalloc is "friend" function */ -epicsShareFunc void * epicsShareAPI asCalloc(size_t nobj,size_t size) +LIBCOM_API void * epicsStdCall asCalloc(size_t nobj,size_t size) { void *p; p=callocMustSucceed(nobj,size,"asCalloc"); return(p); } -epicsShareFunc char * epicsShareAPI asStrdup(unsigned char *str) +LIBCOM_API char * epicsStdCall asStrdup(unsigned char *str) { size_t len = strlen((char *) str); char *buf = asCalloc(1, len + 1); diff --git a/modules/libcom/src/as/asTrapWrite.c b/modules/libcom/src/as/asTrapWrite.c index 544e9a211..fe7b246e6 100644 --- a/modules/libcom/src/as/asTrapWrite.c +++ b/modules/libcom/src/as/asTrapWrite.c @@ -19,7 +19,6 @@ #include #include -#define epicsExportSharedSymbols #include "ellLib.h" #include "freeList.h" #include "epicsStdio.h" @@ -71,7 +70,7 @@ static void asTrapWriteInit(void) pasTrapWritePvt->lock = epicsMutexMustCreate(); } -asTrapWriteId epicsShareAPI asTrapWriteRegisterListener( +asTrapWriteId epicsStdCall asTrapWriteRegisterListener( asTrapWriteListener func) { listener *plistener; @@ -84,7 +83,7 @@ asTrapWriteId epicsShareAPI asTrapWriteRegisterListener( return((asTrapWriteId)plistener); } -void epicsShareAPI asTrapWriteUnregisterListener(asTrapWriteId id) +void epicsStdCall asTrapWriteUnregisterListener(asTrapWriteId id) { listener *plistener = (listener *)id; writeMessage *pwriteMessage; @@ -111,7 +110,7 @@ void epicsShareAPI asTrapWriteUnregisterListener(asTrapWriteId id) epicsMutexUnlock(pasTrapWritePvt->lock); } -void * epicsShareAPI asTrapWriteBeforeWithData( +void * epicsStdCall asTrapWriteBeforeWithData( const char *userid, const char *hostid, void *addr, int dbrType, int no_elements, void *data) { @@ -149,7 +148,7 @@ void * epicsShareAPI asTrapWriteBeforeWithData( return pwriteMessage; } -void epicsShareAPI asTrapWriteAfterWrite(void *pvt) +void epicsStdCall asTrapWriteAfterWrite(void *pvt) { writeMessage *pwriteMessage = (writeMessage *)pvt; listenerPvt *plistenerPvt; diff --git a/modules/libcom/src/as/asTrapWrite.h b/modules/libcom/src/as/asTrapWrite.h index 8f93fa1ee..8a0286e26 100644 --- a/modules/libcom/src/as/asTrapWrite.h +++ b/modules/libcom/src/as/asTrapWrite.h @@ -19,7 +19,7 @@ #ifndef INCasTrapWriteh #define INCasTrapWriteh -#include "shareLib.h" +#include "libComAPI.h" #ifdef __cplusplus extern "C" { @@ -78,13 +78,13 @@ typedef void(*asTrapWriteListener)(asTrapWriteMessage *pmessage,int after); * \param func The listener function to be called. * \return A listener identifier for unregistering this listener. */ -epicsShareFunc asTrapWriteId epicsShareAPI asTrapWriteRegisterListener( +LIBCOM_API asTrapWriteId epicsStdCall asTrapWriteRegisterListener( asTrapWriteListener func); /** * \brief Unregister asTrapWriteListener. * \param id Listener identifier from asTrapWriteRegisterListener(). */ -epicsShareFunc void epicsShareAPI asTrapWriteUnregisterListener( +LIBCOM_API void epicsStdCall asTrapWriteUnregisterListener( asTrapWriteId id); #ifdef __cplusplus diff --git a/modules/libcom/src/bucketLib/bucketLib.c b/modules/libcom/src/bucketLib/bucketLib.c index 40df596a4..c8ef9a2b0 100644 --- a/modules/libcom/src/bucketLib/bucketLib.c +++ b/modules/libcom/src/bucketLib/bucketLib.c @@ -23,7 +23,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsAssert.h" #include "freeList.h" /* bucketLib uses freeListLib inside the DLL */ #include "bucketLib.h" @@ -216,7 +215,7 @@ static BUCKETID bucketStringHash (BUCKET *pb, const void *pId) /* * bucketCreate() */ -epicsShareFunc BUCKET * epicsShareAPI bucketCreate (unsigned nHashTableEntries) +LIBCOM_API BUCKET * epicsStdCall bucketCreate (unsigned nHashTableEntries) { BUCKETID mask; unsigned nbits; @@ -283,7 +282,7 @@ epicsShareFunc BUCKET * epicsShareAPI bucketCreate (unsigned nHashTableEntries) /* * bucketFree() */ -epicsShareFunc int epicsShareAPI bucketFree (BUCKET *prb) +LIBCOM_API int epicsStdCall bucketFree (BUCKET *prb) { /* * deleting a bucket with entries in use @@ -305,17 +304,17 @@ epicsShareFunc int epicsShareAPI bucketFree (BUCKET *prb) /* * bucketAddItem() */ -epicsShareFunc int epicsShareAPI +LIBCOM_API int epicsStdCall bucketAddItemUnsignedId(BUCKET *prb, const unsigned *pId, const void *pApp) { return bucketAddItem(prb, &BSET[bidtUnsigned], pId, pApp); } -epicsShareFunc int epicsShareAPI +LIBCOM_API int epicsStdCall bucketAddItemPointerId(BUCKET *prb, void * const *pId, const void *pApp) { return bucketAddItem(prb, &BSET[bidtPointer], pId, pApp); } -epicsShareFunc int epicsShareAPI +LIBCOM_API int epicsStdCall bucketAddItemStringId(BUCKET *prb, const char *pId, const void *pApp) { return bucketAddItem(prb, &BSET[bidtString], pId, pApp); @@ -395,15 +394,15 @@ static void *bucketLookupAndRemoveItem (BUCKET *prb, bucketSET *pBSET, const voi return pApp; } -epicsShareFunc void * epicsShareAPI bucketLookupAndRemoveItemUnsignedId (BUCKET *prb, const unsigned *pId) +LIBCOM_API void * epicsStdCall bucketLookupAndRemoveItemUnsignedId (BUCKET *prb, const unsigned *pId) { return bucketLookupAndRemoveItem(prb, &BSET[bidtUnsigned], pId); } -epicsShareFunc void * epicsShareAPI bucketLookupAndRemoveItemPointerId (BUCKET *prb, void * const *pId) +LIBCOM_API void * epicsStdCall bucketLookupAndRemoveItemPointerId (BUCKET *prb, void * const *pId) { return bucketLookupAndRemoveItem(prb, &BSET[bidtPointer], pId); } -epicsShareFunc void * epicsShareAPI bucketLookupAndRemoveItemStringId (BUCKET *prb, const char *pId) +LIBCOM_API void * epicsStdCall bucketLookupAndRemoveItemStringId (BUCKET *prb, const char *pId) { return bucketLookupAndRemoveItem(prb, &BSET[bidtString], pId); } @@ -412,17 +411,17 @@ epicsShareFunc void * epicsShareAPI bucketLookupAndRemoveItemStringId (BUCKET *p /* * bucketRemoveItem() */ -epicsShareFunc int epicsShareAPI +LIBCOM_API int epicsStdCall bucketRemoveItemUnsignedId (BUCKET *prb, const unsigned *pId) { return bucketLookupAndRemoveItem(prb, &BSET[bidtUnsigned], pId)?S_bucket_success:S_bucket_uknId; } -epicsShareFunc int epicsShareAPI +LIBCOM_API int epicsStdCall bucketRemoveItemPointerId (BUCKET *prb, void * const *pId) { return bucketLookupAndRemoveItem(prb, &BSET[bidtPointer], pId)?S_bucket_success:S_bucket_uknId; } -epicsShareFunc int epicsShareAPI +LIBCOM_API int epicsStdCall bucketRemoveItemStringId (BUCKET *prb, const char *pId) { return bucketLookupAndRemoveItem(prb, &BSET[bidtString], pId)?S_bucket_success:S_bucket_uknId; @@ -432,17 +431,17 @@ epicsShareFunc int epicsShareAPI /* * bucketLookupItem() */ -epicsShareFunc void * epicsShareAPI +LIBCOM_API void * epicsStdCall bucketLookupItemUnsignedId (BUCKET *prb, const unsigned *pId) { return bucketLookupItem(prb, &BSET[bidtUnsigned], pId); } -epicsShareFunc void * epicsShareAPI +LIBCOM_API void * epicsStdCall bucketLookupItemPointerId (BUCKET *prb, void * const *pId) { return bucketLookupItem(prb, &BSET[bidtPointer], pId); } -epicsShareFunc void * epicsShareAPI +LIBCOM_API void * epicsStdCall bucketLookupItemStringId (BUCKET *prb, const char *pId) { return bucketLookupItem(prb, &BSET[bidtString], pId); @@ -474,7 +473,7 @@ static void *bucketLookupItem (BUCKET *pb, bucketSET *pBSET, const void *pId) /* * bucketShow() */ -epicsShareFunc int epicsShareAPI bucketShow(BUCKET *pb) +LIBCOM_API int epicsStdCall bucketShow(BUCKET *pb) { ITEM **ppi; ITEM *pi; diff --git a/modules/libcom/src/bucketLib/bucketLib.h b/modules/libcom/src/bucketLib/bucketLib.h index 0336d6e18..497f4f9e6 100644 --- a/modules/libcom/src/bucketLib/bucketLib.h +++ b/modules/libcom/src/bucketLib/bucketLib.h @@ -28,7 +28,7 @@ extern "C" { #include "errMdef.h" #include "epicsTypes.h" -#include "shareLib.h" +#include "libComAPI.h" /** \brief Internal: bucket identifier */ typedef unsigned BUCKETID; @@ -57,20 +57,20 @@ typedef struct bucket{ * \param nHashTableEntries Table size * \return Pointer to the newly created hash table, or NULL. */ -epicsShareFunc BUCKET * epicsShareAPI bucketCreate (unsigned nHashTableEntries); +LIBCOM_API BUCKET * epicsStdCall bucketCreate (unsigned nHashTableEntries); /** * \brief Release memory used by a hash table * \param *prb Pointer to the hash table * \return S_bucket_success * \note All items must be deleted from the hash table before calling this. */ -epicsShareFunc int epicsShareAPI bucketFree (BUCKET *prb); +LIBCOM_API int epicsStdCall bucketFree (BUCKET *prb); /** * \brief Display information about a hash table * \param *prb Pointer to the hash table * \return S_bucket_success */ -epicsShareFunc int epicsShareAPI bucketShow (BUCKET *prb); +LIBCOM_API int epicsStdCall bucketShow (BUCKET *prb); /** * \brief Add an item identified by an unsigned int to the table @@ -79,7 +79,7 @@ epicsShareFunc int epicsShareAPI bucketShow (BUCKET *prb); * \param *pApp Pointer to the payload * \return Status value */ -epicsShareFunc int epicsShareAPI bucketAddItemUnsignedId (BUCKET *prb, +LIBCOM_API int epicsStdCall bucketAddItemUnsignedId (BUCKET *prb, const unsigned *pId, const void *pApp); /** * \brief Add an item identified by a pointer to the table @@ -88,7 +88,7 @@ epicsShareFunc int epicsShareAPI bucketAddItemUnsignedId (BUCKET *prb, * \param *pApp Pointer to the payload * \return Status value */ -epicsShareFunc int epicsShareAPI bucketAddItemPointerId (BUCKET *prb, +LIBCOM_API int epicsStdCall bucketAddItemPointerId (BUCKET *prb, void * const *pId, const void *pApp); /** * \brief Add an item identified by a string to the table @@ -97,7 +97,7 @@ epicsShareFunc int epicsShareAPI bucketAddItemPointerId (BUCKET *prb, * \param *pApp Pointer to the payload * \return Status value */ -epicsShareFunc int epicsShareAPI bucketAddItemStringId (BUCKET *prb, +LIBCOM_API int epicsStdCall bucketAddItemStringId (BUCKET *prb, const char *pId, const void *pApp); /** * \brief Remove an item identified by a string from the table @@ -105,42 +105,42 @@ epicsShareFunc int epicsShareAPI bucketAddItemStringId (BUCKET *prb, * \param *pId Pointer to the identifier * \return Status value */ -epicsShareFunc int epicsShareAPI bucketRemoveItemUnsignedId (BUCKET *prb, const unsigned *pId); +LIBCOM_API int epicsStdCall bucketRemoveItemUnsignedId (BUCKET *prb, const unsigned *pId); /** * \brief Remove an item identified by a pointer from the table * \param *prb Pointer to the hash table * \param *pId Pointer to the identifier * \return Status value */ -epicsShareFunc int epicsShareAPI bucketRemoveItemPointerId (BUCKET *prb, void * const *pId); +LIBCOM_API int epicsStdCall bucketRemoveItemPointerId (BUCKET *prb, void * const *pId); /** * \brief Remove an item identified by a string from the table * \param *prb Pointer to the hash table * \param *pId Pointer to the identifier * \return Status value */ -epicsShareFunc int epicsShareAPI bucketRemoveItemStringId (BUCKET *prb, const char *pId); +LIBCOM_API int epicsStdCall bucketRemoveItemStringId (BUCKET *prb, const char *pId); /** * \brief Find an item identified by an unsigned int in the table * \param *prb Pointer to the hash table * \param *pId Pointer to the identifier * \return Item's payload pointer, or NULL if not found */ -epicsShareFunc void * epicsShareAPI bucketLookupItemUnsignedId (BUCKET *prb, const unsigned *pId); +LIBCOM_API void * epicsStdCall bucketLookupItemUnsignedId (BUCKET *prb, const unsigned *pId); /** * \brief Find an item identified by a pointer in the table * \param *prb Pointer to the hash table * \param *pId Pointer to the identifier * \return Item's payload pointer, or NULL if not found */ -epicsShareFunc void * epicsShareAPI bucketLookupItemPointerId (BUCKET *prb, void * const *pId); +LIBCOM_API void * epicsStdCall bucketLookupItemPointerId (BUCKET *prb, void * const *pId); /** * \brief Find an item identified by a string in the table * \param *prb Pointer to the hash table * \param *pId Pointer to the identifier * \return Item's payload pointer, or NULL if not found */ -epicsShareFunc void * epicsShareAPI bucketLookupItemStringId (BUCKET *prb, const char *pId); +LIBCOM_API void * epicsStdCall bucketLookupItemStringId (BUCKET *prb, const char *pId); /** * \brief Find and delete an item identified by an unsigned int from the table @@ -148,21 +148,21 @@ epicsShareFunc void * epicsShareAPI bucketLookupItemStringId (BUCKET *prb, const * \param *pId Pointer to the identifier * \return Item's payload pointer, or NULL if not found */ -epicsShareFunc void * epicsShareAPI bucketLookupAndRemoveItemUnsignedId (BUCKET *prb, const unsigned *pId); +LIBCOM_API void * epicsStdCall bucketLookupAndRemoveItemUnsignedId (BUCKET *prb, const unsigned *pId); /** * \brief Find and delete an item identified by a pointer from the table * \param *prb Pointer to the hash table * \param *pId Pointer to the identifier * \return Item's payload pointer, or NULL if not found */ -epicsShareFunc void * epicsShareAPI bucketLookupAndRemoveItemPointerId (BUCKET *prb, void * const *pId); +LIBCOM_API void * epicsStdCall bucketLookupAndRemoveItemPointerId (BUCKET *prb, void * const *pId); /** * \brief Find and delete an item identified by a string from the table * \param *prb Pointer to the hash table * \param *pId Pointer to the identifier * \return Item's payload pointer, or NULL if not found */ -epicsShareFunc void * epicsShareAPI bucketLookupAndRemoveItemStringId (BUCKET *prb, const char *pId); +LIBCOM_API void * epicsStdCall bucketLookupAndRemoveItemStringId (BUCKET *prb, const char *pId); /** diff --git a/modules/libcom/src/calc/calcPerform.c b/modules/libcom/src/calc/calcPerform.c index 40e173b61..f55cbbdd1 100644 --- a/modules/libcom/src/calc/calcPerform.c +++ b/modules/libcom/src/calc/calcPerform.c @@ -16,7 +16,6 @@ #include #include -#define epicsExportSharedSymbols #include "osiUnistd.h" #include "dbDefs.h" #include "epicsMath.h" @@ -42,7 +41,7 @@ static int cond_search(const char **ppinst, int match); * * Evalutate the postfix expression */ -epicsShareFunc long +LIBCOM_API long calcPerform(double *parg, double *presult, const char *pinst) { double stack[CALCPERFORM_STACK+1]; /* zero'th entry not used */ @@ -402,7 +401,7 @@ epicsShareFunc long # pragma optimize("", on) #endif -epicsShareFunc long +LIBCOM_API long calcArgUsage(const char *pinst, unsigned long *pinputs, unsigned long *pstores) { unsigned long inputs = 0; diff --git a/modules/libcom/src/calc/postfix.c b/modules/libcom/src/calc/postfix.c index 54d629b40..d034c1d0f 100644 --- a/modules/libcom/src/calc/postfix.c +++ b/modules/libcom/src/calc/postfix.c @@ -17,7 +17,6 @@ #include #include -#define epicsExportSharedSymbols #include "dbDefs.h" #include "epicsAssert.h" #include "epicsStdlib.h" @@ -25,7 +24,7 @@ #include "epicsTypes.h" #include "postfix.h" #include "postfixPvt.h" -#include "shareLib.h" +#include "libComAPI.h" /* declarations for postfix */ @@ -206,7 +205,7 @@ static int * * convert an infix expression to a postfix expression */ -epicsShareFunc long +LIBCOM_API long postfix(const char *psrc, char *pout, short *perror) { ELEMENT stack[80]; @@ -490,7 +489,7 @@ bad: * * Return a message string appropriate for the given error code */ -epicsShareFunc const char * +LIBCOM_API const char * calcErrorStr(short error) { static const char *errStrs[] = { @@ -520,7 +519,7 @@ epicsShareFunc const char * * * Disassemble the given postfix instructions to stdout */ -epicsShareFunc void +LIBCOM_API void calcExprDump(const char *pinst) { static const char *opcodes[] = { diff --git a/modules/libcom/src/calc/postfix.h b/modules/libcom/src/calc/postfix.h index 6bdbc1ae0..25a37ed43 100644 --- a/modules/libcom/src/calc/postfix.h +++ b/modules/libcom/src/calc/postfix.h @@ -19,7 +19,7 @@ #ifndef INCpostfixh #define INCpostfixh -#include "shareLib.h" +#include "libComAPI.h" /** \brief Number of input arguments to a calc expression (A-L) */ #define CALCPERFORM_NARGS 12 @@ -295,7 +295,7 @@ extern "C" { * the expression evaluation engine is limited to 80 results (which require an * expression at least 321 characters long to reach). */ -epicsShareFunc long +LIBCOM_API long postfix(const char *pinfix, char *ppostfix, short *perror); /** \brief Run the calculation engine @@ -310,7 +310,7 @@ epicsShareFunc long * \return Status value 0 for OK, or non-zero if an error is discovered * during the evaluation process. */ -epicsShareFunc long +LIBCOM_API long calcPerform(double *parg, double *presult, const char *ppostfix); /** \brief Find the inputs and outputs of an expression @@ -337,7 +337,7 @@ epicsShareFunc long * \return The return value will be non-zero if the ppostfix expression was * illegal, otherwise 0. */ -epicsShareFunc long +LIBCOM_API long calcArgUsage(const char *ppostfix, unsigned long *pinputs, unsigned long *pstores); /** \brief Convert an error code to a string. @@ -347,7 +347,7 @@ epicsShareFunc long * \param error Error code * \return A string representation of the error code */ -epicsShareFunc const char * +LIBCOM_API const char * calcErrorStr(short error); /** \brief Disassemble a postfix expression @@ -355,7 +355,7 @@ epicsShareFunc const char * * Convert the byte-code stream to text and print to stdout. * \param pinst postfix instructions */ -epicsShareFunc void +LIBCOM_API void calcExprDump(const char *pinst); #ifdef __cplusplus diff --git a/modules/libcom/src/cvtFast/cvtFast.c b/modules/libcom/src/cvtFast/cvtFast.c index 106c1ba47..887f0c8fa 100644 --- a/modules/libcom/src/cvtFast/cvtFast.c +++ b/modules/libcom/src/cvtFast/cvtFast.c @@ -16,7 +16,6 @@ #include #include -#define epicsExportSharedSymbols #include "cvtFast.h" #include "epicsMath.h" #include "epicsStdio.h" diff --git a/modules/libcom/src/cvtFast/cvtFast.h b/modules/libcom/src/cvtFast/cvtFast.h index db06dda53..31c04c491 100644 --- a/modules/libcom/src/cvtFast/cvtFast.h +++ b/modules/libcom/src/cvtFast/cvtFast.h @@ -20,7 +20,7 @@ #include #include "epicsTypes.h" -#include "shareLib.h" +#include "libComAPI.h" #ifdef __cplusplus extern "C" { @@ -29,38 +29,38 @@ extern "C" { /* * All functions return the number of characters in the output */ -epicsShareFunc int +LIBCOM_API int cvtFloatToString(float val, char *pdest, epicsUInt16 prec); -epicsShareFunc int +LIBCOM_API int cvtDoubleToString(double val, char *pdest, epicsUInt16 prec); -epicsShareFunc int +LIBCOM_API int cvtFloatToExpString(float val, char *pdest, epicsUInt16 prec); -epicsShareFunc int +LIBCOM_API int cvtDoubleToExpString(double val, char *pdest, epicsUInt16 prec); -epicsShareFunc int +LIBCOM_API int cvtFloatToCompactString(float val, char *pdest, epicsUInt16 prec); -epicsShareFunc int +LIBCOM_API int cvtDoubleToCompactString(double val, char *pdest, epicsUInt16 prec); -epicsShareFunc size_t +LIBCOM_API size_t cvtInt32ToString(epicsInt32 val, char *pdest); -epicsShareFunc size_t +LIBCOM_API size_t cvtUInt32ToString(epicsUInt32 val, char *pdest); -epicsShareFunc size_t +LIBCOM_API size_t cvtInt64ToString(epicsInt64 val, char *pdest); -epicsShareFunc size_t +LIBCOM_API size_t cvtUInt64ToString(epicsUInt64 val, char *pdest); -epicsShareFunc size_t +LIBCOM_API size_t cvtInt32ToHexString(epicsInt32 val, char *pdest); -epicsShareFunc size_t +LIBCOM_API size_t cvtUInt32ToHexString(epicsUInt32 val, char *pdest); -epicsShareFunc size_t +LIBCOM_API size_t cvtInt32ToOctalString(epicsInt32 val, char *pdest); -epicsShareFunc size_t +LIBCOM_API size_t cvtInt64ToHexString(epicsInt64 val, char *pdest); -epicsShareFunc size_t +LIBCOM_API size_t cvtUInt64ToHexString(epicsUInt64 val, char *pdest); /* Support the original names */ diff --git a/modules/libcom/src/cxxTemplates/epicsSingleton.h b/modules/libcom/src/cxxTemplates/epicsSingleton.h index 2c63d3ff7..89c3ab903 100644 --- a/modules/libcom/src/cxxTemplates/epicsSingleton.h +++ b/modules/libcom/src/cxxTemplates/epicsSingleton.h @@ -18,10 +18,10 @@ #include #include -#include "shareLib.h" +#include "libComAPI.h" #include "epicsAssert.h" -class epicsShareClass SingletonUntyped { +class LIBCOM_API SingletonUntyped { public: SingletonUntyped (); ~SingletonUntyped (); diff --git a/modules/libcom/src/cxxTemplates/epicsSingletonMutex.cpp b/modules/libcom/src/cxxTemplates/epicsSingletonMutex.cpp index 8cd69d969..b878e3dc2 100644 --- a/modules/libcom/src/cxxTemplates/epicsSingletonMutex.cpp +++ b/modules/libcom/src/cxxTemplates/epicsSingletonMutex.cpp @@ -14,7 +14,6 @@ #include -#define epicsExportSharedSymbols #include "epicsMutex.h" #include "epicsGuard.h" #include "epicsThread.h" diff --git a/modules/libcom/src/cxxTemplates/resourceLib.h b/modules/libcom/src/cxxTemplates/resourceLib.h index 7b61e238d..ff7ef997f 100644 --- a/modules/libcom/src/cxxTemplates/resourceLib.h +++ b/modules/libcom/src/cxxTemplates/resourceLib.h @@ -41,7 +41,7 @@ #include "tsSLList.h" #include "epicsString.h" -#include "shareLib.h" +#include "libComAPI.h" typedef size_t resTableIndex; template < class T, class ID > class resTableIter; @@ -253,7 +253,7 @@ private: // // character string identifier // -class epicsShareClass stringId { +class LIBCOM_API stringId { public: enum allocationType {copyString, refString}; stringId (const char * idIn, allocationType typeIn=copyString); diff --git a/modules/libcom/src/dbmf/dbmf.c b/modules/libcom/src/dbmf/dbmf.c index e04a7bedf..035e75ace 100644 --- a/modules/libcom/src/dbmf/dbmf.c +++ b/modules/libcom/src/dbmf/dbmf.c @@ -28,7 +28,6 @@ #define REDZONE 0 #endif -#define epicsExportSharedSymbols #include "cantProceed.h" #include "epicsMutex.h" #include "ellLib.h" diff --git a/modules/libcom/src/dbmf/dbmf.h b/modules/libcom/src/dbmf/dbmf.h index ef9787500..8c39e510e 100644 --- a/modules/libcom/src/dbmf/dbmf.h +++ b/modules/libcom/src/dbmf/dbmf.h @@ -35,7 +35,7 @@ #define DBMF_H #include -#include "shareLib.h" +#include "libComAPI.h" #ifdef __cplusplus extern "C" { @@ -52,13 +52,13 @@ extern "C" { * \note If dbmfInit() is not called before one of the other routines then it * is automatically called with size=64 and chunkItems=10 */ -epicsShareFunc int dbmfInit(size_t size, int chunkItems); +LIBCOM_API int dbmfInit(size_t size, int chunkItems); /** * \brief Allocate memory. * \param bytes If bytes > size then malloc() is used to allocate the memory. * \return Pointer to the newly-allocated memory, or NULL on failure. */ -epicsShareFunc void * dbmfMalloc(size_t bytes); +LIBCOM_API void * dbmfMalloc(size_t bytes); /** * \brief Duplicate a string. * @@ -66,7 +66,7 @@ epicsShareFunc void * dbmfMalloc(size_t bytes); * \param str Pointer to the null-terminated string to be copied. * \return A pointer to the new copy, or NULL on failure. */ -epicsShareFunc char * dbmfStrdup(const char *str); +LIBCOM_API char * dbmfStrdup(const char *str); /** * \brief Duplicate a string (up to len bytes). * @@ -76,7 +76,7 @@ epicsShareFunc char * dbmfStrdup(const char *str); * \param len Max number of bytes to copy. * \return A pointer to the new string, or NULL on failure. */ -epicsShareFunc char * dbmfStrndup(const char *str, size_t len); +LIBCOM_API char * dbmfStrndup(const char *str, size_t len); /** * \brief Concatenate three strings. @@ -87,24 +87,24 @@ epicsShareFunc char * dbmfStrndup(const char *str, size_t len); * \param rhs Last string to be concatenated to the lhs+mid (right part). * \return A pointer to the new string, or NULL on failure. */ -epicsShareFunc char * dbmfStrcat3(const char *lhs, const char *mid, +LIBCOM_API char * dbmfStrcat3(const char *lhs, const char *mid, const char *rhs); /** * \brief Free the memory allocated by dbmfMalloc. * \param bytes Pointer to memory obtained from dbmfMalloc(), dbmfStrdup(), * dbmfStrndup() or dbmfStrcat3(). */ -epicsShareFunc void dbmfFree(void *bytes); +LIBCOM_API void dbmfFree(void *bytes); /** * \brief Free all chunks that contain only free items. */ -epicsShareFunc void dbmfFreeChunks(void); +LIBCOM_API void dbmfFreeChunks(void); /** * \brief Show the status of the dbmf memory pool. * \param level Detail level. * \return 0. */ -epicsShareFunc int dbmfShow(int level); +LIBCOM_API int dbmfShow(int level); #ifdef __cplusplus } diff --git a/modules/libcom/src/ellLib/ellLib.c b/modules/libcom/src/ellLib/ellLib.c index c539a843f..184202fb3 100644 --- a/modules/libcom/src/ellLib/ellLib.c +++ b/modules/libcom/src/ellLib/ellLib.c @@ -13,7 +13,6 @@ #include -#define epicsExportSharedSymbols #include "epicsAssert.h" #include "ellLib.h" diff --git a/modules/libcom/src/ellLib/ellLib.h b/modules/libcom/src/ellLib/ellLib.h index 8448fee2d..2a8dcbd75 100644 --- a/modules/libcom/src/ellLib/ellLib.h +++ b/modules/libcom/src/ellLib/ellLib.h @@ -26,7 +26,7 @@ #ifndef INC_ellLib_H #define INC_ellLib_H -#include "shareLib.h" +#include "libComAPI.h" #ifdef __cplusplus extern "C" { @@ -112,7 +112,7 @@ typedef void (*FREEFUNC)(void *); * \param pList Pointer to list descriptor * \param pNode Pointer to node to be added */ -epicsShareFunc void ellAdd (ELLLIST *pList, ELLNODE *pNode); +LIBCOM_API void ellAdd (ELLLIST *pList, ELLNODE *pNode); /** * \brief Concatenates a list to the end of another list. * The list to be added is left empty. Either list (or both) @@ -120,13 +120,13 @@ epicsShareFunc void ellAdd (ELLLIST *pList, ELLNODE *pNode); * \param pDstList Destination list * \param pAddList List to be added to \c pDstList */ -epicsShareFunc void ellConcat (ELLLIST *pDstList, ELLLIST *pAddList); +LIBCOM_API void ellConcat (ELLLIST *pDstList, ELLLIST *pAddList); /** * \brief Deletes a node from a list. * \param pList Pointer to list descriptor * \param pNode Pointer to node to be deleted */ -epicsShareFunc void ellDelete (ELLLIST *pList, ELLNODE *pNode); +LIBCOM_API void ellDelete (ELLLIST *pList, ELLNODE *pNode); /** * \brief Extract a sublist from a list. * \param pSrcList Pointer to source list @@ -134,19 +134,19 @@ epicsShareFunc void ellDelete (ELLLIST *pList, ELLNODE *pNode); * \param pEndNode Last node in \c pSrcList to be extracted * \param pDstList Pointer to list where to put extracted list */ -epicsShareFunc void ellExtract (ELLLIST *pSrcList, ELLNODE *pStartNode, ELLNODE *pEndNode, ELLLIST *pDstList); +LIBCOM_API void ellExtract (ELLLIST *pSrcList, ELLNODE *pStartNode, ELLNODE *pEndNode, ELLLIST *pDstList); /** * \brief Deletes and returns the first node from a list * \param pList Pointer to list from which to get node * \return Pointer to the first node from the list, or NULL if the list is empty */ -epicsShareFunc ELLNODE * ellGet (ELLLIST *pList); +LIBCOM_API ELLNODE * ellGet (ELLLIST *pList); /** * \brief Deletes and returns the last node from a list. * \param pList Pointer to list from which to get node * \return Pointer to the last node from the list, or NULL if the list is empty */ -epicsShareFunc ELLNODE * ellPop (ELLLIST *pList); +LIBCOM_API ELLNODE * ellPop (ELLLIST *pList); /** * \brief Inserts a node into a list immediately after a specific node * \param plist Pointer to list into which to insert node @@ -154,7 +154,7 @@ epicsShareFunc ELLNODE * ellPop (ELLLIST *pList); * \param pNode Pointer to the node to be inserted * \note If \c pPrev is NULL \c pNode will be inserted at the head of the list */ -epicsShareFunc void ellInsert (ELLLIST *plist, ELLNODE *pPrev, ELLNODE *pNode); +LIBCOM_API void ellInsert (ELLLIST *plist, ELLNODE *pPrev, ELLNODE *pNode); /** * \brief Find the Nth node in a list * \param pList Pointer to list from which to find node @@ -163,7 +163,7 @@ epicsShareFunc void ellInsert (ELLLIST *plist, ELLNODE *pPrev, ELLNODE *pNode); * there is no such node in the list. * \note The first node has index 1. */ -epicsShareFunc ELLNODE * ellNth (ELLLIST *pList, int nodeNum); +LIBCOM_API ELLNODE * ellNth (ELLLIST *pList, int nodeNum); /** * \brief Find the list node \c nStep steps away from a specified node * \param pNode The known node @@ -171,7 +171,7 @@ epicsShareFunc ELLNODE * ellNth (ELLLIST *pList, int nodeNum); * \return Pointer to the node \c nStep nodes from \c pNode, or NULL if there * is no such node in the list. */ -epicsShareFunc ELLNODE * ellNStep (ELLNODE *pNode, int nStep); +LIBCOM_API ELLNODE * ellNStep (ELLNODE *pNode, int nStep); /** * \brief Find the index of a specific node in a list * \param pList Pointer to list to search @@ -179,7 +179,7 @@ epicsShareFunc ELLNODE * ellNStep (ELLNODE *pNode, int nStep); * \return The node's index, or -1 if it cannot be found on the list. * \note The first node has index 1. */ -epicsShareFunc int ellFind (ELLLIST *pList, ELLNODE *pNode); +LIBCOM_API int ellFind (ELLLIST *pList, ELLNODE *pNode); typedef int (*pListCmp)(const ELLNODE* A, const ELLNODE* B); /** @@ -192,7 +192,7 @@ typedef int (*pListCmp)(const ELLNODE* A, const ELLNODE* B); * \note Use of mergesort algorithm based on analysis by * http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html */ -epicsShareFunc void ellSortStable(ELLLIST *pList, pListCmp pListCmp); +LIBCOM_API void ellSortStable(ELLLIST *pList, pListCmp pListCmp); /** * \brief Free all the nodes in a list. * @@ -203,12 +203,12 @@ epicsShareFunc void ellSortStable(ELLLIST *pList, pListCmp pListCmp); * structures were malloc()'d one-at-a-time and that the ELLNODE structure is * the first member of the parent structure. */ -epicsShareFunc void ellFree2 (ELLLIST *pList, FREEFUNC freeFunc); +LIBCOM_API void ellFree2 (ELLLIST *pList, FREEFUNC freeFunc); /** * \brief Verifies that the list is consistent * \param pList List to be verified */ -epicsShareFunc void ellVerify (ELLLIST *pList); +LIBCOM_API void ellVerify (ELLLIST *pList); #ifdef __cplusplus } diff --git a/modules/libcom/src/ellLib/ellSort.c b/modules/libcom/src/ellLib/ellSort.c index 2f8f2748b..1aa667960 100644 --- a/modules/libcom/src/ellLib/ellSort.c +++ b/modules/libcom/src/ellLib/ellSort.c @@ -12,7 +12,6 @@ */ #include -#define epicsExportSharedSymbols #include "epicsAssert.h" #include "ellLib.h" diff --git a/modules/libcom/src/env/bldEnvData.pl b/modules/libcom/src/env/bldEnvData.pl index 693be65da..c64bd6cb6 100644 --- a/modules/libcom/src/env/bldEnvData.pl +++ b/modules/libcom/src/env/bldEnvData.pl @@ -44,7 +44,7 @@ open SRC, '<', $env_defs my @vars; while () { - if (m/epicsShareExtern\s+const\s+ENV_PARAM\s+([A-Za-z_]\w*)\s*;/) { + if (m/LIBCOM_API\s+extern\s+const\s+ENV_PARAM\s+([A-Za-z_]\w*)\s*;/) { push @vars, $1; } } @@ -113,14 +113,14 @@ foreach my $var (@vars) { $default = ''; } - print OUT "epicsShareDef const ENV_PARAM $var =\n", + print OUT "const ENV_PARAM $var =\n", " {\"$var\", \"$default\"};\n"; } # Also provide a list of all defined parameters # print OUT "\n", - "epicsShareDef const ENV_PARAM* env_param_list[] = {\n", + "const ENV_PARAM* env_param_list[] = {\n", wrap(' ', ' ', join(', ', map("&$_", @vars), 'NULL')), "\n};\n"; close OUT; diff --git a/modules/libcom/src/env/envDefs.h b/modules/libcom/src/env/envDefs.h index 7f4859063..adf9e68c5 100644 --- a/modules/libcom/src/env/envDefs.h +++ b/modules/libcom/src/env/envDefs.h @@ -23,7 +23,7 @@ * own use--the only caveat is that such parameters aren't automatically * setup by EPICS. * - * \note bldEnvData.pl looks for "epicsShareExtern const ENV_PARAM ;" + * \note bldEnvData.pl looks for "LIBCOM_API extern const ENV_PARAM ;" */ #ifndef envDefsH @@ -33,7 +33,7 @@ extern "C" { #endif -#include "shareLib.h" +#include "libComAPI.h" /** * \brief A structure to hold a single environment parameter @@ -43,39 +43,39 @@ typedef struct envParam { char *pdflt; /**< \brief Default value */ } ENV_PARAM; -epicsShareExtern const ENV_PARAM EPICS_CA_ADDR_LIST; -epicsShareExtern const ENV_PARAM EPICS_CA_CONN_TMO; -epicsShareExtern const ENV_PARAM EPICS_CA_AUTO_ADDR_LIST; -epicsShareExtern const ENV_PARAM EPICS_CA_REPEATER_PORT; -epicsShareExtern const ENV_PARAM EPICS_CA_SERVER_PORT; -epicsShareExtern const ENV_PARAM EPICS_CA_MAX_ARRAY_BYTES; -epicsShareExtern const ENV_PARAM EPICS_CA_AUTO_ARRAY_BYTES; -epicsShareExtern const ENV_PARAM EPICS_CA_MAX_SEARCH_PERIOD; -epicsShareExtern const ENV_PARAM EPICS_CA_NAME_SERVERS; -epicsShareExtern const ENV_PARAM EPICS_CA_MCAST_TTL; -epicsShareExtern const ENV_PARAM EPICS_CAS_INTF_ADDR_LIST; -epicsShareExtern const ENV_PARAM EPICS_CAS_IGNORE_ADDR_LIST; -epicsShareExtern const ENV_PARAM EPICS_CAS_AUTO_BEACON_ADDR_LIST; -epicsShareExtern const ENV_PARAM EPICS_CAS_BEACON_ADDR_LIST; -epicsShareExtern const ENV_PARAM EPICS_CAS_SERVER_PORT; -epicsShareExtern const ENV_PARAM EPICS_CA_BEACON_PERIOD; /**< \brief deprecated */ -epicsShareExtern const ENV_PARAM EPICS_CAS_BEACON_PERIOD; -epicsShareExtern const ENV_PARAM EPICS_CAS_BEACON_PORT; -epicsShareExtern const ENV_PARAM EPICS_BUILD_COMPILER_CLASS; -epicsShareExtern const ENV_PARAM EPICS_BUILD_OS_CLASS; -epicsShareExtern const ENV_PARAM EPICS_BUILD_TARGET_ARCH; -epicsShareExtern const ENV_PARAM EPICS_TZ; -epicsShareExtern const ENV_PARAM EPICS_TS_NTP_INET; -epicsShareExtern const ENV_PARAM EPICS_IOC_IGNORE_SERVERS; -epicsShareExtern const ENV_PARAM EPICS_IOC_LOG_PORT; -epicsShareExtern const ENV_PARAM EPICS_IOC_LOG_INET; -epicsShareExtern const ENV_PARAM EPICS_IOC_LOG_FILE_LIMIT; -epicsShareExtern const ENV_PARAM EPICS_IOC_LOG_FILE_NAME; -epicsShareExtern const ENV_PARAM EPICS_IOC_LOG_FILE_COMMAND; -epicsShareExtern const ENV_PARAM IOCSH_PS1; -epicsShareExtern const ENV_PARAM IOCSH_HISTSIZE; -epicsShareExtern const ENV_PARAM IOCSH_HISTEDIT_DISABLE; -epicsShareExtern const ENV_PARAM *env_param_list[]; +LIBCOM_API extern const ENV_PARAM EPICS_CA_ADDR_LIST; +LIBCOM_API extern const ENV_PARAM EPICS_CA_CONN_TMO; +LIBCOM_API extern const ENV_PARAM EPICS_CA_AUTO_ADDR_LIST; +LIBCOM_API extern const ENV_PARAM EPICS_CA_REPEATER_PORT; +LIBCOM_API extern const ENV_PARAM EPICS_CA_SERVER_PORT; +LIBCOM_API extern const ENV_PARAM EPICS_CA_MAX_ARRAY_BYTES; +LIBCOM_API extern const ENV_PARAM EPICS_CA_AUTO_ARRAY_BYTES; +LIBCOM_API extern const ENV_PARAM EPICS_CA_MAX_SEARCH_PERIOD; +LIBCOM_API extern const ENV_PARAM EPICS_CA_NAME_SERVERS; +LIBCOM_API extern const ENV_PARAM EPICS_CA_MCAST_TTL; +LIBCOM_API extern const ENV_PARAM EPICS_CAS_INTF_ADDR_LIST; +LIBCOM_API extern const ENV_PARAM EPICS_CAS_IGNORE_ADDR_LIST; +LIBCOM_API extern const ENV_PARAM EPICS_CAS_AUTO_BEACON_ADDR_LIST; +LIBCOM_API extern const ENV_PARAM EPICS_CAS_BEACON_ADDR_LIST; +LIBCOM_API extern const ENV_PARAM EPICS_CAS_SERVER_PORT; +LIBCOM_API extern const ENV_PARAM EPICS_CA_BEACON_PERIOD; /**< \brief deprecated */ +LIBCOM_API extern const ENV_PARAM EPICS_CAS_BEACON_PERIOD; +LIBCOM_API extern const ENV_PARAM EPICS_CAS_BEACON_PORT; +LIBCOM_API extern const ENV_PARAM EPICS_BUILD_COMPILER_CLASS; +LIBCOM_API extern const ENV_PARAM EPICS_BUILD_OS_CLASS; +LIBCOM_API extern const ENV_PARAM EPICS_BUILD_TARGET_ARCH; +LIBCOM_API extern const ENV_PARAM EPICS_TZ; +LIBCOM_API extern const ENV_PARAM EPICS_TS_NTP_INET; +LIBCOM_API extern const ENV_PARAM EPICS_IOC_IGNORE_SERVERS; +LIBCOM_API extern const ENV_PARAM EPICS_IOC_LOG_PORT; +LIBCOM_API extern const ENV_PARAM EPICS_IOC_LOG_INET; +LIBCOM_API extern const ENV_PARAM EPICS_IOC_LOG_FILE_LIMIT; +LIBCOM_API extern const ENV_PARAM EPICS_IOC_LOG_FILE_NAME; +LIBCOM_API extern const ENV_PARAM EPICS_IOC_LOG_FILE_COMMAND; +LIBCOM_API extern const ENV_PARAM IOCSH_PS1; +LIBCOM_API extern const ENV_PARAM IOCSH_HISTSIZE; +LIBCOM_API extern const ENV_PARAM IOCSH_HISTEDIT_DISABLE; +LIBCOM_API extern const ENV_PARAM *env_param_list[]; struct in_addr; @@ -94,7 +94,7 @@ struct in_addr; * \return Pointer to the environment variable value string, or * NULL if no parameter value and default value was empty. */ -epicsShareFunc char * epicsShareAPI +LIBCOM_API char * epicsStdCall envGetConfigParam(const ENV_PARAM *pParam, int bufDim, char *pBuf); /** @@ -105,7 +105,7 @@ epicsShareFunc char * epicsShareAPI * the default value for the parameter, or NULL if those strings * were empty or not set. */ -epicsShareFunc const char * epicsShareAPI +LIBCOM_API const char * epicsStdCall envGetConfigParamPtr(const ENV_PARAM *pParam); /** @@ -114,7 +114,7 @@ epicsShareFunc const char * epicsShareAPI * \param pParam Pointer to config param structure. * \return 0 */ -epicsShareFunc long epicsShareAPI +LIBCOM_API long epicsStdCall envPrtConfigParam(const ENV_PARAM *pParam); /** @@ -133,7 +133,7 @@ epicsShareFunc long epicsShareAPI * \param pAddr Pointer to struct to receive inet addr. * \return 0, or -1 if an error is encountered */ -epicsShareFunc long epicsShareAPI +LIBCOM_API long epicsStdCall envGetInetAddrConfigParam(const ENV_PARAM *pParam, struct in_addr *pAddr); /** @@ -151,7 +151,7 @@ epicsShareFunc long epicsShareAPI * \param pDouble Pointer to place to store value. * \return 0, or -1 if an error is encountered */ -epicsShareFunc long epicsShareAPI +LIBCOM_API long epicsStdCall envGetDoubleConfigParam(const ENV_PARAM *pParam, double *pDouble); /** @@ -169,7 +169,7 @@ epicsShareFunc long epicsShareAPI * \param pLong Pointer to place to store value. * \return 0, or -1 if an error is encountered */ -epicsShareFunc long epicsShareAPI +LIBCOM_API long epicsStdCall envGetLongConfigParam(const ENV_PARAM *pParam, long *pLong); /** @@ -186,7 +186,7 @@ epicsShareFunc long epicsShareAPI * \param defaultPort Port number to be used if environment settings invalid. * \return Port number. */ -epicsShareFunc unsigned short epicsShareAPI envGetInetPortConfigParam +LIBCOM_API unsigned short epicsStdCall envGetInetPortConfigParam (const ENV_PARAM *pEnv, unsigned short defaultPort); /** * \brief Get value of a boolean configuration parameter. @@ -207,7 +207,7 @@ epicsShareFunc unsigned short epicsShareAPI envGetInetPortConfigParam * \param pBool Pointer to place to store value. * \return 0, or -1 if an error is encountered */ -epicsShareFunc long epicsShareAPI +LIBCOM_API long epicsStdCall envGetBoolConfigParam(const ENV_PARAM *pParam, int *pBool); /** @@ -215,7 +215,7 @@ epicsShareFunc long epicsShareAPI * * \return 0 */ -epicsShareFunc long epicsShareAPI epicsPrtEnvParams(void); +LIBCOM_API long epicsStdCall epicsPrtEnvParams(void); /** * \brief Set an environment variable's value @@ -225,18 +225,18 @@ epicsShareFunc long epicsShareAPI epicsPrtEnvParams(void); * \param name Environment variable name. * \param value New value for environment variable. */ -epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *value); +LIBCOM_API void epicsStdCall epicsEnvSet (const char *name, const char *value); /** * \brief Clear the value of an environment variable * \param name Environment variable name. */ -epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name); +LIBCOM_API void epicsStdCall epicsEnvUnset (const char *name); /** * \brief Print value of an environment variable, or all variables * * \param name Environment variable name, or NULL to show all. */ -epicsShareFunc void epicsShareAPI epicsEnvShow (const char *name); +LIBCOM_API void epicsStdCall epicsEnvShow (const char *name); #ifdef __cplusplus } diff --git a/modules/libcom/src/env/envSubr.c b/modules/libcom/src/env/envSubr.c index 283b13290..d981ac376 100644 --- a/modules/libcom/src/env/envSubr.c +++ b/modules/libcom/src/env/envSubr.c @@ -40,7 +40,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsStdlib.h" #include "epicsStdio.h" #include "epicsString.h" @@ -79,7 +78,7 @@ * } * *-*/ -const char * epicsShareAPI envGetConfigParamPtr( +const char * epicsStdCall envGetConfigParamPtr( const ENV_PARAM *pParam /* I pointer to config param structure */ ) { @@ -137,7 +136,7 @@ const ENV_PARAM *pParam /* I pointer to config param structure */ * printf("DISPLAY is %s\n", temp); * *-*/ -char * epicsShareAPI envGetConfigParam( +char * epicsStdCall envGetConfigParam( const ENV_PARAM *pParam,/* I pointer to config param structure */ int bufDim, /* I dimension of parameter buffer */ char *pBuf /* I pointer to parameter buffer */ @@ -189,7 +188,7 @@ char *pBuf /* I pointer to parameter buffer */ * } * *-*/ -long epicsShareAPI envGetDoubleConfigParam( +long epicsStdCall envGetDoubleConfigParam( const ENV_PARAM *pParam,/* I pointer to config param structure */ double *pDouble /* O pointer to place to store value */ ) @@ -244,7 +243,7 @@ double *pDouble /* O pointer to place to store value */ * } * *-*/ -long epicsShareAPI envGetInetAddrConfigParam( +long epicsStdCall envGetInetAddrConfigParam( const ENV_PARAM *pParam,/* I pointer to config param structure */ struct in_addr *pAddr /* O pointer to struct to receive inet addr */ ) @@ -301,7 +300,7 @@ struct in_addr *pAddr /* O pointer to struct to receive inet addr */ * } * *-*/ -long epicsShareAPI envGetLongConfigParam( +long epicsStdCall envGetLongConfigParam( const ENV_PARAM *pParam,/* I pointer to config param structure */ long *pLong /* O pointer to place to store value */ ) @@ -322,7 +321,7 @@ long *pLong /* O pointer to place to store value */ } -long epicsShareAPI +long epicsStdCall envGetBoolConfigParam(const ENV_PARAM *pParam, int *pBool) { char text[20]; @@ -351,7 +350,7 @@ envGetBoolConfigParam(const ENV_PARAM *pParam, int *pBool) * envPrtConfigParam(&EPICS_TS_NTP_INET); * *-*/ -long epicsShareAPI envPrtConfigParam( +long epicsStdCall envPrtConfigParam( const ENV_PARAM *pParam) /* pointer to config param structure */ { const char *pVal; @@ -381,7 +380,7 @@ const ENV_PARAM *pParam) /* pointer to config param structure */ * epicsPrtEnvParams(); * *-*/ -long epicsShareAPI +long epicsStdCall epicsPrtEnvParams(void) { const ENV_PARAM **ppParam = env_param_list; @@ -395,7 +394,7 @@ epicsPrtEnvParams(void) /* * envGetInetPortConfigParam () */ -epicsShareFunc unsigned short epicsShareAPI envGetInetPortConfigParam +LIBCOM_API unsigned short epicsStdCall envGetInetPortConfigParam (const ENV_PARAM *pEnv, unsigned short defaultPort) { long longStatus; diff --git a/modules/libcom/src/error/errSymLib.c b/modules/libcom/src/error/errSymLib.c index 8f59718c8..33fe2e5f9 100644 --- a/modules/libcom/src/error/errSymLib.c +++ b/modules/libcom/src/error/errSymLib.c @@ -19,7 +19,6 @@ #include #include -#define epicsExportSharedSymbols #include "cantProceed.h" #include "epicsAssert.h" #include "epicsStdio.h" diff --git a/modules/libcom/src/error/errSymTbl.h b/modules/libcom/src/error/errSymTbl.h index 7fc25f733..c3c0c49af 100644 --- a/modules/libcom/src/error/errSymTbl.h +++ b/modules/libcom/src/error/errSymTbl.h @@ -12,7 +12,7 @@ #include -#include "shareLib.h" +#include "libComAPI.h" #include "epicsTypes.h" /* ERRSYMBOL - entry in symbol table */ @@ -34,14 +34,14 @@ typedef ERRSYMTAB *ERRSYMTAB_ID; extern "C" { #endif -epicsShareFunc void errSymLookup(long status, char *pBuf, size_t bufLength); -epicsShareFunc const char* errSymMsg(long status); -epicsShareFunc void errSymTest(epicsUInt16 modnum, epicsUInt16 begErrNum, +LIBCOM_API void errSymLookup(long status, char *pBuf, size_t bufLength); +LIBCOM_API const char* errSymMsg(long status); +LIBCOM_API void errSymTest(epicsUInt16 modnum, epicsUInt16 begErrNum, epicsUInt16 endErrNum); -epicsShareFunc void errSymTestPrint(long errNum); -epicsShareFunc int errSymBld(void); -epicsShareFunc int errSymbolAdd(long errNum, const char *name); -epicsShareFunc void errSymDump(void); +LIBCOM_API void errSymTestPrint(long errNum); +LIBCOM_API int errSymBld(void); +LIBCOM_API int errSymbolAdd(long errNum, const char *name); +LIBCOM_API void errSymDump(void); #ifdef __cplusplus } diff --git a/modules/libcom/src/error/errlog.c b/modules/libcom/src/error/errlog.c index 8445a5a7e..702a15772 100644 --- a/modules/libcom/src/error/errlog.c +++ b/modules/libcom/src/error/errlog.c @@ -18,7 +18,6 @@ #include #include -#define epicsExportSharedSymbols #define ERRLOG_INIT #include "adjustment.h" #include "dbDefs.h" @@ -39,7 +38,7 @@ #define MAX_MESSAGE_SIZE 256 /*Declare storage for errVerbose */ -epicsShareDef int errVerbose = 0; +int errVerbose = 0; static void errlogExitHandler(void *); static void errlogThread(void); diff --git a/modules/libcom/src/error/errlog.h b/modules/libcom/src/error/errlog.h index e8a4fb557..d70516353 100644 --- a/modules/libcom/src/error/errlog.h +++ b/modules/libcom/src/error/errlog.h @@ -14,7 +14,7 @@ #include #include -#include "shareLib.h" +#include "libComAPI.h" #include "compilerDependencies.h" #ifdef __cplusplus @@ -30,18 +30,18 @@ typedef enum { errlogFatal } errlogSevEnum; -epicsShareExtern int errVerbose; +LIBCOM_API extern int errVerbose; #ifdef ERRLOG_INIT - epicsShareDef const char *errlogSevEnumString[] = { + const char *errlogSevEnumString[] = { "info", "minor", "major", "fatal" }; #else - epicsShareExtern const char * errlogSevEnumString[]; + LIBCOM_API extern const char * errlogSevEnumString[]; #endif /* errMessage is a macro so it can get the file and line number */ @@ -51,38 +51,38 @@ epicsShareExtern int errVerbose; #define epicsPrintf errlogPrintf #define epicsVprintf errlogVprintf -epicsShareFunc int errlogPrintf(const char *pformat, ...) +LIBCOM_API int errlogPrintf(const char *pformat, ...) EPICS_PRINTF_STYLE(1,2); -epicsShareFunc int errlogVprintf(const char *pformat, va_list pvar); -epicsShareFunc int errlogSevPrintf(const errlogSevEnum severity, +LIBCOM_API int errlogVprintf(const char *pformat, va_list pvar); +LIBCOM_API int errlogSevPrintf(const errlogSevEnum severity, const char *pformat, ...) EPICS_PRINTF_STYLE(2,3); -epicsShareFunc int errlogSevVprintf(const errlogSevEnum severity, +LIBCOM_API int errlogSevVprintf(const errlogSevEnum severity, const char *pformat, va_list pvar); -epicsShareFunc int errlogMessage(const char *message); +LIBCOM_API int errlogMessage(const char *message); -epicsShareFunc const char * errlogGetSevEnumString(errlogSevEnum severity); -epicsShareFunc void errlogSetSevToLog(errlogSevEnum severity); -epicsShareFunc errlogSevEnum errlogGetSevToLog(void); +LIBCOM_API const char * errlogGetSevEnumString(errlogSevEnum severity); +LIBCOM_API void errlogSetSevToLog(errlogSevEnum severity); +LIBCOM_API errlogSevEnum errlogGetSevToLog(void); -epicsShareFunc void errlogAddListener(errlogListener listener, void *pPrivate); -epicsShareFunc int errlogRemoveListeners(errlogListener listener, +LIBCOM_API void errlogAddListener(errlogListener listener, void *pPrivate); +LIBCOM_API int errlogRemoveListeners(errlogListener listener, void *pPrivate); -epicsShareFunc int eltc(int yesno); -epicsShareFunc int errlogSetConsole(FILE *stream); +LIBCOM_API int eltc(int yesno); +LIBCOM_API int errlogSetConsole(FILE *stream); -epicsShareFunc int errlogInit(int bufsize); -epicsShareFunc int errlogInit2(int bufsize, int maxMsgSize); -epicsShareFunc void errlogFlush(void); +LIBCOM_API int errlogInit(int bufsize); +LIBCOM_API int errlogInit2(int bufsize, int maxMsgSize); +LIBCOM_API void errlogFlush(void); -epicsShareFunc void errPrintf(long status, const char *pFileName, int lineno, +LIBCOM_API void errPrintf(long status, const char *pFileName, int lineno, const char *pformat, ...) EPICS_PRINTF_STYLE(4,5); -epicsShareFunc int errlogPrintfNoConsole(const char *pformat, ...) +LIBCOM_API int errlogPrintfNoConsole(const char *pformat, ...) EPICS_PRINTF_STYLE(1,2); -epicsShareFunc int errlogVprintfNoConsole(const char *pformat,va_list pvar); +LIBCOM_API int errlogVprintfNoConsole(const char *pformat,va_list pvar); -epicsShareFunc void errSymLookup(long status, char *pBuf, size_t bufLength); +LIBCOM_API void errSymLookup(long status, char *pBuf, size_t bufLength); #ifdef __cplusplus } diff --git a/modules/libcom/src/fdmgr/fdManager.cpp b/modules/libcom/src/fdmgr/fdManager.cpp index 50a0f7e3e..4be6a56ce 100644 --- a/modules/libcom/src/fdmgr/fdManager.cpp +++ b/modules/libcom/src/fdmgr/fdManager.cpp @@ -22,7 +22,6 @@ #include #define instantiateRecourceLib -#define epicsExportSharedSymbols #include "epicsAssert.h" #include "epicsThread.h" #include "fdManager.h" @@ -30,7 +29,7 @@ using std :: max; -epicsShareDef fdManager fileDescriptorManager; +fdManager fileDescriptorManager; const unsigned mSecPerSec = 1000u; const unsigned uSecPerSec = 1000u * mSecPerSec; @@ -41,7 +40,7 @@ const unsigned uSecPerSec = 1000u * mSecPerSec; // hopefully its a reasonable guess that select() and epicsThreadSleep() // will have the same sleep quantum // -epicsShareFunc fdManager::fdManager () : +LIBCOM_API fdManager::fdManager () : sleepQuantum ( epicsThreadSleepQuantum () ), fdSetsPtr ( new fd_set [fdrNEnums] ), pTimerQueue ( 0 ), maxFD ( 0 ), processInProg ( false ), @@ -58,7 +57,7 @@ epicsShareFunc fdManager::fdManager () : // // fdManager::~fdManager() // -epicsShareFunc fdManager::~fdManager() +LIBCOM_API fdManager::~fdManager() { fdReg *pReg; @@ -78,7 +77,7 @@ epicsShareFunc fdManager::~fdManager() // // fdManager::process() // -epicsShareFunc void fdManager::process (double delay) +LIBCOM_API void fdManager::process (double delay) { this->lazyInitTimerQueue (); @@ -331,7 +330,7 @@ double fdManager::quantum () // // lookUpFD() // -epicsShareFunc fdReg *fdManager::lookUpFD (const SOCKET fd, const fdRegType type) +LIBCOM_API fdReg *fdManager::lookUpFD (const SOCKET fd, const fdRegType type) { if (fd<0) { return NULL; diff --git a/modules/libcom/src/fdmgr/fdManager.h b/modules/libcom/src/fdmgr/fdManager.h index 59a2f355f..585c2ef71 100644 --- a/modules/libcom/src/fdmgr/fdManager.h +++ b/modules/libcom/src/fdmgr/fdManager.h @@ -19,7 +19,7 @@ #ifndef fdManagerH_included #define fdManagerH_included -#include "shareLib.h" // reset share lib defines +#include "libComAPI.h" // reset share lib defines #include "tsDLList.h" #include "resourceLib.h" #include "epicsTime.h" @@ -33,7 +33,7 @@ enum fdRegType {fdrRead, fdrWrite, fdrException, fdrNEnums}; // // file descriptor interest id // -class epicsShareClass fdRegId +class LIBCOM_API fdRegId { public: @@ -77,12 +77,12 @@ public: // class fdInterestSubscriptionAlreadyExits {}; - epicsShareFunc fdManager (); - epicsShareFunc virtual ~fdManager (); - epicsShareFunc void process ( double delay ); // delay parameter is in seconds + LIBCOM_API fdManager (); + LIBCOM_API virtual ~fdManager (); + LIBCOM_API void process ( double delay ); // delay parameter is in seconds // returns NULL if the fd is unknown - epicsShareFunc class fdReg *lookUpFD (const SOCKET fd, const fdRegType type); + LIBCOM_API class fdReg *lookUpFD (const SOCKET fd, const fdRegType type); epicsTimer & createTimer (); @@ -113,14 +113,14 @@ private: // // default file descriptor manager // -epicsShareExtern fdManager fileDescriptorManager; +LIBCOM_API extern fdManager fileDescriptorManager; // // fdReg // // file descriptor registration // -class epicsShareClass fdReg : +class LIBCOM_API fdReg : public fdRegId, public tsDLNode, public tsSLNode { friend class fdManager; diff --git a/modules/libcom/src/fdmgr/fdmgr.cpp b/modules/libcom/src/fdmgr/fdmgr.cpp index 342bae862..a9d734896 100644 --- a/modules/libcom/src/fdmgr/fdmgr.cpp +++ b/modules/libcom/src/fdmgr/fdmgr.cpp @@ -22,7 +22,6 @@ // #include -#define epicsExportSharedSymbols #include "locationException.h" #include "epicsAssert.h" #include "fdManager.h" @@ -41,14 +40,14 @@ public: class noFunctionSpecified {}; class doubleDelete {}; - epicsShareFunc fdRegForOldFdmgr (const SOCKET fdIn, const fdRegType type, + LIBCOM_API fdRegForOldFdmgr (const SOCKET fdIn, const fdRegType type, const bool onceOnly, fdManager &manager, pCallBackFDMgr pFunc, void *pParam); - epicsShareFunc ~fdRegForOldFdmgr (); + LIBCOM_API ~fdRegForOldFdmgr (); private: pCallBackFDMgr pFunc; void *pParam; - epicsShareFunc virtual void callBack (); + LIBCOM_API virtual void callBack (); fdRegForOldFdmgr ( const fdRegForOldFdmgr & ); fdRegForOldFdmgr & operator = ( const fdRegForOldFdmgr & ); }; @@ -60,8 +59,8 @@ class oldFdmgr; // class timerForOldFdmgr : public epicsTimerNotify, public chronIntIdRes { public: - epicsShareFunc timerForOldFdmgr (oldFdmgr &fdmgr, double delay, pCallBackFDMgr pFunc, void *pParam); - epicsShareFunc virtual ~timerForOldFdmgr (); + LIBCOM_API timerForOldFdmgr (oldFdmgr &fdmgr, double delay, pCallBackFDMgr pFunc, void *pParam); + LIBCOM_API virtual ~timerForOldFdmgr (); // // exceptions @@ -74,14 +73,14 @@ private: pCallBackFDMgr pFunc; void *pParam; unsigned id; - epicsShareFunc expireStatus expire ( const epicsTime & currentTime ); + LIBCOM_API expireStatus expire ( const epicsTime & currentTime ); timerForOldFdmgr ( const timerForOldFdmgr & ); timerForOldFdmgr & operator = ( const timerForOldFdmgr & ); }; class oldFdmgr : public fdManager { friend class timerForOldFdmgr; - friend epicsShareFunc int epicsShareAPI fdmgr_clear_timeout (fdctx *pfdctx, fdmgrAlarmId id); + friend LIBCOM_API int epicsStdCall fdmgr_clear_timeout (fdctx *pfdctx, fdmgrAlarmId id); public: oldFdmgr (); @@ -104,7 +103,7 @@ template class resTable; # pragma warning ( pop ) #endif -epicsShareFunc fdRegForOldFdmgr::fdRegForOldFdmgr +LIBCOM_API fdRegForOldFdmgr::fdRegForOldFdmgr (const SOCKET fdIn, const fdRegType typeIn, const bool onceOnlyIn, fdManager &managerIn, pCallBackFDMgr pFuncIn, void *pParamIn) : @@ -116,14 +115,14 @@ epicsShareFunc fdRegForOldFdmgr::fdRegForOldFdmgr } } -epicsShareFunc fdRegForOldFdmgr::~fdRegForOldFdmgr () +LIBCOM_API fdRegForOldFdmgr::~fdRegForOldFdmgr () { if (this->pFunc==NULL) { throwWithLocation ( doubleDelete () ); } } -epicsShareFunc void fdRegForOldFdmgr::callBack () +LIBCOM_API void fdRegForOldFdmgr::callBack () { (*this->pFunc) (this->pParam); } @@ -154,7 +153,7 @@ epicsTimerNotify::expireStatus timerForOldFdmgr::expire ( const epicsTime & ) oldFdmgr::oldFdmgr () {} -extern "C" epicsShareFunc fdctx * epicsShareAPI fdmgr_init (void) +extern "C" LIBCOM_API fdctx * epicsStdCall fdmgr_init (void) { oldFdmgr *pfdm; @@ -169,7 +168,7 @@ extern "C" epicsShareFunc fdctx * epicsShareAPI fdmgr_init (void) return (fdctx *) pfdm; } -extern "C" epicsShareFunc fdmgrAlarmId epicsShareAPI fdmgr_add_timeout ( +extern "C" LIBCOM_API fdmgrAlarmId epicsStdCall fdmgr_add_timeout ( fdctx *pfdctx, struct timeval *ptimeout, pCallBackFDMgr pFunc, void *pParam) { double delay = ptimeout->tv_sec + ptimeout->tv_usec / static_cast (uSecPerSec); @@ -207,7 +206,7 @@ extern "C" epicsShareFunc fdmgrAlarmId epicsShareAPI fdmgr_add_timeout ( return id; } -extern "C" epicsShareFunc int epicsShareAPI fdmgr_clear_timeout (fdctx *pfdctx, fdmgrAlarmId id) +extern "C" LIBCOM_API int epicsStdCall fdmgr_clear_timeout (fdctx *pfdctx, fdmgrAlarmId id) { oldFdmgr *pfdm = static_cast (pfdctx); timerForOldFdmgr *pTimer; @@ -227,7 +226,7 @@ extern "C" epicsShareFunc int epicsShareAPI fdmgr_clear_timeout (fdctx *pfdctx, return 0; } -extern "C" epicsShareFunc int epicsShareAPI fdmgr_add_callback ( +extern "C" LIBCOM_API int epicsStdCall fdmgr_add_callback ( fdctx *pfdctx, SOCKET fd, enum fdi_type fdi, pCallBackFDMgr pFunc, void *pParam) { oldFdmgr *pfdm = static_cast (pfdctx); @@ -269,7 +268,7 @@ extern "C" epicsShareFunc int epicsShareAPI fdmgr_add_callback ( } } -extern "C" epicsShareFunc int epicsShareAPI fdmgr_clear_callback ( +extern "C" LIBCOM_API int epicsStdCall fdmgr_clear_callback ( fdctx *pfdctx, SOCKET fd, enum fdi_type fdi) { oldFdmgr *pfdm = static_cast (pfdctx); @@ -296,7 +295,7 @@ extern "C" epicsShareFunc int epicsShareAPI fdmgr_clear_callback ( } } -extern "C" epicsShareFunc int epicsShareAPI fdmgr_pend_event (fdctx *pfdctx, struct timeval *ptimeout) +extern "C" LIBCOM_API int epicsStdCall fdmgr_pend_event (fdctx *pfdctx, struct timeval *ptimeout) { oldFdmgr *pfdm = static_cast (pfdctx); double delay = ptimeout->tv_sec + ptimeout->tv_usec / static_cast (uSecPerSec); @@ -311,7 +310,7 @@ extern "C" epicsShareFunc int epicsShareAPI fdmgr_pend_event (fdctx *pfdctx, str return 0; } -extern "C" epicsShareFunc int epicsShareAPI fdmgr_delete (fdctx *pfdctx) +extern "C" LIBCOM_API int epicsStdCall fdmgr_delete (fdctx *pfdctx) { oldFdmgr *pfdm = static_cast (pfdctx); delete pfdm; @@ -321,7 +320,7 @@ extern "C" epicsShareFunc int epicsShareAPI fdmgr_delete (fdctx *pfdctx) /* * depricated interface */ -extern "C" epicsShareFunc int epicsShareAPI fdmgr_clear_fd (fdctx *pfdctx, SOCKET fd) +extern "C" LIBCOM_API int epicsStdCall fdmgr_clear_fd (fdctx *pfdctx, SOCKET fd) { return fdmgr_clear_callback(pfdctx, fd, fdi_read); } @@ -329,7 +328,7 @@ extern "C" epicsShareFunc int epicsShareAPI fdmgr_clear_fd (fdctx *pfdctx, SOCKE /* * depricated interface */ -extern "C" epicsShareFunc int epicsShareAPI fdmgr_add_fd ( +extern "C" LIBCOM_API int epicsStdCall fdmgr_add_fd ( fdctx *pfdctx, SOCKET fd, void (*pfunc)(void *pParam), void *param) { return fdmgr_add_callback (pfdctx, fd, fdi_read, pfunc, param); diff --git a/modules/libcom/src/fdmgr/fdmgr.h b/modules/libcom/src/fdmgr/fdmgr.h index a227335e7..f19643f77 100644 --- a/modules/libcom/src/fdmgr/fdmgr.h +++ b/modules/libcom/src/fdmgr/fdmgr.h @@ -24,7 +24,7 @@ #include "bucketLib.h" #include "osiSock.h" #include "epicsThread.h" -#include "shareLib.h" +#include "libComAPI.h" #ifdef __cplusplus extern "C" { @@ -65,7 +65,7 @@ typedef unsigned fdmgrAlarmId; * Initialize a file descriptor manager session * */ -epicsShareFunc fdctx * epicsShareAPI fdmgr_init(void); +LIBCOM_API fdctx * epicsStdCall fdmgr_init(void); /* * Specify a function to be called with a specified parameter @@ -74,7 +74,7 @@ epicsShareFunc fdctx * epicsShareAPI fdmgr_init(void); * Returns fdmgrNoAlarm (zero) if alarm cant be created */ #define fdmgrNoAlarm 0 -epicsShareFunc fdmgrAlarmId epicsShareAPI fdmgr_add_timeout( +LIBCOM_API fdmgrAlarmId epicsStdCall fdmgr_add_timeout( fdctx *pfdctx, /* fd mgr ctx from fdmgr_init() */ struct timeval *ptimeout, /* relative delay from current time */ pCallBackFDMgr pfunc, /* function (handler) to call */ @@ -85,7 +85,7 @@ void *param /* first parameter passed to the func */ * Clear a timeout which has not executed its function (handler) * yet. */ -epicsShareFunc int epicsShareAPI fdmgr_clear_timeout( +LIBCOM_API int epicsStdCall fdmgr_clear_timeout( fdctx *pfdctx, /* fd mgr ctx from fdmgr_init() */ fdmgrAlarmId id /* alarm to delete */ ); @@ -107,7 +107,7 @@ fdmgrAlarmId id /* alarm to delete */ * fdmgr_add_callback() * */ -epicsShareFunc int epicsShareAPI fdmgr_add_callback( +LIBCOM_API int epicsStdCall fdmgr_add_callback( fdctx *pfdctx, /* fd mgr ctx from fdmgr_init() */ SOCKET fd, /* file descriptor */ enum fdi_type fdi, /* file descriptor interest type */ @@ -120,7 +120,7 @@ void *param /* first parameter passed to the func */ * Clear nterest in a type of file descriptor activity (IO). * */ -epicsShareFunc int epicsShareAPI fdmgr_clear_callback( +LIBCOM_API int epicsStdCall fdmgr_clear_callback( fdctx *pfdctx, /* fd mgr ctx from fdmgr_init() */ SOCKET fd, /* file descriptor */ enum fdi_type fdi /* file descriptor interest type */ @@ -135,7 +135,7 @@ enum fdi_type fdi /* file descriptor interest type */ * enough. * */ -epicsShareFunc int epicsShareAPI fdmgr_pend_event( +LIBCOM_API int epicsStdCall fdmgr_pend_event( fdctx *pfdctx, /* fd mgr ctx from fdmgr_init() */ struct timeval *ptimeout ); @@ -144,7 +144,7 @@ struct timeval *ptimeout /* * obsolete interface */ -epicsShareFunc int epicsShareAPI fdmgr_clear_fd( +LIBCOM_API int epicsStdCall fdmgr_clear_fd( fdctx *pfdctx, /* fd mgr ctx from fdmgr_init() */ SOCKET fd ); @@ -152,14 +152,14 @@ SOCKET fd /* * obsolete interface */ -epicsShareFunc int epicsShareAPI fdmgr_add_fd( +LIBCOM_API int epicsStdCall fdmgr_add_fd( fdctx *pfdctx, /* fd mgr ctx from fdmgr_init() */ SOCKET fd, pCallBackFDMgr pfunc, /* function (handler) to call */ void *param ); -epicsShareFunc int epicsShareAPI fdmgr_delete(fdctx *pfdctx); +LIBCOM_API int epicsStdCall fdmgr_delete(fdctx *pfdctx); #ifdef __cplusplus } diff --git a/modules/libcom/src/flex/flex.c b/modules/libcom/src/flex/flex.c index 008e5e670..faf61ed19 100644 --- a/modules/libcom/src/flex/flex.c +++ b/modules/libcom/src/flex/flex.c @@ -43,7 +43,6 @@ char copyright[] = #endif /* not lint */ -#define epicsExportSharedSymbols #include "epicsTempFile.h" #undef epicsExportSharedSymbols diff --git a/modules/libcom/src/freeList/freeList.h b/modules/libcom/src/freeList/freeList.h index 77ebfb82e..9c9d2866c 100644 --- a/modules/libcom/src/freeList/freeList.h +++ b/modules/libcom/src/freeList/freeList.h @@ -13,18 +13,18 @@ #define INCfreeListh #include -#include "shareLib.h" +#include "libComAPI.h" #ifdef __cplusplus extern "C" { #endif -epicsShareFunc void epicsShareAPI freeListInitPvt(void **ppvt,int size,int nmalloc); -epicsShareFunc void * epicsShareAPI freeListCalloc(void *pvt); -epicsShareFunc void * epicsShareAPI freeListMalloc(void *pvt); -epicsShareFunc void epicsShareAPI freeListFree(void *pvt,void*pmem); -epicsShareFunc void epicsShareAPI freeListCleanup(void *pvt); -epicsShareFunc size_t epicsShareAPI freeListItemsAvail(void *pvt); +LIBCOM_API void epicsStdCall freeListInitPvt(void **ppvt,int size,int nmalloc); +LIBCOM_API void * epicsStdCall freeListCalloc(void *pvt); +LIBCOM_API void * epicsStdCall freeListMalloc(void *pvt); +LIBCOM_API void epicsStdCall freeListFree(void *pvt,void*pmem); +LIBCOM_API void epicsStdCall freeListCleanup(void *pvt); +LIBCOM_API size_t epicsStdCall freeListItemsAvail(void *pvt); #ifdef __cplusplus } diff --git a/modules/libcom/src/freeList/freeListLib.c b/modules/libcom/src/freeList/freeListLib.c index b489a476d..f5396e831 100755 --- a/modules/libcom/src/freeList/freeListLib.c +++ b/modules/libcom/src/freeList/freeListLib.c @@ -22,7 +22,6 @@ #define REDZONE 0 #endif -#define epicsExportSharedSymbols #include "cantProceed.h" #include "epicsMutex.h" #include "freeList.h" @@ -41,7 +40,7 @@ typedef struct { epicsMutexId lock; }FREELISTPVT; -epicsShareFunc void epicsShareAPI +LIBCOM_API void epicsStdCall freeListInitPvt(void **ppvt,int size,int nmalloc) { FREELISTPVT *pfl; @@ -58,7 +57,7 @@ epicsShareFunc void epicsShareAPI return; } -epicsShareFunc void * epicsShareAPI freeListCalloc(void *pvt) +LIBCOM_API void * epicsStdCall freeListCalloc(void *pvt) { FREELISTPVT *pfl = pvt; # ifdef EPICS_FREELIST_DEBUG @@ -72,7 +71,7 @@ epicsShareFunc void * epicsShareAPI freeListCalloc(void *pvt) # endif } -epicsShareFunc void * epicsShareAPI freeListMalloc(void *pvt) +LIBCOM_API void * epicsStdCall freeListMalloc(void *pvt) { FREELISTPVT *pfl = pvt; # ifdef EPICS_FREELIST_DEBUG @@ -129,7 +128,7 @@ epicsShareFunc void * epicsShareAPI freeListMalloc(void *pvt) # endif } -epicsShareFunc void epicsShareAPI freeListFree(void *pvt,void*pmem) +LIBCOM_API void epicsStdCall freeListFree(void *pvt,void*pmem) { FREELISTPVT *pfl = pvt; # ifdef EPICS_FREELIST_DEBUG @@ -150,7 +149,7 @@ epicsShareFunc void epicsShareAPI freeListFree(void *pvt,void*pmem) # endif } -epicsShareFunc void epicsShareAPI freeListCleanup(void *pvt) +LIBCOM_API void epicsStdCall freeListCleanup(void *pvt) { FREELISTPVT *pfl = pvt; allocMem *phead; @@ -169,7 +168,7 @@ epicsShareFunc void epicsShareAPI freeListCleanup(void *pvt) free(pvt); } -epicsShareFunc size_t epicsShareAPI freeListItemsAvail(void *pvt) +LIBCOM_API size_t epicsStdCall freeListItemsAvail(void *pvt) { FREELISTPVT *pfl = pvt; size_t nBlocksAvailable; diff --git a/modules/libcom/src/gpHash/gpHash.h b/modules/libcom/src/gpHash/gpHash.h index d9c0dd204..6d8a3eeca 100644 --- a/modules/libcom/src/gpHash/gpHash.h +++ b/modules/libcom/src/gpHash/gpHash.h @@ -14,7 +14,7 @@ #ifndef INC_gpHash_H #define INC_gpHash_H -#include "shareLib.h" +#include "libComAPI.h" #include "ellLib.h" @@ -32,19 +32,19 @@ extern "C" { #endif /*tableSize must be power of 2 in range 256 to 65536*/ -epicsShareFunc void epicsShareAPI +LIBCOM_API void epicsStdCall gphInitPvt(struct gphPvt **ppvt, int tableSize); -epicsShareFunc GPHENTRY * epicsShareAPI +LIBCOM_API GPHENTRY * epicsStdCall gphFind(struct gphPvt *pvt, const char *name, void *pvtid); -epicsShareFunc GPHENTRY * epicsShareAPI +LIBCOM_API GPHENTRY * epicsStdCall gphFindParse(struct gphPvt *pvt, const char *name, size_t len, void *pvtid); -epicsShareFunc GPHENTRY * epicsShareAPI +LIBCOM_API GPHENTRY * epicsStdCall gphAdd(struct gphPvt *pvt, const char *name, void *pvtid); -epicsShareFunc void epicsShareAPI +LIBCOM_API void epicsStdCall gphDelete(struct gphPvt *pvt, const char *name, void *pvtid); -epicsShareFunc void epicsShareAPI gphFreeMem(struct gphPvt *pvt); -epicsShareFunc void epicsShareAPI gphDump(struct gphPvt *pvt); -epicsShareFunc void epicsShareAPI gphDumpFP(FILE *fp, struct gphPvt *pvt); +LIBCOM_API void epicsStdCall gphFreeMem(struct gphPvt *pvt); +LIBCOM_API void epicsStdCall gphDump(struct gphPvt *pvt); +LIBCOM_API void epicsStdCall gphDumpFP(FILE *fp, struct gphPvt *pvt); #ifdef __cplusplus } diff --git a/modules/libcom/src/gpHash/gpHashLib.c b/modules/libcom/src/gpHash/gpHashLib.c index a56f00a0c..34bec5ce1 100644 --- a/modules/libcom/src/gpHash/gpHashLib.c +++ b/modules/libcom/src/gpHash/gpHashLib.c @@ -13,7 +13,6 @@ #include #include -#define epicsExportSharedSymbols #include "cantProceed.h" #include "epicsMutex.h" #include "epicsStdioRedirect.h" @@ -35,7 +34,7 @@ typedef struct gphPvt { #define MAX_SIZE 65536 -void epicsShareAPI gphInitPvt(gphPvt **ppvt, int size) +void epicsStdCall gphInitPvt(gphPvt **ppvt, int size) { gphPvt *pgphPvt; @@ -59,7 +58,7 @@ void epicsShareAPI gphInitPvt(gphPvt **ppvt, int size) return; } -GPHENTRY * epicsShareAPI gphFindParse(gphPvt *pgphPvt, const char *name, size_t len, void *pvtid) +GPHENTRY * epicsStdCall gphFindParse(gphPvt *pgphPvt, const char *name, size_t len, void *pvtid) { ELLLIST **paplist; ELLLIST *gphlist; @@ -90,12 +89,12 @@ GPHENTRY * epicsShareAPI gphFindParse(gphPvt *pgphPvt, const char *name, size_t return pgphNode; } -GPHENTRY * epicsShareAPI gphFind(gphPvt *pgphPvt, const char *name, void *pvtid) +GPHENTRY * epicsStdCall gphFind(gphPvt *pgphPvt, const char *name, void *pvtid) { return gphFindParse(pgphPvt, name, strlen(name), pvtid); } -GPHENTRY * epicsShareAPI gphAdd(gphPvt *pgphPvt, const char *name, void *pvtid) +GPHENTRY * epicsStdCall gphAdd(gphPvt *pgphPvt, const char *name, void *pvtid) { ELLLIST **paplist; ELLLIST *plist; @@ -140,7 +139,7 @@ GPHENTRY * epicsShareAPI gphAdd(gphPvt *pgphPvt, const char *name, void *pvtid) return (pgphNode); } -void epicsShareAPI gphDelete(gphPvt *pgphPvt, const char *name, void *pvtid) +void epicsStdCall gphDelete(gphPvt *pgphPvt, const char *name, void *pvtid) { ELLLIST **paplist; ELLLIST *plist = NULL; @@ -174,7 +173,7 @@ void epicsShareAPI gphDelete(gphPvt *pgphPvt, const char *name, void *pvtid) return; } -void epicsShareAPI gphFreeMem(gphPvt *pgphPvt) +void epicsStdCall gphFreeMem(gphPvt *pgphPvt) { ELLLIST **paplist; int h; @@ -204,12 +203,12 @@ void epicsShareAPI gphFreeMem(gphPvt *pgphPvt) free(pgphPvt); } -void epicsShareAPI gphDump(gphPvt *pgphPvt) +void epicsStdCall gphDump(gphPvt *pgphPvt) { gphDumpFP(stdout, pgphPvt); } -void epicsShareAPI gphDumpFP(FILE *fp, gphPvt *pgphPvt) +void epicsStdCall gphDumpFP(FILE *fp, gphPvt *pgphPvt) { unsigned int empty = 0; ELLLIST **paplist; diff --git a/modules/libcom/src/iocsh/initHooks.c b/modules/libcom/src/iocsh/initHooks.c index 0884bdd0a..4c955afad 100644 --- a/modules/libcom/src/iocsh/initHooks.c +++ b/modules/libcom/src/iocsh/initHooks.c @@ -16,7 +16,6 @@ #include #include -#define epicsExportSharedSymbols #include "dbDefs.h" #include "ellLib.h" #include "epicsMutex.h" diff --git a/modules/libcom/src/iocsh/initHooks.h b/modules/libcom/src/iocsh/initHooks.h index 261568e9d..070f15cbc 100644 --- a/modules/libcom/src/iocsh/initHooks.h +++ b/modules/libcom/src/iocsh/initHooks.h @@ -15,7 +15,7 @@ #ifndef INC_initHooks_H #define INC_initHooks_H -#include "shareLib.h" +#include "libComAPI.h" #ifdef __cplusplus extern "C" { @@ -64,10 +64,10 @@ typedef enum { } initHookState; typedef void (*initHookFunction)(initHookState state); -epicsShareFunc int initHookRegister(initHookFunction func); -epicsShareFunc void initHookAnnounce(initHookState state); -epicsShareFunc const char *initHookName(int state); -epicsShareFunc void initHookFree(void); +LIBCOM_API int initHookRegister(initHookFunction func); +LIBCOM_API void initHookAnnounce(initHookState state); +LIBCOM_API const char *initHookName(int state); +LIBCOM_API void initHookFree(void); #ifdef __cplusplus } diff --git a/modules/libcom/src/iocsh/iocsh.cpp b/modules/libcom/src/iocsh/iocsh.cpp index 0492156e7..4a2b3b7e8 100644 --- a/modules/libcom/src/iocsh/iocsh.cpp +++ b/modules/libcom/src/iocsh/iocsh.cpp @@ -19,7 +19,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsMath.h" #include "errlog.h" #include "macLib.h" @@ -39,7 +38,7 @@ extern "C" { /* * Global link to pdbbase */ -epicsShareDef struct dbBase **iocshPpdbbase; +struct dbBase **iocshPpdbbase; /* * File-local information @@ -109,7 +108,7 @@ iocshTableUnlock (void) /* * Register a command */ -void epicsShareAPI iocshRegister (const iocshFuncDef *piocshFuncDef, +void epicsStdCall iocshRegister (const iocshFuncDef *piocshFuncDef, iocshCallFunc func) { struct iocshCommand *l, *p, *n; @@ -152,7 +151,7 @@ void epicsShareAPI iocshRegister (const iocshFuncDef *piocshFuncDef, /* * Retrieves a previously registered function with the given name. */ -const iocshCmdDef * epicsShareAPI iocshFindCommand(const char *name) +const iocshCmdDef * epicsStdCall iocshFindCommand(const char *name) { return (iocshCmdDef *) registryFind(iocshCmdID, name); } @@ -165,7 +164,7 @@ static const iocshArg varCmdArg1 = { "[value]]", iocshArgString}; static const iocshArg *varCmdArgs[2] = {&varCmdArg0, &varCmdArg1}; static const iocshFuncDef varFuncDef = {"var", 2, varCmdArgs}; -void epicsShareAPI iocshRegisterVariable (const iocshVarDef *piocshVarDef) +void epicsStdCall iocshRegisterVariable (const iocshVarDef *piocshVarDef) { struct iocshVariable *l, *p, *n; int i; @@ -220,7 +219,7 @@ void epicsShareAPI iocshRegisterVariable (const iocshVarDef *piocshVarDef) /* * Retrieves a previously registered variable with the given name. */ -const iocshVarDef * epicsShareAPI iocshFindVariable(const char *name) +const iocshVarDef * epicsStdCall iocshFindVariable(const char *name) { struct iocshVariable *temp = (iocshVariable *) registryFind(iocshVarID, name); return temp ? temp->pVarDef : 0; @@ -229,7 +228,7 @@ const iocshVarDef * epicsShareAPI iocshFindVariable(const char *name) /* * Free storage created by iocshRegister/iocshRegisterVariable */ -void epicsShareAPI iocshFree(void) +void epicsStdCall iocshFree(void) { struct iocshCommand *pc; struct iocshVariable *pv; @@ -1008,19 +1007,19 @@ iocshBody (const char *pathname, const char *commandLine, const char *macros) /* * External access to the command interpreter */ -int epicsShareAPI +int epicsStdCall iocsh (const char *pathname) { return iocshLoad(pathname, NULL); } -int epicsShareAPI +int epicsStdCall iocshCmd (const char *cmd) { return iocshRun(cmd, NULL); } -int epicsShareAPI +int epicsStdCall iocshLoad(const char *pathname, const char *macros) { if (pathname) @@ -1028,7 +1027,7 @@ iocshLoad(const char *pathname, const char *macros) return iocshBody(pathname, NULL, macros); } -int epicsShareAPI +int epicsStdCall iocshRun(const char *cmd, const char *macros) { if (cmd == NULL) @@ -1051,7 +1050,7 @@ iocshRun(const char *cmd, const char *macros) * and update the shared MAC_HANDLE that the iocsh uses. Which is * what this function is provided for. */ -void epicsShareAPI +void epicsStdCall iocshEnvClear(const char *name) { iocshContext *context; diff --git a/modules/libcom/src/iocsh/iocsh.h b/modules/libcom/src/iocsh/iocsh.h index e69bd3c7b..407b15314 100644 --- a/modules/libcom/src/iocsh/iocsh.h +++ b/modules/libcom/src/iocsh/iocsh.h @@ -15,7 +15,7 @@ #include #include "compilerDependencies.h" -#include "shareLib.h" +#include "libComAPI.h" #if defined(vxWorks) || defined(__rtems__) #define IOCSH_STATIC_FUNC @@ -72,48 +72,48 @@ typedef struct iocshCmdDef { iocshCallFunc func; }iocshCmdDef; -epicsShareFunc void epicsShareAPI iocshRegister( +LIBCOM_API void epicsStdCall iocshRegister( const iocshFuncDef *piocshFuncDef, iocshCallFunc func); -epicsShareFunc void epicsShareAPI iocshRegisterVariable ( +LIBCOM_API void epicsStdCall iocshRegisterVariable ( const iocshVarDef *piocshVarDef); -epicsShareFunc const iocshCmdDef * epicsShareAPI iocshFindCommand( +LIBCOM_API const iocshCmdDef * epicsStdCall iocshFindCommand( const char* name) EPICS_DEPRECATED; -epicsShareFunc const iocshVarDef * epicsShareAPI iocshFindVariable( +LIBCOM_API const iocshVarDef * epicsStdCall iocshFindVariable( const char* name); /* iocshFree frees storage used by iocshRegister*/ /* This should only be called when iocsh is no longer needed*/ -epicsShareFunc void epicsShareAPI iocshFree(void); +LIBCOM_API void epicsStdCall iocshFree(void); /** shorthand for \code iocshLoad(pathname, NULL) \endcode */ -epicsShareFunc int epicsShareAPI iocsh(const char *pathname); +LIBCOM_API int epicsStdCall iocsh(const char *pathname); /** shorthand for \code iocshRun(cmd, NULL) \endcode */ -epicsShareFunc int epicsShareAPI iocshCmd(const char *cmd); +LIBCOM_API int epicsStdCall iocshCmd(const char *cmd); /** Read and evaluate IOC shell commands from the given file. * \param pathname Path to script file * \param macros NULL or a comma seperated list of macro definitions. eg. "VAR1=x,VAR2=y" * \return 0 on success, non-zero on error */ -epicsShareFunc int epicsShareAPI iocshLoad(const char *pathname, const char* macros); +LIBCOM_API int epicsStdCall iocshLoad(const char *pathname, const char* macros); /** Evaluate a single IOC shell command * \param cmd Command string. eg. "echo \"something or other\"" * \param macros NULL or a comma seperated list of macro definitions. eg. "VAR1=x,VAR2=y" * \return 0 on success, non-zero on error */ -epicsShareFunc int epicsShareAPI iocshRun(const char *cmd, const char* macros); +LIBCOM_API int epicsStdCall iocshRun(const char *cmd, const char* macros); /** \brief Signal error from an IOC shell function. * * \param err 0 - success (no op), !=0 - error * \return The err argument value. */ -epicsShareFunc int iocshSetError(int err); +LIBCOM_API int iocshSetError(int err); /* Makes macros that shadow environment variables work correctly with epicsEnvSet */ -epicsShareFunc void epicsShareAPI iocshEnvClear(const char *name); +LIBCOM_API void epicsStdCall iocshEnvClear(const char *name); /* 'weak' link to pdbbase */ -epicsShareExtern struct dbBase **iocshPpdbbase; +LIBCOM_API extern struct dbBase **iocshPpdbbase; #ifdef __cplusplus } diff --git a/modules/libcom/src/iocsh/libComRegister.c b/modules/libcom/src/iocsh/libComRegister.c index c67804aef..4cd1f73c0 100644 --- a/modules/libcom/src/iocsh/libComRegister.c +++ b/modules/libcom/src/iocsh/libComRegister.c @@ -10,7 +10,6 @@ #include -#define epicsExportSharedSymbols #include "iocsh.h" #include "asLib.h" #include "epicsStdioRedirect.h" @@ -396,7 +395,7 @@ static void installLastResortEventProviderCallFunc(const iocshArgBuf *args) static iocshVarDef asCheckClientIPDef[] = { { "asCheckClientIP", iocshArgInt, 0 }, { NULL, iocshArgInt, NULL } }; -void epicsShareAPI libComRegister(void) +void epicsStdCall libComRegister(void) { iocshRegister(&dateFuncDef, dateCallFunc); iocshRegister(&echoFuncDef, echoCallFunc); diff --git a/modules/libcom/src/iocsh/libComRegister.h b/modules/libcom/src/iocsh/libComRegister.h index ef93f4a8d..a437b6d70 100644 --- a/modules/libcom/src/iocsh/libComRegister.h +++ b/modules/libcom/src/iocsh/libComRegister.h @@ -8,13 +8,13 @@ #ifndef INC_libComRegister_H #define INC_libComRegister_H -#include "shareLib.h" +#include "libComAPI.h" #ifdef __cplusplus extern "C" { #endif -epicsShareFunc void epicsShareAPI libComRegister(void); +LIBCOM_API void epicsStdCall libComRegister(void); #ifdef __cplusplus } diff --git a/modules/libcom/src/iocsh/registry.c b/modules/libcom/src/iocsh/registry.c index 0b2e312e3..1c8ccbb91 100644 --- a/modules/libcom/src/iocsh/registry.c +++ b/modules/libcom/src/iocsh/registry.c @@ -16,7 +16,6 @@ #include #include -#define epicsExportSharedSymbols #include "dbDefs.h" #include "cantProceed.h" #include "epicsFindSymbol.h" @@ -32,7 +31,7 @@ static void registryInit(int tableSize) if(!gphPvt) cantProceed("registry why did gphInitPvt fail\n"); } -epicsShareFunc int epicsShareAPI registrySetTableSize(int size) +LIBCOM_API int epicsStdCall registrySetTableSize(int size) { if(gphPvt) { printf("registryInit already called\n"); @@ -43,7 +42,7 @@ epicsShareFunc int epicsShareAPI registrySetTableSize(int size) } -epicsShareFunc int epicsShareAPI registryAdd( +LIBCOM_API int epicsStdCall registryAdd( void *registryID,const char *name,void *data) { GPHENTRY *pentry; @@ -54,7 +53,7 @@ epicsShareFunc int epicsShareAPI registryAdd( return(TRUE); } -epicsShareFunc int epicsShareAPI registryChange( +LIBCOM_API int epicsStdCall registryChange( void *registryID,const char *name,void *data) { GPHENTRY *pentry; @@ -65,7 +64,7 @@ epicsShareFunc int epicsShareAPI registryChange( return(TRUE); } -epicsShareFunc void * epicsShareAPI registryFind( +LIBCOM_API void * epicsStdCall registryFind( void *registryID,const char *name) { GPHENTRY *pentry; @@ -77,14 +76,14 @@ epicsShareFunc void * epicsShareAPI registryFind( return(pentry->userPvt); } -epicsShareFunc void epicsShareAPI registryFree(void) +LIBCOM_API void epicsStdCall registryFree(void) { if(!gphPvt) return; gphFreeMem(gphPvt); gphPvt = 0; } -epicsShareFunc int epicsShareAPI registryDump(void) +LIBCOM_API int epicsStdCall registryDump(void) { if(!gphPvt) return(0); gphDump(gphPvt); diff --git a/modules/libcom/src/iocsh/registry.h b/modules/libcom/src/iocsh/registry.h index ea1bb7ce7..03d7fb517 100644 --- a/modules/libcom/src/iocsh/registry.h +++ b/modules/libcom/src/iocsh/registry.h @@ -10,23 +10,23 @@ #ifndef INCregistryh #define INCregistryh -#include "shareLib.h" +#include "libComAPI.h" #ifdef __cplusplus extern "C" { #endif #define DEFAULT_TABLE_SIZE 1024 -epicsShareFunc int epicsShareAPI registryAdd( +LIBCOM_API int epicsStdCall registryAdd( void *registryID,const char *name,void *data); -epicsShareFunc void *epicsShareAPI registryFind( +LIBCOM_API void *epicsStdCall registryFind( void *registryID,const char *name); -epicsShareFunc int epicsShareAPI registryChange( +LIBCOM_API int epicsStdCall registryChange( void *registryID,const char *name,void *data); -epicsShareFunc int epicsShareAPI registrySetTableSize(int size); -epicsShareFunc void epicsShareAPI registryFree(void); -epicsShareFunc int epicsShareAPI registryDump(void); +LIBCOM_API int epicsStdCall registrySetTableSize(int size); +LIBCOM_API void epicsStdCall registryFree(void); +LIBCOM_API int epicsStdCall registryDump(void); #ifdef __cplusplus } diff --git a/modules/libcom/src/log/iocLog.c b/modules/libcom/src/log/iocLog.c index ba78041c8..39f47593d 100644 --- a/modules/libcom/src/log/iocLog.c +++ b/modules/libcom/src/log/iocLog.c @@ -16,7 +16,6 @@ #include #include -#define epicsExportSharedSymbols #include "envDefs.h" #include "errlog.h" #include "logClient.h" @@ -69,7 +68,7 @@ static int getConfig (struct in_addr *pserver_addr, unsigned short *pserver_port /* * iocLogFlush () */ -void epicsShareAPI epicsShareAPI iocLogFlush (void) +void epicsStdCall epicsStdCall iocLogFlush (void) { if (iocLogClient!=NULL) { logClientFlush (iocLogClient); @@ -119,7 +118,7 @@ static logClientId iocLogClientInit (void) /* * iocLogInit() */ -int epicsShareAPI iocLogInit (void) +int epicsStdCall iocLogInit (void) { /* * check for global disable @@ -145,7 +144,7 @@ int epicsShareAPI iocLogInit (void) /* * iocLogShow () */ -void epicsShareAPI iocLogShow (unsigned level) +void epicsStdCall iocLogShow (unsigned level) { if (iocLogClient!=NULL) { logClientShow (iocLogClient, level); @@ -155,7 +154,7 @@ void epicsShareAPI iocLogShow (unsigned level) /* * logClientInit(); deprecated */ -logClientId epicsShareAPI logClientInit (void) +logClientId epicsStdCall logClientInit (void) { return iocLogClientInit (); } diff --git a/modules/libcom/src/log/iocLog.h b/modules/libcom/src/log/iocLog.h index b6f7ddf6e..18a42ee99 100644 --- a/modules/libcom/src/log/iocLog.h +++ b/modules/libcom/src/log/iocLog.h @@ -17,7 +17,7 @@ #ifndef INCiocLogh #define INCiocLogh 1 -#include "shareLib.h" +#include "libComAPI.h" #ifdef __cplusplus extern "C" { @@ -26,10 +26,10 @@ extern "C" { /* * ioc log client interface */ -epicsShareExtern int iocLogDisable; -epicsShareFunc int epicsShareAPI iocLogInit (void); -epicsShareFunc void epicsShareAPI iocLogShow (unsigned level); -epicsShareFunc void epicsShareAPI iocLogFlush (void); +LIBCOM_API extern int iocLogDisable; +LIBCOM_API int epicsStdCall iocLogInit (void); +LIBCOM_API void epicsStdCall iocLogShow (unsigned level); +LIBCOM_API void epicsStdCall iocLogFlush (void); #ifdef __cplusplus } diff --git a/modules/libcom/src/log/logClient.c b/modules/libcom/src/log/logClient.c index f6ed2e9c0..250ef85e5 100644 --- a/modules/libcom/src/log/logClient.c +++ b/modules/libcom/src/log/logClient.c @@ -20,7 +20,6 @@ #include #define EPICS_PRIVATE_API -#define epicsExportSharedSymbols #include "dbDefs.h" #include "epicsEvent.h" #include "iocLog.h" @@ -198,7 +197,7 @@ static void sendMessageChunk(logClient * pClient, const char * message) { /* * logClientSend () */ -void epicsShareAPI logClientSend ( logClientId id, const char * message ) +void epicsStdCall logClientSend ( logClientId id, const char * message ) { logClient * pClient = ( logClient * ) id; @@ -217,7 +216,7 @@ void epicsShareAPI logClientSend ( logClientId id, const char * message ) } -void epicsShareAPI logClientFlush ( logClientId id ) +void epicsStdCall logClientFlush ( logClientId id ) { unsigned nSent; int status = 0; @@ -451,7 +450,7 @@ static void logClientRestart ( logClientId id ) /* * logClientCreate() */ -logClientId epicsShareAPI logClientCreate ( +logClientId epicsStdCall logClientCreate ( struct in_addr server_addr, unsigned short server_port) { logClient *pClient; @@ -514,7 +513,7 @@ logClientId epicsShareAPI logClientCreate ( /* * logClientShow () */ -void epicsShareAPI logClientShow (logClientId id, unsigned level) +void epicsStdCall logClientShow (logClientId id, unsigned level) { logClient *pClient = (logClient *) id; @@ -547,7 +546,7 @@ void epicsShareAPI logClientShow (logClientId id, unsigned level) /* * iocLogPrefix() */ -void epicsShareAPI iocLogPrefix(const char * prefix) +void epicsStdCall iocLogPrefix(const char * prefix) { /* If we have already established a log prefix, don't let the user change diff --git a/modules/libcom/src/log/logClient.h b/modules/libcom/src/log/logClient.h index 3b3f63add..66e4e4393 100644 --- a/modules/libcom/src/log/logClient.h +++ b/modules/libcom/src/log/logClient.h @@ -17,7 +17,7 @@ #ifndef INClogClienth #define INClogClienth 1 -#include "shareLib.h" +#include "libComAPI.h" #include "osiSock.h" /* for 'struct in_addr' */ /* include default log client interface for backward compatibility */ @@ -28,16 +28,16 @@ extern "C" { #endif typedef void *logClientId; -epicsShareFunc logClientId epicsShareAPI logClientCreate ( +LIBCOM_API logClientId epicsStdCall logClientCreate ( struct in_addr server_addr, unsigned short server_port); -epicsShareFunc void epicsShareAPI logClientSend (logClientId id, const char *message); -epicsShareFunc void epicsShareAPI logClientShow (logClientId id, unsigned level); -epicsShareFunc void epicsShareAPI logClientFlush (logClientId id); -epicsShareFunc void epicsShareAPI iocLogPrefix(const char* prefix); +LIBCOM_API void epicsStdCall logClientSend (logClientId id, const char *message); +LIBCOM_API void epicsStdCall logClientShow (logClientId id, unsigned level); +LIBCOM_API void epicsStdCall logClientFlush (logClientId id); +LIBCOM_API void epicsStdCall iocLogPrefix(const char* prefix); /* deprecated interface; retained for backward compatibility */ /* note: implementations are in iocLog.c, not logClient.c */ -epicsShareFunc logClientId epicsShareAPI logClientInit (void); +LIBCOM_API logClientId epicsStdCall logClientInit (void); #ifdef __cplusplus } diff --git a/modules/libcom/src/macLib/macCore.c b/modules/libcom/src/macLib/macCore.c index 6f84d6b84..e9d80f475 100644 --- a/modules/libcom/src/macLib/macCore.c +++ b/modules/libcom/src/macLib/macCore.c @@ -25,7 +25,6 @@ #include #include -#define epicsExportSharedSymbols #include "dbDefs.h" #include "errlog.h" #include "dbmf.h" @@ -98,7 +97,7 @@ static char *Strdup( const char *string ); * of macro definitions */ long /* 0 = OK; <0 = ERROR */ -epicsShareAPI macCreateHandle( +epicsStdCall macCreateHandle( MAC_HANDLE **pHandle, /* address of variable to receive pointer */ /* to new macro substitution context */ @@ -152,7 +151,7 @@ epicsShareAPI macCreateHandle( * for the given handle */ void -epicsShareAPI macSuppressWarning( +epicsStdCall macSuppressWarning( MAC_HANDLE *handle, /* opaque handle */ int suppress /* 0 means issue, 1 means suppress */ ) @@ -172,7 +171,7 @@ epicsShareAPI macSuppressWarning( */ long /* strlen(dest), <0 if any macros are */ /* undefined */ -epicsShareAPI macExpandString( +epicsStdCall macExpandString( MAC_HANDLE *handle, /* opaque handle */ const char *src, /* source string */ @@ -231,7 +230,7 @@ epicsShareAPI macExpandString( * already existed */ long /* strlen(value) */ -epicsShareAPI macPutValue( +epicsStdCall macPutValue( MAC_HANDLE *handle, /* opaque handle */ const char *name, /* macro name */ @@ -299,7 +298,7 @@ epicsShareAPI macPutValue( * Return the value of a macro */ long /* strlen(value), <0 if undefined */ -epicsShareAPI macGetValue( +epicsStdCall macGetValue( MAC_HANDLE *handle, /* opaque handle */ const char *name, /* macro name or reference */ @@ -358,7 +357,7 @@ epicsShareAPI macGetValue( * context */ long /* 0 = OK; <0 = ERROR */ -epicsShareAPI macDeleteHandle( +epicsStdCall macDeleteHandle( MAC_HANDLE *handle ) /* opaque handle */ { MAC_ENTRY *entry, *nextEntry; @@ -390,7 +389,7 @@ epicsShareAPI macDeleteHandle( * Mark the start of a new scoping level */ long /* 0 = OK; <0 = ERROR */ -epicsShareAPI macPushScope( +epicsStdCall macPushScope( MAC_HANDLE *handle ) /* opaque handle */ { MAC_ENTRY *entry; @@ -425,7 +424,7 @@ epicsShareAPI macPushScope( * Pop all macros defined since the last call to macPushScope() */ long /* 0 = OK; <0 = ERROR */ -epicsShareAPI macPopScope( +epicsStdCall macPopScope( MAC_HANDLE *handle ) /* opaque handle */ { MAC_ENTRY *entry, *nextEntry; @@ -469,7 +468,7 @@ epicsShareAPI macPopScope( * Report macro details to standard output */ long /* 0 = OK; <0 = ERROR */ -epicsShareAPI macReportMacros( +epicsStdCall macReportMacros( MAC_HANDLE *handle ) /* opaque handle */ { const char *format = "%-1s %-16s %-16s %s\n"; diff --git a/modules/libcom/src/macLib/macEnv.c b/modules/libcom/src/macLib/macEnv.c index f102748a8..9186c67e9 100644 --- a/modules/libcom/src/macLib/macEnv.c +++ b/modules/libcom/src/macLib/macEnv.c @@ -12,18 +12,17 @@ #include #include -#define epicsExportSharedSymbols #include "errlog.h" #include "epicsString.h" #include "macLib.h" -char * epicsShareAPI +char * epicsStdCall macEnvExpand(const char *str) { return macDefExpand(str, NULL); } -char * epicsShareAPI +char * epicsStdCall macDefExpand(const char *str, MAC_HANDLE *macros) { MAC_HANDLE *handle; diff --git a/modules/libcom/src/macLib/macLib.h b/modules/libcom/src/macLib/macLib.h index 8e75d3801..3b31f59f0 100644 --- a/modules/libcom/src/macLib/macLib.h +++ b/modules/libcom/src/macLib/macLib.h @@ -25,7 +25,7 @@ #define INCmacLibH #include "ellLib.h" -#include "shareLib.h" +#include "libComAPI.h" #ifdef __cplusplus extern "C" { @@ -57,8 +57,8 @@ typedef struct { * \brief Creates a new macro substitution context. * \return 0 = OK; <0 = ERROR */ -epicsShareFunc long -epicsShareAPI macCreateHandle( +LIBCOM_API long +epicsStdCall macCreateHandle( MAC_HANDLE **handle, /**< pointer to variable to receive pointer to new macro substitution context */ @@ -75,8 +75,8 @@ epicsShareAPI macCreateHandle( * suppress the warning messages from subsequent library routines given the * same \c handle. */ -epicsShareFunc void -epicsShareAPI macSuppressWarning( +LIBCOM_API void +epicsStdCall macSuppressWarning( MAC_HANDLE *handle, /**< opaque handle */ int falseTrue /**< 0 means issue, 1 means suppress*/ @@ -94,8 +94,8 @@ epicsShareAPI macSuppressWarning( * value is the number of characters copied to \c dest. If the return value * is negative, at least one undefined macro was left unexpanded. */ -epicsShareFunc long -epicsShareAPI macExpandString( +LIBCOM_API long +epicsStdCall macExpandString( MAC_HANDLE *handle, /**< opaque handle */ const char *src, /**< source string */ @@ -112,8 +112,8 @@ epicsShareAPI macExpandString( * all scoping levels (the named macro doesn't have to exist in this case). * Macros referenced in \c value need not be defined at this point. */ -epicsShareFunc long -epicsShareAPI macPutValue( +LIBCOM_API long +epicsStdCall macPutValue( MAC_HANDLE *handle, /**< opaque handle */ const char *name, /**< macro name */ @@ -149,8 +149,8 @@ epicsShareAPI macPutValue( * the named macro is undefined at the moment of expansion. A reference * is terminated by the matching ")" or "}" character. */ -epicsShareFunc long -epicsShareAPI macGetValue( +LIBCOM_API long +epicsStdCall macGetValue( MAC_HANDLE *handle, /**< opaque handle */ const char *name, /**< macro name or reference */ @@ -167,8 +167,8 @@ epicsShareAPI macGetValue( * been returned. Macro values are always returned into strings which * were pre-allocated by the caller. */ -epicsShareFunc long -epicsShareAPI macDeleteHandle( +LIBCOM_API long +epicsStdCall macDeleteHandle( MAC_HANDLE *handle /**< opaque handle */ ); /** @@ -179,8 +179,8 @@ epicsShareAPI macDeleteHandle( * to another scope. These macros will be lost on a macPopScope() * call and those at the current scope will be re-instated. */ -epicsShareFunc long -epicsShareAPI macPushScope( +LIBCOM_API long +epicsStdCall macPushScope( MAC_HANDLE *handle /**< opaque handle */ ); /** @@ -189,8 +189,8 @@ epicsShareAPI macPushScope( * * See macPushScope() */ -epicsShareFunc long -epicsShareAPI macPopScope( +LIBCOM_API long +epicsStdCall macPopScope( MAC_HANDLE *handle /**< opaque handle */ ); /** @@ -199,8 +199,8 @@ epicsShareAPI macPopScope( * This sends details of current definitions to standard output, * and is intended purely for debugging purposes. */ -epicsShareFunc long -epicsShareAPI macReportMacros( +LIBCOM_API long +epicsStdCall macReportMacros( MAC_HANDLE *handle /**< opaque handle */ ); /** @} */ @@ -236,8 +236,8 @@ epicsShareAPI macReportMacros( * The function returns the number of definitions encountered, or -1 if * the supplied string is invalid. */ -epicsShareFunc long -epicsShareAPI macParseDefns( +LIBCOM_API long +epicsStdCall macParseDefns( MAC_HANDLE *handle, /**< opaque handle; may be NULL if debug messages are not required. */ @@ -258,8 +258,8 @@ epicsShareAPI macParseDefns( * definitions by calling macPutValue(). The pairs array is terminated * by a NULL pointer. */ -epicsShareFunc long -epicsShareAPI macInstallMacros( +LIBCOM_API long +epicsStdCall macInstallMacros( MAC_HANDLE *handle, /**< opaque handle */ char *pairs[] /**< pointer to NULL-terminated array of @@ -279,8 +279,8 @@ epicsShareAPI macInstallMacros( * pointer to this null-terminated string. It returns NULL if the source * string contains any undefined references. */ -epicsShareFunc char * -epicsShareAPI macEnvExpand( +LIBCOM_API char * +epicsStdCall macEnvExpand( const char *str /**< string to be expanded */ ); @@ -293,8 +293,8 @@ epicsShareAPI macEnvExpand( * These macros are appended to the set of macros from environment * variables when expanding the string. */ -epicsShareFunc char * -epicsShareAPI macDefExpand( +LIBCOM_API char * +epicsStdCall macDefExpand( const char *str, /**< string to be expanded */ MAC_HANDLE *macros /**< opaque handle; may be NULL if only environment variables are to be used */ diff --git a/modules/libcom/src/macLib/macUtil.c b/modules/libcom/src/macLib/macUtil.c index 7bf73542e..9171aa6ba 100644 --- a/modules/libcom/src/macLib/macUtil.c +++ b/modules/libcom/src/macLib/macUtil.c @@ -17,7 +17,6 @@ #include #include -#define epicsExportSharedSymbols #include "dbDefs.h" #include "errlog.h" #include "macLib.h" @@ -30,7 +29,7 @@ * values) */ long /* #defns encountered; <0 = ERROR */ -epicsShareAPI macParseDefns( +epicsStdCall macParseDefns( MAC_HANDLE *handle, /* opaque handle; can be NULL if default */ /* special characters are to be used */ @@ -251,7 +250,7 @@ error: * one (preferably two) NULL pointers */ long /* #macros defined; <0 = ERROR */ -epicsShareAPI macInstallMacros( +epicsStdCall macInstallMacros( MAC_HANDLE *handle, /* opaque handle */ char *pairs[] ) /* pointer to NULL-terminated array of */ diff --git a/modules/libcom/src/misc/aToIPAddr.c b/modules/libcom/src/misc/aToIPAddr.c index c21b574f6..3a05a3e94 100644 --- a/modules/libcom/src/misc/aToIPAddr.c +++ b/modules/libcom/src/misc/aToIPAddr.c @@ -14,7 +14,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsTypes.h" #include "osiSock.h" @@ -75,7 +74,7 @@ static int initIPAddr ( struct in_addr ipAddr, unsigned port, * "pAddrString" does not contain an address of the form * "n.n.n.n:p or host:p" */ -epicsShareFunc int epicsShareAPI +LIBCOM_API int epicsStdCall aToIPAddr( const char *pAddrString, unsigned short defaultPort, struct sockaddr_in *pIP ) { diff --git a/modules/libcom/src/misc/adjustment.c b/modules/libcom/src/misc/adjustment.c index ac10e28c9..ec24881f7 100644 --- a/modules/libcom/src/misc/adjustment.c +++ b/modules/libcom/src/misc/adjustment.c @@ -20,10 +20,9 @@ * After setting the following they will be declared as exports * (Appropriate for what we implenment) */ -#define epicsExportSharedSymbols #include "adjustment.h" -epicsShareFunc size_t adjustToWorstCaseAlignment(size_t size) +LIBCOM_API size_t adjustToWorstCaseAlignment(size_t size) { int align_size, adjust; struct test_long_word { char c; long lw; }; diff --git a/modules/libcom/src/misc/adjustment.h b/modules/libcom/src/misc/adjustment.h index c256569f1..a8c388467 100644 --- a/modules/libcom/src/misc/adjustment.h +++ b/modules/libcom/src/misc/adjustment.h @@ -17,7 +17,7 @@ #ifndef INCadjustmenth #define INCadjustmenth -#include "shareLib.h" +#include "libComAPI.h" #ifdef __cplusplus extern "C" { @@ -26,7 +26,7 @@ extern "C" { /** returns a value larger or equal than `size`, that is an exact multiple of the worst case alignment for the architecture on which the routine is executed. */ -epicsShareFunc size_t adjustToWorstCaseAlignment(size_t size); +LIBCOM_API size_t adjustToWorstCaseAlignment(size_t size); #ifdef __cplusplus } diff --git a/modules/libcom/src/misc/alarm.h b/modules/libcom/src/misc/alarm.h index edaaf1e5f..a73c60fda 100644 --- a/modules/libcom/src/misc/alarm.h +++ b/modules/libcom/src/misc/alarm.h @@ -20,7 +20,7 @@ #ifndef INC_alarm_H #define INC_alarm_H -#include "shareLib.h" +#include "libComAPI.h" #ifdef __cplusplus extern "C" { @@ -116,11 +116,11 @@ typedef enum { /** * \brief How to convert an alarm severity into a string */ -epicsShareExtern const char *epicsAlarmSeverityStrings [ALARM_NSEV]; +LIBCOM_API extern const char *epicsAlarmSeverityStrings [ALARM_NSEV]; /** * \brief How to convert an alarm condition/status into a string */ -epicsShareExtern const char *epicsAlarmConditionStrings [ALARM_NSTATUS]; +LIBCOM_API extern const char *epicsAlarmConditionStrings [ALARM_NSTATUS]; #ifdef __cplusplus diff --git a/modules/libcom/src/misc/alarmString.c b/modules/libcom/src/misc/alarmString.c index 4db179dcb..b09f74b87 100644 --- a/modules/libcom/src/misc/alarmString.c +++ b/modules/libcom/src/misc/alarmString.c @@ -9,12 +9,11 @@ /* String names for alarm status and severity values */ -#define epicsExportSharedSymbols #include "alarm.h" /* ALARM SEVERITIES - must match menuAlarmSevr.dbd and alarm.h */ -epicsShareDef const char * epicsAlarmSeverityStrings[ALARM_NSEV] = { +const char * epicsAlarmSeverityStrings[ALARM_NSEV] = { "NO_ALARM", "MINOR", "MAJOR", @@ -24,7 +23,7 @@ epicsShareDef const char * epicsAlarmSeverityStrings[ALARM_NSEV] = { /* ALARM STATUS - must match menuAlarmStat.dbd and alarm.h */ -epicsShareDef const char * epicsAlarmConditionStrings[ALARM_NSTATUS] = { +const char * epicsAlarmConditionStrings[ALARM_NSTATUS] = { "NO_ALARM", "READ", "WRITE", diff --git a/modules/libcom/src/misc/cantProceed.c b/modules/libcom/src/misc/cantProceed.c index 6c35796fd..d5ac257ef 100644 --- a/modules/libcom/src/misc/cantProceed.c +++ b/modules/libcom/src/misc/cantProceed.c @@ -14,13 +14,12 @@ #include #include -#define epicsExportSharedSymbols #include "errlog.h" #include "cantProceed.h" #include "epicsThread.h" #include "epicsStackTrace.h" -epicsShareFunc void * callocMustSucceed(size_t count, size_t size, const char *msg) +LIBCOM_API void * callocMustSucceed(size_t count, size_t size, const char *msg) { void * mem = NULL; if (count > 0 && size > 0) { @@ -36,7 +35,7 @@ epicsShareFunc void * callocMustSucceed(size_t count, size_t size, const char *m return mem; } -epicsShareFunc void * mallocMustSucceed(size_t size, const char *msg) +LIBCOM_API void * mallocMustSucceed(size_t size, const char *msg) { void * mem = NULL; if (size > 0) { @@ -52,7 +51,7 @@ epicsShareFunc void * mallocMustSucceed(size_t size, const char *msg) return mem; } -epicsShareFunc void cantProceed(const char *msg, ...) +LIBCOM_API void cantProceed(const char *msg, ...) { va_list pvar; va_start(pvar, msg); diff --git a/modules/libcom/src/misc/cantProceed.h b/modules/libcom/src/misc/cantProceed.h index 5fb3ef0f8..b2f8bc0b6 100644 --- a/modules/libcom/src/misc/cantProceed.h +++ b/modules/libcom/src/misc/cantProceed.h @@ -27,7 +27,7 @@ #include #include "compilerDependencies.h" -#include "shareLib.h" +#include "libComAPI.h" #ifdef __cplusplus extern "C" { @@ -42,7 +42,7 @@ extern "C" { * \param errorMessage A printf-style error message describing the error. * \param ... Any parameters required for the error message. */ -epicsShareFunc void cantProceed(const char *errorMessage, ...) +LIBCOM_API void cantProceed(const char *errorMessage, ...) EPICS_PRINTF_STYLE(1,2); /** \name Memory Allocation Functions @@ -60,14 +60,14 @@ epicsShareFunc void cantProceed(const char *errorMessage, ...) * \param errorMessage What this memory is needed for. * \return Pointer to zeroed allocated memory. */ -epicsShareFunc void * callocMustSucceed(size_t count, size_t size, +LIBCOM_API void * callocMustSucceed(size_t count, size_t size, const char *errorMessage); /** \brief A malloc() that never returns NULL. * \param size Size of block to allocate. * \param errorMessage What this memory is needed for. * \return Pointer to allocated memory. */ -epicsShareFunc void * mallocMustSucceed(size_t size, const char *errorMessage); +LIBCOM_API void * mallocMustSucceed(size_t size, const char *errorMessage); /** @} */ #ifdef __cplusplus diff --git a/modules/libcom/src/misc/epicsConvert.c b/modules/libcom/src/misc/epicsConvert.c index 9318ceb7e..bbc29aa0e 100644 --- a/modules/libcom/src/misc/epicsConvert.c +++ b/modules/libcom/src/misc/epicsConvert.c @@ -11,12 +11,11 @@ #include #include -#define epicsExportSharedSymbols #include "epicsMath.h" #include "epicsConvert.h" #include "cantProceed.h" -epicsShareFunc float epicsConvertDoubleToFloat(double value) +LIBCOM_API float epicsConvertDoubleToFloat(double value) { double abs; diff --git a/modules/libcom/src/misc/epicsConvert.h b/modules/libcom/src/misc/epicsConvert.h index 1c38bc30a..29cdbab47 100644 --- a/modules/libcom/src/misc/epicsConvert.h +++ b/modules/libcom/src/misc/epicsConvert.h @@ -11,13 +11,13 @@ #ifndef INC_epicsConvert_H #define INC_epicsConvert_H -#include +#include #ifdef __cplusplus extern "C" { #endif -epicsShareFunc float epicsConvertDoubleToFloat(double value); +LIBCOM_API float epicsConvertDoubleToFloat(double value); #ifdef __cplusplus } diff --git a/modules/libcom/src/misc/epicsExit.c b/modules/libcom/src/misc/epicsExit.c index 266835eaa..af36bce5b 100644 --- a/modules/libcom/src/misc/epicsExit.c +++ b/modules/libcom/src/misc/epicsExit.c @@ -27,7 +27,6 @@ #include #include -#define epicsExportSharedSymbols #include "ellLib.h" #include "errlog.h" #include "epicsThread.h" @@ -100,7 +99,7 @@ static void epicsExitCallAtExitsPvt(exitPvt *pep) } } -epicsShareFunc void epicsExitCallAtExits(void) +LIBCOM_API void epicsExitCallAtExits(void) { exitPvt * pep = 0; @@ -119,7 +118,7 @@ epicsShareFunc void epicsExitCallAtExits(void) epicsMutexCleanup(); } -epicsShareFunc void epicsExitCallAtThreadExits(void) +LIBCOM_API void epicsExitCallAtThreadExits(void) { exitPvt * pep; @@ -148,7 +147,7 @@ static int epicsAtExitPvt(exitPvt *pep, epicsExitFunc func, void *arg, const cha return status; } -epicsShareFunc int epicsAtThreadExit(epicsExitFunc func, void *arg) +LIBCOM_API int epicsAtThreadExit(epicsExitFunc func, void *arg) { exitPvt * pep; @@ -164,7 +163,7 @@ epicsShareFunc int epicsAtThreadExit(epicsExitFunc func, void *arg) return epicsAtExitPvt ( pep, func, arg, NULL ); } -epicsShareFunc int epicsAtExit3(epicsExitFunc func, void *arg, const char* name) +LIBCOM_API int epicsAtExit3(epicsExitFunc func, void *arg, const char* name) { int status = -1; @@ -180,7 +179,7 @@ epicsShareFunc int epicsAtExit3(epicsExitFunc func, void *arg, const char* name) return status; } -epicsShareFunc void epicsExit(int status) +LIBCOM_API void epicsExit(int status) { epicsExitCallAtExits(); epicsThreadSleep(0.1); @@ -202,7 +201,7 @@ static void exitLaterOnceFunc(void *raw) &exitNow, NULL); } -epicsShareFunc void epicsExitLater(int status) +LIBCOM_API void epicsExitLater(int status) { epicsThreadOnce(&exitLaterOnce, &exitLaterOnceFunc, &status); } diff --git a/modules/libcom/src/misc/epicsExit.h b/modules/libcom/src/misc/epicsExit.h index 23c40f8d1..4f45a97eb 100644 --- a/modules/libcom/src/misc/epicsExit.h +++ b/modules/libcom/src/misc/epicsExit.h @@ -21,7 +21,7 @@ #ifndef epicsExith #define epicsExith -#include +#include #ifdef __cplusplus extern "C" { @@ -37,14 +37,14 @@ typedef void (*epicsExitFunc)(void *arg); * \brief Calls epicsExitCallAtExits(), then the OS exit() routine. * \param status Passed to exit() */ -epicsShareFunc void epicsExit(int status); +LIBCOM_API void epicsExit(int status); /** * \brief Arrange to call epicsExit() later from a low priority thread. * * This delays the actual call to exit() so it doesn't run in this thread. * \param status Passed to exit() */ -epicsShareFunc void epicsExitLater(int status); +LIBCOM_API void epicsExitLater(int status); /** * \brief Internal routine that runs the registered exit routines. * @@ -52,14 +52,14 @@ epicsShareFunc void epicsExitLater(int status); * in reverse order of their registration. * \note Most applications will not call this routine directly. */ -epicsShareFunc void epicsExitCallAtExits(void); +LIBCOM_API void epicsExitCallAtExits(void); /** * \brief Register a function and an associated context parameter * \param func Function to be called when epicsExitCallAtExits is invoked. * \param arg Context parameter for the function. * \param name Function name */ -epicsShareFunc int epicsAtExit3(epicsExitFunc func, void *arg, const char* name); +LIBCOM_API int epicsAtExit3(epicsExitFunc func, void *arg, const char* name); /** * \brief Convenience macro to register a function and context value to be @@ -77,14 +77,14 @@ epicsShareFunc int epicsAtExit3(epicsExitFunc func, void *arg, const char* name) * entry routine returns. It will not be run if the thread gets stopped by * some other method. */ -epicsShareFunc void epicsExitCallAtThreadExits(void); +LIBCOM_API void epicsExitCallAtThreadExits(void); /** * \brief Register a function and an context value to be run by this thread * when it returns from its entry routine. * \param func Function be called at thread completion. * \param arg Context parameter for the function. */ -epicsShareFunc int epicsAtThreadExit(epicsExitFunc func, void *arg); +LIBCOM_API int epicsAtThreadExit(epicsExitFunc func, void *arg); #ifdef __cplusplus diff --git a/modules/libcom/src/misc/epicsStdlib.c b/modules/libcom/src/misc/epicsStdlib.c index f4348981b..328f519c8 100644 --- a/modules/libcom/src/misc/epicsStdlib.c +++ b/modules/libcom/src/misc/epicsStdlib.c @@ -13,7 +13,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsMath.h" #include "epicsStdlib.h" #include "epicsString.h" @@ -22,7 +21,7 @@ /* These are the conversion primitives */ -epicsShareFunc int +LIBCOM_API int epicsParseLong(const char *str, long *to, int base, char **units) { int c; @@ -53,7 +52,7 @@ epicsParseLong(const char *str, long *to, int base, char **units) return 0; } -epicsShareFunc int +LIBCOM_API int epicsParseULong(const char *str, unsigned long *to, int base, char **units) { int c; @@ -84,7 +83,7 @@ epicsParseULong(const char *str, unsigned long *to, int base, char **units) return 0; } -epicsShareFunc int +LIBCOM_API int epicsParseLLong(const char *str, long long *to, int base, char **units) { int c; @@ -115,7 +114,7 @@ epicsParseLLong(const char *str, long long *to, int base, char **units) return 0; } -epicsShareFunc int +LIBCOM_API int epicsParseULLong(const char *str, unsigned long long *to, int base, char **units) { int c; @@ -146,7 +145,7 @@ epicsParseULLong(const char *str, unsigned long long *to, int base, char **units return 0; } -epicsShareFunc int +LIBCOM_API int epicsParseDouble(const char *str, double *to, char **units) { int c; @@ -178,7 +177,7 @@ epicsParseDouble(const char *str, double *to, char **units) /* These call the primitives */ -epicsShareFunc int +LIBCOM_API int epicsParseInt8(const char *str, epicsInt8 *to, int base, char **units) { long value; @@ -194,7 +193,7 @@ epicsParseInt8(const char *str, epicsInt8 *to, int base, char **units) return 0; } -epicsShareFunc int +LIBCOM_API int epicsParseUInt8(const char *str, epicsUInt8 *to, int base, char **units) { unsigned long value; @@ -210,7 +209,7 @@ epicsParseUInt8(const char *str, epicsUInt8 *to, int base, char **units) return 0; } -epicsShareFunc int +LIBCOM_API int epicsParseInt16(const char *str, epicsInt16 *to, int base, char **units) { long value; @@ -226,7 +225,7 @@ epicsParseInt16(const char *str, epicsInt16 *to, int base, char **units) return 0; } -epicsShareFunc int +LIBCOM_API int epicsParseUInt16(const char *str, epicsUInt16 *to, int base, char **units) { unsigned long value; @@ -242,7 +241,7 @@ epicsParseUInt16(const char *str, epicsUInt16 *to, int base, char **units) return 0; } -epicsShareFunc int +LIBCOM_API int epicsParseInt32(const char *str, epicsInt32 *to, int base, char **units) { long value; @@ -260,7 +259,7 @@ epicsParseInt32(const char *str, epicsInt32 *to, int base, char **units) return 0; } -epicsShareFunc int +LIBCOM_API int epicsParseUInt32(const char *str, epicsUInt32 *to, int base, char **units) { unsigned long value; @@ -278,7 +277,7 @@ epicsParseUInt32(const char *str, epicsUInt32 *to, int base, char **units) return 0; } -epicsShareFunc int +LIBCOM_API int epicsParseInt64(const char *str, epicsInt64 *to, int base, char **units) { #if (LONG_MAX == 0x7fffffffffffffffLL) @@ -296,7 +295,7 @@ epicsParseInt64(const char *str, epicsInt64 *to, int base, char **units) return 0; } -epicsShareFunc int +LIBCOM_API int epicsParseUInt64(const char *str, epicsUInt64 *to, int base, char **units) { #if (ULONG_MAX == 0xffffffffffffffffULL) @@ -315,7 +314,7 @@ epicsParseUInt64(const char *str, epicsUInt64 *to, int base, char **units) } -epicsShareFunc int +LIBCOM_API int epicsParseFloat(const char *str, float *to, char **units) { double value, abs; @@ -339,11 +338,11 @@ epicsParseFloat(const char *str, float *to, char **units) * #define epicsStrtod strtod * * If strtod() is broken, osdStrtod.h defines this prototype: - * epicsShareFunc double epicsStrtod(const char *str, char **endp); + * LIBCOM_API double epicsStrtod(const char *str, char **endp); */ #ifndef epicsStrtod -epicsShareFunc double +LIBCOM_API double epicsStrtod(const char *str, char **endp) { const char *cp = str; diff --git a/modules/libcom/src/misc/epicsStdlib.h b/modules/libcom/src/misc/epicsStdlib.h index 20b7cd26f..7d4c293f7 100644 --- a/modules/libcom/src/misc/epicsStdlib.h +++ b/modules/libcom/src/misc/epicsStdlib.h @@ -15,7 +15,7 @@ #include #include -#include "shareLib.h" +#include "libComAPI.h" #include "osdStrtod.h" #include "epicsTypes.h" #include "errMdef.h" @@ -31,37 +31,37 @@ extern "C" { #define S_stdlib_badBase (M_stdlib | 5) /* Number base not supported */ -epicsShareFunc int +LIBCOM_API int epicsParseLong(const char *str, long *to, int base, char **units); -epicsShareFunc int +LIBCOM_API int epicsParseULong(const char *str, unsigned long *to, int base, char **units); -epicsShareFunc int +LIBCOM_API int epicsParseLLong(const char *str, long long *to, int base, char **units); -epicsShareFunc int +LIBCOM_API int epicsParseULLong(const char *str, unsigned long long *to, int base, char **units); -epicsShareFunc int +LIBCOM_API int epicsParseDouble(const char *str, double *to, char **units); -epicsShareFunc int +LIBCOM_API int epicsParseFloat(const char *str, float *to, char **units); -epicsShareFunc int +LIBCOM_API int epicsParseInt8(const char *str, epicsInt8 *to, int base, char **units); -epicsShareFunc int +LIBCOM_API int epicsParseUInt8(const char *str, epicsUInt8 *to, int base, char **units); -epicsShareFunc int +LIBCOM_API int epicsParseInt16(const char *str, epicsInt16 *to, int base, char **units); -epicsShareFunc int +LIBCOM_API int epicsParseUInt16(const char *str, epicsUInt16 *to, int base, char **units); -epicsShareFunc int +LIBCOM_API int epicsParseInt32(const char *str, epicsInt32 *to, int base, char **units); -epicsShareFunc int +LIBCOM_API int epicsParseUInt32(const char *str, epicsUInt32 *to, int base, char **units); -epicsShareFunc int +LIBCOM_API int epicsParseInt64(const char *str, epicsInt64 *to, int base, char **units); -epicsShareFunc int +LIBCOM_API int epicsParseUInt64(const char *str, epicsUInt64 *to, int base, char **units); #define epicsParseFloat32(str, to, units) epicsParseFloat(str, to, units) diff --git a/modules/libcom/src/misc/epicsString.c b/modules/libcom/src/misc/epicsString.c index e41e21b72..3f537b4bd 100644 --- a/modules/libcom/src/misc/epicsString.c +++ b/modules/libcom/src/misc/epicsString.c @@ -22,7 +22,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsStdio.h" #include "cantProceed.h" #include "epicsString.h" diff --git a/modules/libcom/src/misc/epicsString.h b/modules/libcom/src/misc/epicsString.h index 093c73df4..79e5f4931 100644 --- a/modules/libcom/src/misc/epicsString.h +++ b/modules/libcom/src/misc/epicsString.h @@ -17,32 +17,32 @@ #include #include "epicsTypes.h" -#include "shareLib.h" +#include "libComAPI.h" #ifdef __cplusplus extern "C" { #endif -epicsShareFunc int epicsStrnRawFromEscaped(char *outbuf, size_t outsize, +LIBCOM_API int epicsStrnRawFromEscaped(char *outbuf, size_t outsize, const char *inbuf, size_t inlen); -epicsShareFunc int epicsStrnEscapedFromRaw(char *outbuf, size_t outsize, +LIBCOM_API int epicsStrnEscapedFromRaw(char *outbuf, size_t outsize, const char *inbuf, size_t inlen); -epicsShareFunc size_t epicsStrnEscapedFromRawSize(const char *buf, size_t len); -epicsShareFunc int epicsStrCaseCmp(const char *s1, const char *s2); -epicsShareFunc int epicsStrnCaseCmp(const char *s1, const char *s2, size_t len); -epicsShareFunc char * epicsStrDup(const char *s); -epicsShareFunc char * epicsStrnDup(const char *s, size_t len); -epicsShareFunc int epicsStrPrintEscaped(FILE *fp, const char *s, size_t n); +LIBCOM_API size_t epicsStrnEscapedFromRawSize(const char *buf, size_t len); +LIBCOM_API int epicsStrCaseCmp(const char *s1, const char *s2); +LIBCOM_API int epicsStrnCaseCmp(const char *s1, const char *s2, size_t len); +LIBCOM_API char * epicsStrDup(const char *s); +LIBCOM_API char * epicsStrnDup(const char *s, size_t len); +LIBCOM_API int epicsStrPrintEscaped(FILE *fp, const char *s, size_t n); #define epicsStrSnPrintEscaped epicsStrnEscapedFromRaw -epicsShareFunc size_t epicsStrnLen(const char *s, size_t maxlen); -epicsShareFunc int epicsStrGlobMatch(const char *str, const char *pattern); -epicsShareFunc char * epicsStrtok_r(char *s, const char *delim, char **lasts); -epicsShareFunc unsigned int epicsStrHash(const char *str, unsigned int seed); -epicsShareFunc unsigned int epicsMemHash(const char *str, size_t length, +LIBCOM_API size_t epicsStrnLen(const char *s, size_t maxlen); +LIBCOM_API int epicsStrGlobMatch(const char *str, const char *pattern); +LIBCOM_API char * epicsStrtok_r(char *s, const char *delim, char **lasts); +LIBCOM_API unsigned int epicsStrHash(const char *str, unsigned int seed); +LIBCOM_API unsigned int epicsMemHash(const char *str, size_t length, unsigned int seed); /* dbTranslateEscape is deprecated, use epicsStrnRawFromEscaped instead */ -epicsShareFunc int dbTranslateEscape(char *s, const char *ct); +LIBCOM_API int dbTranslateEscape(char *s, const char *ct); #ifdef __cplusplus } diff --git a/modules/libcom/src/misc/epicsTypes.h b/modules/libcom/src/misc/epicsTypes.h index efc6a91cb..399cb9620 100644 --- a/modules/libcom/src/misc/epicsTypes.h +++ b/modules/libcom/src/misc/epicsTypes.h @@ -15,7 +15,7 @@ #ifndef INC_epicsTypes_H #define INC_epicsTypes_H -#include "shareLib.h" +#include "libComAPI.h" #include "compilerDependencies.h" #ifndef stringOf @@ -120,7 +120,7 @@ typedef enum { * of type name strings. */ #ifdef epicsTypesGLOBAL -epicsShareDef const char *epicsTypeNames [lastEpicsType+1] = { +const char *epicsTypeNames [lastEpicsType+1] = { "epicsInt8", "epicsUInt8", "epicsInt16", @@ -134,7 +134,7 @@ epicsShareDef const char *epicsTypeNames [lastEpicsType+1] = { "epicsOldString", }; #else /* epicsTypesGLOBAL */ -epicsShareExtern const char *epicsTypeNames [lastEpicsType+1]; +LIBCOM_API extern const char *epicsTypeNames [lastEpicsType+1]; #endif /* epicsTypesGLOBAL */ /* @@ -142,7 +142,7 @@ epicsShareExtern const char *epicsTypeNames [lastEpicsType+1]; * of type code name strings. */ #ifdef epicsTypesGLOBAL -epicsShareDef const char *epicsTypeCodeNames [lastEpicsType+1] = { +const char *epicsTypeCodeNames [lastEpicsType+1] = { "epicsInt8T", "epicsUInt8T", "epicsInt16T", @@ -156,11 +156,11 @@ epicsShareDef const char *epicsTypeCodeNames [lastEpicsType+1] = { "epicsOldStringT", }; #else /* epicsTypesGLOBAL */ -epicsShareExtern const char *epicsTypeCodeNames [lastEpicsType+1]; +LIBCOM_API extern const char *epicsTypeCodeNames [lastEpicsType+1]; #endif /* epicsTypesGLOBAL */ #ifdef epicsTypesGLOBAL -epicsShareDef const unsigned epicsTypeSizes [lastEpicsType+1] = { +const unsigned epicsTypeSizes [lastEpicsType+1] = { sizeof (epicsInt8), sizeof (epicsUInt8), sizeof (epicsInt16), @@ -174,7 +174,7 @@ epicsShareDef const unsigned epicsTypeSizes [lastEpicsType+1] = { sizeof (epicsOldString), }; #else /* epicsTypesGLOBAL */ -epicsShareExtern const unsigned epicsTypeSizes [lastEpicsType+1]; +LIBCOM_API extern const unsigned epicsTypeSizes [lastEpicsType+1]; #endif /* epicsTypesGLOBAL */ /* @@ -191,7 +191,7 @@ typedef enum { } epicsTypeClass; #ifdef epicsTypesGLOBAL -epicsShareDef const epicsTypeClass epicsTypeClasses [lastEpicsType+1] = { +const epicsTypeClass epicsTypeClasses [lastEpicsType+1] = { epicsIntC, epicsUIntC, epicsIntC, @@ -205,12 +205,12 @@ epicsShareDef const epicsTypeClass epicsTypeClasses [lastEpicsType+1] = { epicsOldStringC }; #else /* epicsTypesGLOBAL */ -epicsShareExtern const epicsTypeClass epicsTypeClasses [lastEpicsType+1]; +LIBCOM_API extern const epicsTypeClass epicsTypeClasses [lastEpicsType+1]; #endif /* epicsTypesGLOBAL */ #ifdef epicsTypesGLOBAL -epicsShareDef const char *epicsTypeAnyFieldName [lastEpicsType+1] = { +const char *epicsTypeAnyFieldName [lastEpicsType+1] = { "int8", "uInt8", "int16", @@ -224,7 +224,7 @@ epicsShareDef const char *epicsTypeAnyFieldName [lastEpicsType+1] = { "", /* Old Style Strings will not be in epicsAny type */ }; #else /* epicsTypesGLOBAL */ -epicsShareExtern const char *epicsTypeAnyFieldName [lastEpicsType+1]; +LIBCOM_API extern const char *epicsTypeAnyFieldName [lastEpicsType+1]; #endif /* epicsTypesGLOBAL */ #endif /* INC_epicsTypes_H */ diff --git a/modules/libcom/src/misc/epicsUnitTest.c b/modules/libcom/src/misc/epicsUnitTest.c index 40e67a147..c2178e4b6 100644 --- a/modules/libcom/src/misc/epicsUnitTest.c +++ b/modules/libcom/src/misc/epicsUnitTest.c @@ -21,7 +21,6 @@ # include #endif -#define epicsExportSharedSymbols #include "epicsThread.h" #include "epicsMutex.h" #include "epicsUnitTest.h" diff --git a/modules/libcom/src/misc/epicsUnitTest.h b/modules/libcom/src/misc/epicsUnitTest.h index 31aac6dc1..f090eb192 100644 --- a/modules/libcom/src/misc/epicsUnitTest.h +++ b/modules/libcom/src/misc/epicsUnitTest.h @@ -149,7 +149,7 @@ ok 3 - M_PI == 4.0*atan(1.0) #include #include "compilerDependencies.h" -#include "shareLib.h" +#include "libComAPI.h" #ifdef __cplusplus extern "C" { @@ -159,7 +159,7 @@ extern "C" { * \param tests Number of tests to be run. May be zero if not known but the * test harness then can't tell if the program dies prematurely. */ -epicsShareFunc void testPlan(int tests); +LIBCOM_API void testPlan(int tests); /** \name Announcing Test Results * Routines that declare individual test results. @@ -171,7 +171,7 @@ epicsShareFunc void testPlan(int tests); * \param ... Any parameters required for the format string. * \return The value of \p pass. */ -epicsShareFunc int testOk(int pass, const char *fmt, ...) +LIBCOM_API int testOk(int pass, const char *fmt, ...) EPICS_PRINTF_STYLE(2, 3); /** \brief Test result using condition as description * \param cond Condition to be evaluated and displayed. @@ -184,19 +184,19 @@ epicsShareFunc int testOk(int pass, const char *fmt, ...) * \param pvar A var-args pointer to any parameters for the format string. * \return The value of \p pass. */ -epicsShareFunc int testOkV(int pass, const char *fmt, va_list pvar); +LIBCOM_API int testOkV(int pass, const char *fmt, va_list pvar); /** \brief Passing test result with printf-style description. * \param fmt A printf-style format string describing the test. * \param ... Any parameters required for the format string. * \return The value of \p pass. */ -epicsShareFunc void testPass(const char *fmt, ...) +LIBCOM_API void testPass(const char *fmt, ...) EPICS_PRINTF_STYLE(1, 2); /** \brief Failing test result with printf-style description. * \param fmt A printf-style format string describing the test. * \param ... Any parameters required for the format string. */ -epicsShareFunc void testFail(const char *fmt, ...) +LIBCOM_API void testFail(const char *fmt, ...) EPICS_PRINTF_STYLE(1, 2); /** @} */ @@ -209,19 +209,19 @@ epicsShareFunc void testFail(const char *fmt, ...) * \param skip How many tests are being skipped. * \param why Reason for skipping these tests. */ -epicsShareFunc void testSkip(int skip, const char *why); +LIBCOM_API void testSkip(int skip, const char *why); /** \brief Mark the start of a group of tests that are expected to fail * \param why Reason for expected failures. */ -epicsShareFunc void testTodoBegin(const char *why); +LIBCOM_API void testTodoBegin(const char *why); /** \brief Mark the end of a failing test group. */ -epicsShareFunc void testTodoEnd(void); +LIBCOM_API void testTodoEnd(void); /** \brief Stop testing, program cannot continue. * \param fmt A printf-style format string giving the reason for stopping. * \param ... Any parameters required for the format string. */ -epicsShareFunc void testAbort(const char *fmt, ...) +LIBCOM_API void testAbort(const char *fmt, ...) EPICS_PRINTF_STYLE(1, 2); /** @} */ @@ -229,13 +229,13 @@ epicsShareFunc void testAbort(const char *fmt, ...) * \param fmt A printf-style format string containing diagnostic information. * \param ... Any parameters required for the format string. */ -epicsShareFunc int testDiag(const char *fmt, ...) +LIBCOM_API int testDiag(const char *fmt, ...) EPICS_PRINTF_STYLE(1, 2); /** \brief Mark the end of testing. */ -epicsShareFunc int testDone(void); +LIBCOM_API int testDone(void); -epicsShareFunc +LIBCOM_API int testImpreciseTiming(void); /** \name Test Harness for Embedded OSs @@ -248,9 +248,9 @@ int testImpreciseTiming(void); typedef int (*TESTFUNC)(void); /** \brief Initialize test harness */ -epicsShareFunc void testHarness(void); -epicsShareFunc void testHarnessExit(void *dummy); -epicsShareFunc void runTestFunc(const char *name, TESTFUNC func); +LIBCOM_API void testHarness(void); +LIBCOM_API void testHarnessExit(void *dummy); +LIBCOM_API void runTestFunc(const char *name, TESTFUNC func); /** \brief Run a test program * \param func Name of the test program. diff --git a/modules/libcom/src/misc/ipAddrToAsciiAsynchronous.cpp b/modules/libcom/src/misc/ipAddrToAsciiAsynchronous.cpp index ec2c16ded..4698a7af7 100644 --- a/modules/libcom/src/misc/ipAddrToAsciiAsynchronous.cpp +++ b/modules/libcom/src/misc/ipAddrToAsciiAsynchronous.cpp @@ -21,7 +21,6 @@ //#define EPICS_FREELIST_DEBUG #define EPICS_PRIVATE_API -#define epicsExportSharedSymbols #include "ipAddrToAsciiAsynchronous.h" #include "epicsThread.h" #include "epicsMutex.h" diff --git a/modules/libcom/src/misc/ipAddrToAsciiAsynchronous.h b/modules/libcom/src/misc/ipAddrToAsciiAsynchronous.h index 9aefca44e..64a0efa73 100644 --- a/modules/libcom/src/misc/ipAddrToAsciiAsynchronous.h +++ b/modules/libcom/src/misc/ipAddrToAsciiAsynchronous.h @@ -17,16 +17,16 @@ #define ipAddrToAsciiAsynchronous_h #include "osiSock.h" -#include "shareLib.h" +#include "libComAPI.h" -class epicsShareClass ipAddrToAsciiCallBack { +class LIBCOM_API ipAddrToAsciiCallBack { public: virtual void transactionComplete ( const char * pHostName ) = 0; virtual void show ( unsigned level ) const; virtual ~ipAddrToAsciiCallBack () = 0; }; -class epicsShareClass ipAddrToAsciiTransaction { +class LIBCOM_API ipAddrToAsciiTransaction { public: virtual void release () = 0; virtual void ipAddrToAscii ( const osiSockAddr &, ipAddrToAsciiCallBack & ) = 0; @@ -36,7 +36,7 @@ protected: virtual ~ipAddrToAsciiTransaction () = 0; }; -class epicsShareClass ipAddrToAsciiEngine { +class LIBCOM_API ipAddrToAsciiEngine { public: virtual void release () = 0; virtual ipAddrToAsciiTransaction & createTransaction () = 0; diff --git a/modules/libcom/src/misc/truncateFile.c b/modules/libcom/src/misc/truncateFile.c index dc074d9fb..4271867d5 100644 --- a/modules/libcom/src/misc/truncateFile.c +++ b/modules/libcom/src/misc/truncateFile.c @@ -14,7 +14,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsStdio.h" #ifndef SEEK_END @@ -25,7 +24,7 @@ * truncate to specified size (we dont use truncate() * because it is not portable) */ -epicsShareFunc enum TF_RETURN truncateFile (const char *pFileName, unsigned long size) +LIBCOM_API enum TF_RETURN truncateFile (const char *pFileName, unsigned long size) { long filePos; FILE *pFile; diff --git a/modules/libcom/src/misc/unixFileName.h b/modules/libcom/src/misc/unixFileName.h index 0b6edb92e..b9a5bf05a 100644 --- a/modules/libcom/src/misc/unixFileName.h +++ b/modules/libcom/src/misc/unixFileName.h @@ -14,7 +14,7 @@ #ifndef unixFileNameH #define unixFileNameH -#include +#include #ifdef __cplusplus extern "C" { @@ -26,13 +26,13 @@ extern "C" { /** Return the absolute path of the current executable. \return NULL or the path. Caller must free() */ -epicsShareFunc +LIBCOM_API char *epicsGetExecName(void); /** Return the absolute path of the directory containing the current executable. \return NULL or the path. Caller must free() */ -epicsShareFunc +LIBCOM_API char *epicsGetExecDir(void); #ifdef __cplusplus diff --git a/modules/libcom/src/osi/devLibVME.c b/modules/libcom/src/osi/devLibVME.c index 6c7d93f99..72e29d601 100644 --- a/modules/libcom/src/osi/devLibVME.c +++ b/modules/libcom/src/osi/devLibVME.c @@ -23,7 +23,6 @@ #include #include -#define epicsExportSharedSymbols #include "dbDefs.h" #include "epicsMutex.h" #include "errlog.h" diff --git a/modules/libcom/src/osi/devLibVME.h b/modules/libcom/src/osi/devLibVME.h index fbf8b399a..0fe0669a6 100644 --- a/modules/libcom/src/osi/devLibVME.h +++ b/modules/libcom/src/osi/devLibVME.h @@ -29,7 +29,7 @@ #include "dbDefs.h" #include "osdVME.h" #include "errMdef.h" -#include "shareLib.h" +#include "libComAPI.h" #include "devLib.h" #ifdef __cplusplus @@ -47,7 +47,7 @@ typedef enum { } epicsAddressType; /** \brief A string representation of each of the bus address types */ -epicsShareExtern const char *epicsAddressTypeName[]; +LIBCOM_API extern const char *epicsAddressTypeName[]; #ifdef __cplusplus } @@ -70,7 +70,7 @@ extern "C" { * each registered address. * \return 0, or an error status value */ -epicsShareFunc long devAddressMap(void); +LIBCOM_API long devAddressMap(void); /** \brief Translate a bus address to a pointer the CPU can use. * @@ -81,7 +81,7 @@ epicsShareFunc long devAddressMap(void); * \param *ppLocalAddr Where to put the CPU pointer. * \return 0, or an error status value. */ -epicsShareFunc long devBusToLocalAddr ( +LIBCOM_API long devBusToLocalAddr ( epicsAddressType addrType, size_t busAddr, volatile void **ppLocalAddr); @@ -96,7 +96,7 @@ epicsShareFunc long devBusToLocalAddr ( * \return 0, or an error status value if the location could not be * accessed or the read caused a bus error. */ -epicsShareFunc long devReadProbe ( +LIBCOM_API long devReadProbe ( unsigned wordSize, volatile const void *ptr, void *pValueRead); /** \brief Read-probe a range of bus addresses, looking for empty space. @@ -113,7 +113,7 @@ epicsShareFunc long devReadProbe ( * \param size Range of bus addresses to test, in bytes. * \return 0 if no devices respond, or an error status value. */ -epicsShareFunc long devNoResponseProbe( +LIBCOM_API long devNoResponseProbe( epicsAddressType addrType, size_t base, size_t size @@ -129,7 +129,7 @@ epicsShareFunc long devNoResponseProbe( * \return 0, or an error status value if the location could not be * accessed or the write caused a bus error. */ -epicsShareFunc long devWriteProbe ( +LIBCOM_API long devWriteProbe ( unsigned wordSize, volatile void *ptr, const void *pValueWritten); /** \brief Register a bus address range with a name. @@ -146,7 +146,7 @@ epicsShareFunc long devWriteProbe ( * \param pPhysicalAddress Where to put the converted CPU pointer. * \return 0, or an error status. */ -epicsShareFunc long devRegisterAddress( +LIBCOM_API long devRegisterAddress( const char *pOwnerName, epicsAddressType addrType, size_t logicalBaseAddress, @@ -162,7 +162,7 @@ epicsShareFunc long devRegisterAddress( * \param pOwnerName The name of the driver that owns this range. * \return 0, or an error status. */ -epicsShareFunc long devUnregisterAddress( +LIBCOM_API long devUnregisterAddress( epicsAddressType addrType, size_t logicalBaseAddress, const char *pOwnerName); @@ -185,7 +185,7 @@ epicsShareFunc long devUnregisterAddress( * \param pLocalAddress Where to put the CPU pointer. * \return 0, or an error status value. */ -epicsShareFunc long devAllocAddress( +LIBCOM_API long devAllocAddress( const char *pOwnerName, epicsAddressType addrType, size_t size, @@ -211,7 +211,7 @@ epicsShareFunc long devAllocAddress( * \param parameter Context parameter for the ISR. * \return 0, or an error status value. */ -epicsShareFunc long devConnectInterruptVME( +LIBCOM_API long devConnectInterruptVME( unsigned vectorNumber, void (*pFunction)(void *), void *parameter); @@ -229,7 +229,7 @@ epicsShareFunc long devConnectInterruptVME( * \param pFunction The ISR to be disconnected. * \return 0, or an error status value. */ -epicsShareFunc long devDisconnectInterruptVME( +LIBCOM_API long devDisconnectInterruptVME( unsigned vectorNumber, void (*pFunction)(void *)); @@ -240,7 +240,7 @@ epicsShareFunc long devDisconnectInterruptVME( * \param vectorNumber Interrupt vector number. * \return True if vector has an ISR attached, otherwise false. */ -epicsShareFunc int devInterruptInUseVME (unsigned vectorNumber); +LIBCOM_API int devInterruptInUseVME (unsigned vectorNumber); /** \brief Enable a VME interrupt level onto the CPU. * @@ -252,7 +252,7 @@ epicsShareFunc int devInterruptInUseVME (unsigned vectorNumber); * \param level VMEbus interrupt level to enable, 1-7. * \return 0, or an error status value. */ -epicsShareFunc long devEnableInterruptLevelVME (unsigned level); +LIBCOM_API long devEnableInterruptLevelVME (unsigned level); /** \brief Disable a VME interrupt level. * @@ -265,7 +265,7 @@ epicsShareFunc long devEnableInterruptLevelVME (unsigned level); * \param level VMEbus interrupt level to disable, 1-7. * \return 0, or an error status value. */ -epicsShareFunc long devDisableInterruptLevelVME (unsigned level); +LIBCOM_API long devDisableInterruptLevelVME (unsigned level); /** @} */ /** \name Memory for VME DMA Operations @@ -281,7 +281,7 @@ epicsShareFunc long devDisableInterruptLevelVME (unsigned level); * \param size How many bytes to allocate * \return A pointer to the memory allocated, or NULL. */ -epicsShareFunc void *devLibA24Malloc(size_t size); +LIBCOM_API void *devLibA24Malloc(size_t size); /** \brief calloc() for VME drivers that support DMA. * @@ -291,7 +291,7 @@ epicsShareFunc void *devLibA24Malloc(size_t size); * \param size How many bytes to allocate and zero. * \return A pointer to the memory allocated, or NULL. */ -epicsShareFunc void *devLibA24Calloc(size_t size); +LIBCOM_API void *devLibA24Calloc(size_t size); /** \brief free() for VME drivers that support DMA. * @@ -299,7 +299,7 @@ epicsShareFunc void *devLibA24Calloc(size_t size); * devLibA24Malloc() or devLibA24Calloc(). * \param pBlock Block to be released. */ -epicsShareFunc void devLibA24Free(void *pBlock); +LIBCOM_API void devLibA24Free(void *pBlock); /** @} */ /** \name ISA Interrupt Management @@ -319,7 +319,7 @@ epicsShareFunc void devLibA24Free(void *pBlock); * \param parameter Parameter to the called function. * \return Returns success or error. */ -epicsShareFunc long devConnectInterruptISA( +LIBCOM_API long devConnectInterruptISA( unsigned interruptLevel, void (*pFunction)(void *), void *parameter); @@ -331,7 +331,7 @@ epicsShareFunc long devConnectInterruptISA( * \param pFunction C function pointer that was connected. * \return returns success or error. */ -epicsShareFunc long devDisconnectInterruptISA( +LIBCOM_API long devDisconnectInterruptISA( unsigned interruptLevel, void (*pFunction)(void *)); @@ -341,21 +341,21 @@ epicsShareFunc long devDisconnectInterruptISA( * \param interruptLevel Interrupt level. * \return Returns True/False. */ -epicsShareFunc int devInterruptLevelInUseISA (unsigned interruptLevel); +LIBCOM_API int devInterruptLevelInUseISA (unsigned interruptLevel); /** * Enable ISA interrupt level * \param level Interrupt level. * \return Returns True/False. */ -epicsShareFunc long devEnableInterruptLevelISA (unsigned level); +LIBCOM_API long devEnableInterruptLevelISA (unsigned level); /** * Disable ISA interrupt level * \param level Interrupt level. * \return Returns True/False. */ -epicsShareFunc long devDisableInterruptLevelISA (unsigned level); +LIBCOM_API long devDisableInterruptLevelISA (unsigned level); /** @} */ #ifndef NO_DEVLIB_OLD_INTERFACE @@ -373,7 +373,7 @@ typedef enum {intVME, intVXI, intISA} epicsInterruptType; * devConnectInterruptISA() instead. devConnectInterrupt() will be removed * in a future release. */ -epicsShareFunc long devConnectInterrupt( +LIBCOM_API long devConnectInterrupt( epicsInterruptType intType, unsigned vectorNumber, void (*pFunction)(void *), @@ -386,7 +386,7 @@ epicsShareFunc long devConnectInterrupt( * devDisconnectInterruptISA() instead. devDisconnectInterrupt() will * be removed in a future release. */ -epicsShareFunc long devDisconnectInterrupt( +LIBCOM_API long devDisconnectInterrupt( epicsInterruptType intType, unsigned vectorNumber, void (*pFunction)(void *)); @@ -398,7 +398,7 @@ epicsShareFunc long devDisconnectInterrupt( * devEnableInterruptLevelISA() instead. devEnableInterruptLevel() will * be removed in a future release. */ -epicsShareFunc long devEnableInterruptLevel( +LIBCOM_API long devEnableInterruptLevel( epicsInterruptType intType, unsigned level); /** @@ -408,7 +408,7 @@ epicsShareFunc long devEnableInterruptLevel( * devDisableInterruptLevelPCI() instead. devDisableInterruptLevel() will * be removed in a future release. */ -epicsShareFunc long devDisableInterruptLevel ( +LIBCOM_API long devDisableInterruptLevel ( epicsInterruptType intType, unsigned level); /** @@ -417,7 +417,7 @@ epicsShareFunc long devDisableInterruptLevel ( * Please use devNoResponseProbe() instead. locationProbe() will be removed * in a future release. */ -epicsShareFunc long locationProbe (epicsAddressType addrType, char *pLocation); +LIBCOM_API long locationProbe (epicsAddressType addrType, char *pLocation); /** @} */ diff --git a/modules/libcom/src/osi/devLibVMEImpl.h b/modules/libcom/src/osi/devLibVMEImpl.h index c9fea8d00..a4f45ca29 100644 --- a/modules/libcom/src/osi/devLibVMEImpl.h +++ b/modules/libcom/src/osi/devLibVMEImpl.h @@ -19,7 +19,7 @@ #define INCdevLibImplh 1 #include "dbDefs.h" -#include "shareLib.h" +#include "libComAPI.h" #include "devLib.h" #ifdef __cplusplus @@ -71,7 +71,7 @@ typedef struct devLibVME { }devLibVME; /** \brief Pointer to the entry table used by devLibVME routines. */ -epicsShareExtern devLibVME *pdevLibVME; +LIBCOM_API extern devLibVME *pdevLibVME; #ifndef NO_DEVLIB_COMPAT /** \brief An alias for pdevLibVME */ diff --git a/modules/libcom/src/osi/epicsAssert.h b/modules/libcom/src/osi/epicsAssert.h index 8df8a2e86..a7db11aad 100644 --- a/modules/libcom/src/osi/epicsAssert.h +++ b/modules/libcom/src/osi/epicsAssert.h @@ -41,7 +41,7 @@ #ifndef INC_epicsAssert_H #define INC_epicsAssert_H -#include "shareLib.h" +#include "libComAPI.h" #include "compilerDependencies.h" #ifdef __cplusplus @@ -61,7 +61,7 @@ extern "C" { #else /* NDEBUG */ /**@private */ -epicsShareFunc void epicsAssert (const char *pFile, const unsigned line, +LIBCOM_API void epicsAssert (const char *pFile, const unsigned line, const char *pExp, const char *pAuthorName); /**\brief Declare that a condition should be true. diff --git a/modules/libcom/src/osi/epicsAtomicDefault.h b/modules/libcom/src/osi/epicsAtomicDefault.h index 26115ce63..9ae98efbf 100644 --- a/modules/libcom/src/osi/epicsAtomicDefault.h +++ b/modules/libcom/src/osi/epicsAtomicDefault.h @@ -22,10 +22,10 @@ extern "C" { /* * struct EpicsAtomicLockKey; - * epicsShareFunc void epicsAtomicReadMemoryBarrier (); - * epicsShareFunc void epicsAtomicWriteMemoryBarrier (); - * epicsShareFunc void epicsAtomicLock ( struct EpicsAtomicLockKey * ); - * epicsShareFunc void epicsAtomicUnock ( struct EpicsAtomicLockKey * ); + * LIBCOM_API void epicsAtomicReadMemoryBarrier (); + * LIBCOM_API void epicsAtomicWriteMemoryBarrier (); + * LIBCOM_API void epicsAtomicLock ( struct EpicsAtomicLockKey * ); + * LIBCOM_API void epicsAtomicUnock ( struct EpicsAtomicLockKey * ); */ /* diff --git a/modules/libcom/src/osi/epicsEvent.cpp b/modules/libcom/src/osi/epicsEvent.cpp index 237f7d268..7baec772b 100644 --- a/modules/libcom/src/osi/epicsEvent.cpp +++ b/modules/libcom/src/osi/epicsEvent.cpp @@ -13,7 +13,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsEvent.h" #include "epicsStdio.h" #include "cantProceed.h" @@ -104,7 +103,7 @@ void epicsEvent::show ( unsigned level ) const extern "C" { -epicsShareFunc epicsEventId epicsEventMustCreate ( +LIBCOM_API epicsEventId epicsEventMustCreate ( epicsEventInitialState initialState) { epicsEventId id = epicsEventCreate (initialState); @@ -114,14 +113,14 @@ epicsShareFunc epicsEventId epicsEventMustCreate ( return id; } -epicsShareFunc void epicsEventMustTrigger (epicsEventId id) { +LIBCOM_API void epicsEventMustTrigger (epicsEventId id) { epicsEventStatus status = epicsEventTrigger (id); if (status != epicsEventOK) cantProceed ("epicsEventMustTrigger"); } -epicsShareFunc void epicsEventMustWait (epicsEventId id) { +LIBCOM_API void epicsEventMustWait (epicsEventId id) { epicsEventStatus status = epicsEventWait (id); if (status != epicsEventOK) diff --git a/modules/libcom/src/osi/epicsEvent.h b/modules/libcom/src/osi/epicsEvent.h index c97cb4d8a..9429b9db6 100644 --- a/modules/libcom/src/osi/epicsEvent.h +++ b/modules/libcom/src/osi/epicsEvent.h @@ -40,7 +40,7 @@ #ifndef epicsEventh #define epicsEventh -#include "shareLib.h" +#include "libComAPI.h" /** \brief An identifier for an epicsEvent for use with the C API */ typedef struct epicsEventOSD *epicsEventId; @@ -75,7 +75,7 @@ typedef enum { * immediately. Multiple calls to trigger() may occur between wait() calls * but will have the same effect as a single trigger(), filling the event. **/ -class epicsShareClass epicsEvent { +class LIBCOM_API epicsEvent { public: /**\brief Constructor. * \param initial State when created, empty (the default) or full. @@ -128,7 +128,7 @@ extern "C" { * \param initialState Starting state, \c epicsEventEmpty or \c epicsEventFull. * \return An identifier for the new event, or NULL if one not be created. **/ -epicsShareFunc epicsEventId epicsEventCreate( +LIBCOM_API epicsEventId epicsEventCreate( epicsEventInitialState initialState); /**\brief Create an epicsEvent for use from C code. @@ -137,7 +137,7 @@ epicsShareFunc epicsEventId epicsEventCreate( * \param initialState Starting state, \c epicsEventEmpty or \c epicsEventFull. * \return An identifier for the new event. **/ -epicsShareFunc epicsEventId epicsEventMustCreate ( +LIBCOM_API epicsEventId epicsEventMustCreate ( epicsEventInitialState initialState); /**\brief Destroy an epicsEvent and any resources it holds. @@ -145,7 +145,7 @@ epicsShareFunc epicsEventId epicsEventMustCreate ( * No calls to any epicsEventWait routines can be active when this call is made. * \param id The event identifier. **/ -epicsShareFunc void epicsEventDestroy(epicsEventId id); +LIBCOM_API void epicsEventDestroy(epicsEventId id); /**\brief Trigger an event i.e. ensures the next or current call to wait * completes. @@ -155,7 +155,7 @@ epicsShareFunc void epicsEventDestroy(epicsEventId id); * \param id The event identifier. * \return Status indicator. **/ -epicsShareFunc epicsEventStatus epicsEventTrigger( +LIBCOM_API epicsEventStatus epicsEventTrigger( epicsEventId id); /**\brief Trigger an event. @@ -163,7 +163,7 @@ epicsShareFunc epicsEventStatus epicsEventTrigger( * This routine does not return if the identifier is invalid. * \param id The event identifier. */ -epicsShareFunc void epicsEventMustTrigger(epicsEventId id); +LIBCOM_API void epicsEventMustTrigger(epicsEventId id); /**\brief A synonym for epicsEventTrigger(). * \param ID The event identifier. @@ -176,7 +176,7 @@ epicsShareFunc void epicsEventMustTrigger(epicsEventId id); * \param id The event identifier. * \return Status indicator. **/ -epicsShareFunc epicsEventStatus epicsEventWait( +LIBCOM_API epicsEventStatus epicsEventWait( epicsEventId id); /**\brief Wait for an event (see epicsEventWait()). @@ -184,7 +184,7 @@ epicsShareFunc epicsEventStatus epicsEventWait( * This routine does not return if the identifier is invalid. * \param id The event identifier. */ -epicsShareFunc void epicsEventMustWait(epicsEventId id); +LIBCOM_API void epicsEventMustWait(epicsEventId id); /**\brief Wait an the event or until the specified timeout period is over. * \note Blocks until full or timeout. @@ -192,7 +192,7 @@ epicsShareFunc void epicsEventMustWait(epicsEventId id); * \param timeOut The timeout delay in seconds. * \return Status indicator. **/ -epicsShareFunc epicsEventStatus epicsEventWaitWithTimeout( +LIBCOM_API epicsEventStatus epicsEventWaitWithTimeout( epicsEventId id, double timeOut); /**\brief Similar to wait() except that if the event is currenly empty the @@ -200,7 +200,7 @@ epicsShareFunc epicsEventStatus epicsEventWaitWithTimeout( * \param id The event identifier. * \return Status indicator, \c epicsEventWaitTimeout when the event is empty. **/ -epicsShareFunc epicsEventStatus epicsEventTryWait( +LIBCOM_API epicsEventStatus epicsEventTryWait( epicsEventId id); /**\brief Display information about the semaphore. @@ -208,7 +208,7 @@ epicsShareFunc epicsEventStatus epicsEventTryWait( * \param id The event identifier. * \param level An unsigned int for the level of information to be displayed. **/ -epicsShareFunc void epicsEventShow( +LIBCOM_API void epicsEventShow( epicsEventId id, unsigned int level); #ifdef __cplusplus diff --git a/modules/libcom/src/osi/epicsFindSymbol.h b/modules/libcom/src/osi/epicsFindSymbol.h index 9935834da..152a092ee 100644 --- a/modules/libcom/src/osi/epicsFindSymbol.h +++ b/modules/libcom/src/osi/epicsFindSymbol.h @@ -13,11 +13,11 @@ extern "C" { #endif -#include "shareLib.h" +#include "libComAPI.h" -epicsShareFunc void * epicsLoadLibrary(const char *name); -epicsShareFunc const char *epicsLoadError(void); -epicsShareFunc void * epicsShareAPI epicsFindSymbol(const char *name); +LIBCOM_API void * epicsLoadLibrary(const char *name); +LIBCOM_API const char *epicsLoadError(void); +LIBCOM_API void * epicsStdCall epicsFindSymbol(const char *name); #ifdef __cplusplus } diff --git a/modules/libcom/src/osi/epicsGeneralTime.c b/modules/libcom/src/osi/epicsGeneralTime.c index 87158d937..ccab5e7be 100644 --- a/modules/libcom/src/osi/epicsGeneralTime.c +++ b/modules/libcom/src/osi/epicsGeneralTime.c @@ -12,7 +12,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsTypes.h" #include "epicsEvent.h" #include "epicsMutex.h" @@ -150,7 +149,7 @@ int generalTimeGetExceptPriority(epicsTimeStamp *pDest, int *pPrio, int ignore) return status; } -int epicsShareAPI epicsTimeGetCurrent(epicsTimeStamp *pDest) +int epicsStdCall epicsTimeGetCurrent(epicsTimeStamp *pDest) { gtProvider *ptp; int status = S_time_noProvider; @@ -339,7 +338,7 @@ static int generalTimeGetEventPriority(epicsTimeStamp *pDest, int eventNumber, return status; } -int epicsShareAPI epicsTimeGetEvent(epicsTimeStamp *pDest, int eventNumber) +int epicsStdCall epicsTimeGetEvent(epicsTimeStamp *pDest, int eventNumber) { if (eventNumber == epicsTimeEventCurrentTime) { return epicsTimeGetCurrent(pDest); diff --git a/modules/libcom/src/osi/epicsGeneralTime.h b/modules/libcom/src/osi/epicsGeneralTime.h index 8f494b376..ab5f39483 100644 --- a/modules/libcom/src/osi/epicsGeneralTime.h +++ b/modules/libcom/src/osi/epicsGeneralTime.h @@ -36,7 +36,7 @@ #ifndef INC_epicsGeneralTime_H #define INC_epicsGeneralTime_H -#include "shareLib.h" +#include "libComAPI.h" #ifdef __cplusplus extern "C" { @@ -60,7 +60,7 @@ extern "C" { * This routine is called automatically by any function that requires the * framework. It does not need to be called explicitly. **/ -epicsShareFunc void generalTime_Init(void); +LIBCOM_API void generalTime_Init(void); /**\brief Install a Time Event time provider that returns the current time for any * Time event number. @@ -69,7 +69,7 @@ epicsShareFunc void generalTime_Init(void); * Event time in the absence of any working provider should be a failure, or the * current time. **/ -epicsShareFunc int installLastResortEventProvider(void); +LIBCOM_API int installLastResortEventProvider(void); /**\brief Reset the internal counter of the number of times the time returned was * earlier than when previously requested. @@ -81,7 +81,7 @@ epicsShareFunc int installLastResortEventProvider(void); OUT = "@RSTERRCNT" \endcode **/ -epicsShareFunc void generalTimeResetErrorCounts(void); +LIBCOM_API void generalTimeResetErrorCounts(void); /**\brief Return the internal counter of the number of times the time returned was * earlier than when previously requested. @@ -95,7 +95,7 @@ epicsShareFunc void generalTimeResetErrorCounts(void); * * \return Reset error counts **/ -epicsShareFunc int generalTimeGetErrorCounts(void); +LIBCOM_API int generalTimeGetErrorCounts(void); /**\brief Return the nume of the provider that last returned a valid current time, or * NULL if none. @@ -108,7 +108,7 @@ epicsShareFunc int generalTimeGetErrorCounts(void); * * \return Provider name **/ -epicsShareFunc const char * generalTimeCurrentProviderName(void); +LIBCOM_API const char * generalTimeCurrentProviderName(void); /**\brief Return the name of the provider that last returned a valid Time Event time, or * NULL of none. @@ -121,7 +121,7 @@ epicsShareFunc const char * generalTimeCurrentProviderName(void); * * \return Provider name **/ -epicsShareFunc const char * generalTimeEventProviderName(void); +LIBCOM_API const char * generalTimeEventProviderName(void); /**\brief Return the name of the registered current time provider that has the highest * priority. @@ -134,7 +134,7 @@ epicsShareFunc const char * generalTimeEventProviderName(void); * * \return Provider name **/ -epicsShareFunc const char * generalTimeHighestCurrentName(void); +LIBCOM_API const char * generalTimeHighestCurrentName(void); /** \brief Old name provided for backwards compatibility */ #define generalTimeCurrentTpName generalTimeCurrentProviderName @@ -145,7 +145,7 @@ epicsShareFunc const char * generalTimeHighestCurrentName(void); * * \param interest Desired interest level to report **/ -epicsShareFunc long generalTimeReport(int interest); +LIBCOM_API long generalTimeReport(int interest); #ifdef __cplusplus } diff --git a/modules/libcom/src/osi/epicsInterrupt.h b/modules/libcom/src/osi/epicsInterrupt.h index 93b443810..b536f0a3b 100644 --- a/modules/libcom/src/osi/epicsInterrupt.h +++ b/modules/libcom/src/osi/epicsInterrupt.h @@ -13,12 +13,12 @@ extern "C" { #endif -#include "shareLib.h" +#include "libComAPI.h" -epicsShareFunc int epicsInterruptLock(void); -epicsShareFunc void epicsInterruptUnlock(int key); -epicsShareFunc int epicsInterruptIsInterruptContext(void); -epicsShareFunc void epicsInterruptContextMessage(const char *message); +LIBCOM_API int epicsInterruptLock(void); +LIBCOM_API void epicsInterruptUnlock(int key); +LIBCOM_API int epicsInterruptIsInterruptContext(void); +LIBCOM_API void epicsInterruptContextMessage(const char *message); #ifdef __cplusplus } diff --git a/modules/libcom/src/osi/epicsMath.cpp b/modules/libcom/src/osi/epicsMath.cpp index 1388e658a..3cfca0a6c 100644 --- a/modules/libcom/src/osi/epicsMath.cpp +++ b/modules/libcom/src/osi/epicsMath.cpp @@ -6,7 +6,6 @@ \*************************************************************************/ /* epicsMath.cpp */ -#define epicsExportSharedSymbols #include #ifdef _MSC_VER @@ -33,8 +32,8 @@ static float makeINF ( void ) #endif extern "C" { -epicsShareDef float epicsNAN = NAN; -epicsShareDef float epicsINF = INFINITY; +float epicsNAN = NAN; +float epicsINF = INFINITY; } #ifdef _MSC_VER diff --git a/modules/libcom/src/osi/epicsMessageQueue.cpp b/modules/libcom/src/osi/epicsMessageQueue.cpp index 1527b3d3a..b5c1ad91c 100644 --- a/modules/libcom/src/osi/epicsMessageQueue.cpp +++ b/modules/libcom/src/osi/epicsMessageQueue.cpp @@ -15,7 +15,6 @@ #include -#define epicsExportSharedSymbols #include "epicsMessageQueue.h" #include "epicsStdio.h" diff --git a/modules/libcom/src/osi/epicsMessageQueue.h b/modules/libcom/src/osi/epicsMessageQueue.h index 7150eab44..6f1330530 100644 --- a/modules/libcom/src/osi/epicsMessageQueue.h +++ b/modules/libcom/src/osi/epicsMessageQueue.h @@ -21,7 +21,7 @@ #define epicsMessageQueueh #include "epicsAssert.h" -#include "shareLib.h" +#include "libComAPI.h" typedef struct epicsMessageQueueOSD *epicsMessageQueueId; @@ -45,7 +45,7 @@ typedef struct epicsMessageQueueOSD *epicsMessageQueueId; * pmq = &mq1; // OK, pointer assignment and address-of * \endcode **/ -class epicsShareClass epicsMessageQueue { +class LIBCOM_API epicsMessageQueue { public: /** @@ -173,14 +173,14 @@ extern "C" { * message that may be queued * \return An identifier for the new queue, or 0. **/ -epicsShareFunc epicsMessageQueueId epicsShareAPI epicsMessageQueueCreate( +LIBCOM_API epicsMessageQueueId epicsStdCall epicsMessageQueueCreate( unsigned int capacity, unsigned int maximumMessageSize); /** * \brief Destroy a message queue, release all its memory. **/ -epicsShareFunc void epicsShareAPI epicsMessageQueueDestroy( +LIBCOM_API void epicsStdCall epicsMessageQueueDestroy( epicsMessageQueueId id); /** @@ -192,7 +192,7 @@ epicsShareFunc void epicsShareAPI epicsMessageQueueDestroy( * \returns -1 if no more messages can be queued or if the message * is larger than the queue's maximum message size. **/ -epicsShareFunc int epicsShareAPI epicsMessageQueueTrySend( +LIBCOM_API int epicsStdCall epicsMessageQueueTrySend( epicsMessageQueueId id, void *message, unsigned int messageSize); @@ -204,7 +204,7 @@ epicsShareFunc int epicsShareAPI epicsMessageQueueTrySend( * \returns -1 if the message is larger than the queue's maximum * message size. **/ -epicsShareFunc int epicsShareAPI epicsMessageQueueSend( +LIBCOM_API int epicsStdCall epicsMessageQueueSend( epicsMessageQueueId id, void *message, unsigned int messageSize); @@ -217,7 +217,7 @@ epicsShareFunc int epicsShareAPI epicsMessageQueueSend( * message could be sent or queued, or if the message is larger * than the queue's maximum message size. **/ -epicsShareFunc int epicsShareAPI epicsMessageQueueSendWithTimeout( +LIBCOM_API int epicsStdCall epicsMessageQueueSendWithTimeout( epicsMessageQueueId id, void *message, unsigned int messageSize, @@ -238,7 +238,7 @@ epicsShareFunc int epicsShareAPI epicsMessageQueueSendWithTimeout( * \returns Number of bytes in the message. * \returns -1 if the message queue is empty, or the buffer too small. **/ -epicsShareFunc int epicsShareAPI epicsMessageQueueTryReceive( +LIBCOM_API int epicsStdCall epicsMessageQueueTryReceive( epicsMessageQueueId id, void *message, unsigned int size); @@ -257,7 +257,7 @@ epicsShareFunc int epicsShareAPI epicsMessageQueueTryReceive( * \returns Number of bytes in the message. * \returns -1 if the buffer is too small for the message. **/ -epicsShareFunc int epicsShareAPI epicsMessageQueueReceive( +LIBCOM_API int epicsStdCall epicsMessageQueueReceive( epicsMessageQueueId id, void *message, unsigned int size); @@ -277,7 +277,7 @@ epicsShareFunc int epicsShareAPI epicsMessageQueueReceive( * \returns -1 if a message is not received within the timeout * interval. **/ -epicsShareFunc int epicsShareAPI epicsMessageQueueReceiveWithTimeout( +LIBCOM_API int epicsStdCall epicsMessageQueueReceiveWithTimeout( epicsMessageQueueId id, void *message, unsigned int size, @@ -288,7 +288,7 @@ epicsShareFunc int epicsShareAPI epicsMessageQueueReceiveWithTimeout( * \param id Message queue identifier. * \returns The number of messages presently in the queue. **/ -epicsShareFunc int epicsShareAPI epicsMessageQueuePending( +LIBCOM_API int epicsStdCall epicsMessageQueuePending( epicsMessageQueueId id); /** @@ -296,7 +296,7 @@ epicsShareFunc int epicsShareAPI epicsMessageQueuePending( * \param id Message queue identifier. * \param level Controls the amount of information displayed. **/ -epicsShareFunc void epicsShareAPI epicsMessageQueueShow( +LIBCOM_API void epicsStdCall epicsMessageQueueShow( epicsMessageQueueId id, int level); diff --git a/modules/libcom/src/osi/epicsMutex.cpp b/modules/libcom/src/osi/epicsMutex.cpp index 035431145..a937f5b4e 100644 --- a/modules/libcom/src/osi/epicsMutex.cpp +++ b/modules/libcom/src/osi/epicsMutex.cpp @@ -25,7 +25,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsStdio.h" #include "epicsThread.h" #include "valgrind/valgrind.h" @@ -83,7 +82,7 @@ static void epicsMutexOsiInit(void *) { epicsMutexGlobalLock = epicsMutexOsdCreate(); } -epicsMutexId epicsShareAPI epicsMutexOsiCreate( +epicsMutexId epicsStdCall epicsMutexOsiCreate( const char *pFileName,int lineno) { epicsMutexOSD * id; @@ -117,7 +116,7 @@ epicsMutexId epicsShareAPI epicsMutexOsiCreate( return(pmutexNode); } -epicsMutexId epicsShareAPI epicsMutexOsiMustCreate( +epicsMutexId epicsStdCall epicsMutexOsiMustCreate( const char *pFileName,int lineno) { epicsMutexId id = epicsMutexOsiCreate(pFileName,lineno); @@ -125,7 +124,7 @@ epicsMutexId epicsShareAPI epicsMutexOsiMustCreate( return(id ); } -void epicsShareAPI epicsMutexDestroy(epicsMutexId pmutexNode) +void epicsStdCall epicsMutexDestroy(epicsMutexId pmutexNode) { epicsMutexLockStatus lockStat = epicsMutexOsdLock(epicsMutexGlobalLock); @@ -138,12 +137,12 @@ void epicsShareAPI epicsMutexDestroy(epicsMutexId pmutexNode) epicsMutexOsdUnlock(epicsMutexGlobalLock); } -void epicsShareAPI epicsMutexUnlock(epicsMutexId pmutexNode) +void epicsStdCall epicsMutexUnlock(epicsMutexId pmutexNode) { epicsMutexOsdUnlock(pmutexNode->id); } -epicsMutexLockStatus epicsShareAPI epicsMutexLock( +epicsMutexLockStatus epicsStdCall epicsMutexLock( epicsMutexId pmutexNode) { epicsMutexLockStatus status = @@ -156,7 +155,7 @@ epicsMutexLockStatus epicsShareAPI epicsMutexLock( return status; } -epicsMutexLockStatus epicsShareAPI epicsMutexTryLock( +epicsMutexLockStatus epicsStdCall epicsMutexTryLock( epicsMutexId pmutexNode) { epicsMutexLockStatus status = @@ -189,7 +188,7 @@ void epicsMutexCleanup(void) epicsMutexOsdUnlock(epicsMutexGlobalLock); } -void epicsShareAPI epicsMutexShow( +void epicsStdCall epicsMutexShow( epicsMutexId pmutexNode, unsigned int level) { # ifdef LOG_LAST_OWNER @@ -215,7 +214,7 @@ void epicsShareAPI epicsMutexShow( } } -void epicsShareAPI epicsMutexShowAll(int onlyLocked,unsigned int level) +void epicsStdCall epicsMutexShowAll(int onlyLocked,unsigned int level) { epicsMutexParm *pmutexNode; diff --git a/modules/libcom/src/osi/epicsMutex.h b/modules/libcom/src/osi/epicsMutex.h index 89a3410f9..af27f2f96 100644 --- a/modules/libcom/src/osi/epicsMutex.h +++ b/modules/libcom/src/osi/epicsMutex.h @@ -36,7 +36,7 @@ #include "epicsAssert.h" -#include "shareLib.h" +#include "libComAPI.h" /**\brief An identifier for an epicsMutex for use with the C API */ typedef struct epicsMutexParm *epicsMutexId; @@ -59,7 +59,7 @@ typedef enum { /**\brief The C++ API for an epicsMutex. */ -class epicsShareClass epicsMutex { +class LIBCOM_API epicsMutex { public: typedef epicsGuard guard_t; typedef epicsGuard release_t; @@ -129,7 +129,7 @@ private: }; /**\brief A semaphore for locating deadlocks in C++ code. */ -class epicsShareClass epicsDeadlockDetectMutex { +class LIBCOM_API epicsDeadlockDetectMutex { public: typedef epicsGuard guard_t; typedef epicsGuard release_t; @@ -161,7 +161,7 @@ extern "C" { **/ #define epicsMutexCreate() epicsMutexOsiCreate(__FILE__,__LINE__) /**\brief Internal API, used by epicsMutexCreate(). */ -epicsShareFunc epicsMutexId epicsShareAPI epicsMutexOsiCreate( +LIBCOM_API epicsMutexId epicsStdCall epicsMutexOsiCreate( const char *pFileName,int lineno); /**\brief Create an epicsMutex semaphore for use from C code. @@ -172,20 +172,20 @@ epicsShareFunc epicsMutexId epicsShareAPI epicsMutexOsiCreate( **/ #define epicsMutexMustCreate() epicsMutexOsiMustCreate(__FILE__,__LINE__) /**\brief Internal API, used by epicsMutexMustCreate(). */ -epicsShareFunc epicsMutexId epicsShareAPI epicsMutexOsiMustCreate( +LIBCOM_API epicsMutexId epicsStdCall epicsMutexOsiMustCreate( const char *pFileName,int lineno); /**\brief Destroy an epicsMutex semaphore. * \param id The mutex identifier. **/ -epicsShareFunc void epicsShareAPI epicsMutexDestroy(epicsMutexId id); +LIBCOM_API void epicsStdCall epicsMutexDestroy(epicsMutexId id); /**\brief Release the semaphore. * \param id The mutex identifier. * \note If a thread issues recursive locks, it must call epicsMutexUnlock() * as many times as it calls epicsMutexLock() or equivalents. **/ -epicsShareFunc void epicsShareAPI epicsMutexUnlock(epicsMutexId id); +LIBCOM_API void epicsStdCall epicsMutexUnlock(epicsMutexId id); /**\brief Claim the semaphore, waiting until it's free if currently owned * owned by a different thread. @@ -197,7 +197,7 @@ epicsShareFunc void epicsShareAPI epicsMutexUnlock(epicsMutexId id); * \param id The mutex identifier. * \return Status indicator. **/ -epicsShareFunc epicsMutexLockStatus epicsShareAPI epicsMutexLock( +LIBCOM_API epicsMutexLockStatus epicsStdCall epicsMutexLock( epicsMutexId id); /**\brief Claim a semaphore (see epicsMutexLock()). @@ -217,7 +217,7 @@ epicsShareFunc epicsMutexLockStatus epicsShareAPI epicsMutexLock( * \return \c epicsMutexLockOK if the resource is now owned by the caller. * \return \c epicsMutexLockTimeout if some other thread owns the resource. **/ -epicsShareFunc epicsMutexLockStatus epicsShareAPI epicsMutexTryLock( +LIBCOM_API epicsMutexLockStatus epicsStdCall epicsMutexTryLock( epicsMutexId id); /**\brief Display information about the semaphore. @@ -227,7 +227,7 @@ epicsShareFunc epicsMutexLockStatus epicsShareAPI epicsMutexTryLock( * \param id The mutex identifier. * \param level Desired information level to report **/ -epicsShareFunc void epicsShareAPI epicsMutexShow( +LIBCOM_API void epicsStdCall epicsMutexShow( epicsMutexId id,unsigned int level); /**\brief Display information about all epicsMutex semaphores. @@ -237,7 +237,7 @@ epicsShareFunc void epicsShareAPI epicsMutexShow( * \param onlyLocked Non-zero to show only locked semaphores. * \param level Desired information level to report **/ -epicsShareFunc void epicsShareAPI epicsMutexShowAll( +LIBCOM_API void epicsStdCall epicsMutexShowAll( int onlyLocked,unsigned int level); /**@privatesection diff --git a/modules/libcom/src/osi/epicsReadline.c b/modules/libcom/src/osi/epicsReadline.c index 0caa50fc2..55eb4fc19 100644 --- a/modules/libcom/src/osi/epicsReadline.c +++ b/modules/libcom/src/osi/epicsReadline.c @@ -11,7 +11,6 @@ #include #include -#define epicsExportSharedSymbols #include "envDefs.h" #include "epicsReadline.h" @@ -61,7 +60,7 @@ static void osdReadlineEnd(struct readlineContext *rc) {} /* * Create a command-line context */ -void * epicsShareAPI +void * epicsStdCall epicsReadlineBegin(FILE *in) { struct readlineContext *rc = calloc(1, sizeof(*rc)); @@ -78,7 +77,7 @@ epicsReadlineBegin(FILE *in) /* * Read a line of input */ -char * epicsShareAPI +char * epicsStdCall epicsReadline (const char *prompt, void *context) { struct readlineContext *rc = context; @@ -138,7 +137,7 @@ epicsReadline (const char *prompt, void *context) /* * Destroy a command-line context */ -void epicsShareAPI +void epicsStdCall epicsReadlineEnd (void *context) { if (context) { diff --git a/modules/libcom/src/osi/epicsReadline.h b/modules/libcom/src/osi/epicsReadline.h index 78c233119..1021a6a56 100644 --- a/modules/libcom/src/osi/epicsReadline.h +++ b/modules/libcom/src/osi/epicsReadline.h @@ -23,26 +23,26 @@ extern "C" { #endif -#include +#include #include /** * \brief Create a command-line context * \param in Filehandle to read from * \return Command-line context */ -epicsShareFunc void * epicsShareAPI epicsReadlineBegin (FILE *in); +LIBCOM_API void * epicsStdCall epicsReadlineBegin (FILE *in); /** * \brief Read a line of input * \param prompt Prompt string * \param context To read from * \return Line read */ -epicsShareFunc char * epicsShareAPI epicsReadline (const char *prompt, void *context); +LIBCOM_API char * epicsStdCall epicsReadline (const char *prompt, void *context); /** * \brief Destroy a command-line context * \param context Command-line context to destroy */ -epicsShareFunc void epicsShareAPI epicsReadlineEnd (void *context); +LIBCOM_API void epicsStdCall epicsReadlineEnd (void *context); #ifdef __cplusplus } diff --git a/modules/libcom/src/osi/epicsSignal.h b/modules/libcom/src/osi/epicsSignal.h index f976ee040..186822f34 100644 --- a/modules/libcom/src/osi/epicsSignal.h +++ b/modules/libcom/src/osi/epicsSignal.h @@ -14,7 +14,7 @@ extern "C" { #endif -#include "shareLib.h" +#include "libComAPI.h" /** \file epicsSignal.h * \brief OS-independent routines for ignoring Posix signals @@ -29,21 +29,21 @@ struct epicsThreadOSD; * Required to avoid problems with soft IOCs getting SIGHUPs when a * Channel Access client disconnects */ -epicsShareFunc void epicsShareAPI epicsSignalInstallSigHupIgnore ( void ); +LIBCOM_API void epicsStdCall epicsSignalInstallSigHupIgnore ( void ); /** Ignore the SIGPIPE signal. * Required to avoid terminating a process which is blocking in a * socket send() call when the SIGPIPE signal is generated by the OS. */ -epicsShareFunc void epicsShareAPI epicsSignalInstallSigPipeIgnore ( void ); +LIBCOM_API void epicsStdCall epicsSignalInstallSigPipeIgnore ( void ); /** Ignore the SIGALRM signal. * Required only if shutdown() and close() do not interrupt a thread blocking in * a socket system call */ -epicsShareFunc void epicsShareAPI epicsSignalInstallSigAlarmIgnore ( void ); +LIBCOM_API void epicsStdCall epicsSignalInstallSigAlarmIgnore ( void ); /** Raise a SIGALRM signal to a specific epicsThread */ -epicsShareFunc void epicsShareAPI epicsSignalRaiseSigAlarm ( struct epicsThreadOSD * ); +LIBCOM_API void epicsStdCall epicsSignalRaiseSigAlarm ( struct epicsThreadOSD * ); #ifdef __cplusplus } diff --git a/modules/libcom/src/osi/epicsSpin.h b/modules/libcom/src/osi/epicsSpin.h index 22ce8ec8f..1b089dadf 100644 --- a/modules/libcom/src/osi/epicsSpin.h +++ b/modules/libcom/src/osi/epicsSpin.h @@ -9,7 +9,7 @@ #ifndef epicsSpinh #define epicsSpinh -#include "shareLib.h" +#include "libComAPI.h" #ifdef __cplusplus extern "C" { @@ -17,13 +17,13 @@ extern "C" { typedef struct epicsSpin *epicsSpinId; -epicsShareFunc epicsSpinId epicsSpinCreate(void); -epicsShareFunc epicsSpinId epicsSpinMustCreate(void); -epicsShareFunc void epicsSpinDestroy(epicsSpinId); +LIBCOM_API epicsSpinId epicsSpinCreate(void); +LIBCOM_API epicsSpinId epicsSpinMustCreate(void); +LIBCOM_API void epicsSpinDestroy(epicsSpinId); -epicsShareFunc void epicsSpinLock(epicsSpinId); -epicsShareFunc int epicsSpinTryLock(epicsSpinId); -epicsShareFunc void epicsSpinUnlock(epicsSpinId); +LIBCOM_API void epicsSpinLock(epicsSpinId); +LIBCOM_API int epicsSpinTryLock(epicsSpinId); +LIBCOM_API void epicsSpinUnlock(epicsSpinId); #ifdef __cplusplus } diff --git a/modules/libcom/src/osi/epicsStackTrace.c b/modules/libcom/src/osi/epicsStackTrace.c index 0fe6928c4..e3054efd0 100644 --- a/modules/libcom/src/osi/epicsStackTrace.c +++ b/modules/libcom/src/osi/epicsStackTrace.c @@ -9,7 +9,6 @@ #include -#define epicsExportSharedSymbols #include "epicsThread.h" #include "epicsMutex.h" #include "errlog.h" diff --git a/modules/libcom/src/osi/epicsStackTrace.h b/modules/libcom/src/osi/epicsStackTrace.h index 885e90abe..a293876f1 100644 --- a/modules/libcom/src/osi/epicsStackTrace.h +++ b/modules/libcom/src/osi/epicsStackTrace.h @@ -10,14 +10,14 @@ #ifndef INC_epicsStackTrace_H #define INC_epicsStackTrace_H -#include "shareLib.h" +#include "libComAPI.h" #ifdef __cplusplus extern "C" { #endif /* Dump a stack trace to the errlog */ -epicsShareFunc void epicsStackTrace(void); +LIBCOM_API void epicsStackTrace(void); /* Inquire about functionality implemented on your system */ @@ -34,7 +34,7 @@ epicsShareFunc void epicsStackTrace(void); #define EPICS_STACKTRACE_LCL_SYMBOLS (1<<3) /* returns ORed bitset of supported features */ -epicsShareFunc int epicsStackTraceGetFeatures(void); +LIBCOM_API int epicsStackTraceGetFeatures(void); #ifdef __cplusplus } diff --git a/modules/libcom/src/osi/epicsStackTracePvt.h b/modules/libcom/src/osi/epicsStackTracePvt.h index de26044fa..00b013d91 100644 --- a/modules/libcom/src/osi/epicsStackTracePvt.h +++ b/modules/libcom/src/osi/epicsStackTracePvt.h @@ -10,7 +10,7 @@ #ifndef INC_epicsStackTracePvt_H #define INC_epicsStackTracePvt_H -#include "shareLib.h" +#include "libComAPI.h" typedef struct epicsSymbol { const char *f_nam; /* file where the symbol is defined */ @@ -25,7 +25,7 @@ extern "C" { /* Take a snapshot of the stack into 'buf' (limited to buf_sz entries) * RETURNS: actual number of entries in 'buf' */ -epicsShareFunc int epicsBackTrace(void **buf, int buf_sz); +LIBCOM_API int epicsBackTrace(void **buf, int buf_sz); /* Find symbol closest to 'addr'. * @@ -36,10 +36,10 @@ epicsShareFunc int epicsBackTrace(void **buf, int buf_sz); * RETURNS: 0 on success, nonzero on failure (not finding an address * is not considered an error). */ -epicsShareFunc int epicsFindAddr(void *addr, epicsSymbol *sym_p); +LIBCOM_API int epicsFindAddr(void *addr, epicsSymbol *sym_p); /* report supported features (as reported by epicsStackTraceGetFeatures) */ -epicsShareFunc int epicsFindAddrGetFeatures(); +LIBCOM_API int epicsFindAddrGetFeatures(); #ifdef __cplusplus } diff --git a/modules/libcom/src/osi/epicsStdio.c b/modules/libcom/src/osi/epicsStdio.c index 52b65bbe4..db4919039 100644 --- a/modules/libcom/src/osi/epicsStdio.c +++ b/modules/libcom/src/osi/epicsStdio.c @@ -18,9 +18,8 @@ #include #include -#define epicsExportSharedSymbols #define epicsStdioStdStreams -#include "shareLib.h" +#include "libComAPI.h" #include "epicsThread.h" #include "epicsStdio.h" @@ -36,7 +35,7 @@ static void once(void *junk) stderrThreadPrivateId = epicsThreadPrivateCreate(); } -FILE * epicsShareAPI epicsGetStdin(void) +FILE * epicsStdCall epicsGetStdin(void) { FILE *fp = epicsGetThreadStdin(); @@ -45,7 +44,7 @@ FILE * epicsShareAPI epicsGetStdin(void) return fp; } -FILE * epicsShareAPI epicsGetStdout(void) +FILE * epicsStdCall epicsGetStdout(void) { FILE *fp = epicsGetThreadStdout(); @@ -54,7 +53,7 @@ FILE * epicsShareAPI epicsGetStdout(void) return fp; } -FILE * epicsShareAPI epicsGetStderr(void) +FILE * epicsStdCall epicsGetStderr(void) { FILE *fp = epicsGetThreadStderr(); @@ -63,19 +62,19 @@ FILE * epicsShareAPI epicsGetStderr(void) return fp; } -FILE * epicsShareAPI epicsGetThreadStdin(void) +FILE * epicsStdCall epicsGetThreadStdin(void) { epicsThreadOnce(&onceId,once,0); return epicsThreadPrivateGet(stdinThreadPrivateId); } -FILE * epicsShareAPI epicsGetThreadStdout(void) +FILE * epicsStdCall epicsGetThreadStdout(void) { epicsThreadOnce(&onceId,once,0); return epicsThreadPrivateGet(stdoutThreadPrivateId); } -FILE * epicsShareAPI epicsGetThreadStderr(void) +FILE * epicsStdCall epicsGetThreadStderr(void) { /* Deliberately don't do the epicsThreadOnce() here; epicsThreadInit() * is allowed to use stderr inside its once() routine, in which case we @@ -88,25 +87,25 @@ FILE * epicsShareAPI epicsGetThreadStderr(void) return epicsThreadPrivateGet(stderrThreadPrivateId); } -void epicsShareAPI epicsSetThreadStdin(FILE *fp) +void epicsStdCall epicsSetThreadStdin(FILE *fp) { epicsThreadOnce(&onceId,once,0); epicsThreadPrivateSet(stdinThreadPrivateId,fp); } -void epicsShareAPI epicsSetThreadStdout(FILE *fp) +void epicsStdCall epicsSetThreadStdout(FILE *fp) { epicsThreadOnce(&onceId,once,0); epicsThreadPrivateSet(stdoutThreadPrivateId,fp); } -void epicsShareAPI epicsSetThreadStderr(FILE *fp) +void epicsStdCall epicsSetThreadStderr(FILE *fp) { epicsThreadOnce(&onceId,once,0); epicsThreadPrivateSet(stderrThreadPrivateId,fp); } -int epicsShareAPI epicsStdoutPrintf(const char *pFormat, ...) +int epicsStdCall epicsStdoutPrintf(const char *pFormat, ...) { va_list pvar; int nchar; @@ -118,12 +117,12 @@ int epicsShareAPI epicsStdoutPrintf(const char *pFormat, ...) return nchar; } -int epicsShareAPI epicsStdoutPuts(const char *str) +int epicsStdCall epicsStdoutPuts(const char *str) { return fprintf(epicsGetStdout(), "%s\n", str); } -int epicsShareAPI epicsStdoutPutchar(int c) +int epicsStdCall epicsStdoutPutchar(int c) { return putc(c, epicsGetStdout()); } diff --git a/modules/libcom/src/osi/epicsStdio.h b/modules/libcom/src/osi/epicsStdio.h index 9ef0b2239..205842bde 100644 --- a/modules/libcom/src/osi/epicsStdio.h +++ b/modules/libcom/src/osi/epicsStdio.h @@ -15,7 +15,7 @@ #include #include -#include "shareLib.h" +#include "libComAPI.h" #include "compilerDependencies.h" #include "epicsTempFile.h" @@ -51,9 +51,9 @@ extern "C" { # define putchar epicsStdoutPutchar #endif -epicsShareFunc int epicsShareAPI epicsSnprintf( +LIBCOM_API int epicsStdCall epicsSnprintf( char *str, size_t size, const char *format, ...) EPICS_PRINTF_STYLE(3,4); -epicsShareFunc int epicsShareAPI epicsVsnprintf( +LIBCOM_API int epicsStdCall epicsVsnprintf( char *str, size_t size, const char *format, va_list ap); /* @@ -68,24 +68,24 @@ epicsShareFunc int epicsShareAPI epicsVsnprintf( * TF_ERROR if the file could not be truncated. */ enum TF_RETURN {TF_OK=0, TF_ERROR=1}; -epicsShareFunc enum TF_RETURN truncateFile ( const char *pFileName, unsigned long size ); +LIBCOM_API enum TF_RETURN truncateFile ( const char *pFileName, unsigned long size ); /* The following are for redirecting stdin,stdout,stderr */ -epicsShareFunc FILE * epicsShareAPI epicsGetStdin(void); -epicsShareFunc FILE * epicsShareAPI epicsGetStdout(void); -epicsShareFunc FILE * epicsShareAPI epicsGetStderr(void); +LIBCOM_API FILE * epicsStdCall epicsGetStdin(void); +LIBCOM_API FILE * epicsStdCall epicsGetStdout(void); +LIBCOM_API FILE * epicsStdCall epicsGetStderr(void); /* These are intended for iocsh only */ -epicsShareFunc FILE * epicsShareAPI epicsGetThreadStdin(void); -epicsShareFunc FILE * epicsShareAPI epicsGetThreadStdout(void); -epicsShareFunc FILE * epicsShareAPI epicsGetThreadStderr(void); -epicsShareFunc void epicsShareAPI epicsSetThreadStdin(FILE *); -epicsShareFunc void epicsShareAPI epicsSetThreadStdout(FILE *); -epicsShareFunc void epicsShareAPI epicsSetThreadStderr(FILE *); +LIBCOM_API FILE * epicsStdCall epicsGetThreadStdin(void); +LIBCOM_API FILE * epicsStdCall epicsGetThreadStdout(void); +LIBCOM_API FILE * epicsStdCall epicsGetThreadStderr(void); +LIBCOM_API void epicsStdCall epicsSetThreadStdin(FILE *); +LIBCOM_API void epicsStdCall epicsSetThreadStdout(FILE *); +LIBCOM_API void epicsStdCall epicsSetThreadStderr(FILE *); -epicsShareFunc int epicsShareAPI epicsStdoutPrintf( +LIBCOM_API int epicsStdCall epicsStdoutPrintf( const char *pformat, ...) EPICS_PRINTF_STYLE(1,2); -epicsShareFunc int epicsShareAPI epicsStdoutPuts(const char *str); -epicsShareFunc int epicsShareAPI epicsStdoutPutchar(int c); +LIBCOM_API int epicsStdCall epicsStdoutPuts(const char *str); +LIBCOM_API int epicsStdCall epicsStdoutPutchar(int c); #ifdef __cplusplus } diff --git a/modules/libcom/src/osi/epicsTempFile.h b/modules/libcom/src/osi/epicsTempFile.h index 210e69740..d1b49053e 100644 --- a/modules/libcom/src/osi/epicsTempFile.h +++ b/modules/libcom/src/osi/epicsTempFile.h @@ -17,7 +17,7 @@ #include -#include "shareLib.h" +#include "libComAPI.h" #ifdef __cplusplus extern "C" { @@ -27,7 +27,7 @@ extern "C" { * \brief Create and open a temporary file. * \return NULL or a FILE pointer to a temporary file. **/ -epicsShareFunc FILE * epicsShareAPI epicsTempFile(void); +LIBCOM_API FILE * epicsStdCall epicsTempFile(void); #ifdef __cplusplus } diff --git a/modules/libcom/src/osi/epicsThread.cpp b/modules/libcom/src/osi/epicsThread.cpp index 1d2adaf10..542089281 100644 --- a/modules/libcom/src/osi/epicsThread.cpp +++ b/modules/libcom/src/osi/epicsThread.cpp @@ -21,7 +21,6 @@ // The following is required for Solaris builds #undef __EXTENSIONS__ -#define epicsExportSharedSymbols #include "epicsAlgorithm.h" #include "epicsTime.h" #include "epicsThread.h" @@ -31,7 +30,7 @@ using namespace std; -epicsThreadId epicsShareAPI epicsThreadCreate ( +epicsThreadId epicsStdCall epicsThreadCreate ( const char * name, unsigned int priority, unsigned int stackSize, EPICSTHREADFUNC funptr,void * parm ) { @@ -356,7 +355,7 @@ extern "C" { okToBlockPrivate = epicsThreadPrivateCreate(); } - int epicsShareAPI epicsThreadIsOkToBlock(void) + int epicsStdCall epicsThreadIsOkToBlock(void) { const int *pokToBlock; epicsThreadOnce(&okToBlockOnce, epicsThreadOnceIdInit, NULL); @@ -364,7 +363,7 @@ extern "C" { return (pokToBlock ? *pokToBlock : 0); } - void epicsShareAPI epicsThreadSetOkToBlock(int isOkToBlock) + void epicsStdCall epicsThreadSetOkToBlock(int isOkToBlock) { const int *pokToBlock; epicsThreadOnce(&okToBlockOnce, epicsThreadOnceIdInit, NULL); @@ -372,7 +371,7 @@ extern "C" { epicsThreadPrivateSet(okToBlockPrivate, (void *)pokToBlock); } - epicsThreadId epicsShareAPI epicsThreadMustCreate ( + epicsThreadId epicsStdCall epicsThreadMustCreate ( const char *name, unsigned int priority, unsigned int stackSize, EPICSTHREADFUNC funptr,void *parm) { diff --git a/modules/libcom/src/osi/epicsThread.h b/modules/libcom/src/osi/epicsThread.h index b25c3cd7c..806b40e85 100644 --- a/modules/libcom/src/osi/epicsThread.h +++ b/modules/libcom/src/osi/epicsThread.h @@ -57,7 +57,7 @@ #include -#include "shareLib.h" +#include "libComAPI.h" #ifdef __cplusplus extern "C" { @@ -99,7 +99,7 @@ typedef enum { * \param size one of the values epicsThreadStackSmall, * epicsThreadStackMedium or epicsThreadStackBig. **/ -epicsShareFunc unsigned int epicsShareAPI epicsThreadGetStackSize( +LIBCOM_API unsigned int epicsStdCall epicsThreadGetStackSize( epicsThreadStackSizeClass size); /** (epicsThreadId)0 is guaranteed to be an invalid thread id */ @@ -126,7 +126,7 @@ typedef epicsThreadId epicsThreadOnceId; * } * \endcode */ -epicsShareFunc void epicsShareAPI epicsThreadOnce( +LIBCOM_API void epicsStdCall epicsThreadOnce( epicsThreadOnceId *id, EPICSTHREADFUNC, void *arg); /** @@ -134,7 +134,7 @@ epicsShareFunc void epicsShareAPI epicsThreadOnce( * that preserve real-time performance. For POSIX targets this locks the * process into RAM, preventing swap-related VM faults. **/ -epicsShareFunc void epicsThreadRealtimeLock(void); +LIBCOM_API void epicsThreadRealtimeLock(void); /** * If the main routine is done but wants to let other threads run it can @@ -142,7 +142,7 @@ epicsShareFunc void epicsThreadRealtimeLock(void); * final return. On most systems epicsThreadExitMain never returns.This * must only be called by the main thread. **/ -epicsShareFunc void epicsShareAPI epicsThreadExitMain(void); +LIBCOM_API void epicsStdCall epicsThreadExitMain(void); /** For use with epicsThreadCreateOpt() */ typedef struct epicsThreadOpts { @@ -174,73 +174,73 @@ typedef struct epicsThreadOpts { * \param opts Modifiers for the new thread, or NULL to use target specific defaults. * \return NULL on error */ -epicsShareFunc epicsThreadId epicsThreadCreateOpt ( +LIBCOM_API epicsThreadId epicsThreadCreateOpt ( const char * name, EPICSTHREADFUNC funptr, void * parm, const epicsThreadOpts *opts ); /** Short-hand for epicsThreadCreateOpt() to create an un-joinable thread. */ -epicsShareFunc epicsThreadId epicsShareAPI epicsThreadCreate ( +LIBCOM_API epicsThreadId epicsStdCall epicsThreadCreate ( const char * name, unsigned int priority, unsigned int stackSize, EPICSTHREADFUNC funptr,void * parm ); /** Short-hand for epicsThreadCreateOpt() to create an un-joinable thread. * On error calls cantProceed() */ -epicsShareFunc epicsThreadId epicsShareAPI epicsThreadMustCreate ( +LIBCOM_API epicsThreadId epicsStdCall epicsThreadMustCreate ( const char * name, unsigned int priority, unsigned int stackSize, EPICSTHREADFUNC funptr,void * parm ); /* This gets undefined in osdThread.h on VxWorks < 6.9 */ #define EPICS_THREAD_CAN_JOIN /** Wait for a joinable thread to exit (return from its main function) */ -epicsShareFunc void epicsThreadMustJoin(epicsThreadId id); +LIBCOM_API void epicsThreadMustJoin(epicsThreadId id); /** Block the current thread until epicsThreadResume(). */ -epicsShareFunc void epicsShareAPI epicsThreadSuspendSelf(void); +LIBCOM_API void epicsStdCall epicsThreadSuspendSelf(void); /** Resume a thread suspended with epicsThreadSuspendSelf() */ -epicsShareFunc void epicsShareAPI epicsThreadResume(epicsThreadId id); +LIBCOM_API void epicsStdCall epicsThreadResume(epicsThreadId id); /** Return thread OSI priority */ -epicsShareFunc unsigned int epicsShareAPI epicsThreadGetPriority( +LIBCOM_API unsigned int epicsStdCall epicsThreadGetPriority( epicsThreadId id); /** Return thread OSI priority */ -epicsShareFunc unsigned int epicsShareAPI epicsThreadGetPrioritySelf(void); +LIBCOM_API unsigned int epicsStdCall epicsThreadGetPrioritySelf(void); /** Change OSI priority of target thread. */ -epicsShareFunc void epicsShareAPI epicsThreadSetPriority( +LIBCOM_API void epicsStdCall epicsThreadSetPriority( epicsThreadId id,unsigned int priority); /** Lookup the next usage OSI priority such that priority > *pPriorityJustBelow * if this is possible with the current target configuration and privlages. */ -epicsShareFunc epicsThreadBooleanStatus epicsShareAPI +LIBCOM_API epicsThreadBooleanStatus epicsStdCall epicsThreadHighestPriorityLevelBelow ( unsigned int priority, unsigned *pPriorityJustBelow); /** Lookup the next usage OSI priority such that priority < *pPriorityJustBelow * if this is possible with the current target configuration and privlages. */ -epicsShareFunc epicsThreadBooleanStatus epicsShareAPI +LIBCOM_API epicsThreadBooleanStatus epicsStdCall epicsThreadLowestPriorityLevelAbove ( unsigned int priority, unsigned *pPriorityJustAbove); /** Test if two thread IDs actually refer to the same OS thread */ -epicsShareFunc int epicsShareAPI epicsThreadIsEqual( +LIBCOM_API int epicsStdCall epicsThreadIsEqual( epicsThreadId id1, epicsThreadId id2); /** How and why a thread can be suspended is implementation dependent. A * thread calling epicsThreadSuspendSelf() should result in this routine * returning true for that thread, but a thread may also be suspended * for other reasons. **/ -epicsShareFunc int epicsShareAPI epicsThreadIsSuspended(epicsThreadId id); +LIBCOM_API int epicsStdCall epicsThreadIsSuspended(epicsThreadId id); /** \brief Block the calling thread for at least the specified time. * \param seconds Time to wait in seconds. Values <=0 blocks for the shortest possible time. */ -epicsShareFunc void epicsShareAPI epicsThreadSleep(double seconds); +LIBCOM_API void epicsStdCall epicsThreadSleep(double seconds); /** \brief Query a value approximating the OS timer/scheduler resolution. * \return A value in seconds >=0 * * \warning On targets other than vxWorks and RTEMS, the quantum value often isn't * meaningful. Use of this function is discouraged in portable code. */ -epicsShareFunc double epicsShareAPI epicsThreadSleepQuantum(void); +LIBCOM_API double epicsStdCall epicsThreadSleepQuantum(void); /** Find an epicsThreadId associated with the current thread. * For non-EPICS threads, a new epicsThreadId may be allocated. */ -epicsShareFunc epicsThreadId epicsShareAPI epicsThreadGetIdSelf(void); +LIBCOM_API epicsThreadId epicsStdCall epicsThreadGetIdSelf(void); /** Attempt to find the first instance of a thread by name. * \return An epicsThreadId, or NULL if no such thread is currently running. * Note that a non-NULL ID may still be invalid if this call races @@ -249,12 +249,12 @@ epicsShareFunc epicsThreadId epicsShareAPI epicsThreadGetIdSelf(void); * \warning Safe use of this function requires external knowledge that this * thread will not return. */ -epicsShareFunc epicsThreadId epicsShareAPI epicsThreadGetId(const char *name); +LIBCOM_API epicsThreadId epicsStdCall epicsThreadGetId(const char *name); /** Return a value approximating the number of threads which this target * can run in parallel. This value is advisory. * \return >=1 */ -epicsShareFunc int epicsThreadGetCPUs(void); +LIBCOM_API int epicsThreadGetCPUs(void); /** Return the name of the current thread. * @@ -263,7 +263,7 @@ epicsShareFunc int epicsThreadGetCPUs(void); * This is either a copy of the string passed to epicsThread*Create*(), * or an arbitrary unique string for non-EPICS threads. */ -epicsShareFunc const char * epicsShareAPI epicsThreadGetNameSelf(void); +LIBCOM_API const char * epicsStdCall epicsThreadGetNameSelf(void); /** Copy out the thread name into the provided buffer. * @@ -271,7 +271,7 @@ epicsShareFunc const char * epicsShareAPI epicsThreadGetNameSelf(void); * size is number of bytes in buffer to hold name (including terminator). * Failure results in an empty string stored in name. */ -epicsShareFunc void epicsShareAPI epicsThreadGetName( +LIBCOM_API void epicsStdCall epicsThreadGetName( epicsThreadId id, char *name, size_t size); /** @@ -280,20 +280,20 @@ epicsShareFunc void epicsShareAPI epicsThreadGetName( * For example the errlog system calls this to decide when messages * should be displayed on the console. **/ -epicsShareFunc int epicsShareAPI epicsThreadIsOkToBlock(void); +LIBCOM_API int epicsStdCall epicsThreadIsOkToBlock(void); /** * When a thread is started the default is that it is not allowed to * block. This method can be called to change the state. For example * iocsh calls this to specify that it is OK to block. **/ -epicsShareFunc void epicsShareAPI epicsThreadSetOkToBlock(int isOkToBlock); +LIBCOM_API void epicsStdCall epicsThreadSetOkToBlock(int isOkToBlock); /** Print to stdout information about all running EPICS threads. * \param level 0 prints minimal output. Higher values print more details. */ -epicsShareFunc void epicsShareAPI epicsThreadShowAll(unsigned int level); +LIBCOM_API void epicsStdCall epicsThreadShowAll(unsigned int level); /** Print info about a single EPICS thread. */ -epicsShareFunc void epicsShareAPI epicsThreadShow( +LIBCOM_API void epicsStdCall epicsThreadShow( epicsThreadId id,unsigned int level); /** @@ -307,35 +307,35 @@ typedef void (*EPICS_THREAD_HOOK_ROUTINE)(epicsThreadId id); * routine with epicsAtThreadExit() to release thread-specific resources * they have allocated. */ -epicsShareFunc int epicsThreadHookAdd(EPICS_THREAD_HOOK_ROUTINE hook); +LIBCOM_API int epicsThreadHookAdd(EPICS_THREAD_HOOK_ROUTINE hook); /** * Remove routine from the list of hooks run at thread creation time. **/ -epicsShareFunc int epicsThreadHookDelete(EPICS_THREAD_HOOK_ROUTINE hook); +LIBCOM_API int epicsThreadHookDelete(EPICS_THREAD_HOOK_ROUTINE hook); /** * Print the current list of hook function pointers. **/ -epicsShareFunc void epicsThreadHooksShow(void); +LIBCOM_API void epicsThreadHooksShow(void); /** * Call func once for every known thread. **/ -epicsShareFunc void epicsThreadMap(EPICS_THREAD_HOOK_ROUTINE func); +LIBCOM_API void epicsThreadMap(EPICS_THREAD_HOOK_ROUTINE func); /** Thread local storage */ typedef struct epicsThreadPrivateOSD * epicsThreadPrivateId; /** Allocate a new thread local variable. * This variable will initially hold NULL for each thread. */ -epicsShareFunc epicsThreadPrivateId epicsShareAPI epicsThreadPrivateCreate(void); +LIBCOM_API epicsThreadPrivateId epicsStdCall epicsThreadPrivateCreate(void); /** Free a thread local variable */ -epicsShareFunc void epicsShareAPI epicsThreadPrivateDelete(epicsThreadPrivateId id); +LIBCOM_API void epicsStdCall epicsThreadPrivateDelete(epicsThreadPrivateId id); /** Update thread local variable */ -epicsShareFunc void epicsShareAPI epicsThreadPrivateSet(epicsThreadPrivateId,void *); +LIBCOM_API void epicsStdCall epicsThreadPrivateSet(epicsThreadPrivateId,void *); /** Fetch the current value of a thread local variable */ -epicsShareFunc void * epicsShareAPI epicsThreadPrivateGet(epicsThreadPrivateId); +LIBCOM_API void * epicsStdCall epicsThreadPrivateGet(epicsThreadPrivateId); #ifdef __cplusplus } @@ -347,7 +347,7 @@ epicsShareFunc void * epicsShareAPI epicsThreadPrivateGet(epicsThreadPrivateId); #include "epicsMutex.h" //! Interface used with class epicsThread -class epicsShareClass epicsThreadRunable { +class LIBCOM_API epicsThreadRunable { public: virtual ~epicsThreadRunable () = 0; //! Thread main function. @@ -366,7 +366,7 @@ extern "C" void epicsThreadCallEntryPoint ( void * ); * * \note Threads must be start() ed. */ -class epicsShareClass epicsThread { +class LIBCOM_API epicsThread { public: /** Create a new thread with the provided information. * @@ -438,7 +438,7 @@ private: class exitException {}; }; -class epicsShareClass epicsThreadPrivateBase { +class LIBCOM_API epicsThreadPrivateBase { public: class unableToCreateThreadPrivate {}; /* exception */ protected: diff --git a/modules/libcom/src/osi/epicsTime.cpp b/modules/libcom/src/osi/epicsTime.cpp index f80d1738b..8c31d592e 100644 --- a/modules/libcom/src/osi/epicsTime.cpp +++ b/modules/libcom/src/osi/epicsTime.cpp @@ -28,7 +28,6 @@ #include #include // vxWorks 6.0 requires this include -#define epicsExportSharedSymbols #include "locationException.h" #include "epicsAssert.h" #include "epicsVersion.h" @@ -931,7 +930,7 @@ extern "C" { // its too bad that these cant be implemented with inline functions // at least when running the GNU compiler // - epicsShareFunc int epicsShareAPI epicsTimeToTime_t (time_t *pDest, const epicsTimeStamp *pSrc) + LIBCOM_API int epicsStdCall epicsTimeToTime_t (time_t *pDest, const epicsTimeStamp *pSrc) { try { time_t_wrapper dst = epicsTime (*pSrc); @@ -942,7 +941,7 @@ extern "C" { } return epicsTimeOK; } - epicsShareFunc int epicsShareAPI epicsTimeFromTime_t (epicsTimeStamp *pDest, time_t src) + LIBCOM_API int epicsStdCall epicsTimeFromTime_t (epicsTimeStamp *pDest, time_t src) { try { time_t_wrapper dst; @@ -954,7 +953,7 @@ extern "C" { } return epicsTimeOK; } - epicsShareFunc int epicsShareAPI epicsTimeToTM (struct tm *pDest, unsigned long *pNSecDest, const epicsTimeStamp *pSrc) + LIBCOM_API int epicsStdCall epicsTimeToTM (struct tm *pDest, unsigned long *pNSecDest, const epicsTimeStamp *pSrc) { try { local_tm_nano_sec tmns = epicsTime (*pSrc); @@ -967,7 +966,7 @@ extern "C" { } return epicsTimeOK; } - epicsShareFunc int epicsShareAPI epicsTimeToGMTM (struct tm *pDest, unsigned long *pNSecDest, const epicsTimeStamp *pSrc) + LIBCOM_API int epicsStdCall epicsTimeToGMTM (struct tm *pDest, unsigned long *pNSecDest, const epicsTimeStamp *pSrc) { try { gm_tm_nano_sec gmtmns = epicsTime (*pSrc); @@ -980,7 +979,7 @@ extern "C" { } return epicsTimeOK; } - epicsShareFunc int epicsShareAPI epicsTimeFromTM (epicsTimeStamp *pDest, const struct tm *pSrc, unsigned long nSecSrc) + LIBCOM_API int epicsStdCall epicsTimeFromTM (epicsTimeStamp *pDest, const struct tm *pSrc, unsigned long nSecSrc) { try { local_tm_nano_sec tmns; @@ -993,7 +992,7 @@ extern "C" { } return epicsTimeOK; } - epicsShareFunc int epicsShareAPI epicsTimeFromGMTM (epicsTimeStamp *pDest, const struct tm *pSrc, unsigned long nSecSrc) + LIBCOM_API int epicsStdCall epicsTimeFromGMTM (epicsTimeStamp *pDest, const struct tm *pSrc, unsigned long nSecSrc) { try { gm_tm_nano_sec tmns; @@ -1006,7 +1005,7 @@ extern "C" { } return epicsTimeOK; } - epicsShareFunc int epicsShareAPI epicsTimeToTimespec (struct timespec *pDest, const epicsTimeStamp *pSrc) + LIBCOM_API int epicsStdCall epicsTimeToTimespec (struct timespec *pDest, const epicsTimeStamp *pSrc) { try { *pDest = epicsTime (*pSrc); @@ -1016,7 +1015,7 @@ extern "C" { } return epicsTimeOK; } - epicsShareFunc int epicsShareAPI epicsTimeFromTimespec (epicsTimeStamp *pDest, const struct timespec *pSrc) + LIBCOM_API int epicsStdCall epicsTimeFromTimespec (epicsTimeStamp *pDest, const struct timespec *pSrc) { try { *pDest = epicsTime (*pSrc); @@ -1026,7 +1025,7 @@ extern "C" { } return epicsTimeOK; } - epicsShareFunc int epicsShareAPI epicsTimeToTimeval (struct timeval *pDest, const epicsTimeStamp *pSrc) + LIBCOM_API int epicsStdCall epicsTimeToTimeval (struct timeval *pDest, const epicsTimeStamp *pSrc) { try { *pDest = epicsTime (*pSrc); @@ -1036,7 +1035,7 @@ extern "C" { } return epicsTimeOK; } - epicsShareFunc int epicsShareAPI epicsTimeFromTimeval (epicsTimeStamp *pDest, const struct timeval *pSrc) + LIBCOM_API int epicsStdCall epicsTimeFromTimeval (epicsTimeStamp *pDest, const struct timeval *pSrc) { try { *pDest = epicsTime (*pSrc); @@ -1046,7 +1045,7 @@ extern "C" { } return epicsTimeOK; } - epicsShareFunc double epicsShareAPI epicsTimeDiffInSeconds (const epicsTimeStamp *pLeft, const epicsTimeStamp *pRight) + LIBCOM_API double epicsStdCall epicsTimeDiffInSeconds (const epicsTimeStamp *pLeft, const epicsTimeStamp *pRight) { try { return epicsTime (*pLeft) - epicsTime (*pRight); @@ -1055,7 +1054,7 @@ extern "C" { return - DBL_MAX; } } - epicsShareFunc void epicsShareAPI epicsTimeAddSeconds (epicsTimeStamp *pDest, double seconds) + LIBCOM_API void epicsStdCall epicsTimeAddSeconds (epicsTimeStamp *pDest, double seconds) { try { *pDest = epicsTime (*pDest) + seconds; @@ -1064,7 +1063,7 @@ extern "C" { *pDest = epicsTime (); } } - epicsShareFunc int epicsShareAPI epicsTimeEqual (const epicsTimeStamp *pLeft, const epicsTimeStamp *pRight) + LIBCOM_API int epicsStdCall epicsTimeEqual (const epicsTimeStamp *pLeft, const epicsTimeStamp *pRight) { try { return epicsTime (*pLeft) == epicsTime (*pRight); @@ -1073,7 +1072,7 @@ extern "C" { return 0; } } - epicsShareFunc int epicsShareAPI epicsTimeNotEqual (const epicsTimeStamp *pLeft, const epicsTimeStamp *pRight) + LIBCOM_API int epicsStdCall epicsTimeNotEqual (const epicsTimeStamp *pLeft, const epicsTimeStamp *pRight) { try { return epicsTime (*pLeft) != epicsTime (*pRight); @@ -1082,7 +1081,7 @@ extern "C" { return 1; } } - epicsShareFunc int epicsShareAPI epicsTimeLessThan (const epicsTimeStamp *pLeft, const epicsTimeStamp *pRight) + LIBCOM_API int epicsStdCall epicsTimeLessThan (const epicsTimeStamp *pLeft, const epicsTimeStamp *pRight) { try { return epicsTime (*pLeft) < epicsTime (*pRight); @@ -1091,7 +1090,7 @@ extern "C" { return 0; } } - epicsShareFunc int epicsShareAPI epicsTimeLessThanEqual (const epicsTimeStamp *pLeft, const epicsTimeStamp *pRight) + LIBCOM_API int epicsStdCall epicsTimeLessThanEqual (const epicsTimeStamp *pLeft, const epicsTimeStamp *pRight) { try { return epicsTime (*pLeft) <= epicsTime (*pRight); @@ -1100,7 +1099,7 @@ extern "C" { return 0; } } - epicsShareFunc int epicsShareAPI epicsTimeGreaterThan (const epicsTimeStamp *pLeft, const epicsTimeStamp *pRight) + LIBCOM_API int epicsStdCall epicsTimeGreaterThan (const epicsTimeStamp *pLeft, const epicsTimeStamp *pRight) { try { return epicsTime (*pLeft) > epicsTime (*pRight); @@ -1109,7 +1108,7 @@ extern "C" { return 0; } } - epicsShareFunc int epicsShareAPI epicsTimeGreaterThanEqual (const epicsTimeStamp *pLeft, const epicsTimeStamp *pRight) + LIBCOM_API int epicsStdCall epicsTimeGreaterThanEqual (const epicsTimeStamp *pLeft, const epicsTimeStamp *pRight) { try { return epicsTime (*pLeft) >= epicsTime (*pRight); @@ -1118,7 +1117,7 @@ extern "C" { return 0; } } - epicsShareFunc size_t epicsShareAPI epicsTimeToStrftime (char *pBuff, size_t bufLength, const char *pFormat, const epicsTimeStamp *pTS) + LIBCOM_API size_t epicsStdCall epicsTimeToStrftime (char *pBuff, size_t bufLength, const char *pFormat, const epicsTimeStamp *pTS) { try { return epicsTime(*pTS).strftime (pBuff, bufLength, pFormat); @@ -1127,7 +1126,7 @@ extern "C" { return 0; } } - epicsShareFunc void epicsShareAPI epicsTimeShow (const epicsTimeStamp *pTS, unsigned interestLevel) + LIBCOM_API void epicsStdCall epicsTimeShow (const epicsTimeStamp *pTS, unsigned interestLevel) { try { epicsTime(*pTS).show (interestLevel); diff --git a/modules/libcom/src/osi/epicsTime.h b/modules/libcom/src/osi/epicsTime.h index 579d08adc..4ebd43986 100644 --- a/modules/libcom/src/osi/epicsTime.h +++ b/modules/libcom/src/osi/epicsTime.h @@ -17,7 +17,7 @@ #include -#include "shareLib.h" +#include "libComAPI.h" #include "epicsTypes.h" #include "osdTime.h" #include "errMdef.h" @@ -108,7 +108,7 @@ struct time_t_wrapper { * Stores an event number for use by the epicsTime::getEvent() static * class method. */ -class epicsShareClass epicsTimeEvent +class LIBCOM_API epicsTimeEvent { public: epicsTimeEvent (const int &number); /**< \brief Constructor */ @@ -128,7 +128,7 @@ private: * has defective POSIX, BSD/SRV5, or standard C time support the EPICS * implementation should be valid until 2106. */ -class epicsShareClass epicsTime +class LIBCOM_API epicsTime { public: /// \brief Exception: Time provider problem @@ -367,12 +367,12 @@ extern "C" { * @{ */ /** \brief Get current time into \p *pDest */ -epicsShareFunc int epicsShareAPI epicsTimeGetCurrent ( epicsTimeStamp * pDest ); +LIBCOM_API int epicsStdCall epicsTimeGetCurrent ( epicsTimeStamp * pDest ); /** \brief Get time of event \p eventNumber into \p *pDest */ -epicsShareFunc int epicsShareAPI epicsTimeGetEvent ( +LIBCOM_API int epicsStdCall epicsTimeGetEvent ( epicsTimeStamp *pDest, int eventNumber); /** \brief Get monotonic time into \p *pDest */ -epicsShareFunc int epicsTimeGetMonotonic ( epicsTimeStamp * pDest ); +LIBCOM_API int epicsTimeGetMonotonic ( epicsTimeStamp * pDest ); /** @} */ /** \name ISR-callable @@ -382,9 +382,9 @@ epicsShareFunc int epicsTimeGetMonotonic ( epicsTimeStamp * pDest ); * @{ */ /** \brief Get current time into \p *pDest (ISR-safe) */ -epicsShareFunc int epicsTimeGetCurrentInt(epicsTimeStamp *pDest); +LIBCOM_API int epicsTimeGetCurrentInt(epicsTimeStamp *pDest); /** \brief Get time of event \p eventNumber into \p *pDest (ISR-safe) */ -epicsShareFunc int epicsTimeGetEventInt(epicsTimeStamp *pDest, int eventNumber); +LIBCOM_API int epicsTimeGetEventInt(epicsTimeStamp *pDest, int eventNumber); /** @} */ /** \name ANSI C time_t conversions @@ -392,10 +392,10 @@ epicsShareFunc int epicsTimeGetEventInt(epicsTimeStamp *pDest, int eventNumber); * @{ */ /** \brief Convert epicsTimeStamp to ANSI C \c time_t */ -epicsShareFunc int epicsShareAPI epicsTimeToTime_t ( +LIBCOM_API int epicsStdCall epicsTimeToTime_t ( time_t * pDest, const epicsTimeStamp * pSrc ); /** \brief Convert ANSI C \c time_t to epicsTimeStamp */ -epicsShareFunc int epicsShareAPI epicsTimeFromTime_t ( +LIBCOM_API int epicsStdCall epicsTimeFromTime_t ( epicsTimeStamp * pDest, time_t src ); /** @} */ @@ -404,16 +404,16 @@ epicsShareFunc int epicsShareAPI epicsTimeFromTime_t ( * @{ */ /** \brief Convert epicsTimeStamp to struct tm in local time zone */ -epicsShareFunc int epicsShareAPI epicsTimeToTM ( +LIBCOM_API int epicsStdCall epicsTimeToTM ( struct tm * pDest, unsigned long * pNSecDest, const epicsTimeStamp * pSrc ); /** \brief Convert epicsTimeStamp to struct tm in UTC/GMT */ -epicsShareFunc int epicsShareAPI epicsTimeToGMTM ( +LIBCOM_API int epicsStdCall epicsTimeToGMTM ( struct tm * pDest, unsigned long * pNSecDest, const epicsTimeStamp * pSrc ); /** \brief Set epicsTimeStamp from struct tm in local time zone */ -epicsShareFunc int epicsShareAPI epicsTimeFromTM ( +LIBCOM_API int epicsStdCall epicsTimeFromTM ( epicsTimeStamp * pDest, const struct tm * pSrc, unsigned long nSecSrc ); /** \brief Set epicsTimeStamp from struct tm in UTC/GMT */ -epicsShareFunc int epicsShareAPI epicsTimeFromGMTM ( +LIBCOM_API int epicsStdCall epicsTimeFromGMTM ( epicsTimeStamp * pDest, const struct tm * pSrc, unsigned long nSecSrc ); /** @} */ @@ -422,10 +422,10 @@ epicsShareFunc int epicsShareAPI epicsTimeFromGMTM ( * format. * @{ */ /** \brief Convert epicsTimeStamp to struct timespec */ -epicsShareFunc int epicsShareAPI epicsTimeToTimespec ( +LIBCOM_API int epicsStdCall epicsTimeToTimespec ( struct timespec * pDest, const epicsTimeStamp * pSrc ); /** \brief Set epicsTimeStamp from struct timespec */ -epicsShareFunc int epicsShareAPI epicsTimeFromTimespec ( +LIBCOM_API int epicsStdCall epicsTimeFromTimespec ( epicsTimeStamp * pDest, const struct timespec * pSrc ); /** @} */ @@ -433,10 +433,10 @@ epicsShareFunc int epicsShareAPI epicsTimeFromTimespec ( * Convert to and from the BSD struct timeval format. * @{ */ /** \brief Convert epicsTimeStamp to struct timeval */ -epicsShareFunc int epicsShareAPI epicsTimeToTimeval ( +LIBCOM_API int epicsStdCall epicsTimeToTimeval ( struct timeval * pDest, const epicsTimeStamp * pSrc ); /** \brief Set epicsTimeStamp from struct timeval */ -epicsShareFunc int epicsShareAPI epicsTimeFromTimeval ( +LIBCOM_API int epicsStdCall epicsTimeFromTimeval ( epicsTimeStamp * pDest, const struct timeval * pSrc ); /** @} */ @@ -445,10 +445,10 @@ epicsShareFunc int epicsShareAPI epicsTimeFromTimeval ( * which are always expressed as a \c double in seconds. * @{ */ /** \brief Time difference between \p left and \p right in seconds. */ -epicsShareFunc double epicsShareAPI epicsTimeDiffInSeconds ( +LIBCOM_API double epicsStdCall epicsTimeDiffInSeconds ( const epicsTimeStamp * pLeft, const epicsTimeStamp * pRight );/* left - right */ /** \brief Add some number of seconds to \p dest */ -epicsShareFunc void epicsShareAPI epicsTimeAddSeconds ( +LIBCOM_API void epicsStdCall epicsTimeAddSeconds ( epicsTimeStamp * pDest, double secondsToAdd ); /* adds seconds to *pDest */ /** @} */ @@ -456,31 +456,31 @@ epicsShareFunc void epicsShareAPI epicsTimeAddSeconds ( * Comparisons between epicsTimeStamp objects, returning 0=false, 1=true. * @{ */ /** \brief \p left equals \p right */ -epicsShareFunc int epicsShareAPI epicsTimeEqual ( +LIBCOM_API int epicsStdCall epicsTimeEqual ( const epicsTimeStamp * pLeft, const epicsTimeStamp * pRight); /** \brief \p left not equal to \p right */ -epicsShareFunc int epicsShareAPI epicsTimeNotEqual ( +LIBCOM_API int epicsStdCall epicsTimeNotEqual ( const epicsTimeStamp * pLeft, const epicsTimeStamp * pRight); /** \brief \p left was before \p right */ -epicsShareFunc int epicsShareAPI epicsTimeLessThan ( +LIBCOM_API int epicsStdCall epicsTimeLessThan ( const epicsTimeStamp * pLeft, const epicsTimeStamp * pRight); /** \brief \p right was no later than \p left */ -epicsShareFunc int epicsShareAPI epicsTimeLessThanEqual ( +LIBCOM_API int epicsStdCall epicsTimeLessThanEqual ( const epicsTimeStamp * pLeft, const epicsTimeStamp * pRight); /** \brief \p left was after \p right */ -epicsShareFunc int epicsShareAPI epicsTimeGreaterThan ( +LIBCOM_API int epicsStdCall epicsTimeGreaterThan ( const epicsTimeStamp * pLeft, const epicsTimeStamp * pRight); /** \brief \p right was not before \p left */ -epicsShareFunc int epicsShareAPI epicsTimeGreaterThanEqual ( +LIBCOM_API int epicsStdCall epicsTimeGreaterThanEqual ( const epicsTimeStamp * pLeft, const epicsTimeStamp * pRight); /** @} */ /** \brief Convert epicsTimeStamp to string. See epicsTime::strftime() */ -epicsShareFunc size_t epicsShareAPI epicsTimeToStrftime ( +LIBCOM_API size_t epicsStdCall epicsTimeToStrftime ( char * pBuff, size_t bufLength, const char * pFormat, const epicsTimeStamp * pTS ); /** \brief Dump current state to stdout */ -epicsShareFunc void epicsShareAPI epicsTimeShow ( +LIBCOM_API void epicsStdCall epicsTimeShow ( const epicsTimeStamp *, unsigned interestLevel ); /** \name Reentrant time_t to struct tm conversions @@ -488,9 +488,9 @@ epicsShareFunc void epicsShareAPI epicsTimeShow ( * vxWorks \c gmtime_r interface does not match POSIX standards * @{ */ /** \brief Break down a \c time_t into a struct tm in the local timezone */ -epicsShareFunc int epicsShareAPI epicsTime_localtime ( const time_t * clock, struct tm * result ); +LIBCOM_API int epicsStdCall epicsTime_localtime ( const time_t * clock, struct tm * result ); /** \brief Break down a \c time_t into a struct tm in the UTC timezone */ -epicsShareFunc int epicsShareAPI epicsTime_gmtime ( const time_t * clock, struct tm * result ); +LIBCOM_API int epicsStdCall epicsTime_gmtime ( const time_t * clock, struct tm * result ); /** @} */ /** \name Monotonic time routines @@ -499,14 +499,14 @@ epicsShareFunc int epicsShareAPI epicsTime_gmtime ( const time_t * clock, struct * minimum non-zero time difference between two calls to epicsMonotonicGet() * in units of nanoseconds. */ -epicsShareFunc epicsUInt64 epicsMonotonicResolution(void); +LIBCOM_API epicsUInt64 epicsMonotonicResolution(void); /** \brief Fetch monotonic counter, returns the number of nanoseconds since * some unspecified time. */ -epicsShareFunc epicsUInt64 epicsMonotonicGet(void); +LIBCOM_API epicsUInt64 epicsMonotonicGet(void); /** @} */ #ifdef EPICS_EXPOSE_LIBCOM_MONOTONIC_PRIVATE -epicsShareFunc void osdMonotonicInit(void); +LIBCOM_API void osdMonotonicInit(void); #endif #ifdef __cplusplus diff --git a/modules/libcom/src/osi/generalTimeSup.h b/modules/libcom/src/osi/generalTimeSup.h index bd6627ef6..23858d79b 100644 --- a/modules/libcom/src/osi/generalTimeSup.h +++ b/modules/libcom/src/osi/generalTimeSup.h @@ -12,7 +12,7 @@ #include "epicsTime.h" #include "epicsTimer.h" -#include "shareLib.h" +#include "libComAPI.h" #define LAST_RESORT_PRIORITY 999 @@ -23,21 +23,21 @@ extern "C" { typedef int (*TIMECURRENTFUN)(epicsTimeStamp *pDest); typedef int (*TIMEEVENTFUN)(epicsTimeStamp *pDest, int event); -epicsShareFunc int generalTimeRegisterCurrentProvider(const char *name, +LIBCOM_API int generalTimeRegisterCurrentProvider(const char *name, int priority, TIMECURRENTFUN getTime); -epicsShareFunc int generalTimeRegisterEventProvider(const char *name, +LIBCOM_API int generalTimeRegisterEventProvider(const char *name, int priority, TIMEEVENTFUN getEvent); /* Original names, for compatibility */ #define generalTimeCurrentTpRegister generalTimeRegisterCurrentProvider #define generalTimeEventTpRegister generalTimeRegisterEventProvider -epicsShareFunc int generalTimeAddIntCurrentProvider(const char *name, +LIBCOM_API int generalTimeAddIntCurrentProvider(const char *name, int priority, TIMECURRENTFUN getTime); -epicsShareFunc int generalTimeAddIntEventProvider(const char *name, +LIBCOM_API int generalTimeAddIntEventProvider(const char *name, int priority, TIMEEVENTFUN getEvent); -epicsShareFunc int generalTimeGetExceptPriority(epicsTimeStamp *pDest, +LIBCOM_API int generalTimeGetExceptPriority(epicsTimeStamp *pDest, int *pPrio, int ignorePrio); #ifdef __cplusplus diff --git a/modules/libcom/src/osi/os/Darwin/epicsMath.h b/modules/libcom/src/osi/os/Darwin/epicsMath.h index d540ba5d3..330ccb6e6 100644 --- a/modules/libcom/src/osi/os/Darwin/epicsMath.h +++ b/modules/libcom/src/osi/os/Darwin/epicsMath.h @@ -11,7 +11,7 @@ #define epicsMathh #include -#include +#include #define finite(x) isfinite(x) @@ -19,8 +19,8 @@ extern "C" { #endif -epicsShareExtern float epicsNAN; -epicsShareExtern float epicsINF; +LIBCOM_API extern float epicsNAN; +LIBCOM_API extern float epicsINF; #ifdef __cplusplus } diff --git a/modules/libcom/src/osi/os/Darwin/osdEnv.c b/modules/libcom/src/osi/os/Darwin/osdEnv.c index ea2662ddc..878dc5125 100644 --- a/modules/libcom/src/osi/os/Darwin/osdEnv.c +++ b/modules/libcom/src/osi/os/Darwin/osdEnv.c @@ -25,7 +25,6 @@ #include #define environ (*_NSGetEnviron()) -#define epicsExportSharedSymbols #include "epicsStdio.h" #include "envDefs.h" #include "iocsh.h" @@ -33,7 +32,7 @@ /* * Set the value of an environment variable */ -epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *value) +LIBCOM_API void epicsStdCall epicsEnvSet (const char *name, const char *value) { if (!name) return; iocshEnvClear(name); @@ -44,7 +43,7 @@ epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *val * Unset an environment variable */ -epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name) +LIBCOM_API void epicsStdCall epicsEnvUnset (const char *name) { iocshEnvClear(name); unsetenv(name); @@ -53,7 +52,7 @@ epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name) /* * Show the value of the specified, or all, environment variables */ -epicsShareFunc void epicsShareAPI epicsEnvShow (const char *name) +LIBCOM_API void epicsStdCall epicsEnvShow (const char *name) { if (name == NULL) { extern char **environ; diff --git a/modules/libcom/src/osi/os/Darwin/osdFindAddr.c b/modules/libcom/src/osi/os/Darwin/osdFindAddr.c index b92770a54..e3c6750c7 100644 --- a/modules/libcom/src/osi/os/Darwin/osdFindAddr.c +++ b/modules/libcom/src/osi/os/Darwin/osdFindAddr.c @@ -12,7 +12,6 @@ #include -#define epicsExportSharedSymbols #include "epicsStackTrace.h" #include "epicsStackTracePvt.h" diff --git a/modules/libcom/src/osi/os/Darwin/osdMonotonic.c b/modules/libcom/src/osi/os/Darwin/osdMonotonic.c index 2f81d002b..4110dd0df 100644 --- a/modules/libcom/src/osi/os/Darwin/osdMonotonic.c +++ b/modules/libcom/src/osi/os/Darwin/osdMonotonic.c @@ -7,7 +7,6 @@ #include #include -#define epicsExportSharedSymbols #define EPICS_EXPOSE_LIBCOM_MONOTONIC_PRIVATE #include "dbDefs.h" #include "errlog.h" diff --git a/modules/libcom/src/osi/os/Darwin/osdTime.cpp b/modules/libcom/src/osi/os/Darwin/osdTime.cpp index 09471a8e8..88abd00d6 100644 --- a/modules/libcom/src/osi/os/Darwin/osdTime.cpp +++ b/modules/libcom/src/osi/os/Darwin/osdTime.cpp @@ -18,7 +18,6 @@ #define EPICS_EXPOSE_LIBCOM_MONOTONIC_PRIVATE #include "osiSock.h" -#define epicsExportSharedSymbols #include "cantProceed.h" #include "epicsTime.h" #include "generalTimeSup.h" @@ -65,7 +64,7 @@ int epicsTime_localtime(const time_t *clock, struct tm *result) epicsTimeOK : errno; } -extern "C" epicsShareFunc void +extern "C" LIBCOM_API void convertDoubleToWakeTime(double timeout, struct timespec *wakeTime) { mach_timespec_t now; diff --git a/modules/libcom/src/osi/os/Darwin/osdTime.h b/modules/libcom/src/osi/os/Darwin/osdTime.h index d0c361404..2fe57fdac 100644 --- a/modules/libcom/src/osi/os/Darwin/osdTime.h +++ b/modules/libcom/src/osi/os/Darwin/osdTime.h @@ -16,7 +16,7 @@ extern "C" { #endif /* __cplusplus */ -epicsShareFunc void convertDoubleToWakeTime(double timeout, +LIBCOM_API void convertDoubleToWakeTime(double timeout, struct timespec *wakeTime); #ifdef __cplusplus diff --git a/modules/libcom/src/osi/os/Darwin/osdgetexec.c b/modules/libcom/src/osi/os/Darwin/osdgetexec.c index 4e4961c59..0d026a083 100644 --- a/modules/libcom/src/osi/os/Darwin/osdgetexec.c +++ b/modules/libcom/src/osi/os/Darwin/osdgetexec.c @@ -4,7 +4,6 @@ #include -#define epicsExportSharedSymbols #include char *epicsGetExecName(void) diff --git a/modules/libcom/src/osi/os/Linux/osdThread.h b/modules/libcom/src/osi/os/Linux/osdThread.h index bb1fdcb0a..25f50203b 100644 --- a/modules/libcom/src/osi/os/Linux/osdThread.h +++ b/modules/libcom/src/osi/os/Linux/osdThread.h @@ -12,7 +12,7 @@ #include #include -#include "shareLib.h" +#include "libComAPI.h" #include "ellLib.h" #include "epicsEvent.h" @@ -40,8 +40,8 @@ typedef struct epicsThreadOSD { char name[1]; /* actually larger */ } epicsThreadOSD; -epicsShareFunc pthread_t epicsThreadGetPosixThreadId(epicsThreadId id); -epicsShareFunc int epicsThreadGetPosixPriority(epicsThreadId id); +LIBCOM_API pthread_t epicsThreadGetPosixThreadId(epicsThreadId id); +LIBCOM_API int epicsThreadGetPosixPriority(epicsThreadId id); #ifdef __cplusplus } diff --git a/modules/libcom/src/osi/os/Linux/osdThreadExtra.c b/modules/libcom/src/osi/os/Linux/osdThreadExtra.c index 6423004c5..9e4575cfe 100644 --- a/modules/libcom/src/osi/os/Linux/osdThreadExtra.c +++ b/modules/libcom/src/osi/os/Linux/osdThreadExtra.c @@ -22,7 +22,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsStdio.h" #include "ellLib.h" #include "epicsEvent.h" @@ -65,5 +64,5 @@ static void thread_hook(epicsThreadId pthreadInfo) pthreadInfo->lwpId = syscall(SYS_gettid); } -epicsShareDef EPICS_THREAD_HOOK_ROUTINE epicsThreadHookDefault = thread_hook; -epicsShareDef EPICS_THREAD_HOOK_ROUTINE epicsThreadHookMain = thread_hook; +EPICS_THREAD_HOOK_ROUTINE epicsThreadHookDefault = thread_hook; +EPICS_THREAD_HOOK_ROUTINE epicsThreadHookMain = thread_hook; diff --git a/modules/libcom/src/osi/os/Linux/osdTime.h b/modules/libcom/src/osi/os/Linux/osdTime.h index 988f8747f..221a7d085 100644 --- a/modules/libcom/src/osi/os/Linux/osdTime.h +++ b/modules/libcom/src/osi/os/Linux/osdTime.h @@ -21,7 +21,7 @@ extern "C" { #endif /* __cplusplus */ -epicsShareFunc void epicsShareAPI +LIBCOM_API void epicsStdCall convertDoubleToWakeTime(double timeout,struct timespec *wakeTime); #ifdef __cplusplus diff --git a/modules/libcom/src/osi/os/Linux/osdgetexec.c b/modules/libcom/src/osi/os/Linux/osdgetexec.c index f79906fb7..f638de2ca 100644 --- a/modules/libcom/src/osi/os/Linux/osdgetexec.c +++ b/modules/libcom/src/osi/os/Linux/osdgetexec.c @@ -4,7 +4,6 @@ #include #include -#define epicsExportSharedSymbols #include #ifndef PATH_MAX diff --git a/modules/libcom/src/osi/os/RTEMS/epicsAtomicOSD.h b/modules/libcom/src/osi/os/RTEMS/epicsAtomicOSD.h index fefd2015e..5e7b6697c 100644 --- a/modules/libcom/src/osi/os/RTEMS/epicsAtomicOSD.h +++ b/modules/libcom/src/osi/os/RTEMS/epicsAtomicOSD.h @@ -16,7 +16,7 @@ #ifndef epicsAtomicOSD_h #define epicsAtomicOSD_h -#include +#include #include "epicsMMIO.h" #include "compilerSpecific.h" #include "epicsInterrupt.h" diff --git a/modules/libcom/src/osi/os/RTEMS/epicsMath.h b/modules/libcom/src/osi/os/RTEMS/epicsMath.h index 83115f06e..b5897929e 100644 --- a/modules/libcom/src/osi/os/RTEMS/epicsMath.h +++ b/modules/libcom/src/osi/os/RTEMS/epicsMath.h @@ -12,14 +12,14 @@ #include #include -#include +#include #ifdef __cplusplus extern "C" { #endif -epicsShareExtern float epicsNAN; -epicsShareExtern float epicsINF; +LIBCOM_API extern float epicsNAN; +LIBCOM_API extern float epicsINF; #ifdef __cplusplus } diff --git a/modules/libcom/src/osi/os/RTEMS/osdEnv.c b/modules/libcom/src/osi/os/RTEMS/osdEnv.c index c356a0a13..2cc80daee 100644 --- a/modules/libcom/src/osi/os/RTEMS/osdEnv.c +++ b/modules/libcom/src/osi/os/RTEMS/osdEnv.c @@ -15,7 +15,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsStdio.h" #include "envDefs.h" #include "osiUnistd.h" @@ -24,7 +23,7 @@ /* * Set the value of an environment variable */ -epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *value) +LIBCOM_API void epicsStdCall epicsEnvSet (const char *name, const char *value) { iocshEnvClear(name); setenv(name, value, 1); @@ -34,7 +33,7 @@ epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *val * Unset an environment variable */ -epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name) +LIBCOM_API void epicsStdCall epicsEnvUnset (const char *name) { iocshEnvClear(name); unsetenv(name); @@ -43,7 +42,7 @@ epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name) /* * Show the value of the specified, or all, environment variables */ -epicsShareFunc void epicsShareAPI epicsEnvShow (const char *name) +LIBCOM_API void epicsStdCall epicsEnvShow (const char *name) { if (name == NULL) { extern char **environ; diff --git a/modules/libcom/src/osi/os/RTEMS/osdFindSymbol.c b/modules/libcom/src/osi/os/RTEMS/osdFindSymbol.c index 9e947f95c..2dae7ab80 100644 --- a/modules/libcom/src/osi/os/RTEMS/osdFindSymbol.c +++ b/modules/libcom/src/osi/os/RTEMS/osdFindSymbol.c @@ -12,20 +12,19 @@ * as the code must build for non-GESYS systems as well. */ -#define epicsExportSharedSymbols #include "epicsFindSymbol.h" -epicsShareFunc void * epicsLoadLibrary(const char *name) +LIBCOM_API void * epicsLoadLibrary(const char *name) { return 0; } -epicsShareFunc const char *epicsLoadError(void) +LIBCOM_API const char *epicsLoadError(void) { return "epicsLoadLibrary not implemented"; } -epicsShareFunc void * epicsShareAPI epicsFindSymbol(const char *name) +LIBCOM_API void * epicsStdCall epicsFindSymbol(const char *name) { return 0; } diff --git a/modules/libcom/src/osi/os/RTEMS/osdMessageQueue.c b/modules/libcom/src/osi/os/RTEMS/osdMessageQueue.c index a566de6f6..52eb8742b 100644 --- a/modules/libcom/src/osi/os/RTEMS/osdMessageQueue.c +++ b/modules/libcom/src/osi/os/RTEMS/osdMessageQueue.c @@ -19,7 +19,6 @@ */ #define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ 1 -#define epicsExportSharedSymbols #include #include #include @@ -29,7 +28,7 @@ #include "epicsMessageQueue.h" #include "errlog.h" -epicsShareFunc epicsMessageQueueId epicsShareAPI +LIBCOM_API epicsMessageQueueId epicsStdCall epicsMessageQueueCreate(unsigned int capacity, unsigned int maximumMessageSize) { rtems_status_code sc; @@ -120,7 +119,7 @@ static rtems_status_code rtems_message_queue_send_timeout( return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ } -epicsShareFunc int epicsShareAPI epicsMessageQueueSend( +LIBCOM_API int epicsStdCall epicsMessageQueueSend( epicsMessageQueueId id, void *message, unsigned int messageSize) @@ -131,7 +130,7 @@ epicsShareFunc int epicsShareAPI epicsMessageQueueSend( return -1; } -epicsShareFunc int epicsShareAPI epicsMessageQueueSendWithTimeout( +LIBCOM_API int epicsStdCall epicsMessageQueueSendWithTimeout( epicsMessageQueueId id, void *message, unsigned int messageSize, @@ -183,7 +182,7 @@ static int receiveMessage( return rsize; } -epicsShareFunc int epicsShareAPI epicsMessageQueueTryReceive( +LIBCOM_API int epicsStdCall epicsMessageQueueTryReceive( epicsMessageQueueId id, void *message, unsigned int size) @@ -191,7 +190,7 @@ epicsShareFunc int epicsShareAPI epicsMessageQueueTryReceive( return receiveMessage(id, message, size, RTEMS_NO_WAIT, 0); } -epicsShareFunc int epicsShareAPI epicsMessageQueueReceive( +LIBCOM_API int epicsStdCall epicsMessageQueueReceive( epicsMessageQueueId id, void *message, unsigned int size) @@ -199,7 +198,7 @@ epicsShareFunc int epicsShareAPI epicsMessageQueueReceive( return receiveMessage(id, message, size, RTEMS_WAIT, RTEMS_NO_TIMEOUT); } -epicsShareFunc int epicsShareAPI epicsMessageQueueReceiveWithTimeout( +LIBCOM_API int epicsStdCall epicsMessageQueueReceiveWithTimeout( epicsMessageQueueId id, void *message, unsigned int size, @@ -225,7 +224,7 @@ epicsShareFunc int epicsShareAPI epicsMessageQueueReceiveWithTimeout( return receiveMessage(id, message, size, wait, delay); } -epicsShareFunc int epicsShareAPI epicsMessageQueuePending( +LIBCOM_API int epicsStdCall epicsMessageQueuePending( epicsMessageQueueId id) { uint32_t count; @@ -241,7 +240,7 @@ epicsShareFunc int epicsShareAPI epicsMessageQueuePending( return count; } -epicsShareFunc void epicsShareAPI epicsMessageQueueShow( +LIBCOM_API void epicsStdCall epicsMessageQueueShow( epicsMessageQueueId id, int level) { diff --git a/modules/libcom/src/osi/os/RTEMS/osdMutex.c b/modules/libcom/src/osi/os/RTEMS/osdMutex.c index 96fde6ea0..da76c5eaf 100644 --- a/modules/libcom/src/osi/os/RTEMS/osdMutex.c +++ b/modules/libcom/src/osi/os/RTEMS/osdMutex.c @@ -185,7 +185,7 @@ epicsMutexLockStatus epicsMutexOsdTryLock(struct epicsMutexOSD * id) #endif } -epicsShareFunc void epicsMutexOsdShow(struct epicsMutexOSD * id,unsigned int level) +LIBCOM_API void epicsMutexOsdShow(struct epicsMutexOSD * id,unsigned int level) { #ifdef RTEMS_FAST_MUTEX Semaphore_Control *the_semaphore = (Semaphore_Control *)id; diff --git a/modules/libcom/src/osi/os/RTEMS/osdPoolStatus.c b/modules/libcom/src/osi/os/RTEMS/osdPoolStatus.c index b2f401190..71171eaa1 100644 --- a/modules/libcom/src/osi/os/RTEMS/osdPoolStatus.c +++ b/modules/libcom/src/osi/os/RTEMS/osdPoolStatus.c @@ -9,13 +9,12 @@ \*************************************************************************/ #include -#define epicsExportSharedSymbols #include "osiPoolStatus.h" /* * osiSufficentSpaceInPool () */ -epicsShareFunc int epicsShareAPI osiSufficentSpaceInPool ( size_t contiguousBlockSize ) +LIBCOM_API int epicsStdCall osiSufficentSpaceInPool ( size_t contiguousBlockSize ) { rtems_malloc_statistics_t s; unsigned long n; diff --git a/modules/libcom/src/osi/os/RTEMS/osdProcess.c b/modules/libcom/src/osi/os/RTEMS/osdProcess.c index 2768dbb0d..379e8b869 100644 --- a/modules/libcom/src/osi/os/RTEMS/osdProcess.c +++ b/modules/libcom/src/osi/os/RTEMS/osdProcess.c @@ -18,10 +18,9 @@ #include #include -#define epicsExportSharedSymbols #include "osiProcess.h" -epicsShareFunc osiGetUserNameReturn epicsShareAPI osiGetUserName (char *pBuf, unsigned bufSizeIn) +LIBCOM_API osiGetUserNameReturn epicsStdCall osiGetUserName (char *pBuf, unsigned bufSizeIn) { const char *pName = "rtems"; unsigned uiLength; @@ -43,7 +42,7 @@ epicsShareFunc osiGetUserNameReturn epicsShareAPI osiGetUserName (char *pBuf, un return osiGetUserNameSuccess; } -epicsShareFunc osiSpawnDetachedProcessReturn epicsShareAPI osiSpawnDetachedProcess +LIBCOM_API osiSpawnDetachedProcessReturn epicsStdCall osiSpawnDetachedProcess (const char *pProcessName, const char *pBaseExecutableName) { return osiSpawnDetachedProcessNoSupport; diff --git a/modules/libcom/src/osi/os/RTEMS/osdSignal.cpp b/modules/libcom/src/osi/os/RTEMS/osdSignal.cpp index 08dfa023c..cf234da0e 100644 --- a/modules/libcom/src/osi/os/RTEMS/osdSignal.cpp +++ b/modules/libcom/src/osi/os/RTEMS/osdSignal.cpp @@ -8,14 +8,13 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -#define epicsExportSharedSymbols #include "epicsSignal.h" /* * All NOOPs if the os isnt POSIX */ -epicsShareFunc void epicsShareAPI epicsSignalInstallSigHupIgnore ( void ) {} -epicsShareFunc void epicsShareAPI epicsSignalInstallSigPipeIgnore ( void ) {} -epicsShareFunc void epicsShareAPI epicsSignalInstallSigAlarmIgnore ( void ) {} -epicsShareFunc void epicsShareAPI epicsSignalRaiseSigAlarm ( struct epicsThreadOSD * /* threadId */ ) {} +LIBCOM_API void epicsStdCall epicsSignalInstallSigHupIgnore ( void ) {} +LIBCOM_API void epicsStdCall epicsSignalInstallSigPipeIgnore ( void ) {} +LIBCOM_API void epicsStdCall epicsSignalInstallSigAlarmIgnore ( void ) {} +LIBCOM_API void epicsStdCall epicsSignalRaiseSigAlarm ( struct epicsThreadOSD * /* threadId */ ) {} diff --git a/modules/libcom/src/osi/os/RTEMS/osdThread.c b/modules/libcom/src/osi/os/RTEMS/osdThread.c index bdcd8c17e..011229198 100644 --- a/modules/libcom/src/osi/os/RTEMS/osdThread.c +++ b/modules/libcom/src/osi/os/RTEMS/osdThread.c @@ -37,8 +37,8 @@ #include "epicsExit.h" #include "epicsAtomic.h" -epicsShareFunc void osdThreadHooksRun(epicsThreadId id); -epicsShareFunc void osdThreadHooksRunMain(epicsThreadId id); +LIBCOM_API void osdThreadHooksRun(epicsThreadId id); +LIBCOM_API void osdThreadHooksRunMain(epicsThreadId id); /* * Per-task variables @@ -107,7 +107,7 @@ int epicsThreadGetOssPriorityValue(unsigned int osiPriority) /* * epicsThreadLowestPriorityLevelAbove () */ -epicsShareFunc epicsThreadBooleanStatus epicsThreadLowestPriorityLevelAbove +LIBCOM_API epicsThreadBooleanStatus epicsThreadLowestPriorityLevelAbove (unsigned int priority, unsigned *pPriorityJustAbove) { unsigned newPriority = priority + 1; @@ -123,7 +123,7 @@ epicsShareFunc epicsThreadBooleanStatus epicsThreadLowestPriorityLevelAbove /* * epicsThreadHighestPriorityLevelBelow () */ -epicsShareFunc epicsThreadBooleanStatus epicsThreadHighestPriorityLevelBelow +LIBCOM_API epicsThreadBooleanStatus epicsThreadHighestPriorityLevelBelow (unsigned int priority, unsigned *pPriorityJustBelow) { unsigned newPriority = priority - 1; @@ -841,7 +841,7 @@ double epicsThreadSleepQuantum ( void ) return 1.0 / rtemsTicksPerSecond_double; } -epicsShareFunc int epicsThreadGetCPUs(void) +LIBCOM_API int epicsThreadGetCPUs(void) { #if defined(RTEMS_SMP) return rtems_smp_get_number_of_processors(); diff --git a/modules/libcom/src/osi/os/RTEMS/osdThreadExtra.c b/modules/libcom/src/osi/os/RTEMS/osdThreadExtra.c index 0a7c7ae95..f4562802e 100644 --- a/modules/libcom/src/osi/os/RTEMS/osdThreadExtra.c +++ b/modules/libcom/src/osi/os/RTEMS/osdThreadExtra.c @@ -9,8 +9,7 @@ /* Null default thread hooks for all platforms that do not do anything special */ -#define epicsExportSharedSymbols #include "epicsThread.h" -epicsShareDef EPICS_THREAD_HOOK_ROUTINE epicsThreadHookDefault; -epicsShareDef EPICS_THREAD_HOOK_ROUTINE epicsThreadHookMain; +EPICS_THREAD_HOOK_ROUTINE epicsThreadHookDefault; +EPICS_THREAD_HOOK_ROUTINE epicsThreadHookMain; diff --git a/modules/libcom/src/osi/os/WIN32/epicsGetopt.c b/modules/libcom/src/osi/os/WIN32/epicsGetopt.c index 1ea064ea2..a364c256d 100644 --- a/modules/libcom/src/osi/os/WIN32/epicsGetopt.c +++ b/modules/libcom/src/osi/os/WIN32/epicsGetopt.c @@ -41,18 +41,17 @@ static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95"; #include #include -#define epicsExportSharedSymbols #include #define _getprogname() nargv[0] -epicsShareDef + int opterr = 1, /* if error message should be printed */ optind = 1, /* index into parent argv vector */ optopt; /* character checked for validity */ int optreset; /* reset getopt */ -epicsShareDef + char *optarg; /* argument associated with option */ #define BADCH (int)'?' diff --git a/modules/libcom/src/osi/os/WIN32/epicsGetopt.h b/modules/libcom/src/osi/os/WIN32/epicsGetopt.h index f92041085..780734e1a 100644 --- a/modules/libcom/src/osi/os/WIN32/epicsGetopt.h +++ b/modules/libcom/src/osi/os/WIN32/epicsGetopt.h @@ -18,17 +18,17 @@ #else /* _MINGW */ -#include "shareLib.h" +#include "libComAPI.h" #ifdef __cplusplus extern "C" { #endif -epicsShareFunc int getopt(int argc, char * const argv[], const char *optstring); +LIBCOM_API int getopt(int argc, char * const argv[], const char *optstring); -epicsShareExtern char *optarg; +LIBCOM_API extern char *optarg; -epicsShareExtern int optind, opterr, optopt; +LIBCOM_API extern int optind, opterr, optopt; #ifdef __cplusplus } diff --git a/modules/libcom/src/osi/os/WIN32/epicsMath.h b/modules/libcom/src/osi/os/WIN32/epicsMath.h index 33eb9dddd..65e7c7b77 100644 --- a/modules/libcom/src/osi/os/WIN32/epicsMath.h +++ b/modules/libcom/src/osi/os/WIN32/epicsMath.h @@ -12,7 +12,7 @@ #include #include -#include +#include #ifndef finite #define finite(D) _finite(D) @@ -30,8 +30,8 @@ extern "C" { #endif -epicsShareExtern float epicsNAN; -epicsShareExtern float epicsINF; +LIBCOM_API extern float epicsNAN; +LIBCOM_API extern float epicsINF; #ifdef __cplusplus } diff --git a/modules/libcom/src/osi/os/WIN32/epicsSocketConvertErrnoToString.cpp b/modules/libcom/src/osi/os/WIN32/epicsSocketConvertErrnoToString.cpp index 3db87ac84..2621ce256 100644 --- a/modules/libcom/src/osi/os/WIN32/epicsSocketConvertErrnoToString.cpp +++ b/modules/libcom/src/osi/os/WIN32/epicsSocketConvertErrnoToString.cpp @@ -9,7 +9,6 @@ #include -#define epicsExportSharedSymbols #include "osiSock.h" #include "epicsStdio.h" diff --git a/modules/libcom/src/osi/os/WIN32/epicsTempFile.c b/modules/libcom/src/osi/os/WIN32/epicsTempFile.c index 9f4c61e20..689429db8 100644 --- a/modules/libcom/src/osi/os/WIN32/epicsTempFile.c +++ b/modules/libcom/src/osi/os/WIN32/epicsTempFile.c @@ -17,7 +17,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsTempFile.h" /* @@ -26,7 +25,7 @@ * allow the teporary file directory to be set with the * TMP environment varianble */ -epicsShareFunc FILE * epicsShareAPI epicsTempFile () +LIBCOM_API FILE * epicsStdCall epicsTempFile () { char * pName = _tempnam("c:\\tmp", "epics"); if (pName) { diff --git a/modules/libcom/src/osi/os/WIN32/osdBackTrace.cpp b/modules/libcom/src/osi/os/WIN32/osdBackTrace.cpp index 8f5896a37..e143ebd57 100644 --- a/modules/libcom/src/osi/os/WIN32/osdBackTrace.cpp +++ b/modules/libcom/src/osi/os/WIN32/osdBackTrace.cpp @@ -9,7 +9,6 @@ #include -#define epicsExportSharedSymbols #include "epicsStackTracePvt.h" int epicsBackTrace(void **buf, int buf_sz) diff --git a/modules/libcom/src/osi/os/WIN32/osdEnv.c b/modules/libcom/src/osi/os/WIN32/osdEnv.c index 4c5587bb2..c1b88819a 100644 --- a/modules/libcom/src/osi/os/WIN32/osdEnv.c +++ b/modules/libcom/src/osi/os/WIN32/osdEnv.c @@ -18,7 +18,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsStdio.h" #include "errlog.h" #include "cantProceed.h" @@ -32,7 +31,7 @@ * Leaks memory, but the assumption is that this routine won't be * called often enough for the leak to be a problem. */ -epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *value) +LIBCOM_API void epicsStdCall epicsEnvSet (const char *name, const char *value) { char *cp; @@ -60,7 +59,7 @@ epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *val * Using putenv with a an existing name plus "=" (without value) deletes */ -epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name) +LIBCOM_API void epicsStdCall epicsEnvUnset (const char *name) { iocshEnvClear(name); if (getenv(name) != NULL) @@ -70,7 +69,7 @@ epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name) /* * Show the value of the specified, or all, environment variables */ -epicsShareFunc void epicsShareAPI epicsEnvShow (const char *name) +LIBCOM_API void epicsStdCall epicsEnvShow (const char *name) { if (name == NULL) { extern char **environ; diff --git a/modules/libcom/src/osi/os/WIN32/osdEvent.c b/modules/libcom/src/osi/os/WIN32/osdEvent.c index 314138b27..1339d8a88 100644 --- a/modules/libcom/src/osi/os/WIN32/osdEvent.c +++ b/modules/libcom/src/osi/os/WIN32/osdEvent.c @@ -22,8 +22,7 @@ #define STRICT #include -#define epicsExportSharedSymbols -#include "shareLib.h" +#include "libComAPI.h" #include "epicsEvent.h" typedef struct epicsEventOSD { @@ -33,7 +32,7 @@ typedef struct epicsEventOSD { /* * epicsEventCreate () */ -epicsShareFunc epicsEventId epicsEventCreate ( +LIBCOM_API epicsEventId epicsEventCreate ( epicsEventInitialState initialState ) { epicsEventOSD *pSem; @@ -53,7 +52,7 @@ epicsShareFunc epicsEventId epicsEventCreate ( /* * epicsEventDestroy () */ -epicsShareFunc void epicsEventDestroy ( epicsEventId pSem ) +LIBCOM_API void epicsEventDestroy ( epicsEventId pSem ) { CloseHandle ( pSem->handle ); free ( pSem ); @@ -62,7 +61,7 @@ epicsShareFunc void epicsEventDestroy ( epicsEventId pSem ) /* * epicsEventTrigger () */ -epicsShareFunc epicsEventStatus epicsEventTrigger ( epicsEventId pSem ) +LIBCOM_API epicsEventStatus epicsEventTrigger ( epicsEventId pSem ) { BOOL status; status = SetEvent ( pSem->handle ); @@ -72,7 +71,7 @@ epicsShareFunc epicsEventStatus epicsEventTrigger ( epicsEventId pSem ) /* * epicsEventWait () */ -epicsShareFunc epicsEventStatus epicsEventWait ( epicsEventId pSem ) +LIBCOM_API epicsEventStatus epicsEventWait ( epicsEventId pSem ) { DWORD status; status = WaitForSingleObject (pSem->handle, INFINITE); @@ -87,7 +86,7 @@ epicsShareFunc epicsEventStatus epicsEventWait ( epicsEventId pSem ) /* * epicsEventWaitWithTimeout () */ -epicsShareFunc epicsEventStatus epicsEventWaitWithTimeout ( +LIBCOM_API epicsEventStatus epicsEventWaitWithTimeout ( epicsEventId pSem, double timeOut ) { static const unsigned mSecPerSec = 1000; @@ -121,7 +120,7 @@ epicsShareFunc epicsEventStatus epicsEventWaitWithTimeout ( /* * epicsEventTryWait () */ -epicsShareFunc epicsEventStatus epicsEventTryWait ( epicsEventId pSem ) +LIBCOM_API epicsEventStatus epicsEventTryWait ( epicsEventId pSem ) { DWORD status; @@ -140,6 +139,6 @@ epicsShareFunc epicsEventStatus epicsEventTryWait ( epicsEventId pSem ) /* * epicsEventShow () */ -epicsShareFunc void epicsEventShow ( epicsEventId id, unsigned level ) +LIBCOM_API void epicsEventShow ( epicsEventId id, unsigned level ) { } diff --git a/modules/libcom/src/osi/os/WIN32/osdFindAddr.c b/modules/libcom/src/osi/os/WIN32/osdFindAddr.c index 5172e2638..d9aa09098 100644 --- a/modules/libcom/src/osi/os/WIN32/osdFindAddr.c +++ b/modules/libcom/src/osi/os/WIN32/osdFindAddr.c @@ -6,7 +6,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsStackTracePvt.h" #include "epicsStackTrace.h" #include "epicsString.h" diff --git a/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c b/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c index 5731c8afe..4e8fc59ea 100644 --- a/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c +++ b/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c @@ -18,7 +18,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsStdio.h" #include "epicsFindSymbol.h" @@ -33,7 +32,7 @@ STORE DWORD epicsLoadErrorCode = 0; -epicsShareFunc void * epicsLoadLibrary(const char *name) +LIBCOM_API void * epicsLoadLibrary(const char *name) { HMODULE lib; @@ -43,7 +42,7 @@ epicsShareFunc void * epicsLoadLibrary(const char *name) return lib; } -epicsShareFunc const char *epicsLoadError(void) +LIBCOM_API const char *epicsLoadError(void) { STORE char buffer[100]; DWORD n; @@ -74,7 +73,7 @@ epicsShareFunc const char *epicsLoadError(void) return buffer; } -epicsShareFunc void * epicsShareAPI epicsFindSymbol(const char *name) +LIBCOM_API void * epicsStdCall epicsFindSymbol(const char *name) { HANDLE proc = GetCurrentProcess(); HMODULE *dlls=NULL; diff --git a/modules/libcom/src/osi/os/WIN32/osdMonotonic.c b/modules/libcom/src/osi/os/WIN32/osdMonotonic.c index e7da25da4..b6e4d9773 100644 --- a/modules/libcom/src/osi/os/WIN32/osdMonotonic.c +++ b/modules/libcom/src/osi/os/WIN32/osdMonotonic.c @@ -6,7 +6,6 @@ #include -#define epicsExportSharedSymbols #define EPICS_EXPOSE_LIBCOM_MONOTONIC_PRIVATE #include "dbDefs.h" #include "errlog.h" diff --git a/modules/libcom/src/osi/os/WIN32/osdMutex.c b/modules/libcom/src/osi/os/WIN32/osdMutex.c index 63a51efd5..6bcf1e608 100644 --- a/modules/libcom/src/osi/os/WIN32/osdMutex.c +++ b/modules/libcom/src/osi/os/WIN32/osdMutex.c @@ -42,8 +42,7 @@ #endif #include -#define epicsExportSharedSymbols -#include "shareLib.h" +#include "libComAPI.h" #include "epicsMutex.h" #include "epicsAssert.h" #include "epicsStdio.h" diff --git a/modules/libcom/src/osi/os/WIN32/osdNetIntf.c b/modules/libcom/src/osi/os/WIN32/osdNetIntf.c index db445d494..5f54ad1ad 100644 --- a/modules/libcom/src/osi/os/WIN32/osdNetIntf.c +++ b/modules/libcom/src/osi/os/WIN32/osdNetIntf.c @@ -34,7 +34,6 @@ /* * EPICS */ -#define epicsExportSharedSymbols #include "osiSock.h" #include "errlog.h" #include "epicsThread.h" @@ -122,7 +121,7 @@ fail: free ( pIfinfoList ); } -epicsShareFunc osiSockAddr epicsShareAPI osiLocalAddr (SOCKET socket) +LIBCOM_API osiSockAddr epicsStdCall osiLocalAddr (SOCKET socket) { epicsThreadOnce(&osiLocalAddrId, osiLocalAddrOnce, (void*)&socket); return osiLocalAddrResult; @@ -131,7 +130,7 @@ epicsShareFunc osiSockAddr epicsShareAPI osiLocalAddr (SOCKET socket) /* * osiSockDiscoverBroadcastAddresses () */ -epicsShareFunc void epicsShareAPI osiSockDiscoverBroadcastAddresses +LIBCOM_API void epicsStdCall osiSockDiscoverBroadcastAddresses (ELLLIST *pList, SOCKET socket, const osiSockAddr *pMatchAddr) { int status; diff --git a/modules/libcom/src/osi/os/WIN32/osdPoolStatus.c b/modules/libcom/src/osi/os/WIN32/osdPoolStatus.c index bb764b2ad..d4e756486 100644 --- a/modules/libcom/src/osi/os/WIN32/osdPoolStatus.c +++ b/modules/libcom/src/osi/os/WIN32/osdPoolStatus.c @@ -8,7 +8,6 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -#define epicsExportSharedSymbols #include "osiPoolStatus.h" /* @@ -17,7 +16,7 @@ * @@@@@ not implemented @@@@@ * */ -epicsShareFunc int epicsShareAPI osiSufficentSpaceInPool ( size_t contiguousBlockSize ) +LIBCOM_API int epicsStdCall osiSufficentSpaceInPool ( size_t contiguousBlockSize ) { return 1; } diff --git a/modules/libcom/src/osi/os/WIN32/osdProcess.c b/modules/libcom/src/osi/os/WIN32/osdProcess.c index fbe68ba91..92902315f 100644 --- a/modules/libcom/src/osi/os/WIN32/osdProcess.c +++ b/modules/libcom/src/osi/os/WIN32/osdProcess.c @@ -24,10 +24,9 @@ #define STRICT #include -#define epicsExportSharedSymbols #include "osiProcess.h" -epicsShareFunc osiGetUserNameReturn epicsShareAPI osiGetUserName (char *pBuf, unsigned bufSizeIn) +LIBCOM_API osiGetUserNameReturn epicsStdCall osiGetUserName (char *pBuf, unsigned bufSizeIn) { DWORD bufsize; @@ -48,7 +47,7 @@ epicsShareFunc osiGetUserNameReturn epicsShareAPI osiGetUserName (char *pBuf, un return osiGetUserNameSuccess; } -epicsShareFunc osiSpawnDetachedProcessReturn epicsShareAPI osiSpawnDetachedProcess +LIBCOM_API osiSpawnDetachedProcessReturn epicsStdCall osiSpawnDetachedProcess ( const char *pProcessName, const char *pBaseExecutableName ) { BOOL status; diff --git a/modules/libcom/src/osi/os/WIN32/osdSignal.cpp b/modules/libcom/src/osi/os/WIN32/osdSignal.cpp index 5f799273a..06251118f 100644 --- a/modules/libcom/src/osi/os/WIN32/osdSignal.cpp +++ b/modules/libcom/src/osi/os/WIN32/osdSignal.cpp @@ -8,14 +8,13 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -#define epicsExportSharedSymbols #include "epicsSignal.h" /* * NOOP */ -epicsShareFunc void epicsShareAPI epicsSignalInstallSigHupIgnore ( void ) {} -epicsShareFunc void epicsShareAPI epicsSignalInstallSigPipeIgnore ( void ) {} -epicsShareFunc void epicsShareAPI epicsSignalInstallSigAlarmIgnore ( void ) {} -epicsShareFunc void epicsShareAPI epicsSignalRaiseSigAlarm ( struct epicsThreadOSD * /* threadid */ ) {} +LIBCOM_API void epicsStdCall epicsSignalInstallSigHupIgnore ( void ) {} +LIBCOM_API void epicsStdCall epicsSignalInstallSigPipeIgnore ( void ) {} +LIBCOM_API void epicsStdCall epicsSignalInstallSigAlarmIgnore ( void ) {} +LIBCOM_API void epicsStdCall epicsSignalRaiseSigAlarm ( struct epicsThreadOSD * /* threadid */ ) {} diff --git a/modules/libcom/src/osi/os/WIN32/osdSock.c b/modules/libcom/src/osi/os/WIN32/osdSock.c index b8c8363fb..fd17ea1d1 100644 --- a/modules/libcom/src/osi/os/WIN32/osdSock.c +++ b/modules/libcom/src/osi/os/WIN32/osdSock.c @@ -31,7 +31,6 @@ #define STRICT #include -#define epicsExportSharedSymbols #include "osiSock.h" #include "errlog.h" #include "epicsVersion.h" @@ -39,7 +38,7 @@ static unsigned nAttached = 0; static WSADATA WsaData; /* version of winsock */ -epicsShareFunc unsigned epicsShareAPI wsaMajorVersion () +LIBCOM_API unsigned epicsStdCall wsaMajorVersion () { return (unsigned) LOBYTE( WsaData.wVersion ); } @@ -47,7 +46,7 @@ epicsShareFunc unsigned epicsShareAPI wsaMajorVersion () /* * osiSockAttach() */ -epicsShareFunc int epicsShareAPI osiSockAttach() +LIBCOM_API int epicsStdCall osiSockAttach() { int status; @@ -101,7 +100,7 @@ epicsShareFunc int epicsShareAPI osiSockAttach() /* * osiSockRelease() */ -epicsShareFunc void epicsShareAPI osiSockRelease() +LIBCOM_API void epicsStdCall osiSockRelease() { if (nAttached) { if (--nAttached==0u) { @@ -114,19 +113,19 @@ epicsShareFunc void epicsShareAPI osiSockRelease() } } -epicsShareFunc SOCKET epicsShareAPI epicsSocketCreate ( +LIBCOM_API SOCKET epicsStdCall epicsSocketCreate ( int domain, int type, int protocol ) { return socket ( domain, type, protocol ); } -epicsShareFunc int epicsShareAPI epicsSocketAccept ( +LIBCOM_API int epicsStdCall epicsSocketAccept ( int sock, struct sockaddr * pAddr, osiSocklen_t * addrlen ) { return accept ( sock, pAddr, addrlen ); } -epicsShareFunc void epicsShareAPI epicsSocketDestroy ( SOCKET s ) +LIBCOM_API void epicsStdCall epicsSocketDestroy ( SOCKET s ) { int status = closesocket ( s ); if ( status < 0 ) { @@ -141,7 +140,7 @@ epicsShareFunc void epicsShareAPI epicsSocketDestroy ( SOCKET s ) /* * ipAddrToHostName */ -epicsShareFunc unsigned epicsShareAPI ipAddrToHostName +LIBCOM_API unsigned epicsStdCall ipAddrToHostName (const struct in_addr *pAddr, char *pBuf, unsigned bufSize) { struct hostent *ent; @@ -162,7 +161,7 @@ epicsShareFunc unsigned epicsShareAPI ipAddrToHostName /* * hostToIPAddr () */ -epicsShareFunc int epicsShareAPI hostToIPAddr +LIBCOM_API int epicsStdCall hostToIPAddr (const char *pHostName, struct in_addr *pIPA) { struct hostent *phe; diff --git a/modules/libcom/src/osi/os/WIN32/osdSock.h b/modules/libcom/src/osi/os/WIN32/osdSock.h index d0549bfad..f00c39e69 100644 --- a/modules/libcom/src/osi/os/WIN32/osdSock.h +++ b/modules/libcom/src/osi/os/WIN32/osdSock.h @@ -79,7 +79,7 @@ typedef DWORD osiSockOptMcastTTL_t; extern "C" { #endif -epicsShareFunc unsigned epicsShareAPI wsaMajorVersion (); +LIBCOM_API unsigned epicsStdCall wsaMajorVersion (); #ifdef __cplusplus } diff --git a/modules/libcom/src/osi/os/WIN32/osdSockUnsentCount.c b/modules/libcom/src/osi/os/WIN32/osdSockUnsentCount.c index 3f4ab3eee..528dbe398 100644 --- a/modules/libcom/src/osi/os/WIN32/osdSockUnsentCount.c +++ b/modules/libcom/src/osi/os/WIN32/osdSockUnsentCount.c @@ -3,7 +3,6 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -#define epicsExportSharedSymbols #define EPICS_PRIVATE_API #include "osiSock.h" #include diff --git a/modules/libcom/src/osi/os/WIN32/osdStdio.c b/modules/libcom/src/osi/os/WIN32/osdStdio.c index 8a2d58ea9..90bbc3459 100644 --- a/modules/libcom/src/osi/os/WIN32/osdStdio.c +++ b/modules/libcom/src/osi/os/WIN32/osdStdio.c @@ -16,10 +16,9 @@ _CRTIMP int __cdecl __MINGW_NOTHROW _vscprintf (const char*, va_list); #endif -#define epicsExportSharedSymbols #include "epicsStdio.h" -int epicsShareAPI epicsVsnprintf(char *str, size_t len, +int epicsStdCall epicsVsnprintf(char *str, size_t len, const char *fmt, va_list ap) { int retval = _vsnprintf(str, len, fmt, ap); @@ -33,7 +32,7 @@ int epicsShareAPI epicsVsnprintf(char *str, size_t len, return retval; } -int epicsShareAPI epicsSnprintf (char *str, size_t len, const char *fmt, ...) +int epicsStdCall epicsSnprintf (char *str, size_t len, const char *fmt, ...) { int rtn; va_list pvar; diff --git a/modules/libcom/src/osi/os/WIN32/osdStrtod.h b/modules/libcom/src/osi/os/WIN32/osdStrtod.h index 4edb444ee..48f8f4a04 100644 --- a/modules/libcom/src/osi/os/WIN32/osdStrtod.h +++ b/modules/libcom/src/osi/os/WIN32/osdStrtod.h @@ -16,7 +16,7 @@ extern "C" { /* * epicsStrtod() for systems with broken strtod() routine */ -epicsShareFunc double epicsStrtod(const char *str, char **endp); +LIBCOM_API double epicsStrtod(const char *str, char **endp); /* * Microsoft apparently added strto[u]ll() in VS2013 diff --git a/modules/libcom/src/osi/os/WIN32/osdThread.c b/modules/libcom/src/osi/os/WIN32/osdThread.c index 455d97b64..be59a45a8 100644 --- a/modules/libcom/src/osi/os/WIN32/osdThread.c +++ b/modules/libcom/src/osi/os/WIN32/osdThread.c @@ -24,9 +24,8 @@ #include #include /* for _endthread() etc */ -#define epicsExportSharedSymbols #include "epicsStdio.h" -#include "shareLib.h" +#include "libComAPI.h" #include "epicsThread.h" #include "cantProceed.h" #include "epicsAssert.h" @@ -34,7 +33,7 @@ #include "epicsExit.h" #include "epicsAtomic.h" -epicsShareFunc void osdThreadHooksRun(epicsThreadId id); +LIBCOM_API void osdThreadHooksRun(epicsThreadId id); void setThreadName ( DWORD dwThreadID, LPCSTR szThreadName ); @@ -247,7 +246,7 @@ static void epicsParmCleanupWIN32 ( win32ThreadParam * pParm ) /* * epicsThreadExitMain () */ -epicsShareFunc void epicsShareAPI epicsThreadExitMain ( void ) +LIBCOM_API void epicsStdCall epicsThreadExitMain ( void ) { _endthread (); } @@ -275,7 +274,7 @@ static unsigned osdPriorityMagFromPriorityOSI ( unsigned osiPriority, unsigned p return magnitude; } -epicsShareFunc +LIBCOM_API void epicsThreadRealtimeLock(void) {} @@ -357,7 +356,7 @@ static unsigned epicsThreadGetOsiPriorityValue ( int osdPriority ) /* * epicsThreadLowestPriorityLevelAbove () */ -epicsShareFunc epicsThreadBooleanStatus epicsShareAPI epicsThreadLowestPriorityLevelAbove +LIBCOM_API epicsThreadBooleanStatus epicsStdCall epicsThreadLowestPriorityLevelAbove ( unsigned int priority, unsigned * pPriorityJustAbove ) { const DWORD priorityClass = GetPriorityClass ( GetCurrentProcess () ); @@ -387,7 +386,7 @@ epicsShareFunc epicsThreadBooleanStatus epicsShareAPI epicsThreadLowestPriorityL /* * epicsThreadHighestPriorityLevelBelow () */ -epicsShareFunc epicsThreadBooleanStatus epicsShareAPI epicsThreadHighestPriorityLevelBelow +LIBCOM_API epicsThreadBooleanStatus epicsStdCall epicsThreadHighestPriorityLevelBelow ( unsigned int priority, unsigned * pPriorityJustBelow ) { const DWORD priorityClass = GetPriorityClass ( GetCurrentProcess () ); @@ -417,7 +416,7 @@ epicsShareFunc epicsThreadBooleanStatus epicsShareAPI epicsThreadHighestPriority /* * epicsThreadGetStackSize () */ -epicsShareFunc unsigned int epicsShareAPI +LIBCOM_API unsigned int epicsStdCall epicsThreadGetStackSize ( epicsThreadStackSizeClass stackSizeClass ) { #define STACK_SIZE(f) (f * 0x10000 * sizeof(void *)) @@ -656,7 +655,7 @@ void epicsThreadMustJoin(epicsThreadId id) /* * epicsThreadSuspendSelf () */ -epicsShareFunc void epicsShareAPI epicsThreadSuspendSelf () +LIBCOM_API void epicsStdCall epicsThreadSuspendSelf () { win32ThreadGlobal * pGbl = fetchWin32ThreadGlobal (); win32ThreadParam * pParm; @@ -681,7 +680,7 @@ epicsShareFunc void epicsShareAPI epicsThreadSuspendSelf () /* * epicsThreadResume () */ -epicsShareFunc void epicsShareAPI epicsThreadResume ( epicsThreadId id ) +LIBCOM_API void epicsStdCall epicsThreadResume ( epicsThreadId id ) { win32ThreadGlobal * pGbl = fetchWin32ThreadGlobal (); win32ThreadParam * pParm = ( win32ThreadParam * ) id; @@ -702,7 +701,7 @@ epicsShareFunc void epicsShareAPI epicsThreadResume ( epicsThreadId id ) /* * epicsThreadGetPriority () */ -epicsShareFunc unsigned epicsShareAPI epicsThreadGetPriority (epicsThreadId id) +LIBCOM_API unsigned epicsStdCall epicsThreadGetPriority (epicsThreadId id) { win32ThreadParam * pParm = ( win32ThreadParam * ) id; return pParm->epicsPriority; @@ -711,7 +710,7 @@ epicsShareFunc unsigned epicsShareAPI epicsThreadGetPriority (epicsThreadId id) /* * epicsThreadGetPrioritySelf () */ -epicsShareFunc unsigned epicsShareAPI epicsThreadGetPrioritySelf () +LIBCOM_API unsigned epicsStdCall epicsThreadGetPrioritySelf () { win32ThreadGlobal * pGbl = fetchWin32ThreadGlobal (); win32ThreadParam * pParm; @@ -737,7 +736,7 @@ epicsShareFunc unsigned epicsShareAPI epicsThreadGetPrioritySelf () /* * epicsThreadSetPriority () */ -epicsShareFunc void epicsShareAPI epicsThreadSetPriority ( epicsThreadId id, unsigned priority ) +LIBCOM_API void epicsStdCall epicsThreadSetPriority ( epicsThreadId id, unsigned priority ) { win32ThreadParam * pParm = ( win32ThreadParam * ) id; BOOL stat = SetThreadPriority ( pParm->handle, epicsThreadGetOsdPriorityValue (priority) ); @@ -747,7 +746,7 @@ epicsShareFunc void epicsShareAPI epicsThreadSetPriority ( epicsThreadId id, uns /* * epicsThreadIsEqual () */ -epicsShareFunc int epicsShareAPI epicsThreadIsEqual ( epicsThreadId id1, epicsThreadId id2 ) +LIBCOM_API int epicsStdCall epicsThreadIsEqual ( epicsThreadId id1, epicsThreadId id2 ) { win32ThreadParam * pParm1 = ( win32ThreadParam * ) id1; win32ThreadParam * pParm2 = ( win32ThreadParam * ) id2; @@ -757,7 +756,7 @@ epicsShareFunc int epicsShareAPI epicsThreadIsEqual ( epicsThreadId id1, epicsTh /* * epicsThreadIsSuspended () */ -epicsShareFunc int epicsShareAPI epicsThreadIsSuspended ( epicsThreadId id ) +LIBCOM_API int epicsStdCall epicsThreadIsSuspended ( epicsThreadId id ) { win32ThreadParam *pParm = ( win32ThreadParam * ) id; DWORD exitCode; @@ -780,7 +779,7 @@ epicsShareFunc int epicsShareAPI epicsThreadIsSuspended ( epicsThreadId id ) /* * epicsThreadSleep () */ -epicsShareFunc void epicsShareAPI epicsThreadSleep ( double seconds ) +LIBCOM_API void epicsStdCall epicsThreadSleep ( double seconds ) { static const unsigned mSecPerSec = 1000; DWORD milliSecDelay; @@ -800,7 +799,7 @@ epicsShareFunc void epicsShareAPI epicsThreadSleep ( double seconds ) /* * epicsThreadSleepQuantum () */ -double epicsShareAPI epicsThreadSleepQuantum () +double epicsStdCall epicsThreadSleepQuantum () { /* * Its worth noting here that the sleep quantum on windows can @@ -832,7 +831,7 @@ double epicsShareAPI epicsThreadSleepQuantum () /* * epicsThreadGetIdSelf () */ -epicsShareFunc epicsThreadId epicsShareAPI epicsThreadGetIdSelf (void) +LIBCOM_API epicsThreadId epicsStdCall epicsThreadGetIdSelf (void) { win32ThreadGlobal * pGbl = fetchWin32ThreadGlobal (); win32ThreadParam * pParm; @@ -848,7 +847,7 @@ epicsShareFunc epicsThreadId epicsShareAPI epicsThreadGetIdSelf (void) return ( epicsThreadId ) pParm; } -epicsShareFunc epicsThreadId epicsShareAPI epicsThreadGetId ( const char * pName ) +LIBCOM_API epicsThreadId epicsStdCall epicsThreadGetId ( const char * pName ) { win32ThreadGlobal * pGbl = fetchWin32ThreadGlobal (); win32ThreadParam * pParm; @@ -879,7 +878,7 @@ epicsShareFunc epicsThreadId epicsShareAPI epicsThreadGetId ( const char * pName /* * epicsThreadGetNameSelf () */ -epicsShareFunc const char * epicsShareAPI epicsThreadGetNameSelf (void) +LIBCOM_API const char * epicsStdCall epicsThreadGetNameSelf (void) { win32ThreadGlobal * pGbl = fetchWin32ThreadGlobal (); win32ThreadParam * pParm; @@ -905,7 +904,7 @@ epicsShareFunc const char * epicsShareAPI epicsThreadGetNameSelf (void) /* * epicsThreadGetName () */ -epicsShareFunc void epicsShareAPI epicsThreadGetName ( +LIBCOM_API void epicsStdCall epicsThreadGetName ( epicsThreadId id, char * pName, size_t size ) { win32ThreadParam * pParm = ( win32ThreadParam * ) id; @@ -980,7 +979,7 @@ static void epicsThreadShowInfo ( epicsThreadId id, unsigned level ) /* * epicsThreadMap () */ -epicsShareFunc void epicsThreadMap ( EPICS_THREAD_HOOK_ROUTINE func ) +LIBCOM_API void epicsThreadMap ( EPICS_THREAD_HOOK_ROUTINE func ) { win32ThreadGlobal * pGbl = fetchWin32ThreadGlobal (); win32ThreadParam * pParm; @@ -1002,7 +1001,7 @@ epicsShareFunc void epicsThreadMap ( EPICS_THREAD_HOOK_ROUTINE func ) /* * epicsThreadShowAll () */ -epicsShareFunc void epicsShareAPI epicsThreadShowAll ( unsigned level ) +LIBCOM_API void epicsStdCall epicsThreadShowAll ( unsigned level ) { win32ThreadGlobal * pGbl = fetchWin32ThreadGlobal (); win32ThreadParam * pParm; @@ -1025,7 +1024,7 @@ epicsShareFunc void epicsShareAPI epicsThreadShowAll ( unsigned level ) /* * epicsThreadShow () */ -epicsShareFunc void epicsShareAPI epicsThreadShow ( epicsThreadId id, unsigned level ) +LIBCOM_API void epicsStdCall epicsThreadShow ( epicsThreadId id, unsigned level ) { epicsThreadShowInfo ( 0, level ); epicsThreadShowInfo ( id, level ); @@ -1034,7 +1033,7 @@ epicsShareFunc void epicsShareAPI epicsThreadShow ( epicsThreadId id, unsigned l /* * epicsThreadOnce () */ -epicsShareFunc void epicsShareAPI epicsThreadOnce ( +LIBCOM_API void epicsStdCall epicsThreadOnce ( epicsThreadOnceId *id, void (*func)(void *), void *arg ) { static struct epicsThreadOSD threadOnceComplete; @@ -1069,7 +1068,7 @@ epicsShareFunc void epicsShareAPI epicsThreadOnce ( /* * epicsThreadPrivateCreate () */ -epicsShareFunc epicsThreadPrivateId epicsShareAPI epicsThreadPrivateCreate () +LIBCOM_API epicsThreadPrivateId epicsStdCall epicsThreadPrivateCreate () { epicsThreadPrivateOSD *p = ( epicsThreadPrivateOSD * ) malloc ( sizeof ( *p ) ); if ( p ) { @@ -1085,7 +1084,7 @@ epicsShareFunc epicsThreadPrivateId epicsShareAPI epicsThreadPrivateCreate () /* * epicsThreadPrivateDelete () */ -epicsShareFunc void epicsShareAPI epicsThreadPrivateDelete ( epicsThreadPrivateId p ) +LIBCOM_API void epicsStdCall epicsThreadPrivateDelete ( epicsThreadPrivateId p ) { BOOL stat = TlsFree ( p->key ); assert ( stat ); @@ -1095,7 +1094,7 @@ epicsShareFunc void epicsShareAPI epicsThreadPrivateDelete ( epicsThreadPrivateI /* * epicsThreadPrivateSet () */ -epicsShareFunc void epicsShareAPI epicsThreadPrivateSet ( epicsThreadPrivateId pPvt, void *pVal ) +LIBCOM_API void epicsStdCall epicsThreadPrivateSet ( epicsThreadPrivateId pPvt, void *pVal ) { BOOL stat = TlsSetValue ( pPvt->key, (void *) pVal ); assert (stat); @@ -1104,7 +1103,7 @@ epicsShareFunc void epicsShareAPI epicsThreadPrivateSet ( epicsThreadPrivateId p /* * epicsThreadPrivateGet () */ -epicsShareFunc void * epicsShareAPI epicsThreadPrivateGet ( epicsThreadPrivateId pPvt ) +LIBCOM_API void * epicsStdCall epicsThreadPrivateGet ( epicsThreadPrivateId pPvt ) { return ( void * ) TlsGetValue ( pPvt->key ); } @@ -1112,7 +1111,7 @@ epicsShareFunc void * epicsShareAPI epicsThreadPrivateGet ( epicsThreadPrivateId /* * epicsThreadGetCPUs () */ -epicsShareFunc int epicsThreadGetCPUs ( void ) +LIBCOM_API int epicsThreadGetCPUs ( void ) { SYSTEM_INFO sysinfo; GetSystemInfo(&sysinfo); diff --git a/modules/libcom/src/osi/os/WIN32/osdThreadExtra.c b/modules/libcom/src/osi/os/WIN32/osdThreadExtra.c index 0a7c7ae95..f4562802e 100644 --- a/modules/libcom/src/osi/os/WIN32/osdThreadExtra.c +++ b/modules/libcom/src/osi/os/WIN32/osdThreadExtra.c @@ -9,8 +9,7 @@ /* Null default thread hooks for all platforms that do not do anything special */ -#define epicsExportSharedSymbols #include "epicsThread.h" -epicsShareDef EPICS_THREAD_HOOK_ROUTINE epicsThreadHookDefault; -epicsShareDef EPICS_THREAD_HOOK_ROUTINE epicsThreadHookMain; +EPICS_THREAD_HOOK_ROUTINE epicsThreadHookDefault; +EPICS_THREAD_HOOK_ROUTINE epicsThreadHookMain; diff --git a/modules/libcom/src/osi/os/WIN32/osdTime.cpp b/modules/libcom/src/osi/os/WIN32/osdTime.cpp index 1b1a70548..518b90b82 100644 --- a/modules/libcom/src/osi/os/WIN32/osdTime.cpp +++ b/modules/libcom/src/osi/os/WIN32/osdTime.cpp @@ -30,7 +30,6 @@ // // EPICS // -#define epicsExportSharedSymbols #define EPICS_EXPOSE_LIBCOM_MONOTONIC_PRIVATE #include "epicsTime.h" #include "generalTimeSup.h" @@ -126,7 +125,7 @@ int osdTimeGetCurrent ( epicsTimeStamp *pDest ) } // synthesize a reentrant gmtime on WIN32 -int epicsShareAPI epicsTime_gmtime ( const time_t *pAnsiTime, struct tm *pTM ) +int epicsStdCall epicsTime_gmtime ( const time_t *pAnsiTime, struct tm *pTM ) { struct tm * pRet = gmtime ( pAnsiTime ); if ( pRet ) { @@ -139,7 +138,7 @@ int epicsShareAPI epicsTime_gmtime ( const time_t *pAnsiTime, struct tm *pTM ) } // synthesize a reentrant localtime on WIN32 -int epicsShareAPI epicsTime_localtime ( +int epicsStdCall epicsTime_localtime ( const time_t * pAnsiTime, struct tm * pTM ) { struct tm * pRet = localtime ( pAnsiTime ); diff --git a/modules/libcom/src/osi/os/WIN32/osdgetexec.c b/modules/libcom/src/osi/os/WIN32/osdgetexec.c index a46ce50cd..a5c07b003 100644 --- a/modules/libcom/src/osi/os/WIN32/osdgetexec.c +++ b/modules/libcom/src/osi/os/WIN32/osdgetexec.c @@ -3,7 +3,6 @@ #include #include -#define epicsExportSharedSymbols #include char *epicsGetExecName(void) diff --git a/modules/libcom/src/osi/os/WIN32/osiFileName.h b/modules/libcom/src/osi/os/WIN32/osiFileName.h index bba2d55c1..02e99cc9f 100644 --- a/modules/libcom/src/osi/os/WIN32/osiFileName.h +++ b/modules/libcom/src/osi/os/WIN32/osiFileName.h @@ -15,7 +15,7 @@ #ifndef osiFileNameH #define osiFileNameH -#include +#include #ifdef __cplusplus extern "C" { @@ -27,13 +27,13 @@ extern "C" { /** Return the absolute path of the current executable. * \return NULL or the path. Caller must free() */ -epicsShareFunc +LIBCOM_API char *epicsGetExecName(void); /** Return the absolute path of the directory containing the current executable. * \return NULL or the path. Caller must free() */ -epicsShareFunc +LIBCOM_API char *epicsGetExecDir(void); #ifdef __cplusplus diff --git a/modules/libcom/src/osi/os/WIN32/systemCallIntMech.cpp b/modules/libcom/src/osi/os/WIN32/systemCallIntMech.cpp index 5e13299c0..7da39164b 100644 --- a/modules/libcom/src/osi/os/WIN32/systemCallIntMech.cpp +++ b/modules/libcom/src/osi/os/WIN32/systemCallIntMech.cpp @@ -12,7 +12,6 @@ * Author: Jeff Hill */ -#define epicsExportSharedSymbols #include "osiSock.h" enum epicsSocketSystemCallInterruptMechanismQueryInfo diff --git a/modules/libcom/src/osi/os/cygwin32/devLibVMEOSD.c b/modules/libcom/src/osi/os/cygwin32/devLibVMEOSD.c index 53cbd58cd..17a1c14c2 100644 --- a/modules/libcom/src/osi/os/cygwin32/devLibVMEOSD.c +++ b/modules/libcom/src/osi/os/cygwin32/devLibVMEOSD.c @@ -7,7 +7,6 @@ #include -#define epicsExportSharedSymbols #include "devLibVME.h" -epicsShareDef devLibVME *pdevLibVME = NULL; +devLibVME *pdevLibVME = NULL; diff --git a/modules/libcom/src/osi/os/cygwin32/osdStrtod.h b/modules/libcom/src/osi/os/cygwin32/osdStrtod.h index b5fda31c3..395cacdc2 100644 --- a/modules/libcom/src/osi/os/cygwin32/osdStrtod.h +++ b/modules/libcom/src/osi/os/cygwin32/osdStrtod.h @@ -16,7 +16,7 @@ extern "C" { /* * epicsStrtod() for systems with broken strtod() routine */ -epicsShareFunc double epicsStrtod(const char *str, char **endp); +LIBCOM_API double epicsStrtod(const char *str, char **endp); #ifdef __cplusplus } diff --git a/modules/libcom/src/osi/os/cygwin32/osiFileName.h b/modules/libcom/src/osi/os/cygwin32/osiFileName.h index 76562f3e4..88b3cddbd 100644 --- a/modules/libcom/src/osi/os/cygwin32/osiFileName.h +++ b/modules/libcom/src/osi/os/cygwin32/osiFileName.h @@ -14,7 +14,7 @@ #ifndef osiFileNameH #define osiFileNameH -#include +#include #ifdef __cplusplus extern "C" { @@ -26,13 +26,13 @@ extern "C" { /** Return the absolute path of the current executable. \return NULL or the path. Caller must free() */ -epicsShareFunc +LIBCOM_API char *epicsGetExecName(void); /** Return the absolute path of the directory containing the current executable. \return NULL or the path. Caller must free() */ -epicsShareFunc +LIBCOM_API char *epicsGetExecDir(void); #ifdef __cplusplus diff --git a/modules/libcom/src/osi/os/cygwin32/systemCallIntMech.cpp b/modules/libcom/src/osi/os/cygwin32/systemCallIntMech.cpp index 9c0df3293..dbcb14dbb 100644 --- a/modules/libcom/src/osi/os/cygwin32/systemCallIntMech.cpp +++ b/modules/libcom/src/osi/os/cygwin32/systemCallIntMech.cpp @@ -12,7 +12,6 @@ #include -#define epicsExportSharedSymbols #include "osiSock.h" enum epicsSocketSystemCallInterruptMechanismQueryInfo diff --git a/modules/libcom/src/osi/os/default/devLibVMEOSD.c b/modules/libcom/src/osi/os/default/devLibVMEOSD.c index b8b1d5047..0de29f2e4 100644 --- a/modules/libcom/src/osi/os/default/devLibVMEOSD.c +++ b/modules/libcom/src/osi/os/default/devLibVMEOSD.c @@ -7,9 +7,8 @@ #include -#define epicsExportSharedSymbols #include "devLibVME.h" /* This file must contain no definitions other than the following: */ -epicsShareDef devLibVME *pdevLibVME; +devLibVME *pdevLibVME; diff --git a/modules/libcom/src/osi/os/default/epicsMMIODef.h b/modules/libcom/src/osi/os/default/epicsMMIODef.h index 114a67c6e..0b0f219ae 100644 --- a/modules/libcom/src/osi/os/default/epicsMMIODef.h +++ b/modules/libcom/src/osi/os/default/epicsMMIODef.h @@ -20,7 +20,7 @@ #include #include #include -#include +#include #ifdef __cplusplus # ifndef INLINE diff --git a/modules/libcom/src/osi/os/default/epicsSocketConvertErrnoToString.cpp b/modules/libcom/src/osi/os/default/epicsSocketConvertErrnoToString.cpp index 3cbfce60d..062560f59 100644 --- a/modules/libcom/src/osi/os/default/epicsSocketConvertErrnoToString.cpp +++ b/modules/libcom/src/osi/os/default/epicsSocketConvertErrnoToString.cpp @@ -15,7 +15,6 @@ #include -#define epicsExportSharedSymbols #include "osiSock.h" /* diff --git a/modules/libcom/src/osi/os/default/osdAssert.c b/modules/libcom/src/osi/os/default/osdAssert.c index 14d548c3d..109ec983d 100644 --- a/modules/libcom/src/osi/os/default/osdAssert.c +++ b/modules/libcom/src/osi/os/default/osdAssert.c @@ -11,7 +11,6 @@ * Date: 02-27-95 */ -#define epicsExportSharedSymbols #include "dbDefs.h" #include "epicsPrint.h" #include "epicsVersion.h" diff --git a/modules/libcom/src/osi/os/default/osdBackTrace.cpp b/modules/libcom/src/osi/os/default/osdBackTrace.cpp index e1f96c033..0a2fdfcfe 100644 --- a/modules/libcom/src/osi/os/default/osdBackTrace.cpp +++ b/modules/libcom/src/osi/os/default/osdBackTrace.cpp @@ -7,7 +7,6 @@ * Author: Till Straumann , 2011, 2014 */ -#define epicsExportSharedSymbols #include "epicsStackTracePvt.h" int epicsBackTrace(void **buf, int buf_sz) diff --git a/modules/libcom/src/osi/os/default/osdEnv.c b/modules/libcom/src/osi/os/default/osdEnv.c index b74856dbf..e4495dbd1 100644 --- a/modules/libcom/src/osi/os/default/osdEnv.c +++ b/modules/libcom/src/osi/os/default/osdEnv.c @@ -18,7 +18,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsStdio.h" #include "errlog.h" #include "cantProceed.h" @@ -32,7 +31,7 @@ * Leaks memory, but the assumption is that this routine won't be * called often enough for the leak to be a problem. */ -epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *value) +LIBCOM_API void epicsStdCall epicsEnvSet (const char *name, const char *value) { char *cp; @@ -61,7 +60,7 @@ epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *val * Using putenv with a an existing name but without "=..." deletes */ -epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name) +LIBCOM_API void epicsStdCall epicsEnvUnset (const char *name) { iocshEnvClear(name); if (getenv(name) != NULL) @@ -71,7 +70,7 @@ epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name) /* * Show the value of the specified, or all, environment variables */ -epicsShareFunc void epicsShareAPI epicsEnvShow (const char *name) +LIBCOM_API void epicsStdCall epicsEnvShow (const char *name) { if (name == NULL) { extern char **environ; diff --git a/modules/libcom/src/osi/os/default/osdFindAddr.c b/modules/libcom/src/osi/os/default/osdFindAddr.c index 582dd5442..9f3089ee3 100644 --- a/modules/libcom/src/osi/os/default/osdFindAddr.c +++ b/modules/libcom/src/osi/os/default/osdFindAddr.c @@ -7,7 +7,6 @@ * Author: Till Straumann , 2011, 2014 */ -#define epicsExportSharedSymbols #include "epicsStackTracePvt.h" #include "epicsStackTrace.h" diff --git a/modules/libcom/src/osi/os/default/osdFindSymbol.c b/modules/libcom/src/osi/os/default/osdFindSymbol.c index 9d9a8878c..81dcacb52 100644 --- a/modules/libcom/src/osi/os/default/osdFindSymbol.c +++ b/modules/libcom/src/osi/os/default/osdFindSymbol.c @@ -8,20 +8,19 @@ \*************************************************************************/ /* osi/os/default/osdFindSymbol.c */ -#define epicsExportSharedSymbols #include "epicsFindSymbol.h" -epicsShareFunc void * epicsLoadLibrary(const char *name) +LIBCOM_API void * epicsLoadLibrary(const char *name) { return 0; } -epicsShareFunc const char *epicsLoadError(void) +LIBCOM_API const char *epicsLoadError(void) { return "epicsLoadLibrary not implemented"; } -epicsShareFunc void * epicsShareAPI epicsFindSymbol(const char *name) +LIBCOM_API void * epicsStdCall epicsFindSymbol(const char *name) { return 0; } diff --git a/modules/libcom/src/osi/os/default/osdInterrupt.c b/modules/libcom/src/osi/os/default/osdInterrupt.c index 91c5c5681..2aec723dd 100644 --- a/modules/libcom/src/osi/os/default/osdInterrupt.c +++ b/modules/libcom/src/osi/os/default/osdInterrupt.c @@ -16,7 +16,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsMutex.h" #include "epicsThread.h" #include "cantProceed.h" @@ -32,26 +31,26 @@ static void initOnce(void *junk) globalLock = epicsMutexMustCreate(); } -epicsShareFunc int epicsInterruptLock() +LIBCOM_API int epicsInterruptLock() { epicsThreadOnce(&onceId, initOnce, NULL); epicsMutexMustLock(globalLock); return 0; } -epicsShareFunc void epicsInterruptUnlock(int key) +LIBCOM_API void epicsInterruptUnlock(int key) { if (!globalLock) cantProceed("epicsInterruptUnlock called before epicsInterruptLock\n"); epicsMutexUnlock(globalLock); } -epicsShareFunc int epicsInterruptIsInterruptContext() +LIBCOM_API int epicsInterruptIsInterruptContext() { return 0; } -epicsShareFunc void epicsInterruptContextMessage(const char *message) +LIBCOM_API void epicsInterruptContextMessage(const char *message) { errlogPrintf("%s", message); } diff --git a/modules/libcom/src/osi/os/default/osdMessageQueue.cpp b/modules/libcom/src/osi/os/default/osdMessageQueue.cpp index 9567c1f09..94491fa8b 100644 --- a/modules/libcom/src/osi/os/default/osdMessageQueue.cpp +++ b/modules/libcom/src/osi/os/default/osdMessageQueue.cpp @@ -19,7 +19,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsMessageQueue.h" #include #include @@ -68,7 +67,7 @@ struct epicsMessageQueueOSD { bool full; }; -epicsShareFunc epicsMessageQueueId epicsShareAPI epicsMessageQueueCreate( +LIBCOM_API epicsMessageQueueId epicsStdCall epicsMessageQueueCreate( unsigned int capacity, unsigned int maxMessageSize) { @@ -115,7 +114,7 @@ freeEventNode(struct eventNode *enode) free(enode); } -epicsShareFunc void epicsShareAPI +LIBCOM_API void epicsStdCall epicsMessageQueueDestroy(epicsMessageQueueId pmsg) { struct eventNode *evp; @@ -241,21 +240,21 @@ mySend(epicsMessageQueueId pmsg, void *message, unsigned int size, return 0; } -epicsShareFunc int epicsShareAPI +LIBCOM_API int epicsStdCall epicsMessageQueueTrySend(epicsMessageQueueId pmsg, void *message, unsigned int size) { return mySend(pmsg, message, size, 0); } -epicsShareFunc int epicsShareAPI +LIBCOM_API int epicsStdCall epicsMessageQueueSend(epicsMessageQueueId pmsg, void *message, unsigned int size) { return mySend(pmsg, message, size, -1); } -epicsShareFunc int epicsShareAPI +LIBCOM_API int epicsStdCall epicsMessageQueueSendWithTimeout(epicsMessageQueueId pmsg, void *message, unsigned int size, double timeout) { @@ -356,28 +355,28 @@ myReceive(epicsMessageQueueId pmsg, void *message, unsigned int size, return -1; } -epicsShareFunc int epicsShareAPI +LIBCOM_API int epicsStdCall epicsMessageQueueTryReceive(epicsMessageQueueId pmsg, void *message, unsigned int size) { return myReceive(pmsg, message, size, 0); } -epicsShareFunc int epicsShareAPI +LIBCOM_API int epicsStdCall epicsMessageQueueReceive(epicsMessageQueueId pmsg, void *message, unsigned int size) { return myReceive(pmsg, message, size, -1); } -epicsShareFunc int epicsShareAPI +LIBCOM_API int epicsStdCall epicsMessageQueueReceiveWithTimeout(epicsMessageQueueId pmsg, void *message, unsigned int size, double timeout) { return myReceive(pmsg, message, size, timeout); } -epicsShareFunc int epicsShareAPI +LIBCOM_API int epicsStdCall epicsMessageQueuePending(epicsMessageQueueId pmsg) { char *myInPtr, *myOutPtr; @@ -396,7 +395,7 @@ epicsMessageQueuePending(epicsMessageQueueId pmsg) return nmsg; } -epicsShareFunc void epicsShareAPI +LIBCOM_API void epicsStdCall epicsMessageQueueShow(epicsMessageQueueId pmsg, int level) { printf("Message Queue Used:%d Slots:%lu", epicsMessageQueuePending(pmsg), pmsg->capacity); diff --git a/modules/libcom/src/osi/os/default/osdNetIntf.c b/modules/libcom/src/osi/os/default/osdNetIntf.c index 62247bc5d..3ba3c0b47 100644 --- a/modules/libcom/src/osi/os/default/osdNetIntf.c +++ b/modules/libcom/src/osi/os/default/osdNetIntf.c @@ -18,7 +18,6 @@ #include #include -#define epicsExportSharedSymbols #include "osiSock.h" #include "epicsAssert.h" #include "errlog.h" @@ -65,7 +64,7 @@ static struct ifreq * ifreqNext ( struct ifreq *pifreq ) /* * osiSockDiscoverBroadcastAddresses () */ -epicsShareFunc void epicsShareAPI osiSockDiscoverBroadcastAddresses +LIBCOM_API void epicsStdCall osiSockDiscoverBroadcastAddresses (ELLLIST *pList, SOCKET socket, const osiSockAddr *pMatchAddr) { static const unsigned nelem = 100; @@ -345,7 +344,7 @@ fail: } -epicsShareFunc osiSockAddr epicsShareAPI osiLocalAddr (SOCKET socket) +LIBCOM_API osiSockAddr epicsStdCall osiLocalAddr (SOCKET socket) { epicsThreadOnce(&osiLocalAddrId, osiLocalAddrOnce, &socket); return osiLocalAddrResult; diff --git a/modules/libcom/src/osi/os/default/osdPoolStatus.c b/modules/libcom/src/osi/os/default/osdPoolStatus.c index bb764b2ad..d4e756486 100644 --- a/modules/libcom/src/osi/os/default/osdPoolStatus.c +++ b/modules/libcom/src/osi/os/default/osdPoolStatus.c @@ -8,7 +8,6 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -#define epicsExportSharedSymbols #include "osiPoolStatus.h" /* @@ -17,7 +16,7 @@ * @@@@@ not implemented @@@@@ * */ -epicsShareFunc int epicsShareAPI osiSufficentSpaceInPool ( size_t contiguousBlockSize ) +LIBCOM_API int epicsStdCall osiSufficentSpaceInPool ( size_t contiguousBlockSize ) { return 1; } diff --git a/modules/libcom/src/osi/os/default/osdSignal.cpp b/modules/libcom/src/osi/os/default/osdSignal.cpp index 08dfa023c..cf234da0e 100644 --- a/modules/libcom/src/osi/os/default/osdSignal.cpp +++ b/modules/libcom/src/osi/os/default/osdSignal.cpp @@ -8,14 +8,13 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -#define epicsExportSharedSymbols #include "epicsSignal.h" /* * All NOOPs if the os isnt POSIX */ -epicsShareFunc void epicsShareAPI epicsSignalInstallSigHupIgnore ( void ) {} -epicsShareFunc void epicsShareAPI epicsSignalInstallSigPipeIgnore ( void ) {} -epicsShareFunc void epicsShareAPI epicsSignalInstallSigAlarmIgnore ( void ) {} -epicsShareFunc void epicsShareAPI epicsSignalRaiseSigAlarm ( struct epicsThreadOSD * /* threadId */ ) {} +LIBCOM_API void epicsStdCall epicsSignalInstallSigHupIgnore ( void ) {} +LIBCOM_API void epicsStdCall epicsSignalInstallSigPipeIgnore ( void ) {} +LIBCOM_API void epicsStdCall epicsSignalInstallSigAlarmIgnore ( void ) {} +LIBCOM_API void epicsStdCall epicsSignalRaiseSigAlarm ( struct epicsThreadOSD * /* threadId */ ) {} diff --git a/modules/libcom/src/osi/os/default/osdSockAddrReuse.cpp b/modules/libcom/src/osi/os/default/osdSockAddrReuse.cpp index 98ac3d098..8a39a5a3c 100644 --- a/modules/libcom/src/osi/os/default/osdSockAddrReuse.cpp +++ b/modules/libcom/src/osi/os/default/osdSockAddrReuse.cpp @@ -16,11 +16,10 @@ # define __BSD_VISIBLE 1 #endif -#define epicsExportSharedSymbols #include "osiSock.h" #include "errlog.h" -epicsShareFunc void epicsShareAPI +LIBCOM_API void epicsStdCall epicsSocketEnableAddressReuseDuringTimeWaitState ( SOCKET s ) { int yes = true; @@ -48,7 +47,7 @@ void setfanout(SOCKET s, int opt, const char *optname) } } -void epicsShareAPI epicsSocketEnableAddressUseForDatagramFanout ( SOCKET s ) +void epicsStdCall epicsSocketEnableAddressUseForDatagramFanout ( SOCKET s ) { #define DOIT(sock, opt) setfanout(sock, opt, #opt) #ifdef SO_REUSEPORT diff --git a/modules/libcom/src/osi/os/default/osdSpin.c b/modules/libcom/src/osi/os/default/osdSpin.c index 6e9acb158..eb9cc1f91 100644 --- a/modules/libcom/src/osi/os/default/osdSpin.c +++ b/modules/libcom/src/osi/os/default/osdSpin.c @@ -12,7 +12,6 @@ #include -#define epicsExportSharedSymbols #include "cantProceed.h" #include "errlog.h" #include "epicsMutex.h" diff --git a/modules/libcom/src/osi/os/default/osdThreadExtra.c b/modules/libcom/src/osi/os/default/osdThreadExtra.c index 0a7c7ae95..f4562802e 100644 --- a/modules/libcom/src/osi/os/default/osdThreadExtra.c +++ b/modules/libcom/src/osi/os/default/osdThreadExtra.c @@ -9,8 +9,7 @@ /* Null default thread hooks for all platforms that do not do anything special */ -#define epicsExportSharedSymbols #include "epicsThread.h" -epicsShareDef EPICS_THREAD_HOOK_ROUTINE epicsThreadHookDefault; -epicsShareDef EPICS_THREAD_HOOK_ROUTINE epicsThreadHookMain; +EPICS_THREAD_HOOK_ROUTINE epicsThreadHookDefault; +EPICS_THREAD_HOOK_ROUTINE epicsThreadHookMain; diff --git a/modules/libcom/src/osi/os/default/osdThreadHooks.c b/modules/libcom/src/osi/os/default/osdThreadHooks.c index cbe28a4ff..924c1a20e 100644 --- a/modules/libcom/src/osi/os/default/osdThreadHooks.c +++ b/modules/libcom/src/osi/os/default/osdThreadHooks.c @@ -16,13 +16,12 @@ #include #include -#define epicsExportSharedSymbols #include "ellLib.h" #include "epicsMutex.h" #include "epicsThread.h" -epicsShareExtern EPICS_THREAD_HOOK_ROUTINE epicsThreadHookDefault; -epicsShareExtern EPICS_THREAD_HOOK_ROUTINE epicsThreadHookMain; +LIBCOM_API extern EPICS_THREAD_HOOK_ROUTINE epicsThreadHookDefault; +LIBCOM_API extern EPICS_THREAD_HOOK_ROUTINE epicsThreadHookMain; typedef struct epicsThreadHook { ELLNODE node; @@ -52,7 +51,7 @@ static void threadHookInit(void) epicsThreadOnce(&flag, threadHookOnce, NULL); } -epicsShareFunc int epicsThreadHookAdd(EPICS_THREAD_HOOK_ROUTINE hook) +LIBCOM_API int epicsThreadHookAdd(EPICS_THREAD_HOOK_ROUTINE hook) { epicsThreadHook *pHook; @@ -75,7 +74,7 @@ epicsShareFunc int epicsThreadHookAdd(EPICS_THREAD_HOOK_ROUTINE hook) return -1; } -epicsShareFunc int epicsThreadHookDelete(EPICS_THREAD_HOOK_ROUTINE hook) +LIBCOM_API int epicsThreadHookDelete(EPICS_THREAD_HOOK_ROUTINE hook) { if (!hook) return 0; threadHookInit(); @@ -97,13 +96,13 @@ epicsShareFunc int epicsThreadHookDelete(EPICS_THREAD_HOOK_ROUTINE hook) return -1; } -epicsShareFunc void osdThreadHooksRunMain(epicsThreadId id) +LIBCOM_API void osdThreadHooksRunMain(epicsThreadId id) { if (epicsThreadHookMain) epicsThreadHookMain(id); } -epicsShareFunc void osdThreadHooksRun(epicsThreadId id) +LIBCOM_API void osdThreadHooksRun(epicsThreadId id) { threadHookInit(); @@ -121,7 +120,7 @@ epicsShareFunc void osdThreadHooksRun(epicsThreadId id) } } -epicsShareFunc void epicsThreadHooksShow(void) +LIBCOM_API void epicsThreadHooksShow(void) { threadHookInit(); diff --git a/modules/libcom/src/osi/os/default/osdgetexec.c b/modules/libcom/src/osi/os/default/osdgetexec.c index 0bec9ead9..996596561 100644 --- a/modules/libcom/src/osi/os/default/osdgetexec.c +++ b/modules/libcom/src/osi/os/default/osdgetexec.c @@ -1,6 +1,5 @@ #include -#define epicsExportSharedSymbols #include char *epicsGetExecName(void) diff --git a/modules/libcom/src/osi/os/freebsd/osdTime.h b/modules/libcom/src/osi/os/freebsd/osdTime.h index 941426c72..c05ffa3af 100644 --- a/modules/libcom/src/osi/os/freebsd/osdTime.h +++ b/modules/libcom/src/osi/os/freebsd/osdTime.h @@ -20,7 +20,7 @@ extern "C" { #endif /* __cplusplus */ -epicsShareFunc void epicsShareAPI +LIBCOM_API void epicsStdCall convertDoubleToWakeTime(double timeout,struct timespec *wakeTime); #ifdef __cplusplus diff --git a/modules/libcom/src/osi/os/freebsd/osdgetexec.c b/modules/libcom/src/osi/os/freebsd/osdgetexec.c index 39c0a163d..b88fd6153 100644 --- a/modules/libcom/src/osi/os/freebsd/osdgetexec.c +++ b/modules/libcom/src/osi/os/freebsd/osdgetexec.c @@ -4,7 +4,6 @@ #include #include -#define epicsExportSharedSymbols #include char *epicsGetExecName(void) diff --git a/modules/libcom/src/osi/os/iOS/epicsMath.h b/modules/libcom/src/osi/os/iOS/epicsMath.h index 493583f70..07360588d 100644 --- a/modules/libcom/src/osi/os/iOS/epicsMath.h +++ b/modules/libcom/src/osi/os/iOS/epicsMath.h @@ -9,7 +9,7 @@ #define epicsMathh #include -#include +#include #define finite(x) isfinite(x) @@ -17,8 +17,8 @@ extern "C" { #endif -epicsShareExtern float epicsNAN; -epicsShareExtern float epicsINF; +LIBCOM_API extern float epicsNAN; +LIBCOM_API extern float epicsINF; #ifdef __cplusplus } diff --git a/modules/libcom/src/osi/os/iOS/osdEnv.c b/modules/libcom/src/osi/os/iOS/osdEnv.c index ba2946aa3..65ce0de3a 100644 --- a/modules/libcom/src/osi/os/iOS/osdEnv.c +++ b/modules/libcom/src/osi/os/iOS/osdEnv.c @@ -18,7 +18,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsStdio.h" #include #include @@ -30,7 +29,7 @@ /* * Set the value of an environment variable */ -epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *value) +LIBCOM_API void epicsStdCall epicsEnvSet (const char *name, const char *value) { if (!name) return; iocshEnvClear(name); @@ -41,7 +40,7 @@ epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *val * Unset an environment variable */ -epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name) +LIBCOM_API void epicsStdCall epicsEnvUnset (const char *name) { iocshEnvClear(name); unsetenv(name); @@ -50,7 +49,7 @@ epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name) /* * Show the value of the specified, or all, environment variables */ -epicsShareFunc void epicsShareAPI epicsEnvShow (const char *name) +LIBCOM_API void epicsStdCall epicsEnvShow (const char *name) { if (name == NULL) { extern char **environ; diff --git a/modules/libcom/src/osi/os/iOS/osdMonotonic.c b/modules/libcom/src/osi/os/iOS/osdMonotonic.c index dfce9dc85..9599410f6 100644 --- a/modules/libcom/src/osi/os/iOS/osdMonotonic.c +++ b/modules/libcom/src/osi/os/iOS/osdMonotonic.c @@ -7,7 +7,6 @@ #include #include -#define epicsExportSharedSymbols #define EPICS_EXPOSE_LIBCOM_MONOTONIC_PRIVATE #include "dbDefs.h" #include "errlog.h" diff --git a/modules/libcom/src/osi/os/iOS/osdTime.h b/modules/libcom/src/osi/os/iOS/osdTime.h index 953ec31b8..fe0e634c9 100644 --- a/modules/libcom/src/osi/os/iOS/osdTime.h +++ b/modules/libcom/src/osi/os/iOS/osdTime.h @@ -17,7 +17,7 @@ extern "C" { #endif /* __cplusplus */ -epicsShareFunc void convertDoubleToWakeTime(double timeout, +LIBCOM_API void convertDoubleToWakeTime(double timeout, struct timespec *wakeTime); #ifdef __cplusplus diff --git a/modules/libcom/src/osi/os/posix/epicsAtomicOSD.cpp b/modules/libcom/src/osi/os/posix/epicsAtomicOSD.cpp index a449a69c0..55578b90e 100644 --- a/modules/libcom/src/osi/os/posix/epicsAtomicOSD.cpp +++ b/modules/libcom/src/osi/os/posix/epicsAtomicOSD.cpp @@ -15,7 +15,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsAssert.h" #include "epicsAtomic.h" diff --git a/modules/libcom/src/osi/os/posix/epicsAtomicOSD.h b/modules/libcom/src/osi/os/posix/epicsAtomicOSD.h index 892d2dcb5..06e8c42ea 100644 --- a/modules/libcom/src/osi/os/posix/epicsAtomicOSD.h +++ b/modules/libcom/src/osi/os/posix/epicsAtomicOSD.h @@ -16,7 +16,7 @@ #ifndef epicsAtomicOSD_h #define epicsAtomicOSD_h -#include +#include #define EPICS_ATOMIC_OS_NAME "POSIX" @@ -26,9 +26,9 @@ typedef struct EpicsAtomicLockKey {} EpicsAtomicLockKey; extern "C" { #endif /* __cplusplus */ -epicsShareFunc void epicsAtomicLock ( struct EpicsAtomicLockKey * ); -epicsShareFunc void epicsAtomicUnlock ( struct EpicsAtomicLockKey * ); -epicsShareFunc void epicsAtomicMemoryBarrierFallback ( void ); +LIBCOM_API void epicsAtomicLock ( struct EpicsAtomicLockKey * ); +LIBCOM_API void epicsAtomicUnlock ( struct EpicsAtomicLockKey * ); +LIBCOM_API void epicsAtomicMemoryBarrierFallback ( void ); #ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void) diff --git a/modules/libcom/src/osi/os/posix/epicsMath.h b/modules/libcom/src/osi/os/posix/epicsMath.h index 6a76f0afb..517a795f0 100644 --- a/modules/libcom/src/osi/os/posix/epicsMath.h +++ b/modules/libcom/src/osi/os/posix/epicsMath.h @@ -11,7 +11,7 @@ #define epicsMathh #include -#include +#include #ifdef __cplusplus @@ -34,8 +34,8 @@ extern "C" { # define finite(x) isfinite((double)(x)) #endif -epicsShareExtern float epicsNAN; -epicsShareExtern float epicsINF; +LIBCOM_API extern float epicsNAN; +LIBCOM_API extern float epicsINF; #ifdef __cplusplus } diff --git a/modules/libcom/src/osi/os/posix/epicsTempFile.c b/modules/libcom/src/osi/os/posix/epicsTempFile.c index 6d7f631b2..f5057a2b6 100644 --- a/modules/libcom/src/osi/os/posix/epicsTempFile.c +++ b/modules/libcom/src/osi/os/posix/epicsTempFile.c @@ -10,10 +10,9 @@ #include -#define epicsExportSharedSymbols #include "epicsTempFile.h" -epicsShareFunc FILE * epicsShareAPI epicsTempFile ( void ) +LIBCOM_API FILE * epicsStdCall epicsTempFile ( void ) { return tmpfile (); } diff --git a/modules/libcom/src/osi/os/posix/osdElfFindAddr.c b/modules/libcom/src/osi/os/posix/osdElfFindAddr.c index bc67ae9ea..964f1d89a 100644 --- a/modules/libcom/src/osi/os/posix/osdElfFindAddr.c +++ b/modules/libcom/src/osi/os/posix/osdElfFindAddr.c @@ -23,7 +23,6 @@ #include #endif -#define epicsExportSharedSymbols #include "epicsMutex.h" #include "epicsThread.h" #include "epicsTime.h" @@ -32,7 +31,7 @@ #include "epicsStackTracePvt.h" /* This routine is provided by osiClockTime.c */ -epicsShareExtern void ClockTime_GetProgramStart(epicsTimeStamp *pDest); +LIBCOM_API extern void ClockTime_GetProgramStart(epicsTimeStamp *pDest); #define FIND_ADDR_DEBUG 0 diff --git a/modules/libcom/src/osi/os/posix/osdEvent.c b/modules/libcom/src/osi/os/posix/osdEvent.c index f133ed028..9a6a4f5e8 100644 --- a/modules/libcom/src/osi/os/posix/osdEvent.c +++ b/modules/libcom/src/osi/os/posix/osdEvent.c @@ -19,7 +19,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsEvent.h" #include "epicsTime.h" #include "errlog.h" @@ -45,7 +44,7 @@ struct epicsEventOSD { } -epicsShareFunc epicsEventId epicsEventCreate(epicsEventInitialState init) +LIBCOM_API epicsEventId epicsEventCreate(epicsEventInitialState init) { epicsEventId pevent = malloc(sizeof(*pevent)); @@ -68,7 +67,7 @@ epicsShareFunc epicsEventId epicsEventCreate(epicsEventInitialState init) return NULL; } -epicsShareFunc void epicsEventDestroy(epicsEventId pevent) +LIBCOM_API void epicsEventDestroy(epicsEventId pevent) { int status = pthread_mutex_destroy(&pevent->mutex); @@ -78,7 +77,7 @@ epicsShareFunc void epicsEventDestroy(epicsEventId pevent) free(pevent); } -epicsShareFunc epicsEventStatus epicsEventTrigger(epicsEventId pevent) +LIBCOM_API epicsEventStatus epicsEventTrigger(epicsEventId pevent) { int status = pthread_mutex_lock(&pevent->mutex); @@ -93,7 +92,7 @@ epicsShareFunc epicsEventStatus epicsEventTrigger(epicsEventId pevent) return epicsEventOK; } -epicsShareFunc epicsEventStatus epicsEventWait(epicsEventId pevent) +LIBCOM_API epicsEventStatus epicsEventWait(epicsEventId pevent) { epicsEventStatus result = epicsEventOK; int status = pthread_mutex_lock(&pevent->mutex); @@ -115,7 +114,7 @@ release: return result; } -epicsShareFunc epicsEventStatus epicsEventWaitWithTimeout(epicsEventId pevent, +LIBCOM_API epicsEventStatus epicsEventWaitWithTimeout(epicsEventId pevent, double timeout) { epicsEventStatus result = epicsEventOK; @@ -143,12 +142,12 @@ release: return result; } -epicsShareFunc epicsEventStatus epicsEventTryWait(epicsEventId id) +LIBCOM_API epicsEventStatus epicsEventTryWait(epicsEventId id) { return epicsEventWaitWithTimeout(id, 0.0); } -epicsShareFunc void epicsEventShow(epicsEventId pevent, unsigned int level) +LIBCOM_API void epicsEventShow(epicsEventId pevent, unsigned int level) { printf("epicsEvent %p: %s\n", pevent, pevent->isFull ? "full" : "empty"); diff --git a/modules/libcom/src/osi/os/posix/osdExecinfoBackTrace.cpp b/modules/libcom/src/osi/os/posix/osdExecinfoBackTrace.cpp index 8ed1bb283..ae32d61fe 100644 --- a/modules/libcom/src/osi/os/posix/osdExecinfoBackTrace.cpp +++ b/modules/libcom/src/osi/os/posix/osdExecinfoBackTrace.cpp @@ -23,7 +23,6 @@ #endif -#define epicsExportSharedSymbols #include "epicsStackTracePvt.h" int epicsBackTrace(void **buf, int buf_sz) diff --git a/modules/libcom/src/osi/os/posix/osdFindSymbol.c b/modules/libcom/src/osi/os/posix/osdFindSymbol.c index 084865341..7a86f15b9 100644 --- a/modules/libcom/src/osi/os/posix/osdFindSymbol.c +++ b/modules/libcom/src/osi/os/posix/osdFindSymbol.c @@ -8,7 +8,6 @@ #include -#define epicsExportSharedSymbols #include "epicsFindSymbol.h" /* non-POSIX extension available on Linux (glibc at least) and OSX. @@ -17,17 +16,17 @@ # define RTLD_DEFAULT 0 #endif -epicsShareFunc void * epicsLoadLibrary(const char *name) +LIBCOM_API void * epicsLoadLibrary(const char *name) { return dlopen(name, RTLD_LAZY | RTLD_GLOBAL); } -epicsShareFunc const char *epicsLoadError(void) +LIBCOM_API const char *epicsLoadError(void) { return dlerror(); } -epicsShareFunc void * epicsShareAPI epicsFindSymbol(const char *name) +LIBCOM_API void * epicsStdCall epicsFindSymbol(const char *name) { return dlsym(RTLD_DEFAULT, name); } diff --git a/modules/libcom/src/osi/os/posix/osdMonotonic.c b/modules/libcom/src/osi/os/posix/osdMonotonic.c index 65585797c..12e0993ae 100644 --- a/modules/libcom/src/osi/os/posix/osdMonotonic.c +++ b/modules/libcom/src/osi/os/posix/osdMonotonic.c @@ -4,7 +4,6 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -#define epicsExportSharedSymbols #define EPICS_EXPOSE_LIBCOM_MONOTONIC_PRIVATE #include "dbDefs.h" #include "errlog.h" diff --git a/modules/libcom/src/osi/os/posix/osdMutex.c b/modules/libcom/src/osi/os/posix/osdMutex.c index d1411215c..43d3eac10 100644 --- a/modules/libcom/src/osi/os/posix/osdMutex.c +++ b/modules/libcom/src/osi/os/posix/osdMutex.c @@ -20,7 +20,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsMutex.h" #include "cantProceed.h" #include "epicsTime.h" diff --git a/modules/libcom/src/osi/os/posix/osdProcess.c b/modules/libcom/src/osi/os/posix/osdProcess.c index a08871465..8517e8ecc 100644 --- a/modules/libcom/src/osi/os/posix/osdProcess.c +++ b/modules/libcom/src/osi/os/posix/osdProcess.c @@ -26,12 +26,11 @@ #include #include -#define epicsExportSharedSymbols #include "osiProcess.h" #include "errlog.h" #include "epicsAssert.h" -epicsShareFunc osiGetUserNameReturn epicsShareAPI osiGetUserName (char *pBuf, unsigned bufSizeIn) +LIBCOM_API osiGetUserNameReturn epicsStdCall osiGetUserName (char *pBuf, unsigned bufSizeIn) { struct passwd *p; @@ -58,7 +57,7 @@ epicsShareFunc osiGetUserNameReturn epicsShareAPI osiGetUserName (char *pBuf, un } } -epicsShareFunc osiSpawnDetachedProcessReturn epicsShareAPI osiSpawnDetachedProcess +LIBCOM_API osiSpawnDetachedProcessReturn epicsStdCall osiSpawnDetachedProcess (const char *pProcessName, const char *pBaseExecutableName) { int status; diff --git a/modules/libcom/src/osi/os/posix/osdSignal.cpp b/modules/libcom/src/osi/os/posix/osdSignal.cpp index 3f8deb4fb..5fe04366a 100644 --- a/modules/libcom/src/osi/os/posix/osdSignal.cpp +++ b/modules/libcom/src/osi/os/posix/osdSignal.cpp @@ -16,7 +16,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsSignal.h" static void ignoreIfDefault(int signum, const char *name) @@ -38,7 +37,7 @@ static void ignoreIfDefault(int signum, const char *name) /* * epicsSignalInstallSigHupIgnore () */ -epicsShareFunc void epicsShareAPI epicsSignalInstallSigHupIgnore (void) +LIBCOM_API void epicsStdCall epicsSignalInstallSigHupIgnore (void) { ignoreIfDefault(SIGHUP, "SIGHUP"); } @@ -46,12 +45,12 @@ epicsShareFunc void epicsShareAPI epicsSignalInstallSigHupIgnore (void) /* * epicsSignalInstallSigPipeIgnore () */ -epicsShareFunc void epicsShareAPI epicsSignalInstallSigPipeIgnore (void) +LIBCOM_API void epicsStdCall epicsSignalInstallSigPipeIgnore (void) { ignoreIfDefault(SIGPIPE, "SIGPIPE"); } /* Disabled */ -epicsShareFunc void epicsShareAPI epicsSignalInstallSigAlarmIgnore ( void ) {} -epicsShareFunc void epicsShareAPI epicsSignalRaiseSigAlarm +LIBCOM_API void epicsStdCall epicsSignalInstallSigAlarmIgnore ( void ) {} +LIBCOM_API void epicsStdCall epicsSignalRaiseSigAlarm ( struct epicsThreadOSD * /* threadId */ ) {} diff --git a/modules/libcom/src/osi/os/posix/osdSock.c b/modules/libcom/src/osi/os/posix/osdSock.c index 9f8146142..5d966b560 100644 --- a/modules/libcom/src/osi/os/posix/osdSock.c +++ b/modules/libcom/src/osi/os/posix/osdSock.c @@ -21,7 +21,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsThread.h" #include "epicsEvent.h" #include "epicsMutex.h" @@ -69,7 +68,7 @@ void osiSockRelease() * the socket will be closed if the user uses exec() * as is the case with third party tools such as TCL/TK */ -epicsShareFunc SOCKET epicsShareAPI epicsSocketCreate ( +LIBCOM_API SOCKET epicsStdCall epicsSocketCreate ( int domain, int type, int protocol ) { SOCKET sock = socket ( domain, type, protocol ); @@ -92,7 +91,7 @@ epicsShareFunc SOCKET epicsShareAPI epicsSocketCreate ( return sock; } -epicsShareFunc int epicsShareAPI epicsSocketAccept ( +LIBCOM_API int epicsStdCall epicsSocketAccept ( int sock, struct sockaddr * pAddr, osiSocklen_t * addrlen ) { int newSock = accept ( sock, pAddr, addrlen ); @@ -115,7 +114,7 @@ epicsShareFunc int epicsShareAPI epicsSocketAccept ( return newSock; } -epicsShareFunc void epicsShareAPI epicsSocketDestroy ( SOCKET s ) +LIBCOM_API void epicsStdCall epicsSocketDestroy ( SOCKET s ) { int status = close ( s ); if ( status < 0 ) { @@ -133,7 +132,7 @@ epicsShareFunc void epicsShareAPI epicsSocketDestroy ( SOCKET s ) * On many systems, gethostbyaddr must be protected by a * mutex since the routine is not thread-safe. */ -epicsShareFunc unsigned epicsShareAPI ipAddrToHostName +LIBCOM_API unsigned epicsStdCall ipAddrToHostName (const struct in_addr *pAddr, char *pBuf, unsigned bufSize) { struct hostent *ent; @@ -159,7 +158,7 @@ epicsShareFunc unsigned epicsShareAPI ipAddrToHostName * On many systems, gethostbyname must be protected by a * mutex since the routine is not thread-safe. */ -epicsShareFunc int epicsShareAPI hostToIPAddr +LIBCOM_API int epicsStdCall hostToIPAddr (const char *pHostName, struct in_addr *pIPA) { struct hostent *phe; diff --git a/modules/libcom/src/osi/os/posix/osdSpin.c b/modules/libcom/src/osi/os/posix/osdSpin.c index aa61a6c90..4be3f980c 100644 --- a/modules/libcom/src/osi/os/posix/osdSpin.c +++ b/modules/libcom/src/osi/os/posix/osdSpin.c @@ -16,7 +16,6 @@ #include #include -#define epicsExportSharedSymbols #include "errlog.h" #include "cantProceed.h" #include "epicsSpin.h" diff --git a/modules/libcom/src/osi/os/posix/osdStdio.c b/modules/libcom/src/osi/os/posix/osdStdio.c index 2a23cee71..0f9378cc5 100644 --- a/modules/libcom/src/osi/os/posix/osdStdio.c +++ b/modules/libcom/src/osi/os/posix/osdStdio.c @@ -9,10 +9,9 @@ \*************************************************************************/ #include -#define epicsExportSharedSymbols #include -epicsShareFunc int epicsShareAPI epicsSnprintf( +LIBCOM_API int epicsStdCall epicsSnprintf( char *str, size_t size, const char *format, ...) { int nchars; @@ -24,7 +23,7 @@ epicsShareFunc int epicsShareAPI epicsSnprintf( return(nchars); } -epicsShareFunc int epicsShareAPI epicsVsnprintf( +LIBCOM_API int epicsStdCall epicsVsnprintf( char *str, size_t size, const char *format, va_list ap) { return vsnprintf ( str, size, format, ap ); diff --git a/modules/libcom/src/osi/os/posix/osdThread.c b/modules/libcom/src/osi/os/posix/osdThread.c index d99e5d9a6..de8d208bb 100644 --- a/modules/libcom/src/osi/os/posix/osdThread.c +++ b/modules/libcom/src/osi/os/posix/osdThread.c @@ -27,7 +27,6 @@ #include #endif -#define epicsExportSharedSymbols #include "epicsStdio.h" #include "ellLib.h" #include "epicsEvent.h" @@ -40,9 +39,9 @@ #include "epicsExit.h" #include "epicsAtomic.h" -epicsShareFunc void epicsThreadShowInfo(epicsThreadOSD *pthreadInfo, unsigned int level); -epicsShareFunc void osdThreadHooksRun(epicsThreadId id); -epicsShareFunc void osdThreadHooksRunMain(epicsThreadId id); +LIBCOM_API void epicsThreadShowInfo(epicsThreadOSD *pthreadInfo, unsigned int level); +LIBCOM_API void osdThreadHooksRun(epicsThreadId id); +LIBCOM_API void osdThreadHooksRunMain(epicsThreadId id); static int mutexLock(pthread_mutex_t *id) { @@ -113,7 +112,7 @@ if(status) { \ } -epicsShareFunc int epicsThreadGetPosixPriority(epicsThreadId pthreadInfo) +LIBCOM_API int epicsThreadGetPosixPriority(epicsThreadId pthreadInfo) { #if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && _POSIX_THREAD_PRIORITY_SCHEDULING > 0 double maxPriority,minPriority,slope,oss; @@ -422,7 +421,7 @@ static void epicsThreadInit(void) checkStatusQuit(status,"pthread_once","epicsThreadInit"); } -epicsShareFunc +LIBCOM_API void epicsThreadRealtimeLock(void) { #if defined(_POSIX_MEMLOCK) && _POSIX_MEMLOCK > 0 @@ -464,7 +463,7 @@ void epicsThreadRealtimeLock(void) #define STACK_SIZE(f) (0) #endif /*_POSIX_THREAD_ATTR_STACKSIZE*/ -epicsShareFunc unsigned int epicsShareAPI epicsThreadGetStackSize (epicsThreadStackSizeClass stackSizeClass) +LIBCOM_API unsigned int epicsStdCall epicsThreadGetStackSize (epicsThreadStackSizeClass stackSizeClass) { #if defined (OSITHREAD_USE_DEFAULT_STACK) return 0; @@ -485,7 +484,7 @@ epicsShareFunc unsigned int epicsShareAPI epicsThreadGetStackSize (epicsThreadSt #endif /*_POSIX_THREAD_ATTR_STACKSIZE*/ } -epicsShareFunc void epicsShareAPI epicsThreadOnce(epicsThreadOnceId *id, void (*func)(void *), void *arg) +LIBCOM_API void epicsStdCall epicsThreadOnce(epicsThreadOnceId *id, void (*func)(void *), void *arg) { static struct epicsThreadOSD threadOnceComplete; #define EPICS_THREAD_ONCE_DONE &threadOnceComplete @@ -662,7 +661,7 @@ void epicsThreadMustJoin(epicsThreadId id) free_threadInfo(id); } -epicsShareFunc void epicsShareAPI epicsThreadSuspendSelf(void) +LIBCOM_API void epicsStdCall epicsThreadSuspendSelf(void) { epicsThreadOSD *pthreadInfo; @@ -674,14 +673,14 @@ epicsShareFunc void epicsShareAPI epicsThreadSuspendSelf(void) epicsEventWait(pthreadInfo->suspendEvent); } -epicsShareFunc void epicsShareAPI epicsThreadResume(epicsThreadOSD *pthreadInfo) +LIBCOM_API void epicsStdCall epicsThreadResume(epicsThreadOSD *pthreadInfo) { assert(epicsThreadOnceCalled); pthreadInfo->isSuspended = 0; epicsEventSignal(pthreadInfo->suspendEvent); } -epicsShareFunc void epicsShareAPI epicsThreadExitMain(void) +LIBCOM_API void epicsStdCall epicsThreadExitMain(void) { epicsThreadOSD *pthreadInfo; @@ -699,19 +698,19 @@ epicsShareFunc void epicsShareAPI epicsThreadExitMain(void) } } -epicsShareFunc unsigned int epicsShareAPI epicsThreadGetPriority(epicsThreadId pthreadInfo) +LIBCOM_API unsigned int epicsStdCall epicsThreadGetPriority(epicsThreadId pthreadInfo) { assert(epicsThreadOnceCalled); return(pthreadInfo->osiPriority); } -epicsShareFunc unsigned int epicsShareAPI epicsThreadGetPrioritySelf(void) +LIBCOM_API unsigned int epicsStdCall epicsThreadGetPrioritySelf(void) { epicsThreadInit(); return(epicsThreadGetPriority(epicsThreadGetIdSelf())); } -epicsShareFunc void epicsShareAPI epicsThreadSetPriority(epicsThreadId pthreadInfo,unsigned int priority) +LIBCOM_API void epicsStdCall epicsThreadSetPriority(epicsThreadId pthreadInfo,unsigned int priority) { #if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && _POSIX_THREAD_PRIORITY_SCHEDULING > 0 int status; @@ -738,7 +737,7 @@ epicsShareFunc void epicsShareAPI epicsThreadSetPriority(epicsThreadId pthreadIn #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ } -epicsShareFunc epicsThreadBooleanStatus epicsShareAPI epicsThreadHighestPriorityLevelBelow( +LIBCOM_API epicsThreadBooleanStatus epicsStdCall epicsThreadHighestPriorityLevelBelow( unsigned int priority, unsigned *pPriorityJustBelow) { unsigned newPriority = priority - 1; @@ -755,7 +754,7 @@ epicsShareFunc epicsThreadBooleanStatus epicsShareAPI epicsThreadHighestPriority return epicsThreadBooleanStatusFail; } -epicsShareFunc epicsThreadBooleanStatus epicsShareAPI epicsThreadLowestPriorityLevelAbove( +LIBCOM_API epicsThreadBooleanStatus epicsStdCall epicsThreadLowestPriorityLevelAbove( unsigned int priority, unsigned *pPriorityJustAbove) { unsigned newPriority = priority + 1; @@ -774,7 +773,7 @@ epicsShareFunc epicsThreadBooleanStatus epicsShareAPI epicsThreadLowestPriorityL return epicsThreadBooleanStatusFail; } -epicsShareFunc int epicsShareAPI epicsThreadIsEqual(epicsThreadId p1, epicsThreadId p2) +LIBCOM_API int epicsStdCall epicsThreadIsEqual(epicsThreadId p1, epicsThreadId p2) { assert(epicsThreadOnceCalled); assert(p1); @@ -782,13 +781,13 @@ epicsShareFunc int epicsShareAPI epicsThreadIsEqual(epicsThreadId p1, epicsThrea return(pthread_equal(p1->tid,p2->tid)); } -epicsShareFunc int epicsShareAPI epicsThreadIsSuspended(epicsThreadId pthreadInfo) { +LIBCOM_API int epicsStdCall epicsThreadIsSuspended(epicsThreadId pthreadInfo) { assert(epicsThreadOnceCalled); assert(pthreadInfo); return(pthreadInfo->isSuspended ? 1 : 0); } -epicsShareFunc void epicsShareAPI epicsThreadSleep(double seconds) +LIBCOM_API void epicsStdCall epicsThreadSleep(double seconds) { struct timespec delayTime; struct timespec remainingTime; @@ -808,7 +807,7 @@ epicsShareFunc void epicsShareAPI epicsThreadSleep(double seconds) delayTime = remainingTime; } -epicsShareFunc epicsThreadId epicsShareAPI epicsThreadGetIdSelf(void) { +LIBCOM_API epicsThreadId epicsStdCall epicsThreadGetIdSelf(void) { epicsThreadOSD *pthreadInfo; epicsThreadInit(); @@ -819,12 +818,12 @@ epicsShareFunc epicsThreadId epicsShareAPI epicsThreadGetIdSelf(void) { return(pthreadInfo); } -epicsShareFunc pthread_t epicsThreadGetPosixThreadId ( epicsThreadId threadId ) +LIBCOM_API pthread_t epicsThreadGetPosixThreadId ( epicsThreadId threadId ) { return threadId->tid; } -epicsShareFunc epicsThreadId epicsShareAPI epicsThreadGetId(const char *name) { +LIBCOM_API epicsThreadId epicsStdCall epicsThreadGetId(const char *name) { epicsThreadOSD *pthreadInfo; int status; @@ -844,7 +843,7 @@ epicsShareFunc epicsThreadId epicsShareAPI epicsThreadGetId(const char *name) { return(pthreadInfo); } -epicsShareFunc const char epicsShareAPI *epicsThreadGetNameSelf() +LIBCOM_API const char epicsStdCall *epicsThreadGetNameSelf() { epicsThreadOSD *pthreadInfo; @@ -855,14 +854,14 @@ epicsShareFunc const char epicsShareAPI *epicsThreadGetNameSelf() return(pthreadInfo->name); } -epicsShareFunc void epicsShareAPI epicsThreadGetName(epicsThreadId pthreadInfo, char *name, size_t size) +LIBCOM_API void epicsStdCall epicsThreadGetName(epicsThreadId pthreadInfo, char *name, size_t size) { assert(epicsThreadOnceCalled); strncpy(name, pthreadInfo->name, size-1); name[size-1] = '\0'; } -epicsShareFunc void epicsThreadMap(EPICS_THREAD_HOOK_ROUTINE func) +LIBCOM_API void epicsThreadMap(EPICS_THREAD_HOOK_ROUTINE func) { epicsThreadOSD *pthreadInfo; int status; @@ -881,7 +880,7 @@ epicsShareFunc void epicsThreadMap(EPICS_THREAD_HOOK_ROUTINE func) checkStatus(status, "pthread_mutex_unlock epicsThreadMap"); } -epicsShareFunc void epicsShareAPI epicsThreadShowAll(unsigned int level) +LIBCOM_API void epicsStdCall epicsThreadShowAll(unsigned int level) { epicsThreadOSD *pthreadInfo; int status; @@ -901,7 +900,7 @@ epicsShareFunc void epicsShareAPI epicsThreadShowAll(unsigned int level) checkStatus(status,"pthread_mutex_unlock epicsThreadShowAll"); } -epicsShareFunc void epicsShareAPI epicsThreadShow(epicsThreadId showThread, unsigned int level) +LIBCOM_API void epicsStdCall epicsThreadShow(epicsThreadId showThread, unsigned int level) { epicsThreadOSD *pthreadInfo; int status; @@ -932,7 +931,7 @@ epicsShareFunc void epicsShareAPI epicsThreadShow(epicsThreadId showThread, unsi printf("Thread %#lx (%lu) not found.\n", (unsigned long)showThread, (unsigned long)showThread); } -epicsShareFunc epicsThreadPrivateId epicsShareAPI epicsThreadPrivateCreate(void) +LIBCOM_API epicsThreadPrivateId epicsStdCall epicsThreadPrivateCreate(void) { pthread_key_t *key; int status; @@ -948,7 +947,7 @@ epicsShareFunc epicsThreadPrivateId epicsShareAPI epicsThreadPrivateCreate(void) return((epicsThreadPrivateId)key); } -epicsShareFunc void epicsShareAPI epicsThreadPrivateDelete(epicsThreadPrivateId id) +LIBCOM_API void epicsStdCall epicsThreadPrivateDelete(epicsThreadPrivateId id) { pthread_key_t *key = (pthread_key_t *)id; int status; @@ -959,7 +958,7 @@ epicsShareFunc void epicsShareAPI epicsThreadPrivateDelete(epicsThreadPrivateId free((void *)key); } -epicsShareFunc void epicsShareAPI epicsThreadPrivateSet (epicsThreadPrivateId id, void *value) +LIBCOM_API void epicsStdCall epicsThreadPrivateSet (epicsThreadPrivateId id, void *value) { pthread_key_t *key = (pthread_key_t *)id; int status; @@ -971,7 +970,7 @@ epicsShareFunc void epicsShareAPI epicsThreadPrivateSet (epicsThreadPrivateId id checkStatusQuit(status,"pthread_setspecific","epicsThreadPrivateSet"); } -epicsShareFunc void epicsShareAPI *epicsThreadPrivateGet(epicsThreadPrivateId id) +LIBCOM_API void epicsStdCall *epicsThreadPrivateGet(epicsThreadPrivateId id) { pthread_key_t *key = (pthread_key_t *)id; @@ -979,7 +978,7 @@ epicsShareFunc void epicsShareAPI *epicsThreadPrivateGet(epicsThreadPrivateId id return pthread_getspecific(*key); } -epicsShareFunc double epicsShareAPI epicsThreadSleepQuantum () +LIBCOM_API double epicsStdCall epicsThreadSleepQuantum () { double hz; hz = sysconf ( _SC_CLK_TCK ); @@ -988,7 +987,7 @@ epicsShareFunc double epicsShareAPI epicsThreadSleepQuantum () return 1.0 / hz; } -epicsShareFunc int epicsThreadGetCPUs(void) +LIBCOM_API int epicsThreadGetCPUs(void) { long ret; #ifdef _SC_NPROCESSORS_ONLN diff --git a/modules/libcom/src/osi/os/posix/osdThread.h b/modules/libcom/src/osi/os/posix/osdThread.h index 8fe8f14eb..85a77cdac 100644 --- a/modules/libcom/src/osi/os/posix/osdThread.h +++ b/modules/libcom/src/osi/os/posix/osdThread.h @@ -11,7 +11,7 @@ #include -#include "shareLib.h" +#include "libComAPI.h" #include "ellLib.h" #include "epicsEvent.h" @@ -38,8 +38,8 @@ typedef struct epicsThreadOSD { char name[1]; /* actually larger */ } epicsThreadOSD; -epicsShareFunc pthread_t epicsThreadGetPosixThreadId(epicsThreadId id); -epicsShareFunc int epicsThreadGetPosixPriority(epicsThreadId id); +LIBCOM_API pthread_t epicsThreadGetPosixThreadId(epicsThreadId id); +LIBCOM_API int epicsThreadGetPosixPriority(epicsThreadId id); #ifdef __cplusplus } diff --git a/modules/libcom/src/osi/os/posix/osdThreadExtra.c b/modules/libcom/src/osi/os/posix/osdThreadExtra.c index af622dc08..7f2854b7c 100644 --- a/modules/libcom/src/osi/os/posix/osdThreadExtra.c +++ b/modules/libcom/src/osi/os/posix/osdThreadExtra.c @@ -11,14 +11,13 @@ /* This is part of the posix implementation of epicsThread */ -#define epicsExportSharedSymbols #include "epicsStdio.h" #include "ellLib.h" #include "epicsEvent.h" #include "epicsThread.h" -epicsShareDef EPICS_THREAD_HOOK_ROUTINE epicsThreadHookDefault; -epicsShareDef EPICS_THREAD_HOOK_ROUTINE epicsThreadHookMain; +EPICS_THREAD_HOOK_ROUTINE epicsThreadHookDefault; +EPICS_THREAD_HOOK_ROUTINE epicsThreadHookMain; void epicsThreadShowInfo(epicsThreadOSD *pthreadInfo, unsigned int level) { diff --git a/modules/libcom/src/osi/os/posix/osdTime.cpp b/modules/libcom/src/osi/os/posix/osdTime.cpp index cc3cb1965..32b3c5b08 100644 --- a/modules/libcom/src/osi/os/posix/osdTime.cpp +++ b/modules/libcom/src/osi/os/posix/osdTime.cpp @@ -16,7 +16,6 @@ #define EPICS_EXPOSE_LIBCOM_MONOTONIC_PRIVATE #include "osiSock.h" -#define epicsExportSharedSymbols #include "cantProceed.h" #include "epicsTime.h" #include "generalTimeSup.h" @@ -88,7 +87,7 @@ int epicsTime_localtime ( const time_t *clock, } } -extern "C" epicsShareFunc void +extern "C" LIBCOM_API void convertDoubleToWakeTime(double timeout,struct timespec *wakeTime) { struct timespec now, wait; diff --git a/modules/libcom/src/osi/os/posix/osdTime.h b/modules/libcom/src/osi/os/posix/osdTime.h index d1da77696..b0c8cd947 100644 --- a/modules/libcom/src/osi/os/posix/osdTime.h +++ b/modules/libcom/src/osi/os/posix/osdTime.h @@ -28,7 +28,7 @@ extern "C" { #endif /* __cplusplus */ -epicsShareFunc void epicsShareAPI +LIBCOM_API void epicsStdCall convertDoubleToWakeTime(double timeout,struct timespec *wakeTime); #ifdef __cplusplus diff --git a/modules/libcom/src/osi/os/posix/systemCallIntMech.cpp b/modules/libcom/src/osi/os/posix/systemCallIntMech.cpp index cdac1d0cb..ea0a3411d 100644 --- a/modules/libcom/src/osi/os/posix/systemCallIntMech.cpp +++ b/modules/libcom/src/osi/os/posix/systemCallIntMech.cpp @@ -12,7 +12,6 @@ * Author: Jeff Hill */ -#define epicsExportSharedSymbols #include "osiSock.h" enum epicsSocketSystemCallInterruptMechanismQueryInfo diff --git a/modules/libcom/src/osi/os/solaris/epicsAtomicOSD.h b/modules/libcom/src/osi/os/solaris/epicsAtomicOSD.h index 1fa23bd88..c6ecfa8d8 100644 --- a/modules/libcom/src/osi/os/solaris/epicsAtomicOSD.h +++ b/modules/libcom/src/osi/os/solaris/epicsAtomicOSD.h @@ -13,7 +13,7 @@ * johill@lanl.gov */ -#include "shareLib.h" +#include "libComAPI.h" #ifndef epicsAtomicOSD_h #define epicsAtomicOSD_h @@ -172,8 +172,8 @@ typedef struct EpicsAtomicLockKey { extern "C" { #endif /* __cplusplus */ -epicsShareFunc void epicsAtomicLock ( struct EpicsAtomicLockKey * ); -epicsShareFunc void epicsAtomicUnlock ( struct EpicsAtomicLockKey * ); +LIBCOM_API void epicsAtomicLock ( struct EpicsAtomicLockKey * ); +LIBCOM_API void epicsAtomicUnlock ( struct EpicsAtomicLockKey * ); #ifdef __cplusplus } /* end of extern "C" */ diff --git a/modules/libcom/src/osi/os/solaris/epicsMath.h b/modules/libcom/src/osi/os/solaris/epicsMath.h index 87d4986a7..c27484daa 100644 --- a/modules/libcom/src/osi/os/solaris/epicsMath.h +++ b/modules/libcom/src/osi/os/solaris/epicsMath.h @@ -10,7 +10,7 @@ #include #include -#include +#include #ifndef isinf # define isinf(x) (((x)==(x)) && !finite((x))) @@ -25,8 +25,8 @@ extern "C" { #endif -epicsShareExtern float epicsNAN; -epicsShareExtern float epicsINF; +LIBCOM_API extern float epicsNAN; +LIBCOM_API extern float epicsINF; #ifdef __cplusplus } diff --git a/modules/libcom/src/osi/os/solaris/osdBackTrace.cpp b/modules/libcom/src/osi/os/solaris/osdBackTrace.cpp index 55d5e3648..46c4784b3 100644 --- a/modules/libcom/src/osi/os/solaris/osdBackTrace.cpp +++ b/modules/libcom/src/osi/os/solaris/osdBackTrace.cpp @@ -9,7 +9,6 @@ #include -#define epicsExportSharedSymbols #include "epicsStackTracePvt.h" struct wlk { diff --git a/modules/libcom/src/osi/os/solaris/osdEnv.c b/modules/libcom/src/osi/os/solaris/osdEnv.c index c356a0a13..2cc80daee 100644 --- a/modules/libcom/src/osi/os/solaris/osdEnv.c +++ b/modules/libcom/src/osi/os/solaris/osdEnv.c @@ -15,7 +15,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsStdio.h" #include "envDefs.h" #include "osiUnistd.h" @@ -24,7 +23,7 @@ /* * Set the value of an environment variable */ -epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *value) +LIBCOM_API void epicsStdCall epicsEnvSet (const char *name, const char *value) { iocshEnvClear(name); setenv(name, value, 1); @@ -34,7 +33,7 @@ epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *val * Unset an environment variable */ -epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name) +LIBCOM_API void epicsStdCall epicsEnvUnset (const char *name) { iocshEnvClear(name); unsetenv(name); @@ -43,7 +42,7 @@ epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name) /* * Show the value of the specified, or all, environment variables */ -epicsShareFunc void epicsShareAPI epicsEnvShow (const char *name) +LIBCOM_API void epicsStdCall epicsEnvShow (const char *name) { if (name == NULL) { extern char **environ; diff --git a/modules/libcom/src/osi/os/solaris/osdStrtod.h b/modules/libcom/src/osi/os/solaris/osdStrtod.h index b5fda31c3..395cacdc2 100644 --- a/modules/libcom/src/osi/os/solaris/osdStrtod.h +++ b/modules/libcom/src/osi/os/solaris/osdStrtod.h @@ -16,7 +16,7 @@ extern "C" { /* * epicsStrtod() for systems with broken strtod() routine */ -epicsShareFunc double epicsStrtod(const char *str, char **endp); +LIBCOM_API double epicsStrtod(const char *str, char **endp); #ifdef __cplusplus } diff --git a/modules/libcom/src/osi/os/solaris/osdgetexec.c b/modules/libcom/src/osi/os/solaris/osdgetexec.c index ff9739ca9..4d55694ce 100644 --- a/modules/libcom/src/osi/os/solaris/osdgetexec.c +++ b/modules/libcom/src/osi/os/solaris/osdgetexec.c @@ -2,7 +2,6 @@ #include #include -#define epicsExportSharedSymbols #include char *epicsGetExecName(void) diff --git a/modules/libcom/src/osi/os/vxWorks/epicsMath.h b/modules/libcom/src/osi/os/vxWorks/epicsMath.h index e973d2d9c..0939f3d5c 100644 --- a/modules/libcom/src/osi/os/vxWorks/epicsMath.h +++ b/modules/libcom/src/osi/os/vxWorks/epicsMath.h @@ -12,7 +12,7 @@ #include #include -#include +#include /* private/mathP.h defines NAN as 4, and uses its value in the * isNan() macro. We need mathP.h for isInf(), but can create @@ -29,8 +29,8 @@ extern "C" { #endif -epicsShareExtern float epicsNAN; -epicsShareExtern float epicsINF; +LIBCOM_API extern float epicsNAN; +LIBCOM_API extern float epicsINF; #ifdef __cplusplus } diff --git a/modules/libcom/src/osi/os/vxWorks/osdEnv.c b/modules/libcom/src/osi/os/vxWorks/osdEnv.c index 9cfd1f7aa..47662bc72 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdEnv.c +++ b/modules/libcom/src/osi/os/vxWorks/osdEnv.c @@ -21,7 +21,6 @@ #include #include -#define epicsExportSharedSymbols #include "cantProceed.h" #include "epicsFindSymbol.h" #include "epicsStdio.h" @@ -33,7 +32,7 @@ * Leaks memory, but the assumption is that this routine won't be * called often enough for the leak to be a problem. */ -epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *value) +LIBCOM_API void epicsStdCall epicsEnvSet (const char *name, const char *value) { char *cp; @@ -62,7 +61,7 @@ epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *val * support to really unset an environment variable. */ -epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name) +LIBCOM_API void epicsStdCall epicsEnvUnset (const char *name) { char* var; @@ -78,7 +77,7 @@ epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name) /* * Show the value of the specified, or all, environment variables */ -epicsShareFunc void epicsShareAPI epicsEnvShow (const char *name) +LIBCOM_API void epicsStdCall epicsEnvShow (const char *name) { if (name == NULL) { envShow (0); diff --git a/modules/libcom/src/osi/os/vxWorks/osdFindSymbol.c b/modules/libcom/src/osi/os/vxWorks/osdFindSymbol.c index da17c5bf3..2923743c8 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdFindSymbol.c +++ b/modules/libcom/src/osi/os/vxWorks/osdFindSymbol.c @@ -28,7 +28,7 @@ static char *errmsg = NULL; static char *oldmsg = NULL; -epicsShareFunc void * epicsLoadLibrary(const char *name) +LIBCOM_API void * epicsLoadLibrary(const char *name) { MODULE_ID m = 0; int fd; @@ -54,7 +54,7 @@ epicsShareFunc void * epicsLoadLibrary(const char *name) return m; } -epicsShareFunc const char *epicsLoadError(void) +LIBCOM_API const char *epicsLoadError(void) { if (oldmsg) free(oldmsg); diff --git a/modules/libcom/src/osi/os/vxWorks/osdMessageQueue.cpp b/modules/libcom/src/osi/os/vxWorks/osdMessageQueue.cpp index 89c2745ed..caabc292d 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdMessageQueue.cpp +++ b/modules/libcom/src/osi/os/vxWorks/osdMessageQueue.cpp @@ -13,13 +13,12 @@ * 630 252 4793 */ -#define epicsExportSharedSymbols #include #include "epicsMessageQueue.h" extern "C" int sysClkRateGet(void); -epicsShareFunc int epicsShareAPI epicsMessageQueueSendWithTimeout( +LIBCOM_API int epicsStdCall epicsMessageQueueSendWithTimeout( epicsMessageQueueId id, void *message, unsigned int messageSize, @@ -36,7 +35,7 @@ epicsShareFunc int epicsShareAPI epicsMessageQueueSendWithTimeout( return msgQSend((MSG_Q_ID)id, (char *)message, messageSize, ticks, MSG_PRI_NORMAL); } -epicsShareFunc int epicsShareAPI epicsMessageQueueReceiveWithTimeout( +LIBCOM_API int epicsStdCall epicsMessageQueueReceiveWithTimeout( epicsMessageQueueId id, void *message, unsigned int size, diff --git a/modules/libcom/src/osi/os/vxWorks/osdPoolStatus.c b/modules/libcom/src/osi/os/vxWorks/osdPoolStatus.c index 06447c1f7..969a03c1c 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdPoolStatus.c +++ b/modules/libcom/src/osi/os/vxWorks/osdPoolStatus.c @@ -10,7 +10,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsThread.h" #include "osiPoolStatus.h" @@ -55,7 +54,7 @@ static void osdSufficentSpaceInPoolInit ( void *pArgIn ) /* * osiSufficentSpaceInPool () */ -epicsShareFunc int epicsShareAPI osiSufficentSpaceInPool ( size_t contiguousBlockSize ) +LIBCOM_API int epicsStdCall osiSufficentSpaceInPool ( size_t contiguousBlockSize ) { epicsThreadOnce ( &osdMaxBlockOnceler, osdSufficentSpaceInPoolInit, 0 ); diff --git a/modules/libcom/src/osi/os/vxWorks/osdProcess.c b/modules/libcom/src/osi/os/vxWorks/osdProcess.c index 2347a407c..6058bfae2 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdProcess.c +++ b/modules/libcom/src/osi/os/vxWorks/osdProcess.c @@ -22,11 +22,10 @@ #include -#define epicsExportSharedSymbols #include "osiProcess.h" #include "errlog.h" -epicsShareFunc osiGetUserNameReturn epicsShareAPI osiGetUserName (char *pBuf, unsigned bufSizeIn) +LIBCOM_API osiGetUserNameReturn epicsStdCall osiGetUserName (char *pBuf, unsigned bufSizeIn) { char pName[MAX_IDENTITY_LEN]; unsigned uiLength; @@ -49,7 +48,7 @@ epicsShareFunc osiGetUserNameReturn epicsShareAPI osiGetUserName (char *pBuf, un return osiGetUserNameSuccess; } -epicsShareFunc osiSpawnDetachedProcessReturn epicsShareAPI osiSpawnDetachedProcess +LIBCOM_API osiSpawnDetachedProcessReturn epicsStdCall osiSpawnDetachedProcess (const char *pProcessName, const char *pBaseExecutableName) { return osiSpawnDetachedProcessNoSupport; diff --git a/modules/libcom/src/osi/os/vxWorks/osdSignal.cpp b/modules/libcom/src/osi/os/vxWorks/osdSignal.cpp index 1157854aa..b06192175 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdSignal.cpp +++ b/modules/libcom/src/osi/os/vxWorks/osdSignal.cpp @@ -8,13 +8,12 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -#define epicsExportSharedSymbols #include "epicsSignal.h" /* * NOOP */ -epicsShareFunc void epicsShareAPI epicsSignalInstallSigHupIgnore ( void ) {} -epicsShareFunc void epicsShareAPI epicsSignalInstallSigPipeIgnore ( void ) {} -epicsShareFunc void epicsShareAPI epicsSignalInstallSigAlarmIgnore ( void ) {} -epicsShareFunc void epicsShareAPI epicsSignalRaiseSigAlarm ( struct epicsThreadOSD * /* threadId */ ) {} +LIBCOM_API void epicsStdCall epicsSignalInstallSigHupIgnore ( void ) {} +LIBCOM_API void epicsStdCall epicsSignalInstallSigPipeIgnore ( void ) {} +LIBCOM_API void epicsStdCall epicsSignalInstallSigAlarmIgnore ( void ) {} +LIBCOM_API void epicsStdCall epicsSignalRaiseSigAlarm ( struct epicsThreadOSD * /* threadId */ ) {} diff --git a/modules/libcom/src/osi/os/vxWorks/osdSock.c b/modules/libcom/src/osi/os/vxWorks/osdSock.c index a0f5e8ec5..2de74453b 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdSock.c +++ b/modules/libcom/src/osi/os/vxWorks/osdSock.c @@ -22,7 +22,6 @@ #include "errlog.h" -#define epicsExportSharedSymbols #include "osiSock.h" int osiSockAttach() @@ -34,7 +33,7 @@ void osiSockRelease() { } -epicsShareFunc SOCKET epicsShareAPI epicsSocketCreate ( +LIBCOM_API SOCKET epicsStdCall epicsSocketCreate ( int domain, int type, int protocol ) { SOCKET sock = socket ( domain, type, protocol ); @@ -44,7 +43,7 @@ epicsShareFunc SOCKET epicsShareAPI epicsSocketCreate ( return sock; } -epicsShareFunc int epicsShareAPI epicsSocketAccept ( +LIBCOM_API int epicsStdCall epicsSocketAccept ( int sock, struct sockaddr * pAddr, osiSocklen_t * addrlen ) { int newSock = accept ( sock, pAddr, addrlen ); @@ -54,7 +53,7 @@ epicsShareFunc int epicsShareAPI epicsSocketAccept ( return newSock; } -epicsShareFunc void epicsShareAPI epicsSocketDestroy ( SOCKET s ) +LIBCOM_API void epicsStdCall epicsSocketDestroy ( SOCKET s ) { int status = close ( s ); if ( status < 0 ) { @@ -70,7 +69,7 @@ epicsShareFunc void epicsShareAPI epicsSocketDestroy ( SOCKET s ) /* * ipAddrToHostName */ -epicsShareFunc unsigned epicsShareAPI ipAddrToHostName +LIBCOM_API unsigned epicsStdCall ipAddrToHostName (const struct in_addr *pAddr, char *pBuf, unsigned bufSize) { int status; @@ -112,7 +111,7 @@ epicsShareFunc unsigned epicsShareAPI ipAddrToHostName /* * hostToIPAddr () */ -epicsShareFunc int epicsShareAPI +LIBCOM_API int epicsStdCall hostToIPAddr(const char *pHostName, struct in_addr *pIPA) { int addr = hostGetByName ( (char *) pHostName ); diff --git a/modules/libcom/src/osi/os/vxWorks/osdThread.c b/modules/libcom/src/osi/os/vxWorks/osdThread.c index babdf11cf..32208fb3f 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdThread.c +++ b/modules/libcom/src/osi/os/vxWorks/osdThread.c @@ -50,7 +50,7 @@ #endif -epicsShareFunc void osdThreadHooksRun(epicsThreadId id); +LIBCOM_API void osdThreadHooksRun(epicsThreadId id); #if CPU_FAMILY == MC680X0 #define ARCH_STACK_FACTOR 1 @@ -457,7 +457,7 @@ void epicsThreadGetName (epicsThreadId id, char *name, size_t size) name[size-1] = '\0'; } -epicsShareFunc void epicsThreadMap ( EPICS_THREAD_HOOK_ROUTINE func ) +LIBCOM_API void epicsThreadMap ( EPICS_THREAD_HOOK_ROUTINE func ) { int noTasks = 0; int i; @@ -571,7 +571,7 @@ double epicsThreadSleepQuantum () return 1.0 / HZ; } -epicsShareFunc int epicsThreadGetCPUs(void) +LIBCOM_API int epicsThreadGetCPUs(void) { return 1; } diff --git a/modules/libcom/src/osi/os/vxWorks/osdThreadExtra.c b/modules/libcom/src/osi/os/vxWorks/osdThreadExtra.c index 0a7c7ae95..f4562802e 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdThreadExtra.c +++ b/modules/libcom/src/osi/os/vxWorks/osdThreadExtra.c @@ -9,8 +9,7 @@ /* Null default thread hooks for all platforms that do not do anything special */ -#define epicsExportSharedSymbols #include "epicsThread.h" -epicsShareDef EPICS_THREAD_HOOK_ROUTINE epicsThreadHookDefault; -epicsShareDef EPICS_THREAD_HOOK_ROUTINE epicsThreadHookMain; +EPICS_THREAD_HOOK_ROUTINE epicsThreadHookDefault; +EPICS_THREAD_HOOK_ROUTINE epicsThreadHookMain; diff --git a/modules/libcom/src/osi/osiClockTime.c b/modules/libcom/src/osi/osiClockTime.c index 4ccb7e399..43df98394 100644 --- a/modules/libcom/src/osi/osiClockTime.c +++ b/modules/libcom/src/osi/osiClockTime.c @@ -10,7 +10,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsEvent.h" #include "epicsExit.h" #include "epicsMutex.h" diff --git a/modules/libcom/src/osi/osiNTPTime.c b/modules/libcom/src/osi/osiNTPTime.c index d22df861b..3283040ed 100644 --- a/modules/libcom/src/osi/osiNTPTime.c +++ b/modules/libcom/src/osi/osiNTPTime.c @@ -18,7 +18,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsEvent.h" #include "epicsExit.h" #include "epicsTypes.h" diff --git a/modules/libcom/src/osi/osiPoolStatus.h b/modules/libcom/src/osi/osiPoolStatus.h index 197d5fc96..ee508883e 100644 --- a/modules/libcom/src/osi/osiPoolStatus.h +++ b/modules/libcom/src/osi/osiPoolStatus.h @@ -17,7 +17,7 @@ #define INC_osiPoolStatus_H #include -#include "shareLib.h" +#include "libComAPI.h" #ifdef __cplusplus extern "C" { @@ -35,7 +35,7 @@ extern "C" { * \param contiguousBlockSize Block size to check. * \return True if the requested memory should be available. */ -epicsShareFunc int epicsShareAPI osiSufficentSpaceInPool ( size_t contiguousBlockSize ); +LIBCOM_API int epicsStdCall osiSufficentSpaceInPool ( size_t contiguousBlockSize ); #ifdef __cplusplus } diff --git a/modules/libcom/src/osi/osiProcess.h b/modules/libcom/src/osi/osiProcess.h index eabff1e72..d0a7c21b1 100644 --- a/modules/libcom/src/osi/osiProcess.h +++ b/modules/libcom/src/osi/osiProcess.h @@ -16,7 +16,7 @@ * Author: Jeff Hill * */ -#include "shareLib.h" +#include "libComAPI.h" #ifdef __cplusplus extern "C" { @@ -25,7 +25,7 @@ extern "C" { typedef enum osiGetUserNameReturn { osiGetUserNameFail, osiGetUserNameSuccess} osiGetUserNameReturn; -epicsShareFunc osiGetUserNameReturn epicsShareAPI osiGetUserName (char *pBuf, unsigned bufSize); +LIBCOM_API osiGetUserNameReturn epicsStdCall osiGetUserName (char *pBuf, unsigned bufSize); /* * Spawn detached process with named executable, but return @@ -37,7 +37,7 @@ typedef enum osiSpawnDetachedProcessReturn { osiSpawnDetachedProcessSuccess, osiSpawnDetachedProcessNoSupport} osiSpawnDetachedProcessReturn; -epicsShareFunc osiSpawnDetachedProcessReturn epicsShareAPI osiSpawnDetachedProcess +LIBCOM_API osiSpawnDetachedProcessReturn epicsStdCall osiSpawnDetachedProcess (const char *pProcessName, const char *pBaseExecutableName); #ifdef __cplusplus diff --git a/modules/libcom/src/osi/osiSock.c b/modules/libcom/src/osi/osiSock.c index 8b4634caf..0683cd2fa 100644 --- a/modules/libcom/src/osi/osiSock.c +++ b/modules/libcom/src/osi/osiSock.c @@ -17,7 +17,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsAssert.h" #include "epicsSignal.h" #include "epicsStdio.h" @@ -32,7 +31,7 @@ * sockAddrAreIdentical() * (returns true if addresses are identical) */ -int epicsShareAPI sockAddrAreIdentical +int epicsStdCall sockAddrAreIdentical ( const osiSockAddr *plhs, const osiSockAddr *prhs ) { int match; @@ -59,7 +58,7 @@ int epicsShareAPI sockAddrAreIdentical * sockAddrToA() * (convert socket address to ASCII host name) */ -unsigned epicsShareAPI sockAddrToA ( +unsigned epicsStdCall sockAddrToA ( const struct sockaddr * paddr, char * pBuf, unsigned bufSize ) { if ( bufSize < 1 ) { @@ -90,7 +89,7 @@ unsigned epicsShareAPI sockAddrToA ( * ipAddrToA() * (convert IP address to ASCII host name) */ -unsigned epicsShareAPI ipAddrToA ( +unsigned epicsStdCall ipAddrToA ( const struct sockaddr_in * paddr, char * pBuf, unsigned bufSize ) { unsigned len = ipAddrToHostName ( @@ -116,7 +115,7 @@ unsigned epicsShareAPI ipAddrToA ( /* * sockAddrToDottedIP () */ -unsigned epicsShareAPI sockAddrToDottedIP ( +unsigned epicsStdCall sockAddrToDottedIP ( const struct sockaddr * paddr, char * pBuf, unsigned bufSize ) { if ( paddr->sa_family != AF_INET ) { @@ -142,7 +141,7 @@ unsigned epicsShareAPI sockAddrToDottedIP ( /* * ipAddrToDottedIP () */ -unsigned epicsShareAPI ipAddrToDottedIP ( +unsigned epicsStdCall ipAddrToDottedIP ( const struct sockaddr_in *paddr, char *pBuf, unsigned bufSize ) { static const char * pErrStr = ""; diff --git a/modules/libcom/src/osi/osiSock.h b/modules/libcom/src/osi/osiSock.h index 6e3b053c5..2a8589c33 100644 --- a/modules/libcom/src/osi/osiSock.h +++ b/modules/libcom/src/osi/osiSock.h @@ -15,7 +15,7 @@ #ifndef osiSockh #define osiSockh -#include "shareLib.h" +#include "libComAPI.h" #include "osdSock.h" #include "ellLib.h" @@ -27,15 +27,15 @@ struct sockaddr; struct sockaddr_in; struct in_addr; -epicsShareFunc SOCKET epicsShareAPI epicsSocketCreate ( +LIBCOM_API SOCKET epicsStdCall epicsSocketCreate ( int domain, int type, int protocol ); -epicsShareFunc int epicsShareAPI epicsSocketAccept ( +LIBCOM_API int epicsStdCall epicsSocketAccept ( int sock, struct sockaddr * pAddr, osiSocklen_t * addrlen ); -epicsShareFunc void epicsShareAPI epicsSocketDestroy ( +LIBCOM_API void epicsStdCall epicsSocketDestroy ( SOCKET ); -epicsShareFunc void epicsShareAPI +LIBCOM_API void epicsStdCall epicsSocketEnableAddressReuseDuringTimeWaitState ( SOCKET s ); -epicsShareFunc void epicsShareAPI +LIBCOM_API void epicsStdCall epicsSocketEnableAddressUseForDatagramFanout ( SOCKET s ); /* @@ -49,7 +49,7 @@ enum epicsSocketSystemCallInterruptMechanismQueryInfo { esscimqi_socketBothShutdownRequired, esscimqi_socketSigAlarmRequired /* NO LONGER USED/SUPPORTED */ }; -epicsShareFunc enum epicsSocketSystemCallInterruptMechanismQueryInfo +LIBCOM_API enum epicsSocketSystemCallInterruptMechanismQueryInfo epicsSocketSystemCallInterruptMechanismQuery (); #ifdef EPICS_PRIVATE_API @@ -58,7 +58,7 @@ epicsShareFunc enum epicsSocketSystemCallInterruptMechanismQueryInfo * of unsent data in the output queue. * Returns -1 if the information is not available. */ -epicsShareFunc int epicsSocketUnsentCount(SOCKET sock); +LIBCOM_API int epicsSocketUnsentCount(SOCKET sock); #endif /* @@ -72,7 +72,7 @@ epicsShareFunc int epicsSocketUnsentCount(SOCKET sock); * including the null termination, but always writes at least a * null ternminater in the string (if bufSize >= 1) */ -epicsShareFunc unsigned epicsShareAPI sockAddrToA ( +LIBCOM_API unsigned epicsStdCall sockAddrToA ( const struct sockaddr * paddr, char * pBuf, unsigned bufSize ); /* @@ -84,7 +84,7 @@ epicsShareFunc unsigned epicsShareAPI sockAddrToA ( * including the null termination, but always writes at least a * null ternminater in the string (if bufSize >= 1) */ -epicsShareFunc unsigned epicsShareAPI ipAddrToA ( +LIBCOM_API unsigned epicsStdCall ipAddrToA ( const struct sockaddr_in * pInetAddr, char * pBuf, unsigned bufSize ); /* @@ -95,7 +95,7 @@ epicsShareFunc unsigned epicsShareAPI ipAddrToA ( * including the null termination, but always writes at least a * null ternminater in the string (if bufSize >= 1) */ -epicsShareFunc unsigned epicsShareAPI sockAddrToDottedIP ( +LIBCOM_API unsigned epicsStdCall sockAddrToDottedIP ( const struct sockaddr * paddr, char * pBuf, unsigned bufSize ); /* @@ -106,7 +106,7 @@ epicsShareFunc unsigned epicsShareAPI sockAddrToDottedIP ( * including the null termination, but always writes at least a * null ternminater in the string (if bufSize >= 1) */ -epicsShareFunc unsigned epicsShareAPI ipAddrToDottedIP ( +LIBCOM_API unsigned epicsStdCall ipAddrToDottedIP ( const struct sockaddr_in * paddr, char * pBuf, unsigned bufSize ); /* @@ -118,7 +118,7 @@ epicsShareFunc unsigned epicsShareAPI ipAddrToDottedIP ( * * there are many OS specific implementation stubs for this routine */ -epicsShareFunc unsigned epicsShareAPI ipAddrToHostName ( +LIBCOM_API unsigned epicsStdCall ipAddrToHostName ( const struct in_addr * pAddr, char * pBuf, unsigned bufSize ); /* @@ -127,30 +127,30 @@ epicsShareFunc unsigned epicsShareAPI ipAddrToHostName ( * 2) look for raw number form of ip address with optional port * 3) look for valid host name with optional port */ -epicsShareFunc int epicsShareAPI aToIPAddr +LIBCOM_API int epicsStdCall aToIPAddr ( const char * pAddrString, unsigned short defaultPort, struct sockaddr_in * pIP); /* * attempt to convert ASCII host name string with optional port to an IP address */ -epicsShareFunc int epicsShareAPI hostToIPAddr +LIBCOM_API int epicsStdCall hostToIPAddr (const char *pHostName, struct in_addr *pIPA); /* * attach to BSD socket library */ -epicsShareFunc int epicsShareAPI osiSockAttach (void); /* returns T if success, else F */ +LIBCOM_API int epicsStdCall osiSockAttach (void); /* returns T if success, else F */ /* * release BSD socket library */ -epicsShareFunc void epicsShareAPI osiSockRelease (void); +LIBCOM_API void epicsStdCall osiSockRelease (void); /* * convert socket error numbers to a string */ -epicsShareFunc void epicsSocketConvertErrorToString ( +LIBCOM_API void epicsSocketConvertErrorToString ( char * pBuf, unsigned bufSize, int error ); -epicsShareFunc void epicsSocketConvertErrnoToString ( +LIBCOM_API void epicsSocketConvertErrnoToString ( char * pBuf, unsigned bufSize ); typedef union osiSockAddr { @@ -167,7 +167,7 @@ typedef struct osiSockAddrNode { * sockAddrAreIdentical() * (returns true if addresses are identical) */ -epicsShareFunc int epicsShareAPI sockAddrAreIdentical +LIBCOM_API int epicsStdCall sockAddrAreIdentical ( const osiSockAddr * plhs, const osiSockAddr * prhs ); /* @@ -188,7 +188,7 @@ epicsShareFunc int epicsShareAPI sockAddrAreIdentical * Any mutex locking required to protect pList is applied externally. * */ -epicsShareFunc void epicsShareAPI osiSockDiscoverBroadcastAddresses +LIBCOM_API void epicsStdCall osiSockDiscoverBroadcastAddresses (ELLLIST *pList, SOCKET socket, const osiSockAddr *pMatchAddr); /* @@ -207,7 +207,7 @@ epicsShareFunc void epicsShareAPI osiSockDiscoverBroadcastAddresses * to current code. After all CA repeaters have been restarted * this osi interface can be eliminated. */ -epicsShareFunc osiSockAddr epicsShareAPI osiLocalAddr (SOCKET socket); +LIBCOM_API osiSockAddr epicsStdCall osiLocalAddr (SOCKET socket); #ifdef __cplusplus } diff --git a/modules/libcom/src/pool/epicsThreadPool.h b/modules/libcom/src/pool/epicsThreadPool.h index 3416bb23a..a41017008 100644 --- a/modules/libcom/src/pool/epicsThreadPool.h +++ b/modules/libcom/src/pool/epicsThreadPool.h @@ -13,7 +13,7 @@ #include #include -#include "shareLib.h" +#include "libComAPI.h" #include "errMdef.h" #define S_pool_jobBusy (M_pool| 1) /*Job already queued or running*/ @@ -59,24 +59,24 @@ typedef struct epicsJob epicsJob; * This much be done to preserve future compatibility * when new options are added. */ -epicsShareFunc void epicsThreadPoolConfigDefaults(epicsThreadPoolConfig *); +LIBCOM_API void epicsThreadPoolConfigDefaults(epicsThreadPoolConfig *); /* fetch or create a thread pool which can be shared with other users. * may return NULL for allocation failures */ -epicsShareFunc epicsThreadPool* epicsThreadPoolGetShared(epicsThreadPoolConfig *opts); -epicsShareFunc void epicsThreadPoolReleaseShared(epicsThreadPool *pool); +LIBCOM_API epicsThreadPool* epicsThreadPoolGetShared(epicsThreadPoolConfig *opts); +LIBCOM_API void epicsThreadPoolReleaseShared(epicsThreadPool *pool); /* If opts is NULL then defaults are used. * The opts pointer is not stored by this call, and may exist on the stack. */ -epicsShareFunc epicsThreadPool* epicsThreadPoolCreate(epicsThreadPoolConfig *opts); +LIBCOM_API epicsThreadPool* epicsThreadPoolCreate(epicsThreadPoolConfig *opts); /* Blocks until all worker threads have stopped. * Any jobs still attached to this pool receive a callback with EPICSJOB_CLEANUP * and are then orphaned. */ -epicsShareFunc void epicsThreadPoolDestroy(epicsThreadPool *); +LIBCOM_API void epicsThreadPoolDestroy(epicsThreadPool *); /* pool control options */ typedef enum { @@ -84,7 +84,7 @@ typedef enum { epicsThreadPoolQueueRun /* val==0 prevents workers from running jobs, 1 is default */ } epicsThreadPoolOption; -epicsShareFunc void epicsThreadPoolControl(epicsThreadPool* pool, +LIBCOM_API void epicsThreadPoolControl(epicsThreadPool* pool, epicsThreadPoolOption opt, unsigned int val); @@ -94,7 +94,7 @@ epicsShareFunc void epicsThreadPoolControl(epicsThreadPool* pool, * timeout<0 waits forever, timeout==0 polls, timeout>0 waits at most one timeout period * Returns 0 for success or non-zero on error (timeout is ETIMEOUT) */ -epicsShareFunc int epicsThreadPoolWait(epicsThreadPool* pool, double timeout); +LIBCOM_API int epicsThreadPoolWait(epicsThreadPool* pool, double timeout); /* Per job operations */ @@ -105,7 +105,7 @@ epicsShareFunc int epicsThreadPoolWait(epicsThreadPool* pool, double timeout); * will be the epicsJob* */ #define EPICSJOB_SELF epicsJobArgSelfMagic -epicsShareExtern void* epicsJobArgSelfMagic; +LIBCOM_API extern void* epicsJobArgSelfMagic; /* Creates, but does not add, a new job. * If pool is NULL then the job is not associated with any pool and @@ -113,7 +113,7 @@ epicsShareExtern void* epicsJobArgSelfMagic; * Safe to call from a running job function. * Returns a new job pointer, or NULL on error. */ -epicsShareFunc epicsJob* epicsJobCreate(epicsThreadPool* pool, +LIBCOM_API epicsJob* epicsJobCreate(epicsThreadPool* pool, epicsJobFunction cb, void* user); @@ -121,7 +121,7 @@ epicsShareFunc epicsJob* epicsJobCreate(epicsThreadPool* pool, * Job may not be immediately free'd. * Safe to call from a running job function. */ -epicsShareFunc void epicsJobDestroy(epicsJob*); +LIBCOM_API void epicsJobDestroy(epicsJob*); /* Move the job to a different pool. * If pool is NULL then the job will no longer be associated @@ -129,13 +129,13 @@ epicsShareFunc void epicsJobDestroy(epicsJob*); * Not thread safe. Job must not be running or queued. * returns 0 on success, non-zero on error. */ -epicsShareFunc int epicsJobMove(epicsJob* job, epicsThreadPool* pool); +LIBCOM_API int epicsJobMove(epicsJob* job, epicsThreadPool* pool); /* Adds the job to the run queue * Safe to call from a running job function. * returns 0 for success, non-zero on error. */ -epicsShareFunc int epicsJobQueue(epicsJob*); +LIBCOM_API int epicsJobQueue(epicsJob*); /* Remove a job from the run queue if it is queued. * Safe to call from a running job function. @@ -143,15 +143,15 @@ epicsShareFunc int epicsJobQueue(epicsJob*); * 1 if job already ran, is running, or was not queued before, * Other non-zero on error */ -epicsShareFunc int epicsJobUnqueue(epicsJob*); +LIBCOM_API int epicsJobUnqueue(epicsJob*); /* Mostly useful for debugging */ -epicsShareFunc void epicsThreadPoolReport(epicsThreadPool *pool, FILE *fd); +LIBCOM_API void epicsThreadPoolReport(epicsThreadPool *pool, FILE *fd); /* Current number of active workers. May be less than the maximum */ -epicsShareFunc unsigned int epicsThreadPoolNThreads(epicsThreadPool *); +LIBCOM_API unsigned int epicsThreadPoolNThreads(epicsThreadPool *); #ifdef __cplusplus } diff --git a/modules/libcom/src/pool/poolJob.c b/modules/libcom/src/pool/poolJob.c index 8e86fb768..8ac5e379e 100644 --- a/modules/libcom/src/pool/poolJob.c +++ b/modules/libcom/src/pool/poolJob.c @@ -9,7 +9,6 @@ #include #include -#define epicsExportSharedSymbols #include "dbDefs.h" #include "errlog.h" diff --git a/modules/libcom/src/pool/threadPool.c b/modules/libcom/src/pool/threadPool.c index 3cfd06606..07d0e0a39 100644 --- a/modules/libcom/src/pool/threadPool.c +++ b/modules/libcom/src/pool/threadPool.c @@ -9,7 +9,6 @@ #include #include -#define epicsExportSharedSymbols #include "dbDefs.h" #include "errlog.h" @@ -326,7 +325,7 @@ void sharedPoolsInit(void* unused) sharedPoolsGuard = epicsMutexMustCreate(); } -epicsShareFunc epicsThreadPool* epicsThreadPoolGetShared(epicsThreadPoolConfig *opts) +LIBCOM_API epicsThreadPool* epicsThreadPoolGetShared(epicsThreadPoolConfig *opts) { ELLNODE *node; epicsThreadPool *cur; @@ -383,7 +382,7 @@ epicsShareFunc epicsThreadPool* epicsThreadPoolGetShared(epicsThreadPoolConfig * return cur; } -epicsShareFunc void epicsThreadPoolReleaseShared(epicsThreadPool *pool) +LIBCOM_API void epicsThreadPoolReleaseShared(epicsThreadPool *pool) { if (!pool) return; diff --git a/modules/libcom/src/ring/epicsRingBytes.c b/modules/libcom/src/ring/epicsRingBytes.c index ab048e467..30a0b9d67 100644 --- a/modules/libcom/src/ring/epicsRingBytes.c +++ b/modules/libcom/src/ring/epicsRingBytes.c @@ -20,7 +20,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsSpin.h" #include "dbDefs.h" #include "epicsRingBytes.h" @@ -42,7 +41,7 @@ typedef struct ringPvt { volatile char buffer[1]; /* actually larger */ }ringPvt; -epicsShareFunc epicsRingBytesId epicsShareAPI epicsRingBytesCreate(int size) +LIBCOM_API epicsRingBytesId epicsStdCall epicsRingBytesCreate(int size) { ringPvt *pring = malloc(sizeof(ringPvt) + size + SLOP); if(!pring) @@ -55,7 +54,7 @@ epicsShareFunc epicsRingBytesId epicsShareAPI epicsRingBytesCreate(int size) return((void *)pring); } -epicsShareFunc epicsRingBytesId epicsShareAPI epicsRingBytesLockedCreate(int size) +LIBCOM_API epicsRingBytesId epicsStdCall epicsRingBytesLockedCreate(int size) { ringPvt *pring = (ringPvt *)epicsRingBytesCreate(size); if(!pring) @@ -64,14 +63,14 @@ epicsShareFunc epicsRingBytesId epicsShareAPI epicsRingBytesLockedCreate(int si return((void *)pring); } -epicsShareFunc void epicsShareAPI epicsRingBytesDelete(epicsRingBytesId id) +LIBCOM_API void epicsStdCall epicsRingBytesDelete(epicsRingBytesId id) { ringPvt *pring = (ringPvt *)id; if (pring->lock) epicsSpinDestroy(pring->lock); free((void *)pring); } -epicsShareFunc int epicsShareAPI epicsRingBytesGet( +LIBCOM_API int epicsStdCall epicsRingBytesGet( epicsRingBytesId id, char *value,int nbytes) { ringPvt *pring = (ringPvt *)id; @@ -115,7 +114,7 @@ epicsShareFunc int epicsShareAPI epicsRingBytesGet( return nbytes; } -epicsShareFunc int epicsShareAPI epicsRingBytesPut( +LIBCOM_API int epicsStdCall epicsRingBytesPut( epicsRingBytesId id, char *value,int nbytes) { ringPvt *pring = (ringPvt *)id; @@ -167,7 +166,7 @@ epicsShareFunc int epicsShareAPI epicsRingBytesPut( return nbytes; } -epicsShareFunc void epicsShareAPI epicsRingBytesFlush(epicsRingBytesId id) +LIBCOM_API void epicsStdCall epicsRingBytesFlush(epicsRingBytesId id) { ringPvt *pring = (ringPvt *)id; @@ -176,7 +175,7 @@ epicsShareFunc void epicsShareAPI epicsRingBytesFlush(epicsRingBytesId id) if (pring->lock) epicsSpinUnlock(pring->lock); } -epicsShareFunc int epicsShareAPI epicsRingBytesFreeBytes(epicsRingBytesId id) +LIBCOM_API int epicsStdCall epicsRingBytesFreeBytes(epicsRingBytesId id) { ringPvt *pring = (ringPvt *)id; int nextGet, nextPut; @@ -192,7 +191,7 @@ epicsShareFunc int epicsShareAPI epicsRingBytesFreeBytes(epicsRingBytesId id) return pring->size - nextPut + nextGet - SLOP; } -epicsShareFunc int epicsShareAPI epicsRingBytesUsedBytes(epicsRingBytesId id) +LIBCOM_API int epicsStdCall epicsRingBytesUsedBytes(epicsRingBytesId id) { ringPvt *pring = (ringPvt *)id; int nextGet, nextPut; @@ -209,14 +208,14 @@ epicsShareFunc int epicsShareAPI epicsRingBytesUsedBytes(epicsRingBytesId id) return used; } -epicsShareFunc int epicsShareAPI epicsRingBytesSize(epicsRingBytesId id) +LIBCOM_API int epicsStdCall epicsRingBytesSize(epicsRingBytesId id) { ringPvt *pring = (ringPvt *)id; return pring->size - SLOP; } -epicsShareFunc int epicsShareAPI epicsRingBytesIsEmpty(epicsRingBytesId id) +LIBCOM_API int epicsStdCall epicsRingBytesIsEmpty(epicsRingBytesId id) { ringPvt *pring = (ringPvt *)id; int isEmpty; @@ -228,18 +227,18 @@ epicsShareFunc int epicsShareAPI epicsRingBytesIsEmpty(epicsRingBytesId id) return isEmpty; } -epicsShareFunc int epicsShareAPI epicsRingBytesIsFull(epicsRingBytesId id) +LIBCOM_API int epicsStdCall epicsRingBytesIsFull(epicsRingBytesId id) { return (epicsRingBytesFreeBytes(id) <= 0); } -epicsShareFunc int epicsShareAPI epicsRingBytesHighWaterMark(epicsRingBytesIdConst id) +LIBCOM_API int epicsStdCall epicsRingBytesHighWaterMark(epicsRingBytesIdConst id) { ringPvt *pring = (ringPvt *)id; return pring->highWaterMark; } -epicsShareFunc void epicsShareAPI epicsRingBytesResetHighWaterMark(epicsRingBytesId id) +LIBCOM_API void epicsStdCall epicsRingBytesResetHighWaterMark(epicsRingBytesId id) { ringPvt *pring = (ringPvt *)id; int used; diff --git a/modules/libcom/src/ring/epicsRingBytes.h b/modules/libcom/src/ring/epicsRingBytes.h index 870d44093..e7a2124ac 100644 --- a/modules/libcom/src/ring/epicsRingBytes.h +++ b/modules/libcom/src/ring/epicsRingBytes.h @@ -31,7 +31,7 @@ extern "C" { #endif -#include "shareLib.h" +#include "libComAPI.h" /** \brief An identifier for a ring buffer */ typedef void *epicsRingBytesId; @@ -42,18 +42,18 @@ typedef void const *epicsRingBytesIdConst; * \param nbytes Size of ring buffer to create * \return Ring buffer Id or NULL on failure */ -epicsShareFunc epicsRingBytesId epicsShareAPI epicsRingBytesCreate(int nbytes); +LIBCOM_API epicsRingBytesId epicsStdCall epicsRingBytesCreate(int nbytes); /** * \brief Create a new ring buffer, secured by a spinlock * \param nbytes Size of ring buffer to create * \return Ring buffer Id or NULL on failure */ -epicsShareFunc epicsRingBytesId epicsShareAPI epicsRingBytesLockedCreate(int nbytes); +LIBCOM_API epicsRingBytesId epicsStdCall epicsRingBytesLockedCreate(int nbytes); /** * \brief Delete the ring buffer and free any associated memory * \param id RingbufferID returned by epicsRingBytesCreate() */ -epicsShareFunc void epicsShareAPI epicsRingBytesDelete(epicsRingBytesId id); +LIBCOM_API void epicsStdCall epicsRingBytesDelete(epicsRingBytesId id); /** * \brief Read data out of the ring buffer * \param id RingbufferID returned by epicsRingBytesCreate() @@ -61,7 +61,7 @@ epicsShareFunc void epicsShareAPI epicsRingBytesDelete(epicsRingBytesId id); * \param nbytes Maximum number of bytes to get * \return The number of bytes actually fetched */ -epicsShareFunc int epicsShareAPI epicsRingBytesGet( +LIBCOM_API int epicsStdCall epicsRingBytesGet( epicsRingBytesId id, char *value,int nbytes); /** * \brief Write data into the ring buffer @@ -70,45 +70,45 @@ epicsShareFunc int epicsShareAPI epicsRingBytesGet( * \param nbytes How many bytes to put * \return The number of bytes actually stored, zero if not enough space */ -epicsShareFunc int epicsShareAPI epicsRingBytesPut( +LIBCOM_API int epicsStdCall epicsRingBytesPut( epicsRingBytesId id, char *value,int nbytes); /** * \brief Make the ring buffer empty * \param id RingbufferID returned by epicsRingBytesCreate() * \note Should only be used when both gets and puts are locked out. */ -epicsShareFunc void epicsShareAPI epicsRingBytesFlush(epicsRingBytesId id); +LIBCOM_API void epicsStdCall epicsRingBytesFlush(epicsRingBytesId id); /** * \brief Return the number of free bytes in the ring buffer * \param id RingbufferID returned by epicsRingBytesCreate() * \return The number of free bytes in the ring buffer */ -epicsShareFunc int epicsShareAPI epicsRingBytesFreeBytes(epicsRingBytesId id); +LIBCOM_API int epicsStdCall epicsRingBytesFreeBytes(epicsRingBytesId id); /** * \brief Return the number of bytes currently stored in the ring buffer * \param id RingbufferID returned by epicsRingBytesCreate() * \return The number of bytes currently stored in the ring buffer */ -epicsShareFunc int epicsShareAPI epicsRingBytesUsedBytes(epicsRingBytesId id); +LIBCOM_API int epicsStdCall epicsRingBytesUsedBytes(epicsRingBytesId id); /** * \brief Return the size of the ring buffer * \param id RingbufferID returned by epicsRingBytesCreate() * \return Return the size of the ring buffer, i.e., nbytes specified in * the call to epicsRingBytesCreate(). */ -epicsShareFunc int epicsShareAPI epicsRingBytesSize(epicsRingBytesId id); +LIBCOM_API int epicsStdCall epicsRingBytesSize(epicsRingBytesId id); /** * \brief Test if the ring buffer is currently empty. * \param id RingbufferID returned by epicsRingBytesCreate() * \return 1 if the buffer is empty, otherwise 0 */ -epicsShareFunc int epicsShareAPI epicsRingBytesIsEmpty(epicsRingBytesId id); +LIBCOM_API int epicsStdCall epicsRingBytesIsEmpty(epicsRingBytesId id); /** * \brief Test if the ring buffer is currently full. * \param id RingbufferID returned by epicsRingBytesCreate() * \return 1 if the buffer is full, otherwise 0 */ -epicsShareFunc int epicsShareAPI epicsRingBytesIsFull(epicsRingBytesId id); +LIBCOM_API int epicsStdCall epicsRingBytesIsFull(epicsRingBytesId id); /** * \brief See how full a ring buffer has been since it was last checked. * @@ -118,14 +118,14 @@ epicsShareFunc int epicsShareAPI epicsRingBytesIsFull(epicsRingBytesId id); * \param id RingbufferID returned by epicsRingBytesCreate() * \return Actual Highwater mark */ -epicsShareFunc int epicsShareAPI epicsRingBytesHighWaterMark(epicsRingBytesIdConst id); +LIBCOM_API int epicsStdCall epicsRingBytesHighWaterMark(epicsRingBytesIdConst id); /** * \brief Reset the Highwater mark of the ring buffer. * * The Highwater mark will be set to the current usage * \param id RingbufferID returned by epicsRingBytesCreate() */ -epicsShareFunc void epicsShareAPI epicsRingBytesResetHighWaterMark(epicsRingBytesId id); +LIBCOM_API void epicsStdCall epicsRingBytesResetHighWaterMark(epicsRingBytesId id); #ifdef __cplusplus } diff --git a/modules/libcom/src/ring/epicsRingPointer.cpp b/modules/libcom/src/ring/epicsRingPointer.cpp index 709ab6509..81a26fe50 100644 --- a/modules/libcom/src/ring/epicsRingPointer.cpp +++ b/modules/libcom/src/ring/epicsRingPointer.cpp @@ -20,84 +20,83 @@ #include #include -#define epicsExportSharedSymbols #include "epicsRingPointer.h" typedef epicsRingPointer voidPointer; -epicsShareFunc epicsRingPointerId epicsShareAPI epicsRingPointerCreate(int size) +LIBCOM_API epicsRingPointerId epicsStdCall epicsRingPointerCreate(int size) { voidPointer *pvoidPointer = new voidPointer(size, false); return(reinterpret_cast(pvoidPointer)); } -epicsShareFunc epicsRingPointerId epicsShareAPI epicsRingPointerLockedCreate(int size) +LIBCOM_API epicsRingPointerId epicsStdCall epicsRingPointerLockedCreate(int size) { voidPointer *pvoidPointer = new voidPointer(size, true); return(reinterpret_cast(pvoidPointer)); } -epicsShareFunc void epicsShareAPI epicsRingPointerDelete(epicsRingPointerId id) +LIBCOM_API void epicsStdCall epicsRingPointerDelete(epicsRingPointerId id) { voidPointer *pvoidPointer = reinterpret_cast(id); delete pvoidPointer; } -epicsShareFunc void* epicsShareAPI epicsRingPointerPop(epicsRingPointerId id) +LIBCOM_API void* epicsStdCall epicsRingPointerPop(epicsRingPointerId id) { voidPointer *pvoidPointer = reinterpret_cast(id); return pvoidPointer->pop(); } -epicsShareFunc int epicsShareAPI epicsRingPointerPush(epicsRingPointerId id, void *p) +LIBCOM_API int epicsStdCall epicsRingPointerPush(epicsRingPointerId id, void *p) { voidPointer *pvoidPointer = reinterpret_cast(id); return((pvoidPointer->push(p) ? 1 : 0)); } -epicsShareFunc void epicsShareAPI epicsRingPointerFlush(epicsRingPointerId id) +LIBCOM_API void epicsStdCall epicsRingPointerFlush(epicsRingPointerId id) { voidPointer *pvoidPointer = reinterpret_cast(id); pvoidPointer->flush(); } -epicsShareFunc int epicsShareAPI epicsRingPointerGetFree(epicsRingPointerId id) +LIBCOM_API int epicsStdCall epicsRingPointerGetFree(epicsRingPointerId id) { voidPointer *pvoidPointer = reinterpret_cast(id); return(pvoidPointer->getFree()); } -epicsShareFunc int epicsShareAPI epicsRingPointerGetUsed(epicsRingPointerId id) +LIBCOM_API int epicsStdCall epicsRingPointerGetUsed(epicsRingPointerId id) { voidPointer *pvoidPointer = reinterpret_cast(id); return(pvoidPointer->getUsed()); } -epicsShareFunc int epicsShareAPI epicsRingPointerGetSize(epicsRingPointerId id) +LIBCOM_API int epicsStdCall epicsRingPointerGetSize(epicsRingPointerId id) { voidPointer *pvoidPointer = reinterpret_cast(id); return(pvoidPointer->getSize()); } -epicsShareFunc int epicsShareAPI epicsRingPointerIsEmpty(epicsRingPointerId id) +LIBCOM_API int epicsStdCall epicsRingPointerIsEmpty(epicsRingPointerId id) { voidPointer *pvoidPointer = reinterpret_cast(id); return((pvoidPointer->isEmpty()) ? 1 : 0); } -epicsShareFunc int epicsShareAPI epicsRingPointerIsFull(epicsRingPointerId id) +LIBCOM_API int epicsStdCall epicsRingPointerIsFull(epicsRingPointerId id) { voidPointer *pvoidPointer = reinterpret_cast(id); return((pvoidPointer->isFull()) ? 1 : 0); } -epicsShareFunc int epicsShareAPI epicsRingPointerGetHighWaterMark(epicsRingPointerIdConst id) +LIBCOM_API int epicsStdCall epicsRingPointerGetHighWaterMark(epicsRingPointerIdConst id) { voidPointer const *pvoidPointer = reinterpret_cast(id); return(pvoidPointer->getHighWaterMark()); } -epicsShareFunc void epicsShareAPI epicsRingPointerResetHighWaterMark(epicsRingPointerId id) +LIBCOM_API void epicsStdCall epicsRingPointerResetHighWaterMark(epicsRingPointerId id) { voidPointer *pvoidPointer = reinterpret_cast(id); pvoidPointer->resetHighWaterMark(); diff --git a/modules/libcom/src/ring/epicsRingPointer.h b/modules/libcom/src/ring/epicsRingPointer.h index 8ecdcec81..eaa7b335b 100644 --- a/modules/libcom/src/ring/epicsRingPointer.h +++ b/modules/libcom/src/ring/epicsRingPointer.h @@ -29,7 +29,7 @@ #include "epicsSpin.h" -#include "shareLib.h" +#include "libComAPI.h" #ifdef __cplusplus /** @@ -122,69 +122,69 @@ typedef void const *epicsRingPointerIdConst; * \param size Size of ring buffer to create * \return Ring buffer identifier or NULL on failure */ -epicsShareFunc epicsRingPointerId epicsShareAPI epicsRingPointerCreate(int size); +LIBCOM_API epicsRingPointerId epicsStdCall epicsRingPointerCreate(int size); /** * \brief Create a new ring buffer, secured by a spinlock * \param size Size of ring buffer to create * \return Ring buffer identifier or NULL on failure */ -epicsShareFunc epicsRingPointerId epicsShareAPI epicsRingPointerLockedCreate(int size); +LIBCOM_API epicsRingPointerId epicsStdCall epicsRingPointerLockedCreate(int size); /** * \brief Delete the ring buffer and free any associated memory * \param id Ring buffer identifier */ -epicsShareFunc void epicsShareAPI epicsRingPointerDelete(epicsRingPointerId id); +LIBCOM_API void epicsStdCall epicsRingPointerDelete(epicsRingPointerId id); /** * \brief Push pointer into the ring buffer * \param id Ring buffer identifier * \param p Pointer to be pushed to the ring * \return 1 if the pointer was successfully pushed, 0 if the buffer was full */ -epicsShareFunc int epicsShareAPI epicsRingPointerPush(epicsRingPointerId id,void *p); +LIBCOM_API int epicsStdCall epicsRingPointerPush(epicsRingPointerId id,void *p); /** * \brief Take an element off the ring * \param id Ring buffer identifier * \return The pointer from the buffer, or NULL if the ring was empty */ -epicsShareFunc void* epicsShareAPI epicsRingPointerPop(epicsRingPointerId id) ; +LIBCOM_API void* epicsStdCall epicsRingPointerPop(epicsRingPointerId id) ; /** * \brief Remove all elements from the ring * \param id Ring buffer identifier * \note If this operation is performed on a ring buffer of the unsecured * kind, all access to the ring should be locked. */ -epicsShareFunc void epicsShareAPI epicsRingPointerFlush(epicsRingPointerId id); +LIBCOM_API void epicsStdCall epicsRingPointerFlush(epicsRingPointerId id); /** * \brief Return the amount of empty space in the ring buffer * \param id Ring buffer identifier * \return The number of additional elements it could hold. */ -epicsShareFunc int epicsShareAPI epicsRingPointerGetFree(epicsRingPointerId id); +LIBCOM_API int epicsStdCall epicsRingPointerGetFree(epicsRingPointerId id); /** * \brief Return the number of elements stored in the ring buffer * \param id Ring buffer identifier * \return The number of elements stored in the ring buffer */ -epicsShareFunc int epicsShareAPI epicsRingPointerGetUsed(epicsRingPointerId id); +LIBCOM_API int epicsStdCall epicsRingPointerGetUsed(epicsRingPointerId id); /** * \brief Return the size of the ring * \param id Ring buffer identifier * \return The size of the ring buffer, i.e. the value of \c size * given when the ring was created. */ -epicsShareFunc int epicsShareAPI epicsRingPointerGetSize(epicsRingPointerId id); +LIBCOM_API int epicsStdCall epicsRingPointerGetSize(epicsRingPointerId id); /** * \brief Check if the ring buffer is currently empty * \param id Ring buffer identifier * \return 1 if the ring is empty, otherwise 0 */ -epicsShareFunc int epicsShareAPI epicsRingPointerIsEmpty(epicsRingPointerId id); +LIBCOM_API int epicsStdCall epicsRingPointerIsEmpty(epicsRingPointerId id); /** * \brief Check if the ring buffer is currently full * \param id Ring buffer identifier * \return 1 if the ring buffer is full, otherwise 0 */ -epicsShareFunc int epicsShareAPI epicsRingPointerIsFull(epicsRingPointerId id); +LIBCOM_API int epicsStdCall epicsRingPointerIsFull(epicsRingPointerId id); /** * \brief Get the Highwater mark of the ring buffer * @@ -194,14 +194,14 @@ epicsShareFunc int epicsShareAPI epicsRingPointerIsFull(epicsRingPointerId id); * \param id Ring buffer identifier * \return Actual Highwater mark */ -epicsShareFunc int epicsShareAPI epicsRingPointerGetHighWaterMark(epicsRingPointerIdConst id); +LIBCOM_API int epicsStdCall epicsRingPointerGetHighWaterMark(epicsRingPointerIdConst id); /** * \brief Reset the Highwater mark of the ring buffer * * The Highwater mark will be set to the current usage * \param id Ring buffer identifier */ -epicsShareFunc void epicsShareAPI epicsRingPointerResetHighWaterMark(epicsRingPointerId id); +LIBCOM_API void epicsStdCall epicsRingPointerResetHighWaterMark(epicsRingPointerId id); /* This routine was incorrectly named in previous releases */ #define epicsRingPointerSize epicsRingPointerGetSize diff --git a/modules/libcom/src/taskwd/taskwd.c b/modules/libcom/src/taskwd/taskwd.c index 4f30a5a5d..c1d123876 100644 --- a/modules/libcom/src/taskwd/taskwd.c +++ b/modules/libcom/src/taskwd/taskwd.c @@ -17,7 +17,6 @@ #include #include -#define epicsExportSharedSymbols #include "cantProceed.h" #include "dbDefs.h" #include "epicsEvent.h" @@ -356,7 +355,7 @@ void taskwdAnyRemove(void *key) /* Report function */ -epicsShareFunc void taskwdShow(int level) +LIBCOM_API void taskwdShow(int level) { struct tNode *pt; int mCount, fCount, tCount; diff --git a/modules/libcom/src/taskwd/taskwd.h b/modules/libcom/src/taskwd/taskwd.h index 4d5274d56..172995e1e 100644 --- a/modules/libcom/src/taskwd/taskwd.h +++ b/modules/libcom/src/taskwd/taskwd.h @@ -17,7 +17,7 @@ #define INC_taskwd_H #include "epicsThread.h" -#include "shareLib.h" +#include "libComAPI.h" #ifdef __cplusplus extern "C" { @@ -25,15 +25,15 @@ extern "C" { /* Initialization, optional */ -epicsShareFunc void taskwdInit(void); +LIBCOM_API void taskwdInit(void); /* For tasks to be monitored */ typedef void (*TASKWDFUNC)(void *usr); -epicsShareFunc void taskwdInsert(epicsThreadId tid, +LIBCOM_API void taskwdInsert(epicsThreadId tid, TASKWDFUNC callback, void *usr); -epicsShareFunc void taskwdRemove(epicsThreadId tid); +LIBCOM_API void taskwdRemove(epicsThreadId tid); /* Monitoring API */ @@ -43,20 +43,20 @@ typedef struct { void (*remove)(void *usr, epicsThreadId tid); } taskwdMonitor; -epicsShareFunc void taskwdMonitorAdd(const taskwdMonitor *funcs, void *usr); -epicsShareFunc void taskwdMonitorDel(const taskwdMonitor *funcs, void *usr); +LIBCOM_API void taskwdMonitorAdd(const taskwdMonitor *funcs, void *usr); +LIBCOM_API void taskwdMonitorDel(const taskwdMonitor *funcs, void *usr); /* Old monitoring API, deprecated */ typedef void (*TASKWDANYFUNC)(void *usr, epicsThreadId tid); -epicsShareFunc void taskwdAnyInsert(void *key, +LIBCOM_API void taskwdAnyInsert(void *key, TASKWDANYFUNC callback, void *usr); -epicsShareFunc void taskwdAnyRemove(void *key); +LIBCOM_API void taskwdAnyRemove(void *key); /* Report function */ -epicsShareFunc void taskwdShow(int level); +LIBCOM_API void taskwdShow(int level); #ifdef __cplusplus diff --git a/modules/libcom/src/timer/epicsTimer.cpp b/modules/libcom/src/timer/epicsTimer.cpp index e55280e7e..44b9a30d5 100644 --- a/modules/libcom/src/timer/epicsTimer.cpp +++ b/modules/libcom/src/timer/epicsTimer.cpp @@ -15,7 +15,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsMath.h" #include "epicsTimer.h" #include "epicsGuard.h" @@ -109,7 +108,7 @@ void epicsTimerQueuePassiveForC::destroy () delete this; } -epicsShareFunc epicsTimerNotify::expireStatus::expireStatus ( restart_t restart ) : +LIBCOM_API epicsTimerNotify::expireStatus::expireStatus ( restart_t restart ) : delay ( - DBL_MAX ) { if ( restart != noRestart ) { @@ -118,7 +117,7 @@ epicsShareFunc epicsTimerNotify::expireStatus::expireStatus ( restart_t restart } } -epicsShareFunc epicsTimerNotify::expireStatus::expireStatus +LIBCOM_API epicsTimerNotify::expireStatus::expireStatus ( restart_t restartIn, const double & expireDelaySec ) : delay ( expireDelaySec ) { @@ -132,12 +131,12 @@ epicsShareFunc epicsTimerNotify::expireStatus::expireStatus } } -epicsShareFunc bool epicsTimerNotify::expireStatus::restart () const +LIBCOM_API bool epicsTimerNotify::expireStatus::restart () const { return this->delay >= 0.0 && finite(this->delay); } -epicsShareFunc double epicsTimerNotify::expireStatus::expirationDelay () const +LIBCOM_API double epicsTimerNotify::expireStatus::expirationDelay () const { if ( this->delay < 0.0 || !finite(this->delay) ) { throw std::logic_error @@ -146,7 +145,7 @@ epicsShareFunc double epicsTimerNotify::expireStatus::expirationDelay () const return this->delay; } -extern "C" epicsTimerQueuePassiveId epicsShareAPI +extern "C" epicsTimerQueuePassiveId epicsStdCall epicsTimerQueuePassiveCreate ( epicsTimerQueueNotifyReschedule pRescheduleCallbackIn, epicsTimerQueueNotifyQuantum pSleepQuantumCallbackIn, @@ -163,13 +162,13 @@ extern "C" epicsTimerQueuePassiveId epicsShareAPI } } -extern "C" void epicsShareAPI +extern "C" void epicsStdCall epicsTimerQueuePassiveDestroy ( epicsTimerQueuePassiveId pQueue ) { pQueue->destroy (); } -extern "C" double epicsShareAPI +extern "C" double epicsStdCall epicsTimerQueuePassiveProcess ( epicsTimerQueuePassiveId pQueue ) { try { @@ -180,7 +179,7 @@ extern "C" double epicsShareAPI } } -extern "C" epicsTimerId epicsShareAPI epicsTimerQueuePassiveCreateTimer ( +extern "C" epicsTimerId epicsStdCall epicsTimerQueuePassiveCreateTimer ( epicsTimerQueuePassiveId pQueue, epicsTimerCallback pCallback, void *pArg ) { try { @@ -191,19 +190,19 @@ extern "C" epicsTimerId epicsShareAPI epicsTimerQueuePassiveCreateTimer ( } } -extern "C" epicsShareFunc void epicsShareAPI epicsTimerQueuePassiveDestroyTimer ( +extern "C" LIBCOM_API void epicsStdCall epicsTimerQueuePassiveDestroyTimer ( epicsTimerQueuePassiveId /* pQueue */, epicsTimerId pTmr ) { pTmr->destroy (); } -extern "C" void epicsShareAPI epicsTimerQueuePassiveShow ( +extern "C" void epicsStdCall epicsTimerQueuePassiveShow ( epicsTimerQueuePassiveId pQueue, unsigned int level ) { pQueue->show ( level ); } -extern "C" epicsTimerQueueId epicsShareAPI +extern "C" epicsTimerQueueId epicsStdCall epicsTimerQueueAllocate ( int okToShare, unsigned int threadPriority ) { try { @@ -218,12 +217,12 @@ extern "C" epicsTimerQueueId epicsShareAPI } } -extern "C" void epicsShareAPI epicsTimerQueueRelease ( epicsTimerQueueId pQueue ) +extern "C" void epicsStdCall epicsTimerQueueRelease ( epicsTimerQueueId pQueue ) { pQueue->release (); } -extern "C" epicsTimerId epicsShareAPI epicsTimerQueueCreateTimer ( +extern "C" epicsTimerId epicsStdCall epicsTimerQueueCreateTimer ( epicsTimerQueueId pQueue, epicsTimerCallback pCallback, void *pArg ) { try { @@ -234,41 +233,41 @@ extern "C" epicsTimerId epicsShareAPI epicsTimerQueueCreateTimer ( } } -extern "C" void epicsShareAPI epicsTimerQueueShow ( +extern "C" void epicsStdCall epicsTimerQueueShow ( epicsTimerQueueId pQueue, unsigned int level ) { pQueue->show ( level ); } -extern "C" void epicsShareAPI epicsTimerQueueDestroyTimer ( +extern "C" void epicsStdCall epicsTimerQueueDestroyTimer ( epicsTimerQueueId /* pQueue */, epicsTimerId pTmr ) { pTmr->destroy (); } -extern "C" void epicsShareAPI epicsTimerStartTime ( +extern "C" void epicsStdCall epicsTimerStartTime ( epicsTimerId pTmr, const epicsTimeStamp *pTime ) { pTmr->start ( *pTmr, *pTime ); } -extern "C" void epicsShareAPI epicsTimerStartDelay ( +extern "C" void epicsStdCall epicsTimerStartDelay ( epicsTimerId pTmr, double delaySeconds ) { pTmr->start ( *pTmr, delaySeconds ); } -extern "C" void epicsShareAPI epicsTimerCancel ( epicsTimerId pTmr ) +extern "C" void epicsStdCall epicsTimerCancel ( epicsTimerId pTmr ) { pTmr->cancel (); } -extern "C" double epicsShareAPI epicsTimerGetExpireDelay ( epicsTimerId pTmr ) +extern "C" double epicsStdCall epicsTimerGetExpireDelay ( epicsTimerId pTmr ) { return pTmr->getExpireDelay (); } -extern "C" void epicsShareAPI epicsTimerShow ( +extern "C" void epicsStdCall epicsTimerShow ( epicsTimerId pTmr, unsigned int level ) { pTmr->timer::show ( level ); diff --git a/modules/libcom/src/timer/epicsTimer.h b/modules/libcom/src/timer/epicsTimer.h index 72270f273..02eebbbfb 100644 --- a/modules/libcom/src/timer/epicsTimer.h +++ b/modules/libcom/src/timer/epicsTimer.h @@ -16,7 +16,7 @@ #include -#include "shareLib.h" +#include "libComAPI.h" #include "epicsTime.h" #include "epicsThread.h" @@ -28,15 +28,15 @@ */ /* code using a timer must implement epicsTimerNotify */ -class epicsShareClass epicsTimerNotify { +class LIBCOM_API epicsTimerNotify { public: enum restart_t { noRestart, restart }; class expireStatus { public: - epicsShareFunc expireStatus ( restart_t ); - epicsShareFunc expireStatus ( restart_t, const double & expireDelaySec ); - epicsShareFunc bool restart () const; - epicsShareFunc double expirationDelay () const; + LIBCOM_API expireStatus ( restart_t ); + LIBCOM_API expireStatus ( restart_t, const double & expireDelaySec ); + LIBCOM_API bool restart () const; + LIBCOM_API double expirationDelay () const; private: double delay; }; @@ -47,7 +47,7 @@ public: virtual void show ( unsigned int level ) const; }; -class epicsShareClass epicsTimer { +class LIBCOM_API epicsTimer { public: /* calls cancel (see warning below) and then destroys the timer */ virtual void destroy () = 0; @@ -75,17 +75,17 @@ public: virtual epicsTimer & createTimer () = 0; virtual void show ( unsigned int level ) const = 0; protected: - epicsShareFunc virtual ~epicsTimerQueue () = 0; + LIBCOM_API virtual ~epicsTimerQueue () = 0; }; class epicsTimerQueueActive : public epicsTimerQueue { public: - static epicsShareFunc epicsTimerQueueActive & allocate ( + static LIBCOM_API epicsTimerQueueActive & allocate ( bool okToShare, unsigned threadPriority = epicsThreadPriorityMin + 10 ); virtual void release () = 0; protected: - epicsShareFunc virtual ~epicsTimerQueueActive () = 0; + LIBCOM_API virtual ~epicsTimerQueueActive () = 0; }; class epicsTimerQueueNotify { @@ -97,14 +97,14 @@ public: /* return this quantum in seconds. If unknown then return zero. */ virtual double quantum () = 0; protected: - epicsShareFunc virtual ~epicsTimerQueueNotify () = 0; + LIBCOM_API virtual ~epicsTimerQueueNotify () = 0; }; class epicsTimerQueuePassive : public epicsTimerQueue { public: - static epicsShareFunc epicsTimerQueuePassive & create ( epicsTimerQueueNotify & ); - epicsShareFunc virtual ~epicsTimerQueuePassive () = 0; /* ok to call delete */ + static LIBCOM_API epicsTimerQueuePassive & create ( epicsTimerQueueNotify & ); + LIBCOM_API virtual ~epicsTimerQueuePassive () = 0; /* ok to call delete */ virtual double process ( const epicsTime & currentTime ) = 0; /* returns delay to next expire */ }; @@ -135,47 +135,47 @@ typedef void ( *epicsTimerCallback ) ( void *pPrivate ); /* thread managed timer queue */ typedef struct epicsTimerQueueActiveForC * epicsTimerQueueId; -epicsShareFunc epicsTimerQueueId epicsShareAPI +LIBCOM_API epicsTimerQueueId epicsStdCall epicsTimerQueueAllocate ( int okToShare, unsigned int threadPriority ); -epicsShareFunc void epicsShareAPI +LIBCOM_API void epicsStdCall epicsTimerQueueRelease ( epicsTimerQueueId ); -epicsShareFunc epicsTimerId epicsShareAPI +LIBCOM_API epicsTimerId epicsStdCall epicsTimerQueueCreateTimer ( epicsTimerQueueId queueid, epicsTimerCallback callback, void *arg ); -epicsShareFunc void epicsShareAPI +LIBCOM_API void epicsStdCall epicsTimerQueueDestroyTimer ( epicsTimerQueueId queueid, epicsTimerId id ); -epicsShareFunc void epicsShareAPI +LIBCOM_API void epicsStdCall epicsTimerQueueShow ( epicsTimerQueueId id, unsigned int level ); /* passive timer queue */ typedef struct epicsTimerQueuePassiveForC * epicsTimerQueuePassiveId; typedef void ( * epicsTimerQueueNotifyReschedule ) ( void * pPrivate ); typedef double ( * epicsTimerQueueNotifyQuantum ) ( void * pPrivate ); -epicsShareFunc epicsTimerQueuePassiveId epicsShareAPI +LIBCOM_API epicsTimerQueuePassiveId epicsStdCall epicsTimerQueuePassiveCreate ( epicsTimerQueueNotifyReschedule, epicsTimerQueueNotifyQuantum, void *pPrivate ); -epicsShareFunc void epicsShareAPI +LIBCOM_API void epicsStdCall epicsTimerQueuePassiveDestroy ( epicsTimerQueuePassiveId ); -epicsShareFunc epicsTimerId epicsShareAPI +LIBCOM_API epicsTimerId epicsStdCall epicsTimerQueuePassiveCreateTimer ( epicsTimerQueuePassiveId queueid, epicsTimerCallback pCallback, void *pArg ); -epicsShareFunc void epicsShareAPI +LIBCOM_API void epicsStdCall epicsTimerQueuePassiveDestroyTimer ( epicsTimerQueuePassiveId queueid, epicsTimerId id ); -epicsShareFunc double epicsShareAPI +LIBCOM_API double epicsStdCall epicsTimerQueuePassiveProcess ( epicsTimerQueuePassiveId ); -epicsShareFunc void epicsShareAPI +LIBCOM_API void epicsStdCall epicsTimerQueuePassiveShow ( epicsTimerQueuePassiveId id, unsigned int level ); /* timer */ -epicsShareFunc void epicsShareAPI +LIBCOM_API void epicsStdCall epicsTimerStartTime ( epicsTimerId id, const epicsTimeStamp *pTime ); -epicsShareFunc void epicsShareAPI +LIBCOM_API void epicsStdCall epicsTimerStartDelay ( epicsTimerId id, double delaySeconds ); -epicsShareFunc void epicsShareAPI +LIBCOM_API void epicsStdCall epicsTimerCancel ( epicsTimerId id ); -epicsShareFunc double epicsShareAPI +LIBCOM_API double epicsStdCall epicsTimerGetExpireDelay ( epicsTimerId id ); -epicsShareFunc void epicsShareAPI +LIBCOM_API void epicsStdCall epicsTimerShow ( epicsTimerId id, unsigned int level ); #ifdef __cplusplus diff --git a/modules/libcom/src/timer/timer.cpp b/modules/libcom/src/timer/timer.cpp index 35d6e47bf..fed400761 100644 --- a/modules/libcom/src/timer/timer.cpp +++ b/modules/libcom/src/timer/timer.cpp @@ -19,7 +19,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsGuard.h" #include "timerPrivate.h" #include "errlog.h" diff --git a/modules/libcom/src/timer/timerQueue.cpp b/modules/libcom/src/timer/timerQueue.cpp index 8f7f98e12..f4e3555a8 100644 --- a/modules/libcom/src/timer/timerQueue.cpp +++ b/modules/libcom/src/timer/timerQueue.cpp @@ -15,7 +15,6 @@ #include #include -#define epicsExportSharedSymbols #include "epicsGuard.h" #include "timerPrivate.h" #include "errlog.h" diff --git a/modules/libcom/src/timer/timerQueueActive.cpp b/modules/libcom/src/timer/timerQueueActive.cpp index 4db68c00c..ab0599e21 100644 --- a/modules/libcom/src/timer/timerQueueActive.cpp +++ b/modules/libcom/src/timer/timerQueueActive.cpp @@ -14,7 +14,6 @@ #include -#define epicsExportSharedSymbols #include "epicsAtomic.h" #include "timerPrivate.h" #include "errlog.h" diff --git a/modules/libcom/src/timer/timerQueueActiveMgr.cpp b/modules/libcom/src/timer/timerQueueActiveMgr.cpp index eff2e0c53..7e382f644 100644 --- a/modules/libcom/src/timer/timerQueueActiveMgr.cpp +++ b/modules/libcom/src/timer/timerQueueActiveMgr.cpp @@ -15,7 +15,6 @@ #include -#define epicsExportSharedSymbols #include "epicsGuard.h" #include "timerPrivate.h" diff --git a/modules/libcom/src/timer/timerQueuePassive.cpp b/modules/libcom/src/timer/timerQueuePassive.cpp index a352c5672..754484073 100644 --- a/modules/libcom/src/timer/timerQueuePassive.cpp +++ b/modules/libcom/src/timer/timerQueuePassive.cpp @@ -23,7 +23,6 @@ #include -#define epicsExportSharedSymbols #include "timerPrivate.h" epicsTimerQueuePassive::~epicsTimerQueuePassive () {} From 055223dbe4b4fff2e54fdc524e6019d47ef89ace Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 30 Apr 2020 18:15:10 -0700 Subject: [PATCH 187/216] fix epicsTempFile in antelope+e_flex --- modules/libcom/src/flex/Makefile | 1 - modules/libcom/src/flex/flex.c | 10 ++++++++-- modules/libcom/src/flex/flexdef.h | 13 ++++++------- modules/libcom/src/yacc/antelope.c | 7 +++++++ 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/modules/libcom/src/flex/Makefile b/modules/libcom/src/flex/Makefile index 20cce5d30..5c6f41bfe 100644 --- a/modules/libcom/src/flex/Makefile +++ b/modules/libcom/src/flex/Makefile @@ -29,7 +29,6 @@ e_flex_SRCS += nfa.c e_flex_SRCS += sym.c e_flex_SRCS += tblcmp.c e_flex_SRCS += parse.c -e_flex_OBJS += epicsTempFile$(OBJ) PROD_HOST += e_flex diff --git a/modules/libcom/src/flex/flex.c b/modules/libcom/src/flex/flex.c index faf61ed19..6abb9597f 100644 --- a/modules/libcom/src/flex/flex.c +++ b/modules/libcom/src/flex/flex.c @@ -43,8 +43,14 @@ char copyright[] = #endif /* not lint */ -#include "epicsTempFile.h" -#undef epicsExportSharedSymbols +#ifdef EPICS_BUILD_DLL +# undef EPICS_BUILD_DLL +#endif +#ifdef EPICS_CALL_DLL +# undef EPICS_CALL_DLL +#endif + +#include "epicsTempFile.c" static char flex_version[] = "2.3"; diff --git a/modules/libcom/src/flex/flexdef.h b/modules/libcom/src/flex/flexdef.h index cf972b274..c14260ccb 100644 --- a/modules/libcom/src/flex/flexdef.h +++ b/modules/libcom/src/flex/flexdef.h @@ -43,6 +43,12 @@ #include #include +#ifdef _WIN32 +# include +#else +# include +#endif + #ifdef __GNUC__ #define NORETURN __attribute__((noreturn)) #else @@ -824,12 +830,5 @@ extern int yylex (); /* The Unix kernel calls used here */ -extern int read (int, char*, int); -#ifndef _WIN32 -extern int unlink (char*); -#endif -extern int write (int, char*, int); - - #endif /* INC_flexdef_H */ diff --git a/modules/libcom/src/yacc/antelope.c b/modules/libcom/src/yacc/antelope.c index 5475874ed..620035799 100644 --- a/modules/libcom/src/yacc/antelope.c +++ b/modules/libcom/src/yacc/antelope.c @@ -10,6 +10,13 @@ #include "defs.h" /* Need this before the Com library can build it */ +#ifdef EPICS_BUILD_DLL +# undef EPICS_BUILD_DLL +#endif +#ifdef EPICS_CALL_DLL +# undef EPICS_CALL_DLL +#endif + #include "epicsTempFile.c" char dflag; From 36a8b51d8e743c487cc5f4c079746b234b2afca1 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Wed, 20 May 2020 14:43:02 -0700 Subject: [PATCH 188/216] CleanupWhitespace removed spaces at end of line replaced tabs with spaces --- modules/ca/src/client/CASG.cpp | 12 +- modules/ca/src/client/SearchDest.h | 2 +- modules/ca/src/client/access.cpp | 424 ++-- modules/ca/src/client/acctst.c | 478 ++--- modules/ca/src/client/acctstMain.c | 22 +- modules/ca/src/client/acctstRegister.cpp | 2 +- modules/ca/src/client/addrList.h | 4 +- modules/ca/src/client/autoPtrFreeList.h | 18 +- modules/ca/src/client/autoPtrRecycle.h | 26 +- modules/ca/src/client/baseNMIU.cpp | 2 +- modules/ca/src/client/bhe.cpp | 70 +- modules/ca/src/client/bhe.h | 20 +- modules/ca/src/client/caConnTest.cpp | 36 +- modules/ca/src/client/caDiagnostics.h | 4 +- modules/ca/src/client/caEventRate.cpp | 28 +- modules/ca/src/client/caProto.h | 24 +- modules/ca/src/client/caServerID.h | 6 +- modules/ca/src/client/ca_client_context.cpp | 6 +- modules/ca/src/client/cac.cpp | 2 +- modules/ca/src/client/cac.h | 8 +- modules/ca/src/client/cacChannel.cpp | 34 +- modules/ca/src/client/cacChannelNotify.cpp | 18 +- modules/ca/src/client/cacContextNotify.cpp | 6 +- modules/ca/src/client/cacIO.h | 10 +- modules/ca/src/client/cacReadNotify.cpp | 2 +- modules/ca/src/client/cacStateNotify.cpp | 2 +- modules/ca/src/client/cacWriteNotify.cpp | 2 +- modules/ca/src/client/cadef.h | 166 +- modules/ca/src/client/caerr.h | 10 +- modules/ca/src/client/caeventmask.h | 8 +- modules/ca/src/client/casw.cpp | 38 +- modules/ca/src/client/catime.c | 88 +- modules/ca/src/client/catimeMain.c | 2 +- modules/ca/src/client/comBuf.cpp | 20 +- modules/ca/src/client/comBuf.h | 40 +- modules/ca/src/client/comQueRecv.cpp | 10 +- modules/ca/src/client/comQueRecv.h | 20 +- modules/ca/src/client/comQueSend.cpp | 114 +- modules/ca/src/client/comQueSend.h | 92 +- modules/ca/src/client/convert.cpp | 182 +- modules/ca/src/client/db_access.h | 842 ++++---- .../ca/src/client/disconnectGovernorTimer.cpp | 18 +- .../ca/src/client/disconnectGovernorTimer.h | 28 +- modules/ca/src/client/evtime.c | 78 +- modules/ca/src/client/getCallback.cpp | 20 +- modules/ca/src/client/getCopy.cpp | 40 +- modules/ca/src/client/hostNameCache.cpp | 18 +- modules/ca/src/client/hostNameCache.h | 16 +- modules/ca/src/client/inetAddrID.h | 4 +- modules/ca/src/client/iocinf.cpp | 40 +- modules/ca/src/client/iocinf.h | 24 +- modules/ca/src/client/localHostName.cpp | 6 +- modules/ca/src/client/localHostName.h | 2 +- .../ca/src/client/msgForMultiplyDefinedPV.cpp | 26 +- .../ca/src/client/msgForMultiplyDefinedPV.h | 22 +- modules/ca/src/client/nciu.cpp | 6 +- modules/ca/src/client/nciu.h | 10 +- modules/ca/src/client/netIO.h | 152 +- modules/ca/src/client/netReadNotifyIO.cpp | 30 +- modules/ca/src/client/netSubscription.cpp | 52 +- modules/ca/src/client/netWriteNotifyIO.cpp | 30 +- modules/ca/src/client/net_convert.h | 4 +- modules/ca/src/client/netiiu.cpp | 42 +- modules/ca/src/client/netiiu.h | 70 +- modules/ca/src/client/noopiiu.cpp | 66 +- modules/ca/src/client/noopiiu.h | 74 +- modules/ca/src/client/oldAccess.h | 26 +- modules/ca/src/client/oldChannelNotify.cpp | 6 +- modules/ca/src/client/oldSubscription.cpp | 14 +- modules/ca/src/client/putCallback.cpp | 24 +- modules/ca/src/client/repeater.cpp | 54 +- modules/ca/src/client/repeaterClient.h | 20 +- .../ca/src/client/repeaterSubscribeTimer.cpp | 12 +- .../ca/src/client/repeaterSubscribeTimer.h | 34 +- modules/ca/src/client/searchTimer.cpp | 126 +- modules/ca/src/client/searchTimer.h | 48 +- modules/ca/src/client/sgAutoPtr.h | 24 +- modules/ca/src/client/syncGroup.h | 20 +- modules/ca/src/client/syncGroupNotify.cpp | 2 +- modules/ca/src/client/syncGroupReadNotify.cpp | 2 +- .../ca/src/client/syncGroupWriteNotify.cpp | 2 +- modules/ca/src/client/syncgrp.cpp | 6 +- modules/ca/src/client/tcpRecvWatchdog.cpp | 58 +- modules/ca/src/client/tcpRecvWatchdog.h | 28 +- modules/ca/src/client/tcpSendWatchdog.cpp | 10 +- modules/ca/src/client/tcpSendWatchdog.h | 20 +- modules/ca/src/client/tcpiiu.cpp | 458 ++--- modules/ca/src/client/test/ca_test.c | 408 ++-- modules/ca/src/client/test/ca_test.h | 6 +- modules/ca/src/client/test/ca_test_main.c | 62 +- modules/ca/src/client/test_event.cpp | 20 +- modules/ca/src/client/udpiiu.cpp | 328 ++-- modules/ca/src/client/udpiiu.h | 174 +- modules/ca/src/client/virtualCircuit.h | 178 +- modules/ca/src/perl/CA.pm | 4 +- .../src/template/top/caClientApp/caExample.c | 8 +- .../src/template/top/caClientApp/caMonitor.c | 62 +- .../src/template/top/caPerlApp/camonitor.pl | 4 +- modules/ca/src/tools/caget.c | 40 +- modules/ca/src/tools/cainfo.c | 26 +- modules/ca/src/tools/camonitor.c | 32 +- modules/ca/src/tools/caput.c | 24 +- modules/ca/src/tools/tool_lib.c | 54 +- modules/ca/src/tools/tool_lib.h | 4 +- modules/database/src/ioc/as/asCa.c | 36 +- modules/database/src/ioc/as/asCa.h | 2 +- modules/database/src/ioc/as/asDbLib.c | 124 +- modules/database/src/ioc/as/asDbLib.h | 4 +- modules/database/src/ioc/as/asIocRegister.c | 2 +- modules/database/src/ioc/as/asIocRegister.h | 2 +- modules/database/src/ioc/as/ascheck.c | 44 +- modules/database/src/ioc/bpt/cvtTable.h | 4 +- modules/database/src/ioc/bpt/makeBpt.c | 442 ++--- modules/database/src/ioc/db/callback.c | 4 +- modules/database/src/ioc/db/callback.h | 18 +- modules/database/src/ioc/db/cvtBpt.c | 252 +-- modules/database/src/ioc/db/dbAccess.c | 382 ++-- modules/database/src/ioc/db/dbAccess.h | 4 +- modules/database/src/ioc/db/dbAccessDefs.h | 68 +- modules/database/src/ioc/db/dbBkpt.c | 32 +- modules/database/src/ioc/db/dbBkpt.h | 8 +- modules/database/src/ioc/db/dbCAC.h | 6 +- modules/database/src/ioc/db/dbCa.c | 14 +- modules/database/src/ioc/db/dbCaPvt.h | 74 +- modules/database/src/ioc/db/dbCaTest.c | 4 +- modules/database/src/ioc/db/dbCaTest.h | 2 +- modules/database/src/ioc/db/dbChannelIO.cpp | 10 +- modules/database/src/ioc/db/dbChannelIO.h | 6 +- modules/database/src/ioc/db/dbContext.cpp | 14 +- .../src/ioc/db/dbContextReadNotifyCache.cpp | 8 +- modules/database/src/ioc/db/dbConvert.h | 2 +- modules/database/src/ioc/db/dbConvertFast.h | 2 +- modules/database/src/ioc/db/dbConvertJSON.c | 4 +- modules/database/src/ioc/db/dbConvertJSON.h | 2 +- modules/database/src/ioc/db/dbEvent.c | 26 +- modules/database/src/ioc/db/dbEvent.h | 2 +- modules/database/src/ioc/db/dbFastLinkConv.c | 40 +- modules/database/src/ioc/db/dbIocRegister.c | 2 +- modules/database/src/ioc/db/dbIocRegister.h | 2 +- modules/database/src/ioc/db/dbLock.c | 28 +- modules/database/src/ioc/db/dbLock.h | 4 +- modules/database/src/ioc/db/dbLockPvt.h | 14 +- modules/database/src/ioc/db/dbNotify.c | 22 +- modules/database/src/ioc/db/dbNotify.h | 32 +- .../src/ioc/db/dbPutNotifyBlocker.cpp | 16 +- .../database/src/ioc/db/dbPutNotifyBlocker.h | 12 +- modules/database/src/ioc/db/dbScan.h | 2 +- .../database/src/ioc/db/dbSubscriptionIO.cpp | 14 +- modules/database/src/ioc/db/dbTest.h | 2 +- modules/database/src/ioc/db/db_convert.h | 40 +- modules/database/src/ioc/db/db_field_log.h | 18 +- modules/database/src/ioc/db/db_test.c | 2 +- modules/database/src/ioc/db/db_test.h | 2 +- modules/database/src/ioc/db/recGbl.c | 52 +- modules/database/src/ioc/db/recGbl.h | 2 +- modules/database/src/ioc/dbStatic/dbBase.h | 194 +- .../database/src/ioc/dbStatic/dbFldTypes.h | 82 +- modules/database/src/ioc/dbStatic/dbLex.l | 144 +- .../database/src/ioc/dbStatic/dbLexRoutines.c | 528 ++--- modules/database/src/ioc/dbStatic/dbPvdLib.c | 4 +- .../src/ioc/dbStatic/dbStaticIocRegister.c | 2 +- .../src/ioc/dbStatic/dbStaticIocRegister.h | 2 +- .../database/src/ioc/dbStatic/dbStaticLib.c | 1702 ++++++++-------- .../database/src/ioc/dbStatic/dbStaticLib.h | 2 +- .../database/src/ioc/dbStatic/dbStaticPvt.h | 14 +- .../database/src/ioc/dbStatic/dbStaticRun.c | 28 +- modules/database/src/ioc/dbStatic/dbYacc.y | 334 ++-- modules/database/src/ioc/dbStatic/devSup.h | 16 +- modules/database/src/ioc/dbStatic/drvSup.h | 4 +- modules/database/src/ioc/dbStatic/guigroup.h | 6 +- modules/database/src/ioc/dbStatic/link.h | 182 +- modules/database/src/ioc/dbStatic/recSup.h | 28 +- modules/database/src/ioc/dbStatic/special.h | 46 +- .../src/ioc/dbtemplate/dbLoadTemplate.h | 2 +- .../src/ioc/dbtemplate/dbLoadTemplate.y | 6 +- .../src/ioc/dbtemplate/dbLoadTemplate_lex.l | 2 +- .../src/ioc/dbtemplate/dbtoolsIocRegister.c | 2 +- .../src/ioc/dbtemplate/dbtoolsIocRegister.h | 2 +- modules/database/src/ioc/misc/dlload.c | 2 +- modules/database/src/ioc/misc/epicsRelease.h | 2 +- modules/database/src/ioc/misc/iocInit.c | 2 +- modules/database/src/ioc/misc/iocInit.h | 4 +- .../src/ioc/misc/iocshRegisterCommon.h | 2 +- .../database/src/ioc/misc/miscIocRegister.c | 2 +- .../database/src/ioc/misc/miscIocRegister.h | 2 +- .../src/ioc/registry/registryCommon.c | 2 +- .../src/ioc/registry/registryCommon.h | 2 +- .../src/ioc/registry/registryDeviceSupport.h | 2 +- .../src/ioc/registry/registryDriverSupport.h | 2 +- .../src/ioc/registry/registryFunction.h | 2 +- .../src/ioc/registry/registryIocRegister.c | 2 +- .../src/ioc/registry/registryIocRegister.h | 2 +- .../src/ioc/registry/registryJLinks.h | 2 +- .../src/ioc/registry/registryRecordType.h | 2 +- modules/database/src/ioc/rsrv/camessage.c | 28 +- modules/database/src/ioc/rsrv/camsgtask.c | 14 +- modules/database/src/ioc/rsrv/caserverio.c | 38 +- modules/database/src/ioc/rsrv/cast_server.c | 28 +- modules/database/src/ioc/rsrv/online_notify.c | 8 +- .../src/std/dev/asSubRecordFunctions.c | 22 +- modules/database/src/std/dev/devAaoSoft.c | 4 +- modules/database/src/std/dev/devAiSoft.c | 2 +- modules/database/src/std/dev/devAiSoftRaw.c | 2 +- modules/database/src/std/dev/devAoSoft.c | 2 +- .../database/src/std/dev/devAoSoftCallback.c | 2 +- modules/database/src/std/dev/devAoSoftRaw.c | 2 +- modules/database/src/std/dev/devBiSoft.c | 2 +- modules/database/src/std/dev/devBiSoftRaw.c | 2 +- modules/database/src/std/dev/devBoSoft.c | 6 +- modules/database/src/std/dev/devBoSoftRaw.c | 10 +- modules/database/src/std/dev/devCalcoutSoft.c | 2 +- .../src/std/dev/devCalcoutSoftCallback.c | 2 +- modules/database/src/std/dev/devEnviron.c | 2 +- modules/database/src/std/dev/devEventSoft.c | 2 +- modules/database/src/std/dev/devGeneralTime.c | 4 +- .../database/src/std/dev/devHistogramSoft.c | 6 +- modules/database/src/std/dev/devI64inSoft.c | 2 +- modules/database/src/std/dev/devI64outSoft.c | 2 +- modules/database/src/std/dev/devLiSoft.c | 2 +- modules/database/src/std/dev/devLoSoft.c | 8 +- .../database/src/std/dev/devLoSoftCallback.c | 2 +- .../database/src/std/dev/devLsoSoftCallback.c | 2 +- .../database/src/std/dev/devMbbiDirectSoft.c | 2 +- .../src/std/dev/devMbbiDirectSoftRaw.c | 2 +- modules/database/src/std/dev/devMbbiSoft.c | 2 +- .../src/std/dev/devMbbiSoftCallback.c | 2 +- modules/database/src/std/dev/devMbbiSoftRaw.c | 2 +- .../database/src/std/dev/devMbboDirectSoft.c | 2 +- .../src/std/dev/devMbboDirectSoftRaw.c | 2 +- modules/database/src/std/dev/devMbboSoft.c | 4 +- modules/database/src/std/dev/devPrintfSoft.c | 2 +- .../src/std/dev/devPrintfSoftCallback.c | 2 +- modules/database/src/std/dev/devSiSoft.c | 2 +- modules/database/src/std/dev/devSoSoft.c | 2 +- modules/database/src/std/dev/devStdio.c | 2 +- modules/database/src/std/dev/devTimestamp.c | 2 +- modules/database/src/std/link/lnkCalc.c | 2 +- modules/database/src/std/rec/aSubRecord.c | 2 +- modules/database/src/std/rec/aiRecord.c | 260 +-- modules/database/src/std/rec/aoRecord.c | 296 +-- modules/database/src/std/rec/biRecord.c | 180 +- modules/database/src/std/rec/boRecord.c | 328 ++-- modules/database/src/std/rec/calcRecord.c | 30 +- modules/database/src/std/rec/calcoutRecord.c | 10 +- modules/database/src/std/rec/dfanoutRecord.c | 48 +- modules/database/src/std/rec/eventRecord.c | 66 +- modules/database/src/std/rec/fanoutRecord.c | 2 +- .../database/src/std/rec/histogramRecord.c | 2 +- modules/database/src/std/rec/int64inRecord.c | 96 +- modules/database/src/std/rec/int64outRecord.c | 170 +- modules/database/src/std/rec/longinRecord.c | 92 +- modules/database/src/std/rec/longoutRecord.c | 162 +- .../database/src/std/rec/mbbiDirectRecord.c | 2 +- modules/database/src/std/rec/mbbiRecord.c | 2 +- .../database/src/std/rec/mbboDirectRecord.c | 2 +- modules/database/src/std/rec/mbboRecord.c | 2 +- .../database/src/std/rec/permissiveRecord.c | 44 +- modules/database/src/std/rec/printfRecord.c | 10 +- modules/database/src/std/rec/selRecord.c | 118 +- modules/database/src/std/rec/seqRecord.c | 10 +- modules/database/src/std/rec/stateRecord.c | 58 +- modules/database/src/std/rec/stringinRecord.c | 74 +- .../database/src/std/rec/stringoutRecord.c | 128 +- modules/database/src/std/rec/subRecord.c | 8 +- .../src/std/softIoc/makeInstallDir.pl | 2 +- modules/database/src/std/softIoc/softMain.cpp | 4 +- .../top/exampleApp/src/_APPNAME_Hello.c | 4 +- .../top/exampleApp/src/_APPNAME_Main.cpp | 2 +- .../template/top/exampleApp/src/devXxxSoft.c | 28 +- .../top/exampleApp/src/sncExample.stt | 18 +- .../template/top/exampleApp/src/xxxRecord.c | 248 +-- .../template/top/iocApp/src/_APPNAME_Main.cpp | 2 +- modules/database/src/tools/DBD.pm | 2 +- modules/database/src/tools/DBD/Parser.pm | 10 +- modules/database/src/tools/makeIncludeDbd.pl | 2 +- .../test/ioc/db/callbackParallelTest.c | 2 +- modules/database/test/ioc/db/callbackTest.c | 4 +- modules/database/test/ioc/db/dbCaLinkTest.c | 2 +- modules/database/test/ioc/db/dbPutLinkTest.c | 2 +- .../database/test/std/rec/mbbioDirectTest.c | 10 +- modules/database/test/std/rec/seqTest.c | 2 +- modules/database/test/tools/Device.plt | 22 +- modules/libcom/RTEMS/rtems_config.c | 2 +- modules/libcom/RTEMS/rtems_netconfig.c | 4 +- modules/libcom/RTEMS/rtems_util.c | 4 +- modules/libcom/src/as/asLib.h | 142 +- modules/libcom/src/as/asLib.y | 288 +-- modules/libcom/src/as/asLibRoutines.c | 1196 ++++++------ modules/libcom/src/as/asLib_lex.l | 72 +- modules/libcom/src/as/asTrapWrite.c | 6 +- modules/libcom/src/bucketLib/bucketLib.c | 566 +++--- modules/libcom/src/bucketLib/bucketLib.h | 36 +- modules/libcom/src/calc/calcPerform.c | 650 +++---- modules/libcom/src/calc/postfix.c | 796 ++++---- modules/libcom/src/calc/postfixPvt.h | 122 +- modules/libcom/src/cvtFast/cvtFast.c | 286 +-- modules/libcom/src/cxxTemplates/epicsGuard.h | 30 +- .../libcom/src/cxxTemplates/epicsSingleton.h | 88 +- .../src/cxxTemplates/epicsSingletonMutex.cpp | 8 +- .../libcom/src/cxxTemplates/resourceLib.cpp | 4 +- modules/libcom/src/cxxTemplates/resourceLib.h | 182 +- .../src/cxxTemplates/test/minmaxTest.cc | 36 +- .../src/cxxTemplates/test/resourceLibTest.cc | 374 ++-- .../src/cxxTemplates/test/tsDLListBench.cc | 72 +- .../src/cxxTemplates/test/tsDLListTest.cc | 10 +- .../src/cxxTemplates/test/tsSLListBench.cc | 84 +- .../src/cxxTemplates/test/tsSLListTest.cc | 120 +- modules/libcom/src/cxxTemplates/tsDLList.h | 84 +- modules/libcom/src/cxxTemplates/tsFreeList.h | 34 +- modules/libcom/src/cxxTemplates/tsMinMax.h | 10 +- modules/libcom/src/cxxTemplates/tsSLList.h | 18 +- modules/libcom/src/dbmf/dbmf.c | 50 +- modules/libcom/src/ellLib/ellLib.c | 2 +- modules/libcom/src/env/envDefs.h | 14 +- modules/libcom/src/env/envSubr.c | 332 ++-- modules/libcom/src/error/epicsPrint.h | 2 +- modules/libcom/src/error/errSymTbl.h | 2 +- modules/libcom/src/error/errlog.c | 2 +- modules/libcom/src/error/errlog.h | 2 +- modules/libcom/src/error/makeStatTbl.pl | 2 +- modules/libcom/src/fdmgr/fdManager.cpp | 48 +- modules/libcom/src/fdmgr/fdManager.h | 24 +- modules/libcom/src/fdmgr/fdmgr.cpp | 48 +- modules/libcom/src/fdmgr/fdmgr.h | 66 +- modules/libcom/src/flex/ccl.c | 78 +- modules/libcom/src/flex/dfa.c | 1018 +++++----- modules/libcom/src/flex/ecs.c | 316 +-- modules/libcom/src/flex/flex.c | 648 +++---- modules/libcom/src/flex/flex.skel | 506 ++--- modules/libcom/src/flex/flex.skel.static | 512 ++--- modules/libcom/src/flex/flexdef.h | 120 +- modules/libcom/src/flex/gen.c | 1246 ++++++------ modules/libcom/src/flex/libmain.c | 2 +- modules/libcom/src/flex/misc.c | 326 ++-- modules/libcom/src/flex/nfa.c | 374 ++-- modules/libcom/src/flex/parse.y | 916 ++++----- modules/libcom/src/flex/scan.c | 1308 ++++++------- modules/libcom/src/flex/sym.c | 84 +- modules/libcom/src/flex/tblcmp.c | 684 +++---- modules/libcom/src/flex/yylex.c | 256 +-- modules/libcom/src/freeList/freeList.h | 4 +- modules/libcom/src/freeList/freeListLib.c | 38 +- modules/libcom/src/gpHash/gpHash.h | 8 +- modules/libcom/src/iocsh/initHooks.c | 2 +- modules/libcom/src/iocsh/initHooks.h | 2 +- modules/libcom/src/iocsh/iocsh.cpp | 28 +- modules/libcom/src/iocsh/iocsh.h | 2 +- modules/libcom/src/iocsh/libComRegister.c | 6 +- modules/libcom/src/iocsh/libComRegister.h | 2 +- modules/libcom/src/iocsh/registry.c | 6 +- modules/libcom/src/iocsh/registry.h | 2 +- modules/libcom/src/log/iocLog.c | 6 +- modules/libcom/src/log/iocLog.h | 6 +- modules/libcom/src/log/iocLogServer.c | 1016 +++++----- modules/libcom/src/log/logClient.h | 6 +- modules/libcom/src/macLib/macCore.c | 10 +- modules/libcom/src/macLib/macEnv.c | 4 +- modules/libcom/src/macLib/macUtil.c | 234 +-- modules/libcom/src/misc/aToIPAddr.c | 34 +- modules/libcom/src/misc/adjustment.c | 12 +- modules/libcom/src/misc/alarmString.c | 2 +- modules/libcom/src/misc/cantProceed.c | 6 +- modules/libcom/src/misc/epicsConvert.c | 2 +- modules/libcom/src/misc/epicsExit.c | 12 +- modules/libcom/src/misc/epicsStdlib.c | 2 +- modules/libcom/src/misc/epicsString.c | 2 +- modules/libcom/src/misc/epicsString.h | 2 +- modules/libcom/src/misc/epicsUnitTest.c | 64 +- .../src/misc/ipAddrToAsciiAsynchronous.cpp | 50 +- .../src/misc/ipAddrToAsciiAsynchronous.h | 18 +- modules/libcom/src/misc/locationException.h | 2 +- modules/libcom/src/misc/makeEpicsVersion.pl | 2 +- modules/libcom/src/misc/testMain.h | 2 +- modules/libcom/src/misc/truncateFile.c | 202 +- modules/libcom/src/misc/unixFileName.h | 2 +- .../src/osi/compiler/clang/compilerSpecific.h | 6 +- .../src/osi/compiler/clang/epicsAtomicCD.h | 2 +- .../osi/compiler/default/compilerSpecific.h | 6 +- .../src/osi/compiler/default/epicsAtomicCD.h | 2 +- .../src/osi/compiler/gcc/compilerSpecific.h | 10 +- .../src/osi/compiler/gcc/epicsAtomicCD.h | 32 +- .../src/osi/compiler/msvc/compilerSpecific.h | 12 +- .../src/osi/compiler/msvc/epicsAtomicCD.h | 26 +- .../osi/compiler/solStudio/compilerSpecific.h | 4 +- .../osi/compiler/solStudio/epicsAtomicCD.h | 2 +- modules/libcom/src/osi/compilerDependencies.h | 2 +- modules/libcom/src/osi/devLib.h | 6 +- modules/libcom/src/osi/devLibVME.c | 58 +- modules/libcom/src/osi/devLibVME.h | 72 +- modules/libcom/src/osi/epicsAtomic.h | 32 +- modules/libcom/src/osi/epicsAtomicDefault.h | 28 +- modules/libcom/src/osi/epicsEndian.h | 2 +- modules/libcom/src/osi/epicsEvent.cpp | 12 +- modules/libcom/src/osi/epicsFindSymbol.h | 2 +- modules/libcom/src/osi/epicsGeneralTime.c | 6 +- modules/libcom/src/osi/epicsInterrupt.h | 2 +- modules/libcom/src/osi/epicsMath.cpp | 2 +- modules/libcom/src/osi/epicsMessageQueue.cpp | 4 +- modules/libcom/src/osi/epicsMutex.cpp | 34 +- modules/libcom/src/osi/epicsSignal.h | 4 +- modules/libcom/src/osi/epicsStackTrace.c | 84 +- modules/libcom/src/osi/epicsStackTrace.h | 6 +- modules/libcom/src/osi/epicsStackTracePvt.h | 14 +- modules/libcom/src/osi/epicsStdio.c | 2 +- modules/libcom/src/osi/epicsStdio.h | 4 +- modules/libcom/src/osi/epicsStdioRedirect.h | 2 +- modules/libcom/src/osi/epicsThread.h | 2 +- modules/libcom/src/osi/epicsTime.h | 2 +- modules/libcom/src/osi/os/Darwin/epicsMath.h | 2 +- .../libcom/src/osi/os/Darwin/osdBackTrace.cpp | 6 +- modules/libcom/src/osi/os/Darwin/osdEnv.c | 2 +- .../libcom/src/osi/os/Darwin/osdFindAddr.c | 6 +- modules/libcom/src/osi/os/Darwin/osdTime.h | 2 +- .../libcom/src/osi/os/Darwin/osiFileName.h | 2 +- .../libcom/src/osi/os/Linux/osdBackTrace.cpp | 6 +- modules/libcom/src/osi/os/Linux/osdFindAddr.c | 6 +- modules/libcom/src/osi/os/Linux/osdTime.h | 2 +- modules/libcom/src/osi/os/Linux/osiFileName.h | 2 +- modules/libcom/src/osi/os/Linux/osiUnistd.h | 10 +- .../libcom/src/osi/os/RTEMS/devLibVMEOSD.c | 28 +- .../libcom/src/osi/os/RTEMS/epicsAtomicOSD.h | 2 +- modules/libcom/src/osi/os/RTEMS/epicsMath.h | 2 +- modules/libcom/src/osi/os/RTEMS/osdEnv.c | 2 +- modules/libcom/src/osi/os/RTEMS/osdEvent.c | 22 +- modules/libcom/src/osi/os/RTEMS/osdEvent.h | 2 +- .../libcom/src/osi/os/RTEMS/osdFindSymbol.c | 2 +- .../libcom/src/osi/os/RTEMS/osdInterrupt.c | 8 +- .../libcom/src/osi/os/RTEMS/osdInterrupt.h | 2 +- .../libcom/src/osi/os/RTEMS/osdMessageQueue.c | 16 +- .../libcom/src/osi/os/RTEMS/osdMessageQueue.h | 2 +- modules/libcom/src/osi/os/RTEMS/osdMutex.c | 12 +- modules/libcom/src/osi/os/RTEMS/osdMutex.h | 2 +- .../libcom/src/osi/os/RTEMS/osdPoolStatus.c | 2 +- modules/libcom/src/osi/os/RTEMS/osdProcess.c | 4 +- modules/libcom/src/osi/os/RTEMS/osdSignal.cpp | 2 +- modules/libcom/src/osi/os/RTEMS/osdStrtod.h | 2 +- modules/libcom/src/osi/os/RTEMS/osdThread.c | 2 +- modules/libcom/src/osi/os/RTEMS/osdVME.h | 2 +- modules/libcom/src/osi/os/RTEMS/osiFileName.h | 2 +- modules/libcom/src/osi/os/RTEMS/osiUnistd.h | 10 +- .../libcom/src/osi/os/WIN32/epicsAtomicMS.h | 42 +- .../libcom/src/osi/os/WIN32/epicsAtomicOSD.h | 16 +- modules/libcom/src/osi/os/WIN32/epicsGetopt.c | 138 +- modules/libcom/src/osi/os/WIN32/epicsGetopt.h | 2 +- modules/libcom/src/osi/os/WIN32/epicsMath.h | 4 +- .../WIN32/epicsSocketConvertErrnoToString.cpp | 4 +- .../osi/os/WIN32/forceBadAllocException.cpp | 10 +- .../libcom/src/osi/os/WIN32/osdBackTrace.cpp | 6 +- modules/libcom/src/osi/os/WIN32/osdEnv.c | 18 +- modules/libcom/src/osi/os/WIN32/osdEvent.c | 12 +- modules/libcom/src/osi/os/WIN32/osdEvent.h | 2 +- .../libcom/src/osi/os/WIN32/osdFindSymbol.c | 2 +- modules/libcom/src/osi/os/WIN32/osdMutex.c | 42 +- modules/libcom/src/osi/os/WIN32/osdMutex.h | 2 +- .../libcom/src/osi/os/WIN32/osdPoolStatus.c | 2 +- .../libcom/src/osi/os/WIN32/osdPoolStatus.h | 2 +- modules/libcom/src/osi/os/WIN32/osdProcess.c | 44 +- modules/libcom/src/osi/os/WIN32/osdSignal.cpp | 2 +- modules/libcom/src/osi/os/WIN32/osdSock.c | 162 +- modules/libcom/src/osi/os/WIN32/osdSock.h | 14 +- modules/libcom/src/osi/os/WIN32/osdStdio.c | 2 +- modules/libcom/src/osi/os/WIN32/osdStrtod.h | 2 +- modules/libcom/src/osi/os/WIN32/osdThread.c | 110 +- modules/libcom/src/osi/os/WIN32/osdTime.cpp | 36 +- modules/libcom/src/osi/os/WIN32/osiFileName.h | 2 +- modules/libcom/src/osi/os/WIN32/osiUnistd.h | 10 +- .../libcom/src/osi/os/WIN32/setThreadName.cpp | 4 +- .../src/osi/os/WIN32/systemCallIntMech.cpp | 6 +- .../libcom/src/osi/os/cygwin32/osdStrtod.h | 2 +- .../libcom/src/osi/os/cygwin32/osiFileName.h | 2 +- .../src/osi/os/cygwin32/systemCallIntMech.cpp | 4 +- .../libcom/src/osi/os/default/epicsGetopt.h | 2 +- .../epicsSocketConvertErrnoToString.cpp | 6 +- .../libcom/src/osi/os/default/gnuReadline.c | 2 +- modules/libcom/src/osi/os/default/osdAssert.c | 2 +- .../src/osi/os/default/osdBackTrace.cpp | 8 +- modules/libcom/src/osi/os/default/osdEnv.c | 18 +- .../libcom/src/osi/os/default/osdFindAddr.c | 6 +- .../libcom/src/osi/os/default/osdFindSymbol.c | 2 +- .../libcom/src/osi/os/default/osdInterrupt.c | 2 +- .../libcom/src/osi/os/default/osdInterrupt.h | 2 +- .../libcom/src/osi/os/default/osdNetIntf.c | 36 +- .../libcom/src/osi/os/default/osdPoolStatus.c | 2 +- .../libcom/src/osi/os/default/osdPoolStatus.h | 2 +- .../libcom/src/osi/os/default/osdSignal.cpp | 2 +- .../src/osi/os/default/osdSockAddrReuse.cpp | 2 +- modules/libcom/src/osi/os/default/osdSpin.c | 2 +- modules/libcom/src/osi/os/default/osdVME.h | 2 +- .../libcom/src/osi/os/default/osdWireConfig.h | 6 +- .../libcom/src/osi/os/default/osdWireFormat.h | 46 +- modules/libcom/src/osi/os/freebsd/osdTime.h | 2 +- .../libcom/src/osi/os/freebsd/osiFileName.h | 2 +- modules/libcom/src/osi/os/freebsd/osiUnistd.h | 10 +- modules/libcom/src/osi/os/iOS/epicsMath.h | 2 +- modules/libcom/src/osi/os/iOS/osdEnv.c | 2 +- .../src/osi/os/posix/epicsAtomicOSD.cpp | 26 +- .../libcom/src/osi/os/posix/epicsAtomicOSD.h | 2 +- modules/libcom/src/osi/os/posix/epicsMath.h | 2 +- .../libcom/src/osi/os/posix/epicsTempFile.c | 2 +- .../libcom/src/osi/os/posix/osdElfFindAddr.c | 28 +- modules/libcom/src/osi/os/posix/osdEvent.c | 2 +- modules/libcom/src/osi/os/posix/osdEvent.h | 2 +- .../src/osi/os/posix/osdExecinfoBackTrace.cpp | 10 +- .../libcom/src/osi/os/posix/osdFindSymbol.c | 2 +- modules/libcom/src/osi/os/posix/osdMutex.c | 12 +- modules/libcom/src/osi/os/posix/osdMutex.h | 2 +- modules/libcom/src/osi/os/posix/osdProcess.c | 6 +- modules/libcom/src/osi/os/posix/osdSignal.cpp | 2 +- modules/libcom/src/osi/os/posix/osdSock.c | 70 +- modules/libcom/src/osi/os/posix/osdStdio.c | 2 +- modules/libcom/src/osi/os/posix/osdStrtod.h | 2 +- modules/libcom/src/osi/os/posix/osdThread.c | 4 +- modules/libcom/src/osi/os/posix/osdTime.h | 10 +- modules/libcom/src/osi/os/posix/osiUnistd.h | 10 +- .../src/osi/os/posix/systemCallIntMech.cpp | 6 +- .../src/osi/os/solaris/epicsAtomicOSD.h | 10 +- modules/libcom/src/osi/os/solaris/epicsMath.h | 2 +- .../src/osi/os/solaris/osdBackTrace.cpp | 32 +- modules/libcom/src/osi/os/solaris/osdEnv.c | 2 +- .../libcom/src/osi/os/solaris/osdFindAddr.c | 6 +- modules/libcom/src/osi/os/solaris/osdStrtod.h | 2 +- .../libcom/src/osi/os/solaris/osiFileName.h | 2 +- .../libcom/src/osi/os/vxWorks/atReboot.cpp | 2 +- modules/libcom/src/osi/os/vxWorks/camacLib.h | 64 +- .../libcom/src/osi/os/vxWorks/devLibVMEOSD.c | 46 +- .../src/osi/os/vxWorks/epicsAtomicOSD.h | 42 +- modules/libcom/src/osi/os/vxWorks/epicsMath.h | 2 +- .../src/osi/os/vxWorks/logMsgToErrlog.cpp | 24 +- .../libcom/src/osi/os/vxWorks/module_types.h | 268 +-- modules/libcom/src/osi/os/vxWorks/osdEnv.c | 4 +- modules/libcom/src/osi/os/vxWorks/osdEvent.c | 2 +- modules/libcom/src/osi/os/vxWorks/osdEvent.h | 2 +- .../libcom/src/osi/os/vxWorks/osdFindSymbol.c | 2 +- .../libcom/src/osi/os/vxWorks/osdInterrupt.c | 2 +- .../libcom/src/osi/os/vxWorks/osdInterrupt.h | 2 +- .../src/osi/os/vxWorks/osdMessageQueue.cpp | 2 +- .../src/osi/os/vxWorks/osdMessageQueue.h | 2 +- modules/libcom/src/osi/os/vxWorks/osdMutex.c | 2 +- modules/libcom/src/osi/os/vxWorks/osdMutex.h | 2 +- .../libcom/src/osi/os/vxWorks/osdPoolStatus.c | 8 +- .../libcom/src/osi/os/vxWorks/osdProcess.c | 8 +- .../libcom/src/osi/os/vxWorks/osdReadline.c | 2 +- .../libcom/src/osi/os/vxWorks/osdSignal.cpp | 2 +- modules/libcom/src/osi/os/vxWorks/osdSock.c | 28 +- modules/libcom/src/osi/os/vxWorks/osdSock.h | 2 +- modules/libcom/src/osi/os/vxWorks/osdStdio.c | 4 +- modules/libcom/src/osi/os/vxWorks/osdThread.c | 10 +- modules/libcom/src/osi/os/vxWorks/osdTime.h | 2 +- modules/libcom/src/osi/os/vxWorks/osdVME.h | 2 +- .../libcom/src/osi/os/vxWorks/osiFileName.h | 2 +- modules/libcom/src/osi/os/vxWorks/strtoll.c | 176 +- modules/libcom/src/osi/os/vxWorks/strtoull.c | 132 +- .../libcom/src/osi/os/vxWorks/task_params.h | 234 +-- modules/libcom/src/osi/os/vxWorks/veclist.c | 250 +-- modules/libcom/src/osi/osiClockTime.h | 2 +- modules/libcom/src/osi/osiNTPTime.c | 2 +- modules/libcom/src/osi/osiNTPTime.h | 2 +- modules/libcom/src/osi/osiProcess.h | 8 +- modules/libcom/src/osi/osiSock.c | 62 +- modules/libcom/src/osi/osiSock.h | 58 +- modules/libcom/src/osi/osiWireFormat.h | 48 +- modules/libcom/src/taskwd/taskwd.c | 4 +- modules/libcom/src/taskwd/taskwd.h | 4 +- modules/libcom/src/timer/epicsTimer.cpp | 32 +- modules/libcom/src/timer/epicsTimer.h | 14 +- modules/libcom/src/timer/timer.cpp | 20 +- modules/libcom/src/timer/timerPrivate.h | 52 +- modules/libcom/src/timer/timerQueue.cpp | 50 +- modules/libcom/src/timer/timerQueueActive.cpp | 20 +- .../libcom/src/timer/timerQueueActiveMgr.cpp | 10 +- .../libcom/src/timer/timerQueuePassive.cpp | 12 +- modules/libcom/src/valgrind/valgrind.h | 54 +- modules/libcom/src/yacc/antelope.c | 256 +-- modules/libcom/src/yacc/closure.c | 176 +- modules/libcom/src/yacc/defs.h | 96 +- modules/libcom/src/yacc/error.c | 44 +- modules/libcom/src/yacc/lalr.c | 306 +-- modules/libcom/src/yacc/lr0.c | 358 ++-- modules/libcom/src/yacc/mkpar.c | 248 +-- modules/libcom/src/yacc/output.c | 1162 +++++------ modules/libcom/src/yacc/reader.c | 1720 ++++++++--------- modules/libcom/src/yacc/skeleton.c | 80 +- modules/libcom/src/yacc/symtab.c | 20 +- modules/libcom/src/yacc/verbose.c | 266 +-- modules/libcom/src/yacc/warshall.c | 62 +- modules/libcom/src/yajl/yajl.c | 4 +- modules/libcom/src/yajl/yajl_buf.c | 2 +- modules/libcom/src/yajl/yajl_buf.h | 2 +- modules/libcom/src/yajl/yajl_common.h | 2 +- modules/libcom/src/yajl/yajl_encode.c | 20 +- modules/libcom/src/yajl/yajl_gen.c | 16 +- modules/libcom/src/yajl/yajl_gen.h | 4 +- modules/libcom/src/yajl/yajl_lex.c | 104 +- modules/libcom/src/yajl/yajl_lex.h | 16 +- modules/libcom/src/yajl/yajl_parse.h | 2 +- modules/libcom/test/blockingSockTest.cpp | 26 +- modules/libcom/test/epicsAlgorithmTest.cpp | 24 +- modules/libcom/test/epicsAtomicPerform.cpp | 160 +- modules/libcom/test/epicsAtomicTest.cpp | 110 +- modules/libcom/test/epicsCalcTest.cpp | 132 +- modules/libcom/test/epicsEllTest.c | 2 +- modules/libcom/test/epicsEventTest.cpp | 2 +- modules/libcom/test/epicsMutexTest.cpp | 10 +- modules/libcom/test/epicsStackTraceTest.c | 12 +- modules/libcom/test/epicsStdioTest.c | 6 +- .../libcom/test/epicsThreadPrivateTest.cpp | 4 +- modules/libcom/test/epicsTimerTest.cpp | 14 +- modules/libcom/test/fdmgrTest.c | 6 +- modules/libcom/test/macDefExpandTest.c | 10 +- modules/libcom/test/ringBytesTest.c | 6 +- 610 files changed, 19733 insertions(+), 19733 deletions(-) diff --git a/modules/ca/src/client/CASG.cpp b/modules/ca/src/client/CASG.cpp index 97da8a273..0fc76e238 100644 --- a/modules/ca/src/client/CASG.cpp +++ b/modules/ca/src/client/CASG.cpp @@ -208,23 +208,23 @@ bool CASG::ioComplete ( return this->ioPendingList.count () == 0u; } -void CASG::put ( epicsGuard < epicsMutex > & guard, chid pChan, +void CASG::put ( epicsGuard < epicsMutex > & guard, chid pChan, unsigned type, arrayElementCount count, const void * pValue ) { guard.assertIdenticalMutex ( this->client.mutexRef() ); sgAutoPtr < syncGroupWriteNotify > pNotify ( guard, *this ); - pNotify = syncGroupWriteNotify::factory ( + pNotify = syncGroupWriteNotify::factory ( this->freeListWriteOP, *this, & CASG :: recycleWriteNotifyIO, pChan ); pNotify->begin ( guard, type, count, pValue ); pNotify.release (); } -void CASG::get ( epicsGuard < epicsMutex > & guard, chid pChan, +void CASG::get ( epicsGuard < epicsMutex > & guard, chid pChan, unsigned type, arrayElementCount count, void *pValue ) { guard.assertIdenticalMutex ( this->client.mutexRef() ); sgAutoPtr < syncGroupReadNotify > pNotify ( guard, *this ); - pNotify = syncGroupReadNotify::factory ( + pNotify = syncGroupReadNotify::factory ( this->freeListReadOP, *this, & CASG :: recycleReadNotifyIO, pChan, pValue ); pNotify->begin ( guard, type, count ); pNotify.release (); @@ -241,14 +241,14 @@ void CASG::completionNotify ( } } -void CASG :: recycleReadNotifyIO ( epicsGuard < epicsMutex > & guard, +void CASG :: recycleReadNotifyIO ( epicsGuard < epicsMutex > & guard, syncGroupReadNotify & io ) { guard.assertIdenticalMutex ( this->client.mutexRef() ); this->freeListReadOP.release ( & io ); } -void CASG :: recycleWriteNotifyIO ( epicsGuard < epicsMutex > & guard, +void CASG :: recycleWriteNotifyIO ( epicsGuard < epicsMutex > & guard, syncGroupWriteNotify & io ) { guard.assertIdenticalMutex ( this->client.mutexRef() ); diff --git a/modules/ca/src/client/SearchDest.h b/modules/ca/src/client/SearchDest.h index cb9c3e737..ce6381122 100644 --- a/modules/ca/src/client/SearchDest.h +++ b/modules/ca/src/client/SearchDest.h @@ -28,7 +28,7 @@ struct SearchDest : virtual void notify ( const caHdr & msg, const void * pPayload, const osiSockAddr & addr, const epicsTime & ) = 0; - virtual void show ( + virtual void show ( epicsGuard < epicsMutex > &, unsigned level ) const = 0; }; virtual void searchRequest ( epicsGuard < epicsMutex > &, diff --git a/modules/ca/src/client/access.cpp b/modules/ca/src/client/access.cpp index a290805f7..169a08bef 100644 --- a/modules/ca/src/client/access.cpp +++ b/modules/ca/src/client/access.cpp @@ -181,19 +181,19 @@ int epicsStdCall ca_context_create ( } pcac = ( ca_client_context * ) epicsThreadPrivateGet ( caClientContextId ); - if ( pcac ) { + if ( pcac ) { if ( premptiveCallbackSelect == ca_enable_preemptive_callback && ! pcac->preemptiveCallbakIsEnabled() ) { return ECA_NOTTHREADED; } - return ECA_NORMAL; - } + return ECA_NORMAL; + } pcac = new ca_client_context ( premptiveCallbackSelect == ca_enable_preemptive_callback ); - if ( ! pcac ) { - return ECA_ALLOCMEM; - } + if ( ! pcac ) { + return ECA_ALLOCMEM; + } epicsThreadPrivateSet ( caClientContextId, (void *) pcac ); } @@ -465,7 +465,7 @@ int epicsStdCall ca_pend_event ( ca_real timeout ) try { // preserve past odd ball behavior of waiting forever when // the delay is zero - if ( timeout == 0.0 ) { + if ( timeout == 0.0 ) { while ( true ) { pcac->pendEvent ( 60.0 ); } @@ -694,7 +694,7 @@ int epicsStdCall ca_channel_status ( epicsThreadId /* tid */ ) { ::printf ("The R3.14 EPICS OS abstraction API does not allow peeking at thread private storage of another thread.\n"); ::printf ("Please call \"ca_client_status ( unsigned level )\" from the subsystem specific diagnostic code.\n"); - return ECA_ANACHRONISM; + return ECA_ANACHRONISM; } // extern "C" @@ -798,249 +798,249 @@ const int epicsTypeToDBR_XXXX [lastEpicsType+1] = { }; const epicsType DBR_XXXXToEpicsType [LAST_BUFFER_TYPE+1] = { - epicsOldStringT, - epicsInt16T, - epicsFloat32T, - epicsEnum16T, - epicsUInt8T, - epicsInt32T, - epicsFloat64T, + epicsOldStringT, + epicsInt16T, + epicsFloat32T, + epicsEnum16T, + epicsUInt8T, + epicsInt32T, + epicsFloat64T, - epicsOldStringT, - epicsInt16T, - epicsFloat32T, - epicsEnum16T, - epicsUInt8T, - epicsInt32T, - epicsFloat64T, + epicsOldStringT, + epicsInt16T, + epicsFloat32T, + epicsEnum16T, + epicsUInt8T, + epicsInt32T, + epicsFloat64T, - epicsOldStringT, - epicsInt16T, - epicsFloat32T, - epicsEnum16T, - epicsUInt8T, - epicsInt32T, - epicsFloat64T, + epicsOldStringT, + epicsInt16T, + epicsFloat32T, + epicsEnum16T, + epicsUInt8T, + epicsInt32T, + epicsFloat64T, - epicsOldStringT, - epicsInt16T, - epicsFloat32T, - epicsEnum16T, - epicsUInt8T, - epicsInt32T, - epicsFloat64T, + epicsOldStringT, + epicsInt16T, + epicsFloat32T, + epicsEnum16T, + epicsUInt8T, + epicsInt32T, + epicsFloat64T, - epicsOldStringT, - epicsInt16T, - epicsFloat32T, - epicsEnum16T, - epicsUInt8T, - epicsInt32T, - epicsFloat64T, + epicsOldStringT, + epicsInt16T, + epicsFloat32T, + epicsEnum16T, + epicsUInt8T, + epicsInt32T, + epicsFloat64T, - epicsUInt16T, - epicsUInt16T, - epicsOldStringT, - epicsOldStringT + epicsUInt16T, + epicsUInt16T, + epicsOldStringT, + epicsOldStringT }; const unsigned short dbr_size[LAST_BUFFER_TYPE+1] = { - sizeof(dbr_string_t), /* string max size */ - sizeof(dbr_short_t), /* short */ - sizeof(dbr_float_t), /* IEEE Float */ - sizeof(dbr_enum_t), /* item number */ - sizeof(dbr_char_t), /* character */ + sizeof(dbr_string_t), /* string max size */ + sizeof(dbr_short_t), /* short */ + sizeof(dbr_float_t), /* IEEE Float */ + sizeof(dbr_enum_t), /* item number */ + sizeof(dbr_char_t), /* character */ - sizeof(dbr_long_t), /* long */ - sizeof(dbr_double_t), /* double */ - sizeof(struct dbr_sts_string), /* string field with status */ - sizeof(struct dbr_sts_short), /* short field with status */ - sizeof(struct dbr_sts_float), /* float field with status */ + sizeof(dbr_long_t), /* long */ + sizeof(dbr_double_t), /* double */ + sizeof(struct dbr_sts_string), /* string field with status */ + sizeof(struct dbr_sts_short), /* short field with status */ + sizeof(struct dbr_sts_float), /* float field with status */ - sizeof(struct dbr_sts_enum), /* item number with status */ - sizeof(struct dbr_sts_char), /* char field with status */ - sizeof(struct dbr_sts_long), /* long field with status */ - sizeof(struct dbr_sts_double), /* double field with time */ - sizeof(struct dbr_time_string), /* string field with time */ + sizeof(struct dbr_sts_enum), /* item number with status */ + sizeof(struct dbr_sts_char), /* char field with status */ + sizeof(struct dbr_sts_long), /* long field with status */ + sizeof(struct dbr_sts_double), /* double field with time */ + sizeof(struct dbr_time_string), /* string field with time */ - sizeof(struct dbr_time_short), /* short field with time */ - sizeof(struct dbr_time_float), /* float field with time */ - sizeof(struct dbr_time_enum), /* item number with time */ - sizeof(struct dbr_time_char), /* char field with time */ - sizeof(struct dbr_time_long), /* long field with time */ + sizeof(struct dbr_time_short), /* short field with time */ + sizeof(struct dbr_time_float), /* float field with time */ + sizeof(struct dbr_time_enum), /* item number with time */ + sizeof(struct dbr_time_char), /* char field with time */ + sizeof(struct dbr_time_long), /* long field with time */ - sizeof(struct dbr_time_double), /* double field with time */ - sizeof(struct dbr_sts_string), /* graphic string info */ - sizeof(struct dbr_gr_short), /* graphic short info */ - sizeof(struct dbr_gr_float), /* graphic float info */ - sizeof(struct dbr_gr_enum), /* graphic item info */ + sizeof(struct dbr_time_double), /* double field with time */ + sizeof(struct dbr_sts_string), /* graphic string info */ + sizeof(struct dbr_gr_short), /* graphic short info */ + sizeof(struct dbr_gr_float), /* graphic float info */ + sizeof(struct dbr_gr_enum), /* graphic item info */ - sizeof(struct dbr_gr_char), /* graphic char info */ - sizeof(struct dbr_gr_long), /* graphic long info */ - sizeof(struct dbr_gr_double), /* graphic double info */ - sizeof(struct dbr_sts_string), /* control string info */ - sizeof(struct dbr_ctrl_short), /* control short info */ + sizeof(struct dbr_gr_char), /* graphic char info */ + sizeof(struct dbr_gr_long), /* graphic long info */ + sizeof(struct dbr_gr_double), /* graphic double info */ + sizeof(struct dbr_sts_string), /* control string info */ + sizeof(struct dbr_ctrl_short), /* control short info */ - sizeof(struct dbr_ctrl_float), /* control float info */ - sizeof(struct dbr_ctrl_enum), /* control item info */ - sizeof(struct dbr_ctrl_char), /* control char info */ - sizeof(struct dbr_ctrl_long), /* control long info */ - sizeof(struct dbr_ctrl_double), /* control double info */ + sizeof(struct dbr_ctrl_float), /* control float info */ + sizeof(struct dbr_ctrl_enum), /* control item info */ + sizeof(struct dbr_ctrl_char), /* control char info */ + sizeof(struct dbr_ctrl_long), /* control long info */ + sizeof(struct dbr_ctrl_double), /* control double info */ - sizeof(dbr_put_ackt_t), /* put ackt */ - sizeof(dbr_put_acks_t), /* put acks */ - sizeof(struct dbr_stsack_string),/* string field with status/ack*/ - sizeof(dbr_string_t), /* string max size */ + sizeof(dbr_put_ackt_t), /* put ackt */ + sizeof(dbr_put_acks_t), /* put acks */ + sizeof(struct dbr_stsack_string),/* string field with status/ack*/ + sizeof(dbr_string_t), /* string max size */ }; const unsigned short dbr_value_size[LAST_BUFFER_TYPE+1] = { - sizeof(dbr_string_t), /* string max size */ - sizeof(dbr_short_t), /* short */ - sizeof(dbr_float_t), /* IEEE Float */ - sizeof(dbr_enum_t), /* item number */ - sizeof(dbr_char_t), /* character */ + sizeof(dbr_string_t), /* string max size */ + sizeof(dbr_short_t), /* short */ + sizeof(dbr_float_t), /* IEEE Float */ + sizeof(dbr_enum_t), /* item number */ + sizeof(dbr_char_t), /* character */ - sizeof(dbr_long_t), /* long */ - sizeof(dbr_double_t), /* double */ - sizeof(dbr_string_t), /* string max size */ - sizeof(dbr_short_t), /* short */ - sizeof(dbr_float_t), /* IEEE Float */ + sizeof(dbr_long_t), /* long */ + sizeof(dbr_double_t), /* double */ + sizeof(dbr_string_t), /* string max size */ + sizeof(dbr_short_t), /* short */ + sizeof(dbr_float_t), /* IEEE Float */ - sizeof(dbr_enum_t), /* item number */ - sizeof(dbr_char_t), /* character */ - sizeof(dbr_long_t), /* long */ - sizeof(dbr_double_t), /* double */ - sizeof(dbr_string_t), /* string max size */ + sizeof(dbr_enum_t), /* item number */ + sizeof(dbr_char_t), /* character */ + sizeof(dbr_long_t), /* long */ + sizeof(dbr_double_t), /* double */ + sizeof(dbr_string_t), /* string max size */ - sizeof(dbr_short_t), /* short */ - sizeof(dbr_float_t), /* IEEE Float */ - sizeof(dbr_enum_t), /* item number */ - sizeof(dbr_char_t), /* character */ - sizeof(dbr_long_t), /* long */ + sizeof(dbr_short_t), /* short */ + sizeof(dbr_float_t), /* IEEE Float */ + sizeof(dbr_enum_t), /* item number */ + sizeof(dbr_char_t), /* character */ + sizeof(dbr_long_t), /* long */ - sizeof(dbr_double_t), /* double */ - sizeof(dbr_string_t), /* string max size */ - sizeof(dbr_short_t), /* short */ - sizeof(dbr_float_t), /* IEEE Float */ - sizeof(dbr_enum_t), /* item number */ + sizeof(dbr_double_t), /* double */ + sizeof(dbr_string_t), /* string max size */ + sizeof(dbr_short_t), /* short */ + sizeof(dbr_float_t), /* IEEE Float */ + sizeof(dbr_enum_t), /* item number */ - sizeof(dbr_char_t), /* character */ - sizeof(dbr_long_t), /* long */ - sizeof(dbr_double_t), /* double */ - sizeof(dbr_string_t), /* string max size */ - sizeof(dbr_short_t), /* short */ + sizeof(dbr_char_t), /* character */ + sizeof(dbr_long_t), /* long */ + sizeof(dbr_double_t), /* double */ + sizeof(dbr_string_t), /* string max size */ + sizeof(dbr_short_t), /* short */ - sizeof(dbr_float_t), /* IEEE Float */ - sizeof(dbr_enum_t), /* item number */ - sizeof(dbr_char_t), /* character */ - sizeof(dbr_long_t), /* long */ - sizeof(dbr_double_t), /* double */ + sizeof(dbr_float_t), /* IEEE Float */ + sizeof(dbr_enum_t), /* item number */ + sizeof(dbr_char_t), /* character */ + sizeof(dbr_long_t), /* long */ + sizeof(dbr_double_t), /* double */ - sizeof(dbr_ushort_t), /* put_ackt */ - sizeof(dbr_ushort_t), /* put_acks */ - sizeof(dbr_string_t), /* string max size */ - sizeof(dbr_string_t), /* string max size */ + sizeof(dbr_ushort_t), /* put_ackt */ + sizeof(dbr_ushort_t), /* put_acks */ + sizeof(dbr_string_t), /* string max size */ + sizeof(dbr_string_t), /* string max size */ }; //extern "C" const enum dbr_value_class dbr_value_class[LAST_BUFFER_TYPE+1] = { - dbr_class_string, /* string max size */ - dbr_class_int, /* short */ - dbr_class_float, /* IEEE Float */ - dbr_class_int, /* item number */ - dbr_class_int, /* character */ - dbr_class_int, /* long */ - dbr_class_float, /* double */ + dbr_class_string, /* string max size */ + dbr_class_int, /* short */ + dbr_class_float, /* IEEE Float */ + dbr_class_int, /* item number */ + dbr_class_int, /* character */ + dbr_class_int, /* long */ + dbr_class_float, /* double */ - dbr_class_string, /* string max size */ - dbr_class_int, /* short */ - dbr_class_float, /* IEEE Float */ - dbr_class_int, /* item number */ - dbr_class_int, /* character */ - dbr_class_int, /* long */ - dbr_class_float, /* double */ + dbr_class_string, /* string max size */ + dbr_class_int, /* short */ + dbr_class_float, /* IEEE Float */ + dbr_class_int, /* item number */ + dbr_class_int, /* character */ + dbr_class_int, /* long */ + dbr_class_float, /* double */ - dbr_class_string, /* string max size */ - dbr_class_int, /* short */ - dbr_class_float, /* IEEE Float */ - dbr_class_int, /* item number */ - dbr_class_int, /* character */ - dbr_class_int, /* long */ - dbr_class_float, /* double */ + dbr_class_string, /* string max size */ + dbr_class_int, /* short */ + dbr_class_float, /* IEEE Float */ + dbr_class_int, /* item number */ + dbr_class_int, /* character */ + dbr_class_int, /* long */ + dbr_class_float, /* double */ - dbr_class_string, /* string max size */ - dbr_class_int, /* short */ - dbr_class_float, /* IEEE Float */ - dbr_class_int, /* item number */ - dbr_class_int, /* character */ - dbr_class_int, /* long */ - dbr_class_float, /* double */ + dbr_class_string, /* string max size */ + dbr_class_int, /* short */ + dbr_class_float, /* IEEE Float */ + dbr_class_int, /* item number */ + dbr_class_int, /* character */ + dbr_class_int, /* long */ + dbr_class_float, /* double */ - dbr_class_string, /* string max size */ - dbr_class_int, /* short */ - dbr_class_float, /* IEEE Float */ - dbr_class_int, /* item number */ - dbr_class_int, /* character */ - dbr_class_int, /* long */ - dbr_class_float, /* double */ - dbr_class_int, - dbr_class_int, - dbr_class_string, - dbr_class_string, /* string max size */ + dbr_class_string, /* string max size */ + dbr_class_int, /* short */ + dbr_class_float, /* IEEE Float */ + dbr_class_int, /* item number */ + dbr_class_int, /* character */ + dbr_class_int, /* long */ + dbr_class_float, /* double */ + dbr_class_int, + dbr_class_int, + dbr_class_string, + dbr_class_string, /* string max size */ }; const unsigned short dbr_value_offset[LAST_BUFFER_TYPE+1] = { - 0, /* string */ - 0, /* short */ - 0, /* IEEE Float */ - 0, /* item number */ - 0, /* character */ - 0, /* long */ - 0, /* IEEE double */ - (unsigned short) offsetof(dbr_sts_string,value[0]),/* string field with status */ - (unsigned short) offsetof(dbr_sts_short,value), /* short field with status */ - (unsigned short) offsetof(dbr_sts_float,value), /* float field with status */ - (unsigned short) offsetof(dbr_sts_enum,value), /* item number with status */ - (unsigned short) offsetof(dbr_sts_char,value), /* char field with status */ - (unsigned short) offsetof(dbr_sts_long,value), /* long field with status */ - (unsigned short) offsetof(dbr_sts_double,value), /* double field with time */ - (unsigned short) offsetof(dbr_time_string,value[0] ),/* string field with time */ - (unsigned short) offsetof(dbr_time_short,value), /* short field with time */ - (unsigned short) offsetof(dbr_time_float,value), /* float field with time */ - (unsigned short) offsetof(dbr_time_enum,value), /* item number with time */ - (unsigned short) offsetof(dbr_time_char,value), /* char field with time */ - (unsigned short) offsetof(dbr_time_long,value), /* long field with time */ - (unsigned short) offsetof(dbr_time_double,value), /* double field with time */ - (unsigned short) offsetof(dbr_sts_string,value[0]),/* graphic string info */ - (unsigned short) offsetof(dbr_gr_short,value), /* graphic short info */ - (unsigned short) offsetof(dbr_gr_float,value), /* graphic float info */ - (unsigned short) offsetof(dbr_gr_enum,value), /* graphic item info */ - (unsigned short) offsetof(dbr_gr_char,value), /* graphic char info */ - (unsigned short) offsetof(dbr_gr_long,value), /* graphic long info */ - (unsigned short) offsetof(dbr_gr_double,value), /* graphic double info */ - (unsigned short) offsetof(dbr_sts_string,value[0]),/* control string info */ - (unsigned short) offsetof(dbr_ctrl_short,value), /* control short info */ - (unsigned short) offsetof(dbr_ctrl_float,value), /* control float info */ - (unsigned short) offsetof(dbr_ctrl_enum,value), /* control item info */ - (unsigned short) offsetof(dbr_ctrl_char,value), /* control char info */ - (unsigned short) offsetof(dbr_ctrl_long,value), /* control long info */ - (unsigned short) offsetof(dbr_ctrl_double,value), /* control double info */ - 0, /* put ackt */ - 0, /* put acks */ - (unsigned short) offsetof(dbr_stsack_string,value[0]),/* string field with status */ - 0, /* string */ + 0, /* string */ + 0, /* short */ + 0, /* IEEE Float */ + 0, /* item number */ + 0, /* character */ + 0, /* long */ + 0, /* IEEE double */ + (unsigned short) offsetof(dbr_sts_string,value[0]), /* string field with status */ + (unsigned short) offsetof(dbr_sts_short,value), /* short field with status */ + (unsigned short) offsetof(dbr_sts_float,value), /* float field with status */ + (unsigned short) offsetof(dbr_sts_enum,value), /* item number with status */ + (unsigned short) offsetof(dbr_sts_char,value), /* char field with status */ + (unsigned short) offsetof(dbr_sts_long,value), /* long field with status */ + (unsigned short) offsetof(dbr_sts_double,value), /* double field with time */ + (unsigned short) offsetof(dbr_time_string,value[0] ), /* string field with time */ + (unsigned short) offsetof(dbr_time_short,value), /* short field with time */ + (unsigned short) offsetof(dbr_time_float,value), /* float field with time */ + (unsigned short) offsetof(dbr_time_enum,value), /* item number with time */ + (unsigned short) offsetof(dbr_time_char,value), /* char field with time */ + (unsigned short) offsetof(dbr_time_long,value), /* long field with time */ + (unsigned short) offsetof(dbr_time_double,value), /* double field with time */ + (unsigned short) offsetof(dbr_sts_string,value[0]), /* graphic string info */ + (unsigned short) offsetof(dbr_gr_short,value), /* graphic short info */ + (unsigned short) offsetof(dbr_gr_float,value), /* graphic float info */ + (unsigned short) offsetof(dbr_gr_enum,value), /* graphic item info */ + (unsigned short) offsetof(dbr_gr_char,value), /* graphic char info */ + (unsigned short) offsetof(dbr_gr_long,value), /* graphic long info */ + (unsigned short) offsetof(dbr_gr_double,value), /* graphic double info */ + (unsigned short) offsetof(dbr_sts_string,value[0]), /* control string info */ + (unsigned short) offsetof(dbr_ctrl_short,value), /* control short info */ + (unsigned short) offsetof(dbr_ctrl_float,value), /* control float info */ + (unsigned short) offsetof(dbr_ctrl_enum,value), /* control item info */ + (unsigned short) offsetof(dbr_ctrl_char,value), /* control char info */ + (unsigned short) offsetof(dbr_ctrl_long,value), /* control long info */ + (unsigned short) offsetof(dbr_ctrl_double,value), /* control double info */ + 0, /* put ackt */ + 0, /* put acks */ + (unsigned short) offsetof(dbr_stsack_string,value[0]), /* string field with status */ + 0, /* string */ }; const char *dbf_text[LAST_TYPE+3] = { - "TYPENOTCONN", - "DBF_STRING", - "DBF_SHORT", - "DBF_FLOAT", - "DBF_ENUM", - "DBF_CHAR", - "DBF_LONG", - "DBF_DOUBLE", - "DBF_NO_ACCESS" + "TYPENOTCONN", + "DBF_STRING", + "DBF_SHORT", + "DBF_FLOAT", + "DBF_ENUM", + "DBF_CHAR", + "DBF_LONG", + "DBF_DOUBLE", + "DBF_NO_ACCESS" }; const char *dbf_text_invalid = "DBF_invalid"; diff --git a/modules/ca/src/client/acctst.c b/modules/ca/src/client/acctst.c index fd18ae4b1..9f3e90714 100644 --- a/modules/ca/src/client/acctst.c +++ b/modules/ca/src/client/acctst.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -14,7 +14,7 @@ * Jeff Hill * Murali Shankar - initial versions of verifyMultithreadSubscr * Michael Abbott - initial versions of multiSubscrDestroyNoLateCallbackTest - * + * */ /* @@ -110,7 +110,7 @@ void nUpdatesTester ( struct event_handler_args args ) ( *pCtr ) ++; } else { - printf ( "subscription update failed for \"%s\" because \"%s\"", + printf ( "subscription update failed for \"%s\" because \"%s\"", ca_name ( args.chid ), ca_message ( args.status ) ); } } @@ -131,7 +131,7 @@ void monitorSubscriptionFirstUpdateTest ( const char *pName, chid chan, unsigned * verify that the first event arrives (with evid) * and channel connected */ - status = ca_add_event ( DBR_FLOAT, + status = ca_add_event ( DBR_FLOAT, chan, nUpdatesTester, &eventCount, &id ); SEVCHK ( status, 0 ); ca_flush_io (); @@ -190,7 +190,7 @@ void monitorSubscriptionFirstUpdateTest ( const char *pName, chid chan, unsigned waitCount = 0u; status = ca_search ( pName, &chan2 ); SEVCHK ( status, 0 ); - status = ca_add_event ( DBR_FLOAT, chan2, + status = ca_add_event ( DBR_FLOAT, chan2, nUpdatesTester, &eventCount, 0 ); SEVCHK ( status, 0 ); status = ca_pend_io ( timeoutToPendIO ); @@ -250,7 +250,7 @@ void ioTesterGet ( struct event_handler_args args ) ( *pCtr ) ++; } else { - printf("get call back failed for \"%s\" because \"%s\"", + printf("get call back failed for \"%s\" because \"%s\"", ca_name ( args.chid ), ca_message ( args.status ) ); } } @@ -263,7 +263,7 @@ void ioTesterEvent ( struct event_handler_args args ) SEVCHK ( status, 0 ); } else { - printf ( "subscription update failed for \"%s\" because \"%s\"", + printf ( "subscription update failed for \"%s\" because \"%s\"", ca_name ( args.chid ), ca_message ( args.status ) ); } } @@ -280,7 +280,7 @@ void verifyMonitorSubscriptionFlushIO ( chid chan, unsigned interestLevel ) /* * verify that the first event arrives */ - status = ca_add_event ( DBR_FLOAT, + status = ca_add_event ( DBR_FLOAT, chan, nUpdatesTester, &eventCount, &id ); SEVCHK (status, 0); ca_flush_io (); @@ -317,8 +317,8 @@ void getCallbackStateChange ( struct event_handler_args args ) verify ( pChan->channel == args.chid ); verify ( pChan->connected ); if ( args.status != ECA_NORMAL ) { - printf ( "getCallbackStateChange abnormal status was \"%s\"\n", - ca_message ( args.status ) ); + printf ( "getCallbackStateChange abnormal status was \"%s\"\n", + ca_message ( args.status ) ); verify ( args.status == ECA_NORMAL ); } @@ -373,7 +373,7 @@ void subscriptionStateChange ( struct event_handler_args args ) void noopSubscriptionStateChange ( struct event_handler_args args ) { if ( args.status != ECA_NORMAL ) { - printf ( "noopSubscriptionStateChange: subscription update failed for \"%s\" because \"%s\"", + printf ( "noopSubscriptionStateChange: subscription update failed for \"%s\" because \"%s\"", ca_name ( args.chid ), ca_message ( args.status ) ); } } @@ -396,7 +396,7 @@ void noopSubscriptionStateChange ( struct event_handler_args args ) * * 7) verify that a nill access rights handler can be installed */ -void verifyConnectionHandlerConnect ( appChan *pChans, unsigned chanCount, +void verifyConnectionHandlerConnect ( appChan *pChans, unsigned chanCount, unsigned repetitionCount, unsigned interestLevel ) { int status; @@ -439,7 +439,7 @@ void verifyConnectionHandlerConnect ( appChan *pChans, unsigned chanCount, showProgress ( interestLevel ); - while ( connectionUpdateCount < chanCount || + while ( connectionUpdateCount < chanCount || getCallbackCount < chanCount ) { epicsThreadSleep ( 0.1 ); ca_poll (); /* emulate typical GUI */ @@ -471,7 +471,7 @@ void verifyConnectionHandlerConnect ( appChan *pChans, unsigned chanCount, ca_self_test (); showProgress ( interestLevel ); - + for ( j = 0u; j < chanCount; j++ ) { status = ca_replace_access_rights_event ( pChans[j].channel, 0 ); @@ -494,7 +494,7 @@ void verifyConnectionHandlerConnect ( appChan *pChans, unsigned chanCount, /* * verifyBlockingConnect () * - * 1) verify that we dont print a disconnect message when + * 1) verify that we dont print a disconnect message when * we delete the last channel * * 2) verify that we delete the connection to the IOC @@ -502,7 +502,7 @@ void verifyConnectionHandlerConnect ( appChan *pChans, unsigned chanCount, * * 3) verify channel connection state variables * - * 4) verify ca_test_io () and ca_pend_io () work with + * 4) verify ca_test_io () and ca_pend_io () work with * channels w/o connection handlers * * 5) verify that the pending IO count is properly @@ -512,7 +512,7 @@ void verifyConnectionHandlerConnect ( appChan *pChans, unsigned chanCount, * 6) verify that the pending IO count goes to zero * if the channel is deleted before it connects. */ -void verifyBlockingConnect ( appChan *pChans, unsigned chanCount, +void verifyBlockingConnect ( appChan *pChans, unsigned chanCount, unsigned repetitionCount, unsigned interestLevel ) { int status; @@ -551,7 +551,7 @@ void verifyBlockingConnect ( appChan *pChans, unsigned chanCount, verify ( INVALID_DB_REQ ( ca_field_type ( pChans[j].channel ) ) ); verify ( ca_test_io () == ECA_IOINPROGRESS ); } - + status = ca_replace_access_rights_event ( pChans[j].channel, accessRightsStateChange ); SEVCHK ( status, NULL ); @@ -605,7 +605,7 @@ void verifyBlockingConnect ( appChan *pChans, unsigned chanCount, showProgress ( interestLevel ); /* - * verify that connections to IOC's that are + * verify that connections to IOC's that are * not in use are dropped */ if ( ca_get_ioc_connection_count () != backgroundConnCount ) { @@ -698,13 +698,13 @@ void verifyClear ( appChan *pChans, unsigned interestLevel ) /* * verify subscription clear before connect - * and verify that NULL evid does not cause failure + * and verify that NULL evid does not cause failure */ status = ca_search ( pChans[0].name, &pChans[0].channel ); SEVCHK ( status, NULL ); SEVCHK ( status, NULL ); - status = ca_add_event ( DBR_GR_DOUBLE, + status = ca_add_event ( DBR_GR_DOUBLE, pChans[0].channel, noopSubscriptionStateChange, NULL, NULL ); SEVCHK ( status, NULL ); @@ -791,7 +791,7 @@ void ctrlDoubleTest ( chid chan, unsigned interestLevel ) SEVCHK (status, "ctrlDoubleTest, ca_array_put"); size = dbr_size_n(DBR_CTRL_DOUBLE, ca_element_count(chan)); - pCtrlDbl = (struct dbr_ctrl_double *) malloc (size); + pCtrlDbl = (struct dbr_ctrl_double *) malloc (size); verify (pCtrlDbl!=NULL); /* @@ -846,7 +846,7 @@ void verifyBlockInPendIO ( chid chan, unsigned interestLevel ) else if ( resp != -100 ) { printf ( "CA didnt block for get to return?\n" ); } - + req = 1; resp = -100; SEVCHK ( ca_put (DBR_LONG, chan, &req), NULL ); @@ -898,7 +898,7 @@ void floatTest ( chid chan, dbr_float_t beginValue, dbr_float_t increment, /* * doubleTest () */ -void doubleTest ( chid chan, dbr_double_t beginValue, +void doubleTest ( chid chan, dbr_double_t beginValue, dbr_double_t increment, dbr_double_t epsilon, unsigned iterations) { @@ -929,7 +929,7 @@ void doubleTest ( chid chan, dbr_double_t beginValue, * Verify that we can write and then read back * the same analog value */ -void verifyAnalogIO ( chid chan, int dataType, double min, double max, +void verifyAnalogIO ( chid chan, int dataType, double min, double max, int minExp, int maxExp, double epsilon, unsigned interestLevel ) { int i; @@ -962,11 +962,11 @@ void verifyAnalogIO ( chid chan, int dataType, double min, double max, iter = 10u; } if ( dataType == DBR_FLOAT ) { - floatTest ( chan, (dbr_float_t) base, (dbr_float_t) incr, + floatTest ( chan, (dbr_float_t) base, (dbr_float_t) incr, (dbr_float_t) epsil, iter ); } else if (dataType == DBR_DOUBLE ) { - doubleTest ( chan, (dbr_double_t) base, (dbr_double_t) incr, + doubleTest ( chan, (dbr_double_t) base, (dbr_double_t) incr, (dbr_double_t) epsil, iter ); } else { @@ -983,11 +983,11 @@ void verifyAnalogIO ( chid chan, int dataType, double min, double max, iter = 10u; } if ( dataType == DBR_FLOAT ) { - floatTest ( chan, (dbr_float_t) base, (dbr_float_t) incr, + floatTest ( chan, (dbr_float_t) base, (dbr_float_t) incr, (dbr_float_t) epsil, iter ); } else if (dataType == DBR_DOUBLE ) { - doubleTest ( chan, (dbr_double_t) base, (dbr_double_t) incr, + doubleTest ( chan, (dbr_double_t) base, (dbr_double_t) incr, (dbr_double_t) epsil, iter ); } else { @@ -1004,11 +1004,11 @@ void verifyAnalogIO ( chid chan, int dataType, double min, double max, iter = 10l; } if ( dataType == DBR_FLOAT ) { - floatTest ( chan, (dbr_float_t) base, (dbr_float_t) incr, + floatTest ( chan, (dbr_float_t) base, (dbr_float_t) incr, (dbr_float_t) epsil, iter ); } else if (dataType == DBR_DOUBLE ) { - doubleTest ( chan, (dbr_double_t) base, (dbr_double_t) incr, + doubleTest ( chan, (dbr_double_t) base, (dbr_double_t) incr, (dbr_double_t) epsil, iter ); } else { @@ -1045,7 +1045,7 @@ void verifyLongIO ( chid chan, unsigned interestLevel ) if ( incr == 0 ) { incr = 1; } - for ( iter = cl.lower_ctrl_limit; + for ( iter = cl.lower_ctrl_limit; iter <= cl.upper_ctrl_limit; iter+=incr ) { ca_put ( DBR_LONG, chan, &iter ); @@ -1089,8 +1089,8 @@ void verifyShortIO ( chid chan, unsigned interestLevel ) if ( incr == 0 ) { incr = 1; } - for ( iter = (dbr_short_t) cl.lower_ctrl_limit; - iter <= (dbr_short_t) cl.upper_ctrl_limit; + for ( iter = (dbr_short_t) cl.lower_ctrl_limit; + iter <= (dbr_short_t) cl.upper_ctrl_limit; iter = (dbr_short_t) (iter + incr) ) { ca_put ( DBR_SHORT, chan, &iter ); @@ -1131,7 +1131,7 @@ void verifyHighThroughputRead ( chid chan, unsigned interestLevel ) } } -void verifyHighThroughputWrite ( chid chan, unsigned interestLevel ) +void verifyHighThroughputWrite ( chid chan, unsigned interestLevel ) { int status; unsigned i; @@ -1155,12 +1155,12 @@ void verifyHighThroughputWrite ( chid chan, unsigned interestLevel ) * verify we dont jam up on many uninterrupted * get callback requests */ -void verifyHighThroughputReadCallback ( chid chan, unsigned interestLevel ) +void verifyHighThroughputReadCallback ( chid chan, unsigned interestLevel ) { unsigned i; int status; - if ( ca_read_access ( chan ) ) { + if ( ca_read_access ( chan ) ) { unsigned count = 0u; showProgressBegin ( "verifyHighThroughputReadCallback", interestLevel ); for ( i=0; i<10000; i++ ) { @@ -1203,10 +1203,10 @@ void verifyHighThroughputWriteCallback ( chid chan, unsigned interestLevel ) SEVCHK ( ca_flush_io (), NULL ); dval = 0.0; status = ca_get ( DBR_DOUBLE, chan, &dval ); - SEVCHK ( status, + SEVCHK ( status, "verifyHighThroughputWriteCallback, verification get" ); status = ca_pend_io ( timeoutToPendIO ); - SEVCHK ( status, + SEVCHK ( status, "verifyHighThroughputWriteCallback, verification get pend" ); verify ( dval == i ); showProgressEnd ( interestLevel ); @@ -1360,9 +1360,9 @@ static void noLateCallbackDetect ( struct event_handler_args args ) verify ( callbackIsOk ); } -static void multiSubscrDestroyNoLateCallbackThread ( void * pParm ) +static void multiSubscrDestroyNoLateCallbackThread ( void * pParm ) { - struct MultiSubscrDestroyNoLateCallbackTestData * const pTestData = + struct MultiSubscrDestroyNoLateCallbackTestData * const pTestData = ( struct MultiSubscrDestroyNoLateCallbackTestData * ) pParm; unsigned i, j; int status; @@ -1391,10 +1391,10 @@ static void multiSubscrDestroyNoLateCallbackThread ( void * pParm ) SEVCHK ( ca_add_event ( DBR_GR_FLOAT, pTestData->m_chan, noLateCallbackDetect, &pTestData->m_eventData[j], &pTestData->m_eventData[j].m_id ) , NULL ); } - SEVCHK ( ca_flush_io(), NULL ); + SEVCHK ( ca_flush_io(), NULL ); /* - * raise the priority of the current thread hoping to improve our + * raise the priority of the current thread hoping to improve our * likelyhood of detecting a bug */ priorityOfTestThread = epicsThreadGetPrioritySelf (); @@ -1445,7 +1445,7 @@ static void multiSubscrDestroyNoLateCallbackThread ( void * pParm ) } /* - * verify that, in a preemtive callback mode client, a subscription callback never + * verify that, in a preemtive callback mode client, a subscription callback never * comes after the subscription is destroyed */ static void multiSubscrDestroyNoLateCallbackTest ( const char *pName, unsigned interestLevel ) @@ -1456,13 +1456,13 @@ static void multiSubscrDestroyNoLateCallbackTest ( const char *pName, unsigned i pTestData = calloc ( 1u, sizeof ( struct MultiSubscrDestroyNoLateCallbackTestData ) ); verify ( pTestData ); - pTestData->m_mutex = epicsMutexMustCreate (); + pTestData->m_mutex = epicsMutexMustCreate (); pTestData->m_testDoneEvent = epicsEventMustCreate ( epicsEventEmpty ); pTestData->m_pChanName = pName; pTestData->m_interestLevel = interestLevel; epicsThreadMustCreate ( "multiSubscrDestroyNoLateCallbackTest", - epicsThreadPriorityLow, + epicsThreadPriorityLow, epicsThreadGetStackSize ( epicsThreadStackMedium ), multiSubscrDestroyNoLateCallbackThread, pTestData ); @@ -1488,7 +1488,7 @@ static void multiSubscrDestroyNoLateCallbackTest ( const char *pName, unsigned i * 1) verify we can add many monitors at once * 2) verify that under heavy load the last monitor * returned is the last modification sent - * 3) attempt to delete monitors while many monitors + * 3) attempt to delete monitors while many monitors * are running */ void multiSubscriptionDeleteTest ( chid chan, unsigned interestLevel ) @@ -1497,7 +1497,7 @@ void multiSubscriptionDeleteTest ( chid chan, unsigned interestLevel ) evid mid[1000]; dbr_float_t temp, getResp; unsigned i; - + showProgressBegin ( "multiSubscriptionDeleteTest", interestLevel ); for ( i=0; i < NELEMENTS (mid); i++ ) { @@ -1510,7 +1510,7 @@ void multiSubscriptionDeleteTest ( chid chan, unsigned interestLevel ) * complete * * NOTE: this hopefully demonstrates that when the - * server is very busy with monitors the client + * server is very busy with monitors the client * is still able to punch through with a request. */ SEVCHK ( ca_get ( DBR_FLOAT,chan,&getResp ), NULL ); @@ -1521,7 +1521,7 @@ void multiSubscriptionDeleteTest ( chid chan, unsigned interestLevel ) /* * attempt to generate heavy event traffic before initiating * the monitor delete - */ + */ if ( ca_write_access (chan) ) { for ( i=0; i < NELEMENTS (mid); i++ ) { temp = (float) i; @@ -1532,12 +1532,12 @@ void multiSubscriptionDeleteTest ( chid chan, unsigned interestLevel ) showProgress ( interestLevel ); /* - * without pausing begin deleting the event subscriptions + * without pausing begin deleting the event subscriptions * while the queue is full * - * continue attempting to generate heavy event traffic - * while deleting subscriptions with the hope that we will - * deleting an event at the instant that its callback is + * continue attempting to generate heavy event traffic + * while deleting subscriptions with the hope that we will + * deleting an event at the instant that its callback is * occurring */ for ( i=0; i < NELEMENTS (mid); i++ ) { @@ -1557,14 +1557,14 @@ void multiSubscriptionDeleteTest ( chid chan, unsigned interestLevel ) SEVCHK ( ca_pend_io (timeoutToPendIO), NULL ); showProgressEnd ( interestLevel ); -} +} /* * singleSubscriptionDeleteTest * - * verify that we dont fail when we repeatedly create - * and delete only one subscription with a high level of + * verify that we dont fail when we repeatedly create + * and delete only one subscription with a high level of * traffic on it */ void singleSubscriptionDeleteTest ( chid chan, unsigned interestLevel ) @@ -1573,7 +1573,7 @@ void singleSubscriptionDeleteTest ( chid chan, unsigned interestLevel ) evid sid; dbr_float_t temp, getResp; unsigned i; - + showProgressBegin ( "singleSubscriptionDeleteTest", interestLevel ); for ( i=0; i < 1000; i++ ){ @@ -1595,14 +1595,14 @@ void singleSubscriptionDeleteTest ( chid chan, unsigned interestLevel ) * attempt to generate heavy event traffic before initiating * the monitor delete * - * try to interrupt the recv thread while it is processing + * try to interrupt the recv thread while it is processing * incoming subscription updates - */ + */ if ( ca_write_access (chan) ) { unsigned j = 0; while ( j < i ) { temp = (float) j++; - SEVCHK ( ca_put (DBR_FLOAT, chan, &temp), + SEVCHK ( ca_put (DBR_FLOAT, chan, &temp), "singleSubscriptionDeleteTest - one of multiple puts" ); } ca_flush_io (); @@ -1612,7 +1612,7 @@ void singleSubscriptionDeleteTest ( chid chan, unsigned interestLevel ) } showProgressEnd ( interestLevel ); -} +} /* * channelClearWithEventTrafficTest @@ -1626,13 +1626,13 @@ void channelClearWithEventTrafficTest ( const char *pName, unsigned interestLeve evid sid; dbr_float_t temp, getResp; unsigned i; - + showProgressBegin ( "channelClearWithEventTrafficTest", interestLevel ); for ( i=0; i < 1000; i++ ) { chid chan; - int status = ca_create_channel ( pName, 0, 0, + int status = ca_create_channel ( pName, 0, 0, CA_PRIORITY_DEFAULT, &chan ); status = ca_pend_io ( timeoutToPendIO ); SEVCHK ( status, "channelClearWithEventTrafficTest: channel connect failed" ); @@ -1652,9 +1652,9 @@ void channelClearWithEventTrafficTest ( const char *pName, unsigned interestLeve * attempt to generate heavy event traffic before initiating * the channel delete * - * try to interrupt the recv thread while it is processing + * try to interrupt the recv thread while it is processing * incoming subscription updates - */ + */ if ( ca_write_access (chan) ) { unsigned j = 0; while ( j < i ) { @@ -1669,7 +1669,7 @@ void channelClearWithEventTrafficTest ( const char *pName, unsigned interestLeve } showProgressEnd ( interestLevel ); -} +} @@ -1679,7 +1679,7 @@ void selfDeleteEvent ( struct event_handler_args args ) { int status; status = ca_clear_event ( globalEventID ); - verify ( status == ECA_NORMAL ); + verify ( status == ECA_NORMAL ); } void eventClearTest ( chid chan ) @@ -1687,29 +1687,29 @@ void eventClearTest ( chid chan ) int status; evid monix1, monix2, monix3; - status = ca_add_event ( DBR_FLOAT, chan, noopSubscriptionStateChange, + status = ca_add_event ( DBR_FLOAT, chan, noopSubscriptionStateChange, NULL, &monix1 ); SEVCHK ( status, NULL ); status = ca_clear_event ( monix1 ); SEVCHK ( status, NULL ); - status = ca_add_event ( DBR_FLOAT, chan, noopSubscriptionStateChange, + status = ca_add_event ( DBR_FLOAT, chan, noopSubscriptionStateChange, NULL, &monix1 ); SEVCHK ( status, NULL ); - status = ca_add_event ( DBR_FLOAT, chan, noopSubscriptionStateChange, + status = ca_add_event ( DBR_FLOAT, chan, noopSubscriptionStateChange, NULL, &monix2); SEVCHK (status, NULL); status = ca_clear_event ( monix2 ); SEVCHK ( status, NULL); - status = ca_add_event ( DBR_FLOAT, chan, noopSubscriptionStateChange, + status = ca_add_event ( DBR_FLOAT, chan, noopSubscriptionStateChange, NULL, &monix2); SEVCHK ( status, NULL ); - status = ca_add_event ( DBR_FLOAT, chan, noopSubscriptionStateChange, + status = ca_add_event ( DBR_FLOAT, chan, noopSubscriptionStateChange, NULL, &monix3); SEVCHK ( status, NULL ); @@ -1722,7 +1722,7 @@ void eventClearTest ( chid chan ) status = ca_clear_event ( monix3 ); SEVCHK ( status, NULL); - status = ca_add_event ( DBR_FLOAT, chan, selfDeleteEvent, + status = ca_add_event ( DBR_FLOAT, chan, selfDeleteEvent, 0, &globalEventID ); SEVCHK ( status, NULL ); } @@ -1739,7 +1739,7 @@ void arrayEventExceptionNotify ( struct event_handler_args args ) if ( args.status == ECA_NORMAL ) { printf ( "arrayEventExceptionNotify: expected " - "exception but didnt receive one against \"%s\" \n", + "exception but didnt receive one against \"%s\" \n", ca_name ( args.chid ) ); } else { @@ -1765,8 +1765,8 @@ void exceptionTest ( chid chan, unsigned interestLevel ) pRS = malloc ( ca_element_count (chan) * sizeof (*pRS) ); verify ( pRS ); - status = ca_array_get ( DBR_PUT_ACKT, - ca_element_count (chan), chan, pRS ); + status = ca_array_get ( DBR_PUT_ACKT, + ca_element_count (chan), chan, pRS ); SEVCHK ( status, "array read request failed" ); ca_pend_io ( 1e-5 ); epicsThreadSleep ( 0.1 ); @@ -1787,8 +1787,8 @@ void exceptionTest ( chid chan, unsigned interestLevel ) */ { arrayEventExceptionNotifyComplete = 0u; - status = ca_array_get_callback ( DBR_PUT_ACKT, - ca_element_count (chan), chan, arrayEventExceptionNotify, 0 ); + status = ca_array_get_callback ( DBR_PUT_ACKT, + ca_element_count (chan), chan, arrayEventExceptionNotify, 0 ); if ( status != ECA_NORMAL ) { verify ( status == ECA_BADTYPE || status == ECA_GETFAIL ); arrayEventExceptionNotifyComplete = 1; @@ -1811,8 +1811,8 @@ void exceptionTest ( chid chan, unsigned interestLevel ) evid id; arrayEventExceptionNotifyComplete = 0u; - status = ca_add_array_event ( DBR_PUT_ACKT, ca_element_count ( chan ), - chan, arrayEventExceptionNotify, 0, 0.0, 0.0, 0.0, &id ); + status = ca_add_array_event ( DBR_PUT_ACKT, ca_element_count ( chan ), + chan, arrayEventExceptionNotify, 0, 0.0, 0.0, 0.0, &id ); if ( status != ECA_NORMAL ) { verify ( status == ECA_BADTYPE || status == ECA_GETFAIL ); arrayEventExceptionNotifyComplete = 1; @@ -1846,8 +1846,8 @@ void exceptionTest ( chid chan, unsigned interestLevel ) for ( i = 0; i < ca_element_count (chan); i++ ) { strcpy ( pWS[i], "@#$%" ); } - status = ca_array_put ( DBR_STRING, - ca_element_count (chan), chan, pWS ); + status = ca_array_put ( DBR_STRING, + ca_element_count (chan), chan, pWS ); if ( status != ECA_NORMAL ) { verify ( status == ECA_BADTYPE || status == ECA_PUTFAIL ); acctstExceptionCount++; /* local PV case */ @@ -1879,9 +1879,9 @@ void exceptionTest ( chid chan, unsigned interestLevel ) strcpy ( pWS[i], "@#$%" ); } arrayEventExceptionNotifyComplete = 0u; - status = ca_array_put_callback ( DBR_STRING, + status = ca_array_put_callback ( DBR_STRING, ca_element_count (chan), chan, pWS, - arrayEventExceptionNotify, 0); + arrayEventExceptionNotify, 0); if ( status != ECA_NORMAL ) { arrayEventExceptionNotifyComplete = 1; } @@ -1924,7 +1924,7 @@ void arrayWriteNotify ( struct event_handler_args args ) arrayWriteNotifyComplete = 1; } else { - printf ( "arrayWriteNotify: update failed for \"%s\" because \"%s\"", + printf ( "arrayWriteNotify: update failed for \"%s\" because \"%s\"", ca_name ( args.chid ), ca_message ( args.status ) ); } } @@ -1956,15 +1956,15 @@ void arrayTest ( chid chan, unsigned maxArrayBytes, unsigned interestLevel ) pWF[i] = rand (); pRF[i] = - pWF[i]; } - status = ca_array_put ( DBR_DOUBLE, ca_element_count ( chan ), - chan, pWF ); + status = ca_array_put ( DBR_DOUBLE, ca_element_count ( chan ), + chan, pWF ); SEVCHK ( status, "array write request failed" ); /* * read back the array */ - status = ca_array_get ( DBR_DOUBLE, ca_element_count (chan), - chan, pRF ); + status = ca_array_get ( DBR_DOUBLE, ca_element_count (chan), + chan, pRF ); SEVCHK ( status, "array read request failed" ); status = ca_pend_io ( timeoutToPendIO ); SEVCHK ( status, "array read failed" ); @@ -1991,8 +1991,8 @@ void arrayTest ( chid chan, unsigned maxArrayBytes, unsigned interestLevel ) pRS = malloc ( ca_element_count (chan) * MAX_STRING_SIZE ); verify ( pRS ); - status = ca_array_get ( DBR_STRING, - ca_element_count (chan), chan, pRS ); + status = ca_array_get ( DBR_STRING, + ca_element_count (chan), chan, pRS ); SEVCHK ( status, "array read request failed" ); status = ca_pend_io ( timeoutToPendIO ); SEVCHK ( status, "array read failed" ); @@ -2010,11 +2010,11 @@ void arrayTest ( chid chan, unsigned maxArrayBytes, unsigned interestLevel ) pWF[i] = rand (); pRF[i] = - pWF[i]; } - status = ca_array_put_callback ( DBR_DOUBLE, ca_element_count (chan), - chan, pWF, arrayWriteNotify, 0 ); + status = ca_array_put_callback ( DBR_DOUBLE, ca_element_count (chan), + chan, pWF, arrayWriteNotify, 0 ); SEVCHK ( status, "array write notify request failed" ); - status = ca_array_get_callback ( DBR_DOUBLE, ca_element_count (chan), - chan, arrayReadNotify, pWF ); + status = ca_array_get_callback ( DBR_DOUBLE, ca_element_count (chan), + chan, arrayReadNotify, pWF ); SEVCHK ( status, "array read notify request failed" ); ca_flush_io (); while ( ! arrayWriteNotifyComplete || ! arrayReadNotifyComplete ) { @@ -2030,11 +2030,11 @@ void arrayTest ( chid chan, unsigned maxArrayBytes, unsigned interestLevel ) pRF[i] = - pWF[i]; } arrayReadNotifyComplete = 0; - status = ca_array_put ( DBR_DOUBLE, ca_element_count ( chan ), - chan, pWF ); + status = ca_array_put ( DBR_DOUBLE, ca_element_count ( chan ), + chan, pWF ); SEVCHK ( status, "array write notify request failed" ); - status = ca_add_array_event ( DBR_DOUBLE, ca_element_count ( chan ), - chan, arrayReadNotify, pWF, 0.0, 0.0, 0.0, &id ); + status = ca_add_array_event ( DBR_DOUBLE, ca_element_count ( chan ), + chan, arrayReadNotify, pWF, 0.0, 0.0, 0.0, &id ); SEVCHK ( status, "array subscription request failed" ); ca_flush_io (); while ( ! arrayReadNotifyComplete ) { @@ -2052,8 +2052,8 @@ void arrayTest ( chid chan, unsigned maxArrayBytes, unsigned interestLevel ) acctstExceptionCount = 0u; status = ca_add_exception_event ( acctstExceptionNotify, 0 ); SEVCHK ( status, "exception notify install failed" ); - status = ca_array_get ( DBR_DOUBLE, - ca_element_count (chan)+1, chan, pRF ); + status = ca_array_get ( DBR_DOUBLE, + ca_element_count (chan)+1, chan, pRF ); if ( status == ECA_NORMAL ) { ca_poll (); while ( acctstExceptionCount < 1u ) { @@ -2076,7 +2076,7 @@ void arrayTest ( chid chan, unsigned maxArrayBytes, unsigned interestLevel ) showProgressEnd ( interestLevel ); } -/* +/* * verify that unequal send/recv buffer sizes work * (a bug related to this test was detected in early R3.14) * @@ -2115,8 +2115,8 @@ void unequalServerBufferSizeTest ( const char * pName, unsigned interestLevel ) pWF = (dbr_double_t *) calloc ( ca_element_count (newChan), sizeof (*pWF) ); verify ( pWF != NULL ); - status = ca_array_get ( DBR_DOUBLE, ca_element_count ( newChan ), - newChan, pRF ); + status = ca_array_get ( DBR_DOUBLE, ca_element_count ( newChan ), + newChan, pRF ); status = ca_pend_io ( timeoutToPendIO ); verify ( status == ECA_NORMAL ); status = ca_clear_channel ( newChan ); @@ -2131,11 +2131,11 @@ void unequalServerBufferSizeTest ( const char * pName, unsigned interestLevel ) showProgress ( interestLevel ); - status = ca_array_put ( DBR_DOUBLE, ca_element_count ( newChan ), - newChan, pWF ); + status = ca_array_put ( DBR_DOUBLE, ca_element_count ( newChan ), + newChan, pWF ); verify ( status == ECA_NORMAL ); - status = ca_array_get ( DBR_DOUBLE, 1, - newChan, pRF ); + status = ca_array_get ( DBR_DOUBLE, 1, + newChan, pRF ); verify ( status == ECA_NORMAL ); status = ca_pend_io ( timeoutToPendIO ); verify ( status == ECA_NORMAL ); @@ -2205,9 +2205,9 @@ void verifyDataTypeMacros (void) verify ( dbf_type_is_valid ( DBF_SHORT ) ); { int dataType = -1; - dbf_text_to_type ( "DBF_SHORT", dataType ); + dbf_text_to_type ( "DBF_SHORT", dataType ); verify ( dataType == DBF_SHORT ); - dbr_text_to_type ( "DBR_CLASS_NAME", dataType ); + dbr_text_to_type ( "DBR_CLASS_NAME", dataType ); verify ( dataType == DBR_CLASS_NAME ); } } @@ -2225,7 +2225,7 @@ void updateTestEvent ( struct event_handler_args args ) { eventTest *pET = (eventTest *) args.usr; struct dbr_gr_float *pGF = (struct dbr_gr_float *) args.dbr; - pET->lastValue = pGF->value; + pET->lastValue = pGF->value; pET->count++; } @@ -2246,7 +2246,7 @@ void clearChannelInGetCallbackTest ( const char *pName, unsigned level ) unsigned i; chid chan; int status; - + showProgressBegin ( "clearChannelInGetCallbackTest", level ); for ( i = 0; ca_get_ioc_connection_count () > 0 ; i++ ) { @@ -2259,15 +2259,15 @@ void clearChannelInGetCallbackTest ( const char *pName, unsigned level ) status = ca_pend_io ( timeoutToPendIO ); SEVCHK ( status, "clearChannelInGetCallbackTest connect channel" ); - + status = ca_get_callback ( DBR_DOUBLE, chan, callbackClearsChannel, 0 ); SEVCHK ( status, "clearChannelInGetCallbackTest get callback" ); - + for ( i = 0; ca_get_ioc_connection_count () > 0 ; i++ ) { ca_pend_event ( 0.1 ); verify ( i < 100 ); } - + showProgressEnd ( level ); } @@ -2277,7 +2277,7 @@ void clearChannelInPutCallbackTest ( const char *pName, unsigned level ) const dbr_double_t value = 1.1; chid chan; int status; - + showProgressBegin ( "clearChannelInPutCallbackTest", level ); for ( i = 0; ca_get_ioc_connection_count () > 0 ; i++ ) { @@ -2291,15 +2291,15 @@ void clearChannelInPutCallbackTest ( const char *pName, unsigned level ) status = ca_pend_io ( timeoutToPendIO ); SEVCHK ( status, "clearChannelInPutCallbackTest connect channel" ); - status = ca_put_callback ( DBR_DOUBLE, chan, & value, + status = ca_put_callback ( DBR_DOUBLE, chan, & value, callbackClearsChannel, 0 ); SEVCHK ( status, "clearChannelInPutCallbackTest get callback" ); - + for ( i = 0; ca_get_ioc_connection_count () > 0 ; i++ ) { ca_pend_event ( 0.1 ); verify ( i < 100 ); } - + showProgressEnd ( level ); } @@ -2308,7 +2308,7 @@ void clearChannelInSubscrCallbackTest ( const char *pName, unsigned level ) unsigned i; chid chan; int status; - + showProgressBegin ( "clearChannelInSubscrCallbackTest", level ); for ( i = 0; ca_get_ioc_connection_count () > 0 ; i++ ) { @@ -2321,8 +2321,8 @@ void clearChannelInSubscrCallbackTest ( const char *pName, unsigned level ) status = ca_pend_io ( timeoutToPendIO ); SEVCHK ( status, "clearChannelInSubscrCallbackTest connect channel" ); - - status = ca_create_subscription ( DBR_DOUBLE, 1, chan, + + status = ca_create_subscription ( DBR_DOUBLE, 1, chan, DBE_VALUE, callbackClearsChannel, 0, 0 ); SEVCHK ( status, "clearChannelInSubscrCallbackTest subscribe" ); @@ -2330,18 +2330,18 @@ void clearChannelInSubscrCallbackTest ( const char *pName, unsigned level ) ca_pend_event ( 0.1 ); verify ( i < 100 ); } - + showProgressEnd ( level ); } -void monitorAddConnectionCallback ( struct connection_handler_args args ) +void monitorAddConnectionCallback ( struct connection_handler_args args ) { if ( args.op == CA_OP_CONN_UP ) { unsigned * pEventCount = ( unsigned * ) ca_puser ( args.chid ); int status; verify ( *pEventCount == 0u ); (*pEventCount)++; - status = ca_create_subscription ( DBR_DOUBLE, 1, + status = ca_create_subscription ( DBR_DOUBLE, 1, args.chid, DBE_VALUE, nUpdatesTester, ca_puser ( args.chid ), 0 ); SEVCHK ( status, "monitorAddConnectionCallback create subscription" ); } @@ -2363,7 +2363,7 @@ void monitorAddConnectionCallbackTest ( const char *pName, unsigned interestLeve int status; unsigned eventCount = 0u; unsigned getCallbackCount = 0u; - + showProgressBegin ( "monitorAddConnectionCallbackTest", interestLevel ); for ( i = 0; ca_get_ioc_connection_count () > 0 ; i++ ) { @@ -2371,7 +2371,7 @@ void monitorAddConnectionCallbackTest ( const char *pName, unsigned interestLeve verify ( i < 100 ); } - status = ca_create_channel ( pName, + status = ca_create_channel ( pName, monitorAddConnectionCallback, &eventCount, 0, & chan ); SEVCHK ( status, "monitorAddConnectionCallbackTest create channel" ); @@ -2379,7 +2379,7 @@ void monitorAddConnectionCallbackTest ( const char *pName, unsigned interestLeve ca_pend_event ( 0.1 ); } verify ( eventCount >= 2u ); - + status = ca_get_callback ( DBR_DOUBLE, chan, nUpdatesTester, &getCallbackCount ); SEVCHK ( status, "monitorAddConnectionCallback get callback" ); while ( getCallbackCount == 0 ) { @@ -2390,7 +2390,7 @@ void monitorAddConnectionCallbackTest ( const char *pName, unsigned interestLeve status = ca_clear_channel ( chan ); SEVCHK ( status, "monitorAddConnectionCallbackTest clear channel" ); - + status = ca_flush_io (); SEVCHK ( status, "monitorAddConnectionCallbackTest flush" ); @@ -2423,7 +2423,7 @@ void monitorUpdateTest ( chid chan, unsigned interestLevel ) printf ("skipped monitorUpdateTest test - not an analog type\n"); return; } - + showProgressBegin ( "monitorUpdateTest", interestLevel ); /* @@ -2444,12 +2444,12 @@ void monitorUpdateTest ( chid chan, unsigned interestLevel ) * complete * * NOTE: this hopefully demonstrates that when the - * server is very busy with monitors the client + * server is very busy with monitors the client * is still able to punch through with a request. */ SEVCHK ( ca_get ( DBR_FLOAT, chan, &getResp) ,NULL ); SEVCHK ( ca_pend_io ( timeoutToPendIO ) ,NULL ); - + showProgress ( interestLevel ); /* @@ -2483,7 +2483,7 @@ void monitorUpdateTest ( chid chan, unsigned interestLevel ) /* * attempt to uncover problems where the last event isnt sent * and hopefully get into a flow control situation - */ + */ prevPassCount = 0u; for ( i = 0; i < 10; i++ ) { for ( j = 0; j < NELEMENTS(test); j++ ) { @@ -2492,7 +2492,7 @@ void monitorUpdateTest ( chid chan, unsigned interestLevel ) test[j].lastValue = -1.0f; SEVCHK ( ca_add_event ( DBR_GR_FLOAT, chan, updateTestEvent, &test[j], &test[j].id ) , NULL ); - } + } for ( j = 0; j <= i; j++ ) { temp = monitorUpdateTestPattern ( j ); @@ -2522,7 +2522,7 @@ void monitorUpdateTest ( chid chan, unsigned interestLevel ) ca_poll (); /* emulate typical GUI */ for ( j = 0; j < NELEMENTS ( test ); j++ ) { /* - * we shouldnt see old monitors because + * we shouldnt see old monitors because * we resubscribed */ verify ( test[j].count <= i + 2 ); @@ -2562,12 +2562,12 @@ void monitorUpdateTest ( chid chan, unsigned interestLevel ) showProgress ( interestLevel ); /* - * delete the event subscriptions + * delete the event subscriptions */ for ( i = 0; i < NELEMENTS ( test ); i++ ) { SEVCHK ( ca_clear_event ( test[i].id ), NULL ); } - + /* * force all of the clear event requests to * complete @@ -2578,7 +2578,7 @@ void monitorUpdateTest ( chid chan, unsigned interestLevel ) /* printf ( "flow control bypassed %u events\n", flowCtrlCount ); */ showProgressEnd ( interestLevel ); -} +} void verifyReasonableBeaconPeriod ( chid chan, unsigned interestLevel ) { @@ -2594,7 +2594,7 @@ void verifyReasonableBeaconPeriod ( chid chan, unsigned interestLevel ) ca_beacon_anomaly_count () ); beaconPeriod = ca_beacon_period ( chan ); - printf ( "Estimated beacon period for channel %s = %g sec.\n", + printf ( "Estimated beacon period for channel %s = %g sec.\n", ca_name ( chan ), beaconPeriod ); watchDogDelay = ca_receive_watchdog_delay ( chan ); @@ -2603,8 +2603,8 @@ void verifyReasonableBeaconPeriod ( chid chan, unsigned interestLevel ) printf ( "busy: receive watchdog for \"%s\" expires in %g sec.\n", ca_name ( chan ), watchDogDelay ); - /* - * let one default connection timeout go by w/o receive activity + /* + * let one default connection timeout go by w/o receive activity * so we can see if beacons reset the watchdog */ for ( i = 0u; i < 15u; i++ ) { @@ -2667,18 +2667,18 @@ void verifyTimeStamps ( chid chan, unsigned interestLevel ) status = ca_pend_io ( timeoutToPendIO ); verify ( status == ECA_NORMAL ); - length = epicsTimeToStrftime ( buf, sizeof ( buf ), + length = epicsTimeToStrftime ( buf, sizeof ( buf ), "%a %b %d %Y %H:%M:%S.%f", & first.stamp ); verify ( length ); - printf ("Processing time of channel \"%s\" was \"%s\"\n", + printf ("Processing time of channel \"%s\" was \"%s\"\n", ca_name ( chan ), buf ); diff = epicsTimeDiffInSeconds ( & last.stamp, & first.stamp ); - printf ("Time difference between two successive reads was %g sec\n", + printf ("Time difference between two successive reads was %g sec\n", diff ); diff = epicsTimeDiffInSeconds ( & first.stamp, & localTime ); - printf ("Time difference between client and server %g sec\n", + printf ("Time difference between client and server %g sec\n", diff ); showProgressEnd ( interestLevel ); @@ -2700,7 +2700,7 @@ void verifyChannelPriorities ( const char *pName, unsigned interestLevel ) double value; chid chan0, chan1; unsigned priority0, priority1; - + priority0 = ( i * ( CA_PRIORITY_MAX - CA_PRIORITY_MIN ) ) / nPrio; priority0 += CA_PRIORITY_MIN; if ( priority0 > CA_PRIORITY_MAX ) { @@ -2713,11 +2713,11 @@ void verifyChannelPriorities ( const char *pName, unsigned interestLevel ) priority1 = CA_PRIORITY_MAX; } - status = ca_create_channel ( pName, 0, 0, + status = ca_create_channel ( pName, 0, 0, priority0, &chan0 ); SEVCHK ( status, "prioritized channel create failed" ); - status = ca_create_channel ( pName, 0, 0, + status = ca_create_channel ( pName, 0, 0, priority1, &chan1 ); SEVCHK ( status, "prioritized channel create failed" ); @@ -2751,8 +2751,8 @@ void verifyChannelPriorities ( const char *pName, unsigned interestLevel ) showProgressEnd ( interestLevel ); } -void verifyTearDownWhenChannelConnected ( const char * pName, - enum ca_preemptive_callback_select select, +void verifyTearDownWhenChannelConnected ( const char * pName, + enum ca_preemptive_callback_select select, unsigned interestLevel ) { static const unsigned chanCount = 20; @@ -2761,15 +2761,15 @@ void verifyTearDownWhenChannelConnected ( const char * pName, chid * const pChans = (chid * const) calloc ( chanCount, sizeof ( *pChans ) ); double * const pValues = (double * const) calloc ( chanCount, sizeof ( *pValues ) ); unsigned i, j; - + verify ( pChans && pValues ); - + showProgressBegin ( "verifyTearDownWhenChannelConnected", interestLevel ); for ( i = 0u; i < loopCount; i++ ) { int status; ca_context_create ( select ); - + for ( j = 0; j < chanCount; j++ ) { status = ca_create_channel ( pName, 0, 0, 0, & pChans[j] ); SEVCHK ( status, "immediate tear down channel create failed" ); @@ -2782,11 +2782,11 @@ void verifyTearDownWhenChannelConnected ( const char * pName, status = ca_get ( DBR_DOUBLE, pChans[j], &pValues[j] ); SEVCHK ( status, "immediate tear down channel get failed" ); } - + status = ca_pend_io ( timeoutToPendIO ); SEVCHK ( status, "immediate tear down get pend io failed" ); - ca_context_destroy (); + ca_context_destroy (); } ca_context_create ( select ); @@ -2798,8 +2798,8 @@ void verifyTearDownWhenChannelConnected ( const char * pName, } -void verifyImmediateTearDown ( const char * pName, - enum ca_preemptive_callback_select select, +void verifyImmediateTearDown ( const char * pName, + enum ca_preemptive_callback_select select, unsigned interestLevel ) { int i; @@ -2817,8 +2817,8 @@ void verifyImmediateTearDown ( const char * pName, status = ca_pend_io ( timeoutToPendIO ); SEVCHK ( status, "immediate tear down channel connect failed" ); verify ( status == ECA_NORMAL ); - /* - * verify that puts pending when we call ca_task_exit() + /* + * verify that puts pending when we call ca_task_exit() * get flushed out */ if ( i > 0 ) { @@ -2868,12 +2868,12 @@ void fdRegCB ( void * parg, int fd, int opened ) fdctx * mgrCtx = ( fdctx * ) parg; if ( opened ) { - status = fdmgr_add_callback ( + status = fdmgr_add_callback ( mgrCtx, fd, fdi_read, fdcb, 0 ); verify ( status >= 0 ); } else { - status = fdmgr_clear_callback ( + status = fdmgr_clear_callback ( mgrCtx, fd, fdi_read ); verify ( status >= 0 ); } @@ -2893,21 +2893,21 @@ typedef struct { unsigned m_interestLevel; } MultiThreadSubscrTest; -static void testMultithreadSubscrSubscrCallback +static void testMultithreadSubscrSubscrCallback ( struct event_handler_args eha ) { const epicsEventId firstUpdateEvent = ( epicsEventId ) eha.usr; epicsEventSignal ( firstUpdateEvent ); } -static void testMultithreadSubscrCreateSubscr ( void * pParm ) +static void testMultithreadSubscrCreateSubscr ( void * pParm ) { static unsigned nElem = 0; int testComplete = FALSE; evid id; epicsEventId firstUpdateEvent; - epicsEventWaitStatus eventWaitStatus; - MultiThreadSubscrTest * const pMultiThreadSubscrTest = + epicsEventWaitStatus eventWaitStatus; + MultiThreadSubscrTest * const pMultiThreadSubscrTest = ( MultiThreadSubscrTest * ) pParm; /* this is required for the ca_flush below to work correctly */ @@ -2915,19 +2915,19 @@ static void testMultithreadSubscrCreateSubscr ( void * pParm ) verify ( status == ECA_NORMAL ); firstUpdateEvent = epicsEventMustCreate ( epicsEventEmpty ); verify ( firstUpdateEvent ); - status = ca_create_subscription ( - DBR_TIME_LONG, - nElem, - pMultiThreadSubscrTest->m_chan, - DBE_VALUE, - testMultithreadSubscrSubscrCallback, - firstUpdateEvent, + status = ca_create_subscription ( + DBR_TIME_LONG, + nElem, + pMultiThreadSubscrTest->m_chan, + DBE_VALUE, + testMultithreadSubscrSubscrCallback, + firstUpdateEvent, & id ); verify ( status == ECA_NORMAL ); status = ca_flush_io (); verify ( status == ECA_NORMAL ); /* wait for first update */ - eventWaitStatus = epicsEventWaitWithTimeout ( + eventWaitStatus = epicsEventWaitWithTimeout ( firstUpdateEvent, 60.0 * 10 ); verify ( eventWaitStatus == epicsEventWaitOK ); epicsEventDestroy ( firstUpdateEvent ); @@ -2935,7 +2935,7 @@ static void testMultithreadSubscrCreateSubscr ( void * pParm ) verify ( status == ECA_NORMAL ); epicsMutexMustLock ( pMultiThreadSubscrTest->m_mutex ); pMultiThreadSubscrTest->m_nUpdatesReceived++; - testComplete = ( pMultiThreadSubscrTest->m_nUpdatesReceived == + testComplete = ( pMultiThreadSubscrTest->m_nUpdatesReceived == pMultiThreadSubscrTest->m_nUpdatesRequired ); pMultiThreadSubscrTest->m_testComplete = testComplete; epicsMutexUnlock ( pMultiThreadSubscrTest->m_mutex ); @@ -2946,10 +2946,10 @@ static void testMultithreadSubscrCreateSubscr ( void * pParm ) void testMultithreadSubscrConnHandler ( struct connection_handler_args args ) { - MultiThreadSubscrTest * const pMultiThreadSubscrTest = + MultiThreadSubscrTest * const pMultiThreadSubscrTest = ( MultiThreadSubscrTest * ) ca_puser ( args.chid ); epicsMutexMustLock ( pMultiThreadSubscrTest->m_mutex ); - if ( !pMultiThreadSubscrTest->m_testInitiated && + if ( !pMultiThreadSubscrTest->m_testInitiated && args.op == CA_OP_CONN_UP ) { int i; pMultiThreadSubscrTest->m_testInitiated = TRUE; @@ -2957,10 +2957,10 @@ void testMultithreadSubscrConnHandler ( struct connection_handler_args args ) char threadname[64]; epicsThreadId threadId; sprintf(threadname, "testSubscr%06u", i); - threadId = epicsThreadCreate ( threadname, - epicsThreadPriorityMedium, - epicsThreadGetStackSize(epicsThreadStackSmall), - testMultithreadSubscrCreateSubscr, + threadId = epicsThreadCreate ( threadname, + epicsThreadPriorityMedium, + epicsThreadGetStackSize(epicsThreadStackSmall), + testMultithreadSubscrCreateSubscr, pMultiThreadSubscrTest ); verify ( threadId ); } @@ -2970,7 +2970,7 @@ void testMultithreadSubscrConnHandler ( struct connection_handler_args args ) void testMultithreadSubscr ( void * pParm ) { - MultiThreadSubscrTest * const pMultiThreadSubscrTest = + MultiThreadSubscrTest * const pMultiThreadSubscrTest = ( MultiThreadSubscrTest * ) pParm; int status; unsigned i; @@ -2983,11 +2983,11 @@ void testMultithreadSubscr ( void * pParm ) pMultiThreadSubscrTest->m_chanName, testMultithreadSubscrConnHandler, pMultiThreadSubscrTest, - CA_PRIORITY_MIN, + CA_PRIORITY_MIN, & pMultiThreadSubscrTest->m_chan ); verify ( status == ECA_NORMAL ); - showProgressBegin ( "verifyMultithreadSubscr", + showProgressBegin ( "verifyMultithreadSubscr", pMultiThreadSubscrTest->m_interestLevel ); i = 0; while ( TRUE ) { @@ -2999,11 +2999,11 @@ void testMultithreadSubscr ( void * pParm ) if ( success ) { break; } - eventWaitStatus = epicsEventWaitWithTimeout ( + eventWaitStatus = epicsEventWaitWithTimeout ( pMultiThreadSubscrTest->m_testCompleteEvent, 0.1 ); - verify ( eventWaitStatus == epicsEventWaitOK || + verify ( eventWaitStatus == epicsEventWaitOK || eventWaitStatus == epicsEventWaitTimeout ); - if ( i++ % 100 == 0u ) + if ( i++ % 100 == 0u ) showProgress ( pMultiThreadSubscrTest->m_interestLevel ); verify ( i < 1000 ); } @@ -3023,33 +3023,33 @@ void verifyMultithreadSubscr ( const char * pName, unsigned interestLevel ) { static unsigned nSubscr = 3000; epicsThreadId threadId; - MultiThreadSubscrTest * const pMultiThreadSubscrTest = - (MultiThreadSubscrTest*) calloc ( 1, + MultiThreadSubscrTest * const pMultiThreadSubscrTest = + (MultiThreadSubscrTest*) calloc ( 1, sizeof ( MultiThreadSubscrTest ) ); verify ( pMultiThreadSubscrTest); pMultiThreadSubscrTest->m_mutex = epicsMutexMustCreate (); verify ( pMultiThreadSubscrTest->m_mutex ); - pMultiThreadSubscrTest->m_testCompleteEvent = + pMultiThreadSubscrTest->m_testCompleteEvent = epicsEventMustCreate ( epicsEventEmpty ); verify ( pMultiThreadSubscrTest->m_testCompleteEvent ); - pMultiThreadSubscrTest->m_threadExitEvent = + pMultiThreadSubscrTest->m_threadExitEvent = epicsEventMustCreate ( epicsEventEmpty ); verify ( pMultiThreadSubscrTest->m_threadExitEvent ); - strncpy ( pMultiThreadSubscrTest->m_chanName, pName, + strncpy ( pMultiThreadSubscrTest->m_chanName, pName, sizeof ( pMultiThreadSubscrTest->m_chanName ) ); pMultiThreadSubscrTest->m_chanName [ sizeof ( pMultiThreadSubscrTest->m_chanName ) - 1u ] = '\0'; pMultiThreadSubscrTest->m_nUpdatesRequired = nSubscr; pMultiThreadSubscrTest->m_interestLevel = interestLevel; - threadId = epicsThreadCreate ( - "testMultithreadSubscr", - epicsThreadPriorityMedium, - epicsThreadGetStackSize(epicsThreadStackSmall), + threadId = epicsThreadCreate ( + "testMultithreadSubscr", + epicsThreadPriorityMedium, + epicsThreadGetStackSize(epicsThreadStackSmall), testMultithreadSubscr, pMultiThreadSubscrTest ); verify ( threadId ); { epicsEventWaitStatus eventWaitStatus; - eventWaitStatus = epicsEventWaitWithTimeout ( + eventWaitStatus = epicsEventWaitWithTimeout ( pMultiThreadSubscrTest->m_threadExitEvent, 1000.0 ); verify ( eventWaitStatus == epicsEventWaitOK ); } @@ -3068,7 +3068,7 @@ void fdManagerVerify ( const char * pName, unsigned interestLevel ) evid subscription; unsigned eventCount = 0u; epicsTimeStamp begin, end; - + mgrCtx = fdmgr_init (); verify ( mgrCtx ); @@ -3089,7 +3089,7 @@ void fdManagerVerify ( const char * pName, unsigned interestLevel ) showProgress ( interestLevel ); - status = ca_add_event ( DBR_FLOAT, newChan, + status = ca_add_event ( DBR_FLOAT, newChan, nUpdatesTester, & eventCount, & subscription ); verify ( status == ECA_NORMAL ); @@ -3142,7 +3142,7 @@ void fdManagerVerify ( const char * pName, unsigned interestLevel ) showProgressEnd ( interestLevel ); } -void verifyConnectWithDisconnectedChannels ( +void verifyConnectWithDisconnectedChannels ( const char *pName, unsigned interestLevel ) { int status; @@ -3171,11 +3171,11 @@ void verifyConnectWithDisconnectedChannels ( status = ca_create_channel ( pName, 0, 0, 0, & validChan ); verify ( status == ECA_NORMAL ); - /* - * we should be able to connect to a valid + /* + * we should be able to connect to a valid * channel within a reasonable delay even - * though there is one permanently - * diasconnected channel + * though there is one permanently + * diasconnected channel */ status = ca_pend_io ( timeoutToPendIO ); verify ( status == ECA_NORMAL ); @@ -3205,7 +3205,7 @@ void noopExceptionCallback ( struct exception_handler_args args ) { } -void verifyDisconnect ( +void verifyDisconnect ( const char * pName, unsigned interestLevel ) { int disconnectFlag = 0; @@ -3214,8 +3214,8 @@ void verifyDisconnect ( chid chan1; int status; - status = ca_create_channel ( - pName, verifyClearChannelOnDisconnectCallback, + status = ca_create_channel ( + pName, verifyClearChannelOnDisconnectCallback, & disconnectFlag, 0, & chan0 ); SEVCHK ( status, NULL ); @@ -3256,7 +3256,7 @@ void verifyDisconnect ( fprintf ( stdout, "confirmed.\n" ); /* channel cleared by disconnect handler */ - status = ca_create_channel ( + status = ca_create_channel ( pName, 0, 0, 0, & chan1 ); SEVCHK ( status, NULL ); @@ -3275,11 +3275,11 @@ void verifyDisconnect ( SEVCHK ( status, NULL ); } -void verifyName ( +void verifyName ( const char * pName, unsigned interestLevel ) { chid chan; - int status = ca_create_channel ( + int status = ca_create_channel ( pName, 0, 0, 0, & chan ); SEVCHK ( status, NULL ); if ( strcmp ( pName, ca_name ( chan ) ) != 0 ) { @@ -3297,13 +3297,13 @@ void verifyContextRundownFlush ( const char * pName, unsigned interestLevel ) for ( i=0u; i < 1000; i++ ) { const dbr_double_t stim = i; - - { + + { chid chan; int status; status = ca_context_create ( ca_disable_preemptive_callback ); SEVCHK ( status, "context create failed" ); - + status = ca_create_channel ( pName, 0, 0, 0, & chan ); /* * currently in-memory channels cant be used with this test @@ -3311,26 +3311,26 @@ void verifyContextRundownFlush ( const char * pName, unsigned interestLevel ) */ if ( status != ECA_UNAVAILINSERV ) { SEVCHK ( status, NULL ); - + status = ca_pend_io( timeoutToPendIO ); SEVCHK ( status, "channel connect failed" ); - + status = ca_put ( DBR_DOUBLE, chan, & stim ); SEVCHK ( status, "channel put failed" ); - + status = ca_clear_channel ( chan ); SEVCHK ( status, NULL ); } ca_context_destroy (); } - + { chid chan; int status; dbr_double_t resp; status = ca_context_create ( ca_disable_preemptive_callback ); SEVCHK ( status, "context create failed" ); - + status = ca_create_channel ( pName, 0, 0, 0, & chan ); SEVCHK ( status, NULL ); /* @@ -3340,15 +3340,15 @@ void verifyContextRundownFlush ( const char * pName, unsigned interestLevel ) if ( status != ECA_UNAVAILINSERV ) { status = ca_pend_io( timeoutToPendIO ); SEVCHK ( status, "channel connect failed" ); - + status = ca_get ( DBR_DOUBLE, chan, & resp ); SEVCHK ( status, "channel get failed" ); - + status = ca_pend_io ( timeoutToPendIO ); SEVCHK ( status, "get, pend io failed" ); - + verify ( stim == resp ); - + status = ca_clear_channel ( chan ); SEVCHK ( status, NULL ); } @@ -3359,11 +3359,11 @@ void verifyContextRundownFlush ( const char * pName, unsigned interestLevel ) showProgress ( interestLevel ); } } - + showProgressEnd ( interestLevel ); } -void verifyContextRundownChanStillExist ( +void verifyContextRundownChanStillExist ( const char * pName, unsigned interestLevel ) { chid chan[10000]; @@ -3374,7 +3374,7 @@ void verifyContextRundownChanStillExist ( status = ca_context_create ( ca_disable_preemptive_callback ); SEVCHK ( status, "context create failed" ); - + for ( i = 0; i < NELEMENTS ( chan ); i++ ) { status = ca_create_channel ( pName, 0, 0, 0, & chan[i] ); /* @@ -3386,17 +3386,17 @@ void verifyContextRundownChanStillExist ( } SEVCHK ( status, NULL ); } - + status = ca_pend_io( timeoutToPendIO ); SEVCHK ( status, "channel connect failed" ); ca_context_destroy (); - + showProgressEnd ( interestLevel ); } -int acctst ( const char * pName, unsigned interestLevel, unsigned channelCount, - unsigned repetitionCount, enum ca_preemptive_callback_select select ) +int acctst ( const char * pName, unsigned interestLevel, unsigned channelCount, + unsigned repetitionCount, enum ca_preemptive_callback_select select ) { chid chan; int status; @@ -3405,7 +3405,7 @@ int acctst ( const char * pName, unsigned interestLevel, unsigned channelCount, unsigned connections; unsigned maxArrayBytes = 10000000; - printf ( "CA Client V%s, channel name \"%s\", timeout %g\n", + printf ( "CA Client V%s, channel name \"%s\", timeout %g\n", ca_version (), pName, timeoutToPendIO ); if ( select == ca_enable_preemptive_callback ) { printf ( "Preemptive call back is enabled.\n" ); @@ -3414,7 +3414,7 @@ int acctst ( const char * pName, unsigned interestLevel, unsigned channelCount, { char tmpString[32]; sprintf ( tmpString, "%u", maxArrayBytes ); - epicsEnvSet ( "EPICS_CA_MAX_ARRAY_BYTES", tmpString ); + epicsEnvSet ( "EPICS_CA_MAX_ARRAY_BYTES", tmpString ); } /* @@ -3447,7 +3447,7 @@ int acctst ( const char * pName, unsigned interestLevel, unsigned channelCount, showProgressEnd ( interestLevel ); printf ( "native type was %s, native count was %lu\n", - dbf_type_to_text ( ca_field_type ( chan ) ), + dbf_type_to_text ( ca_field_type ( chan ) ), ca_element_count ( chan ) ); connections = ca_get_ioc_connection_count (); @@ -3464,14 +3464,14 @@ int acctst ( const char * pName, unsigned interestLevel, unsigned channelCount, verifyTimeStamps ( chan, interestLevel ); verifyOldPend ( interestLevel ); exceptionTest ( chan, interestLevel ); - arrayTest ( chan, maxArrayBytes, interestLevel ); + arrayTest ( chan, maxArrayBytes, interestLevel ); verifyMonitorSubscriptionFlushIO ( chan, interestLevel ); monitorSubscriptionFirstUpdateTest ( pName, chan, interestLevel ); ctrlDoubleTest ( chan, interestLevel ); verifyBlockInPendIO ( chan, interestLevel ); - verifyAnalogIO ( chan, DBR_FLOAT, FLT_MIN, FLT_MAX, + verifyAnalogIO ( chan, DBR_FLOAT, FLT_MIN, FLT_MAX, FLT_MIN_EXP, FLT_MAX_EXP, FLT_EPSILON, interestLevel ); - verifyAnalogIO ( chan, DBR_DOUBLE, DBL_MIN, DBL_MAX, + verifyAnalogIO ( chan, DBR_DOUBLE, DBL_MIN, DBL_MAX, DBL_MIN_EXP, DBL_MAX_EXP, DBL_EPSILON, interestLevel ); verifyLongIO ( chan, interestLevel ); verifyShortIO ( chan, interestLevel ); @@ -3486,7 +3486,7 @@ int acctst ( const char * pName, unsigned interestLevel, unsigned channelCount, verifyBadString ( chan, interestLevel ); verifyMultithreadSubscr ( pName, interestLevel ); if ( select != ca_enable_preemptive_callback ) { - fdManagerVerify ( pName, interestLevel ); + fdManagerVerify ( pName, interestLevel ); } /* @@ -3497,7 +3497,7 @@ int acctst ( const char * pName, unsigned interestLevel, unsigned channelCount, printf ( "\n" ); pend_event_delay_test ( 1.0 ); pend_event_delay_test ( 0.1 ); - pend_event_delay_test ( 0.25 ); + pend_event_delay_test ( 0.25 ); /* ca_channel_status ( 0 ); */ ca_client_status ( 0 ); @@ -3539,10 +3539,10 @@ int acctst ( const char * pName, unsigned interestLevel, unsigned channelCount, /* SEVCHK ( status, NULL ); */ caTaskExitTest ( interestLevel ); - + verifyContextRundownFlush ( pName, interestLevel ); verifyContextRundownChanStillExist ( pName, interestLevel ); - + free ( pChans ); printf ( "\nTest Complete\n" ); diff --git a/modules/ca/src/client/acctstMain.c b/modules/ca/src/client/acctstMain.c index 4c700a30b..5386019e0 100644 --- a/modules/ca/src/client/acctstMain.c +++ b/modules/ca/src/client/acctstMain.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include @@ -19,15 +19,15 @@ int main ( int argc, char **argv ) unsigned progressLoggingLevel; unsigned channelCount; unsigned repetitionCount; - enum ca_preemptive_callback_select preempt; - int aBoolean; + enum ca_preemptive_callback_select preempt; + int aBoolean; if ( argc < 2 || argc > 6 ) { printf ("usage: %s [progress logging level] [channel count] " - "[repetition count] [enable preemptive callback]\n", + "[repetition count] [enable preemptive callback]\n", argv[0] ); - return 1; + return 1; } if ( argc >= 3 ) { @@ -57,12 +57,12 @@ int main ( int argc, char **argv ) else { aBoolean = 0; } - if ( aBoolean ) { - preempt = ca_enable_preemptive_callback; - } - else { - preempt = ca_disable_preemptive_callback; - } + if ( aBoolean ) { + preempt = ca_enable_preemptive_callback; + } + else { + preempt = ca_disable_preemptive_callback; + } acctst ( argv[1], progressLoggingLevel, channelCount, repetitionCount, preempt ); diff --git a/modules/ca/src/client/acctstRegister.cpp b/modules/ca/src/client/acctstRegister.cpp index e75ed7fe3..5ddc5af16 100644 --- a/modules/ca/src/client/acctstRegister.cpp +++ b/modules/ca/src/client/acctstRegister.cpp @@ -60,7 +60,7 @@ struct AutoInit { AutoInit (); }; -AutoInit :: AutoInit () +AutoInit :: AutoInit () { iocshRegister ( &acctstFuncDef, acctstCallFunc ); } diff --git a/modules/ca/src/client/addrList.h b/modules/ca/src/client/addrList.h index bc0fd9d7e..9f1bd9d78 100644 --- a/modules/ca/src/client/addrList.h +++ b/modules/ca/src/client/addrList.h @@ -10,7 +10,7 @@ #ifndef INC_addrList_H #define INC_addrList_H -#include "envDefs.h" +#include "envDefs.h" #include "osiSock.h" #include "libCaAPI.h" @@ -23,7 +23,7 @@ LIBCA_API void epicsStdCall configureChannelAccessAddressList ( struct ELLLIST *pList, SOCKET sock, unsigned short port ); LIBCA_API int epicsStdCall addAddrToChannelAccessAddressList - ( struct ELLLIST *pList, const ENV_PARAM *pEnv, + ( struct ELLLIST *pList, const ENV_PARAM *pEnv, unsigned short port, int ignoreNonDefaultPort ); LIBCA_API void epicsStdCall printChannelAccessAddressList diff --git a/modules/ca/src/client/autoPtrFreeList.h b/modules/ca/src/client/autoPtrFreeList.h index b3679c6e8..e1d31d215 100644 --- a/modules/ca/src/client/autoPtrFreeList.h +++ b/modules/ca/src/client/autoPtrFreeList.h @@ -7,19 +7,19 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* + * * - * * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 - * + * * Copyright, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #ifndef INC_autoPtrFreeList_H @@ -46,7 +46,7 @@ private: }; template < class T, unsigned N, class MUTEX > -inline autoPtrFreeList < T, N, MUTEX >::autoPtrFreeList ( +inline autoPtrFreeList < T, N, MUTEX >::autoPtrFreeList ( tsFreeList < T, N, MUTEX > & freeListIn, T * pIn ) : p ( pIn ), freeList ( freeListIn ) {} diff --git a/modules/ca/src/client/autoPtrRecycle.h b/modules/ca/src/client/autoPtrRecycle.h index 173e148b8..600bb5a8c 100644 --- a/modules/ca/src/client/autoPtrRecycle.h +++ b/modules/ca/src/client/autoPtrRecycle.h @@ -5,22 +5,22 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* + * * - * * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 - * + * * Copyright, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #ifndef autoPtrRecycleh @@ -29,7 +29,7 @@ template < class T > class autoPtrRecycle { public: - autoPtrRecycle ( + autoPtrRecycle ( epicsGuard < epicsMutex > &, chronIntIdResTable < baseNMIU > &, cacRecycle &, T * ); ~autoPtrRecycle (); @@ -43,12 +43,12 @@ private: chronIntIdResTable < baseNMIU > & ioTable; epicsGuard < epicsMutex > & guard; // not implemented - autoPtrRecycle ( const autoPtrRecycle & ); - autoPtrRecycle & operator = ( const autoPtrRecycle & ); + autoPtrRecycle ( const autoPtrRecycle & ); + autoPtrRecycle & operator = ( const autoPtrRecycle & ); }; template < class T > -inline autoPtrRecycle::autoPtrRecycle ( +inline autoPtrRecycle::autoPtrRecycle ( epicsGuard < epicsMutex > & guardIn, chronIntIdResTable < baseNMIU > & tbl, cacRecycle & rIn, T * pIn ) : p ( pIn ), r ( rIn ), ioTable ( tbl ), guard ( guardIn ) {} diff --git a/modules/ca/src/client/baseNMIU.cpp b/modules/ca/src/client/baseNMIU.cpp index 226568e62..9a86886dc 100644 --- a/modules/ca/src/client/baseNMIU.cpp +++ b/modules/ca/src/client/baseNMIU.cpp @@ -7,7 +7,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* * * L O S A L A M O S * Los Alamos National Laboratory diff --git a/modules/ca/src/client/bhe.cpp b/modules/ca/src/client/bhe.cpp index 8ba679e7d..19b8f9045 100644 --- a/modules/ca/src/client/bhe.cpp +++ b/modules/ca/src/client/bhe.cpp @@ -6,8 +6,8 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ - -/* + +/* * * L O S A L A M O S * Los Alamos National Laboratory @@ -40,12 +40,12 @@ * start up * * if creating this in response to a search reply - * and not in response to a beacon then + * and not in response to a beacon then * we set the beacon time stamp to * zero (so we can correctly compute the period * between the 1st and 2nd beacons) */ -bhe::bhe ( epicsMutex & mutexIn, const epicsTime & initialTimeStamp, +bhe::bhe ( epicsMutex & mutexIn, const epicsTime & initialTimeStamp, unsigned initialBeaconNumber, const inetAddrID & addr ) : inetAddrID ( addr ), timeStamp ( initialTimeStamp ), averagePeriod ( - DBL_MAX ), mutex ( mutexIn ), pIIU ( 0 ), lastBeaconNumber ( initialBeaconNumber ) @@ -72,7 +72,7 @@ void bhe::beaconAnomalyNotify ( epicsGuard < epicsMutex > & guard ) } #ifdef DEBUG -void bhe::logBeacon ( const char * pDiagnostic, +void bhe::logBeacon ( const char * pDiagnostic, const double & currentPeriod, const epicsTime & currentTime ) { @@ -80,10 +80,10 @@ void bhe::logBeacon ( const char * pDiagnostic, char name[64]; this->name ( name, sizeof ( name ) ); char date[64]; - currentTime.strftime ( date, sizeof ( date ), + currentTime.strftime ( date, sizeof ( date ), "%a %b %d %Y %H:%M:%S.%f"); ::printf ( "%s cp=%g ap=%g %s %s\n", - pDiagnostic, currentPeriod, + pDiagnostic, currentPeriod, this->averagePeriod, name, date ); } } @@ -103,7 +103,7 @@ void bhe::logBeaconDiscard ( unsigned beaconAdvance, char name[64]; this->name ( name, sizeof ( name ) ); char date[64]; - currentTime.strftime ( date, sizeof ( date ), + currentTime.strftime ( date, sizeof ( date ), "%a %b %d %Y %H:%M:%S.%f"); ::printf ( "bb %u %s %s\n", beaconAdvance, name, date ); @@ -121,16 +121,16 @@ void bhe::logBeaconDiscard ( unsigned /* beaconAdvance */, * * updates beacon period, and looks for beacon anomalies */ -bool bhe::updatePeriod ( - epicsGuard < epicsMutex > & guard, const epicsTime & programBeginTime, - const epicsTime & currentTime, ca_uint32_t beaconNumber, +bool bhe::updatePeriod ( + epicsGuard < epicsMutex > & guard, const epicsTime & programBeginTime, + const epicsTime & currentTime, ca_uint32_t beaconNumber, unsigned protocolRevision ) { guard.assertIdenticalMutex ( this->mutex ); // // this block is enetered if the beacon was created as a side effect of - // creating a connection and so we dont yet know the first beacon time + // creating a connection and so we dont yet know the first beacon time // and sequence number // if ( this->timeStamp == epicsTime () ) { @@ -140,7 +140,7 @@ bool bhe::updatePeriod ( this->beaconAnomalyNotify ( guard ); - /* + /* * this is the 1st beacon seen - the beacon time stamp * was not initialized during BHE create because * a TCP/IP connection created the beacon. @@ -165,15 +165,15 @@ bool bhe::updatePeriod ( } this->lastBeaconNumber = beaconNumber; - // throw out sequence numbers just prior to, or the same as, the last one received + // throw out sequence numbers just prior to, or the same as, the last one received // (this situation is probably caused by a temporary duplicate route ) if ( beaconSeqAdvance == 0 || beaconSeqAdvance > ca_uint32_max - 256 ) { logBeaconDiscard ( beaconSeqAdvance, currentTime ); return false; } - // throw out sequence numbers that jump forward by only a few numbers - // (this situation is probably caused by a duplicate route + // throw out sequence numbers that jump forward by only a few numbers + // (this situation is probably caused by a duplicate route // or a beacon due to input queue overun) if ( beaconSeqAdvance > 1 && beaconSeqAdvance < 4 ) { logBeaconDiscard ( beaconSeqAdvance, currentTime ); @@ -203,7 +203,7 @@ bool bhe::updatePeriod ( /* * ignore beacons seen for the first time shortly after * init, but do not ignore beacons arriving with a short - * period because the IOC was rebooted soon after the + * period because the IOC was rebooted soon after the * client starts up. */ totalRunningTime = this->timeStamp - programBeginTime; @@ -215,24 +215,24 @@ bool bhe::updatePeriod ( /* * Is this an IOC seen because of a restored - * network segment? + * network segment? * - * It may be possible to get false triggers here + * It may be possible to get false triggers here * if the client is busy, but this does not cause - * problems because the echo response will tell us + * problems because the echo response will tell us * that the server is available */ if ( currentPeriod >= this->averagePeriod * 1.25 ) { - /* - * trigger on any missing beacon + /* + * trigger on any missing beacon * if connected to this server - */ + */ this->beaconAnomalyNotify ( guard ); if ( currentPeriod >= this->averagePeriod * 3.25 ) { - /* - * trigger on any 3 contiguous missing beacons + /* + * trigger on any 3 contiguous missing beacons * if not connected to this server */ netChange = true; @@ -246,9 +246,9 @@ bool bhe::updatePeriod ( * IOC reboots). Lower tolarance here because we * dont have to worry about lost beacons. * - * It may be possible to get false triggers here + * It may be possible to get false triggers here * if the client is busy, but this does not cause - * problems because the echo response will tell us + * problems because the echo response will tell us * that the server is available */ else if ( currentPeriod <= this->averagePeriod * 0.80 ) { @@ -257,14 +257,14 @@ bool bhe::updatePeriod ( logBeacon ( "bal", currentPeriod, currentTime ); } else if ( this->pIIU ) { - // update state of health for active virtual circuits + // update state of health for active virtual circuits // if the beacon looks ok this->pIIU->beaconArrivalNotify ( guard ); logBeacon ( "vb", currentPeriod, currentTime ); } // update a running average period - this->averagePeriod = currentPeriod * 0.125 + + this->averagePeriod = currentPeriod * 0.125 + this->averagePeriod * 0.875; } @@ -284,22 +284,22 @@ void bhe::show ( epicsGuard < epicsMutex > &, unsigned level ) const char host [64]; this->name ( host, sizeof ( host ) ); if ( this->averagePeriod == -DBL_MAX ) { - ::printf ( "CA beacon hash entry for %s \n", + ::printf ( "CA beacon hash entry for %s \n", host ); } else { - ::printf ( "CA beacon hash entry for %s with period estimate %f\n", + ::printf ( "CA beacon hash entry for %s with period estimate %f\n", host, this->averagePeriod ); } if ( level > 0u ) { char date[64]; this->timeStamp.strftime ( date, sizeof ( date ), "%a %b %d %Y %H:%M:%S"); - ::printf ( "\tbeacon number %u, on %s\n", + ::printf ( "\tbeacon number %u, on %s\n", this->lastBeaconNumber, date ); } } -double bhe::period ( epicsGuard < epicsMutex > & guard ) const +double bhe::period ( epicsGuard < epicsMutex > & guard ) const { guard.assertIdenticalMutex ( this->mutex ); return this->averagePeriod; @@ -311,14 +311,14 @@ epicsTime bhe::updateTime ( epicsGuard < epicsMutex > & guard ) const return this->timeStamp; } -void bhe::registerIIU ( +void bhe::registerIIU ( epicsGuard < epicsMutex > & guard, tcpiiu & iiu ) { guard.assertIdenticalMutex ( this->mutex ); this->pIIU = & iiu; } -void bhe::unregisterIIU ( +void bhe::unregisterIIU ( epicsGuard < epicsMutex > & guard, tcpiiu & iiu ) { guard.assertIdenticalMutex ( this->mutex ); diff --git a/modules/ca/src/client/bhe.h b/modules/ca/src/client/bhe.h index b503ebb42..7bd3f93b9 100644 --- a/modules/ca/src/client/bhe.h +++ b/modules/ca/src/client/bhe.h @@ -7,7 +7,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* * * L O S A L A M O S * Los Alamos National Laboratory @@ -70,13 +70,13 @@ private: tcpiiu * pIIU; ca_uint32_t lastBeaconNumber; void beaconAnomalyNotify ( epicsGuard < epicsMutex > & ); - void logBeacon ( const char * pDiagnostic, + void logBeacon ( const char * pDiagnostic, const double & currentPeriod, const epicsTime & currentTime ); void logBeaconDiscard ( unsigned beaconAdvance, const epicsTime & currentTime ); - bhe ( const bhe & ); - bhe & operator = ( const bhe & ); + bhe ( const bhe & ); + bhe & operator = ( const bhe & ); LIBCA_API void operator delete ( void * ); }; @@ -89,20 +89,20 @@ public: void release ( void * ); private: tsFreeList < bhe, 0x100 > freeList; - bheFreeStore ( const bheFreeStore & ); - bheFreeStore & operator = ( const bheFreeStore & ); + bheFreeStore ( const bheFreeStore & ); + bheFreeStore & operator = ( const bheFreeStore & ); }; -inline void * bhe::operator new ( size_t size, +inline void * bhe::operator new ( size_t size, bheMemoryManager & mgr ) -{ +{ return mgr.allocate ( size ); } #ifdef CXX_PLACEMENT_DELETE -inline void bhe::operator delete ( void * pCadaver, +inline void bhe::operator delete ( void * pCadaver, bheMemoryManager & mgr ) -{ +{ mgr.release ( pCadaver ); } #endif diff --git a/modules/ca/src/client/caConnTest.cpp b/modules/ca/src/client/caConnTest.cpp index 6f6ed0d1b..4a74f6cfb 100644 --- a/modules/ca/src/client/caConnTest.cpp +++ b/modules/ca/src/client/caConnTest.cpp @@ -59,50 +59,50 @@ void caConnTest ( const char *pNameIn, unsigned channelCountIn, double delayIn ) { unsigned iteration = 0u; int status; - unsigned i; - chid *pChans; + unsigned i; + chid *pChans; channelCount = channelCountIn; pChans = new chid [channelCount]; - - while ( 1 ) { + + while ( 1 ) { connCount = 0u; subsequentConnect = false; begin = epicsTime::getCurrent (); printf ( "initializing CA client library\n" ); - status = ca_task_initialize(); - SEVCHK ( status, "CA init failed" ); + status = ca_task_initialize(); + SEVCHK ( status, "CA init failed" ); printf ( "creating channels\n" ); - for ( i = 0u; i < channelCount; i++ ) { - status = ca_search_and_connect ( pNameIn, + for ( i = 0u; i < channelCount; i++ ) { + status = ca_search_and_connect ( pNameIn, &pChans[i], caConnTestConnHandler, 0 ); - SEVCHK ( status, "CA search problems" ); - } + SEVCHK ( status, "CA search problems" ); + } printf ( "all channels were created\n" ); - ca_pend_event ( delayIn ); + ca_pend_event ( delayIn ); if ( iteration & 1 ) { - for ( i = 0u; i < channelCount; i++ ) { - status = ca_clear_channel ( pChans[i] ); - SEVCHK ( status, "ca_clear_channel() problems" ); - } + for ( i = 0u; i < channelCount; i++ ) { + status = ca_clear_channel ( pChans[i] ); + SEVCHK ( status, "ca_clear_channel() problems" ); + } printf ( "all channels were destroyed\n" ); } printf ( "shutting down CA client library\n" ); - status = ca_task_exit (); - SEVCHK ( status, "task exit problems" ); + status = ca_task_exit (); + SEVCHK ( status, "task exit problems" ); iteration++; - } + } //delete [] pChans; } diff --git a/modules/ca/src/client/caDiagnostics.h b/modules/ca/src/client/caDiagnostics.h index 56318e764..d495ebbdd 100644 --- a/modules/ca/src/client/caDiagnostics.h +++ b/modules/ca/src/client/caDiagnostics.h @@ -19,8 +19,8 @@ extern "C" { enum appendNumberFlag {appendNumber, dontAppendNumber}; int catime ( const char *channelName, unsigned channelCount, enum appendNumberFlag appNF ); -int acctst ( const char *pname, unsigned logggingInterestLevel, - unsigned channelCount, unsigned repetitionCount, +int acctst ( const char *pname, unsigned logggingInterestLevel, + unsigned channelCount, unsigned repetitionCount, enum ca_preemptive_callback_select select ); #define CATIME_OK 0 diff --git a/modules/ca/src/client/caEventRate.cpp b/modules/ca/src/client/caEventRate.cpp index 414464948..be6c4f2d9 100644 --- a/modules/ca/src/client/caEventRate.cpp +++ b/modules/ca/src/client/caEventRate.cpp @@ -37,50 +37,50 @@ void caEventRate ( const char *pName, unsigned count ) chid * pChidTable = new chid [ count ]; { - printf ( "Connecting to CA Channel \"%s\" %u times.", + printf ( "Connecting to CA Channel \"%s\" %u times.", pName, count ); fflush ( stdout ); - + epicsTime begin = epicsTime::getCurrent (); for ( unsigned i = 0u; i < count; i++ ) { int status = ca_search ( pName, & pChidTable[i] ); SEVCHK ( status, NULL ); } - + int status = ca_pend_io ( 10000.0 ); if ( status != ECA_NORMAL ) { fprintf ( stderr, " not found.\n" ); return; } epicsTime end = epicsTime::getCurrent (); - + printf ( " done(%f sec).\n", end - begin ); } { printf ( "Subscribing %u times.", count ); fflush ( stdout ); - + epicsTime begin = epicsTime::getCurrent (); for ( unsigned i = 0u; i < count; i++ ) { - int addEventStatus = ca_add_event ( DBR_FLOAT, + int addEventStatus = ca_add_event ( DBR_FLOAT, pChidTable[i], eventCallBack, &eventCount, NULL); SEVCHK ( addEventStatus, __FILE__ ); } - + int status = ca_flush_io (); SEVCHK ( status, __FILE__ ); - + epicsTime end = epicsTime::getCurrent (); - + printf ( " done(%f sec).\n", end - begin ); } - + { printf ( "Waiting for initial value events." ); fflush ( stdout ); - - // let the first one go by + + // let the first one go by epicsTime begin = epicsTime::getCurrent (); while ( eventCount < count ) { int status = ca_pend_event ( 0.01 ); @@ -89,7 +89,7 @@ void caEventRate ( const char *pName, unsigned count ) } } epicsTime end = epicsTime::getCurrent (); - + printf ( " done(%f sec).\n", end - begin ); } @@ -127,7 +127,7 @@ void caEventRate ( const char *pName, unsigned count ) double mean = X / N; double stdDev = sqrt ( XX / N - mean * mean ); - printf ( "CA Event Rate (Hz): current %g mean %g std dev %g\n", + printf ( "CA Event Rate (Hz): current %g mean %g std dev %g\n", Hz, mean, stdDev ); if ( samplePeriod < maxSamplePeriod ) { diff --git a/modules/ca/src/client/caProto.h b/modules/ca/src/client/caProto.h index f43a848bb..43e4c225c 100644 --- a/modules/ca/src/client/caProto.h +++ b/modules/ca/src/client/caProto.h @@ -19,9 +19,9 @@ #define capStrOf(A) #A #define capStrOfX(A) capStrOf ( A ) -/* +/* * CA protocol revision - * TCP/UDP port number (bumped each major protocol change) + * TCP/UDP port number (bumped each major protocol change) */ #define CA_MAJOR_PROTOCOL_REVISION 4 #define CA_VERSION_STRING( MINOR_REVISION ) \ @@ -29,7 +29,7 @@ #define CA_UKN_MINOR_VERSION 0u /* unknown minor version */ #define CA_MINIMUM_SUPPORTED_VERSION 4u # define CA_VSUPPORTED(MINOR) ((MINOR)>=CA_MINIMUM_SUPPORTED_VERSION) -# define CA_V41(MINOR) ((MINOR)>=1u) +# define CA_V41(MINOR) ((MINOR)>=1u) # define CA_V42(MINOR) ((MINOR)>=2u) # define CA_V43(MINOR) ((MINOR)>=3u) # define CA_V44(MINOR) ((MINOR)>=4u) @@ -44,8 +44,8 @@ # define CA_V413(MINOR) ((MINOR)>=13u) /* Allow zero length in requests. */ /* - * These port numbers are only used if the CA repeater and - * CA server port numbers cant be obtained from the EPICS + * These port numbers are only used if the CA repeater and + * CA server port numbers cant be obtained from the EPICS * environment variables "EPICS_CA_REPEATER_PORT" and * "EPICS_CA_SERVER_PORT" */ @@ -53,8 +53,8 @@ #define CA_SERVER_PORT (CA_PORT_BASE+CA_MAJOR_PROTOCOL_REVISION*2u) #define CA_REPEATER_PORT (CA_PORT_BASE+CA_MAJOR_PROTOCOL_REVISION*2u+1u) -/* - * 1500 (max of ethernet and 802.{2,3} MTU) - 20(IP) - 8(UDP) +/* + * 1500 (max of ethernet and 802.{2,3} MTU) - 20(IP) - 8(UDP) * (the MTU of Ethernet is currently independent of its speed varient) */ #define ETHERNET_MAX_UDP ( 1500u - 20u - 8u ) @@ -88,10 +88,10 @@ typedef ca_uint32_t caResId; #define CA_PROTO_SNAPSHOT 5u /* snapshot of the system */ #define CA_PROTO_SEARCH 6u /* IOC channel search */ #define CA_PROTO_BUILD 7u /* build - obsolete */ -#define CA_PROTO_EVENTS_OFF 8u /* flow control */ -#define CA_PROTO_EVENTS_ON 9u /* flow control */ -#define CA_PROTO_READ_SYNC 10u /* purge old reads */ -#define CA_PROTO_ERROR 11u /* an operation failed */ +#define CA_PROTO_EVENTS_OFF 8u /* flow control */ +#define CA_PROTO_EVENTS_ON 9u /* flow control */ +#define CA_PROTO_READ_SYNC 10u /* purge old reads */ +#define CA_PROTO_ERROR 11u /* an operation failed */ #define CA_PROTO_CLEAR_CHANNEL 12u /* free chan resources */ #define CA_PROTO_RSRV_IS_UP 13u /* CA server has joined the net */ #define CA_PROTO_NOT_FOUND 14u /* channel not found */ @@ -171,7 +171,7 @@ typedef struct ca_hdr { */ struct mon_info { ca_float32_t m_lval; /* low delta */ - ca_float32_t m_hval; /* high delta */ + ca_float32_t m_hval; /* high delta */ ca_float32_t m_toval; /* period btween samples */ ca_uint16_t m_mask; /* event select mask */ ca_uint16_t m_pad; /* extend to 32 bits */ diff --git a/modules/ca/src/client/caServerID.h b/modules/ca/src/client/caServerID.h index b2df7cafb..de4441a42 100644 --- a/modules/ca/src/client/caServerID.h +++ b/modules/ca/src/client/caServerID.h @@ -36,7 +36,7 @@ private: ca_uint8_t pri; }; -inline caServerID::caServerID ( +inline caServerID::caServerID ( const struct sockaddr_in & addrIn, unsigned priorityIn ) : addr ( addrIn ), pri ( static_cast ( priorityIn ) ) { @@ -45,7 +45,7 @@ inline caServerID::caServerID ( inline bool caServerID::operator == ( const caServerID & rhs ) const { - if ( this->addr.sin_addr.s_addr == rhs.addr.sin_addr.s_addr && + if ( this->addr.sin_addr.s_addr == rhs.addr.sin_addr.s_addr && this->addr.sin_port == rhs.addr.sin_port && this->pri == rhs.pri ) { return true; @@ -66,7 +66,7 @@ inline resTableIndex caServerID::hash () const index ^= this->addr.sin_port; index ^= this->addr.sin_port >> 8u; index ^= this->pri; - return integerHash ( caServerMinIndexBitWidth, + return integerHash ( caServerMinIndexBitWidth, caServerMaxIndexBitWidth, index ); } diff --git a/modules/ca/src/client/ca_client_context.cpp b/modules/ca/src/client/ca_client_context.cpp index 24aa78944..4430ea0ad 100644 --- a/modules/ca/src/client/ca_client_context.cpp +++ b/modules/ca/src/client/ca_client_context.cpp @@ -17,9 +17,9 @@ * Copyright, 1986, The Regents of the University of California. * * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #ifdef _MSC_VER diff --git a/modules/ca/src/client/cac.cpp b/modules/ca/src/client/cac.cpp index cf9d5d5b6..070feb2e1 100644 --- a/modules/ca/src/client/cac.cpp +++ b/modules/ca/src/client/cac.cpp @@ -154,7 +154,7 @@ cac::cac ( } try { - long status; + long status; /* * Certain os, such as HPUX, do not unblock a socket system call diff --git a/modules/ca/src/client/cac.h b/modules/ca/src/client/cac.h index f59245c26..018ce30f4 100644 --- a/modules/ca/src/client/cac.h +++ b/modules/ca/src/client/cac.h @@ -72,8 +72,8 @@ public: void release ( void * ); private: tsFreeList < comBuf, 0x20 > freeList; - cacComBufMemoryManager ( const cacComBufMemoryManager & ); - cacComBufMemoryManager & operator = ( const cacComBufMemoryManager & ); + cacComBufMemoryManager ( const cacComBufMemoryManager & ); + cacComBufMemoryManager & operator = ( const cacComBufMemoryManager & ); }; class notifyGuard { @@ -339,8 +339,8 @@ private: const char *pCtx, unsigned status ); static const pExcepProtoStubTCP tcpExcepJumpTableCAC []; - cac ( const cac & ); - cac & operator = ( const cac & ); + cac ( const cac & ); + cac & operator = ( const cac & ); friend class tcpiiu; }; diff --git a/modules/ca/src/client/cacChannel.cpp b/modules/ca/src/client/cacChannel.cpp index 6a7fd287d..0720ced51 100644 --- a/modules/ca/src/client/cacChannel.cpp +++ b/modules/ca/src/client/cacChannel.cpp @@ -8,7 +8,7 @@ \*************************************************************************/ -/* +/* * * L O S A L A M O S * Los Alamos National Laboratory @@ -39,7 +39,7 @@ private: epicsSingleton < localHostName > :: reference _refLocalHostName; }; - + static epicsThreadOnceId cacChannelIdOnce = EPICS_THREAD_ONCE_INIT; const cacChannel::priLev cacChannel::priorityMax = 99u; @@ -53,63 +53,63 @@ cacChannel::~cacChannel () { } -caAccessRights cacChannel::accessRights ( - epicsGuard < epicsMutex > & ) const +caAccessRights cacChannel::accessRights ( + epicsGuard < epicsMutex > & ) const { static caAccessRights ar ( true, true ); return ar; } -unsigned cacChannel::searchAttempts ( - epicsGuard < epicsMutex > & ) const +unsigned cacChannel::searchAttempts ( + epicsGuard < epicsMutex > & ) const { return 0u; } -double cacChannel::beaconPeriod ( - epicsGuard < epicsMutex > & ) const +double cacChannel::beaconPeriod ( + epicsGuard < epicsMutex > & ) const { return - DBL_MAX; } -double cacChannel::receiveWatchdogDelay ( +double cacChannel::receiveWatchdogDelay ( epicsGuard < epicsMutex > & ) const { return - DBL_MAX; } bool cacChannel::ca_v42_ok ( - epicsGuard < epicsMutex > & ) const + epicsGuard < epicsMutex > & ) const { return true; } bool cacChannel::connected ( - epicsGuard < epicsMutex > & ) const + epicsGuard < epicsMutex > & ) const { return true; } -CACChannelPrivate :: +CACChannelPrivate :: CACChannelPrivate() : _refLocalHostName ( localHostNameCache.getReference () ) { } -inline unsigned CACChannelPrivate :: +inline unsigned CACChannelPrivate :: getHostName ( char * pBuf, unsigned bufLength ) { return _refLocalHostName->getName ( pBuf, bufLength ); } - -inline const char * CACChannelPrivate :: + +inline const char * CACChannelPrivate :: pHostName () { return _refLocalHostName->pointer (); } static CACChannelPrivate * pCACChannelPrivate = 0; - + // runs once only for each process extern "C" void cacChannelSetup ( void * ) { @@ -117,7 +117,7 @@ extern "C" void cacChannelSetup ( void * ) } // the default is to assume that it is a locally hosted channel -unsigned cacChannel::getHostName ( +unsigned cacChannel::getHostName ( epicsGuard < epicsMutex > &, char * pBuf, unsigned bufLength ) const throw () { diff --git a/modules/ca/src/client/cacChannelNotify.cpp b/modules/ca/src/client/cacChannelNotify.cpp index 67e23164c..cb231d848 100644 --- a/modules/ca/src/client/cacChannelNotify.cpp +++ b/modules/ca/src/client/cacChannelNotify.cpp @@ -6,26 +6,26 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* + * * - * * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 - * + * * Copyright, 1986, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #include "iocinf.h" #include "cacIO.h" -cacChannelNotify::~cacChannelNotify () +cacChannelNotify::~cacChannelNotify () { } diff --git a/modules/ca/src/client/cacContextNotify.cpp b/modules/ca/src/client/cacContextNotify.cpp index aa8904e17..2c36ba06d 100644 --- a/modules/ca/src/client/cacContextNotify.cpp +++ b/modules/ca/src/client/cacContextNotify.cpp @@ -7,7 +7,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* * * L O S A L A M O S * Los Alamos National Laboratory @@ -28,11 +28,11 @@ cacContextNotify::~cacContextNotify () { } -void cacContextNotify::callbackProcessingInitiateNotify () +void cacContextNotify::callbackProcessingInitiateNotify () { } -void cacContextNotify::callbackProcessingCompleteNotify () +void cacContextNotify::callbackProcessingCompleteNotify () { } diff --git a/modules/ca/src/client/cacIO.h b/modules/ca/src/client/cacIO.h index 699626a54..627a6b1dd 100644 --- a/modules/ca/src/client/cacIO.h +++ b/modules/ca/src/client/cacIO.h @@ -16,9 +16,9 @@ * Copyright, 1986, The Regents of the University of California. * * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #ifndef INC_cacIO_H @@ -264,8 +264,8 @@ protected: private: cacChannelNotify & callback; - cacChannel ( const cacChannel & ); - cacChannel & operator = ( const cacChannel & ); + cacChannel ( const cacChannel & ); + cacChannel & operator = ( const cacChannel & ); }; class LIBCA_API cacContext { diff --git a/modules/ca/src/client/cacReadNotify.cpp b/modules/ca/src/client/cacReadNotify.cpp index c8e9a5434..2361f73fb 100644 --- a/modules/ca/src/client/cacReadNotify.cpp +++ b/modules/ca/src/client/cacReadNotify.cpp @@ -7,7 +7,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* * * L O S A L A M O S * Los Alamos National Laboratory diff --git a/modules/ca/src/client/cacStateNotify.cpp b/modules/ca/src/client/cacStateNotify.cpp index 799b0dfa0..b9da1240c 100644 --- a/modules/ca/src/client/cacStateNotify.cpp +++ b/modules/ca/src/client/cacStateNotify.cpp @@ -7,7 +7,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* * * L O S A L A M O S * Los Alamos National Laboratory diff --git a/modules/ca/src/client/cacWriteNotify.cpp b/modules/ca/src/client/cacWriteNotify.cpp index 79b98bb66..4ed642d93 100644 --- a/modules/ca/src/client/cacWriteNotify.cpp +++ b/modules/ca/src/client/cacWriteNotify.cpp @@ -7,7 +7,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* * * L O S A L A M O S * Los Alamos National Laboratory diff --git a/modules/ca/src/client/cadef.h b/modules/ca/src/client/cadef.h index 32cef0070..5ed215584 100644 --- a/modules/ca/src/client/cadef.h +++ b/modules/ca/src/client/cadef.h @@ -6,7 +6,7 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* * * L O S A L A M O S * Los Alamos National Laboratory @@ -72,8 +72,8 @@ typedef void caArh (struct access_rights_handler_args args); /* The conversion routine to call for each type */ #define VALID_TYPE(TYPE) (((unsigned short)TYPE)<=LAST_BUFFER_TYPE) -/* - * Arguments passed to event handlers and get/put call back handlers. +/* + * Arguments passed to event handlers and get/put call back handlers. * * The status field below is the CA ECA_XXX status of the requested * operation which is saved from when the operation was attempted in the @@ -84,7 +84,7 @@ typedef void caArh (struct access_rights_handler_args args); typedef struct event_handler_args { void *usr; /* user argument supplied with request */ chanId chid; /* channel id */ - long type; /* the type of the item returned */ + long type; /* the type of the item returned */ long count; /* the element count of the item returned */ const void *dbr; /* a pointer to the item returned */ int status; /* ECA_XXX status of the requested op from the server */ @@ -122,8 +122,8 @@ typedef unsigned CA_SYNC_GID; #define CA_OP_CLEAR_EVENT 4 #define CA_OP_OTHER 5 -/* - * used with connection_handler_args +/* + * used with connection_handler_args */ #define CA_OP_CONN_UP 6 #define CA_OP_CONN_DOWN 7 @@ -156,8 +156,8 @@ LIBCA_API unsigned epicsStdCall ca_read_access (chid chan); LIBCA_API unsigned epicsStdCall ca_write_access (chid chan); /* - * cs_ - `channel state' - * + * cs_ - `channel state' + * * cs_never_conn valid chid, IOC not found * cs_prev_conn valid chid, IOC was found, but unavailable * cs_conn valid chid, IOC was found, still available @@ -172,7 +172,7 @@ LIBCA_API enum channel_state epicsStdCall ca_state (chid chan); /* Must be called once before calling any of the other routines */ /************************************************************************/ LIBCA_API int epicsStdCall ca_task_initialize (void); -enum ca_preemptive_callback_select +enum ca_preemptive_callback_select { ca_disable_preemptive_callback, ca_enable_preemptive_callback }; LIBCA_API int epicsStdCall ca_context_create (enum ca_preemptive_callback_select select); @@ -186,7 +186,7 @@ LIBCA_API void epicsStdCall ca_detach_context (); LIBCA_API int epicsStdCall ca_task_exit (void); LIBCA_API void epicsStdCall ca_context_destroy (void); -typedef unsigned capri; +typedef unsigned capri; #define CA_PRIORITY_MAX 99 #define CA_PRIORITY_MIN 0 #define CA_PRIORITY_DEFAULT CA_PRIORITY_MIN @@ -199,7 +199,7 @@ typedef unsigned capri; * ca_create_channel () * * pChanName R channel name string - * pConnStateCallback R address of connection state change + * pConnStateCallback R address of connection state change * callback function * pUserPrivate R placed in the channel's user private field * o can be fetched later by ca_puser(CHID) @@ -209,8 +209,8 @@ typedef unsigned capri; */ LIBCA_API int epicsStdCall ca_create_channel ( - const char *pChanName, - caCh *pConnStateCallback, + const char *pChanName, + caCh *pConnStateCallback, void *pUserPrivate, capri priority, chid *pChanID @@ -219,7 +219,7 @@ LIBCA_API int epicsStdCall ca_create_channel /* * ca_change_connection_event() * - * chan R channel identifier + * chan R channel identifier * pfunc R address of connection call-back function */ LIBCA_API int epicsStdCall ca_change_connection_event @@ -231,7 +231,7 @@ LIBCA_API int epicsStdCall ca_change_connection_event /* * ca_replace_access_rights_event () * - * chan R channel identifier + * chan R channel identifier * pfunc R address of access rights call-back function */ LIBCA_API int epicsStdCall ca_replace_access_rights_event ( @@ -245,7 +245,7 @@ LIBCA_API int epicsStdCall ca_replace_access_rights_event ( * replace the default exception handler * * pfunc R address of exception call-back function - * pArg R copy of this pointer passed to exception + * pArg R copy of this pointer passed to exception * call-back function */ typedef void caExceptionHandler (struct exception_handler_args); @@ -272,10 +272,10 @@ LIBCA_API int epicsStdCall ca_clear_channel /* * ca_bput() * - * WARNING: this copies the new value from a string (dbr_string_t) + * WARNING: this copies the new value from a string (dbr_string_t) * (and not as an integer) * - * chan R channel identifier + * chan R channel identifier * pValue R new channel value string copied from this location */ #define ca_bput(chan, pValue) \ @@ -284,9 +284,9 @@ ca_array_put(DBR_STRING, 1u, chan, (const dbr_string_t *) (pValue)) /* * ca_rput() * - * WARNING: this copies the new value from a dbr_float_t + * WARNING: this copies the new value from a dbr_float_t * - * chan R channel identifier + * chan R channel identifier * pValue R new channel value copied from this location */ #define ca_rput(chan,pValue) \ @@ -296,7 +296,7 @@ ca_array_put(DBR_FLOAT, 1u, chan, (const dbr_float_t *) pValue) * ca_put() * * type R data type from db_access.h - * chan R channel identifier + * chan R channel identifier * pValue R new channel value copied from this location */ #define ca_put(type, chan, pValue) ca_array_put (type, 1u, chan, pValue) @@ -306,13 +306,13 @@ ca_array_put(DBR_FLOAT, 1u, chan, (const dbr_float_t *) pValue) * * type R data type from db_access.h * count R array element count - * chan R channel identifier + * chan R channel identifier * pValue R new channel value copied from this location */ LIBCA_API int epicsStdCall ca_array_put ( - chtype type, - unsigned long count, + chtype type, + unsigned long count, chid chanId, const void * pValue ); @@ -320,8 +320,8 @@ LIBCA_API int epicsStdCall ca_array_put /* * ca_array_put_callback() * - * This routine functions identically to the original ca put request - * with the addition of a callback to the user supplied function + * This routine functions identically to the original ca put request + * with the addition of a callback to the user supplied function * after recod processing completes in the IOC. The arguments * to the user supplied callback function are declared in * the structure event_handler_args and include the pointer @@ -329,15 +329,15 @@ LIBCA_API int epicsStdCall ca_array_put * * type R data type from db_access.h * count R array element count - * chan R channel identifier + * chan R channel identifier * pValue R new channel value copied from this location * pFunc R pointer to call-back function * pArg R copy of this pointer passed to pFunc */ LIBCA_API int epicsStdCall ca_array_put_callback ( - chtype type, - unsigned long count, + chtype type, + unsigned long count, chid chanId, const void * pValue, caEventCallBackFunc * pFunc, @@ -354,10 +354,10 @@ LIBCA_API int epicsStdCall ca_array_put_callback /* * ca_bget() * - * WARNING: this copies the new value into a string (dbr_string_t) + * WARNING: this copies the new value into a string (dbr_string_t) * (and not into an integer) * - * chan R channel identifier + * chan R channel identifier * pValue W channel value copied to this location */ #define ca_bget(chan, pValue) \ @@ -366,9 +366,9 @@ ca_array_get(DBR_STRING, 1u, chan, (dbr_string_t *)(pValue)) /* * ca_rget() * - * WARNING: this copies the new value into a 32 bit float (dbr_float_t) + * WARNING: this copies the new value into a 32 bit float (dbr_float_t) * - * chan R channel identifier + * chan R channel identifier * pValue W channel value copied to this location */ #define ca_rget(chan, pValue) \ @@ -378,7 +378,7 @@ ca_array_get(DBR_FLOAT, 1u, chan, (dbr_float_t *)(pValue)) * ca_rget() * * type R data type from db_access.h - * chan R channel identifier + * chan R channel identifier * pValue W channel value copied to this location */ #define ca_get(type, chan, pValue) ca_array_get(type, 1u, chan, pValue) @@ -388,13 +388,13 @@ ca_array_get(DBR_FLOAT, 1u, chan, (dbr_float_t *)(pValue)) * * type R data type from db_access.h * count R array element count - * chan R channel identifier + * chan R channel identifier * pValue W channel value copied to this location */ LIBCA_API int epicsStdCall ca_array_get ( - chtype type, - unsigned long count, + chtype type, + unsigned long count, chid chanId, void * pValue ); @@ -408,10 +408,10 @@ LIBCA_API int epicsStdCall ca_array_get /* * ca_bget_callback() * - * WARNING: this returns the new value as a string (dbr_string_t) + * WARNING: this returns the new value as a string (dbr_string_t) * (and not as an integer) * - * chan R channel identifier + * chan R channel identifier * pFunc R pointer to call-back function * pArg R copy of this pointer passed to pFunc */ @@ -421,9 +421,9 @@ ca_array_get_callback (DBR_STRING, 1u, chan, pFunc, pArg) /* * ca_rget_callback() * - * WARNING: this returns the new value as a float (dbr_float_t) + * WARNING: this returns the new value as a float (dbr_float_t) * - * chan R channel identifier + * chan R channel identifier * pFunc R pointer to call-back function * pArg R copy of this pointer passed to pFunc */ @@ -434,7 +434,7 @@ ca_array_get_callback (DBR_FLOAT, 1u, chan, pFunc, pArg) * ca_get_callback() * * type R data type from db_access.h - * chan R channel identifier + * chan R channel identifier * pFunc R pointer to call-back function * pArg R copy of this pointer passed to pFunc */ @@ -446,14 +446,14 @@ ca_array_get_callback (type, 1u, chan, pFunc, pArg) * * type R data type from db_access.h * count R array element count - * chan R channel identifier + * chan R channel identifier * pFunc R pointer to call-back function * pArg R copy of this pointer passed to pFunc */ LIBCA_API int epicsStdCall ca_array_get_callback ( - chtype type, - unsigned long count, + chtype type, + unsigned long count, chid chanId, caEventCallBackFunc * pFunc, void * pArg @@ -465,7 +465,7 @@ LIBCA_API int epicsStdCall ca_array_get_callback /* NOTES: */ /* 1) Evid may be omited by passing a NULL pointer */ /* */ -/* 2) An array count of zero specifies the native db count */ +/* 2) An array count of zero specifies the native db count */ /* */ /************************************************************************/ @@ -474,7 +474,7 @@ LIBCA_API int epicsStdCall ca_array_get_callback * * type R data type from db_access.h * count R array element count - * chan R channel identifier + * chan R channel identifier * mask R event mask - one of {DBE_VALUE, DBE_ALARM, DBE_LOG} * pFunc R pointer to call-back function * pArg R copy of this pointer passed to pFunc @@ -482,8 +482,8 @@ LIBCA_API int epicsStdCall ca_array_get_callback */ LIBCA_API int epicsStdCall ca_create_subscription ( - chtype type, - unsigned long count, + chtype type, + unsigned long count, chid chanId, long mask, caEventCallBackFunc * pFunc, @@ -524,24 +524,24 @@ LIBCA_API chid epicsStdCall ca_evid_to_chid ( evid id ); /* FLOW OF TYPICAL APPLICATION */ /* */ /* search() ! Obtain Channel ids */ -/* . ! " */ +/* . ! " */ /* . ! " */ /* pend_io ! wait for channels to connect */ /* */ /* get() ! several requests for remote info */ -/* get() ! " */ -/* add_event() ! " */ -/* get() ! " */ +/* get() ! " */ +/* add_event() ! " */ +/* get() ! " */ /* . */ /* . */ /* . */ /* flush_io() ! send get requests */ /* ! optional parallel processing */ -/* . ! " */ -/* . ! " */ +/* . ! " */ +/* . ! " */ /* pend_io() ! wait for replies from get requests */ /* . ! access to requested data */ -/* . ! " */ +/* . ! " */ /* pend_event() ! wait for requested events */ /* */ /************************************************************************/ @@ -551,7 +551,7 @@ LIBCA_API chid epicsStdCall ca_evid_to_chid ( evid id ); /* functions specified with add_event when events occur. If the */ /* timeout is specified as 0 an infinite timeout is assumed. */ /* ca_flush_io() is called by this routine. If ca_pend_io () */ -/* is called when no IO is outstanding then it will return immediately */ +/* is called when no IO is outstanding then it will return immediately */ /* without processing. */ /************************************************************************/ @@ -566,8 +566,8 @@ LIBCA_API int epicsStdCall ca_pend_event (ca_real timeOut); /* * ca_pend_io() * - * timeOut R wait for this delay in seconds but return early - * if all get requests (or search requests with null + * timeOut R wait for this delay in seconds but return early + * if all get requests (or search requests with null * connection handler pointer have completed) */ LIBCA_API int epicsStdCall ca_pend_io (ca_real timeOut); @@ -578,7 +578,7 @@ LIBCA_API int epicsStdCall ca_pend (ca_real timeout, int early); /* * ca_test_io() * - * returns TRUE when get requests (or search requests with null + * returns TRUE when get requests (or search requests with null * connection handler pointer) are outstanding */ LIBCA_API int epicsStdCall ca_test_io (void); @@ -600,8 +600,8 @@ LIBCA_API int epicsStdCall ca_flush_io (void); */ LIBCA_API void epicsStdCall ca_signal ( - long errorCode, - const char *pCtxStr + long errorCode, + const char *pCtxStr ); /* @@ -614,10 +614,10 @@ LIBCA_API void epicsStdCall ca_signal */ LIBCA_API void epicsStdCall ca_signal_with_file_and_lineno ( - long errorCode, - const char *pCtxStr, - const char *pFileStr, - int lineNo + long errorCode, + const char *pCtxStr, + const char *pFileStr, + int lineNo ); /* @@ -646,7 +646,7 @@ LIBCA_API unsigned epicsStdCall ca_get_host_name ( chid pChan, /* * CA_ADD_FD_REGISTRATION * - * call their function with their argument whenever + * call their function with their argument whenever * a new fd is added or removed * (for use with a manager of the select system call under UNIX) * @@ -654,7 +654,7 @@ LIBCA_API unsigned epicsStdCall ca_get_host_name ( chid pChan, * if (!opened) then fd was deleted * */ -typedef void CAFDHANDLER (void *parg, int fd, int opened); +typedef void CAFDHANDLER (void *parg, int fd, int opened); /* * ca_add_fd_registration() @@ -685,7 +685,7 @@ LIBCA_API int epicsStdCall ca_add_fd_registration * * create a sync group * - * pgid W pointer to sync group id that will be written + * pgid W pointer to sync group id that will be written */ LIBCA_API int epicsStdCall ca_sg_create (CA_SYNC_GID * pgid); @@ -694,16 +694,16 @@ LIBCA_API int epicsStdCall ca_sg_create (CA_SYNC_GID * pgid); * * delete a sync group * - * gid R sync group id + * gid R sync group id */ LIBCA_API int epicsStdCall ca_sg_delete (const CA_SYNC_GID gid); /* * ca_sg_block() * - * block for IO performed within a sync group to complete + * block for IO performed within a sync group to complete * - * gid R sync group id + * gid R sync group id * timeout R wait for this duration prior to timing out * and returning ECA_TIMEOUT */ @@ -715,7 +715,7 @@ LIBCA_API int epicsStdCall ca_sg_block (const CA_SYNC_GID gid, ca_real timeout); * test for sync group IO operations in progress * * gid R sync group id - * + * * returns one of ECA_BADSYNCGRP, ECA_IOINPROGRESS, ECA_IODONE */ LIBCA_API int epicsStdCall ca_sg_test (const CA_SYNC_GID gid); @@ -736,16 +736,16 @@ LIBCA_API int epicsStdCall ca_sg_reset(const CA_SYNC_GID gid); * gid R sync group id * type R data type from db_access.h * count R array element count - * chan R channel identifier + * chan R channel identifier * pValue W channel value copied to this location */ LIBCA_API int epicsStdCall ca_sg_array_get ( const CA_SYNC_GID gid, - chtype type, + chtype type, unsigned long count, chid chan, - void *pValue + void *pValue ); #define ca_sg_get(gid, type, chan, pValue) \ @@ -760,16 +760,16 @@ ca_sg_array_get (gid, type, 1u, chan, pValue) * gid R sync group id * type R data type from db_access.h * count R array element count - * chan R channel identifier + * chan R channel identifier * pValue R new channel value copied from this location */ LIBCA_API int epicsStdCall ca_sg_array_put ( const CA_SYNC_GID gid, - chtype type, + chtype type, unsigned long count, chid chan, - const void *pValue + const void *pValue ); #define ca_sg_put(gid, type, chan, pValue) \ @@ -790,11 +790,11 @@ LIBCA_API void epicsStdCall ca_dump_dbr (chtype type, unsigned count, const void /* * ca_v42_ok() * - * Put call back is available if the CA server is on version is 4.2 + * Put call back is available if the CA server is on version is 4.2 * or higher. * * chan R channel identifier - * + * * (returns true or false) */ LIBCA_API int epicsStdCall ca_v42_ok (chid chan); @@ -854,12 +854,12 @@ ca_build_and_connect(NAME, XXXXX, 1, CHIDPTR, YYYYY, 0, 0) #define ca_array_build(NAME,XXXXX, ZZZZZZ, CHIDPTR,YYYYY)\ ca_build_and_connect(NAME, XXXXX, ZZZZZZ, CHIDPTR, YYYYY, 0, 0) LIBCA_API int epicsStdCall ca_build_and_connect - ( const char *pChanName, chtype, unsigned long, + ( const char *pChanName, chtype, unsigned long, chid * pChanID, void *, caCh * pFunc, void * pArg ); #define ca_search(pChanName, pChanID)\ ca_search_and_connect (pChanName, pChanID, 0, 0) LIBCA_API int epicsStdCall ca_search_and_connect - ( const char * pChanName, chid * pChanID, + ( const char * pChanName, chid * pChanID, caCh *pFunc, void * pArg ); LIBCA_API int epicsStdCall ca_channel_status (epicsThreadId tid); LIBCA_API int epicsStdCall ca_clear_event ( evid eventID ); diff --git a/modules/ca/src/client/caerr.h b/modules/ca/src/client/caerr.h index 9104a4f02..03967475d 100644 --- a/modules/ca/src/client/caerr.h +++ b/modules/ca/src/client/caerr.h @@ -16,7 +16,7 @@ * * Author: Jeffrey O. Hill * - */ + */ #ifndef INC_caerr_H @@ -69,9 +69,9 @@ (CA_INSERT_MSG_NO(NUMBER) | CA_INSERT_SEVERITY(SEVERITY)) /* - * In the lines below "defunct" indicates that current release + * In the lines below "defunct" indicates that current release * servers and client library will not return this error code, but - * servers on earlier releases that communicate with current clients + * servers on earlier releases that communicate with current clients * might still generate exceptions with these error constants */ #define ECA_NORMAL DEFMSG(CA_K_SUCCESS, 0) /* success */ @@ -80,10 +80,10 @@ #define ECA_UKNSERV DEFMSG(CA_K_ERROR, 3) /* defunct */ #define ECA_SOCK DEFMSG(CA_K_ERROR, 4) /* defunct */ #define ECA_CONN DEFMSG(CA_K_WARNING, 5) /* defunct */ -#define ECA_ALLOCMEM DEFMSG(CA_K_WARNING, 6) +#define ECA_ALLOCMEM DEFMSG(CA_K_WARNING, 6) #define ECA_UKNCHAN DEFMSG(CA_K_WARNING, 7) /* defunct */ #define ECA_UKNFIELD DEFMSG(CA_K_WARNING, 8) /* defunct */ -#define ECA_TOLARGE DEFMSG(CA_K_WARNING, 9) +#define ECA_TOLARGE DEFMSG(CA_K_WARNING, 9) #define ECA_TIMEOUT DEFMSG(CA_K_WARNING, 10) #define ECA_NOSUPPORT DEFMSG(CA_K_WARNING, 11) /* defunct */ #define ECA_STRTOBIG DEFMSG(CA_K_WARNING, 12) /* defunct */ diff --git a/modules/ca/src/client/caeventmask.h b/modules/ca/src/client/caeventmask.h index 5f0914509..4f0f2ec79 100644 --- a/modules/ca/src/client/caeventmask.h +++ b/modules/ca/src/client/caeventmask.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef INCLcaeventmaskh @@ -13,12 +13,12 @@ /* event selections - (If any more than 8 of these are needed then update the - select field in the event_block struct in db_event.c from + (If any more than 8 of these are needed then update the + select field in the event_block struct in db_event.c from unsigned char to unsigned short) - DBE_VALUE + DBE_VALUE Trigger an event when a significant change in the channel's value occurs. Relies on the monitor deadband field under DCT. diff --git a/modules/ca/src/client/casw.cpp b/modules/ca/src/client/casw.cpp index 74e38dca9..ee16c70aa 100644 --- a/modules/ca/src/client/casw.cpp +++ b/modules/ca/src/client/casw.cpp @@ -7,7 +7,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* * * L O S A L A M O S * Los Alamos National Laboratory @@ -22,7 +22,7 @@ #define epicsAssertAuthor "Jeff Hill johill@lanl.gov" -#include "envDefs.h" +#include "envDefs.h" #include "errlog.h" #include "osiWireFormat.h" @@ -39,8 +39,8 @@ public: void release ( void * ); private: tsFreeList < class bhe, 0x100 > freeList; - bheFreeStoreMgr ( const bheFreeStoreMgr & ); - bheFreeStoreMgr & operator = ( const bheFreeStoreMgr & ); + bheFreeStoreMgr ( const bheFreeStoreMgr & ); + bheFreeStoreMgr & operator = ( const bheFreeStoreMgr & ); }; void * bheFreeStoreMgr::allocate ( size_t size ) @@ -107,7 +107,7 @@ int main ( int argc, char ** argv ) sock = epicsSocketCreate ( AF_INET, SOCK_DGRAM, IPPROTO_UDP ); if ( sock == INVALID_SOCKET ) { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); errlogPrintf ("casw: unable to create datagram socket because = \"%s\"\n", sockErrBuf ); @@ -121,7 +121,7 @@ int main ( int argc, char ** argv ) status = bind ( sock, &addr.sa, sizeof (addr) ); if ( status < 0 ) { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); epicsSocketDestroy ( sock ); errlogPrintf ( "casw: unable to bind to an unconstrained address because = \"%s\"\n", @@ -133,7 +133,7 @@ int main ( int argc, char ** argv ) status = socket_ioctl ( sock, FIONBIO, &yes ); if ( status < 0 ) { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); epicsSocketDestroy ( sock ); errlogPrintf ( "casw: unable to set socket to nonblocking state because \"%s\"\n", @@ -168,7 +168,7 @@ int main ( int argc, char ** argv ) status = socket_ioctl ( sock, FIONBIO, &no ); if ( status < 0 ) { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); epicsSocketDestroy ( sock ); errlogPrintf ( "casw: unable to set socket to blocking state because \"%s\"\n", @@ -184,7 +184,7 @@ int main ( int argc, char ** argv ) &addr.sa, &addrSize ); if ( status <= 0 ) { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); epicsSocketDestroy ( sock ); errlogPrintf ("casw: error from recv was = \"%s\"\n", @@ -195,7 +195,7 @@ int main ( int argc, char ** argv ) if ( addr.sa.sa_family != AF_INET ) { continue; } - + unsigned byteCount = static_cast ( status ); pCurMsg = reinterpret_cast < const caHdr * > ( ( pCurBuf = buf ) ); while ( byteCount ) { @@ -212,9 +212,9 @@ int main ( int argc, char ** argv ) epicsTime previousTime; struct sockaddr_in ina; - /* + /* * this allows a fan-out server to potentially - * insert the true address of the CA server + * insert the true address of the CA server * * old servers: * 1) set this field to one of the ip addresses of the host _or_ @@ -251,8 +251,8 @@ int main ( int argc, char ** argv ) bhe *pBHE = beaconTable.lookup ( ina ); if ( pBHE ) { previousTime = pBHE->updateTime ( guard ); - anomaly = pBHE->updatePeriod ( - guard, programBeginTime, + anomaly = pBHE->updatePeriod ( + guard, programBeginTime, currentTime, beaconNumber, protocolRevision ); } else { @@ -263,7 +263,7 @@ int main ( int argc, char ** argv ) * time that we have seen a server's beacon * shortly after the program started up) */ - pBHE = new ( bheFreeList ) + pBHE = new ( bheFreeList ) bhe ( mutex, currentTime, beaconNumber, ina ); if ( pBHE ) { if ( beaconTable.add ( *pBHE ) < 0 ) { @@ -274,7 +274,7 @@ int main ( int argc, char ** argv ) } if ( anomaly || interest > 1 ) { char date[64]; - currentTime.strftime ( date, sizeof ( date ), + currentTime.strftime ( date, sizeof ( date ), "%Y-%m-%d %H:%M:%S.%09f"); char host[64]; ipAddrToA ( &ina, host, sizeof ( host ) ); @@ -287,11 +287,11 @@ int main ( int argc, char ** argv ) pPrefix = " "; } } - printf ( "%s%-40s %s\n", + printf ( "%s%-40s %s\n", pPrefix, host, date ); if ( anomaly && interest > 0 ) { - printf ( "\testimate=%f current=%f\n", - pBHE->period ( guard ), + printf ( "\testimate=%f current=%f\n", + pBHE->period ( guard ), currentTime - previousTime ); } fflush(stdout); diff --git a/modules/ca/src/client/catime.c b/modules/ca/src/client/catime.c index cccd940bc..ab758d3fd 100644 --- a/modules/ca/src/client/catime.c +++ b/modules/ca/src/client/catime.c @@ -5,17 +5,17 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * - * CA performance test + * CA performance test * - * History + * History * joh 09-12-89 Initial release * joh 12-20-94 portability * - * + * */ #include @@ -45,7 +45,7 @@ typedef struct testItem { char name[128]; int type; int count; - void * pValue; + void * pValue; } ti; typedef void tf ( ti *pItems, unsigned iterations, unsigned *pInlineIter ); @@ -144,7 +144,7 @@ unsigned *pInlineIter { int status; unsigned i; - + for (i=0u; itype, @@ -257,7 +257,7 @@ unsigned *pInlineIter { ti *pi; int status; - + for (pi=pItems; pi<&pItems[iterations]; pi++) { status = ca_array_get( pi->type, @@ -337,7 +337,7 @@ unsigned *pInlineIter { ti *pi; int status; - + for (pi=pItems; pi<&pItems[iterations]; pi++) { status = ca_array_get( pi->type, @@ -361,9 +361,9 @@ static void measure_get_latency (ti *pItems, unsigned iterations) epicsTimeStamp start_time; double delay; double X = 0u; - double XX = 0u; - double max = DBL_MIN; - double min = DBL_MAX; + double XX = 0u; + double max = DBL_MIN; + double min = DBL_MAX; double mean; double stdDev; ti *pi; @@ -371,7 +371,7 @@ static void measure_get_latency (ti *pItems, unsigned iterations) for ( pi = pItems; pi < &pItems[iterations]; pi++ ) { epicsTimeGetCurrent ( &start_time ); - status = ca_array_get ( pi->type, pi->count, + status = ca_array_get ( pi->type, pi->count, pi->chix, pi->pValue ); SEVCHK ( status, NULL ); status = ca_pend_io ( 100.0 ); @@ -395,13 +395,13 @@ static void measure_get_latency (ti *pItems, unsigned iterations) mean = X/iterations; stdDev = sqrt ( XX/iterations - mean*mean ); - printf ( + printf ( "Get Latency - " "mean = %3.1f uS, " "std dev = %3.1f uS, " "min = %3.1f uS " "max = %3.1f uS\n", - mean * 1e6, stdDev * 1e6, + mean * 1e6, stdDev * 1e6, min * 1e6, max * 1e6 ); } @@ -412,9 +412,9 @@ static void printSearchStat ( const ti * pi, unsigned iterations ) { unsigned i; double X = 0u; - double XX = 0u; - double max = DBL_MIN; - double min = DBL_MAX; + double XX = 0u; + double max = DBL_MIN; + double min = DBL_MAX; double mean; double stdDev; @@ -432,7 +432,7 @@ static void printSearchStat ( const ti * pi, unsigned iterations ) mean = X / iterations; stdDev = sqrt( XX / iterations - mean * mean ); - printf ( + printf ( "Search tries per chan - " "mean = %3.1f " "std dev = %3.1f " @@ -458,10 +458,10 @@ void timeIt ( tf *pfunc, ti *pItems, unsigned iterations, delay = epicsTimeDiffInSeconds ( &end_time, &start_time ); if ( delay > 0.0 ) { double freq = ( iterations * inlineIter ) / delay; - printf ( "Per Op, %8.4f uS ( %8.4f MHz )", + printf ( "Per Op, %8.4f uS ( %8.4f MHz )", 1e6 / freq, freq / 1e6 ); if ( pItems != NULL ) { - printf(", %8.4f snd Mbps, %8.4f rcv Mbps\n", + printf(", %8.4f snd Mbps, %8.4f rcv Mbps\n", (inlineIter*nBytesSent*CHAR_BIT)/(delay*1e6), (inlineIter*nBytesRecv*CHAR_BIT)/(delay*1e6) ); } @@ -479,13 +479,13 @@ static void test ( ti *pItems, unsigned iterations ) unsigned payloadSize, dblPayloadSize; unsigned nBytesSent, nBytesRecv; - payloadSize = + payloadSize = dbr_size_n ( pItems[0].type, pItems[0].count ); payloadSize = CA_MESSAGE_ALIGN ( payloadSize ); dblPayloadSize = dbr_size [ DBR_DOUBLE ]; dblPayloadSize = CA_MESSAGE_ALIGN ( dblPayloadSize ); - + if ( payloadSize > dblPayloadSize ) { unsigned factor = payloadSize / dblPayloadSize; while ( factor ) { @@ -500,15 +500,15 @@ static void test ( ti *pItems, unsigned iterations ) printf ( "\t### async put test ###\n"); nBytesSent = sizeof ( caHdr ) + CA_MESSAGE_ALIGN( payloadSize ); nBytesRecv = 0u; - timeIt ( test_put, pItems, iterations, - nBytesSent * iterations, + timeIt ( test_put, pItems, iterations, + nBytesSent * iterations, nBytesRecv * iterations ); printf ( "\t### async get test ###\n"); nBytesSent = sizeof ( caHdr ); nBytesRecv = sizeof ( caHdr ) + CA_MESSAGE_ALIGN ( payloadSize ); - timeIt ( test_get, pItems, iterations, - nBytesSent * ( iterations ), + timeIt ( test_get, pItems, iterations, + nBytesSent * ( iterations ), nBytesRecv * ( iterations ) ); printf ("\t### synch get test ###\n"); @@ -520,7 +520,7 @@ static void test ( ti *pItems, unsigned iterations ) else if ( iterations > 10 ) { iterations /= 10; } - timeIt ( test_wait, pItems, iterations, + timeIt ( test_wait, pItems, iterations, nBytesSent * iterations, nBytesRecv * iterations ); } @@ -528,7 +528,7 @@ static void test ( ti *pItems, unsigned iterations ) /* * catime () */ -int catime ( const char * channelName, +int catime ( const char * channelName, unsigned channelCount, enum appendNumberFlag appNF ) { unsigned i; @@ -536,7 +536,7 @@ int catime ( const char * channelName, unsigned strsize; unsigned nBytesSent, nBytesRecv; ti *pItemList; - + if ( channelCount == 0 ) { printf ( "channel count was zero\n" ); return 0; @@ -547,15 +547,15 @@ int catime ( const char * channelName, return -1; } - SEVCHK ( ca_context_create ( ca_disable_preemptive_callback ), + SEVCHK ( ca_context_create ( ca_disable_preemptive_callback ), "Unable to initialize" ); if ( appNF == appendNumber ) { - printf ( "Testing with %u channels named %snnn\n", + printf ( "Testing with %u channels named %snnn\n", channelCount, channelName ); } else { - printf ( "Testing with %u channels named %s\n", + printf ( "Testing with %u channels named %s\n", channelCount, channelName ); } @@ -573,7 +573,7 @@ int catime ( const char * channelName, pItemList[i].name[strsize]= '\0'; pItemList[i].count = 0; pItemList[i].pValue = 0; - nBytesSent += 2 * ( CA_MESSAGE_ALIGN ( strlen ( pItemList[i].name ) ) + nBytesSent += 2 * ( CA_MESSAGE_ALIGN ( strlen ( pItemList[i].name ) ) + sizeof (caHdr) ); nBytesRecv += 2 * sizeof (caHdr); } @@ -582,7 +582,7 @@ int catime ( const char * channelName, printf ( "--------------------\n" ); timeIt ( test_search, pItemList, channelCount, nBytesSent, nBytesRecv ); printSearchStat ( pItemList, channelCount ); - + for ( i = 0; i < channelCount; i++ ) { size_t count = ca_element_count ( pItemList[i].chix ); size_t size = sizeof ( dbr_string_t ) * count; @@ -608,7 +608,7 @@ int catime ( const char * channelName, for ( j = 0; j < pItemList[i].count; j++ ) { pFltVal[j] = (dbr_float_t) val; } - pItemList[i].type = DBR_FLOAT; + pItemList[i].type = DBR_FLOAT; } printf ( "DBR_FLOAT Test\n" ); printf ( "--------------\n" ); @@ -621,13 +621,13 @@ int catime ( const char * channelName, for ( j = 0; j < pItemList[i].count; j++ ) { pDblVal[j] = (dbr_double_t) val; } - pItemList[i].type = DBR_DOUBLE; + pItemList[i].type = DBR_DOUBLE; } printf ( "DBR_DOUBLE Test\n" ); printf ( "---------------\n" ); test ( pItemList, channelCount ); - + for ( i = 0; i < channelCount; i++ ) { dbr_string_t * pStrVal = ( dbr_string_t * ) pItemList[i].pValue; double val = i; @@ -635,7 +635,7 @@ int catime ( const char * channelName, for ( j = 0; j < pItemList[i].count; j++ ) { sprintf ( pStrVal[j], "%f", val ); } - pItemList[i].type = DBR_STRING; + pItemList[i].type = DBR_STRING; } printf ( "DBR_STRING Test\n" ); printf ( "---------------\n" ); @@ -648,7 +648,7 @@ int catime ( const char * channelName, for ( j = 0; j < pItemList[i].count; j++ ) { pIntVal[j] = (dbr_int_t) val; } - pItemList[i].type = DBR_INT; + pItemList[i].type = DBR_INT; } printf ( "DBR_INT Test\n" ); printf ( "------------\n" ); @@ -661,8 +661,8 @@ int catime ( const char * channelName, for ( j = 0; j < pItemList[i].count; j++ ) { pDblVal[j] = 0; } - pItemList[i].type = DBR_DOUBLE; - } + pItemList[i].type = DBR_DOUBLE; + } measure_get_latency ( pItemList, channelCount ); printf ( "Free Channel Test\n" ); @@ -670,10 +670,10 @@ int catime ( const char * channelName, timeIt ( test_free, pItemList, channelCount, 0, 0 ); SEVCHK ( ca_task_exit (), "Unable to free resources at exit" ); - + for ( i = 0; i < channelCount; i++ ) { free ( pItemList[i].pValue ); - } + } free ( pItemList ); diff --git a/modules/ca/src/client/catimeMain.c b/modules/ca/src/client/catimeMain.c index 598ec453b..cc9ec8365 100644 --- a/modules/ca/src/client/catimeMain.c +++ b/modules/ca/src/client/catimeMain.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include diff --git a/modules/ca/src/client/comBuf.cpp b/modules/ca/src/client/comBuf.cpp index 21c73ebba..481ba3996 100644 --- a/modules/ca/src/client/comBuf.cpp +++ b/modules/ca/src/client/comBuf.cpp @@ -6,18 +6,18 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* + * * - * * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 - * + * * Copyright, 1986, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov */ #include @@ -32,7 +32,7 @@ bool comBuf::flushToWire ( wireSendAdapter & wire, const epicsTime & currentTime unsigned index = this->nextReadIndex; unsigned finalIndex = this->commitIndex; while ( index < finalIndex ) { - unsigned nBytes = wire.sendBytes ( + unsigned nBytes = wire.sendBytes ( &this->buf[index], finalIndex - index, currentTime ); if ( nBytes == 0u ) { this->nextReadIndex = index; @@ -44,9 +44,9 @@ bool comBuf::flushToWire ( wireSendAdapter & wire, const epicsTime & currentTime return true; } -// throwing the exception from a function that isnt inline +// throwing the exception from a function that isnt inline // shrinks the GNU compiled object code -void comBuf::throwInsufficentBytesException () +void comBuf::throwInsufficentBytesException () { throw comBuf::insufficentBytesAvailable (); } diff --git a/modules/ca/src/client/comBuf.h b/modules/ca/src/client/comBuf.h index 281961c6d..93ba732f2 100644 --- a/modules/ca/src/client/comBuf.h +++ b/modules/ca/src/client/comBuf.h @@ -16,8 +16,8 @@ * Copyright, 1986, The Regents of the University of California. * * - * Author Jeffrey O. Hill - * johill@lanl.gov + * Author Jeffrey O. Hill + * johill@lanl.gov */ #ifndef INC_comBuf_H @@ -39,23 +39,23 @@ static const unsigned comBufSize = 0x4000; class comBufMemoryManager { public: virtual ~comBufMemoryManager (); - virtual void * allocate ( size_t ) = 0; - virtual void release ( void * ) = 0; + virtual void * allocate ( size_t ) = 0; + virtual void release ( void * ) = 0; }; class wireSendAdapter { public: - virtual unsigned sendBytes ( const void * pBuf, - unsigned nBytesInBuf, + virtual unsigned sendBytes ( const void * pBuf, + unsigned nBytesInBuf, const class epicsTime & currentTime ) = 0; protected: virtual ~wireSendAdapter() {} }; -enum swioCircuitState { - swioConnected, - swioPeerHangup, - swioPeerAbort, +enum swioCircuitState { + swioConnected, + swioPeerHangup, + swioPeerAbort, swioLinkFailure, swioLocalAbort }; @@ -66,7 +66,7 @@ struct statusWireIO { class wireRecvAdapter { public: - virtual void recvBytes ( void * pBuf, + virtual void recvBytes ( void * pBuf, unsigned nBytesInBuf, statusWireIO & ) = 0; protected: virtual ~wireRecvAdapter() {} @@ -105,7 +105,7 @@ public: template < class T > popStatus pop ( T & ); static void throwInsufficentBytesException (); - void * operator new ( size_t size, + void * operator new ( size_t size, comBufMemoryManager & ); epicsPlacementDeleteOperator (( void *, comBufMemoryManager & )) private: @@ -118,14 +118,14 @@ private: bool push ( const T * ); // disabled }; -inline void * comBuf::operator new ( size_t size, +inline void * comBuf::operator new ( size_t size, comBufMemoryManager & mgr ) { return mgr.allocate ( size ); } - + #ifdef CXX_PLACEMENT_DELETE -inline void comBuf::operator delete ( void * pCadaver, +inline void comBuf::operator delete ( void * pCadaver, comBufMemoryManager & mgr ) { mgr.release ( pCadaver ); @@ -161,8 +161,8 @@ inline unsigned comBuf :: uncommittedBytes () const inline unsigned comBuf :: push ( comBuf & bufIn ) { - unsigned nBytes = this->copyInBytes ( - & bufIn.buf[ bufIn.nextReadIndex ], + unsigned nBytes = this->copyInBytes ( + & bufIn.buf[ bufIn.nextReadIndex ], bufIn.commitIndex - bufIn.nextReadIndex ); bufIn.nextReadIndex += nBytes; return nBytes; @@ -173,11 +173,11 @@ inline unsigned comBuf :: capacityBytes () return comBufSize; } -inline void comBuf :: fillFromWire ( +inline void comBuf :: fillFromWire ( wireRecvAdapter & wire, statusWireIO & stat ) { - wire.recvBytes ( - & this->buf[this->nextWriteIndex], + wire.recvBytes ( + & this->buf[this->nextWriteIndex], sizeof ( this->buf ) - this->nextWriteIndex, stat ); if ( stat.circuitState == swioConnected ) { this->nextWriteIndex += stat.bytesCopied; diff --git a/modules/ca/src/client/comQueRecv.cpp b/modules/ca/src/client/comQueRecv.cpp index 3628ad181..45cd4301f 100644 --- a/modules/ca/src/client/comQueRecv.cpp +++ b/modules/ca/src/client/comQueRecv.cpp @@ -6,7 +6,7 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* * * * L O S A L A M O S @@ -25,8 +25,8 @@ #include "iocinf.h" #include "virtualCircuit.h" -comQueRecv::comQueRecv ( comBufMemoryManager & comBufMemoryManagerIn ): - comBufMemMgr ( comBufMemoryManagerIn ), nBytesPending ( 0u ) +comQueRecv::comQueRecv ( comBufMemoryManager & comBufMemoryManagerIn ): + comBufMemMgr ( comBufMemoryManagerIn ), nBytesPending ( 0u ) { } @@ -100,7 +100,7 @@ void comQueRecv::popString ( epicsOldString *pStr ) } void comQueRecv::pushLastComBufReceived ( comBuf & bufIn ) - + { bufIn.commitIncomming (); comBuf * pComBuf = this->bufs.last (); @@ -171,7 +171,7 @@ void comQueRecv::removeAndDestroyBuf ( comBuf & buf ) this->comBufMemMgr.release ( & buf ); } -epicsUInt8 comQueRecv::popUInt8 () +epicsUInt8 comQueRecv::popUInt8 () { comBuf * pComBuf = this->bufs.first (); if ( ! pComBuf ) { diff --git a/modules/ca/src/client/comQueRecv.h b/modules/ca/src/client/comQueRecv.h index 96b6b5eac..2807f54e3 100644 --- a/modules/ca/src/client/comQueRecv.h +++ b/modules/ca/src/client/comQueRecv.h @@ -7,19 +7,19 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* + * * - * * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 - * + * * Copyright, 1986, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #ifndef INC_comQueRecv_H @@ -53,8 +53,8 @@ private: epicsUInt16 multiBufferPopUInt16 (); epicsUInt32 multiBufferPopUInt32 (); void removeAndDestroyBuf ( comBuf & ); - comQueRecv ( const comQueRecv & ); - comQueRecv & operator = ( const comQueRecv & ); + comQueRecv ( const comQueRecv & ); + comQueRecv & operator = ( const comQueRecv & ); }; inline unsigned comQueRecv::occupiedBytes () const diff --git a/modules/ca/src/client/comQueSend.cpp b/modules/ca/src/client/comQueSend.cpp index b81411c37..82489c033 100644 --- a/modules/ca/src/client/comQueSend.cpp +++ b/modules/ca/src/client/comQueSend.cpp @@ -7,18 +7,18 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* + * * - * * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 - * + * * Copyright, 1986, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov */ // @@ -34,7 +34,7 @@ // a connection dropped. // 4) Do not allocate too much memory in exception situatons (such as // after a circuit disconnect). -// 5) Avoid allocating more memory than is absolutely necessary to meet +// 5) Avoid allocating more memory than is absolutely necessary to meet // the above requirements. // 6) Message fragments must never be sent to the IOC when there isnt // enough memory to queue part of a message (we also must not force @@ -43,7 +43,7 @@ // protocol stream. // // Implementation: -// 1) When queuing a complete message, first test to see if a flush is +// 1) When queuing a complete message, first test to see if a flush is // required. If it is a receive thread scheduals the flush with the // send thread, and otherwise directly execute the system call. The // send thread must run at a higher priority than the receive thread @@ -51,14 +51,14 @@ // 2) Preallocate space for the entire message prior to copying in the // message so that message fragments are not flushed out just prior // to detecting that memory is unavailable. -// 3) Return a special error constant when the following situations +// 3) Return a special error constant when the following situations // are detected when the user is attempting to queue a request // from within a user callback executed by a receive thread: -// a) A user is queuing more requests that demand a response from a +// a) A user is queuing more requests that demand a response from a // callback than are removed by the response that initiated the // callback, and this situation persists for many callbacks until // all buffering in the system is exausted. -// b) A user is queuing many requests that demand a response from one +// b) A user is queuing many requests that demand a response from one // callback until all buffering in the system is exausted. // c) Some combination of both (a) nad (b). // @@ -71,15 +71,15 @@ #include "db_access.h" // for dbr_short_t etc // nill message alignment pad bytes -const char cacNillBytes [] = -{ +const char cacNillBytes [] = +{ 0, 0, 0, 0, 0, 0, 0, 0 }; -comQueSend::comQueSend ( wireSendAdapter & wireIn, +comQueSend::comQueSend ( wireSendAdapter & wireIn, comBufMemoryManager & comBufMemMgrIn ): - comBufMemMgr ( comBufMemMgrIn ), wire ( wireIn ), + comBufMemMgr ( comBufMemMgrIn ), wire ( wireIn ), nBytesPending ( 0u ) { } @@ -89,7 +89,7 @@ comQueSend::~comQueSend () this->clear (); } -void comQueSend::clear () +void comQueSend::clear () { comBuf *pBuf; @@ -179,32 +179,32 @@ const comQueSend::copyScalarFunc_t comQueSend::dbrCopyScalar [39] = { &comQueSend::copy_dbr_invalid // DBR_CLASS_NAME }; -void comQueSend::copy_dbr_string ( const void *pValue, unsigned nElem ) +void comQueSend::copy_dbr_string ( const void *pValue, unsigned nElem ) { this->push ( static_cast < const char * > ( pValue ), nElem * MAX_STRING_SIZE ); } -void comQueSend::copy_dbr_short ( const void *pValue, unsigned nElem ) +void comQueSend::copy_dbr_short ( const void *pValue, unsigned nElem ) { this->push ( static_cast ( pValue ), nElem ); } -void comQueSend::copy_dbr_float ( const void *pValue, unsigned nElem ) +void comQueSend::copy_dbr_float ( const void *pValue, unsigned nElem ) { this->push ( static_cast ( pValue ), nElem ); } -void comQueSend::copy_dbr_char ( const void *pValue, unsigned nElem ) +void comQueSend::copy_dbr_char ( const void *pValue, unsigned nElem ) { this->push ( static_cast ( pValue ), nElem ); } -void comQueSend::copy_dbr_long ( const void *pValue, unsigned nElem ) +void comQueSend::copy_dbr_long ( const void *pValue, unsigned nElem ) { this->push ( static_cast ( pValue ), nElem ); } -void comQueSend::copy_dbr_double ( const void *pValue, unsigned nElem ) +void comQueSend::copy_dbr_double ( const void *pValue, unsigned nElem ) { this->push ( static_cast ( pValue ), nElem ); } @@ -256,7 +256,7 @@ const comQueSend::copyVectorFunc_t comQueSend::dbrCopyVector [39] = { &comQueSend::copy_dbr_invalid // DBR_CLASS_NAME }; -comBuf * comQueSend::popNextComBufToSend () +comBuf * comQueSend::popNextComBufToSend () { comBuf *pBuf = this->bufs.get (); if ( pBuf ) { @@ -277,9 +277,9 @@ comBuf * comQueSend::popNextComBufToSend () } void comQueSend::insertRequestHeader ( - ca_uint16_t request, ca_uint32_t payloadSize, - ca_uint16_t dataType, ca_uint32_t nElem, ca_uint32_t cid, - ca_uint32_t requestDependent, bool v49Ok ) + ca_uint16_t request, ca_uint32_t payloadSize, + ca_uint16_t dataType, ca_uint32_t nElem, ca_uint32_t cid, + ca_uint32_t requestDependent, bool v49Ok ) { if ( payloadSize < 0xffff && nElem < 0xffff ) { comBuf * pComBuf = this->bufs.last (); @@ -287,12 +287,12 @@ void comQueSend::insertRequestHeader ( pComBuf = newComBuf (); this->pushComBuf ( *pComBuf ); } - pComBuf->push ( request ); - pComBuf->push ( static_cast < ca_uint16_t > ( payloadSize ) ); - pComBuf->push ( dataType ); - pComBuf->push ( static_cast < ca_uint16_t > ( nElem ) ); - pComBuf->push ( cid ); - pComBuf->push ( requestDependent ); + pComBuf->push ( request ); + pComBuf->push ( static_cast < ca_uint16_t > ( payloadSize ) ); + pComBuf->push ( dataType ); + pComBuf->push ( static_cast < ca_uint16_t > ( nElem ) ); + pComBuf->push ( cid ); + pComBuf->push ( requestDependent ); } else if ( v49Ok ) { comBuf * pComBuf = this->bufs.last (); @@ -300,14 +300,14 @@ void comQueSend::insertRequestHeader ( pComBuf = newComBuf (); this->pushComBuf ( *pComBuf ); } - pComBuf->push ( request ); - pComBuf->push ( static_cast < ca_uint16_t > ( 0xffff ) ); - pComBuf->push ( dataType ); - pComBuf->push ( static_cast < ca_uint16_t > ( 0u ) ); - pComBuf->push ( cid ); - pComBuf->push ( requestDependent ); - pComBuf->push ( payloadSize ); - pComBuf->push ( nElem ); + pComBuf->push ( request ); + pComBuf->push ( static_cast < ca_uint16_t > ( 0xffff ) ); + pComBuf->push ( dataType ); + pComBuf->push ( static_cast < ca_uint16_t > ( 0u ) ); + pComBuf->push ( cid ); + pComBuf->push ( requestDependent ); + pComBuf->push ( payloadSize ); + pComBuf->push ( nElem ); } else { throw cacChannel::outOfBounds (); @@ -315,9 +315,9 @@ void comQueSend::insertRequestHeader ( } void comQueSend::insertRequestWithPayLoad ( - ca_uint16_t request, unsigned dataType, arrayElementCount nElem, - ca_uint32_t cid, ca_uint32_t requestDependent, - const void * pPayload, bool v49Ok ) + ca_uint16_t request, unsigned dataType, arrayElementCount nElem, + ca_uint32_t cid, ca_uint32_t requestDependent, + const void * pPayload, bool v49Ok ) { if ( INVALID_DB_REQ ( dataType ) ) { throw cacChannel::badType (); @@ -335,16 +335,16 @@ void comQueSend::insertRequestWithPayLoad ( throw cacChannel::outOfBounds(); } payloadSize = CA_MESSAGE_ALIGN ( size ); - this->insertRequestHeader ( request, payloadSize, - static_cast ( dataType ), + this->insertRequestHeader ( request, payloadSize, + static_cast ( dataType ), nElem, cid, requestDependent, v49Ok ); - this->pushString ( pStr, size ); + this->pushString ( pStr, size ); } else { size = dbr_size[dataType]; payloadSize = CA_MESSAGE_ALIGN ( size ); - this->insertRequestHeader ( request, payloadSize, - static_cast ( dataType ), + this->insertRequestHeader ( request, payloadSize, + static_cast ( dataType ), nElem, cid, requestDependent, v49Ok ); ( this->*dbrCopyScalar [dataType] ) ( pPayload ); } @@ -355,22 +355,22 @@ void comQueSend::insertRequestWithPayLoad ( maxBytes = 0xffffffff; } else { - maxBytes = MAX_TCP - sizeof ( caHdr ); + maxBytes = MAX_TCP - sizeof ( caHdr ); } - arrayElementCount maxElem = - ( maxBytes - sizeof (dbr_double_t) - dbr_size[dataType] ) / + arrayElementCount maxElem = + ( maxBytes - sizeof (dbr_double_t) - dbr_size[dataType] ) / dbr_value_size[dataType]; if ( nElem >= maxElem ) { throw cacChannel::outOfBounds(); } // the above checks verify that the total size // is lest that 0xffffffff - size = static_cast < ca_uint32_t > + size = static_cast < ca_uint32_t > ( dbr_size_n ( dataType, nElem ) ); payloadSize = CA_MESSAGE_ALIGN ( size ); - this->insertRequestHeader ( request, payloadSize, - static_cast ( dataType ), - static_cast < ca_uint32_t > ( nElem ), + this->insertRequestHeader ( request, payloadSize, + static_cast ( dataType ), + static_cast < ca_uint32_t > ( nElem ), cid, requestDependent, v49Ok ); ( this->*dbrCopyVector [dataType] ) ( pPayload, nElem ); } @@ -381,7 +381,7 @@ void comQueSend::insertRequestWithPayLoad ( } } -void comQueSend::commitMsg () +void comQueSend::commitMsg () { while ( this->pFirstUncommited.valid() ) { this->nBytesPending += this->pFirstUncommited->uncommittedBytes (); diff --git a/modules/ca/src/client/comQueSend.h b/modules/ca/src/client/comQueSend.h index 30ef30712..f7b25c3f4 100644 --- a/modules/ca/src/client/comQueSend.h +++ b/modules/ca/src/client/comQueSend.h @@ -8,19 +8,19 @@ \*************************************************************************/ -/* +/* + * * - * * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 - * + * * Copyright, 1986, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #ifndef INC_comQueSend_H @@ -38,7 +38,7 @@ template < class T > class epicsGuard; class comQueSendMsgMinder { public: - comQueSendMsgMinder ( + comQueSendMsgMinder ( class comQueSend &, epicsGuard < epicsMutex > & ); ~comQueSendMsgMinder (); void commit (); @@ -55,20 +55,20 @@ public: comQueSend ( wireSendAdapter &, comBufMemoryManager & ); ~comQueSend (); void clear (); - unsigned occupiedBytes () const; + unsigned occupiedBytes () const; bool flushEarlyThreshold ( unsigned nBytesThisMsg ) const; - bool flushBlockThreshold () const; + bool flushBlockThreshold () const; void pushUInt16 ( const ca_uint16_t value ); void pushUInt32 ( const ca_uint32_t value ); void pushFloat32 ( const ca_float32_t value ); void pushString ( const char *pVal, unsigned nChar ); - void insertRequestHeader ( - ca_uint16_t request, ca_uint32_t payloadSize, - ca_uint16_t dataType, ca_uint32_t nElem, ca_uint32_t cid, + void insertRequestHeader ( + ca_uint16_t request, ca_uint32_t payloadSize, + ca_uint16_t dataType, ca_uint32_t nElem, ca_uint32_t cid, ca_uint32_t requestDependent, bool v49Ok ); void insertRequestWithPayLoad ( - ca_uint16_t request, unsigned dataType, arrayElementCount nElem, - ca_uint32_t cid, ca_uint32_t requestDependent, + ca_uint16_t request, unsigned dataType, arrayElementCount nElem, + ca_uint32_t cid, ca_uint32_t requestDependent, const void * pPayload, bool v49Ok ); comBuf * popNextComBufToSend (); private: @@ -78,43 +78,43 @@ private: wireSendAdapter & wire; unsigned nBytesPending; - typedef void ( comQueSend::*copyScalarFunc_t ) ( + typedef void ( comQueSend::*copyScalarFunc_t ) ( const void * pValue ); static const copyScalarFunc_t dbrCopyScalar [comQueSendCopyDispatchSize]; void copy_dbr_string ( const void * pValue ); - void copy_dbr_short ( const void * pValue ); - void copy_dbr_float ( const void * pValue ); - void copy_dbr_char ( const void * pValue ); - void copy_dbr_long ( const void * pValue ); - void copy_dbr_double ( const void * pValue ); + void copy_dbr_short ( const void * pValue ); + void copy_dbr_float ( const void * pValue ); + void copy_dbr_char ( const void * pValue ); + void copy_dbr_long ( const void * pValue ); + void copy_dbr_double ( const void * pValue ); void copy_dbr_invalid ( const void * pValue ); - typedef void ( comQueSend::*copyVectorFunc_t ) ( + typedef void ( comQueSend::*copyVectorFunc_t ) ( const void * pValue, unsigned nElem ); static const copyVectorFunc_t dbrCopyVector [comQueSendCopyDispatchSize]; void copy_dbr_string ( const void *pValue, unsigned nElem ); - void copy_dbr_short ( const void *pValue, unsigned nElem ); - void copy_dbr_float ( const void *pValue, unsigned nElem ); - void copy_dbr_char ( const void *pValue, unsigned nElem ); - void copy_dbr_long ( const void *pValue, unsigned nElem ); - void copy_dbr_double ( const void *pValue, unsigned nElem ); + void copy_dbr_short ( const void *pValue, unsigned nElem ); + void copy_dbr_float ( const void *pValue, unsigned nElem ); + void copy_dbr_char ( const void *pValue, unsigned nElem ); + void copy_dbr_long ( const void *pValue, unsigned nElem ); + void copy_dbr_double ( const void *pValue, unsigned nElem ); void copy_dbr_invalid ( const void * pValue, unsigned nElem ); - void pushComBuf ( comBuf & ); - comBuf * newComBuf (); + void pushComBuf ( comBuf & ); + comBuf * newComBuf (); - void beginMsg (); - void commitMsg (); + void beginMsg (); + void commitMsg (); void clearUncommitedMsg (); friend class comQueSendMsgMinder; // - // visual C++ versions 6 & 7 do not allow out of + // visual C++ versions 6 & 7 do not allow out of // class member template function definition // template < class T > - inline void push ( const T *pVal, const unsigned nElem ) + inline void push ( const T *pVal, const unsigned nElem ) { comBuf * pLastBuf = this->bufs.last (); unsigned nCopied; @@ -126,18 +126,18 @@ private: } while ( nElem > nCopied ) { comBuf * pComBuf = newComBuf (); - nCopied += pComBuf->push + nCopied += pComBuf->push ( &pVal[nCopied], nElem - nCopied ); this->pushComBuf ( *pComBuf ); } } // - // visual C++ versions 6 and 7 do not allow out of + // visual C++ versions 6 and 7 do not allow out of // class member template function definition // template < class T > - inline void push ( const T & val ) + inline void push ( const T & val ) { comBuf * pComBuf = this->bufs.last (); if ( pComBuf && pComBuf->push ( val ) ) { @@ -158,8 +158,8 @@ private: extern const char cacNillBytes[]; -inline comQueSendMsgMinder::comQueSendMsgMinder ( - class comQueSend & sendQueIn, epicsGuard < epicsMutex > & ) : +inline comQueSendMsgMinder::comQueSendMsgMinder ( + class comQueSend & sendQueIn, epicsGuard < epicsMutex > & ) : pSendQue ( & sendQueIn ) { sendQueIn.beginMsg (); @@ -180,32 +180,32 @@ inline void comQueSendMsgMinder::commit () } } -inline void comQueSend::beginMsg () +inline void comQueSend::beginMsg () { this->pFirstUncommited = this->bufs.lastIter (); } -inline void comQueSend::pushUInt16 ( const ca_uint16_t value ) +inline void comQueSend::pushUInt16 ( const ca_uint16_t value ) { this->push ( value ); } -inline void comQueSend::pushUInt32 ( const ca_uint32_t value ) +inline void comQueSend::pushUInt32 ( const ca_uint32_t value ) { this->push ( value ); } -inline void comQueSend::pushFloat32 ( const ca_float32_t value ) +inline void comQueSend::pushFloat32 ( const ca_float32_t value ) { this->push ( value ); } -inline void comQueSend::pushString ( const char *pVal, unsigned nChar ) +inline void comQueSend::pushString ( const char *pVal, unsigned nChar ) { this->push ( pVal, nChar ); } -inline void comQueSend::pushComBuf ( comBuf & cb ) +inline void comQueSend::pushComBuf ( comBuf & cb ) { this->bufs.add ( cb ); if ( ! this->pFirstUncommited.valid() ) { @@ -213,7 +213,7 @@ inline void comQueSend::pushComBuf ( comBuf & cb ) } } -inline unsigned comQueSend::occupiedBytes () const +inline unsigned comQueSend::occupiedBytes () const { return this->nBytesPending; } diff --git a/modules/ca/src/client/convert.cpp b/modules/ca/src/client/convert.cpp index e70e6be9e..3d423142a 100644 --- a/modules/ca/src/client/convert.cpp +++ b/modules/ca/src/client/convert.cpp @@ -12,11 +12,11 @@ * Author: D. Kersteins * * - * NOTES: + * NOTES: * * 1) All routines in this file have an encode argument which * determines if we are converting from the standard format to - * the local format or vise versa. To date only float and double data + * the local format or vise versa. To date only float and double data * types must be converted differently depending on the encode * argument - joh * @@ -44,38 +44,38 @@ * * net format: big endian and IEEE float */ -typedef void ( * CACVRTFUNCPTR ) ( +typedef void ( * CACVRTFUNCPTR ) ( const void *pSrc, void *pDest, int hton, arrayElementCount count ); -inline void dbr_htond ( +inline void dbr_htond ( const dbr_double_t * pHost, dbr_double_t * pNet ) { AlignedWireRef < epicsFloat64 > tmp ( *pNet ); tmp = *pHost; } -inline void dbr_ntohd ( +inline void dbr_ntohd ( const dbr_double_t * pNet, dbr_double_t * pHost ) { *pHost = AlignedWireRef < const epicsFloat64 > ( *pNet ); } -inline void dbr_htonf ( +inline void dbr_htonf ( const dbr_float_t * pHost, dbr_float_t * pNet ) { AlignedWireRef < epicsFloat32 > tmp ( *pNet ); tmp = *pHost; } -inline void dbr_ntohf ( +inline void dbr_ntohf ( const dbr_float_t * pNet, dbr_float_t * pHost ) { *pHost = AlignedWireRef < const epicsFloat32 > ( *pNet ); } -inline epicsUInt16 dbr_ntohs( const epicsUInt16 & net ) +inline epicsUInt16 dbr_ntohs( const epicsUInt16 & net ) { return AlignedWireRef < const epicsUInt16 > ( net ); } -inline epicsUInt16 dbr_htons ( const epicsUInt16 & host ) +inline epicsUInt16 dbr_htons ( const epicsUInt16 & host ) { epicsUInt16 tmp; AlignedWireRef < epicsUInt16 > awr ( tmp ); @@ -101,7 +101,7 @@ inline epicsUInt32 dbr_htonl ( const epicsUInt32 & host ) * otherwise vise-versa * * net format: big endian and IEEE float - * + * */ /* @@ -120,7 +120,7 @@ arrayElementCount num /* number of values */ /* convert "in place" -> nothing to do */ if (s == d) return; - memcpy ( pDest, pSrc, num*MAX_STRING_SIZE ); + memcpy ( pDest, pSrc, num*MAX_STRING_SIZE ); } /* @@ -232,7 +232,7 @@ arrayElementCount num /* number of values */ * * * NOTES: - * placing encode outside the loop results in more + * placing encode outside the loop results in more * code but better performance. * */ @@ -289,10 +289,10 @@ arrayElementCount num /* number of values */ ** struct dbr_sts_string *d pointer to destination struct ** int encode; boolean, if true vax to ieee ** else ieee to vax -** +** ** converts fields of struct in HOST format to NET format -** or -** converts fields of struct in NET format to fields with HOST +** or +** converts fields of struct in NET format to fields with HOST ** format; ****************************************************************************/ @@ -305,7 +305,7 @@ arrayElementCount num /* number of values */ { struct dbr_sts_string *pSrc = (struct dbr_sts_string *) s; struct dbr_sts_string *pDest = (struct dbr_sts_string *) d; - + /* convert ieee to vax format or vax to ieee */ pDest->status = dbr_ntohs(pSrc->status); pDest->severity = dbr_ntohs(pSrc->severity); @@ -326,8 +326,8 @@ arrayElementCount num /* number of values */ ** else ieee to vax ** ** converts fields ofstruct in HOST format to ieee format -** or -** converts fields of struct in NET format to fields with HOST +** or +** converts fields of struct in NET format to fields with HOST ** format ****************************************************************************/ @@ -359,10 +359,10 @@ arrayElementCount num /* number of values */ ** int encode; boolean, if true vax to ieee ** else ieee to vax ** -** if encode +** if encode ** converts struct in HOST format to ieee format -** else -** converts fields of struct in NET format to fields with HOST +** else +** converts fields of struct in NET format to fields with HOST ** format; ****************************************************************************/ @@ -385,10 +385,10 @@ arrayElementCount num /* number of values */ /**************************************************************************** ** cvrt_sts_double(s,d) ** -** if encode +** if encode ** converts struct in HOST format to ieee format -** else -** converts fields of struct in NET format to fields with HOST +** else +** converts fields of struct in NET format to fields with HOST ** format; ****************************************************************************/ @@ -416,9 +416,9 @@ arrayElementCount num /* number of values */ ** else ieee to vax ** ** converts fields of struct in NET format to fields with HOST format -** or +** or ** converts fields of struct in HOST format to fields with NET format -** +** ****************************************************************************/ static void cvrt_sts_enum( @@ -444,9 +444,9 @@ arrayElementCount num /* number of values */ ** cvrt_gr_short() ** ** converts fields of struct in NET format to fields with HOST format -** or +** or ** converts fields of struct in HOST format to fields with NET format -** +** ****************************************************************************/ static void cvrt_gr_short( @@ -483,9 +483,9 @@ arrayElementCount num /* number of values */ ** cvrt_gr_char() ** ** converts fields of struct in NET format to fields with HOST format -** or +** or ** converts fields of struct in HOST format to fields with NET format -** +** ****************************************************************************/ static void cvrt_gr_char( @@ -524,9 +524,9 @@ arrayElementCount num /* number of values */ ** cvrt_gr_long() ** ** converts fields of struct in NET format to fields with HOST format -** or +** or ** converts fields of struct in HOST format to fields with NET format -** +** ****************************************************************************/ static void cvrt_gr_long( @@ -562,10 +562,10 @@ arrayElementCount num /* number of values */ /**************************************************************************** ** cvrt_gr_enum(s,d) ** -** if encode +** if encode ** converts struct in HOST format to ieee format -** else -** converts fields of struct in NET format to fields with HOST +** else +** converts fields of struct in NET format to fields with HOST ** format; ****************************************************************************/ @@ -597,10 +597,10 @@ arrayElementCount num /* number of values */ /**************************************************************************** ** cvrt_gr_double(s,d) ** -** if encode +** if encode ** converts struct in HOST format to ieee format -** else -** converts fields of struct in NET format to fields with HOST +** else +** converts fields of struct in NET format to fields with HOST ** format; ****************************************************************************/ @@ -661,10 +661,10 @@ arrayElementCount num /* number of values */ ** int encode; boolean, if true vax to ieee ** else ieee to vax ** -** if encode +** if encode ** converts struct in HOST format to ieee format -** else -** converts fields of struct in NET format to fields with HOST +** else +** converts fields of struct in NET format to fields with HOST ** format; ****************************************************************************/ @@ -728,9 +728,9 @@ arrayElementCount num /* number of values */ ** else ieee to vax ** ** converts fields of struct in NET format to fields with HOST format -** or +** or ** converts fields of struct in HOST format to fields with NET format -** +** ****************************************************************************/ static void cvrt_ctrl_short( @@ -770,9 +770,9 @@ arrayElementCount num /* number of values */ ** cvrt_ctrl_long(s,d) ** ** converts fields of struct in NET format to fields with HOST format -** or +** or ** converts fields of struct in HOST format to fields with NET format -** +** ****************************************************************************/ static void cvrt_ctrl_long( @@ -812,9 +812,9 @@ arrayElementCount num /* number of values */ ** cvrt_ctrl_short(s,d) ** ** converts fields of struct in NET format to fields with HOST format -** or +** or ** converts fields of struct in HOST format to fields with NET format -** +** ****************************************************************************/ static void cvrt_ctrl_char( @@ -831,7 +831,7 @@ arrayElementCount num /* number of values */ pDest->status = dbr_ntohs(pSrc->status); pDest->severity = dbr_ntohs(pSrc->severity); - if ( s == d ) + if ( s == d ) return; pDest->upper_disp_limit = pSrc->upper_disp_limit; @@ -851,10 +851,10 @@ arrayElementCount num /* number of values */ /**************************************************************************** ** cvrt_ctrl_double(s,d) ** -** if encode +** if encode ** converts struct in HOST format to ieee format -** else -** converts fields of struct in NET format to fields with HOST +** else +** converts fields of struct in NET format to fields with HOST ** format; ****************************************************************************/ @@ -917,10 +917,10 @@ arrayElementCount num /* number of values */ /**************************************************************************** ** cvrt_ctrl_float(s,d) ** -** if encode +** if encode ** converts struct in HOST format to ieee format -** else -** converts fields of struct in NET format to fields with HOST +** else +** converts fields of struct in NET format to fields with HOST ** format; ****************************************************************************/ @@ -982,10 +982,10 @@ arrayElementCount num /* number of values */ /**************************************************************************** ** cvrt_ctrl_enum(s,d) ** -** if encode +** if encode ** converts struct in HOST format to ieee format -** else -** converts fields of struct in NET format to fields with HOST +** else +** converts fields of struct in NET format to fields with HOST ** format; ****************************************************************************/ @@ -1001,7 +1001,7 @@ arrayElementCount num /* number of values */ pDest->status = dbr_ntohs(pSrc->status); pDest->severity = dbr_ntohs(pSrc->severity); - pDest->no_str = dbr_ntohs(pSrc->no_str); + pDest->no_str = dbr_ntohs(pSrc->no_str); if ( s != d ) { memcpy((void *)pDest->strs,(void *)pSrc->strs,sizeof(pSrc->strs)); } @@ -1022,8 +1022,8 @@ arrayElementCount num /* number of values */ ** else ieee to vax ** ** converts fields ofstruct in HOST format to ieee format -** or -** converts fields of struct in NET format to fields with HOST +** or +** converts fields of struct in NET format to fields with HOST ** format ****************************************************************************/ @@ -1041,7 +1041,7 @@ arrayElementCount num /* number of values */ pDest->status = dbr_ntohs(pSrc->status); pDest->severity = dbr_ntohs(pSrc->severity); - if ( s == d ) + if ( s == d ) return; if (num == 1) /* single value */ @@ -1056,8 +1056,8 @@ arrayElementCount num /* number of values */ ** cvrt_sts_long(s,d) ** ** converts fields ofstruct in HOST format to ieee format -** or -** converts fields of struct in NET format to fields with HOST +** or +** converts fields of struct in NET format to fields with HOST ** format ****************************************************************************/ @@ -1086,10 +1086,10 @@ arrayElementCount num /* number of values */ /**************************************************************************** ** cvrt_time_string(s,d) -** +** ** converts fields of struct in HOST format to NET format -** or -** converts fields of struct in NET format to fields with HOST +** or +** converts fields of struct in NET format to fields with HOST ** format; ****************************************************************************/ @@ -1102,7 +1102,7 @@ arrayElementCount num /* number of values */ { struct dbr_time_string *pSrc = (struct dbr_time_string *) s; struct dbr_time_string *pDest = (struct dbr_time_string *) d; - + /* convert ieee to vax format or vax to ieee */ pDest->status = dbr_ntohs(pSrc->status); pDest->severity = dbr_ntohs(pSrc->severity); @@ -1118,8 +1118,8 @@ arrayElementCount num /* number of values */ ** cvrt_time_short(s,d) ** ** converts fields ofstruct in HOST format to ieee format -** or -** converts fields of struct in NET format to fields with HOST +** or +** converts fields of struct in NET format to fields with HOST ** format ****************************************************************************/ @@ -1150,10 +1150,10 @@ arrayElementCount num /* number of values */ /**************************************************************************** ** cvrt_time_float(s,d) ** -** if encode +** if encode ** converts struct in HOST format to ieee format -** else -** converts fields of struct in NET format to fields with HOST +** else +** converts fields of struct in NET format to fields with HOST ** format; ****************************************************************************/ @@ -1178,10 +1178,10 @@ arrayElementCount num /* number of values */ /**************************************************************************** ** cvrt_time_double(s,d) ** -** if encode +** if encode ** converts struct in HOST format to ieee format -** else -** converts fields of struct in NET format to fields with HOST +** else +** converts fields of struct in NET format to fields with HOST ** format; ****************************************************************************/ @@ -1209,9 +1209,9 @@ arrayElementCount num /* number of values */ ** cvrt_time_enum(s,d) ** ** converts fields of struct in NET format to fields with HOST format -** or +** or ** converts fields of struct in HOST format to fields with NET format -** +** ****************************************************************************/ static void cvrt_time_enum( @@ -1239,8 +1239,8 @@ arrayElementCount num /* number of values */ ** cvrt_sts_char(s,d) ** ** converts fields ofstruct in HOST format to ieee format -** or -** converts fields of struct in NET format to fields with HOST +** or +** converts fields of struct in NET format to fields with HOST ** format ****************************************************************************/ @@ -1260,7 +1260,7 @@ arrayElementCount num /* number of values */ pDest->stamp.secPastEpoch = dbr_ntohl(pSrc->stamp.secPastEpoch); pDest->stamp.nsec = dbr_ntohl(pSrc->stamp.nsec); - if ( s == d ) + if ( s == d ) return; if (num == 1) /* single value */ @@ -1274,8 +1274,8 @@ arrayElementCount num /* number of values */ ** cvrt_time_long(s,d) ** ** converts fields ofstruct in HOST format to ieee format -** or -** converts fields of struct in NET format to fields with HOST +** or +** converts fields of struct in NET format to fields with HOST ** format ****************************************************************************/ @@ -1324,7 +1324,7 @@ arrayElementCount num /* number of values */ for(i=0; istatus = dbr_ntohs(pSrc->status); pDest->severity = dbr_ntohs(pSrc->severity); @@ -1409,7 +1409,7 @@ static CACVRTFUNCPTR cac_dbr_cvrt[] = { cvrt_ctrl_long, cvrt_ctrl_double, - cvrt_put_ackt, + cvrt_put_ackt, cvrt_put_ackt, /* DBR_PUT_ACKS identical to DBR_PUT_ACKT */ cvrt_stsack_string, cvrt_string @@ -1417,18 +1417,18 @@ static CACVRTFUNCPTR cac_dbr_cvrt[] = { #endif /* EPICS_CONVERSION_REQUIRED */ -int caNetConvert ( unsigned type, const void *pSrc, void *pDest, +int caNetConvert ( unsigned type, const void *pSrc, void *pDest, int hton, arrayElementCount count ) { # ifdef EPICS_CONVERSION_REQUIRED if ( type >= NELEMENTS ( cac_dbr_cvrt ) ) { return ECA_BADTYPE; - } + } ( * cac_dbr_cvrt [ type ] ) ( pSrc, pDest, hton, count ); # else if ( INVALID_DB_REQ ( type ) ) { return ECA_BADTYPE; - } + } if ( pSrc != pDest ) { memcpy ( pDest, pSrc, dbr_size_n ( type, count ) ); } diff --git a/modules/ca/src/client/db_access.h b/modules/ca/src/client/db_access.h index b82ae4243..810f82ff7 100644 --- a/modules/ca/src/client/db_access.h +++ b/modules/ca/src/client/db_access.h @@ -26,9 +26,9 @@ extern "C" { #endif -#define MAX_UNITS_SIZE 8 -#define MAX_ENUM_STRING_SIZE 26 -#define MAX_ENUM_STATES 16 +#define MAX_UNITS_SIZE 8 +#define MAX_ENUM_STRING_SIZE 26 +#define MAX_ENUM_STATES 16 /* * architecture independent types @@ -38,81 +38,81 @@ extern "C" { typedef epicsOldString dbr_string_t; typedef epicsUInt8 dbr_char_t; typedef epicsInt16 dbr_short_t; -typedef epicsUInt16 dbr_ushort_t; +typedef epicsUInt16 dbr_ushort_t; typedef epicsInt16 dbr_int_t; typedef epicsUInt16 dbr_enum_t; typedef epicsInt32 dbr_long_t; typedef epicsUInt32 dbr_ulong_t; typedef epicsFloat32 dbr_float_t; typedef epicsFloat64 dbr_double_t; -typedef epicsUInt16 dbr_put_ackt_t; -typedef epicsUInt16 dbr_put_acks_t; +typedef epicsUInt16 dbr_put_ackt_t; +typedef epicsUInt16 dbr_put_acks_t; typedef epicsOldString dbr_stsack_string_t; typedef epicsOldString dbr_class_name_t; #ifndef db_accessHFORdb_accessC /* database field types */ -#define DBF_STRING 0 -#define DBF_INT 1 -#define DBF_SHORT 1 -#define DBF_FLOAT 2 -#define DBF_ENUM 3 -#define DBF_CHAR 4 -#define DBF_LONG 5 -#define DBF_DOUBLE 6 -#define DBF_NO_ACCESS 7 -#define LAST_TYPE DBF_DOUBLE -#define VALID_DB_FIELD(x) ((x >= 0) && (x <= LAST_TYPE)) -#define INVALID_DB_FIELD(x) ((x < 0) || (x > LAST_TYPE)) +#define DBF_STRING 0 +#define DBF_INT 1 +#define DBF_SHORT 1 +#define DBF_FLOAT 2 +#define DBF_ENUM 3 +#define DBF_CHAR 4 +#define DBF_LONG 5 +#define DBF_DOUBLE 6 +#define DBF_NO_ACCESS 7 +#define LAST_TYPE DBF_DOUBLE +#define VALID_DB_FIELD(x) ((x >= 0) && (x <= LAST_TYPE)) +#define INVALID_DB_FIELD(x) ((x < 0) || (x > LAST_TYPE)) /* data request buffer types */ -#define DBR_STRING DBF_STRING -#define DBR_INT DBF_INT -#define DBR_SHORT DBF_INT -#define DBR_FLOAT DBF_FLOAT -#define DBR_ENUM DBF_ENUM -#define DBR_CHAR DBF_CHAR -#define DBR_LONG DBF_LONG -#define DBR_DOUBLE DBF_DOUBLE -#define DBR_STS_STRING 7 -#define DBR_STS_SHORT 8 -#define DBR_STS_INT DBR_STS_SHORT -#define DBR_STS_FLOAT 9 -#define DBR_STS_ENUM 10 -#define DBR_STS_CHAR 11 -#define DBR_STS_LONG 12 -#define DBR_STS_DOUBLE 13 -#define DBR_TIME_STRING 14 -#define DBR_TIME_INT 15 -#define DBR_TIME_SHORT 15 -#define DBR_TIME_FLOAT 16 -#define DBR_TIME_ENUM 17 -#define DBR_TIME_CHAR 18 -#define DBR_TIME_LONG 19 -#define DBR_TIME_DOUBLE 20 -#define DBR_GR_STRING 21 -#define DBR_GR_SHORT 22 -#define DBR_GR_INT DBR_GR_SHORT -#define DBR_GR_FLOAT 23 -#define DBR_GR_ENUM 24 -#define DBR_GR_CHAR 25 -#define DBR_GR_LONG 26 -#define DBR_GR_DOUBLE 27 -#define DBR_CTRL_STRING 28 -#define DBR_CTRL_SHORT 29 -#define DBR_CTRL_INT DBR_CTRL_SHORT -#define DBR_CTRL_FLOAT 30 -#define DBR_CTRL_ENUM 31 -#define DBR_CTRL_CHAR 32 -#define DBR_CTRL_LONG 33 -#define DBR_CTRL_DOUBLE 34 -#define DBR_PUT_ACKT DBR_CTRL_DOUBLE + 1 +#define DBR_STRING DBF_STRING +#define DBR_INT DBF_INT +#define DBR_SHORT DBF_INT +#define DBR_FLOAT DBF_FLOAT +#define DBR_ENUM DBF_ENUM +#define DBR_CHAR DBF_CHAR +#define DBR_LONG DBF_LONG +#define DBR_DOUBLE DBF_DOUBLE +#define DBR_STS_STRING 7 +#define DBR_STS_SHORT 8 +#define DBR_STS_INT DBR_STS_SHORT +#define DBR_STS_FLOAT 9 +#define DBR_STS_ENUM 10 +#define DBR_STS_CHAR 11 +#define DBR_STS_LONG 12 +#define DBR_STS_DOUBLE 13 +#define DBR_TIME_STRING 14 +#define DBR_TIME_INT 15 +#define DBR_TIME_SHORT 15 +#define DBR_TIME_FLOAT 16 +#define DBR_TIME_ENUM 17 +#define DBR_TIME_CHAR 18 +#define DBR_TIME_LONG 19 +#define DBR_TIME_DOUBLE 20 +#define DBR_GR_STRING 21 +#define DBR_GR_SHORT 22 +#define DBR_GR_INT DBR_GR_SHORT +#define DBR_GR_FLOAT 23 +#define DBR_GR_ENUM 24 +#define DBR_GR_CHAR 25 +#define DBR_GR_LONG 26 +#define DBR_GR_DOUBLE 27 +#define DBR_CTRL_STRING 28 +#define DBR_CTRL_SHORT 29 +#define DBR_CTRL_INT DBR_CTRL_SHORT +#define DBR_CTRL_FLOAT 30 +#define DBR_CTRL_ENUM 31 +#define DBR_CTRL_CHAR 32 +#define DBR_CTRL_LONG 33 +#define DBR_CTRL_DOUBLE 34 +#define DBR_PUT_ACKT DBR_CTRL_DOUBLE + 1 #define DBR_PUT_ACKS DBR_PUT_ACKT + 1 #define DBR_STSACK_STRING DBR_PUT_ACKS + 1 #define DBR_CLASS_NAME DBR_STSACK_STRING + 1 -#define LAST_BUFFER_TYPE DBR_CLASS_NAME -#define VALID_DB_REQ(x) ((x >= 0) && (x <= LAST_BUFFER_TYPE)) -#define INVALID_DB_REQ(x) ((x < 0) || (x > LAST_BUFFER_TYPE)) +#define LAST_BUFFER_TYPE DBR_CLASS_NAME +#define VALID_DB_REQ(x) ((x >= 0) && (x <= LAST_BUFFER_TYPE)) +#define INVALID_DB_REQ(x) ((x < 0) || (x > LAST_BUFFER_TYPE)) /* * The enumeration "epicsType" is an index to this array @@ -127,46 +127,46 @@ LIBCA_API extern const int epicsTypeToDBR_XXXX [lastEpicsType+1]; LIBCA_API extern const epicsType DBR_XXXXToEpicsType [LAST_BUFFER_TYPE+1]; /* values returned for each field type - * DBR_STRING returns a NULL terminated string - * DBR_SHORT returns an unsigned short - * DBR_INT returns an unsigned short - * DBR_FLOAT returns an IEEE floating point value - * DBR_ENUM returns an unsigned short which is the enum item - * DBR_CHAR returns an unsigned char - * DBR_LONG returns an unsigned long - * DBR_DOUBLE returns a double precision floating point number - * DBR_STS_STRING returns a string status structure (dbr_sts_string) - * DBR_STS_SHORT returns a short status structure (dbr_sts_short) - * DBR_STS_INT returns a short status structure (dbr_sts_int) - * DBR_STS_FLOAT returns a float status structure (dbr_sts_float) - * DBR_STS_ENUM returns an enum status structure (dbr_sts_enum) - * DBR_STS_CHAR returns a char status structure (dbr_sts_char) - * DBR_STS_LONG returns a long status structure (dbr_sts_long) - * DBR_STS_DOUBLE returns a double status structure (dbr_sts_double) - * DBR_TIME_STRING returns a string time structure (dbr_time_string) - * DBR_TIME_SHORT returns a short time structure (dbr_time_short) - * DBR_TIME_INT returns a short time structure (dbr_time_short) - * DBR_TIME_FLOAT returns a float time structure (dbr_time_float) - * DBR_TIME_ENUM returns an enum time structure (dbr_time_enum) - * DBR_TIME_CHAR returns a char time structure (dbr_time_char) - * DBR_TIME_LONG returns a long time structure (dbr_time_long) - * DBR_TIME_DOUBLE returns a double time structure (dbr_time_double) - * DBR_GR_STRING returns a graphic string structure (dbr_gr_string) - * DBR_GR_SHORT returns a graphic short structure (dbr_gr_short) - * DBR_GR_INT returns a graphic short structure (dbr_gr_int) - * DBR_GR_FLOAT returns a graphic float structure (dbr_gr_float) - * DBR_GR_ENUM returns a graphic enum structure (dbr_gr_enum) - * DBR_GR_CHAR returns a graphic char structure (dbr_gr_char) - * DBR_GR_LONG returns a graphic long structure (dbr_gr_long) - * DBR_GR_DOUBLE returns a graphic double structure (dbr_gr_double) - * DBR_CTRL_STRING returns a control string structure (dbr_ctrl_int) - * DBR_CTRL_SHORT returns a control short structure (dbr_ctrl_short) - * DBR_CTRL_INT returns a control short structure (dbr_ctrl_int) - * DBR_CTRL_FLOAT returns a control float structure (dbr_ctrl_float) - * DBR_CTRL_ENUM returns a control enum structure (dbr_ctrl_enum) - * DBR_CTRL_CHAR returns a control char structure (dbr_ctrl_char) - * DBR_CTRL_LONG returns a control long structure (dbr_ctrl_long) - * DBR_CTRL_DOUBLE returns a control double structure (dbr_ctrl_double) + * DBR_STRING returns a NULL terminated string + * DBR_SHORT returns an unsigned short + * DBR_INT returns an unsigned short + * DBR_FLOAT returns an IEEE floating point value + * DBR_ENUM returns an unsigned short which is the enum item + * DBR_CHAR returns an unsigned char + * DBR_LONG returns an unsigned long + * DBR_DOUBLE returns a double precision floating point number + * DBR_STS_STRING returns a string status structure (dbr_sts_string) + * DBR_STS_SHORT returns a short status structure (dbr_sts_short) + * DBR_STS_INT returns a short status structure (dbr_sts_int) + * DBR_STS_FLOAT returns a float status structure (dbr_sts_float) + * DBR_STS_ENUM returns an enum status structure (dbr_sts_enum) + * DBR_STS_CHAR returns a char status structure (dbr_sts_char) + * DBR_STS_LONG returns a long status structure (dbr_sts_long) + * DBR_STS_DOUBLE returns a double status structure (dbr_sts_double) + * DBR_TIME_STRING returns a string time structure (dbr_time_string) + * DBR_TIME_SHORT returns a short time structure (dbr_time_short) + * DBR_TIME_INT returns a short time structure (dbr_time_short) + * DBR_TIME_FLOAT returns a float time structure (dbr_time_float) + * DBR_TIME_ENUM returns an enum time structure (dbr_time_enum) + * DBR_TIME_CHAR returns a char time structure (dbr_time_char) + * DBR_TIME_LONG returns a long time structure (dbr_time_long) + * DBR_TIME_DOUBLE returns a double time structure (dbr_time_double) + * DBR_GR_STRING returns a graphic string structure (dbr_gr_string) + * DBR_GR_SHORT returns a graphic short structure (dbr_gr_short) + * DBR_GR_INT returns a graphic short structure (dbr_gr_int) + * DBR_GR_FLOAT returns a graphic float structure (dbr_gr_float) + * DBR_GR_ENUM returns a graphic enum structure (dbr_gr_enum) + * DBR_GR_CHAR returns a graphic char structure (dbr_gr_char) + * DBR_GR_LONG returns a graphic long structure (dbr_gr_long) + * DBR_GR_DOUBLE returns a graphic double structure (dbr_gr_double) + * DBR_CTRL_STRING returns a control string structure (dbr_ctrl_int) + * DBR_CTRL_SHORT returns a control short structure (dbr_ctrl_short) + * DBR_CTRL_INT returns a control short structure (dbr_ctrl_int) + * DBR_CTRL_FLOAT returns a control float structure (dbr_ctrl_float) + * DBR_CTRL_ENUM returns a control enum structure (dbr_ctrl_enum) + * DBR_CTRL_CHAR returns a control char structure (dbr_ctrl_char) + * DBR_CTRL_LONG returns a control long structure (dbr_ctrl_long) + * DBR_CTRL_DOUBLE returns a control double structure (dbr_ctrl_double) */ #endif /*db_accessHFORdb_accessC*/ @@ -174,345 +174,345 @@ LIBCA_API extern const epicsType DBR_XXXXToEpicsType [LAST_BUFFER_TYPE+1]; /* structure for a string status field */ struct dbr_sts_string { - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - dbr_string_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + dbr_string_t value; /* current value */ }; /* structure for a string status and ack field */ struct dbr_stsack_string{ - dbr_ushort_t status; /* status of value */ - dbr_ushort_t severity; /* severity of alarm */ - dbr_ushort_t ackt; /* ack transient? */ - dbr_ushort_t acks; /* ack severity */ - dbr_string_t value; /* current value */ + dbr_ushort_t status; /* status of value */ + dbr_ushort_t severity; /* severity of alarm */ + dbr_ushort_t ackt; /* ack transient? */ + dbr_ushort_t acks; /* ack severity */ + dbr_string_t value; /* current value */ }; /* structure for an short status field */ struct dbr_sts_int{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - dbr_short_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + dbr_short_t value; /* current value */ }; struct dbr_sts_short{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - dbr_short_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + dbr_short_t value; /* current value */ }; /* structure for a float status field */ struct dbr_sts_float{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - dbr_float_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + dbr_float_t value; /* current value */ }; /* structure for a enum status field */ struct dbr_sts_enum{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - dbr_enum_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + dbr_enum_t value; /* current value */ }; /* structure for a char status field */ struct dbr_sts_char{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - dbr_char_t RISC_pad; /* RISC alignment */ - dbr_char_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + dbr_char_t RISC_pad; /* RISC alignment */ + dbr_char_t value; /* current value */ }; /* structure for a long status field */ struct dbr_sts_long{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - dbr_long_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + dbr_long_t value; /* current value */ }; /* structure for a double status field */ struct dbr_sts_double{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - dbr_long_t RISC_pad; /* RISC alignment */ - dbr_double_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + dbr_long_t RISC_pad; /* RISC alignment */ + dbr_double_t value; /* current value */ }; /* VALUES WITH STATUS AND TIME STRUCTURES */ /* structure for a string time field */ struct dbr_time_string{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - epicsTimeStamp stamp; /* time stamp */ - dbr_string_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + epicsTimeStamp stamp; /* time stamp */ + dbr_string_t value; /* current value */ }; /* structure for an short time field */ struct dbr_time_short{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - epicsTimeStamp stamp; /* time stamp */ - dbr_short_t RISC_pad; /* RISC alignment */ - dbr_short_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + epicsTimeStamp stamp; /* time stamp */ + dbr_short_t RISC_pad; /* RISC alignment */ + dbr_short_t value; /* current value */ }; /* structure for a float time field */ struct dbr_time_float{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - epicsTimeStamp stamp; /* time stamp */ - dbr_float_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + epicsTimeStamp stamp; /* time stamp */ + dbr_float_t value; /* current value */ }; /* structure for a enum time field */ struct dbr_time_enum{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - epicsTimeStamp stamp; /* time stamp */ - dbr_short_t RISC_pad; /* RISC alignment */ - dbr_enum_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + epicsTimeStamp stamp; /* time stamp */ + dbr_short_t RISC_pad; /* RISC alignment */ + dbr_enum_t value; /* current value */ }; /* structure for a char time field */ struct dbr_time_char{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - epicsTimeStamp stamp; /* time stamp */ - dbr_short_t RISC_pad0; /* RISC alignment */ - dbr_char_t RISC_pad1; /* RISC alignment */ - dbr_char_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + epicsTimeStamp stamp; /* time stamp */ + dbr_short_t RISC_pad0; /* RISC alignment */ + dbr_char_t RISC_pad1; /* RISC alignment */ + dbr_char_t value; /* current value */ }; /* structure for a long time field */ struct dbr_time_long{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - epicsTimeStamp stamp; /* time stamp */ - dbr_long_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + epicsTimeStamp stamp; /* time stamp */ + dbr_long_t value; /* current value */ }; /* structure for a double time field */ struct dbr_time_double{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - epicsTimeStamp stamp; /* time stamp */ - dbr_long_t RISC_pad; /* RISC alignment */ - dbr_double_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + epicsTimeStamp stamp; /* time stamp */ + dbr_long_t RISC_pad; /* RISC alignment */ + dbr_double_t value; /* current value */ }; /* VALUES WITH STATUS AND GRAPHIC STRUCTURES */ /* structure for a graphic string */ - /* not implemented; use struct_dbr_sts_string */ + /* not implemented; use struct_dbr_sts_string */ /* structure for a graphic short field */ struct dbr_gr_int{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - char units[MAX_UNITS_SIZE]; /* units of value */ - dbr_short_t upper_disp_limit; /* upper limit of graph */ - dbr_short_t lower_disp_limit; /* lower limit of graph */ - dbr_short_t upper_alarm_limit; - dbr_short_t upper_warning_limit; - dbr_short_t lower_warning_limit; - dbr_short_t lower_alarm_limit; - dbr_short_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + char units[MAX_UNITS_SIZE]; /* units of value */ + dbr_short_t upper_disp_limit; /* upper limit of graph */ + dbr_short_t lower_disp_limit; /* lower limit of graph */ + dbr_short_t upper_alarm_limit; + dbr_short_t upper_warning_limit; + dbr_short_t lower_warning_limit; + dbr_short_t lower_alarm_limit; + dbr_short_t value; /* current value */ }; struct dbr_gr_short{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - char units[MAX_UNITS_SIZE]; /* units of value */ - dbr_short_t upper_disp_limit; /* upper limit of graph */ - dbr_short_t lower_disp_limit; /* lower limit of graph */ - dbr_short_t upper_alarm_limit; - dbr_short_t upper_warning_limit; - dbr_short_t lower_warning_limit; - dbr_short_t lower_alarm_limit; - dbr_short_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + char units[MAX_UNITS_SIZE]; /* units of value */ + dbr_short_t upper_disp_limit; /* upper limit of graph */ + dbr_short_t lower_disp_limit; /* lower limit of graph */ + dbr_short_t upper_alarm_limit; + dbr_short_t upper_warning_limit; + dbr_short_t lower_warning_limit; + dbr_short_t lower_alarm_limit; + dbr_short_t value; /* current value */ }; /* structure for a graphic floating point field */ struct dbr_gr_float{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - dbr_short_t precision; /* number of decimal places */ - dbr_short_t RISC_pad0; /* RISC alignment */ - char units[MAX_UNITS_SIZE]; /* units of value */ - dbr_float_t upper_disp_limit; /* upper limit of graph */ - dbr_float_t lower_disp_limit; /* lower limit of graph */ - dbr_float_t upper_alarm_limit; - dbr_float_t upper_warning_limit; - dbr_float_t lower_warning_limit; - dbr_float_t lower_alarm_limit; - dbr_float_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + dbr_short_t precision; /* number of decimal places */ + dbr_short_t RISC_pad0; /* RISC alignment */ + char units[MAX_UNITS_SIZE]; /* units of value */ + dbr_float_t upper_disp_limit; /* upper limit of graph */ + dbr_float_t lower_disp_limit; /* lower limit of graph */ + dbr_float_t upper_alarm_limit; + dbr_float_t upper_warning_limit; + dbr_float_t lower_warning_limit; + dbr_float_t lower_alarm_limit; + dbr_float_t value; /* current value */ }; /* structure for a graphic enumeration field */ struct dbr_gr_enum{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - dbr_short_t no_str; /* number of strings */ - char strs[MAX_ENUM_STATES][MAX_ENUM_STRING_SIZE]; - /* state strings */ - dbr_enum_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + dbr_short_t no_str; /* number of strings */ + char strs[MAX_ENUM_STATES][MAX_ENUM_STRING_SIZE]; + /* state strings */ + dbr_enum_t value; /* current value */ }; /* structure for a graphic char field */ struct dbr_gr_char{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - char units[MAX_UNITS_SIZE]; /* units of value */ - dbr_char_t upper_disp_limit; /* upper limit of graph */ - dbr_char_t lower_disp_limit; /* lower limit of graph */ - dbr_char_t upper_alarm_limit; - dbr_char_t upper_warning_limit; - dbr_char_t lower_warning_limit; - dbr_char_t lower_alarm_limit; - dbr_char_t RISC_pad; /* RISC alignment */ - dbr_char_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + char units[MAX_UNITS_SIZE]; /* units of value */ + dbr_char_t upper_disp_limit; /* upper limit of graph */ + dbr_char_t lower_disp_limit; /* lower limit of graph */ + dbr_char_t upper_alarm_limit; + dbr_char_t upper_warning_limit; + dbr_char_t lower_warning_limit; + dbr_char_t lower_alarm_limit; + dbr_char_t RISC_pad; /* RISC alignment */ + dbr_char_t value; /* current value */ }; /* structure for a graphic long field */ struct dbr_gr_long{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - char units[MAX_UNITS_SIZE]; /* units of value */ - dbr_long_t upper_disp_limit; /* upper limit of graph */ - dbr_long_t lower_disp_limit; /* lower limit of graph */ - dbr_long_t upper_alarm_limit; - dbr_long_t upper_warning_limit; - dbr_long_t lower_warning_limit; - dbr_long_t lower_alarm_limit; - dbr_long_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + char units[MAX_UNITS_SIZE]; /* units of value */ + dbr_long_t upper_disp_limit; /* upper limit of graph */ + dbr_long_t lower_disp_limit; /* lower limit of graph */ + dbr_long_t upper_alarm_limit; + dbr_long_t upper_warning_limit; + dbr_long_t lower_warning_limit; + dbr_long_t lower_alarm_limit; + dbr_long_t value; /* current value */ }; /* structure for a graphic double field */ struct dbr_gr_double{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - dbr_short_t precision; /* number of decimal places */ - dbr_short_t RISC_pad0; /* RISC alignment */ - char units[MAX_UNITS_SIZE]; /* units of value */ - dbr_double_t upper_disp_limit; /* upper limit of graph */ - dbr_double_t lower_disp_limit; /* lower limit of graph */ - dbr_double_t upper_alarm_limit; - dbr_double_t upper_warning_limit; - dbr_double_t lower_warning_limit; - dbr_double_t lower_alarm_limit; - dbr_double_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + dbr_short_t precision; /* number of decimal places */ + dbr_short_t RISC_pad0; /* RISC alignment */ + char units[MAX_UNITS_SIZE]; /* units of value */ + dbr_double_t upper_disp_limit; /* upper limit of graph */ + dbr_double_t lower_disp_limit; /* lower limit of graph */ + dbr_double_t upper_alarm_limit; + dbr_double_t upper_warning_limit; + dbr_double_t lower_warning_limit; + dbr_double_t lower_alarm_limit; + dbr_double_t value; /* current value */ }; /* VALUES WITH STATUS, GRAPHIC and CONTROL STRUCTURES */ /* structure for a control string */ - /* not implemented; use struct_dbr_sts_string */ + /* not implemented; use struct_dbr_sts_string */ /* structure for a control integer */ struct dbr_ctrl_int{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - char units[MAX_UNITS_SIZE]; /* units of value */ - dbr_short_t upper_disp_limit; /* upper limit of graph */ - dbr_short_t lower_disp_limit; /* lower limit of graph */ - dbr_short_t upper_alarm_limit; - dbr_short_t upper_warning_limit; - dbr_short_t lower_warning_limit; - dbr_short_t lower_alarm_limit; - dbr_short_t upper_ctrl_limit; /* upper control limit */ - dbr_short_t lower_ctrl_limit; /* lower control limit */ - dbr_short_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + char units[MAX_UNITS_SIZE]; /* units of value */ + dbr_short_t upper_disp_limit; /* upper limit of graph */ + dbr_short_t lower_disp_limit; /* lower limit of graph */ + dbr_short_t upper_alarm_limit; + dbr_short_t upper_warning_limit; + dbr_short_t lower_warning_limit; + dbr_short_t lower_alarm_limit; + dbr_short_t upper_ctrl_limit; /* upper control limit */ + dbr_short_t lower_ctrl_limit; /* lower control limit */ + dbr_short_t value; /* current value */ }; struct dbr_ctrl_short{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - char units[MAX_UNITS_SIZE]; /* units of value */ - dbr_short_t upper_disp_limit; /* upper limit of graph */ - dbr_short_t lower_disp_limit; /* lower limit of graph */ - dbr_short_t upper_alarm_limit; - dbr_short_t upper_warning_limit; - dbr_short_t lower_warning_limit; - dbr_short_t lower_alarm_limit; - dbr_short_t upper_ctrl_limit; /* upper control limit */ - dbr_short_t lower_ctrl_limit; /* lower control limit */ - dbr_short_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + char units[MAX_UNITS_SIZE]; /* units of value */ + dbr_short_t upper_disp_limit; /* upper limit of graph */ + dbr_short_t lower_disp_limit; /* lower limit of graph */ + dbr_short_t upper_alarm_limit; + dbr_short_t upper_warning_limit; + dbr_short_t lower_warning_limit; + dbr_short_t lower_alarm_limit; + dbr_short_t upper_ctrl_limit; /* upper control limit */ + dbr_short_t lower_ctrl_limit; /* lower control limit */ + dbr_short_t value; /* current value */ }; /* structure for a control floating point field */ struct dbr_ctrl_float{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - dbr_short_t precision; /* number of decimal places */ - dbr_short_t RISC_pad; /* RISC alignment */ - char units[MAX_UNITS_SIZE]; /* units of value */ - dbr_float_t upper_disp_limit; /* upper limit of graph */ - dbr_float_t lower_disp_limit; /* lower limit of graph */ - dbr_float_t upper_alarm_limit; - dbr_float_t upper_warning_limit; - dbr_float_t lower_warning_limit; - dbr_float_t lower_alarm_limit; - dbr_float_t upper_ctrl_limit; /* upper control limit */ - dbr_float_t lower_ctrl_limit; /* lower control limit */ - dbr_float_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + dbr_short_t precision; /* number of decimal places */ + dbr_short_t RISC_pad; /* RISC alignment */ + char units[MAX_UNITS_SIZE]; /* units of value */ + dbr_float_t upper_disp_limit; /* upper limit of graph */ + dbr_float_t lower_disp_limit; /* lower limit of graph */ + dbr_float_t upper_alarm_limit; + dbr_float_t upper_warning_limit; + dbr_float_t lower_warning_limit; + dbr_float_t lower_alarm_limit; + dbr_float_t upper_ctrl_limit; /* upper control limit */ + dbr_float_t lower_ctrl_limit; /* lower control limit */ + dbr_float_t value; /* current value */ }; /* structure for a control enumeration field */ struct dbr_ctrl_enum{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - dbr_short_t no_str; /* number of strings */ - char strs[MAX_ENUM_STATES][MAX_ENUM_STRING_SIZE]; - /* state strings */ - dbr_enum_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + dbr_short_t no_str; /* number of strings */ + char strs[MAX_ENUM_STATES][MAX_ENUM_STRING_SIZE]; + /* state strings */ + dbr_enum_t value; /* current value */ }; /* structure for a control char field */ struct dbr_ctrl_char{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - char units[MAX_UNITS_SIZE]; /* units of value */ - dbr_char_t upper_disp_limit; /* upper limit of graph */ - dbr_char_t lower_disp_limit; /* lower limit of graph */ - dbr_char_t upper_alarm_limit; - dbr_char_t upper_warning_limit; - dbr_char_t lower_warning_limit; - dbr_char_t lower_alarm_limit; - dbr_char_t upper_ctrl_limit; /* upper control limit */ - dbr_char_t lower_ctrl_limit; /* lower control limit */ - dbr_char_t RISC_pad; /* RISC alignment */ - dbr_char_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + char units[MAX_UNITS_SIZE]; /* units of value */ + dbr_char_t upper_disp_limit; /* upper limit of graph */ + dbr_char_t lower_disp_limit; /* lower limit of graph */ + dbr_char_t upper_alarm_limit; + dbr_char_t upper_warning_limit; + dbr_char_t lower_warning_limit; + dbr_char_t lower_alarm_limit; + dbr_char_t upper_ctrl_limit; /* upper control limit */ + dbr_char_t lower_ctrl_limit; /* lower control limit */ + dbr_char_t RISC_pad; /* RISC alignment */ + dbr_char_t value; /* current value */ }; /* structure for a control long field */ struct dbr_ctrl_long{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - char units[MAX_UNITS_SIZE]; /* units of value */ - dbr_long_t upper_disp_limit; /* upper limit of graph */ - dbr_long_t lower_disp_limit; /* lower limit of graph */ - dbr_long_t upper_alarm_limit; - dbr_long_t upper_warning_limit; - dbr_long_t lower_warning_limit; - dbr_long_t lower_alarm_limit; - dbr_long_t upper_ctrl_limit; /* upper control limit */ - dbr_long_t lower_ctrl_limit; /* lower control limit */ - dbr_long_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + char units[MAX_UNITS_SIZE]; /* units of value */ + dbr_long_t upper_disp_limit; /* upper limit of graph */ + dbr_long_t lower_disp_limit; /* lower limit of graph */ + dbr_long_t upper_alarm_limit; + dbr_long_t upper_warning_limit; + dbr_long_t lower_warning_limit; + dbr_long_t lower_alarm_limit; + dbr_long_t upper_ctrl_limit; /* upper control limit */ + dbr_long_t lower_ctrl_limit; /* lower control limit */ + dbr_long_t value; /* current value */ }; /* structure for a control double field */ struct dbr_ctrl_double{ - dbr_short_t status; /* status of value */ - dbr_short_t severity; /* severity of alarm */ - dbr_short_t precision; /* number of decimal places */ - dbr_short_t RISC_pad0; /* RISC alignment */ - char units[MAX_UNITS_SIZE]; /* units of value */ - dbr_double_t upper_disp_limit; /* upper limit of graph */ - dbr_double_t lower_disp_limit; /* lower limit of graph */ - dbr_double_t upper_alarm_limit; - dbr_double_t upper_warning_limit; - dbr_double_t lower_warning_limit; - dbr_double_t lower_alarm_limit; - dbr_double_t upper_ctrl_limit; /* upper control limit */ - dbr_double_t lower_ctrl_limit; /* lower control limit */ - dbr_double_t value; /* current value */ + dbr_short_t status; /* status of value */ + dbr_short_t severity; /* severity of alarm */ + dbr_short_t precision; /* number of decimal places */ + dbr_short_t RISC_pad0; /* RISC alignment */ + char units[MAX_UNITS_SIZE]; /* units of value */ + dbr_double_t upper_disp_limit; /* upper limit of graph */ + dbr_double_t lower_disp_limit; /* lower limit of graph */ + dbr_double_t upper_alarm_limit; + dbr_double_t upper_warning_limit; + dbr_double_t lower_warning_limit; + dbr_double_t lower_alarm_limit; + dbr_double_t upper_ctrl_limit; /* upper control limit */ + dbr_double_t lower_ctrl_limit; /* lower control limit */ + dbr_double_t value; /* current value */ }; #define dbr_size_n(TYPE,COUNT)\ @@ -526,21 +526,21 @@ LIBCA_API extern const unsigned short dbr_value_size[]; #ifndef db_accessHFORdb_accessC /* class for each type's value */ -enum dbr_value_class { - dbr_class_int, - dbr_class_float, - dbr_class_string, - dbr_class_max}; +enum dbr_value_class { + dbr_class_int, + dbr_class_float, + dbr_class_string, + dbr_class_max}; LIBCA_API extern const enum dbr_value_class dbr_value_class[LAST_BUFFER_TYPE+1]; -/* +/* * ptr to value given a pointer to the structure and the DBR type */ #define dbr_value_ptr(PDBR, DBR_TYPE) \ ((void *)(((char *)PDBR)+dbr_value_offset[DBR_TYPE])) -/* +/* * ptr to value given a pointer to the structure and the structure declaration */ #define dbr_value_ptr_from_structure(PDBR, STRUCTURE)\ @@ -551,128 +551,128 @@ LIBCA_API extern const unsigned short dbr_value_offset[LAST_BUFFER_TYPE+1]; /* union for each fetch buffers */ union db_access_val{ - dbr_string_t strval; /* string max size */ - dbr_short_t shrtval; /* short */ - dbr_short_t intval; /* short */ - dbr_float_t fltval; /* IEEE Float */ - dbr_enum_t enmval; /* item number */ - dbr_char_t charval; /* character */ - dbr_long_t longval; /* long */ - dbr_double_t doubleval; /* double */ - struct dbr_sts_string sstrval; /* string field with status */ - struct dbr_sts_short sshrtval; /* short field with status */ - struct dbr_sts_float sfltval; /* float field with status */ - struct dbr_sts_enum senmval; /* item number with status */ - struct dbr_sts_char schrval; /* char field with status */ - struct dbr_sts_long slngval; /* long field with status */ - struct dbr_sts_double sdblval; /* double field with time */ - struct dbr_time_string tstrval; /* string field with time */ - struct dbr_time_short tshrtval; /* short field with time */ - struct dbr_time_float tfltval; /* float field with time */ - struct dbr_time_enum tenmval; /* item number with time */ - struct dbr_time_char tchrval; /* char field with time */ - struct dbr_time_long tlngval; /* long field with time */ - struct dbr_time_double tdblval; /* double field with time */ - struct dbr_sts_string gstrval; /* graphic string info */ - struct dbr_gr_short gshrtval; /* graphic short info */ - struct dbr_gr_float gfltval; /* graphic float info */ - struct dbr_gr_enum genmval; /* graphic item info */ - struct dbr_gr_char gchrval; /* graphic char info */ - struct dbr_gr_long glngval; /* graphic long info */ - struct dbr_gr_double gdblval; /* graphic double info */ - struct dbr_sts_string cstrval; /* control string info */ - struct dbr_ctrl_short cshrtval; /* control short info */ - struct dbr_ctrl_float cfltval; /* control float info */ - struct dbr_ctrl_enum cenmval; /* control item info */ - struct dbr_ctrl_char cchrval; /* control char info */ - struct dbr_ctrl_long clngval; /* control long info */ - struct dbr_ctrl_double cdblval; /* control double info */ - dbr_put_ackt_t putackt; /* item number */ - dbr_put_acks_t putacks; /* item number */ - struct dbr_sts_string sastrval; /* string field with status */ - dbr_string_t classname; /* string max size */ + dbr_string_t strval; /* string max size */ + dbr_short_t shrtval; /* short */ + dbr_short_t intval; /* short */ + dbr_float_t fltval; /* IEEE Float */ + dbr_enum_t enmval; /* item number */ + dbr_char_t charval; /* character */ + dbr_long_t longval; /* long */ + dbr_double_t doubleval; /* double */ + struct dbr_sts_string sstrval; /* string field with status */ + struct dbr_sts_short sshrtval; /* short field with status */ + struct dbr_sts_float sfltval; /* float field with status */ + struct dbr_sts_enum senmval; /* item number with status */ + struct dbr_sts_char schrval; /* char field with status */ + struct dbr_sts_long slngval; /* long field with status */ + struct dbr_sts_double sdblval; /* double field with time */ + struct dbr_time_string tstrval; /* string field with time */ + struct dbr_time_short tshrtval; /* short field with time */ + struct dbr_time_float tfltval; /* float field with time */ + struct dbr_time_enum tenmval; /* item number with time */ + struct dbr_time_char tchrval; /* char field with time */ + struct dbr_time_long tlngval; /* long field with time */ + struct dbr_time_double tdblval; /* double field with time */ + struct dbr_sts_string gstrval; /* graphic string info */ + struct dbr_gr_short gshrtval; /* graphic short info */ + struct dbr_gr_float gfltval; /* graphic float info */ + struct dbr_gr_enum genmval; /* graphic item info */ + struct dbr_gr_char gchrval; /* graphic char info */ + struct dbr_gr_long glngval; /* graphic long info */ + struct dbr_gr_double gdblval; /* graphic double info */ + struct dbr_sts_string cstrval; /* control string info */ + struct dbr_ctrl_short cshrtval; /* control short info */ + struct dbr_ctrl_float cfltval; /* control float info */ + struct dbr_ctrl_enum cenmval; /* control item info */ + struct dbr_ctrl_char cchrval; /* control char info */ + struct dbr_ctrl_long clngval; /* control long info */ + struct dbr_ctrl_double cdblval; /* control double info */ + dbr_put_ackt_t putackt; /* item number */ + dbr_put_acks_t putacks; /* item number */ + struct dbr_sts_string sastrval; /* string field with status */ + dbr_string_t classname; /* string max size */ }; /*---------------------------------------------------------------------------- * repository for some useful PV database constants and utilities * * item dimensions -* db_strval_dim dimension for string values -* db_units_dim dimension for record units text -* db_desc_dim dimension for record description text -* db_name_dim dimension for channel names (record.field\0) -* db_state_dim number of states possible in a state table -* db_state_text_dim dimension for a state text string -* usage: char state_table[db_state_dim][db_state_text_dim] +* db_strval_dim dimension for string values +* db_units_dim dimension for record units text +* db_desc_dim dimension for record description text +* db_name_dim dimension for channel names (record.field\0) +* db_state_dim number of states possible in a state table +* db_state_text_dim dimension for a state text string +* usage: char state_table[db_state_dim][db_state_text_dim] * * type checking macros -- return non-zero if condition is true, zero otherwise * -* int dbf_type_is_valid(type) type is a valid DBF_xxx -* int dbr_type_is_valid(type) type is a valid DBR_xxx -* int dbr_type_is_plain(type) type is a valid plain DBR_xxx -* int dbr_type_is_STS(type) type is a valid DBR_STS_xxx -* int dbr_type_is_TIME(type) type is a valid DBR_TIME_xxx -* int dbr_type_is_GR(type) type is a valid DBR_GR_xxx -* int dbr_type_is_CTRL(type) type is a valid DBR_CTRL_xxx -* int dbr_type_is_STRING(type) type is a valid DBR_STRING_xxx -* int dbr_type_is_SHORT(type) type is a valid DBR_SHORT_xxx -* int dbr_type_is_FLOAT(type) type is a valid DBR_FLOAT_xxx -* int dbr_type_is_ENUM(type) type is a valid DBR_ENUM_xxx -* int dbr_type_is_CHAR(type) type is a valid DBR_CHAR_xxx -* int dbr_type_is_LONG(type) type is a valid DBR_LONG_xxx -* int dbr_type_is_DOUBLE(type) type is a valid DBR_DOUBLE_xxx +* int dbf_type_is_valid(type) type is a valid DBF_xxx +* int dbr_type_is_valid(type) type is a valid DBR_xxx +* int dbr_type_is_plain(type) type is a valid plain DBR_xxx +* int dbr_type_is_STS(type) type is a valid DBR_STS_xxx +* int dbr_type_is_TIME(type) type is a valid DBR_TIME_xxx +* int dbr_type_is_GR(type) type is a valid DBR_GR_xxx +* int dbr_type_is_CTRL(type) type is a valid DBR_CTRL_xxx +* int dbr_type_is_STRING(type) type is a valid DBR_STRING_xxx +* int dbr_type_is_SHORT(type) type is a valid DBR_SHORT_xxx +* int dbr_type_is_FLOAT(type) type is a valid DBR_FLOAT_xxx +* int dbr_type_is_ENUM(type) type is a valid DBR_ENUM_xxx +* int dbr_type_is_CHAR(type) type is a valid DBR_CHAR_xxx +* int dbr_type_is_LONG(type) type is a valid DBR_LONG_xxx +* int dbr_type_is_DOUBLE(type) type is a valid DBR_DOUBLE_xxx * * type conversion macros * -* char *dbf_type_to_text(type) returns text matching DBF_xxx +* char *dbf_type_to_text(type) returns text matching DBF_xxx * void dbf_text_to_type(text, type) finds DBF_xxx matching text -* int dbf_type_to_DBR(type) returns DBR_xxx matching DBF_xxx -* int dbf_type_to_DBR_TIME(type) returns DBR_TIME_xxx matching DBF_xxx -* int dbf_type_to_DBR_GR(type) returns DBR_GR_xxx matching DBF_xxx -* int dbf_type_to_DBR_CTRL(type) returns DBR_CTRL_xxx matching DBF_xxx -* char *dbr_type_to_text(type) returns text matching DBR_xxx +* int dbf_type_to_DBR(type) returns DBR_xxx matching DBF_xxx +* int dbf_type_to_DBR_TIME(type) returns DBR_TIME_xxx matching DBF_xxx +* int dbf_type_to_DBR_GR(type) returns DBR_GR_xxx matching DBF_xxx +* int dbf_type_to_DBR_CTRL(type) returns DBR_CTRL_xxx matching DBF_xxx +* char *dbr_type_to_text(type) returns text matching DBR_xxx * void dbr_text_to_type(text, type) finds DBR_xxx matching text *---------------------------------------------------------------------------*/ -#define db_strval_dim MAX_STRING_SIZE -#define db_units_dim MAX_UNITS_SIZE -#define db_desc_dim 24 -#define db_name_dim 36 -#define db_state_dim MAX_ENUM_STATES -#define db_state_text_dim MAX_ENUM_STRING_SIZE +#define db_strval_dim MAX_STRING_SIZE +#define db_units_dim MAX_UNITS_SIZE +#define db_desc_dim 24 +#define db_name_dim 36 +#define db_state_dim MAX_ENUM_STATES +#define db_state_text_dim MAX_ENUM_STRING_SIZE #define dbf_type_is_valid(type) ((type) >= 0 && (type) <= LAST_TYPE) #define dbr_type_is_valid(type) ((type) >= 0 && (type) <= LAST_BUFFER_TYPE) #define dbr_type_is_plain(type) \ - ((type) >= DBR_STRING && (type) <= DBR_DOUBLE) + ((type) >= DBR_STRING && (type) <= DBR_DOUBLE) #define dbr_type_is_STS(type) \ - ((type) >= DBR_STS_STRING && (type) <= DBR_STS_DOUBLE) + ((type) >= DBR_STS_STRING && (type) <= DBR_STS_DOUBLE) #define dbr_type_is_TIME(type) \ - ((type) >= DBR_TIME_STRING && (type) <= DBR_TIME_DOUBLE) + ((type) >= DBR_TIME_STRING && (type) <= DBR_TIME_DOUBLE) #define dbr_type_is_GR(type) \ - ((type) >= DBR_GR_STRING && (type) <= DBR_GR_DOUBLE) + ((type) >= DBR_GR_STRING && (type) <= DBR_GR_DOUBLE) #define dbr_type_is_CTRL(type) \ - ((type) >= DBR_CTRL_STRING && (type) <= DBR_CTRL_DOUBLE) + ((type) >= DBR_CTRL_STRING && (type) <= DBR_CTRL_DOUBLE) #define dbr_type_is_STRING(type) \ - ((type) >= 0 && (type) <= LAST_BUFFER_TYPE && \ - (type)%(LAST_TYPE+1) == DBR_STRING) + ((type) >= 0 && (type) <= LAST_BUFFER_TYPE && \ + (type)%(LAST_TYPE+1) == DBR_STRING) #define dbr_type_is_SHORT(type) \ - ((type) >= 0 && (type) <= LAST_BUFFER_TYPE && \ - (type)%(LAST_TYPE+1) == DBR_SHORT) + ((type) >= 0 && (type) <= LAST_BUFFER_TYPE && \ + (type)%(LAST_TYPE+1) == DBR_SHORT) #define dbr_type_is_FLOAT(type) \ - ((type) >= 0 && (type) <= LAST_BUFFER_TYPE && \ - (type)%(LAST_TYPE+1) == DBR_FLOAT) + ((type) >= 0 && (type) <= LAST_BUFFER_TYPE && \ + (type)%(LAST_TYPE+1) == DBR_FLOAT) #define dbr_type_is_ENUM(type) \ - ((type) >= 0 && (type) <= LAST_BUFFER_TYPE && \ - (type)%(LAST_TYPE+1) == DBR_ENUM) + ((type) >= 0 && (type) <= LAST_BUFFER_TYPE && \ + (type)%(LAST_TYPE+1) == DBR_ENUM) #define dbr_type_is_CHAR(type) \ - ((type) >= 0 && (type) <= LAST_BUFFER_TYPE && \ - (type)%(LAST_TYPE+1) == DBR_CHAR) + ((type) >= 0 && (type) <= LAST_BUFFER_TYPE && \ + (type)%(LAST_TYPE+1) == DBR_CHAR) #define dbr_type_is_LONG(type) \ - ((type) >= 0 && (type) <= LAST_BUFFER_TYPE && \ - (type)%(LAST_TYPE+1) == DBR_LONG) + ((type) >= 0 && (type) <= LAST_BUFFER_TYPE && \ + (type)%(LAST_TYPE+1) == DBR_LONG) #define dbr_type_is_DOUBLE(type) \ - ((type) >= 0 && (type) <= LAST_BUFFER_TYPE && \ - (type)%(LAST_TYPE+1) == DBR_DOUBLE) + ((type) >= 0 && (type) <= LAST_BUFFER_TYPE && \ + (type)%(LAST_TYPE+1) == DBR_DOUBLE) #define dbf_type_to_text(type) \ ( ((type) >= -1 && (type) < dbf_text_dim-2) ? \ diff --git a/modules/ca/src/client/disconnectGovernorTimer.cpp b/modules/ca/src/client/disconnectGovernorTimer.cpp index 987c54a84..2a7c7fd6a 100644 --- a/modules/ca/src/client/disconnectGovernorTimer.cpp +++ b/modules/ca/src/client/disconnectGovernorTimer.cpp @@ -6,7 +6,7 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -// +// // // L O S A L A M O S // Los Alamos National Laboratory @@ -25,9 +25,9 @@ static const double disconnectGovernorPeriod = 10.0; // sec -disconnectGovernorTimer::disconnectGovernorTimer ( - disconnectGovernorNotify & iiuIn, - epicsTimerQueue & queueIn, +disconnectGovernorTimer::disconnectGovernorTimer ( + disconnectGovernorNotify & iiuIn, + epicsTimerQueue & queueIn, epicsMutex & mutexIn ) : mutex ( mutexIn ), timer ( queueIn.createTimer () ), iiu ( iiuIn ) @@ -56,18 +56,18 @@ void disconnectGovernorTimer::shutdown ( } } while ( nciu * pChan = this->chanList.get () ) { - pChan->channelNode::listMember = + pChan->channelNode::listMember = channelNode::cs_none; pChan->serviceShutdownNotify ( cbGuard, guard ); } } -epicsTimerNotify::expireStatus disconnectGovernorTimer::expire ( +epicsTimerNotify::expireStatus disconnectGovernorTimer::expire ( const epicsTime & /* currentTime */ ) { epicsGuard < epicsMutex > guard ( this->mutex ); while ( nciu * pChan = chanList.get () ) { - pChan->channelNode::listMember = + pChan->channelNode::listMember = channelNode::cs_none; this->iiu.govExpireNotify ( guard, *pChan ); } @@ -81,14 +81,14 @@ void disconnectGovernorTimer::show ( unsigned level ) const this->chanList.count () ); if ( level > 0u ) { tsDLIterConst < nciu > pChan = this->chanList.firstIter (); - while ( pChan.valid () ) { + while ( pChan.valid () ) { pChan->show ( level - 1u ); pChan++; } } } -void disconnectGovernorTimer::installChan ( +void disconnectGovernorTimer::installChan ( epicsGuard < epicsMutex > & guard, nciu & chan ) { guard.assertIdenticalMutex ( this->mutex ); diff --git a/modules/ca/src/client/disconnectGovernorTimer.h b/modules/ca/src/client/disconnectGovernorTimer.h index 70127a711..23c1c5427 100644 --- a/modules/ca/src/client/disconnectGovernorTimer.h +++ b/modules/ca/src/client/disconnectGovernorTimer.h @@ -7,19 +7,19 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -// // -// +// +// // L O S A L A M O S // Los Alamos National Laboratory // Los Alamos, New Mexico 87545 -// +// // Copyright, 1986, The Regents of the University of California. -// -// -// Author Jeffrey O. Hill -// johill@lanl.gov -// 505 665 1831 +// +// +// Author Jeffrey O. Hill +// johill@lanl.gov +// 505 665 1831 // #ifndef INC_disconnectGovernorTimer_H @@ -36,22 +36,22 @@ class disconnectGovernorNotify { public: virtual ~disconnectGovernorNotify () = 0; - virtual void govExpireNotify ( + virtual void govExpireNotify ( epicsGuard < epicsMutex > &, nciu & ) = 0; }; class disconnectGovernorTimer : private epicsTimerNotify { public: - disconnectGovernorTimer ( + disconnectGovernorTimer ( class disconnectGovernorNotify &, epicsTimerQueue &, epicsMutex & ); virtual ~disconnectGovernorTimer (); void start (); void shutdown ( epicsGuard < epicsMutex > & cbGuard, epicsGuard < epicsMutex > & guard ); - void installChan ( + void installChan ( epicsGuard < epicsMutex > &, nciu & ); - void uninstallChan ( + void uninstallChan ( epicsGuard < epicsMutex > &, nciu & ); void show ( unsigned level ) const; private: @@ -60,8 +60,8 @@ private: epicsTimer & timer; class disconnectGovernorNotify & iiu; epicsTimerNotify::expireStatus expire ( const epicsTime & currentTime ); - disconnectGovernorTimer ( const disconnectGovernorTimer & ); - disconnectGovernorTimer & operator = ( const disconnectGovernorTimer & ); + disconnectGovernorTimer ( const disconnectGovernorTimer & ); + disconnectGovernorTimer & operator = ( const disconnectGovernorTimer & ); }; #endif // ifdef INC_disconnectGovernorTimer_H diff --git a/modules/ca/src/client/evtime.c b/modules/ca/src/client/evtime.c index d5cf58382..9c6fe0fdf 100644 --- a/modules/ca/src/client/evtime.c +++ b/modules/ca/src/client/evtime.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include @@ -17,8 +17,8 @@ void event_handler (struct event_handler_args args); int evtime (char *pname); -static unsigned iteration_count; -static epicsUInt32 last_time; +static unsigned iteration_count; +static epicsUInt32 last_time; #ifndef iocCore int main(int argc, char **argv) @@ -32,7 +32,7 @@ int main(int argc, char **argv) else{ printf("usage: %s ", argv[0]); } - return(0); + return(0); } #endif @@ -41,28 +41,28 @@ int main(int argc, char **argv) */ int evtime(char *pname) { - chid chan; - int status; + chid chan; + int status; - status = ca_search(pname, &chan); - SEVCHK(status, NULL); + status = ca_search(pname, &chan); + SEVCHK(status, NULL); - status = ca_pend_io(10.0); - if(status != ECA_NORMAL){ - printf("%s not found\n", pname); - return 0; - } + status = ca_pend_io(10.0); + if(status != ECA_NORMAL){ + printf("%s not found\n", pname); + return 0; + } - status = ca_add_event( - DBR_FLOAT, - chan, - event_handler, - NULL, - NULL); - SEVCHK(status, __FILE__); + status = ca_add_event( + DBR_FLOAT, + chan, + event_handler, + NULL, + NULL); + SEVCHK(status, __FILE__); - status = ca_pend_event(0.0); - SEVCHK(status, NULL); + status = ca_pend_event(0.0); + SEVCHK(status, NULL); } @@ -72,24 +72,24 @@ int evtime(char *pname) */ void event_handler(struct event_handler_args args) { - epicsUInt32 current_time; -# define COUNT 0x8000 - double interval; - double delay; - epicsTimeStamp ts; + epicsUInt32 current_time; +# define COUNT 0x8000 + double interval; + double delay; + epicsTimeStamp ts; - if(iteration_count%COUNT == 0){ - epicsTimeGetCurrent(&ts); - current_time = ts.secPastEpoch; - if(last_time != 0){ - interval = current_time - last_time; - delay = interval/COUNT; - printf("Delay = %f sec per event\n", - delay); - } - last_time = current_time; - } + if(iteration_count%COUNT == 0){ + epicsTimeGetCurrent(&ts); + current_time = ts.secPastEpoch; + if(last_time != 0){ + interval = current_time - last_time; + delay = interval/COUNT; + printf("Delay = %f sec per event\n", + delay); + } + last_time = current_time; + } - iteration_count++; + iteration_count++; } diff --git a/modules/ca/src/client/getCallback.cpp b/modules/ca/src/client/getCallback.cpp index f5c4e760d..b7fb46ef2 100644 --- a/modules/ca/src/client/getCallback.cpp +++ b/modules/ca/src/client/getCallback.cpp @@ -7,19 +7,19 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* + * * - * * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 - * + * * Copyright, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #include @@ -30,7 +30,7 @@ #include "iocinf.h" #include "oldAccess.h" -getCallback::getCallback ( oldChannelNotify & chanIn, +getCallback::getCallback ( oldChannelNotify & chanIn, caEventCallBackFunc *pFuncIn, void *pPrivateIn ) : chan ( chanIn ), pFunc ( pFuncIn ), pPrivate ( pPrivateIn ) { @@ -63,7 +63,7 @@ void getCallback::completion ( void getCallback::exception ( epicsGuard < epicsMutex > & guard, - int status, const char * /* pContext */, + int status, const char * /* pContext */, unsigned type, arrayElementCount count ) { if ( status != ECA_CHANDESTROY ) { diff --git a/modules/ca/src/client/getCopy.cpp b/modules/ca/src/client/getCopy.cpp index 7f1ccf07c..625620bc9 100644 --- a/modules/ca/src/client/getCopy.cpp +++ b/modules/ca/src/client/getCopy.cpp @@ -7,19 +7,19 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* + * * - * * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 - * + * * Copyright, 1986, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #include @@ -33,18 +33,18 @@ #include "oldAccess.h" #include "cac.h" -getCopy::getCopy ( - epicsGuard < epicsMutex > & guard, ca_client_context & cacCtxIn, - oldChannelNotify & chanIn, unsigned typeIn, +getCopy::getCopy ( + epicsGuard < epicsMutex > & guard, ca_client_context & cacCtxIn, + oldChannelNotify & chanIn, unsigned typeIn, arrayElementCount countIn, void * pValueIn ) : - count ( countIn ), cacCtx ( cacCtxIn ), chan ( chanIn ), pValue ( pValueIn ), + count ( countIn ), cacCtx ( cacCtxIn ), chan ( chanIn ), pValue ( pValueIn ), ioSeqNo ( 0 ), type ( typeIn ) { this->ioSeqNo = cacCtxIn.sequenceNumberOfOutstandingIO ( guard ); cacCtxIn.incrementOutstandingIO ( guard, this->ioSeqNo ); } -getCopy::~getCopy () +getCopy::~getCopy () { } @@ -54,8 +54,8 @@ void getCopy::cancel () this->cacCtx.decrementOutstandingIO ( guard, this->ioSeqNo ); } -void getCopy::completion ( - epicsGuard < epicsMutex > & guard, unsigned typeIn, +void getCopy::completion ( + epicsGuard < epicsMutex > & guard, unsigned typeIn, arrayElementCount countIn, const void *pDataIn ) { if ( this->type == typeIn ) { @@ -66,7 +66,7 @@ void getCopy::completion ( // this object destroyed by preceding function call } else { - this->exception ( guard, ECA_INTERNAL, + this->exception ( guard, ECA_INTERNAL, "bad data type match in get copy back response", typeIn, countIn); // this object destroyed by preceding function call @@ -75,7 +75,7 @@ void getCopy::completion ( void getCopy::exception ( epicsGuard < epicsMutex > & guard, - int status, const char *pContext, + int status, const char *pContext, unsigned /* typeIn */, arrayElementCount /* countIn */ ) { oldChannelNotify & chanTmp ( this->chan ); @@ -86,8 +86,8 @@ void getCopy::exception ( // the lock and calling cb in case they destroy channel there this->cacCtx.destroyGetCopy ( guard, *this ); if ( status != ECA_CHANDESTROY ) { - caClientCtx.exception ( guard, status, pContext, - __FILE__, __LINE__, chanTmp, typeTmp, + caClientCtx.exception ( guard, status, pContext, + __FILE__, __LINE__, chanTmp, typeTmp, countTmp, CA_OP_GET ); } } @@ -95,7 +95,7 @@ void getCopy::exception ( void getCopy::show ( unsigned level ) const { int tmpType = static_cast ( this->type ); - ::printf ( "read copy IO at %p, type %s, element count %lu\n", + ::printf ( "read copy IO at %p, type %s, element count %lu\n", static_cast ( this ), dbf_type_to_text ( tmpType ), this->count ); if ( level > 0u ) { ::printf ( "\tIO sequence number %u, user's storage %p\n", diff --git a/modules/ca/src/client/hostNameCache.cpp b/modules/ca/src/client/hostNameCache.cpp index d82ffde13..310346765 100644 --- a/modules/ca/src/client/hostNameCache.cpp +++ b/modules/ca/src/client/hostNameCache.cpp @@ -7,18 +7,18 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* + * * - * * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 - * + * * Copyright, 1986, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov */ #include @@ -28,7 +28,7 @@ #include "hostNameCache.h" #include "epicsGuard.h" -hostNameCache::hostNameCache ( +hostNameCache::hostNameCache ( const osiSockAddr & addr, ipAddrToAsciiEngine & engine ) : dnsTransaction ( engine.createTransaction() ), nameLength ( 0 ) { @@ -64,7 +64,7 @@ void hostNameCache::transactionComplete ( const char * pHostNameIn ) this->nameLength = newNameLen; } -unsigned hostNameCache::getName ( +unsigned hostNameCache::getName ( char * pBuf, unsigned bufSize ) const { if ( bufSize == 0u ) { diff --git a/modules/ca/src/client/hostNameCache.h b/modules/ca/src/client/hostNameCache.h index 0fc7e7860..3209e8eb4 100644 --- a/modules/ca/src/client/hostNameCache.h +++ b/modules/ca/src/client/hostNameCache.h @@ -7,19 +7,19 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* + * * - * * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 - * + * * Copyright, 1986, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #ifndef INC_hostNameCache_H diff --git a/modules/ca/src/client/inetAddrID.h b/modules/ca/src/client/inetAddrID.h index d7ee160cb..f8ba11424 100644 --- a/modules/ca/src/client/inetAddrID.h +++ b/modules/ca/src/client/inetAddrID.h @@ -7,7 +7,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* * * L O S A L A M O S * Los Alamos National Laboratory @@ -57,7 +57,7 @@ inline resTableIndex inetAddrID::hash () const index = this->addr.sin_addr.s_addr; index ^= this->addr.sin_port; index ^= this->addr.sin_port >> 8u; - return integerHash ( inetAddrMinIndexBitWidth, + return integerHash ( inetAddrMinIndexBitWidth, inetAddrMaxIndexBitWidth, index ); } diff --git a/modules/ca/src/client/iocinf.cpp b/modules/ca/src/client/iocinf.cpp index 8dcf8c087..0cc069472 100644 --- a/modules/ca/src/client/iocinf.cpp +++ b/modules/ca/src/client/iocinf.cpp @@ -7,7 +7,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* * * L O S A L A M O S * Los Alamos National Laboratory @@ -62,8 +62,8 @@ static char *getToken ( const char **ppString, char *pBuf, unsigned bufSIze ) if ( tokenFound ) { pBuf[bufSIze-1] = '\0'; - return pBuf; - } + return pBuf; + } return NULL; } @@ -71,7 +71,7 @@ static char *getToken ( const char **ppString, char *pBuf, unsigned bufSIze ) * addAddrToChannelAccessAddressList () */ extern "C" int epicsStdCall addAddrToChannelAccessAddressList - ( ELLLIST *pList, const ENV_PARAM *pEnv, + ( ELLLIST *pList, const ENV_PARAM *pEnv, unsigned short port, int ignoreNonDefaultPort ) { osiSockAddrNode *pNewNode; @@ -106,9 +106,9 @@ extern "C" int epicsStdCall addAddrToChannelAccessAddressList pNewNode->addr.ia = addr; - /* - * LOCK applied externally - */ + /* + * LOCK applied externally + */ ellAdd (pList, &pNewNode->node); ret = 0; /* success if anything is added to the list */ } @@ -125,8 +125,8 @@ extern "C" void epicsStdCall removeDuplicateAddresses ELLNODE *pRawNode; while ( (pRawNode = ellGet ( pSrcList ) ) ) { - STATIC_ASSERT ( offsetof (osiSockAddrNode, node) == 0 ); - osiSockAddrNode *pNode = reinterpret_cast ( pRawNode ); + STATIC_ASSERT ( offsetof (osiSockAddrNode, node) == 0 ); + osiSockAddrNode *pNode = reinterpret_cast ( pRawNode ); osiSockAddrNode *pTmpNode; if ( pNode->addr.sa.sa_family == AF_INET ) { @@ -134,14 +134,14 @@ extern "C" void epicsStdCall removeDuplicateAddresses pTmpNode = (osiSockAddrNode *) ellFirst (pDestList); while ( pTmpNode ) { if (pTmpNode->addr.sa.sa_family == AF_INET) { - if ( pNode->addr.ia.sin_addr.s_addr == pTmpNode->addr.ia.sin_addr.s_addr && + if ( pNode->addr.ia.sin_addr.s_addr == pTmpNode->addr.ia.sin_addr.s_addr && pNode->addr.ia.sin_port == pTmpNode->addr.ia.sin_port ) { - if ( ! silent ) { + if ( ! silent ) { char buf[64]; ipAddrToDottedIP ( &pNode->addr.ia, buf, sizeof (buf) ); - fprintf ( stderr, - "Warning: Duplicate EPICS CA Address list entry \"%s\" discarded\n", buf ); - } + fprintf ( stderr, + "Warning: Duplicate EPICS CA Address list entry \"%s\" discarded\n", buf ); + } free (pNode); pNode = NULL; break; @@ -200,7 +200,7 @@ extern "C" void epicsStdCall configureChannelAccessAddressList * from the interfaces found. */ yes = true; - pstr = envGetConfigParam ( &EPICS_CA_AUTO_ADDR_LIST, + pstr = envGetConfigParam ( &EPICS_CA_AUTO_ADDR_LIST, sizeof (yesno), yesno ); if ( pstr ) { if ( strstr ( pstr, "no" ) || strstr ( pstr, "NO" ) ) { @@ -213,19 +213,19 @@ extern "C" void epicsStdCall configureChannelAccessAddressList * (lock outside because this is used by the server also) */ if (yes) { - ELLLIST bcastList; + ELLLIST bcastList; osiSockAddr addr; - ellInit ( &bcastList ); + ellInit ( &bcastList ); addr.ia.sin_family = AF_UNSPEC; osiSockDiscoverBroadcastAddresses ( &bcastList, sock, &addr ); forcePort ( &bcastList, port ); - removeDuplicateAddresses ( &tmpList, &bcastList, 1 ); + removeDuplicateAddresses ( &tmpList, &bcastList, 1 ); if ( ellCount ( &tmpList ) == 0 ) { osiSockAddrNode *pNewNode; pNewNode = (osiSockAddrNode *) calloc ( 1, sizeof (*pNewNode) ); if ( pNewNode ) { - /* - * if no interfaces found then look for local channels + /* + * if no interfaces found then look for local channels * with the loop back interface */ pNewNode->addr.ia.sin_family = AF_INET; diff --git a/modules/ca/src/client/iocinf.h b/modules/ca/src/client/iocinf.h index fee060370..5100ac0e7 100644 --- a/modules/ca/src/client/iocinf.h +++ b/modules/ca/src/client/iocinf.h @@ -6,19 +6,19 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* + * * - * * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 - * + * * Copyright, 1986, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #ifndef INC_iocinf_H @@ -46,17 +46,17 @@ * CA_CONN_VERIFY_PERIOD is normally obtained from an * EPICS environment variable. */ -static const double CA_ECHO_TIMEOUT = 5.0; /* (sec) disconn no echo reply tmo */ +static const double CA_ECHO_TIMEOUT = 5.0; /* (sec) disconn no echo reply tmo */ static const double CA_CONN_VERIFY_PERIOD = 30.0; /* (sec) how often to request echo */ /* * this determines the number of messages received - * without a delay in between before we go into + * without a delay in between before we go into * monitor flow control * * turning this down effects maximum throughput - * because we dont get an optimal number of bytes - * per network frame + * because we dont get an optimal number of bytes + * per network frame */ static const unsigned contiguousMsgCountWhichTriggersFlowControl = 10u; diff --git a/modules/ca/src/client/localHostName.cpp b/modules/ca/src/client/localHostName.cpp index 4810a279c..7bc034f90 100644 --- a/modules/ca/src/client/localHostName.cpp +++ b/modules/ca/src/client/localHostName.cpp @@ -7,7 +7,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* * * L O S A L A M O S * Los Alamos National Laboratory @@ -30,7 +30,7 @@ localHostName::localHostName () : const char * pErrStr = ""; int status = -1; if ( this->attachedToSockLib ) { - status = gethostname ( + status = gethostname ( this->cache, sizeof ( this->cache ) ); } if ( status ) { @@ -47,7 +47,7 @@ localHostName::~localHostName () } } -unsigned localHostName::getName ( +unsigned localHostName::getName ( char * pBuf, unsigned bufLength ) const { if ( bufLength ) { diff --git a/modules/ca/src/client/localHostName.h b/modules/ca/src/client/localHostName.h index 95d1452f8..e26a520b4 100644 --- a/modules/ca/src/client/localHostName.h +++ b/modules/ca/src/client/localHostName.h @@ -7,7 +7,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* * * L O S A L A M O S * Los Alamos National Laboratory diff --git a/modules/ca/src/client/msgForMultiplyDefinedPV.cpp b/modules/ca/src/client/msgForMultiplyDefinedPV.cpp index 06c2ce354..72fe2b04e 100644 --- a/modules/ca/src/client/msgForMultiplyDefinedPV.cpp +++ b/modules/ca/src/client/msgForMultiplyDefinedPV.cpp @@ -7,19 +7,19 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* + * * - * * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 - * + * * Copyright, 1986, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #include @@ -34,9 +34,9 @@ #include "cac.h" #include "caerr.h" // for ECA_DBLCHNL -msgForMultiplyDefinedPV::msgForMultiplyDefinedPV ( +msgForMultiplyDefinedPV::msgForMultiplyDefinedPV ( ipAddrToAsciiEngine & engine, - callbackForMultiplyDefinedPV & cbIn, + callbackForMultiplyDefinedPV & cbIn, const char * pChannelName, const char * pAcc ) : dnsTransaction ( engine.createTransaction () ), cb ( cbIn ) { @@ -59,15 +59,15 @@ void msgForMultiplyDefinedPV::transactionComplete ( const char * pHostNameRej ) // !! dont touch 'this' pointer after this point because object has been deleted !! } -void * msgForMultiplyDefinedPV::operator new ( size_t size, +void * msgForMultiplyDefinedPV::operator new ( size_t size, tsFreeList < class msgForMultiplyDefinedPV, 16 > & freeList ) { return freeList.allocate ( size ); } #ifdef CXX_PLACEMENT_DELETE -void msgForMultiplyDefinedPV::operator delete ( void *pCadaver, - tsFreeList < class msgForMultiplyDefinedPV, 16 > & freeList ) +void msgForMultiplyDefinedPV::operator delete ( void *pCadaver, + tsFreeList < class msgForMultiplyDefinedPV, 16 > & freeList ) { freeList.release ( pCadaver, sizeof ( msgForMultiplyDefinedPV ) ); } diff --git a/modules/ca/src/client/msgForMultiplyDefinedPV.h b/modules/ca/src/client/msgForMultiplyDefinedPV.h index afcbc807e..187fa0d56 100644 --- a/modules/ca/src/client/msgForMultiplyDefinedPV.h +++ b/modules/ca/src/client/msgForMultiplyDefinedPV.h @@ -7,19 +7,19 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* + * * - * * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 - * + * * Copyright, 1986, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #ifndef INC_msgForMultiplyDefinedPV_H @@ -33,8 +33,8 @@ class callbackForMultiplyDefinedPV { public: virtual ~callbackForMultiplyDefinedPV () = 0; - virtual void pvMultiplyDefinedNotify ( - class msgForMultiplyDefinedPV &, const char * pChannelName, + virtual void pvMultiplyDefinedNotify ( + class msgForMultiplyDefinedPV &, const char * pChannelName, const char * pAcc, const char * pRej ) = 0; }; @@ -43,7 +43,7 @@ class msgForMultiplyDefinedPV : public tsDLNode < msgForMultiplyDefinedPV > { public: msgForMultiplyDefinedPV ( ipAddrToAsciiEngine & engine, - callbackForMultiplyDefinedPV &, const char * pChannelName, + callbackForMultiplyDefinedPV &, const char * pChannelName, const char * pAcc ); virtual ~msgForMultiplyDefinedPV (); void ioInitiate ( const osiSockAddr & rej ); diff --git a/modules/ca/src/client/nciu.cpp b/modules/ca/src/client/nciu.cpp index d3ea7097b..0a7e70899 100644 --- a/modules/ca/src/client/nciu.cpp +++ b/modules/ca/src/client/nciu.cpp @@ -49,7 +49,7 @@ nciu::nciu ( cac & cacIn, netiiu & iiuIn, cacChannelNotify & chanIn, typeCode ( USHRT_MAX ), priority ( static_cast ( pri ) ) { - size_t nameLengthTmp = strlen ( pNameIn ) + 1; + size_t nameLengthTmp = strlen ( pNameIn ) + 1; // second constraint is imposed by size field in protocol header if ( nameLengthTmp > MAX_UDP_SEND - sizeof ( caHdr ) || nameLengthTmp > USHRT_MAX ) { @@ -60,7 +60,7 @@ nciu::nciu ( cac & cacIn, netiiu & iiuIn, cacChannelNotify & chanIn, throw cacChannel::badPriority (); } - this->nameLength = static_cast ( nameLengthTmp ); + this->nameLength = static_cast ( nameLengthTmp ); this->pNameStr = new char [ this->nameLength ]; strcpy ( this->pNameStr, pNameIn ); @@ -112,7 +112,7 @@ void nciu::initiateConnect ( } void nciu::connect ( unsigned nativeType, - unsigned nativeCount, unsigned sidIn, + unsigned nativeCount, unsigned sidIn, epicsGuard < epicsMutex > & /* cbGuard */, epicsGuard < epicsMutex > & guard ) { diff --git a/modules/ca/src/client/nciu.h b/modules/ca/src/client/nciu.h index 52b73302c..adfeda2c8 100644 --- a/modules/ca/src/client/nciu.h +++ b/modules/ca/src/client/nciu.h @@ -16,9 +16,9 @@ * Copyright, 1986, The Regents of the University of California. * * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #ifndef INC_nciu_H @@ -269,8 +269,8 @@ private: epicsGuard < epicsMutex > &, class baseNMIU & ); const char * pHostName ( epicsGuard < epicsMutex > & guard ) const throw (); - nciu ( const nciu & ); - nciu & operator = ( const nciu & ); + nciu ( const nciu & ); + nciu & operator = ( const nciu & ); void operator delete ( void * ); }; diff --git a/modules/ca/src/client/netIO.h b/modules/ca/src/client/netIO.h index 74d48adbb..e5a257164 100644 --- a/modules/ca/src/client/netIO.h +++ b/modules/ca/src/client/netIO.h @@ -6,19 +6,19 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* + * * - * * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 - * + * * Copyright, 1986, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #ifndef INC_netIO_H @@ -28,9 +28,9 @@ #include "compilerDependencies.h" // SUN PRO generates multiply defined symbols if the baseNMIU -// destructor is virtual (therefore it is protected). +// destructor is virtual (therefore it is protected). // I assume that SUNPRO will fix this in future versions. -// With other compilers we get warnings (and +// With other compilers we get warnings (and // potential problems) if we dont make the baseNMIU // destructor virtual. #if defined ( __SUNPRO_CC ) && ( __SUNPRO_CC <= 0x540 ) @@ -44,42 +44,42 @@ class privateInterfaceForIO; class baseNMIU : public tsDLNode < baseNMIU >, public chronIntIdRes < baseNMIU > { public: - virtual void destroy ( + virtual void destroy ( epicsGuard < epicsMutex > &, class cacRecycle & ) = 0; // only called by cac - virtual void completion ( + virtual void completion ( epicsGuard < epicsMutex > &, cacRecycle & ) = 0; - virtual void exception ( - epicsGuard < epicsMutex > &, cacRecycle &, + virtual void exception ( + epicsGuard < epicsMutex > &, cacRecycle &, int status, const char * pContext ) = 0; - virtual void exception ( + virtual void exception ( epicsGuard < epicsMutex > &, cacRecycle &, - int status, const char * pContext, unsigned type, + int status, const char * pContext, unsigned type, arrayElementCount count ) = 0; - virtual void completion ( + virtual void completion ( epicsGuard < epicsMutex > &, cacRecycle &, - unsigned type, arrayElementCount count, + unsigned type, arrayElementCount count, const void * pData ) = 0; virtual void forceSubscriptionUpdate ( epicsGuard < epicsMutex > & guard, nciu & chan ) = 0; virtual class netSubscription * isSubscription () = 0; - virtual void show ( + virtual void show ( unsigned level ) const = 0; - virtual void show ( - epicsGuard < epicsMutex > &, + virtual void show ( + epicsGuard < epicsMutex > &, unsigned level ) const = 0; protected: - NETIO_VIRTUAL_DESTRUCTOR ~baseNMIU (); + NETIO_VIRTUAL_DESTRUCTOR ~baseNMIU (); }; class netSubscription : public baseNMIU { public: - static netSubscription * factory ( - tsFreeList < class netSubscription, 1024, epicsMutexNOOP > &, - class privateInterfaceForIO &, unsigned type, arrayElementCount count, + static netSubscription * factory ( + tsFreeList < class netSubscription, 1024, epicsMutexNOOP > &, + class privateInterfaceForIO &, unsigned type, arrayElementCount count, unsigned mask, cacStateNotify & ); - void show ( + void show ( unsigned level ) const; - void show ( + void show ( epicsGuard < epicsMutex > &, unsigned level ) const; arrayElementCount getCount ( epicsGuard < epicsMutex > &, bool allow_zero ) const; @@ -89,12 +89,12 @@ public: epicsGuard < epicsMutex > & ) const; void subscribeIfRequired ( epicsGuard < epicsMutex > & guard, nciu & chan ); - void unsubscribeIfRequired ( + void unsubscribeIfRequired ( epicsGuard < epicsMutex > & guard, nciu & chan ); protected: - netSubscription ( - class privateInterfaceForIO &, unsigned type, - arrayElementCount count, + netSubscription ( + class privateInterfaceForIO &, unsigned type, + arrayElementCount count, unsigned mask, cacStateNotify & ); ~netSubscription (); private: @@ -106,23 +106,23 @@ private: bool subscribed; class netSubscription * isSubscription (); void operator delete ( void * ); - void * operator new ( size_t, + void * operator new ( size_t, tsFreeList < class netSubscription, 1024, epicsMutexNOOP > & ); - epicsPlacementDeleteOperator (( void *, + epicsPlacementDeleteOperator (( void *, tsFreeList < class netSubscription, 1024, epicsMutexNOOP > & )) - void destroy ( + void destroy ( epicsGuard < epicsMutex > &, class cacRecycle & ); void completion ( epicsGuard < epicsMutex > &, cacRecycle & ); - void exception ( + void exception ( epicsGuard < epicsMutex > &, cacRecycle &, int status, const char * pContext ); - void completion ( + void completion ( epicsGuard < epicsMutex > &, cacRecycle &, unsigned type, arrayElementCount count, const void * pData ); - void exception ( + void exception ( epicsGuard < epicsMutex > &, cacRecycle &, - int status, const char * pContext, unsigned type, + int status, const char * pContext, unsigned type, arrayElementCount count ); void forceSubscriptionUpdate ( epicsGuard < epicsMutex > & guard, nciu & chan ); @@ -132,12 +132,12 @@ private: class netReadNotifyIO : public baseNMIU { public: - static netReadNotifyIO * factory ( - tsFreeList < class netReadNotifyIO, 1024, epicsMutexNOOP > &, + static netReadNotifyIO * factory ( + tsFreeList < class netReadNotifyIO, 1024, epicsMutexNOOP > &, privateInterfaceForIO &, cacReadNotify & ); - void show ( + void show ( unsigned level ) const; - void show ( + void show ( epicsGuard < epicsMutex > &, unsigned level ) const; protected: netReadNotifyIO ( privateInterfaceForIO &, cacReadNotify & ); @@ -146,24 +146,24 @@ private: cacReadNotify & notify; class privateInterfaceForIO & privateChanForIO; void operator delete ( void * ); - void * operator new ( size_t, + void * operator new ( size_t, tsFreeList < class netReadNotifyIO, 1024, epicsMutexNOOP > & ); - epicsPlacementDeleteOperator (( void *, + epicsPlacementDeleteOperator (( void *, tsFreeList < class netReadNotifyIO, 1024, epicsMutexNOOP > & )) - void destroy ( + void destroy ( epicsGuard < epicsMutex > &, class cacRecycle & ); void completion ( epicsGuard < epicsMutex > &, cacRecycle & ); - void exception ( + void exception ( epicsGuard < epicsMutex > &, cacRecycle &, int status, const char * pContext ); - void completion ( + void completion ( epicsGuard < epicsMutex > &, cacRecycle &, unsigned type, arrayElementCount count, const void * pData ); - void exception ( + void exception ( epicsGuard < epicsMutex > &, cacRecycle &, - int status, const char * pContext, + int status, const char * pContext, unsigned type, arrayElementCount count ); class netSubscription * isSubscription (); void forceSubscriptionUpdate ( @@ -174,12 +174,12 @@ private: class netWriteNotifyIO : public baseNMIU { public: - static netWriteNotifyIO * factory ( - tsFreeList < class netWriteNotifyIO, 1024, epicsMutexNOOP > &, + static netWriteNotifyIO * factory ( + tsFreeList < class netWriteNotifyIO, 1024, epicsMutexNOOP > &, privateInterfaceForIO &, cacWriteNotify & ); - void show ( + void show ( unsigned level ) const; - void show ( + void show ( epicsGuard < epicsMutex > &, unsigned level ) const; protected: netWriteNotifyIO ( privateInterfaceForIO &, cacWriteNotify & ); @@ -188,25 +188,25 @@ private: cacWriteNotify & notify; privateInterfaceForIO & privateChanForIO; void operator delete ( void * ); - void * operator new ( size_t, + void * operator new ( size_t, tsFreeList < class netWriteNotifyIO, 1024, epicsMutexNOOP > & ); epicsPlacementDeleteOperator (( void *, tsFreeList < class netWriteNotifyIO, 1024, epicsMutexNOOP > & )) class netSubscription * isSubscription (); - void destroy ( + void destroy ( epicsGuard < epicsMutex > &, class cacRecycle & ); void completion ( epicsGuard < epicsMutex > &, cacRecycle & ); - void exception ( + void exception ( epicsGuard < epicsMutex > &, cacRecycle &, int status, const char * pContext ); - void completion ( + void completion ( epicsGuard < epicsMutex > &, cacRecycle &, unsigned type, arrayElementCount count, const void * pData ); - void exception ( + void exception ( epicsGuard < epicsMutex > &, cacRecycle &, - int status, const char * pContext, unsigned type, + int status, const char * pContext, unsigned type, arrayElementCount count ); void forceSubscriptionUpdate ( epicsGuard < epicsMutex > & guard, nciu & chan ); @@ -214,23 +214,23 @@ private: netWriteNotifyIO & operator = ( const netWriteNotifyIO & ); }; -inline void * netSubscription::operator new ( size_t size, +inline void * netSubscription::operator new ( size_t size, tsFreeList < class netSubscription, 1024, epicsMutexNOOP > &freeList ) { return freeList.allocate ( size ); } #if defined ( CXX_PLACEMENT_DELETE ) - inline void netSubscription::operator delete ( void *pCadaver, - tsFreeList < class netSubscription, 1024, epicsMutexNOOP > &freeList ) + inline void netSubscription::operator delete ( void *pCadaver, + tsFreeList < class netSubscription, 1024, epicsMutexNOOP > &freeList ) { freeList.release ( pCadaver ); } #endif -inline netSubscription * netSubscription::factory ( - tsFreeList < class netSubscription, 1024, epicsMutexNOOP > & freeList, - class privateInterfaceForIO & chan, unsigned type, arrayElementCount count, +inline netSubscription * netSubscription::factory ( + tsFreeList < class netSubscription, 1024, epicsMutexNOOP > & freeList, + class privateInterfaceForIO & chan, unsigned type, arrayElementCount count, unsigned mask, cacStateNotify ¬ify ) { return new ( freeList ) netSubscription ( chan, type, @@ -260,43 +260,43 @@ inline unsigned netSubscription::getMask ( epicsGuard < epicsMutex > & ) const return this->mask; } -inline netReadNotifyIO * netReadNotifyIO::factory ( - tsFreeList < class netReadNotifyIO, 1024, epicsMutexNOOP > & freeList, +inline netReadNotifyIO * netReadNotifyIO::factory ( + tsFreeList < class netReadNotifyIO, 1024, epicsMutexNOOP > & freeList, privateInterfaceForIO & ioComplNotifIntf, cacReadNotify & notify ) { return new ( freeList ) netReadNotifyIO ( ioComplNotifIntf, notify ); } -inline void * netReadNotifyIO::operator new ( size_t size, +inline void * netReadNotifyIO::operator new ( size_t size, tsFreeList < class netReadNotifyIO, 1024, epicsMutexNOOP > & freeList ) { return freeList.allocate ( size ); } #if defined ( CXX_PLACEMENT_DELETE ) - inline void netReadNotifyIO::operator delete ( void *pCadaver, - tsFreeList < class netReadNotifyIO, 1024, epicsMutexNOOP > & freeList ) + inline void netReadNotifyIO::operator delete ( void *pCadaver, + tsFreeList < class netReadNotifyIO, 1024, epicsMutexNOOP > & freeList ) { freeList.release ( pCadaver ); } #endif -inline netWriteNotifyIO * netWriteNotifyIO::factory ( - tsFreeList < class netWriteNotifyIO, 1024, epicsMutexNOOP > & freeList, +inline netWriteNotifyIO * netWriteNotifyIO::factory ( + tsFreeList < class netWriteNotifyIO, 1024, epicsMutexNOOP > & freeList, privateInterfaceForIO & ioComplNotifyIntf, cacWriteNotify & notify ) { return new ( freeList ) netWriteNotifyIO ( ioComplNotifyIntf, notify ); } -inline void * netWriteNotifyIO::operator new ( size_t size, +inline void * netWriteNotifyIO::operator new ( size_t size, tsFreeList < class netWriteNotifyIO, 1024, epicsMutexNOOP > & freeList ) -{ +{ return freeList.allocate ( size ); } #if defined ( CXX_PLACEMENT_DELETE ) - inline void netWriteNotifyIO::operator delete ( void *pCadaver, - tsFreeList < class netWriteNotifyIO, 1024, epicsMutexNOOP > & freeList ) + inline void netWriteNotifyIO::operator delete ( void *pCadaver, + tsFreeList < class netWriteNotifyIO, 1024, epicsMutexNOOP > & freeList ) { freeList.release ( pCadaver ); } diff --git a/modules/ca/src/client/netReadNotifyIO.cpp b/modules/ca/src/client/netReadNotifyIO.cpp index 41199c1dd..7a61acbcf 100644 --- a/modules/ca/src/client/netReadNotifyIO.cpp +++ b/modules/ca/src/client/netReadNotifyIO.cpp @@ -28,8 +28,8 @@ #include "nciu.h" #include "cac.h" -netReadNotifyIO::netReadNotifyIO ( - privateInterfaceForIO & ioComplIntfIn, +netReadNotifyIO::netReadNotifyIO ( + privateInterfaceForIO & ioComplIntfIn, cacReadNotify & notify ) : notify ( notify ), privateChanForIO ( ioComplIntfIn ) { @@ -41,26 +41,26 @@ netReadNotifyIO::~netReadNotifyIO () void netReadNotifyIO::show ( unsigned /* level */ ) const { - ::printf ( "netReadNotifyIO at %p\n", + ::printf ( "netReadNotifyIO at %p\n", static_cast < const void * > ( this ) ); } -void netReadNotifyIO::show ( +void netReadNotifyIO::show ( epicsGuard < epicsMutex > &, unsigned level ) const { this->show ( level ); } -void netReadNotifyIO::destroy ( +void netReadNotifyIO::destroy ( epicsGuard < epicsMutex > & guard, cacRecycle & recycle ) { this->~netReadNotifyIO (); recycle.recycleReadNotifyIO ( guard, *this ); } -void netReadNotifyIO::completion ( - epicsGuard < epicsMutex > & guard, - cacRecycle & recycle, unsigned type, +void netReadNotifyIO::completion ( + epicsGuard < epicsMutex > & guard, + cacRecycle & recycle, unsigned type, arrayElementCount count, const void * pData ) { //guard.assertIdenticalMutex ( this->mutex ); @@ -81,28 +81,28 @@ void netReadNotifyIO::completion ( recycle.recycleReadNotifyIO ( guard, *this ); } -void netReadNotifyIO::exception ( - epicsGuard < epicsMutex > & guard, +void netReadNotifyIO::exception ( + epicsGuard < epicsMutex > & guard, cacRecycle & recycle, int status, const char *pContext ) { //guard.assertIdenticalMutex ( this->mutex ); this->privateChanForIO.ioCompletionNotify ( guard, *this ); - this->notify.exception ( + this->notify.exception ( guard, status, pContext, UINT_MAX, 0u ); this->~netReadNotifyIO (); recycle.recycleReadNotifyIO ( guard, *this ); } -void netReadNotifyIO::exception ( - epicsGuard < epicsMutex > & guard, +void netReadNotifyIO::exception ( + epicsGuard < epicsMutex > & guard, cacRecycle & recycle, - int status, const char *pContext, + int status, const char *pContext, unsigned type, arrayElementCount count ) { //guard.assertIdenticalMutex ( this->mutex ) this->privateChanForIO.ioCompletionNotify ( guard, *this ); - this->notify.exception ( + this->notify.exception ( guard, status, pContext, type, count ); this->~netReadNotifyIO (); recycle.recycleReadNotifyIO ( guard, *this ); diff --git a/modules/ca/src/client/netSubscription.cpp b/modules/ca/src/client/netSubscription.cpp index 78f0b71c8..78a0b1b6c 100644 --- a/modules/ca/src/client/netSubscription.cpp +++ b/modules/ca/src/client/netSubscription.cpp @@ -30,9 +30,9 @@ #include "db_access.h" // for dbf_type_to_text #include "caerr.h" -netSubscription::netSubscription ( - privateInterfaceForIO & chanIn, - unsigned typeIn, arrayElementCount countIn, +netSubscription::netSubscription ( + privateInterfaceForIO & chanIn, + unsigned typeIn, arrayElementCount countIn, unsigned maskIn, cacStateNotify & notifyIn ) : count ( countIn ), privateChanForIO ( chanIn ), notify ( notifyIn ), type ( typeIn ), mask ( maskIn ), @@ -46,11 +46,11 @@ netSubscription::netSubscription ( } } -netSubscription::~netSubscription () +netSubscription::~netSubscription () { } -void netSubscription::destroy ( +void netSubscription::destroy ( epicsGuard < epicsMutex > & guard, cacRecycle & recycle ) { this->~netSubscription (); @@ -64,26 +64,26 @@ class netSubscription * netSubscription::isSubscription () void netSubscription::show ( unsigned /* level */ ) const { - ::printf ( "event subscription IO at %p, type %s, element count %lu, mask %u\n", - static_cast < const void * > ( this ), - dbf_type_to_text ( static_cast < int > ( this->type ) ), + ::printf ( "event subscription IO at %p, type %s, element count %lu, mask %u\n", + static_cast < const void * > ( this ), + dbf_type_to_text ( static_cast < int > ( this->type ) ), this->count, this->mask ); } -void netSubscription::show ( +void netSubscription::show ( epicsGuard < epicsMutex > &, unsigned level ) const { this->show ( level ); } -void netSubscription::completion ( +void netSubscription::completion ( epicsGuard < epicsMutex > &, cacRecycle & ) { errlogPrintf ( "subscription update w/o data ?\n" ); } -void netSubscription::exception ( - epicsGuard < epicsMutex > & guard, cacRecycle & recycle, +void netSubscription::exception ( + epicsGuard < epicsMutex > & guard, cacRecycle & recycle, int status, const char * pContext ) { if ( status == ECA_DISCONN ) { @@ -91,7 +91,7 @@ void netSubscription::exception ( } if ( status == ECA_CHANDESTROY ) { this->privateChanForIO.ioCompletionNotify ( guard, *this ); - this->notify.exception ( + this->notify.exception ( guard, status, pContext, UINT_MAX, 0 ); this->~netSubscription (); recycle.recycleSubscription ( guard, *this ); @@ -99,15 +99,15 @@ void netSubscription::exception ( else { // guard.assertIdenticalMutex ( this->mutex ); if ( this->privateChanForIO.connected ( guard ) ) { - this->notify.exception ( + this->notify.exception ( guard, status, pContext, UINT_MAX, 0 ); } } } -void netSubscription::exception ( - epicsGuard < epicsMutex > & guard, - cacRecycle & recycle, int status, const char * pContext, +void netSubscription::exception ( + epicsGuard < epicsMutex > & guard, + cacRecycle & recycle, int status, const char * pContext, unsigned typeIn, arrayElementCount countIn ) { if ( status == ECA_DISCONN ) { @@ -115,7 +115,7 @@ void netSubscription::exception ( } if ( status == ECA_CHANDESTROY ) { this->privateChanForIO.ioCompletionNotify ( guard, *this ); - this->notify.exception ( + this->notify.exception ( guard, status, pContext, UINT_MAX, 0 ); this->~netSubscription (); recycle.recycleSubscription ( guard, *this ); @@ -123,20 +123,20 @@ void netSubscription::exception ( else { //guard.assertIdenticalMutex ( this->mutex ); if ( this->privateChanForIO.connected ( guard ) ) { - this->notify.exception ( + this->notify.exception ( guard, status, pContext, typeIn, countIn ); } } } -void netSubscription::completion ( +void netSubscription::completion ( epicsGuard < epicsMutex > & guard, cacRecycle &, - unsigned typeIn, arrayElementCount countIn, + unsigned typeIn, arrayElementCount countIn, const void * pDataIn ) { // guard.assertIdenticalMutex ( this->mutex ); if ( this->privateChanForIO.connected ( guard ) ) { - this->notify.current ( + this->notify.current ( guard, typeIn, countIn, pDataIn ); } } @@ -145,17 +145,17 @@ void netSubscription::subscribeIfRequired ( epicsGuard < epicsMutex > & guard, nciu & chan ) { if ( ! this->subscribed ) { - chan.getPIIU(guard)->subscriptionRequest ( + chan.getPIIU(guard)->subscriptionRequest ( guard, chan, *this ); this->subscribed = true; } } -void netSubscription::unsubscribeIfRequired ( +void netSubscription::unsubscribeIfRequired ( epicsGuard < epicsMutex > & guard, nciu & chan ) { if ( this->subscribed ) { - chan.getPIIU(guard)->subscriptionCancelRequest ( + chan.getPIIU(guard)->subscriptionCancelRequest ( guard, chan, *this ); this->subscribed = false; } @@ -164,7 +164,7 @@ void netSubscription::unsubscribeIfRequired ( void netSubscription::forceSubscriptionUpdate ( epicsGuard < epicsMutex > & guard, nciu & chan ) { - chan.getPIIU(guard)->subscriptionUpdateRequest ( + chan.getPIIU(guard)->subscriptionUpdateRequest ( guard, chan, *this ); } diff --git a/modules/ca/src/client/netWriteNotifyIO.cpp b/modules/ca/src/client/netWriteNotifyIO.cpp index 045217e66..1e11a6e62 100644 --- a/modules/ca/src/client/netWriteNotifyIO.cpp +++ b/modules/ca/src/client/netWriteNotifyIO.cpp @@ -28,7 +28,7 @@ #include "nciu.h" #include "cac.h" -netWriteNotifyIO::netWriteNotifyIO ( +netWriteNotifyIO::netWriteNotifyIO ( privateInterfaceForIO & ioComplIntf, cacWriteNotify & notifyIn ) : notify ( notifyIn ), privateChanForIO ( ioComplIntf ) { @@ -40,19 +40,19 @@ netWriteNotifyIO::~netWriteNotifyIO () void netWriteNotifyIO::show ( unsigned /* level */ ) const { - ::printf ( "read write notify IO at %p\n", + ::printf ( "read write notify IO at %p\n", static_cast < const void * > ( this ) ); } -void netWriteNotifyIO::show ( - epicsGuard < epicsMutex > &, +void netWriteNotifyIO::show ( + epicsGuard < epicsMutex > &, unsigned level ) const { this->show ( level ); } -void netWriteNotifyIO::destroy ( - epicsGuard < epicsMutex > & guard, +void netWriteNotifyIO::destroy ( + epicsGuard < epicsMutex > & guard, cacRecycle & recycle ) { this->~netWriteNotifyIO (); @@ -69,10 +69,10 @@ void netWriteNotifyIO::completion ( recycle.recycleWriteNotifyIO ( guard, *this ); } -void netWriteNotifyIO::completion ( - epicsGuard < epicsMutex > & guard, +void netWriteNotifyIO::completion ( + epicsGuard < epicsMutex > & guard, cacRecycle & recycle, - unsigned /* type */, arrayElementCount /* count */, + unsigned /* type */, arrayElementCount /* count */, const void * /* pData */ ) { //this->chan.getClient().printf ( "Write response with data ?\n" ); @@ -81,26 +81,26 @@ void netWriteNotifyIO::completion ( recycle.recycleWriteNotifyIO ( guard, *this ); } -void netWriteNotifyIO::exception ( +void netWriteNotifyIO::exception ( epicsGuard < epicsMutex > & guard, cacRecycle & recycle, int status, const char * pContext ) { this->privateChanForIO.ioCompletionNotify ( guard, *this ); - this->notify.exception ( + this->notify.exception ( guard, status, pContext, UINT_MAX, 0u ); this->~netWriteNotifyIO (); recycle.recycleWriteNotifyIO ( guard, *this ); } -void netWriteNotifyIO::exception ( - epicsGuard < epicsMutex > & guard, +void netWriteNotifyIO::exception ( + epicsGuard < epicsMutex > & guard, cacRecycle & recycle, - int status, const char *pContext, + int status, const char *pContext, unsigned type, arrayElementCount count ) { this->privateChanForIO.ioCompletionNotify ( guard, *this ); - this->notify.exception ( + this->notify.exception ( guard, status, pContext, type, count ); this->~netWriteNotifyIO (); recycle.recycleWriteNotifyIO ( guard, *this ); diff --git a/modules/ca/src/client/net_convert.h b/modules/ca/src/client/net_convert.h index 1c3aac5df..24640dbc4 100644 --- a/modules/ca/src/client/net_convert.h +++ b/modules/ca/src/client/net_convert.h @@ -8,7 +8,7 @@ \*************************************************************************/ /* * - * Author: J. Hill + * Author: J. Hill * */ @@ -25,7 +25,7 @@ extern "C" { typedef unsigned long arrayElementCount; LIBCA_API int caNetConvert ( - unsigned type, const void *pSrc, void *pDest, + unsigned type, const void *pSrc, void *pDest, int hton, arrayElementCount count ); #ifdef __cplusplus diff --git a/modules/ca/src/client/netiiu.cpp b/modules/ca/src/client/netiiu.cpp index cfd4b8091..4f4204da8 100644 --- a/modules/ca/src/client/netiiu.cpp +++ b/modules/ca/src/client/netiiu.cpp @@ -7,7 +7,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* * * L O S A L A M O S * Los Alamos National Laboratory @@ -19,7 +19,7 @@ */ #include -#include // vxWorks 6.0 requires this include +#include // vxWorks 6.0 requires this include #include #include @@ -46,51 +46,51 @@ bool netiiu::ca_v41_ok ( return false; } -void netiiu::writeRequest ( - epicsGuard < epicsMutex > &, nciu &, +void netiiu::writeRequest ( + epicsGuard < epicsMutex > &, nciu &, unsigned, arrayElementCount, const void * ) { throw cacChannel::notConnected(); } -void netiiu::writeNotifyRequest ( - epicsGuard < epicsMutex > &, - nciu &, netWriteNotifyIO &, unsigned, +void netiiu::writeNotifyRequest ( + epicsGuard < epicsMutex > &, + nciu &, netWriteNotifyIO &, unsigned, arrayElementCount, const void * ) { throw cacChannel::notConnected(); } -void netiiu::readNotifyRequest ( - epicsGuard < epicsMutex > &, +void netiiu::readNotifyRequest ( + epicsGuard < epicsMutex > &, nciu &, netReadNotifyIO &, unsigned, arrayElementCount ) { throw cacChannel::notConnected(); } -void netiiu::clearChannelRequest ( +void netiiu::clearChannelRequest ( epicsGuard < epicsMutex > &, ca_uint32_t, ca_uint32_t ) { } -void netiiu::subscriptionRequest ( +void netiiu::subscriptionRequest ( epicsGuard < epicsMutex > &, nciu &, netSubscription & ) { } -void netiiu::subscriptionCancelRequest ( +void netiiu::subscriptionCancelRequest ( epicsGuard < epicsMutex > &, nciu &, netSubscription & ) { } -void netiiu::subscriptionUpdateRequest ( +void netiiu::subscriptionUpdateRequest ( epicsGuard < epicsMutex > &, nciu &, netSubscription & ) { } static const char * const pHostNameNetIIU = ""; -unsigned netiiu::getHostName ( +unsigned netiiu::getHostName ( epicsGuard < epicsMutex > &, char * pBuf, unsigned bufLen ) const throw () { @@ -123,18 +123,18 @@ osiSockAddr netiiu::getNetworkAddress ( return addr; } -void netiiu::flushRequest ( +void netiiu::flushRequest ( epicsGuard < epicsMutex > & ) { } -unsigned netiiu::requestMessageBytesPending ( +unsigned netiiu::requestMessageBytesPending ( epicsGuard < epicsMutex > & ) { return 0u; } -void netiiu::flush ( +void netiiu::flush ( epicsGuard < epicsMutex > & ) { } @@ -144,7 +144,7 @@ void netiiu::requestRecvProcessPostponedFlush ( { } -void netiiu::uninstallChan ( +void netiiu::uninstallChan ( epicsGuard < epicsMutex > &, nciu & ) { throw cacChannel::notConnected(); @@ -156,15 +156,15 @@ double netiiu::receiveWatchdogDelay ( return - DBL_MAX; } -void netiiu::uninstallChanDueToSuccessfulSearchResponse ( +void netiiu::uninstallChanDueToSuccessfulSearchResponse ( epicsGuard < epicsMutex > &, nciu &, const epicsTime & ) { - throw std::runtime_error ( + throw std::runtime_error ( "search response occured when not attached to udpiiu?" ); } bool netiiu::searchMsg ( - epicsGuard < epicsMutex > &, ca_uint32_t /* id */, + epicsGuard < epicsMutex > &, ca_uint32_t /* id */, const char * /* pName */, unsigned /* nameLength */ ) { return false; diff --git a/modules/ca/src/client/netiiu.h b/modules/ca/src/client/netiiu.h index 7c2ca2cae..e017153df 100644 --- a/modules/ca/src/client/netiiu.h +++ b/modules/ca/src/client/netiiu.h @@ -6,19 +6,19 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* + * * - * * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 - * + * * Copyright, 1986, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #ifndef INC_netiiu_H @@ -37,8 +37,8 @@ class nciu; class netiiu { public: virtual ~netiiu () = 0; - virtual unsigned getHostName ( - epicsGuard < epicsMutex > &, char * pBuf, + virtual unsigned getHostName ( + epicsGuard < epicsMutex > &, char * pBuf, unsigned bufLength ) const throw () = 0; virtual const char * pHostName ( epicsGuard < epicsMutex > & ) const throw () = 0; @@ -46,50 +46,50 @@ public: epicsGuard < epicsMutex > & ) const = 0; virtual bool ca_v42_ok ( epicsGuard < epicsMutex > & ) const = 0; - virtual unsigned requestMessageBytesPending ( + virtual unsigned requestMessageBytesPending ( epicsGuard < epicsMutex > & mutualExclusionGuard ) = 0; - virtual void flush ( + virtual void flush ( epicsGuard < epicsMutex > & mutualExclusionGuard ) = 0; - virtual void writeRequest ( - epicsGuard < epicsMutex > &, nciu &, - unsigned type, arrayElementCount nElem, + virtual void writeRequest ( + epicsGuard < epicsMutex > &, nciu &, + unsigned type, arrayElementCount nElem, const void *pValue ) = 0; - virtual void writeNotifyRequest ( - epicsGuard < epicsMutex > &, - nciu &, netWriteNotifyIO &, - unsigned type, arrayElementCount nElem, + virtual void writeNotifyRequest ( + epicsGuard < epicsMutex > &, + nciu &, netWriteNotifyIO &, + unsigned type, arrayElementCount nElem, const void *pValue ) = 0; - virtual void readNotifyRequest ( - epicsGuard < epicsMutex > &, nciu &, - netReadNotifyIO &, unsigned type, + virtual void readNotifyRequest ( + epicsGuard < epicsMutex > &, nciu &, + netReadNotifyIO &, unsigned type, arrayElementCount nElem ) = 0; - virtual void clearChannelRequest ( - epicsGuard < epicsMutex > &, + virtual void clearChannelRequest ( + epicsGuard < epicsMutex > &, ca_uint32_t sid, ca_uint32_t cid ) = 0; - virtual void subscriptionRequest ( - epicsGuard < epicsMutex > &, + virtual void subscriptionRequest ( + epicsGuard < epicsMutex > &, nciu &, netSubscription & ) = 0; - virtual void subscriptionUpdateRequest ( - epicsGuard < epicsMutex > &, + virtual void subscriptionUpdateRequest ( + epicsGuard < epicsMutex > &, nciu &, netSubscription & ) = 0; - virtual void subscriptionCancelRequest ( - epicsGuard < epicsMutex > &, + virtual void subscriptionCancelRequest ( + epicsGuard < epicsMutex > &, nciu & chan, netSubscription & subscr ) = 0; - virtual void flushRequest ( + virtual void flushRequest ( epicsGuard < epicsMutex > & ) = 0; virtual void requestRecvProcessPostponedFlush ( epicsGuard < epicsMutex > & ) = 0; virtual osiSockAddr getNetworkAddress ( epicsGuard < epicsMutex > & ) const = 0; - virtual void uninstallChan ( + virtual void uninstallChan ( epicsGuard < epicsMutex > &, nciu & ) = 0; - virtual void uninstallChanDueToSuccessfulSearchResponse ( - epicsGuard < epicsMutex > &, nciu &, + virtual void uninstallChanDueToSuccessfulSearchResponse ( + epicsGuard < epicsMutex > &, nciu &, const class epicsTime & currentTime ) = 0; virtual double receiveWatchdogDelay ( epicsGuard < epicsMutex > & ) const = 0; virtual bool searchMsg ( - epicsGuard < epicsMutex > &, ca_uint32_t id, + epicsGuard < epicsMutex > &, ca_uint32_t id, const char * pName, unsigned nameLength ) = 0; }; diff --git a/modules/ca/src/client/noopiiu.cpp b/modules/ca/src/client/noopiiu.cpp index 84edb3828..14c878761 100644 --- a/modules/ca/src/client/noopiiu.cpp +++ b/modules/ca/src/client/noopiiu.cpp @@ -6,19 +6,19 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* + * * - * * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 - * + * * Copyright, 1986, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #include "osiSock.h" @@ -27,11 +27,11 @@ noopiiu noopIIU; -noopiiu::~noopiiu () +noopiiu::~noopiiu () { } -unsigned noopiiu::getHostName ( +unsigned noopiiu::getHostName ( epicsGuard < epicsMutex > & cacGuard, char * pBuf, unsigned bufLength ) const throw () { @@ -56,71 +56,71 @@ bool noopiiu::ca_v41_ok ( return netiiu::ca_v41_ok ( cacGuard ); } -void noopiiu::writeRequest ( - epicsGuard < epicsMutex > & guard, - nciu & chan, unsigned type, +void noopiiu::writeRequest ( + epicsGuard < epicsMutex > & guard, + nciu & chan, unsigned type, arrayElementCount nElem, const void * pValue ) { netiiu::writeRequest ( guard, chan, type, nElem, pValue ); } -void noopiiu::writeNotifyRequest ( - epicsGuard < epicsMutex > & guard, nciu & chan, - netWriteNotifyIO & io, unsigned type, +void noopiiu::writeNotifyRequest ( + epicsGuard < epicsMutex > & guard, nciu & chan, + netWriteNotifyIO & io, unsigned type, arrayElementCount nElem, const void *pValue ) { netiiu::writeNotifyRequest ( guard, chan, io, type, nElem, pValue ); } -void noopiiu::readNotifyRequest ( - epicsGuard < epicsMutex > & guard, nciu & chan, +void noopiiu::readNotifyRequest ( + epicsGuard < epicsMutex > & guard, nciu & chan, netReadNotifyIO & io, unsigned type, arrayElementCount nElem ) { netiiu::readNotifyRequest ( guard, chan, io, type, nElem ); } -void noopiiu::clearChannelRequest ( - epicsGuard < epicsMutex > & guard, +void noopiiu::clearChannelRequest ( + epicsGuard < epicsMutex > & guard, ca_uint32_t sid, ca_uint32_t cid ) { netiiu::clearChannelRequest ( guard, sid, cid ); } -void noopiiu::subscriptionRequest ( - epicsGuard < epicsMutex > & guard, nciu & chan, +void noopiiu::subscriptionRequest ( + epicsGuard < epicsMutex > & guard, nciu & chan, netSubscription & subscr ) { netiiu::subscriptionRequest ( guard, chan, subscr ); } -void noopiiu::subscriptionUpdateRequest ( - epicsGuard < epicsMutex > & guard, nciu & chan, +void noopiiu::subscriptionUpdateRequest ( + epicsGuard < epicsMutex > & guard, nciu & chan, netSubscription & subscr ) { netiiu::subscriptionUpdateRequest ( guard, chan, subscr ); } -void noopiiu::subscriptionCancelRequest ( - epicsGuard < epicsMutex > & guard, +void noopiiu::subscriptionCancelRequest ( + epicsGuard < epicsMutex > & guard, nciu & chan, netSubscription & subscr ) { netiiu::subscriptionCancelRequest ( guard, chan, subscr ); } -void noopiiu::flushRequest ( +void noopiiu::flushRequest ( epicsGuard < epicsMutex > & guard ) { netiiu::flushRequest ( guard ); } -unsigned noopiiu::requestMessageBytesPending ( +unsigned noopiiu::requestMessageBytesPending ( epicsGuard < epicsMutex > & guard ) { return netiiu::requestMessageBytesPending ( guard ); } -void noopiiu::flush ( +void noopiiu::flush ( epicsGuard < epicsMutex > & guard ) { netiiu::flush ( guard ); @@ -144,14 +144,14 @@ double noopiiu::receiveWatchdogDelay ( return netiiu::receiveWatchdogDelay ( guard ); } -void noopiiu::uninstallChan ( +void noopiiu::uninstallChan ( epicsGuard < epicsMutex > &, nciu & ) { // intentionally does not call default in netiiu } -void noopiiu::uninstallChanDueToSuccessfulSearchResponse ( - epicsGuard < epicsMutex > & guard, nciu & chan, +void noopiiu::uninstallChanDueToSuccessfulSearchResponse ( + epicsGuard < epicsMutex > & guard, nciu & chan, const class epicsTime & currentTime ) { netiiu::uninstallChanDueToSuccessfulSearchResponse ( @@ -159,7 +159,7 @@ void noopiiu::uninstallChanDueToSuccessfulSearchResponse ( } bool noopiiu::searchMsg ( - epicsGuard < epicsMutex > & guard, ca_uint32_t id, + epicsGuard < epicsMutex > & guard, ca_uint32_t id, const char * pName, unsigned nameLength ) { return netiiu::searchMsg ( diff --git a/modules/ca/src/client/noopiiu.h b/modules/ca/src/client/noopiiu.h index f6ed87fcb..9c761f83f 100644 --- a/modules/ca/src/client/noopiiu.h +++ b/modules/ca/src/client/noopiiu.h @@ -6,19 +6,19 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* + * * - * * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 - * + * * Copyright, 1986, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #ifndef INC_noopiiu_H @@ -29,60 +29,60 @@ class noopiiu : public netiiu { public: ~noopiiu (); - unsigned getHostName ( - epicsGuard < epicsMutex > &, char * pBuf, + unsigned getHostName ( + epicsGuard < epicsMutex > &, char * pBuf, unsigned bufLength ) const throw (); const char * pHostName ( - epicsGuard < epicsMutex > & ) const throw (); + epicsGuard < epicsMutex > & ) const throw (); bool ca_v41_ok ( epicsGuard < epicsMutex > & ) const; bool ca_v42_ok ( epicsGuard < epicsMutex > & ) const; - unsigned requestMessageBytesPending ( + unsigned requestMessageBytesPending ( epicsGuard < epicsMutex > & mutualExclusionGuard ); - void flush ( + void flush ( epicsGuard < epicsMutex > & mutualExclusionGuard ); - void writeRequest ( - epicsGuard < epicsMutex > &, nciu &, - unsigned type, arrayElementCount nElem, + void writeRequest ( + epicsGuard < epicsMutex > &, nciu &, + unsigned type, arrayElementCount nElem, const void *pValue ); - void writeNotifyRequest ( - epicsGuard < epicsMutex > &, - nciu &, netWriteNotifyIO &, - unsigned type, arrayElementCount nElem, + void writeNotifyRequest ( + epicsGuard < epicsMutex > &, + nciu &, netWriteNotifyIO &, + unsigned type, arrayElementCount nElem, const void *pValue ); - void readNotifyRequest ( - epicsGuard < epicsMutex > &, nciu &, - netReadNotifyIO &, unsigned type, + void readNotifyRequest ( + epicsGuard < epicsMutex > &, nciu &, + netReadNotifyIO &, unsigned type, arrayElementCount nElem ); - void clearChannelRequest ( - epicsGuard < epicsMutex > &, + void clearChannelRequest ( + epicsGuard < epicsMutex > &, ca_uint32_t sid, ca_uint32_t cid ); - void subscriptionRequest ( - epicsGuard < epicsMutex > &, + void subscriptionRequest ( + epicsGuard < epicsMutex > &, nciu &, netSubscription & ); - void subscriptionUpdateRequest ( - epicsGuard < epicsMutex > &, + void subscriptionUpdateRequest ( + epicsGuard < epicsMutex > &, nciu &, netSubscription & ); - void subscriptionCancelRequest ( - epicsGuard < epicsMutex > &, + void subscriptionCancelRequest ( + epicsGuard < epicsMutex > &, nciu & chan, netSubscription & subscr ); - void flushRequest ( + void flushRequest ( epicsGuard < epicsMutex > & ); void requestRecvProcessPostponedFlush ( epicsGuard < epicsMutex > & ); osiSockAddr getNetworkAddress ( epicsGuard < epicsMutex > & ) const; - void uninstallChan ( - epicsGuard < epicsMutex > & mutex, + void uninstallChan ( + epicsGuard < epicsMutex > & mutex, nciu & ); - void uninstallChanDueToSuccessfulSearchResponse ( - epicsGuard < epicsMutex > &, nciu &, + void uninstallChanDueToSuccessfulSearchResponse ( + epicsGuard < epicsMutex > &, nciu &, const class epicsTime & currentTime ); double receiveWatchdogDelay ( epicsGuard < epicsMutex > & ) const; bool searchMsg ( - epicsGuard < epicsMutex > &, ca_uint32_t id, + epicsGuard < epicsMutex > &, ca_uint32_t id, const char * pName, unsigned nameLength ); }; diff --git a/modules/ca/src/client/oldAccess.h b/modules/ca/src/client/oldAccess.h index 4fdb89a33..cefa5f577 100644 --- a/modules/ca/src/client/oldAccess.h +++ b/modules/ca/src/client/oldAccess.h @@ -17,9 +17,9 @@ * Copyright, The Regents of the University of California. * * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #ifndef INC_oldAccess_H @@ -185,8 +185,8 @@ private: void exception ( epicsGuard < epicsMutex > &, int status, const char *pContext, unsigned type, arrayElementCount count ); - getCopy ( const getCopy & ); - getCopy & operator = ( const getCopy & ); + getCopy ( const getCopy & ); + getCopy & operator = ( const getCopy & ); void operator delete ( void * ); }; @@ -210,8 +210,8 @@ private: void exception ( epicsGuard < epicsMutex > &, int status, const char * pContext, unsigned type, arrayElementCount count ); - getCallback ( const getCallback & ); - getCallback & operator = ( const getCallback & ); + getCallback ( const getCallback & ); + getCallback & operator = ( const getCallback & ); void operator delete ( void * ); }; @@ -233,8 +233,8 @@ private: void exception ( epicsGuard < epicsMutex > &, int status, const char *pContext, unsigned type, arrayElementCount count ); - putCallback ( const putCallback & ); - putCallback & operator = ( const putCallback & ); + putCallback ( const putCallback & ); + putCallback & operator = ( const putCallback & ); void operator delete ( void * ); }; @@ -273,8 +273,8 @@ private: void exception ( epicsGuard < epicsMutex > &, int status, const char *pContext, unsigned type, arrayElementCount count ); - oldSubscription ( const oldSubscription & ); - oldSubscription & operator = ( const oldSubscription & ); + oldSubscription ( const oldSubscription & ); + oldSubscription & operator = ( const oldSubscription & ); void operator delete ( void * ); }; @@ -374,7 +374,7 @@ public: friend int ca_sync_group_destroy ( CallbackGuard & cbGuard, epicsGuard < epicsMutex > & guard, ca_client_context & cac, const CA_SYNC_GID gid ); - friend void sync_group_reset ( ca_client_context & client, + friend void sync_group_reset ( ca_client_context & client, CASG & sg ); // exceptions @@ -571,7 +571,7 @@ inline unsigned ca_client_context::sequenceNumberOfOutstandingIO ( } template < class T > -void ca_client_context :: whenThereIsAnExceptionDestroySyncGroupIO ( +void ca_client_context :: whenThereIsAnExceptionDestroySyncGroupIO ( epicsGuard < epicsMutex > & guard, T & io ) { if ( this->pCallbackGuard.get() && diff --git a/modules/ca/src/client/oldChannelNotify.cpp b/modules/ca/src/client/oldChannelNotify.cpp index 2c546edbb..92f7b576b 100644 --- a/modules/ca/src/client/oldChannelNotify.cpp +++ b/modules/ca/src/client/oldChannelNotify.cpp @@ -16,9 +16,9 @@ * Copyright, 1986, The Regents of the University of California. * * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #include diff --git a/modules/ca/src/client/oldSubscription.cpp b/modules/ca/src/client/oldSubscription.cpp index 39e6bb002..13889d31d 100644 --- a/modules/ca/src/client/oldSubscription.cpp +++ b/modules/ca/src/client/oldSubscription.cpp @@ -7,7 +7,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* * * L O S A L A M O S * Los Alamos National Laboratory @@ -26,12 +26,12 @@ #include "oldAccess.h" oldSubscription::oldSubscription ( - epicsGuard < epicsMutex > & guard, - oldChannelNotify & chanIn, cacChannel & io, + epicsGuard < epicsMutex > & guard, + oldChannelNotify & chanIn, cacChannel & io, unsigned type, arrayElementCount nElem, unsigned mask, caEventCallBackFunc * pFuncIn, void * pPrivateIn, evid * pEventId ) : - chan ( chanIn ), id ( UINT_MAX ), pFunc ( pFuncIn ), + chan ( chanIn ), id ( UINT_MAX ), pFunc ( pFuncIn ), pPrivate ( pPrivateIn ) { // The users event id *must* be set prior to potentially @@ -49,7 +49,7 @@ oldSubscription::~oldSubscription () { } -void oldSubscription::current ( +void oldSubscription::current ( epicsGuard < epicsMutex > & guard, unsigned type, arrayElementCount count, const void * pData ) { @@ -66,10 +66,10 @@ void oldSubscription::current ( ( *pFuncTmp ) ( args ); } } - + void oldSubscription::exception ( epicsGuard < epicsMutex > & guard, - int status, const char * /* pContext */, + int status, const char * /* pContext */, unsigned type, arrayElementCount count ) { if ( status == ECA_CHANDESTROY ) { diff --git a/modules/ca/src/client/putCallback.cpp b/modules/ca/src/client/putCallback.cpp index 50f4542aa..1815afef1 100644 --- a/modules/ca/src/client/putCallback.cpp +++ b/modules/ca/src/client/putCallback.cpp @@ -7,19 +7,19 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* + * * - * * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 - * + * * Copyright, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #include @@ -30,8 +30,8 @@ #include "iocinf.h" #include "oldAccess.h" -putCallback::putCallback ( - oldChannelNotify & chanIn, caEventCallBackFunc * pFuncIn, +putCallback::putCallback ( + oldChannelNotify & chanIn, caEventCallBackFunc * pFuncIn, void * pPrivateIn ) : chan ( chanIn ), pFunc ( pFuncIn ), pPrivate ( pPrivateIn ) { @@ -61,9 +61,9 @@ void putCallback::completion ( epicsGuard < epicsMutex > & guard ) } } -void putCallback::exception ( +void putCallback::exception ( epicsGuard < epicsMutex > & guard, - int status, const char * /* pContext */, + int status, const char * /* pContext */, unsigned type, arrayElementCount count ) { if ( status != ECA_CHANDESTROY ) { diff --git a/modules/ca/src/client/repeater.cpp b/modules/ca/src/client/repeater.cpp index 418174198..449d5febc 100644 --- a/modules/ca/src/client/repeater.cpp +++ b/modules/ca/src/client/repeater.cpp @@ -33,7 +33,7 @@ * received it goes to all sockets on the same port, but if a unicast is * received it goes to only one of the sockets on the same port (we can only * guess at which one it will be). - * + * * I have observed this behavior under winsock II: * o only one of the sockets on the same port receives the message if we * send to the loopback address @@ -76,7 +76,7 @@ #include "addrList.h" -/* +/* * these can be external since there is only one instance * per machine so we dont care about reentrancy */ @@ -89,7 +89,7 @@ static const unsigned short PORT_ANY = 0u; */ static int makeSocket ( unsigned short port, bool reuseAddr, SOCKET * pSock ) { - SOCKET sock = epicsSocketCreate ( AF_INET, SOCK_DGRAM, 0 ); + SOCKET sock = epicsSocketCreate ( AF_INET, SOCK_DGRAM, 0 ); if ( sock == INVALID_SOCKET ) { *pSock = sock; @@ -108,8 +108,8 @@ static int makeSocket ( unsigned short port, bool reuseAddr, SOCKET * pSock ) memset ( (char *) &bd, 0, sizeof (bd) ); bd.ia.sin_family = AF_INET; - bd.ia.sin_addr.s_addr = htonl ( INADDR_ANY ); - bd.ia.sin_port = htons ( port ); + bd.ia.sin_addr.s_addr = htonl ( INADDR_ANY ); + bd.ia.sin_port = htons ( port ); status = bind ( sock, &bd.sa, (int) sizeof(bd) ); if ( status < 0 ) { status = SOCKERRNO; @@ -139,7 +139,7 @@ bool repeaterClient::connect () if ( int sockerrno = makeSocket ( PORT_ANY, false, & this->sock ) ) { char sockErrBuf[64]; - epicsSocketConvertErrorToString ( + epicsSocketConvertErrorToString ( sockErrBuf, sizeof ( sockErrBuf ), sockerrno ); fprintf ( stderr, "%s: no client sock because \"%s\"\n", __FILE__, sockErrBuf ); @@ -149,7 +149,7 @@ bool repeaterClient::connect () status = ::connect ( this->sock, &this->from.sa, sizeof ( this->from.sa ) ); if ( status < 0 ) { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); fprintf ( stderr, "%s: unable to connect client sock because \"%s\"\n", __FILE__, sockErrBuf ); @@ -178,7 +178,7 @@ bool repeaterClient::sendConfirm () } else { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); debugPrintf ( ( "CA Repeater: confirm req err was \"%s\"\n", sockErrBuf) ); return false; @@ -227,7 +227,7 @@ repeaterClient::~repeaterClient () } void repeaterClient::operator delete ( void * ) -{ +{ // Visual C++ .net appears to require operator delete if // placement operator delete is defined? I smell a ms rat // because if I declare placement new and delete, but @@ -237,16 +237,16 @@ void repeaterClient::operator delete ( void * ) __FILE__, __LINE__ ); } -void * repeaterClient::operator new ( size_t size, +void * repeaterClient::operator new ( size_t size, tsFreeList < repeaterClient, 0x20 > & freeList ) -{ +{ return freeList.allocate ( size ); } #ifdef CXX_PLACEMENT_DELETE -void repeaterClient::operator delete ( void *pCadaver, - tsFreeList < repeaterClient, 0x20 > & freeList ) -{ +void repeaterClient::operator delete ( void *pCadaver, + tsFreeList < repeaterClient, 0x20 > & freeList ) +{ freeList.release ( pCadaver ); } #endif @@ -326,7 +326,7 @@ static void verifyClients ( tsFreeList < repeaterClient, 0x20 > & freeList ) /* * fanOut() */ -static void fanOut ( const osiSockAddr & from, const void * pMsg, +static void fanOut ( const osiSockAddr & from, const void * pMsg, unsigned msgSize, tsFreeList < repeaterClient, 0x20 > & freeList ) { static tsDLList < repeaterClient > theClients; @@ -354,7 +354,7 @@ static void fanOut ( const osiSockAddr & from, const void * pMsg, /* * register_new_client() */ -static void register_new_client ( osiSockAddr & from, +static void register_new_client ( osiSockAddr & from, tsFreeList < repeaterClient, 0x20 > & freeList ) { bool newClient = false; @@ -375,7 +375,7 @@ static void register_new_client ( osiSockAddr & from, SOCKET sock; if ( int sockerrno = makeSocket ( PORT_ANY, true, & sock ) ) { char sockErrBuf[64]; - epicsSocketConvertErrorToString ( + epicsSocketConvertErrorToString ( sockErrBuf, sizeof ( sockErrBuf ), sockerrno ); fprintf ( stderr, "%s: Unable to create repeater bind test socket because \"%s\"\n", __FILE__, sockErrBuf ); @@ -391,7 +391,7 @@ static void register_new_client ( osiSockAddr & from, * repeater would not always allow the loopback address * as a local client address so current clients alternate * between the address of the first non-loopback interface - * found and the loopback addresss when subscribing with + * found and the loopback addresss when subscribing with * the CA repeater until all CA repeaters have been updated * to current code. */ @@ -418,8 +418,8 @@ static void register_new_client ( osiSockAddr & from, break; } pclient++; - } - + } + repeaterClient *pNewClient; if ( pclient.valid () ) { pNewClient = pclient.pointer (); @@ -435,7 +435,7 @@ static void register_new_client ( osiSockAddr & from, freeList.release ( pNewClient ); return; } - client_list.add ( *pNewClient ); + client_list.add ( *pNewClient ); newClient = true; } @@ -451,7 +451,7 @@ static void register_new_client ( osiSockAddr & from, } /* - * send a noop message to all other clients so that we dont + * send a noop message to all other clients so that we dont * accumulate sockets when there are no beacons */ caHdr noop; @@ -479,14 +479,14 @@ static void register_new_client ( osiSockAddr & from, /* * ca_repeater () */ -void ca_repeater () +void ca_repeater () { tsFreeList < repeaterClient, 0x20 > freeList; int size; SOCKET sock; osiSockAddr from; unsigned short port; - char * pBuf; + char * pBuf; pBuf = new char [MAX_UDP_RECV]; @@ -508,7 +508,7 @@ void ca_repeater () return; } char sockErrBuf[64]; - epicsSocketConvertErrorToString ( + epicsSocketConvertErrorToString ( sockErrBuf, sizeof ( sockErrBuf ), sockerrno ); fprintf ( stderr, "%s: Unable to create repeater socket because \"%s\" - fatal\n", __FILE__, sockErrBuf ); @@ -584,7 +584,7 @@ void ca_repeater () continue; } char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); fprintf ( stderr, "CA Repeater: unexpected UDP recv err: %s\n", sockErrBuf ); @@ -621,7 +621,7 @@ void ca_repeater () continue; } - fanOut ( from, pMsg, size, freeList ); + fanOut ( from, pMsg, size, freeList ); } } diff --git a/modules/ca/src/client/repeaterClient.h b/modules/ca/src/client/repeaterClient.h index 7a028810f..eb86d6cf1 100644 --- a/modules/ca/src/client/repeaterClient.h +++ b/modules/ca/src/client/repeaterClient.h @@ -7,19 +7,19 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* + * * - * * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 - * + * * Copyright, 1986, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #ifndef INC_repeaterClient_H @@ -47,9 +47,9 @@ public: bool verify (); bool identicalAddress ( const osiSockAddr &from ); bool identicalPort ( const osiSockAddr &from ); - void * operator new ( size_t size, + void * operator new ( size_t size, tsFreeList < repeaterClient, 0x20 > & ); - epicsPlacementDeleteOperator (( void *, + epicsPlacementDeleteOperator (( void *, tsFreeList < repeaterClient, 0x20 > & )) private: osiSockAddr from; diff --git a/modules/ca/src/client/repeaterSubscribeTimer.cpp b/modules/ca/src/client/repeaterSubscribeTimer.cpp index 5e3d856bd..29dcac9bd 100644 --- a/modules/ca/src/client/repeaterSubscribeTimer.cpp +++ b/modules/ca/src/client/repeaterSubscribeTimer.cpp @@ -29,10 +29,10 @@ static const double repeaterSubscribeTimerInitialPeriod = 10.0; // sec static const double repeaterSubscribeTimerPeriod = 1.0; // sec -repeaterSubscribeTimer::repeaterSubscribeTimer ( +repeaterSubscribeTimer::repeaterSubscribeTimer ( repeaterTimerNotify & iiuIn, epicsTimerQueue & queueIn, epicsMutex & cbMutexIn, cacContextNotify & ctxNotifyIn ) : - timer ( queueIn.createTimer () ), iiu ( iiuIn ), + timer ( queueIn.createTimer () ), iiu ( iiuIn ), cbMutex ( cbMutexIn ),ctxNotify ( ctxNotifyIn ), stateMutex(__FILE__, __LINE__), attempts ( 0 ), registered ( false ), once ( false ) @@ -46,7 +46,7 @@ repeaterSubscribeTimer::~repeaterSubscribeTimer () void repeaterSubscribeTimer::start () { - this->timer.start ( + this->timer.start ( *this, repeaterSubscribeTimerInitialPeriod ); } @@ -65,12 +65,12 @@ epicsTimerNotify::expireStatus repeaterSubscribeTimer:: expire ( const epicsTime & /* currentTime */ ) { epicsGuard < epicsMutex > guard ( this->stateMutex ); - + static const unsigned nTriesToMsg = 50; if ( this->attempts > nTriesToMsg && ! this->once ) { callbackManager mgr ( this->ctxNotify, this->cbMutex ); this->iiu.printFormated ( mgr.cbGuard, - "CA client library is unable to contact CA repeater after %u tries.\n", + "CA client library is unable to contact CA repeater after %u tries.\n", nTriesToMsg ); this->iiu.printFormated ( mgr.cbGuard, "Silence this message by starting a CA repeater daemon\n") ; @@ -93,7 +93,7 @@ epicsTimerNotify::expireStatus repeaterSubscribeTimer:: void repeaterSubscribeTimer::show ( unsigned /* level */ ) const { epicsGuard < epicsMutex > guard ( this->stateMutex ); - + ::printf ( "repeater subscribe timer: attempts=%u registered=%u once=%u\n", this->attempts, this->registered, this->once ); } diff --git a/modules/ca/src/client/repeaterSubscribeTimer.h b/modules/ca/src/client/repeaterSubscribeTimer.h index cc5431b71..4c3e1e9ba 100644 --- a/modules/ca/src/client/repeaterSubscribeTimer.h +++ b/modules/ca/src/client/repeaterSubscribeTimer.h @@ -7,19 +7,19 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* + * * - * * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 - * + * * Copyright, 1986, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #ifndef INC_repeaterSubscribeTimer_H @@ -35,17 +35,17 @@ class cacContextNotify; class repeaterTimerNotify { public: virtual ~repeaterTimerNotify () = 0; - virtual void repeaterRegistrationMessage ( + virtual void repeaterRegistrationMessage ( unsigned attemptNumber ) = 0; - virtual int printFormated ( - epicsGuard < epicsMutex > & callbackControl, + virtual int printFormated ( + epicsGuard < epicsMutex > & callbackControl, const char * pformat, ... ) = 0; }; class repeaterSubscribeTimer : private epicsTimerNotify { public: - repeaterSubscribeTimer ( - repeaterTimerNotify &, epicsTimerQueue &, + repeaterSubscribeTimer ( + repeaterTimerNotify &, epicsTimerQueue &, epicsMutex & cbMutex, cacContextNotify & ctxNotify ); virtual ~repeaterSubscribeTimer (); void start (); @@ -53,7 +53,7 @@ public: epicsGuard < epicsMutex > & cbGuard, epicsGuard < epicsMutex > & guard ); void confirmNotify (); - void show ( unsigned level ) const; + void show ( unsigned level ) const; private: epicsTimer & timer; repeaterTimerNotify & iiu; @@ -63,9 +63,9 @@ private: unsigned attempts; bool registered; bool once; - expireStatus expire ( const epicsTime & currentTime ); - repeaterSubscribeTimer ( const repeaterSubscribeTimer & ); - repeaterSubscribeTimer & operator = ( const repeaterSubscribeTimer & ); + expireStatus expire ( const epicsTime & currentTime ); + repeaterSubscribeTimer ( const repeaterSubscribeTimer & ); + repeaterSubscribeTimer & operator = ( const repeaterSubscribeTimer & ); }; #endif // ifdef INC_repeaterSubscribeTimer_H diff --git a/modules/ca/src/client/searchTimer.cpp b/modules/ca/src/client/searchTimer.cpp index 32ce58990..9538bb0ee 100644 --- a/modules/ca/src/client/searchTimer.cpp +++ b/modules/ca/src/client/searchTimer.cpp @@ -6,7 +6,7 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -// +// // // L O S A L A M O S // Los Alamos National Laboratory @@ -18,7 +18,7 @@ // #include -#include // vxWorks 6.0 requires this include +#include // vxWorks 6.0 requires this include #include #define epicsAssertAuthor "Jeff Hill johill@lanl.gov" @@ -30,15 +30,15 @@ #include "nciu.h" static const unsigned initialTriesPerFrame = 1u; // initial UDP frames per search try -static const unsigned maxTriesPerFrame = 64u; // max UDP frames per search try +static const unsigned maxTriesPerFrame = 64u; // max UDP frames per search try // // searchTimer::searchTimer () // -searchTimer::searchTimer ( - searchTimerNotify & iiuIn, - epicsTimerQueue & queueIn, - const unsigned indexIn, +searchTimer::searchTimer ( + searchTimerNotify & iiuIn, + epicsTimerQueue & queueIn, + const unsigned indexIn, epicsMutex & mutexIn, bool boostPossibleIn ) : timeAtLastSend ( epicsTime::getCurrent () ), @@ -71,7 +71,7 @@ searchTimer::~searchTimer () this->timer.destroy (); } -void searchTimer::shutdown ( +void searchTimer::shutdown ( epicsGuard < epicsMutex > & cbGuard, epicsGuard < epicsMutex > & guard ) { @@ -85,25 +85,25 @@ void searchTimer::shutdown ( } while ( nciu * pChan = this->chanListReqPending.get () ) { - pChan->channelNode::listMember = + pChan->channelNode::listMember = channelNode::cs_none; pChan->serviceShutdownNotify ( cbGuard, guard ); } while ( nciu * pChan = this->chanListRespPending.get () ) { - pChan->channelNode::listMember = + pChan->channelNode::listMember = channelNode::cs_none; pChan->serviceShutdownNotify ( cbGuard, guard ); } } -void searchTimer::installChannel ( +void searchTimer::installChannel ( epicsGuard < epicsMutex > & guard, nciu & chan ) { this->chanListReqPending.add ( chan ); chan.channelNode::setReqPendingState ( guard, this->index ); } -void searchTimer::moveChannels ( +void searchTimer::moveChannels ( epicsGuard < epicsMutex > & guard, searchTimer & dest ) { while ( nciu * pChan = this->chanListRespPending.get () ) { @@ -120,25 +120,25 @@ void searchTimer::moveChannels ( // // searchTimer::expire () // -epicsTimerNotify::expireStatus searchTimer::expire ( +epicsTimerNotify::expireStatus searchTimer::expire ( const epicsTime & currentTime ) { epicsGuard < epicsMutex > guard ( this->mutex ); while ( nciu * pChan = this->chanListRespPending.get () ) { - pChan->channelNode::listMember = + pChan->channelNode::listMember = channelNode::cs_none; - this->iiu.noSearchRespNotify ( + this->iiu.noSearchRespNotify ( guard, *pChan, this->index ); } - + this->timeAtLastSend = currentTime; // boost search period for channels not recently // searched for if there was some success if ( this->searchResponses && this->boostPossible ) { while ( nciu * pChan = this->chanListReqPending.get () ) { - pChan->channelNode::listMember = + pChan->channelNode::listMember = channelNode::cs_none; this->iiu.boostChannel ( guard, *pChan ); } @@ -147,8 +147,8 @@ epicsTimerNotify::expireStatus searchTimer::expire ( if ( this->searchAttempts ) { #if 0 // - // dynamically adjust the number of UDP frames per - // try depending how many search requests are not + // dynamically adjust the number of UDP frames per + // try depending how many search requests are not // replied to // // The variable this->framesPerTry @@ -158,13 +158,13 @@ epicsTimerNotify::expireStatus searchTimer::expire ( // network bandwidth. If it is too low we will // use very little of the incoming UDP message // buffer associated with the server's port and - // will therefore take longer to connect. We - // initialize this->framesPerTry to a prime number + // will therefore take longer to connect. We + // initialize this->framesPerTry to a prime number // so that it is less likely that the // same channel is in the last UDP frame // sent every time that this is called (and // potentially discarded by a CA server with - // a small UDP input queue). + // a small UDP input queue). // // increase frames per try only if we see better than // a 93.75% success rate for one pass through the list @@ -180,19 +180,19 @@ epicsTimerNotify::expireStatus searchTimer::expire ( else { this->framesPerTry += (this->framesPerTry/8) + 1; } - debugPrintf ( ("Increasing frame count to %u t=%u r=%u\n", + debugPrintf ( ("Increasing frame count to %u t=%u r=%u\n", this->framesPerTry, this->searchAttempts, this->searchResponses) ); } } - // if we detect congestion because we have less than a 87.5% success + // if we detect congestion because we have less than a 87.5% success // rate then gradually reduce the frames per try - else if ( this->searchResponses < + else if ( this->searchResponses < ( this->searchAttempts - (this->searchAttempts/8u) ) ) { if ( this->framesPerTry > 1 ) { this->framesPerTry--; } this->framesPerTryCongestThresh = this->framesPerTry/2 + 1; - debugPrintf ( ("Congestion detected - set frames per try to %f t=%u r=%u\n", + debugPrintf ( ("Congestion detected - set frames per try to %f t=%u r=%u\n", this->framesPerTry, this->searchAttempts, this->searchResponses) ); } #else @@ -212,20 +212,20 @@ epicsTimerNotify::expireStatus searchTimer::expire ( else { this->framesPerTry += 1.0 / this->framesPerTry; } - debugPrintf ( ("Increasing frame count to %g t=%u r=%u\n", + debugPrintf ( ("Increasing frame count to %g t=%u r=%u\n", this->framesPerTry, this->searchAttempts, this->searchResponses) ); } } else { this->framesPerTryCongestThresh = this->framesPerTry / 2.0; this->framesPerTry = 1u; - debugPrintf ( ("Congestion detected - set frames per try to %g t=%u r=%u\n", + debugPrintf ( ("Congestion detected - set frames per try to %g t=%u r=%u\n", this->framesPerTry, this->searchAttempts, this->searchResponses) ); } #endif } - this->dgSeqNoAtTimerExpireBegin = + this->dgSeqNoAtTimerExpireBegin = this->iiu.datagramSeqNumber ( guard ); this->searchAttempts = 0; @@ -238,9 +238,9 @@ epicsTimerNotify::expireStatus searchTimer::expire ( break; } - pChan->channelNode::listMember = + pChan->channelNode::listMember = channelNode::cs_none; - + bool success = pChan->searchMsg ( guard ); if ( ! success ) { if ( this->iiu.datagramFlush ( guard, currentTime ) ) { @@ -251,14 +251,14 @@ epicsTimerNotify::expireStatus searchTimer::expire ( } if ( ! success ) { this->chanListReqPending.push ( *pChan ); - pChan->channelNode::setReqPendingState ( + pChan->channelNode::setReqPendingState ( guard, this->index ); break; } } this->chanListRespPending.add ( *pChan ); - pChan->channelNode::setRespPendingState ( + pChan->channelNode::setRespPendingState ( guard, this->index ); if ( this->searchAttempts < UINT_MAX ) { @@ -271,14 +271,14 @@ epicsTimerNotify::expireStatus searchTimer::expire ( nFrameSent++; } - this->dgSeqNoAtTimerExpireEnd = + this->dgSeqNoAtTimerExpireEnd = this->iiu.datagramSeqNumber ( guard ) - 1u; # ifdef DEBUG if ( this->searchAttempts ) { char buf[64]; currentTime.strftime ( buf, sizeof(buf), "%M:%S.%09f"); - debugPrintf ( ("sent %u delay sec=%f Rts=%s\n", + debugPrintf ( ("sent %u delay sec=%f Rts=%s\n", nFrameSent, this->period(), buf ) ); } # endif @@ -291,22 +291,22 @@ void searchTimer :: show ( unsigned level ) const epicsGuard < epicsMutex > guard ( this->mutex ); ::printf ( "searchTimer with period %f\n", this->period ( guard ) ); if ( level > 0 ) { - ::printf ( "channels with search request pending = %u\n", + ::printf ( "channels with search request pending = %u\n", this->chanListReqPending.count () ); if ( level > 1u ) { - tsDLIterConst < nciu > pChan = + tsDLIterConst < nciu > pChan = this->chanListReqPending.firstIter (); - while ( pChan.valid () ) { + while ( pChan.valid () ) { pChan->show ( level - 2u ); pChan++; } } - ::printf ( "channels with search response pending = %u\n", + ::printf ( "channels with search response pending = %u\n", this->chanListRespPending.count () ); if ( level > 1u ) { - tsDLIterConst < nciu > pChan = + tsDLIterConst < nciu > pChan = this->chanListRespPending.firstIter (); - while ( pChan.valid () ) { + while ( pChan.valid () ) { pChan->show ( level - 2u ); pChan++; } @@ -319,9 +319,9 @@ void searchTimer :: show ( unsigned level ) const // at least one response. However, dont reset this delay if we // get a delayed response to an old search request. // -void searchTimer::uninstallChanDueToSuccessfulSearchResponse ( - epicsGuard < epicsMutex > & guard, nciu & chan, - ca_uint32_t respDatagramSeqNo, bool seqNumberIsValid, +void searchTimer::uninstallChanDueToSuccessfulSearchResponse ( + epicsGuard < epicsMutex > & guard, nciu & chan, + ca_uint32_t respDatagramSeqNo, bool seqNumberIsValid, const epicsTime & currentTime ) { guard.assertIdenticalMutex ( this->mutex ); @@ -333,8 +333,8 @@ void searchTimer::uninstallChanDueToSuccessfulSearchResponse ( bool validResponse = true; if ( seqNumberIsValid ) { - validResponse = - this->dgSeqNoAtTimerExpireBegin <= respDatagramSeqNo && + validResponse = + this->dgSeqNoAtTimerExpireBegin <= respDatagramSeqNo && this->dgSeqNoAtTimerExpireEnd >= respDatagramSeqNo; } @@ -349,7 +349,7 @@ void searchTimer::uninstallChanDueToSuccessfulSearchResponse ( if ( this->searchResponses == this->searchAttempts ) { if ( this->chanListReqPending.count () ) { // - // when we get 100% success immediately + // when we get 100% success immediately // send another search request // debugPrintf ( ( "All requests succesful, set timer delay to zero\n" ) ); @@ -364,25 +364,25 @@ void searchTimer::uninstallChan ( epicsGuard < epicsMutex > & cacGuard, nciu & chan ) { cacGuard.assertIdenticalMutex ( this->mutex ); - unsigned ulistmem = - static_cast ( chan.channelNode::listMember ); - unsigned uReqBase = - static_cast ( channelNode::cs_searchReqPending0 ); + unsigned ulistmem = + static_cast ( chan.channelNode::listMember ); + unsigned uReqBase = + static_cast ( channelNode::cs_searchReqPending0 ); if ( ulistmem == this->index + uReqBase ) { this->chanListReqPending.remove ( chan ); } - else { - unsigned uRespBase = - static_cast ( - channelNode::cs_searchRespPending0 ); - if ( ulistmem == this->index + uRespBase ) { - this->chanListRespPending.remove ( chan ); - } - else { - throw std::runtime_error ( - "uninstalling channel search timer, but channel " - "state is wrong" ); - } + else { + unsigned uRespBase = + static_cast ( + channelNode::cs_searchRespPending0 ); + if ( ulistmem == this->index + uRespBase ) { + this->chanListRespPending.remove ( chan ); + } + else { + throw std::runtime_error ( + "uninstalling channel search timer, but channel " + "state is wrong" ); + } } chan.channelNode::listMember = channelNode::cs_none; } diff --git a/modules/ca/src/client/searchTimer.h b/modules/ca/src/client/searchTimer.h index 0baa3caed..dd291fd59 100644 --- a/modules/ca/src/client/searchTimer.h +++ b/modules/ca/src/client/searchTimer.h @@ -7,19 +7,19 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -// // -// +// +// // L O S A L A M O S // Los Alamos National Laboratory // Los Alamos, New Mexico 87545 -// +// // Copyright, 1986, The Regents of the University of California. -// -// -// Author Jeffrey O. Hill -// johill@lanl.gov -// 505 665 1831 +// +// +// Author Jeffrey O. Hill +// johill@lanl.gov +// 505 665 1831 // #ifndef INC_searchTimer_H @@ -36,14 +36,14 @@ class searchTimerNotify { public: virtual ~searchTimerNotify () = 0; - virtual void boostChannel ( + virtual void boostChannel ( epicsGuard < epicsMutex > &, nciu & ) = 0; - virtual void noSearchRespNotify ( + virtual void noSearchRespNotify ( epicsGuard < epicsMutex > &, nciu &, unsigned ) = 0; virtual double getRTTE ( epicsGuard < epicsMutex > & ) const = 0; virtual void updateRTTE ( epicsGuard < epicsMutex > &, double rtte ) = 0; - virtual bool datagramFlush ( - epicsGuard < epicsMutex > &, + virtual bool datagramFlush ( + epicsGuard < epicsMutex > &, const epicsTime & currentTime ) = 0; virtual ca_uint32_t datagramSeqNumber ( epicsGuard < epicsMutex > & ) const = 0; @@ -51,24 +51,24 @@ public: class searchTimer : private epicsTimerNotify { public: - searchTimer ( - class searchTimerNotify &, epicsTimerQueue &, + searchTimer ( + class searchTimerNotify &, epicsTimerQueue &, const unsigned index, epicsMutex &, bool boostPossible ); virtual ~searchTimer (); void start ( epicsGuard < epicsMutex > & ); - void shutdown ( + void shutdown ( epicsGuard < epicsMutex > & cbGuard, epicsGuard < epicsMutex > & guard ); - void moveChannels ( + void moveChannels ( epicsGuard < epicsMutex > &, searchTimer & dest ); - void installChannel ( + void installChannel ( epicsGuard < epicsMutex > &, nciu & ); - void uninstallChan ( + void uninstallChan ( epicsGuard < epicsMutex > &, nciu & ); - void uninstallChanDueToSuccessfulSearchResponse ( - epicsGuard < epicsMutex > &, nciu &, - ca_uint32_t respDatagramSeqNo, bool seqNumberIsValid, + void uninstallChanDueToSuccessfulSearchResponse ( + epicsGuard < epicsMutex > &, nciu &, + ca_uint32_t respDatagramSeqNo, bool seqNumberIsValid, const epicsTime & currentTime ); void show ( unsigned level ) const; private: @@ -84,15 +84,15 @@ private: unsigned searchAttempts; /* num search tries after last timer experation */ unsigned searchResponses; /* num search resp after last timer experation */ const unsigned index; - ca_uint32_t dgSeqNoAtTimerExpireBegin; + ca_uint32_t dgSeqNoAtTimerExpireBegin; ca_uint32_t dgSeqNoAtTimerExpireEnd; const bool boostPossible; bool stopped; expireStatus expire ( const epicsTime & currentTime ); double period ( epicsGuard < epicsMutex > & ) const; - searchTimer ( const searchTimer & ); // not implemented - searchTimer & operator = ( const searchTimer & ); // not implemented + searchTimer ( const searchTimer & ); // not implemented + searchTimer & operator = ( const searchTimer & ); // not implemented }; #endif // ifdef INC_searchTimer_H diff --git a/modules/ca/src/client/sgAutoPtr.h b/modules/ca/src/client/sgAutoPtr.h index f42877e25..6a8ad9a76 100644 --- a/modules/ca/src/client/sgAutoPtr.h +++ b/modules/ca/src/client/sgAutoPtr.h @@ -7,19 +7,19 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* + * * - * * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 - * + * * Copyright, 1986, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #ifndef INC_sgAutoPtr_H @@ -39,18 +39,18 @@ private: T * pNotify; struct CASG & sg; epicsGuard < epicsMutex > & guard; - sgAutoPtr & operator = ( const sgAutoPtr & ); + sgAutoPtr & operator = ( const sgAutoPtr & ); }; template < class T > -inline sgAutoPtr < T > :: sgAutoPtr ( - epicsGuard < epicsMutex > & guardIn, struct CASG & sgIn ) : +inline sgAutoPtr < T > :: sgAutoPtr ( + epicsGuard < epicsMutex > & guardIn, struct CASG & sgIn ) : pNotify ( 0 ), sg ( sgIn ), guard ( guardIn ) { } template < class T > -inline sgAutoPtr < T > :: ~sgAutoPtr () +inline sgAutoPtr < T > :: ~sgAutoPtr () { if ( this->pNotify ) { this->sg.ioPendingList.remove ( *this->pNotify ); diff --git a/modules/ca/src/client/syncGroup.h b/modules/ca/src/client/syncGroup.h index 3b4247537..6015bef45 100644 --- a/modules/ca/src/client/syncGroup.h +++ b/modules/ca/src/client/syncGroup.h @@ -16,9 +16,9 @@ * Copyright, 1986, The Regents of the University of California. * * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #ifndef INC_syncGroup_H @@ -60,7 +60,7 @@ struct CASG; class syncGroupReadNotify : public syncGroupNotify, public cacReadNotify { public: - typedef void ( CASG :: * PRecycleFunc ) + typedef void ( CASG :: * PRecycleFunc ) ( epicsGuard < epicsMutex > &, syncGroupReadNotify & ); static syncGroupReadNotify * factory ( tsFreeList < class syncGroupReadNotify, 128, epicsMutexNOOP > &, @@ -105,7 +105,7 @@ private: class syncGroupWriteNotify : public syncGroupNotify, public cacWriteNotify { public: - typedef void ( CASG :: * PRecycleFunc ) + typedef void ( CASG :: * PRecycleFunc ) ( epicsGuard < epicsMutex > &, syncGroupWriteNotify & ); static syncGroupWriteNotify * factory ( tsFreeList < class syncGroupWriteNotify, 128, epicsMutexNOOP > &, @@ -140,7 +140,7 @@ private: void completion ( epicsGuard < epicsMutex > & ); void exception ( epicsGuard < epicsMutex > &, int status, const char *pContext, - unsigned type, arrayElementCount count ); + unsigned type, arrayElementCount count ); syncGroupWriteNotify ( const syncGroupWriteNotify & ); syncGroupWriteNotify & operator = ( const syncGroupWriteNotify & ); }; @@ -164,9 +164,9 @@ public: void reset ( CallbackGuard &, epicsGuard < epicsMutex > & ); void show ( epicsGuard < epicsMutex > &, unsigned level ) const; void show ( unsigned level ) const; - void get ( epicsGuard < epicsMutex > &, chid pChan, + void get ( epicsGuard < epicsMutex > &, chid pChan, unsigned type, arrayElementCount count, void * pValue ); - void put ( epicsGuard < epicsMutex > &, chid pChan, + void put ( epicsGuard < epicsMutex > &, chid pChan, unsigned type, arrayElementCount count, const void * pValue ); void completionNotify ( epicsGuard < epicsMutex > &, syncGroupNotify & ); @@ -198,9 +198,9 @@ private: void destroyCompletedIO ( CallbackGuard & cbGuard, epicsGuard < epicsMutex > & guard ); - void recycleReadNotifyIO ( epicsGuard < epicsMutex > &, + void recycleReadNotifyIO ( epicsGuard < epicsMutex > &, syncGroupReadNotify & ); - void recycleWriteNotifyIO ( epicsGuard < epicsMutex > &, + void recycleWriteNotifyIO ( epicsGuard < epicsMutex > &, syncGroupWriteNotify & ); CASG ( const CASG & ); diff --git a/modules/ca/src/client/syncGroupNotify.cpp b/modules/ca/src/client/syncGroupNotify.cpp index 800641feb..cca2ad412 100644 --- a/modules/ca/src/client/syncGroupNotify.cpp +++ b/modules/ca/src/client/syncGroupNotify.cpp @@ -19,7 +19,7 @@ #include "syncGroup.h" #include "oldAccess.h" -syncGroupNotify::syncGroupNotify () +syncGroupNotify::syncGroupNotify () { } diff --git a/modules/ca/src/client/syncGroupReadNotify.cpp b/modules/ca/src/client/syncGroupReadNotify.cpp index e7390fade..36e3ea47c 100644 --- a/modules/ca/src/client/syncGroupReadNotify.cpp +++ b/modules/ca/src/client/syncGroupReadNotify.cpp @@ -27,7 +27,7 @@ syncGroupReadNotify::syncGroupReadNotify ( CASG & sgIn, PRecycleFunc pRecycleFuncIn, chid pChan, void * pValueIn ) : - chan ( pChan ), pRecycleFunc ( pRecycleFuncIn ), + chan ( pChan ), pRecycleFunc ( pRecycleFuncIn ), sg ( sgIn ), pValue ( pValueIn ), magic ( CASG_MAGIC ), id ( 0u ), idIsValid ( false ), ioComplete ( false ) diff --git a/modules/ca/src/client/syncGroupWriteNotify.cpp b/modules/ca/src/client/syncGroupWriteNotify.cpp index 5d4d49055..0543e3307 100644 --- a/modules/ca/src/client/syncGroupWriteNotify.cpp +++ b/modules/ca/src/client/syncGroupWriteNotify.cpp @@ -24,7 +24,7 @@ #include "syncGroup.h" #include "oldAccess.h" -syncGroupWriteNotify::syncGroupWriteNotify ( CASG & sgIn, +syncGroupWriteNotify::syncGroupWriteNotify ( CASG & sgIn, PRecycleFunc pRecycleFuncIn, chid pChan ) : chan ( pChan ), pRecycleFunc ( pRecycleFuncIn ), sg ( sgIn ), magic ( CASG_MAGIC ), diff --git a/modules/ca/src/client/syncgrp.cpp b/modules/ca/src/client/syncgrp.cpp index e938fa579..2a0565f08 100644 --- a/modules/ca/src/client/syncgrp.cpp +++ b/modules/ca/src/client/syncgrp.cpp @@ -100,7 +100,7 @@ void sync_group_reset ( ca_client_context & client, CASG & sg ) epicsGuard < epicsMutex > guard ( client.mutex ); sg.reset ( *client.pCallbackGuard.get(), guard ); } - else { + else { // // we will definately stall out here if all of the // following are true @@ -260,7 +260,7 @@ extern "C" int epicsStdCall ca_sg_array_put ( const CA_SYNC_GID gid, chtype type } try { - pcasg->put ( guard, pChan, type, + pcasg->put ( guard, pChan, type, static_cast < unsigned > ( count ), pValue ); return ECA_NORMAL; } @@ -322,7 +322,7 @@ extern "C" int epicsStdCall ca_sg_array_get ( const CA_SYNC_GID gid, chtype type } try { - pcasg->get ( guard, pChan, type, + pcasg->get ( guard, pChan, type, static_cast < unsigned > ( count ), pValue ); return ECA_NORMAL; } diff --git a/modules/ca/src/client/tcpRecvWatchdog.cpp b/modules/ca/src/client/tcpRecvWatchdog.cpp index 4596c33dc..d2834ad7d 100644 --- a/modules/ca/src/client/tcpRecvWatchdog.cpp +++ b/modules/ca/src/client/tcpRecvWatchdog.cpp @@ -26,14 +26,14 @@ // // the recv watchdog timer is active when this object is created // -tcpRecvWatchdog::tcpRecvWatchdog +tcpRecvWatchdog::tcpRecvWatchdog ( epicsMutex & cbMutexIn, cacContextNotify & ctxNotifyIn, - epicsMutex & mutexIn, tcpiiu & iiuIn, + epicsMutex & mutexIn, tcpiiu & iiuIn, double periodIn, epicsTimerQueue & queueIn ) : period ( periodIn ), timer ( queueIn.createTimer () ), - cbMutex ( cbMutexIn ), ctxNotify ( ctxNotifyIn ), - mutex ( mutexIn ), iiu ( iiuIn ), - probeResponsePending ( false ), beaconAnomaly ( true ), + cbMutex ( cbMutexIn ), ctxNotify ( ctxNotifyIn ), + mutex ( mutexIn ), iiu ( iiuIn ), + probeResponsePending ( false ), beaconAnomaly ( true ), probeTimeoutDetected ( false ), shuttingDown ( false ) { } @@ -60,15 +60,15 @@ tcpRecvWatchdog::expire ( const epicsTime & /* currentTime */ ) char hostName[128]; this->iiu.getHostName ( guard, hostName, sizeof (hostName) ); debugPrintf ( ( "CA server \"%s\" unresponsive after %g inactive sec" - "- disconnecting.\n", + "- disconnecting.\n", hostName, this->period ) ); # endif - // to get the callback lock safely we must reorder + // to get the callback lock safely we must reorder // the lock hierarchy epicsGuardRelease < epicsMutex > unguard ( guard ); { // callback lock is required because channel disconnect - // state change is initiated from this thread, and + // state change is initiated from this thread, and // this can cause their disconnect notify callback // to be invoked. callbackManager mgr ( this->ctxNotify, this->cbMutex ); @@ -90,7 +90,7 @@ tcpRecvWatchdog::expire ( const epicsTime & /* currentTime */ ) } } -void tcpRecvWatchdog::beaconArrivalNotify ( +void tcpRecvWatchdog::beaconArrivalNotify ( epicsGuard < epicsMutex > & guard ) { guard.assertIdenticalMutex ( this->mutex ); @@ -102,12 +102,12 @@ void tcpRecvWatchdog::beaconArrivalNotify ( // // be careful about using beacons to reset the connection -// time out watchdog until we have received a ping response +// time out watchdog until we have received a ping response // from the IOC (this makes the software detect reconnects -// faster when the server is rebooted twice in rapid +// faster when the server is rebooted twice in rapid // succession before a 1st or 2nd beacon has been received) // -void tcpRecvWatchdog::beaconAnomalyNotify ( +void tcpRecvWatchdog::beaconAnomalyNotify ( epicsGuard < epicsMutex > & guard ) { guard.assertIdenticalMutex ( this->mutex ); @@ -115,7 +115,7 @@ void tcpRecvWatchdog::beaconAnomalyNotify ( debugPrintf ( ("Saw an abnormal beacon\n") ); } -void tcpRecvWatchdog::messageArrivalNotify ( +void tcpRecvWatchdog::messageArrivalNotify ( epicsGuard < epicsMutex > & guard ) { guard.assertIdenticalMutex ( this->mutex ); @@ -127,7 +127,7 @@ void tcpRecvWatchdog::messageArrivalNotify ( } } -void tcpRecvWatchdog::probeResponseNotify ( +void tcpRecvWatchdog::probeResponseNotify ( epicsGuard < epicsMutex > & cbGuard ) { bool restartNeeded = false; @@ -157,27 +157,27 @@ void tcpRecvWatchdog::probeResponseNotify ( } // -// The thread for outgoing requests in the client runs +// The thread for outgoing requests in the client runs // at a higher priority than the thread in the client -// that receives responses. Therefore, there could -// be considerable large array write send backlog that -// is delaying departure of an echo request and also -// interrupting delivery of an echo response. -// We must be careful not to timeout the echo response as -// long as we see indication of regular departures of -// message buffers from the client in a situation where -// we know that the TCP send queueing has been exceeded. -// The send watchdog will be responsible for detecting +// that receives responses. Therefore, there could +// be considerable large array write send backlog that +// is delaying departure of an echo request and also +// interrupting delivery of an echo response. +// We must be careful not to timeout the echo response as +// long as we see indication of regular departures of +// message buffers from the client in a situation where +// we know that the TCP send queueing has been exceeded. +// The send watchdog will be responsible for detecting // dead connections in this case. // -void tcpRecvWatchdog::sendBacklogProgressNotify ( +void tcpRecvWatchdog::sendBacklogProgressNotify ( epicsGuard < epicsMutex > & guard ) { guard.assertIdenticalMutex ( this->mutex ); // We dont set "beaconAnomaly" to be false here because, after we see a - // beacon anomaly (which could be transiently detecting a reboot) we will - // not trust the beacon as an indicator of a healthy server until we + // beacon anomaly (which could be transiently detecting a reboot) we will + // not trust the beacon as an indicator of a healthy server until we // receive at least one message from the server. if ( this->probeResponsePending && ! this->shuttingDown ) { this->timer.start ( *this, CA_ECHO_TIMEOUT ); @@ -196,7 +196,7 @@ void tcpRecvWatchdog::connectNotify ( debugPrintf ( ("connected to the server - initiating circuit recv watchdog\n") ); } -void tcpRecvWatchdog::sendTimeoutNotify ( +void tcpRecvWatchdog::sendTimeoutNotify ( epicsGuard < epicsMutex > & /* cbGuard */, epicsGuard < epicsMutex > & guard ) { @@ -242,7 +242,7 @@ void tcpRecvWatchdog::show ( unsigned level ) const static_cast ( this ), this->period ); if ( level > 0u ) { ::printf ( "\t%s %s %s\n", - this->probeResponsePending ? "probe-response-pending" : "", + this->probeResponsePending ? "probe-response-pending" : "", this->beaconAnomaly ? "beacon-anomaly-detected" : "", this->probeTimeoutDetected ? "probe-response-timeout" : "" ); } diff --git a/modules/ca/src/client/tcpRecvWatchdog.h b/modules/ca/src/client/tcpRecvWatchdog.h index ca214c222..45e6f0852 100644 --- a/modules/ca/src/client/tcpRecvWatchdog.h +++ b/modules/ca/src/client/tcpRecvWatchdog.h @@ -7,19 +7,19 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* + * * - * * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 - * + * * Copyright, 1986, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #ifndef INC_tcpRecvWatchdog_H @@ -33,18 +33,18 @@ class tcpiiu; class tcpRecvWatchdog : private epicsTimerNotify { public: - tcpRecvWatchdog ( epicsMutex & cbMutex, + tcpRecvWatchdog ( epicsMutex & cbMutex, cacContextNotify & ctxNotify, - epicsMutex & mutex, tcpiiu &, + epicsMutex & mutex, tcpiiu &, double periodIn, epicsTimerQueue & ); virtual ~tcpRecvWatchdog (); void sendBacklogProgressNotify ( epicsGuard < epicsMutex > & ); void messageArrivalNotify ( epicsGuard < epicsMutex > & guard ); - void probeResponseNotify ( + void probeResponseNotify ( epicsGuard < epicsMutex > & ); - void beaconArrivalNotify ( + void beaconArrivalNotify ( epicsGuard < epicsMutex > & ); void beaconAnomalyNotify ( epicsGuard < epicsMutex > & ); void connectNotify ( @@ -68,8 +68,8 @@ private: bool probeTimeoutDetected; bool shuttingDown; expireStatus expire ( const epicsTime & currentTime ); - tcpRecvWatchdog ( const tcpRecvWatchdog & ); - tcpRecvWatchdog & operator = ( const tcpRecvWatchdog & ); + tcpRecvWatchdog ( const tcpRecvWatchdog & ); + tcpRecvWatchdog & operator = ( const tcpRecvWatchdog & ); }; #endif // #ifndef INC_tcpRecvWatchdog_H diff --git a/modules/ca/src/client/tcpSendWatchdog.cpp b/modules/ca/src/client/tcpSendWatchdog.cpp index 140fdba39..85344164a 100644 --- a/modules/ca/src/client/tcpSendWatchdog.cpp +++ b/modules/ca/src/client/tcpSendWatchdog.cpp @@ -7,7 +7,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* * * L O S A L A M O S * Los Alamos National Laboratory @@ -24,8 +24,8 @@ #include "cac.h" #include "virtualCircuit.h" -tcpSendWatchdog::tcpSendWatchdog ( - epicsMutex & cbMutexIn, cacContextNotify & ctxNotifyIn, +tcpSendWatchdog::tcpSendWatchdog ( + epicsMutex & cbMutexIn, cacContextNotify & ctxNotifyIn, epicsMutex & mutexIn, tcpiiu & iiuIn, double periodIn, epicsTimerQueue & queueIn ) : period ( periodIn ), timer ( queueIn.createTimer () ), @@ -39,7 +39,7 @@ tcpSendWatchdog::~tcpSendWatchdog () this->timer.destroy (); } -epicsTimerNotify::expireStatus tcpSendWatchdog::expire ( +epicsTimerNotify::expireStatus tcpSendWatchdog::expire ( const epicsTime & /* currentTime */ ) { { @@ -54,7 +54,7 @@ epicsTimerNotify::expireStatus tcpSendWatchdog::expire ( # ifdef DEBUG char hostName[128]; this->iiu.getHostName ( guard, hostName, sizeof ( hostName ) ); - debugPrintf ( ( "Request not accepted by CA server %s for %g sec. Disconnecting.\n", + debugPrintf ( ( "Request not accepted by CA server %s for %g sec. Disconnecting.\n", hostName, this->period ) ); # endif this->iiu.sendTimeoutNotify ( mgr, guard ); diff --git a/modules/ca/src/client/tcpSendWatchdog.h b/modules/ca/src/client/tcpSendWatchdog.h index 3d9bc05fa..3fd25d4e1 100644 --- a/modules/ca/src/client/tcpSendWatchdog.h +++ b/modules/ca/src/client/tcpSendWatchdog.h @@ -7,19 +7,19 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* + * * - * * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 - * + * * Copyright, 1986, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #ifndef INC_tcpSendWatchdog_H @@ -46,8 +46,8 @@ private: epicsMutex & mutex; tcpiiu & iiu; expireStatus expire ( const epicsTime & currentTime ); - tcpSendWatchdog ( const tcpSendWatchdog & ); - tcpSendWatchdog & operator = ( const tcpSendWatchdog & ); + tcpSendWatchdog ( const tcpSendWatchdog & ); + tcpSendWatchdog & operator = ( const tcpSendWatchdog & ); }; #endif // #ifndef INC_tcpSendWatchdog_H diff --git a/modules/ca/src/client/tcpiiu.cpp b/modules/ca/src/client/tcpiiu.cpp index b1b6a6e8b..0751eb4d9 100644 --- a/modules/ca/src/client/tcpiiu.cpp +++ b/modules/ca/src/client/tcpiiu.cpp @@ -7,7 +7,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 @@ -47,7 +47,7 @@ using namespace std; tcpSendThread::tcpSendThread ( - class tcpiiu & iiuIn, const char * pName, + class tcpiiu & iiuIn, const char * pName, unsigned stackSize, unsigned priority ) : thread ( *this, pName, stackSize, priority ), iiu ( iiuIn ) { @@ -91,7 +91,7 @@ void tcpSendThread::run () } laborPending = false; - bool flowControlLaborNeeded = + bool flowControlLaborNeeded = this->iiu.busyStateDetected != this->iiu.flowControlActive; bool echoLaborNeeded = this->iiu.echoRequestPending; this->iiu.echoRequestPending = false; @@ -118,7 +118,7 @@ void tcpSendThread::run () if ( CA_V42 ( this->iiu.minorProtocolVersion ) ) { this->iiu.createRespPend.add ( *pChan ); - pChan->channelNode::listMember = + pChan->channelNode::listMember = channelNode::cs_createRespPend; } else { @@ -128,12 +128,12 @@ void tcpSendThread::run () // that the UDP thread take the callback lock. There are // almost no V42 servers left at this point. this->iiu.v42ConnCallbackPend.add ( *pChan ); - pChan->channelNode::listMember = + pChan->channelNode::listMember = channelNode::cs_v42ConnCallbackPend; this->iiu.echoRequestPending = true; laborPending = true; } - + if ( this->iiu.sendQue.flushBlockThreshold () ) { laborPending = true; break; @@ -144,7 +144,7 @@ void tcpSendThread::run () // this installs any subscriptions as needed pChan->resubscribe ( guard ); this->iiu.connectedList.add ( *pChan ); - pChan->channelNode::listMember = + pChan->channelNode::listMember = channelNode::cs_connected; if ( this->iiu.sendQue.flushBlockThreshold () ) { laborPending = true; @@ -156,7 +156,7 @@ void tcpSendThread::run () // this updates any subscriptions as needed pChan->sendSubscriptionUpdateRequests ( guard ); this->iiu.connectedList.add ( *pChan ); - pChan->channelNode::listMember = + pChan->channelNode::listMember = channelNode::cs_connected; if ( this->iiu.sendQue.flushBlockThreshold () ) { laborPending = true; @@ -170,14 +170,14 @@ void tcpSendThread::run () } if ( this->iiu.state == tcpiiu::iiucs_clean_shutdown ) { this->iiu.sendThreadFlush ( guard ); - // this should cause the server to disconnect from + // this should cause the server to disconnect from // the client int status = ::shutdown ( this->iiu.sock, SHUT_WR ); if ( status ) { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - errlogPrintf ("CAC TCP clean socket shutdown error was %s\n", + errlogPrintf ("CAC TCP clean socket shutdown error was %s\n", sockErrBuf ); } } @@ -186,14 +186,14 @@ void tcpSendThread::run () errlogPrintf ( "cac: tcp send thread received an unexpected exception " "- disconnecting\n"); - // this should cause the server to disconnect from + // this should cause the server to disconnect from // the client int status = ::shutdown ( this->iiu.sock, SHUT_WR ); if ( status ) { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - errlogPrintf ("CAC TCP clean socket shutdown error was %s\n", + errlogPrintf ("CAC TCP clean socket shutdown error was %s\n", sockErrBuf ); } } @@ -202,11 +202,11 @@ void tcpSendThread::run () this->iiu.recvDog.shutdown (); while ( ! this->iiu.recvThread.exitWait ( 30.0 ) ) { - // it is possible to get stuck here if the user calls + // it is possible to get stuck here if the user calls // ca_context_destroy() when a circuit isnt known to // be unresponsive, but is. That situation is probably // rare, and the IP kernel might have a timeout for - // such situations, nevertheless we will attempt to deal + // such situations, nevertheless we will attempt to deal // with it here after waiting a reasonable amount of time // for a clean shutdown to finish. epicsGuard < epicsMutex > guard ( this->iiu.mutex ); @@ -214,7 +214,7 @@ void tcpSendThread::run () } // user threads blocking for send backlog to be reduced - // will abort their attempt to get space if + // will abort their attempt to get space if // the state of the tcpiiu changes from connected to a // disconnecting state. Nevertheless, we need to wait // for them to finish prior to destroying the IIU. @@ -228,7 +228,7 @@ void tcpSendThread::run () this->iiu.cacRef.destroyIIU ( this->iiu ); } -unsigned tcpiiu::sendBytes ( const void *pBuf, +unsigned tcpiiu::sendBytes ( const void *pBuf, unsigned nBytesInBuf, const epicsTime & currentTime ) { unsigned nBytes = 0u; @@ -237,7 +237,7 @@ unsigned tcpiiu::sendBytes ( const void *pBuf, this->sendDog.start ( currentTime ); while ( true ) { - int status = ::send ( this->sock, + int status = ::send ( this->sock, static_cast < const char * > (pBuf), (int) nBytesInBuf, 0 ); if ( status > 0 ) { nBytes = static_cast ( status ); @@ -263,7 +263,7 @@ unsigned tcpiiu::sendBytes ( const void *pBuf, } if ( localError == SOCK_ENOBUFS ) { - errlogPrintf ( + errlogPrintf ( "CAC: system low on network buffers " "- send retry in 15 seconds\n" ); { @@ -273,16 +273,16 @@ unsigned tcpiiu::sendBytes ( const void *pBuf, continue; } - if ( - localError != SOCK_EPIPE && + if ( + localError != SOCK_EPIPE && localError != SOCK_ECONNRESET && - localError != SOCK_ETIMEDOUT && + localError != SOCK_ETIMEDOUT && localError != SOCK_ECONNABORTED && localError != SOCK_SHUTDOWN ) { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - errlogPrintf ( "CAC: unexpected TCP send error: %s\n", + errlogPrintf ( "CAC: unexpected TCP send error: %s\n", sockErrBuf ); } @@ -296,13 +296,13 @@ unsigned tcpiiu::sendBytes ( const void *pBuf, return nBytes; } -void tcpiiu::recvBytes ( +void tcpiiu::recvBytes ( void * pBuf, unsigned nBytesInBuf, statusWireIO & stat ) { assert ( nBytesInBuf <= INT_MAX ); while ( true ) { - int status = ::recv ( this->sock, static_cast ( pBuf ), + int status = ::recv ( this->sock, static_cast ( pBuf ), static_cast ( nBytesInBuf ), 0 ); if ( status > 0 ) { @@ -321,14 +321,14 @@ void tcpiiu::recvBytes ( return; } - // if the circuit was locally aborted then supress + // if the circuit was locally aborted then supress // warning messages about bad file descriptor etc - if ( this->state != iiucs_connected && + if ( this->state != iiucs_connected && this->state != iiucs_clean_shutdown ) { stat.bytesCopied = 0u; stat.circuitState = swioLocalAbort; return; - } + } int localErrno = SOCKERRNO; @@ -343,7 +343,7 @@ void tcpiiu::recvBytes ( } if ( localErrno == SOCK_ENOBUFS ) { - errlogPrintf ( + errlogPrintf ( "CAC: system low on network buffers " "- receive retry in 15 seconds\n" ); { @@ -354,20 +354,20 @@ void tcpiiu::recvBytes ( } char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); // the replacable printf handler isnt called here // because it reqires a callback lock which probably // isnt appropriate here char name[64]; - this->hostNameCacheInstance.getName ( + this->hostNameCacheInstance.getName ( name, sizeof ( name ) ); errlogPrintf ( "Unexpected problem with CA circuit to" - " server \"%s\" was \"%s\" - disconnecting\n", + " server \"%s\" was \"%s\" - disconnecting\n", name, sockErrBuf ); - + stat.bytesCopied = 0u; stat.circuitState = swioPeerAbort; return; @@ -375,12 +375,12 @@ void tcpiiu::recvBytes ( } } -tcpRecvThread::tcpRecvThread ( +tcpRecvThread::tcpRecvThread ( class tcpiiu & iiuIn, class epicsMutex & cbMutexIn, - cacContextNotify & ctxNotifyIn, const char * pName, + cacContextNotify & ctxNotifyIn, const char * pName, unsigned int stackSize, unsigned int priority ) : thread ( *this, pName, stackSize, priority ), - iiu ( iiuIn ), cbMutex ( cbMutexIn ), + iiu ( iiuIn ), cbMutex ( cbMutexIn ), ctxNotify ( ctxNotifyIn ) {} tcpRecvThread::~tcpRecvThread () @@ -406,7 +406,7 @@ void tcpRecvThread::exitWait () this->thread.exitWait (); } -bool tcpRecvThread::validFillStatus ( +bool tcpRecvThread::validFillStatus ( epicsGuard < epicsMutex > & guard, const statusWireIO & stat ) { if ( this->iiu.state != tcpiiu::iiucs_connected && @@ -463,9 +463,9 @@ void tcpRecvThread::run () // // We leave the bytes pending and fetch them after - // callbacks are enabled when running in the old preemptive + // callbacks are enabled when running in the old preemptive // call back disabled mode so that asynchronous wakeup via - // file manager call backs works correctly. This does not + // file manager call backs works correctly. This does not // appear to impact performance. // if ( ! pComBuf ) { @@ -479,7 +479,7 @@ void tcpRecvThread::run () { epicsGuard < epicsMutex > guard ( this->iiu.mutex ); - + if ( ! this->validFillStatus ( guard, stat ) ) { break; } @@ -501,7 +501,7 @@ void tcpRecvThread::run () callbackManager mgr ( this->ctxNotify, this->cbMutex ); epicsGuard < epicsMutex > guard ( this->iiu.mutex ); - + // route legacy V42 channel connect through the recv thread - // the only thread that should be taking the callback lock while ( nciu * pChan = this->iiu.v42ConnCallbackPend.first () ) { @@ -524,7 +524,7 @@ void tcpRecvThread::run () } this->iiu._receiveThreadIsBusy = false; // reschedule connection activity watchdog - this->iiu.recvDog.messageArrivalNotify ( guard ); + this->iiu.recvDog.messageArrivalNotify ( guard ); // // if this thread has connected channels with subscriptions // that need to be sent then wakeup the send thread @@ -532,13 +532,13 @@ void tcpRecvThread::run () sendWakeupNeeded = true; } } - + // // we dont feel comfortable calling this with a lock applied // (it might block for longer than we like) // - // we would prefer to improve efficency by trying, first, a - // recv with the new MSG_DONTWAIT flag set, but there isnt + // we would prefer to improve efficency by trying, first, a + // recv with the new MSG_DONTWAIT flag set, but there isnt // universal support // bool bytesArePending = this->iiu.bytesArePendingInOS (); @@ -547,7 +547,7 @@ void tcpRecvThread::run () if ( bytesArePending ) { if ( ! this->iiu.busyStateDetected ) { this->iiu.contigRecvMsgCount++; - if ( this->iiu.contigRecvMsgCount >= + if ( this->iiu.contigRecvMsgCount >= this->iiu.cacRef.maxContiguousFrames ( guard ) ) { this->iiu.busyStateDetected = true; sendWakeupNeeded = true; @@ -577,7 +577,7 @@ void tcpRecvThread::run () } } catch ( std::bad_alloc & ) { - errlogPrintf ( + errlogPrintf ( "CA client library tcp receive thread " "terminating due to no space in pool " "C++ exception\n" ); @@ -585,15 +585,15 @@ void tcpRecvThread::run () this->iiu.initiateCleanShutdown ( guard ); } catch ( std::exception & except ) { - errlogPrintf ( + errlogPrintf ( "CA client library tcp receive thread " - "terminating due to C++ exception \"%s\"\n", + "terminating due to C++ exception \"%s\"\n", except.what () ); epicsGuard < epicsMutex > guard ( this->iiu.mutex ); this->iiu.initiateCleanShutdown ( guard ); } catch ( ... ) { - errlogPrintf ( + errlogPrintf ( "CA client library tcp receive thread " "terminating due to a non-standard C++ exception\n" ); epicsGuard < epicsMutex > guard ( this->iiu.mutex ); @@ -613,7 +613,7 @@ void tcpRecvThread::connect ( { epicsGuardRelease < epicsMutex > unguard ( guard ); osiSockAddr tmp = this->iiu.address (); - status = ::connect ( this->iiu.sock, + status = ::connect ( this->iiu.sock, & tmp.sa, sizeof ( tmp.sa ) ); } @@ -623,7 +623,7 @@ void tcpRecvThread::connect ( if ( status >= 0 ) { // put the iiu into the connected state this->iiu.state = tcpiiu::iiucs_connected; - this->iiu.recvDog.connectNotify ( guard ); + this->iiu.recvDog.connectNotify ( guard ); break; } else { @@ -639,7 +639,7 @@ void tcpRecvThread::connect ( } else { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); errlogPrintf ( "CAC: Unable to connect because \"%s\"\n", sockErrBuf ); @@ -662,24 +662,24 @@ void tcpRecvThread::connect ( // // tcpiiu::tcpiiu () // -tcpiiu::tcpiiu ( - cac & cac, epicsMutex & mutexIn, epicsMutex & cbMutexIn, - cacContextNotify & ctxNotifyIn, double connectionTimeout, - epicsTimerQueue & timerQueue, const osiSockAddr & addrIn, +tcpiiu::tcpiiu ( + cac & cac, epicsMutex & mutexIn, epicsMutex & cbMutexIn, + cacContextNotify & ctxNotifyIn, double connectionTimeout, + epicsTimerQueue & timerQueue, const osiSockAddr & addrIn, comBufMemoryManager & comBufMemMgrIn, - unsigned minorVersion, ipAddrToAsciiEngine & engineIn, + unsigned minorVersion, ipAddrToAsciiEngine & engineIn, const cacChannel::priLev & priorityIn, SearchDestTCP * pSearchDestIn ) : caServerID ( addrIn.ia, priorityIn ), hostNameCacheInstance ( addrIn, engineIn ), - recvThread ( *this, cbMutexIn, ctxNotifyIn, "CAC-TCP-recv", + recvThread ( *this, cbMutexIn, ctxNotifyIn, "CAC-TCP-recv", epicsThreadGetStackSize ( epicsThreadStackBig ), cac::highestPriorityLevelBelow ( cac.getInitializingThreadsPriority() ) ), sendThread ( *this, "CAC-TCP-send", epicsThreadGetStackSize ( epicsThreadStackMedium ), cac::lowestPriorityLevelAbove ( cac.getInitializingThreadsPriority() ) ), - recvDog ( cbMutexIn, ctxNotifyIn, mutexIn, + recvDog ( cbMutexIn, ctxNotifyIn, mutexIn, *this, connectionTimeout, timerQueue ), sendDog ( cbMutexIn, ctxNotifyIn, mutexIn, *this, connectionTimeout, timerQueue ), @@ -720,9 +720,9 @@ tcpiiu::tcpiiu ( if ( this->sock == INVALID_SOCKET ) { freeListFree(this->cacRef.tcpSmallRecvBufFreeList, this->pCurData); char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - std :: string reason = + std :: string reason = "CAC: TCP circuit creation failure because \""; reason += sockErrBuf; reason += "\""; @@ -734,7 +734,7 @@ tcpiiu::tcpiiu ( (char *) &flag, sizeof ( flag ) ); if ( status < 0 ) { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); errlogPrintf ( "CAC: problems setting socket option TCP_NODELAY = \"%s\"\n", sockErrBuf ); @@ -745,13 +745,13 @@ tcpiiu::tcpiiu ( ( char * ) &flag, sizeof ( flag ) ); if ( status < 0 ) { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); errlogPrintf ( "CAC: problems setting socket option SO_KEEPALIVE = \"%s\"\n", sockErrBuf ); } - // load message queue with messages informing server + // load message queue with messages informing server // of version, user, and host name of client { epicsGuard < epicsMutex > guard ( this->mutex ); @@ -767,7 +767,7 @@ tcpiiu::tcpiiu ( /* * some concern that vxWorks will run out of mBuf's * if this change is made joh 11-10-98 - */ + */ i = MAX_MSG_SIZE; status = setsockopt ( this->sock, SOL_SOCKET, SO_SNDBUF, ( char * ) &i, sizeof ( i ) ); @@ -794,10 +794,10 @@ tcpiiu::tcpiiu ( osiSocklen_t sizeOfParameter = static_cast < int > ( sizeof ( nBytes ) ); status = getsockopt ( this->sock, SOL_SOCKET, SO_SNDBUF, ( char * ) &nBytes, &sizeOfParameter ); - if ( status < 0 || nBytes < 0 || + if ( status < 0 || nBytes < 0 || sizeOfParameter != static_cast < int > ( sizeof ( nBytes ) ) ) { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); errlogPrintf ("CAC: problems getting socket option SO_SNDBUF = \"%s\"\n", sockErrBuf ); @@ -814,16 +814,16 @@ tcpiiu::tcpiiu ( memset ( (void *) &this->curMsg, '\0', sizeof ( this->curMsg ) ); } -// this must always be called by the udp thread when it holds +// this must always be called by the udp thread when it holds // the callback lock. -void tcpiiu::start ( +void tcpiiu::start ( epicsGuard < epicsMutex > & guard ) { guard.assertIdenticalMutex ( this->mutex ); this->recvThread.start (); } -void tcpiiu::initiateCleanShutdown ( +void tcpiiu::initiateCleanShutdown ( epicsGuard < epicsMutex > & guard ) { guard.assertIdenticalMutex ( this->mutex ); @@ -848,7 +848,7 @@ void tcpiiu::initiateCleanShutdown ( } } -void tcpiiu::disconnectNotify ( +void tcpiiu::disconnectNotify ( epicsGuard < epicsMutex > & guard ) { guard.assertIdenticalMutex ( this->mutex ); @@ -857,7 +857,7 @@ void tcpiiu::disconnectNotify ( this->flushBlockEvent.signal (); } -void tcpiiu::responsiveCircuitNotify ( +void tcpiiu::responsiveCircuitNotify ( epicsGuard < epicsMutex > & cbGuard, epicsGuard < epicsMutex > & guard ) { @@ -867,7 +867,7 @@ void tcpiiu::responsiveCircuitNotify ( this->unresponsiveCircuit = false; while ( nciu * pChan = this->unrespCircuit.get() ) { this->subscripUpdateReqPend.add ( *pChan ); - pChan->channelNode::listMember = + pChan->channelNode::listMember = channelNode::cs_subscripUpdateReqPend; pChan->connect ( cbGuard, guard ); } @@ -875,7 +875,7 @@ void tcpiiu::responsiveCircuitNotify ( } } -void tcpiiu::sendTimeoutNotify ( +void tcpiiu::sendTimeoutNotify ( callbackManager & mgr, epicsGuard < epicsMutex > & guard ) { @@ -886,7 +886,7 @@ void tcpiiu::sendTimeoutNotify ( this->recvDog.sendTimeoutNotify ( mgr.cbGuard, guard ); } -void tcpiiu::receiveTimeoutNotify ( +void tcpiiu::receiveTimeoutNotify ( callbackManager & mgr, epicsGuard < epicsMutex > & guard ) { @@ -895,8 +895,8 @@ void tcpiiu::receiveTimeoutNotify ( this->unresponsiveCircuitNotify ( mgr.cbGuard, guard ); } -void tcpiiu::unresponsiveCircuitNotify ( - epicsGuard < epicsMutex > & cbGuard, +void tcpiiu::unresponsiveCircuitNotify ( + epicsGuard < epicsMutex > & cbGuard, epicsGuard < epicsMutex > & guard ) { cbGuard.assertIdenticalMutex ( this->cbMutex ); @@ -921,7 +921,7 @@ void tcpiiu::unresponsiveCircuitNotify ( if ( this->connectedList.count() ) { char hostNameTmp[128]; this->getHostName ( guard, hostNameTmp, sizeof ( hostNameTmp ) ); - genLocalExcep ( cbGuard, guard, this->cacRef, + genLocalExcep ( cbGuard, guard, this->cacRef, ECA_UNRESPTMO, hostNameTmp ); while ( nciu * pChan = this->connectedList.get () ) { // The cac lock is released herein so there is concern that @@ -931,7 +931,7 @@ void tcpiiu::unresponsiveCircuitNotify ( // channel. The callback lock must be taken in all of // these situations so this code is protected. this->unrespCircuit.add ( *pChan ); - pChan->channelNode::listMember = + pChan->channelNode::listMember = channelNode::cs_unrespCircuit; pChan->unresponsiveCircuitNotify ( cbGuard, guard ); } @@ -939,24 +939,24 @@ void tcpiiu::unresponsiveCircuitNotify ( } } -void tcpiiu::initiateAbortShutdown ( +void tcpiiu::initiateAbortShutdown ( epicsGuard < epicsMutex > & guard ) { guard.assertIdenticalMutex ( this->mutex ); if ( ! this->discardingPendingData ) { - // force abortive shutdown sequence + // force abortive shutdown sequence // (discard outstanding sends and receives) struct linger tmpLinger; tmpLinger.l_onoff = true; tmpLinger.l_linger = 0u; - int status = setsockopt ( this->sock, SOL_SOCKET, SO_LINGER, + int status = setsockopt ( this->sock, SOL_SOCKET, SO_LINGER, reinterpret_cast ( &tmpLinger ), sizeof (tmpLinger) ); if ( status != 0 ) { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - errlogPrintf ( "CAC TCP socket linger set error was %s\n", + errlogPrintf ( "CAC TCP socket linger set error was %s\n", sockErrBuf ); } this->discardingPendingData = true; @@ -985,9 +985,9 @@ void tcpiiu::initiateAbortShutdown ( int status = ::shutdown ( this->sock, SHUT_RDWR ); if ( status ) { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - errlogPrintf ("CAC TCP socket shutdown error was %s\n", + errlogPrintf ("CAC TCP socket shutdown error was %s\n", sockErrBuf ); } } @@ -1000,7 +1000,7 @@ void tcpiiu::initiateAbortShutdown ( break; }; - // + // // wake up the send thread if it isnt blocking in send() // this->sendThreadFlushEvent.signal (); @@ -1045,15 +1045,15 @@ void tcpiiu::show ( unsigned level ) const epicsGuard < epicsMutex > locker ( this->mutex ); char buf[256]; this->hostNameCacheInstance.getName ( buf, sizeof ( buf ) ); - ::printf ( "Virtual circuit to \"%s\" at version V%u.%u state %u\n", + ::printf ( "Virtual circuit to \"%s\" at version V%u.%u state %u\n", buf, CA_MAJOR_PROTOCOL_REVISION, this->minorProtocolVersion, this->state ); if ( level > 1u ) { ::printf ( "\tcurrent data cache pointer = %p current data cache size = %lu\n", static_cast < void * > ( this->pCurData ), this->curDataMax ); - ::printf ( "\tcontiguous receive message count=%u, busy detect bool=%u, flow control bool=%u\n", + ::printf ( "\tcontiguous receive message count=%u, busy detect bool=%u, flow control bool=%u\n", this->contigRecvMsgCount, this->busyStateDetected, this->flowControlActive ); - ::printf ( "\receive thread is busy=%u\n", + ::printf ( "\receive thread is busy=%u\n", this->_receiveThreadIsBusy ); } if ( level > 2u ) { @@ -1070,7 +1070,7 @@ void tcpiiu::show ( unsigned level ) const if ( this->createReqPend.count () ) { ::printf ( "Create request pending channels\n" ); tsDLIterConst < nciu > pChan = this->createReqPend.firstIter (); - while ( pChan.valid () ) { + while ( pChan.valid () ) { pChan->show ( level - 2u ); pChan++; } @@ -1078,7 +1078,7 @@ void tcpiiu::show ( unsigned level ) const if ( this->createRespPend.count () ) { ::printf ( "Create response pending channels\n" ); tsDLIterConst < nciu > pChan = this->createRespPend.firstIter (); - while ( pChan.valid () ) { + while ( pChan.valid () ) { pChan->show ( level - 2u ); pChan++; } @@ -1086,7 +1086,7 @@ void tcpiiu::show ( unsigned level ) const if ( this->v42ConnCallbackPend.count () ) { ::printf ( "V42 Conn Callback pending channels\n" ); tsDLIterConst < nciu > pChan = this->v42ConnCallbackPend.firstIter (); - while ( pChan.valid () ) { + while ( pChan.valid () ) { pChan->show ( level - 2u ); pChan++; } @@ -1094,7 +1094,7 @@ void tcpiiu::show ( unsigned level ) const if ( this->subscripReqPend.count () ) { ::printf ( "Subscription request pending channels\n" ); tsDLIterConst < nciu > pChan = this->subscripReqPend.firstIter (); - while ( pChan.valid () ) { + while ( pChan.valid () ) { pChan->show ( level - 2u ); pChan++; } @@ -1102,7 +1102,7 @@ void tcpiiu::show ( unsigned level ) const if ( this->connectedList.count () ) { ::printf ( "Connected channels\n" ); tsDLIterConst < nciu > pChan = this->connectedList.firstIter (); - while ( pChan.valid () ) { + while ( pChan.valid () ) { pChan->show ( level - 2u ); pChan++; } @@ -1110,7 +1110,7 @@ void tcpiiu::show ( unsigned level ) const if ( this->unrespCircuit.count () ) { ::printf ( "Unresponsive circuit channels\n" ); tsDLIterConst < nciu > pChan = this->unrespCircuit.firstIter (); - while ( pChan.valid () ) { + while ( pChan.valid () ) { pChan->show ( level - 2u ); pChan++; } @@ -1143,8 +1143,8 @@ void tcpiiu::flushIfRecvProcessRequested ( } } -bool tcpiiu::processIncoming ( - const epicsTime & currentTime, +bool tcpiiu::processIncoming ( + const epicsTime & currentTime, callbackManager & mgr ) { mgr.cbGuard.assertIdenticalMutex ( this->cbMutex ); @@ -1156,7 +1156,7 @@ bool tcpiiu::processIncoming ( // if ( ! this->msgHeaderAvailable ) { if ( ! this->oldMsgHeaderAvailable ) { - this->oldMsgHeaderAvailable = + this->oldMsgHeaderAvailable = this->recvQue.popOldMsgHeader ( this->curMsg ); if ( ! this->oldMsgHeaderAvailable ) { epicsGuard < epicsMutex > guard ( this->mutex ); @@ -1165,8 +1165,8 @@ bool tcpiiu::processIncoming ( } } if ( this->curMsg.m_postsize == 0xffff ) { - static const unsigned annexSize = - sizeof ( this->curMsg.m_postsize ) + + static const unsigned annexSize = + sizeof ( this->curMsg.m_postsize ) + sizeof ( this->curMsg.m_count ); if ( this->recvQue.occupiedBytes () < annexSize ) { epicsGuard < epicsMutex > guard ( this->mutex ); @@ -1196,7 +1196,7 @@ bool tcpiiu::processIncoming ( // check for 8 byte aligned protocol if ( this->curMsg.m_postsize & 0x7 ) { this->printFormated ( mgr.cbGuard, - "CAC: server sent missaligned payload 0x%x\n", + "CAC: server sent missaligned payload 0x%x\n", this->curMsg.m_postsize ); return false; } @@ -1250,8 +1250,8 @@ bool tcpiiu::processIncoming ( if ( this->curMsg.m_postsize <= this->curDataMax ) { if ( this->curMsg.m_postsize > 0u ) { - this->curDataBytes += this->recvQue.copyOutBytes ( - &this->pCurData[this->curDataBytes], + this->curDataBytes += this->recvQue.copyOutBytes ( + &this->pCurData[this->curDataBytes], this->curMsg.m_postsize - this->curDataBytes ); if ( this->curDataBytes < this->curMsg.m_postsize ) { epicsGuard < epicsMutex > guard ( this->mutex ); @@ -1259,7 +1259,7 @@ bool tcpiiu::processIncoming ( return true; } } - bool msgOK = this->cacRef.executeResponse ( mgr, *this, + bool msgOK = this->cacRef.executeResponse ( mgr, *this, currentTime, this->curMsg, this->pCurData ); if ( ! msgOK ) { return false; @@ -1273,7 +1273,7 @@ bool tcpiiu::processIncoming ( this->curMsg.m_postsize ); once = true; } - this->curDataBytes += this->recvQue.removeBytes ( + this->curDataBytes += this->recvQue.removeBytes ( this->curMsg.m_postsize - this->curDataBytes ); if ( this->curDataBytes < this->curMsg.m_postsize ) { epicsGuard < epicsMutex > guard ( this->mutex ); @@ -1281,7 +1281,7 @@ bool tcpiiu::processIncoming ( return true; } } - + this->oldMsgHeaderAvailable = false; this->msgHeaderAvailable = false; this->curDataBytes = 0u; @@ -1295,7 +1295,7 @@ void tcpiiu::hostNameSetRequest ( epicsGuard < epicsMutex > & guard ) if ( ! CA_V41 ( this->minorProtocolVersion ) ) { return; } - + const char * pName = this->cacRef.pLocalHostName (); unsigned size = strlen ( pName ) + 1u; unsigned postSize = CA_MESSAGE_ALIGN ( size ); @@ -1306,9 +1306,9 @@ void tcpiiu::hostNameSetRequest ( epicsGuard < epicsMutex > & guard ) } comQueSendMsgMinder minder ( this->sendQue, guard ); - this->sendQue.insertRequestHeader ( - CA_PROTO_HOST_NAME, postSize, - 0u, 0u, 0u, 0u, + this->sendQue.insertRequestHeader ( + CA_PROTO_HOST_NAME, postSize, + 0u, 0u, 0u, 0u, CA_V49 ( this->minorProtocolVersion ) ); this->sendQue.pushString ( pName, size ); this->sendQue.pushString ( cacNillBytes, postSize - size ); @@ -1336,16 +1336,16 @@ void tcpiiu::userNameSetRequest ( epicsGuard < epicsMutex > & guard ) } comQueSendMsgMinder minder ( this->sendQue, guard ); - this->sendQue.insertRequestHeader ( - CA_PROTO_CLIENT_NAME, postSize, - 0u, 0u, 0u, 0u, + this->sendQue.insertRequestHeader ( + CA_PROTO_CLIENT_NAME, postSize, + 0u, 0u, 0u, 0u, CA_V49 ( this->minorProtocolVersion ) ); this->sendQue.pushString ( pName, size ); this->sendQue.pushString ( cacNillBytes, postSize - size ); minder.commit (); } -void tcpiiu::disableFlowControlRequest ( +void tcpiiu::disableFlowControlRequest ( epicsGuard < epicsMutex > & guard ) { guard.assertIdenticalMutex ( this->mutex ); @@ -1354,14 +1354,14 @@ void tcpiiu::disableFlowControlRequest ( this->flushRequest ( guard ); } comQueSendMsgMinder minder ( this->sendQue, guard ); - this->sendQue.insertRequestHeader ( - CA_PROTO_EVENTS_ON, 0u, - 0u, 0u, 0u, 0u, + this->sendQue.insertRequestHeader ( + CA_PROTO_EVENTS_ON, 0u, + 0u, 0u, 0u, 0u, CA_V49 ( this->minorProtocolVersion ) ); minder.commit (); } -void tcpiiu::enableFlowControlRequest ( +void tcpiiu::enableFlowControlRequest ( epicsGuard < epicsMutex > & guard ) { guard.assertIdenticalMutex ( this->mutex ); @@ -1370,9 +1370,9 @@ void tcpiiu::enableFlowControlRequest ( this->flushRequest ( guard ); } comQueSendMsgMinder minder ( this->sendQue, guard ); - this->sendQue.insertRequestHeader ( - CA_PROTO_EVENTS_OFF, 0u, - 0u, 0u, 0u, 0u, + this->sendQue.insertRequestHeader ( + CA_PROTO_EVENTS_OFF, 0u, + 0u, 0u, 0u, 0u, CA_V49 ( this->minorProtocolVersion ) ); minder.commit (); } @@ -1389,10 +1389,10 @@ void tcpiiu::versionMessage ( epicsGuard < epicsMutex > & guard, } comQueSendMsgMinder minder ( this->sendQue, guard ); - this->sendQue.insertRequestHeader ( - CA_PROTO_VERSION, 0u, - static_cast < ca_uint16_t > ( priority ), - CA_MINOR_PROTOCOL_REVISION, 0u, 0u, + this->sendQue.insertRequestHeader ( + CA_PROTO_VERSION, 0u, + static_cast < ca_uint16_t > ( priority ), + CA_MINOR_PROTOCOL_REVISION, 0u, 0u, CA_V49 ( this->minorProtocolVersion ) ); minder.commit (); } @@ -1400,7 +1400,7 @@ void tcpiiu::versionMessage ( epicsGuard < epicsMutex > & guard, void tcpiiu::echoRequest ( epicsGuard < epicsMutex > & guard ) { guard.assertIdenticalMutex ( this->mutex ); - + epicsUInt16 command = CA_PROTO_ECHO; if ( ! CA_V43 ( this->minorProtocolVersion ) ) { // we fake an echo to early server using a read sync @@ -1411,9 +1411,9 @@ void tcpiiu::echoRequest ( epicsGuard < epicsMutex > & guard ) this->flushRequest ( guard ); } comQueSendMsgMinder minder ( this->sendQue, guard ); - this->sendQue.insertRequestHeader ( - command, 0u, - 0u, 0u, 0u, 0u, + this->sendQue.insertRequestHeader ( + command, 0u, + 0u, 0u, 0u, 0u, CA_V49 ( this->minorProtocolVersion ) ); minder.commit (); } @@ -1426,7 +1426,7 @@ void tcpiiu::writeRequest ( epicsGuard < epicsMutex > & guard, throw cacChannel::badType (); } comQueSendMsgMinder minder ( this->sendQue, guard ); - this->sendQue.insertRequestWithPayLoad ( CA_PROTO_WRITE, + this->sendQue.insertRequestWithPayLoad ( CA_PROTO_WRITE, type, nElem, chan.getSID(guard), chan.getCID(guard), pValue, CA_V49 ( this->minorProtocolVersion ) ); minder.commit (); @@ -1434,7 +1434,7 @@ void tcpiiu::writeRequest ( epicsGuard < epicsMutex > & guard, void tcpiiu::writeNotifyRequest ( epicsGuard < epicsMutex > & guard, - nciu &chan, netWriteNotifyIO &io, unsigned type, + nciu &chan, netWriteNotifyIO &io, unsigned type, arrayElementCount nElem, const void *pValue ) { guard.assertIdenticalMutex ( this->mutex ); @@ -1446,14 +1446,14 @@ void tcpiiu::writeNotifyRequest ( epicsGuard < epicsMutex > & guard, throw cacChannel::badType (); } comQueSendMsgMinder minder ( this->sendQue, guard ); - this->sendQue.insertRequestWithPayLoad ( CA_PROTO_WRITE_NOTIFY, + this->sendQue.insertRequestWithPayLoad ( CA_PROTO_WRITE_NOTIFY, type, nElem, chan.getSID(guard), io.getId(), pValue, CA_V49 ( this->minorProtocolVersion ) ); minder.commit (); } void tcpiiu::readNotifyRequest ( epicsGuard < epicsMutex > & guard, - nciu & chan, netReadNotifyIO & io, + nciu & chan, netReadNotifyIO & io, unsigned dataType, arrayElementCount nElem ) { guard.assertIdenticalMutex ( this->mutex ); @@ -1467,7 +1467,7 @@ void tcpiiu::readNotifyRequest ( epicsGuard < epicsMutex > & guard, else { maxBytes = MAX_TCP; } - arrayElementCount maxElem = + arrayElementCount maxElem = ( maxBytes - dbr_size[dataType] ) / dbr_value_size[dataType]; if ( nElem > maxElem ) { throw cacChannel::msgBodyCacheTooSmall (); @@ -1475,21 +1475,21 @@ void tcpiiu::readNotifyRequest ( epicsGuard < epicsMutex > & guard, if (nElem == 0 && !CA_V413(this->minorProtocolVersion)) nElem = chan.getcount(); comQueSendMsgMinder minder ( this->sendQue, guard ); - this->sendQue.insertRequestHeader ( - CA_PROTO_READ_NOTIFY, 0u, - static_cast < ca_uint16_t > ( dataType ), - static_cast < ca_uint32_t > ( nElem ), - chan.getSID(guard), io.getId(), + this->sendQue.insertRequestHeader ( + CA_PROTO_READ_NOTIFY, 0u, + static_cast < ca_uint16_t > ( dataType ), + static_cast < ca_uint32_t > ( nElem ), + chan.getSID(guard), io.getId(), CA_V49 ( this->minorProtocolVersion ) ); minder.commit (); } -void tcpiiu::createChannelRequest ( +void tcpiiu::createChannelRequest ( nciu & chan, epicsGuard < epicsMutex > & guard ) { guard.assertIdenticalMutex ( this->mutex ); - if ( this->state != iiucs_connected && + if ( this->state != iiucs_connected && this->state != iiucs_connecting ) { return; } @@ -1520,9 +1520,9 @@ void tcpiiu::createChannelRequest ( // here to communicate the minor version number // starting with CA 4.1. // - this->sendQue.insertRequestHeader ( - CA_PROTO_CREATE_CHAN, postCnt, - 0u, 0u, identity, CA_MINOR_PROTOCOL_REVISION, + this->sendQue.insertRequestHeader ( + CA_PROTO_CREATE_CHAN, postCnt, + 0u, 0u, identity, CA_MINOR_PROTOCOL_REVISION, CA_V49 ( this->minorProtocolVersion ) ); if ( nameLength ) { this->sendQue.pushString ( pName, nameLength ); @@ -1543,9 +1543,9 @@ void tcpiiu::clearChannelRequest ( epicsGuard < epicsMutex > & guard, return; } comQueSendMsgMinder minder ( this->sendQue, guard ); - this->sendQue.insertRequestHeader ( - CA_PROTO_CLEAR_CHANNEL, 0u, - 0u, 0u, sid, cid, + this->sendQue.insertRequestHeader ( + CA_PROTO_CLEAR_CHANNEL, 0u, + 0u, 0u, sid, cid, CA_V49 ( this->minorProtocolVersion ) ); minder.commit (); } @@ -1554,14 +1554,14 @@ void tcpiiu::clearChannelRequest ( epicsGuard < epicsMutex > & guard, // this routine return void because if this internally fails the best response // is to try again the next time that we reconnect // -void tcpiiu::subscriptionRequest ( +void tcpiiu::subscriptionRequest ( epicsGuard < epicsMutex > & guard, nciu & chan, netSubscription & subscr ) { guard.assertIdenticalMutex ( this->mutex ); // there are situations where the circuit is disconnected, but // the channel does not know this yet - if ( this->state != iiucs_connected && + if ( this->state != iiucs_connected && this->state != iiucs_connecting ) { return; } @@ -1586,11 +1586,11 @@ void tcpiiu::subscriptionRequest ( } comQueSendMsgMinder minder ( this->sendQue, guard ); // nElement bounds checked above - this->sendQue.insertRequestHeader ( - CA_PROTO_EVENT_ADD, 16u, - static_cast < ca_uint16_t > ( dataType ), - static_cast < ca_uint32_t > ( nElem ), - chan.getSID(guard), subscr.getId(), + this->sendQue.insertRequestHeader ( + CA_PROTO_EVENT_ADD, 16u, + static_cast < ca_uint16_t > ( dataType ), + static_cast < ca_uint32_t > ( nElem ), + chan.getSID(guard), subscr.getId(), CA_V49 ( this->minorProtocolVersion ) ); // extension @@ -1606,7 +1606,7 @@ void tcpiiu::subscriptionRequest ( // this routine return void because if this internally fails the best response // is to try again the next time that we reconnect // -void tcpiiu::subscriptionUpdateRequest ( +void tcpiiu::subscriptionUpdateRequest ( epicsGuard < epicsMutex > & guard, nciu & chan, netSubscription & subscr ) { @@ -1633,11 +1633,11 @@ void tcpiiu::subscriptionUpdateRequest ( } comQueSendMsgMinder minder ( this->sendQue, guard ); // nElem boounds checked above - this->sendQue.insertRequestHeader ( - CA_PROTO_READ_NOTIFY, 0u, - static_cast < ca_uint16_t > ( dataType ), - static_cast < ca_uint32_t > ( nElem ), - chan.getSID (guard), subscr.getId (), + this->sendQue.insertRequestHeader ( + CA_PROTO_READ_NOTIFY, 0u, + static_cast < ca_uint16_t > ( dataType ), + static_cast < ca_uint32_t > ( nElem ), + chan.getSID (guard), subscr.getId (), CA_V49 ( this->minorProtocolVersion ) ); minder.commit (); } @@ -1652,12 +1652,12 @@ void tcpiiu::subscriptionCancelRequest ( epicsGuard < epicsMutex > & guard, return; } comQueSendMsgMinder minder ( this->sendQue, guard ); - this->sendQue.insertRequestHeader ( - CA_PROTO_EVENT_CANCEL, 0u, - static_cast < ca_uint16_t > ( subscr.getType ( guard ) ), + this->sendQue.insertRequestHeader ( + CA_PROTO_EVENT_CANCEL, 0u, + static_cast < ca_uint16_t > ( subscr.getType ( guard ) ), static_cast < ca_uint16_t > ( subscr.getCount ( guard, CA_V413(this->minorProtocolVersion) ) ), - chan.getSID(guard), subscr.getId(), + chan.getSID(guard), subscr.getId(), CA_V49 ( this->minorProtocolVersion ) ); minder.commit (); } @@ -1688,10 +1688,10 @@ bool tcpiiu::sendThreadFlush ( epicsGuard < epicsMutex > & guard ) return false; } - // set it here with this odd order because we must have + // set it here with this odd order because we must have // the lock and we must have already sent the bytes this->unacknowledgedSendBytes += bytesToBeSent; - if ( this->unacknowledgedSendBytes > + if ( this->unacknowledgedSendBytes > this->socketLibrarySendBufferSize ) { this->recvDog.sendBacklogProgressNotify ( guard ); } @@ -1711,25 +1711,25 @@ void tcpiiu :: flush ( epicsGuard < epicsMutex > & guard ) this->flushRequest ( guard ); // the process thread is not permitted to flush as this // can result in a push / pull deadlock on the TCP pipe. - // Instead, the process thread scheduals the flush with the - // send thread which runs at a higher priority than the + // Instead, the process thread scheduals the flush with the + // send thread which runs at a higher priority than the // receive thread. The same applies to the UDP thread for // locking hierarchy reasons. if ( ! epicsThreadPrivateGet ( caClientCallbackThreadId ) ) { // enable / disable of call back preemption must occur here // because the tcpiiu might disconnect while waiting and its - // pointer to this cac might become invalid + // pointer to this cac might become invalid assert ( this->blockingForFlush < UINT_MAX ); this->blockingForFlush++; while ( this->sendQue.flushBlockThreshold() ) { bool userRequestsCanBeAccepted = this->state == iiucs_connected || - ( ! this->ca_v42_ok ( guard ) && + ( ! this->ca_v42_ok ( guard ) && this->state == iiucs_connecting ); // fail the users request if we have a disconnected // or unresponsive circuit - if ( ! userRequestsCanBeAccepted || + if ( ! userRequestsCanBeAccepted || this->unresponsiveCircuit ) { this->decrementBlockingForFlushCount ( guard ); throw cacChannel::notConnected (); @@ -1742,7 +1742,7 @@ void tcpiiu :: flush ( epicsGuard < epicsMutex > & guard ) } } -unsigned tcpiiu::requestMessageBytesPending ( +unsigned tcpiiu::requestMessageBytesPending ( epicsGuard < epicsMutex > & guard ) { guard.assertIdenticalMutex ( this->mutex ); @@ -1755,7 +1755,7 @@ unsigned tcpiiu::requestMessageBytesPending ( return sendQue.occupiedBytes (); } -void tcpiiu::decrementBlockingForFlushCount ( +void tcpiiu::decrementBlockingForFlushCount ( epicsGuard < epicsMutex > & guard ) { guard.assertIdenticalMutex ( this->mutex ); @@ -1788,10 +1788,10 @@ void tcpiiu::requestRecvProcessPostponedFlush ( this->recvProcessPostponedFlush = true; } -unsigned tcpiiu::getHostName ( +unsigned tcpiiu::getHostName ( epicsGuard < epicsMutex > & guard, char * pBuf, unsigned bufLength ) const throw () -{ +{ guard.assertIdenticalMutex ( this->mutex ); return this->hostNameCacheInstance.getName ( pBuf, bufLength ); } @@ -1803,8 +1803,8 @@ const char * tcpiiu::pHostName ( return this->hostNameCacheInstance.pointer (); } -void tcpiiu::disconnectAllChannels ( - epicsGuard < epicsMutex > & cbGuard, +void tcpiiu::disconnectAllChannels ( + epicsGuard < epicsMutex > & cbGuard, epicsGuard < epicsMutex > & guard, class udpiiu & discIIU ) { @@ -1817,21 +1817,21 @@ void tcpiiu::disconnectAllChannels ( while ( nciu * pChan = this->createRespPend.get () ) { // we dont yet know the server's id so we cant - // send a channel delete request and will instead + // send a channel delete request and will instead // trust that the server can do the proper cleanup // when the circuit disconnects discIIU.installDisconnectedChannel ( guard, *pChan ); } - + while ( nciu * pChan = this->v42ConnCallbackPend.get () ) { - this->clearChannelRequest ( guard, + this->clearChannelRequest ( guard, pChan->getSID(guard), pChan->getCID(guard) ); discIIU.installDisconnectedChannel ( guard, *pChan ); } while ( nciu * pChan = this->subscripReqPend.get () ) { pChan->disconnectAllIO ( cbGuard, guard ); - this->clearChannelRequest ( guard, + this->clearChannelRequest ( guard, pChan->getSID(guard), pChan->getCID(guard) ); discIIU.installDisconnectedChannel ( guard, *pChan ); pChan->unresponsiveCircuitNotify ( cbGuard, guard ); @@ -1839,7 +1839,7 @@ void tcpiiu::disconnectAllChannels ( while ( nciu * pChan = this->connectedList.get () ) { pChan->disconnectAllIO ( cbGuard, guard ); - this->clearChannelRequest ( guard, + this->clearChannelRequest ( guard, pChan->getSID(guard), pChan->getCID(guard) ); discIIU.installDisconnectedChannel ( guard, *pChan ); pChan->unresponsiveCircuitNotify ( cbGuard, guard ); @@ -1847,16 +1847,16 @@ void tcpiiu::disconnectAllChannels ( while ( nciu * pChan = this->unrespCircuit.get () ) { // if we know that the circuit is unresponsive - // then we dont send a channel delete request and - // will instead trust that the server can do the + // then we dont send a channel delete request and + // will instead trust that the server can do the // proper cleanup when the circuit disconnects pChan->disconnectAllIO ( cbGuard, guard ); discIIU.installDisconnectedChannel ( guard, *pChan ); } - + while ( nciu * pChan = this->subscripUpdateReqPend.get () ) { pChan->disconnectAllIO ( cbGuard, guard ); - this->clearChannelRequest ( guard, + this->clearChannelRequest ( guard, pChan->getSID(guard), pChan->getCID(guard) ); discIIU.installDisconnectedChannel ( guard, *pChan ); pChan->unresponsiveCircuitNotify ( cbGuard, guard ); @@ -1866,71 +1866,71 @@ void tcpiiu::disconnectAllChannels ( this->initiateCleanShutdown ( guard ); } -void tcpiiu::unlinkAllChannels ( - epicsGuard < epicsMutex > & cbGuard, +void tcpiiu::unlinkAllChannels ( + epicsGuard < epicsMutex > & cbGuard, epicsGuard < epicsMutex > & guard ) { cbGuard.assertIdenticalMutex ( this->cbMutex ); guard.assertIdenticalMutex ( this->mutex ); while ( nciu * pChan = this->createReqPend.get () ) { - pChan->channelNode::listMember = + pChan->channelNode::listMember = channelNode::cs_none; pChan->serviceShutdownNotify ( cbGuard, guard ); } while ( nciu * pChan = this->createRespPend.get () ) { - pChan->channelNode::listMember = + pChan->channelNode::listMember = channelNode::cs_none; // we dont yet know the server's id so we cant - // send a channel delete request and will instead + // send a channel delete request and will instead // trust that the server can do the proper cleanup // when the circuit disconnects pChan->serviceShutdownNotify ( cbGuard, guard ); } - + while ( nciu * pChan = this->v42ConnCallbackPend.get () ) { - pChan->channelNode::listMember = + pChan->channelNode::listMember = channelNode::cs_none; - this->clearChannelRequest ( guard, + this->clearChannelRequest ( guard, pChan->getSID(guard), pChan->getCID(guard) ); pChan->serviceShutdownNotify ( cbGuard, guard ); } while ( nciu * pChan = this->subscripReqPend.get () ) { - pChan->channelNode::listMember = + pChan->channelNode::listMember = channelNode::cs_none; pChan->disconnectAllIO ( cbGuard, guard ); - this->clearChannelRequest ( guard, + this->clearChannelRequest ( guard, pChan->getSID(guard), pChan->getCID(guard) ); pChan->serviceShutdownNotify ( cbGuard, guard ); } while ( nciu * pChan = this->connectedList.get () ) { - pChan->channelNode::listMember = + pChan->channelNode::listMember = channelNode::cs_none; pChan->disconnectAllIO ( cbGuard, guard ); - this->clearChannelRequest ( guard, + this->clearChannelRequest ( guard, pChan->getSID(guard), pChan->getCID(guard) ); pChan->serviceShutdownNotify ( cbGuard, guard ); } while ( nciu * pChan = this->unrespCircuit.get () ) { - pChan->channelNode::listMember = + pChan->channelNode::listMember = channelNode::cs_none; pChan->disconnectAllIO ( cbGuard, guard ); // if we know that the circuit is unresponsive - // then we dont send a channel delete request and - // will instead trust that the server can do the + // then we dont send a channel delete request and + // will instead trust that the server can do the // proper cleanup when the circuit disconnects pChan->serviceShutdownNotify ( cbGuard, guard ); } - + while ( nciu * pChan = this->subscripUpdateReqPend.get () ) { - pChan->channelNode::listMember = + pChan->channelNode::listMember = channelNode::cs_none; pChan->disconnectAllIO ( cbGuard, guard ); - this->clearChannelRequest ( guard, + this->clearChannelRequest ( guard, pChan->getSID(guard), pChan->getCID(guard) ); pChan->serviceShutdownNotify ( cbGuard, guard ); } @@ -1939,9 +1939,9 @@ void tcpiiu::unlinkAllChannels ( this->initiateCleanShutdown ( guard ); } -void tcpiiu::installChannel ( - epicsGuard < epicsMutex > & guard, - nciu & chan, unsigned sidIn, +void tcpiiu::installChannel ( + epicsGuard < epicsMutex > & guard, + nciu & chan, unsigned sidIn, ca_uint16_t typeIn, arrayElementCount countIn ) { guard.assertIdenticalMutex ( this->mutex ); @@ -1950,12 +1950,12 @@ void tcpiiu::installChannel ( this->channelCountTot++; chan.channelNode::listMember = channelNode::cs_createReqPend; chan.searchReplySetUp ( *this, sidIn, typeIn, countIn, guard ); - // The tcp send thread runs at apriority below the udp thread + // The tcp send thread runs at apriority below the udp thread // so that this will not send small packets this->sendThreadFlushEvent.signal (); } -bool tcpiiu :: connectNotify ( +bool tcpiiu :: connectNotify ( epicsGuard < epicsMutex > & guard, nciu & chan ) { guard.assertIdenticalMutex ( this->mutex ); @@ -1979,7 +1979,7 @@ bool tcpiiu :: connectNotify ( return wasExpected; } -void tcpiiu::uninstallChan ( +void tcpiiu::uninstallChan ( epicsGuard < epicsMutex > & guard, nciu & chan ) { guard.assertIdenticalMutex ( this->mutex ); @@ -2007,7 +2007,7 @@ void tcpiiu::uninstallChan ( this->subscripUpdateReqPend.remove ( chan ); break; default: - errlogPrintf ( + errlogPrintf ( "cac: attempt to uninstall channel from tcp iiu, but it inst installed there?" ); } chan.channelNode::listMember = channelNode::cs_none; @@ -2017,8 +2017,8 @@ void tcpiiu::uninstallChan ( } } -int tcpiiu :: printFormated ( - epicsGuard < epicsMutex > & cbGuard, +int tcpiiu :: printFormated ( + epicsGuard < epicsMutex > & cbGuard, const char *pformat, ... ) { cbGuard.assertIdenticalMutex ( this->cbMutex ); @@ -2027,11 +2027,11 @@ int tcpiiu :: printFormated ( int status; va_start ( theArgs, pformat ); - + status = this->cacRef.varArgsPrintFormated ( cbGuard, pformat, theArgs ); - + va_end ( theArgs ); - + return status; } @@ -2053,7 +2053,7 @@ bool tcpiiu::bytesArePendingInOS () const tmo.tv_usec = 0; int status = select ( this->sock + 1, & readBits, NULL, NULL, & tmo ); if ( status > 0 ) { - if ( FD_ISSET ( this->sock, & readBits ) ) { + if ( FD_ISSET ( this->sock, & readBits ) ) { return true; } } @@ -2078,8 +2078,8 @@ double tcpiiu::receiveWatchdogDelay ( } /* - * Certain OS, such as HPUX, do not unblock a socket system call - * when another thread asynchronously calls both shutdown() and + * Certain OS, such as HPUX, do not unblock a socket system call + * when another thread asynchronously calls both shutdown() and * close(). To solve this problem we need to employ OS specific * mechanisms. */ @@ -2116,8 +2116,8 @@ unsigned tcpiiu::channelCount ( epicsGuard < epicsMutex > & guard ) return this->channelCountTot; } -void tcpiiu::uninstallChanDueToSuccessfulSearchResponse ( - epicsGuard < epicsMutex > & guard, nciu & chan, +void tcpiiu::uninstallChanDueToSuccessfulSearchResponse ( + epicsGuard < epicsMutex > & guard, nciu & chan, const class epicsTime & currentTime ) { netiiu::uninstallChanDueToSuccessfulSearchResponse ( @@ -2125,7 +2125,7 @@ void tcpiiu::uninstallChanDueToSuccessfulSearchResponse ( } bool tcpiiu::searchMsg ( - epicsGuard < epicsMutex > & guard, ca_uint32_t id, + epicsGuard < epicsMutex > & guard, ca_uint32_t id, const char * pName, unsigned nameLength ) { return netiiu::searchMsg ( @@ -2192,7 +2192,7 @@ void tcpiiu :: versionRespNotify ( const caHdrLargeArray & msg ) void tcpiiu :: searchRespNotify ( const epicsTime & currentTime, const caHdrLargeArray & msg ) -{ +{ /* * the type field is abused to carry the port number * so that we can have multiple servers on one host @@ -2206,7 +2206,7 @@ void tcpiiu :: searchRespNotify ( else { serverAddr = this->address (); } - cacRef.transferChanToVirtCircuit - ( msg.m_available, msg.m_cid, 0xffff, + cacRef.transferChanToVirtCircuit + ( msg.m_available, msg.m_cid, 0xffff, 0, minorProtocolVersion, serverAddr, currentTime ); } diff --git a/modules/ca/src/client/test/ca_test.c b/modules/ca/src/client/test/ca_test.c index 998536843..0ecfee8c8 100644 --- a/modules/ca/src/client/test/ca_test.c +++ b/modules/ca/src/client/test/ca_test.c @@ -5,11 +5,11 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* - * Author: Jeff Hill - * Date: 07-01-91 + * Author: Jeff Hill + * Date: 07-01-91 */ /* @@ -32,24 +32,24 @@ static unsigned long outstanding; /* - * ca_test + * ca_test * - * find channel, write a value if supplied, and - * read back the current value + * find channel, write a value if supplied, and + * read back the current value * */ int ca_test( -char *pname, -char *pvalue +char *pname, +char *pvalue ) { int status; - if(pvalue){ - status = capft(pname,pvalue); - } - else{ - status = cagft(pname); - } + if(pvalue){ + status = capft(pname,pvalue); + } + else{ + status = cagft(pname); + } ca_task_exit(); return status; } @@ -57,244 +57,244 @@ char *pvalue /* - * cagft() + * cagft() * - * ca get field test + * ca get field test * - * test ca get over the range of CA data types + * test ca get over the range of CA data types */ static int cagft(char *pname) -{ - const unsigned maxTries = 1000ul; - unsigned ntries = 0u; - chid chan_id; - int status; - int i; +{ + const unsigned maxTries = 1000ul; + unsigned ntries = 0u; + chid chan_id; + int status; + int i; - /* - * convert name to chan id - */ - status = ca_search(pname, &chan_id); - SEVCHK(status,NULL); - status = ca_pend_io(5.0); - if(status != ECA_NORMAL){ + /* + * convert name to chan id + */ + status = ca_search(pname, &chan_id); + SEVCHK(status,NULL); + status = ca_pend_io(5.0); + if(status != ECA_NORMAL){ SEVCHK(ca_clear_channel(chan_id),NULL); - printf("Not Found %s\n", pname); - return -1; - } + printf("Not Found %s\n", pname); + return -1; + } - printf("name:\t%s\n", + printf("name:\t%s\n", ca_name(chan_id)); - printf("native type:\t%s\n", + printf("native type:\t%s\n", dbr_type_to_text(ca_field_type(chan_id))); - printf("native count:\t%lu\n", + printf("native count:\t%lu\n", ca_element_count(chan_id)); - /* - * fetch as each type - */ - for(i=0; i<=LAST_BUFFER_TYPE; i++){ - if(ca_field_type(chan_id)==DBR_STRING) { - if( (i!=DBR_STRING) - && (i!=DBR_STS_STRING) - && (i!=DBR_TIME_STRING) - && (i!=DBR_GR_STRING) + /* + * fetch as each type + */ + for(i=0; i<=LAST_BUFFER_TYPE; i++){ + if(ca_field_type(chan_id)==DBR_STRING) { + if( (i!=DBR_STRING) + && (i!=DBR_STS_STRING) + && (i!=DBR_TIME_STRING) + && (i!=DBR_GR_STRING) && (i!=DBR_CTRL_STRING)) { continue; } } /* ignore write only types */ - if ( - i == DBR_PUT_ACKT || + if ( + i == DBR_PUT_ACKT || i == DBR_PUT_ACKS ) { continue; } - status = ca_array_get_callback( - i, - ca_element_count(chan_id), - chan_id, - printit, - NULL); - SEVCHK(status, NULL); + status = ca_array_get_callback( + i, + ca_element_count(chan_id), + chan_id, + printit, + NULL); + SEVCHK(status, NULL); - outstanding++; - } + outstanding++; + } - /* - * wait for the operation to complete - * before returning - */ - while ( ntries < maxTries ) { - unsigned long oldOut; + /* + * wait for the operation to complete + * before returning + */ + while ( ntries < maxTries ) { + unsigned long oldOut; - oldOut = outstanding; - ca_pend_event ( 0.05 ); + oldOut = outstanding; + ca_pend_event ( 0.05 ); - if ( ! outstanding ) { + if ( ! outstanding ) { SEVCHK ( ca_clear_channel ( chan_id ), NULL ); - printf ( "\n\n" ); - return 0; - } + printf ( "\n\n" ); + return 0; + } - if ( outstanding == oldOut ) { - ntries++; - } - } + if ( outstanding == oldOut ) { + ntries++; + } + } SEVCHK ( ca_clear_channel ( chan_id ), NULL ); - return -1; + return -1; } /* - * PRINTIT() + * PRINTIT() */ static void printit ( struct event_handler_args args ) { - if ( args.status == ECA_NORMAL ) { - ca_dump_dbr ( args.type, args.count, args.dbr ); - } - else { + if ( args.status == ECA_NORMAL ) { + ca_dump_dbr ( args.type, args.count, args.dbr ); + } + else { printf ( "%s\t%s\n", dbr_text[args.type], ca_message(args.status) ); - } + } - outstanding--; + outstanding--; } /* - * capft + * capft + * + * test ca_put() over a range of data types * - * test ca_put() over a range of data types - * */ static int capft( -char *pname, -char *pvalue +char *pname, +char *pvalue ) { - dbr_short_t shortvalue; - dbr_long_t longvalue; - dbr_float_t floatvalue; - dbr_char_t charvalue; - dbr_double_t doublevalue; - unsigned long ntries = 10ul; - int status; - chid chan_id; + dbr_short_t shortvalue; + dbr_long_t longvalue; + dbr_float_t floatvalue; + dbr_char_t charvalue; + dbr_double_t doublevalue; + unsigned long ntries = 10ul; + int status; + chid chan_id; - if (((*pname < ' ') || (*pname > 'z')) - || ((*pvalue < ' ') || (*pvalue > 'z'))){ - printf("\nusage \"pv name\",\"value\"\n"); - return -1; - } + if (((*pname < ' ') || (*pname > 'z')) + || ((*pvalue < ' ') || (*pvalue > 'z'))){ + printf("\nusage \"pv name\",\"value\"\n"); + return -1; + } - /* - * convert name to chan id - */ - status = ca_search(pname, &chan_id); - SEVCHK(status,NULL); - status = ca_pend_io(5.0); - if(status != ECA_NORMAL){ + /* + * convert name to chan id + */ + status = ca_search(pname, &chan_id); + SEVCHK(status,NULL); + status = ca_pend_io(5.0); + if(status != ECA_NORMAL){ SEVCHK(ca_clear_channel(chan_id),NULL); - printf("Not Found %s\n", pname); - return -1; - } + printf("Not Found %s\n", pname); + return -1; + } - printf("name:\t%s\n", ca_name(chan_id)); - printf("native type:\t%d\n", ca_field_type(chan_id)); - printf("native count:\t%lu\n", ca_element_count(chan_id)); + printf("name:\t%s\n", ca_name(chan_id)); + printf("native type:\t%d\n", ca_field_type(chan_id)); + printf("native count:\t%lu\n", ca_element_count(chan_id)); - /* - * string value ca_put - */ - status = ca_put( - DBR_STRING, - chan_id, - pvalue); - SEVCHK(status, NULL); - verify_value(chan_id, DBR_STRING); + /* + * string value ca_put + */ + status = ca_put( + DBR_STRING, + chan_id, + pvalue); + SEVCHK(status, NULL); + verify_value(chan_id, DBR_STRING); - if(ca_field_type(chan_id)==0)goto skip_rest; + if(ca_field_type(chan_id)==0)goto skip_rest; - if(sscanf(pvalue,"%hd",&shortvalue)==1) { - /* - * short integer ca_put - */ - status = ca_put( - DBR_SHORT, - chan_id, - &shortvalue); - SEVCHK(status, NULL); - verify_value(chan_id, DBR_SHORT); - status = ca_put( - DBR_ENUM, - chan_id, - &shortvalue); - SEVCHK(status, NULL); - verify_value(chan_id, DBR_ENUM); - charvalue=(dbr_char_t)shortvalue; - status = ca_put( - DBR_CHAR, - chan_id, - &charvalue); - SEVCHK(status, NULL); - verify_value(chan_id, DBR_CHAR); - } - if(sscanf(pvalue,"%d",&longvalue)==1) { - /* - * long integer ca_put - */ - status = ca_put( - DBR_LONG, - chan_id, - &longvalue); - SEVCHK(status, NULL); - verify_value(chan_id, DBR_LONG); - } - if(epicsScanFloat(pvalue, &floatvalue)==1) { - /* - * single precision float ca_put - */ - status = ca_put( - DBR_FLOAT, - chan_id, - &floatvalue); - SEVCHK(status, NULL); - verify_value(chan_id, DBR_FLOAT); - } - if(epicsScanDouble(pvalue, &doublevalue)==1) { - /* - * double precision float ca_put - */ - status = ca_put( - DBR_DOUBLE, - chan_id, - &doublevalue); - SEVCHK(status, NULL); - verify_value(chan_id, DBR_DOUBLE); - } + if(sscanf(pvalue,"%hd",&shortvalue)==1) { + /* + * short integer ca_put + */ + status = ca_put( + DBR_SHORT, + chan_id, + &shortvalue); + SEVCHK(status, NULL); + verify_value(chan_id, DBR_SHORT); + status = ca_put( + DBR_ENUM, + chan_id, + &shortvalue); + SEVCHK(status, NULL); + verify_value(chan_id, DBR_ENUM); + charvalue=(dbr_char_t)shortvalue; + status = ca_put( + DBR_CHAR, + chan_id, + &charvalue); + SEVCHK(status, NULL); + verify_value(chan_id, DBR_CHAR); + } + if(sscanf(pvalue,"%d",&longvalue)==1) { + /* + * long integer ca_put + */ + status = ca_put( + DBR_LONG, + chan_id, + &longvalue); + SEVCHK(status, NULL); + verify_value(chan_id, DBR_LONG); + } + if(epicsScanFloat(pvalue, &floatvalue)==1) { + /* + * single precision float ca_put + */ + status = ca_put( + DBR_FLOAT, + chan_id, + &floatvalue); + SEVCHK(status, NULL); + verify_value(chan_id, DBR_FLOAT); + } + if(epicsScanDouble(pvalue, &doublevalue)==1) { + /* + * double precision float ca_put + */ + status = ca_put( + DBR_DOUBLE, + chan_id, + &doublevalue); + SEVCHK(status, NULL); + verify_value(chan_id, DBR_DOUBLE); + } skip_rest: - /* - * wait for the operation to complete - * (outstabnding decrements to zero) - */ - while(ntries){ - ca_pend_event(1.0); + /* + * wait for the operation to complete + * (outstabnding decrements to zero) + */ + while(ntries){ + ca_pend_event(1.0); - if(!outstanding){ + if(!outstanding){ SEVCHK(ca_clear_channel(chan_id),NULL); - printf("\n\n"); - return 0; - } + printf("\n\n"); + return 0; + } - ntries--; - } + ntries--; + } SEVCHK(ca_clear_channel(chan_id),NULL); - return -1; + return -1; } @@ -305,19 +305,19 @@ skip_rest: */ static void verify_value(chid chan_id, chtype type) { - int status; + int status; - /* - * issue a get which calls back `printit' - * upon completion - */ - status = ca_array_get_callback( - type, - ca_element_count(chan_id), - chan_id, - printit, - NULL); - SEVCHK(status, NULL); + /* + * issue a get which calls back `printit' + * upon completion + */ + status = ca_array_get_callback( + type, + ca_element_count(chan_id), + chan_id, + printit, + NULL); + SEVCHK(status, NULL); - outstanding++; + outstanding++; } diff --git a/modules/ca/src/client/test/ca_test.h b/modules/ca/src/client/test/ca_test.h index 076f8936a..2b7e3f178 100644 --- a/modules/ca/src/client/test/ca_test.h +++ b/modules/ca/src/client/test/ca_test.h @@ -5,11 +5,11 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* - * Author: Jeff Hill - * Date: 21JAN2000 + * Author: Jeff Hill + * Date: 21JAN2000 */ #ifdef __cplusplus diff --git a/modules/ca/src/client/test/ca_test_main.c b/modules/ca/src/client/test/ca_test_main.c index 85fd7ea19..7d70f67ca 100644 --- a/modules/ca/src/client/test/ca_test_main.c +++ b/modules/ca/src/client/test/ca_test_main.c @@ -5,11 +5,11 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* - * Author: Jeff Hill - * Date: 21JAN2000 + * Author: Jeff Hill + * Date: 21JAN2000 */ #include #include @@ -20,36 +20,36 @@ int main(int argc, char **argv) { - /* - * print error and return if arguments are invalid - */ - if(argc < 2 || argc > 3){ - printf("usage: %s [optional value to be written]\n", argv[0]); - printf("the following arguments were received\n"); - while(argc>0) { - printf("%s\n",argv[0]); - argv++; argc--; - } - return -1; - } + /* + * print error and return if arguments are invalid + */ + if(argc < 2 || argc > 3){ + printf("usage: %s [optional value to be written]\n", argv[0]); + printf("the following arguments were received\n"); + while(argc>0) { + printf("%s\n",argv[0]); + argv++; argc--; + } + return -1; + } - /* - * check for supplied value - */ - if(argc == 2){ - return ca_test(argv[1], NULL); - } - else if(argc == 3){ - char *pt; + /* + * check for supplied value + */ + if(argc == 2){ + return ca_test(argv[1], NULL); + } + else if(argc == 3){ + char *pt; - /* strip leading and trailing quotes*/ - if(argv[2][1]=='"') argv[2]++; - if( (pt=strchr(argv[2],'"')) ) *pt = 0; - return ca_test(argv[1], argv[2]); - } - else{ - return -1; - } + /* strip leading and trailing quotes*/ + if(argv[2][1]=='"') argv[2]++; + if( (pt=strchr(argv[2],'"')) ) *pt = 0; + return ca_test(argv[1], argv[2]); + } + else{ + return -1; + } } diff --git a/modules/ca/src/client/test_event.cpp b/modules/ca/src/client/test_event.cpp index 18469ab3b..bcd24c528 100644 --- a/modules/ca/src/client/test_event.cpp +++ b/modules/ca/src/client/test_event.cpp @@ -30,7 +30,7 @@ extern "C" void epicsStdCall ca_test_event ( struct event_handler_args args ) } } - printf ( "ca_test_event() for channel \"%s\" with native type %s\n", + printf ( "ca_test_event() for channel \"%s\" with native type %s\n", ca_name(args.chid), pNativeTypeName ); if ( ! ( CA_M_SUCCESS & args.status ) ) { @@ -130,7 +130,7 @@ extern "C" void epicsStdCall ca_dump_dbr ( case DBR_GR_STRING: case DBR_CTRL_STRING: { - struct dbr_sts_string *pvalue + struct dbr_sts_string *pvalue = (struct dbr_sts_string *) pbuffer; printf("%2d %2d",pvalue->status,pvalue->severity); printf("\tValue: %s",pvalue->value); @@ -217,7 +217,7 @@ extern "C" void epicsStdCall ca_dump_dbr ( } case DBR_TIME_STRING: { - struct dbr_time_string *pvalue + struct dbr_time_string *pvalue = (struct dbr_time_string *) pbuffer; epicsTimeToStrftime(tsString,sizeof(tsString), @@ -562,12 +562,12 @@ extern "C" void epicsStdCall ca_dump_dbr ( } case DBR_STSACK_STRING: { - struct dbr_stsack_string *pvalue - = (struct dbr_stsack_string *)pbuffer; - printf("%2d %2d",pvalue->status,pvalue->severity); - printf(" %2d %2d",pvalue->ackt,pvalue->acks); - printf(" %s",pvalue->value); - break; + struct dbr_stsack_string *pvalue + = (struct dbr_stsack_string *)pbuffer; + printf("%2d %2d",pvalue->status,pvalue->severity); + printf(" %2d %2d",pvalue->ackt,pvalue->acks); + printf(" %s",pvalue->value); + break; } case DBR_CLASS_NAME: { @@ -577,7 +577,7 @@ extern "C" void epicsStdCall ca_dump_dbr ( break; } default: - printf ( + printf ( "unsupported by ca_dbrDump()" ); break; } diff --git a/modules/ca/src/client/udpiiu.cpp b/modules/ca/src/client/udpiiu.cpp index e88abc874..9d424f1fc 100644 --- a/modules/ca/src/client/udpiiu.cpp +++ b/modules/ca/src/client/udpiiu.cpp @@ -41,7 +41,7 @@ #include "disconnectGovernorTimer.h" // UDP protocol dispatch table -const udpiiu::pProtoStubUDP udpiiu::udpJumpTableCAC [] = +const udpiiu::pProtoStubUDP udpiiu::udpJumpTableCAC [] = { &udpiiu::versionAction, &udpiiu::badUDPRespAction, @@ -112,16 +112,16 @@ unsigned getNTimers(double maxPeriod) // // udpiiu::udpiiu () // -udpiiu::udpiiu ( +udpiiu::udpiiu ( epicsGuard < epicsMutex > & cacGuard, - epicsTimerQueueActive & timerQueue, - epicsMutex & cbMutexIn, + epicsTimerQueueActive & timerQueue, + epicsMutex & cbMutexIn, epicsMutex & cacMutexIn, cacContextNotify & ctxNotifyIn, cac & cac, unsigned port, tsDLList < SearchDest > & searchDestListIn ) : - recvThread ( *this, ctxNotifyIn, cbMutexIn, "CAC-UDP", + recvThread ( *this, ctxNotifyIn, cbMutexIn, "CAC-UDP", epicsThreadGetStackSize ( epicsThreadStackMedium ), cac::lowestPriorityLevelAbove ( cac::lowestPriorityLevelAbove ( @@ -158,19 +158,19 @@ udpiiu::udpiiu ( } for ( unsigned i = 0; i < this->nTimers; i++ ) { - this->ppSearchTmr[i].reset ( - new searchTimer ( *this, timerQueue, i, cacMutexIn, - i > this->beaconAnomalyTimerIndex ) ); + this->ppSearchTmr[i].reset ( + new searchTimer ( *this, timerQueue, i, cacMutexIn, + i > this->beaconAnomalyTimerIndex ) ); } - this->repeaterPort = + this->repeaterPort = envGetInetPortConfigParam ( &EPICS_CA_REPEATER_PORT, static_cast (CA_REPEATER_PORT) ); this->sock = epicsSocketCreate ( AF_INET, SOCK_DGRAM, IPPROTO_UDP ); if ( this->sock == INVALID_SOCKET ) { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); errlogPrintf ("CAC: unable to create datagram socket because = \"%s\"\n", sockErrBuf ); @@ -207,11 +207,11 @@ udpiiu::udpiiu ( #endif int boolValue = true; - int status = setsockopt ( this->sock, SOL_SOCKET, SO_BROADCAST, + int status = setsockopt ( this->sock, SOL_SOCKET, SO_BROADCAST, (char *) &boolValue, sizeof ( boolValue ) ); if ( status < 0 ) { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); errlogPrintf ("CAC: IP broadcasting enable failed because = \"%s\"\n", sockErrBuf ); @@ -243,26 +243,26 @@ udpiiu::udpiiu ( osiSockAddr addr; memset ( (char *)&addr, 0 , sizeof (addr) ); addr.ia.sin_family = AF_INET; - addr.ia.sin_addr.s_addr = htonl ( INADDR_ANY ); + addr.ia.sin_addr.s_addr = htonl ( INADDR_ANY ); addr.ia.sin_port = htons ( PORT_ANY ); status = bind (this->sock, &addr.sa, sizeof (addr) ); if ( status < 0 ) { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); epicsSocketDestroy (this->sock); errlogPrintf ( "CAC: unable to bind to an unconstrained address because = \"%s\"\n", sockErrBuf ); throwWithLocation ( noSocket () ); } - + { osiSockAddr tmpAddr; osiSocklen_t saddr_length = sizeof ( tmpAddr ); status = getsockname ( this->sock, &tmpAddr.sa, &saddr_length ); if ( status < 0 ) { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); epicsSocketDestroy ( this->sock ); errlogPrintf ( "CAC: getsockname () error was \"%s\"\n", sockErrBuf ); @@ -283,9 +283,9 @@ udpiiu::udpiiu ( ELLLIST dest; ellInit ( & dest ); configureChannelAccessAddressList ( & dest, this->sock, this->serverPort ); - while ( osiSockAddrNode * + while ( osiSockAddrNode * pNode = reinterpret_cast < osiSockAddrNode * > ( ellGet ( & dest ) ) ) { - SearchDestUDP & searchDest = * + SearchDestUDP & searchDest = * new SearchDestUDP ( pNode->addr, *this ); _searchDestList.add ( searchDest ); free ( pNode ); @@ -293,14 +293,14 @@ udpiiu::udpiiu ( /* add list of tcp name service addresses */ _searchDestList.add ( searchDestListIn ); - + caStartRepeaterIfNotInstalled ( this->repeaterPort ); this->pushVersionMsg (); // start timers and receive thread for ( unsigned j =0; j < this->nTimers; j++ ) { - this->ppSearchTmr[j]->start ( cacGuard ); + this->ppSearchTmr[j]->start ( cacGuard ); } this->govTmr.start (); this->repeaterSubscribeTmr.start (); @@ -325,19 +325,19 @@ udpiiu::~udpiiu () iter++; delete & curr; } - + epicsSocketDestroy ( this->sock ); } -void udpiiu::shutdown ( - epicsGuard < epicsMutex > & cbGuard, +void udpiiu::shutdown ( + epicsGuard < epicsMutex > & cbGuard, epicsGuard < epicsMutex > & guard ) { // stop all of the timers this->repeaterSubscribeTmr.shutdown ( cbGuard, guard ); this->govTmr.shutdown ( cbGuard, guard ); for ( unsigned i =0; i < this->nTimers; i++ ) { - this->ppSearchTmr[i]->shutdown ( cbGuard, guard ); + this->ppSearchTmr[i]->shutdown ( cbGuard, guard ); } { @@ -367,13 +367,13 @@ void udpiiu::shutdown ( } } -udpRecvThread::udpRecvThread ( +udpRecvThread::udpRecvThread ( udpiiu & iiuIn, cacContextNotify & ctxNotifyIn, epicsMutex & cbMutexIn, const char * pName, unsigned stackSize, unsigned priority ) : - iiu ( iiuIn ), cbMutex ( cbMutexIn ), ctxNotify ( ctxNotifyIn ), + iiu ( iiuIn ), cbMutex ( cbMutexIn ), ctxNotify ( ctxNotifyIn ), thread ( *this, pName, stackSize, priority ) {} -udpRecvThread::~udpRecvThread () +udpRecvThread::~udpRecvThread () { } @@ -394,18 +394,18 @@ void udpRecvThread::show ( unsigned /* level */ ) const void udpRecvThread::run () { epicsThreadPrivateSet ( caClientCallbackThreadId, &this->iiu ); - - if ( this->iiu._searchDestList.count () == 0 ) { + + if ( this->iiu._searchDestList.count () == 0 ) { callbackManager mgr ( this->ctxNotify, this->cbMutex ); epicsGuard < epicsMutex > guard ( this->iiu.cacMutex ); - genLocalExcep ( mgr.cbGuard, guard, + genLocalExcep ( mgr.cbGuard, guard, this->iiu.cacRef, ECA_NOSEARCHADDR, NULL ); } do { osiSockAddr src; osiSocklen_t src_size = sizeof ( src ); - int status = recvfrom ( this->iiu.sock, + int status = recvfrom ( this->iiu.sock, this->iiu.recvBuf, sizeof ( this->iiu.recvBuf ), 0, & src.sa, & src_size ); @@ -413,7 +413,7 @@ void udpRecvThread::run () if ( status < 0 ) { int errnoCpy = SOCKERRNO; - if ( + if ( errnoCpy != SOCK_EINTR && errnoCpy != SOCK_SHUTDOWN && errnoCpy != SOCK_ENOTSOCK && @@ -425,15 +425,15 @@ void udpRecvThread::run () errnoCpy != SOCK_ECONNRESET ) { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - errlogPrintf ( "CAC: UDP recv error was \"%s\"\n", + errlogPrintf ( "CAC: UDP recv error was \"%s\"\n", sockErrBuf ); } } } else if ( status > 0 ) { - this->iiu.postMsg ( src, this->iiu.recvBuf, + this->iiu.postMsg ( src, this->iiu.recvBuf, (arrayElementCount) status, epicsTime::getCurrent() ); } @@ -441,14 +441,14 @@ void udpRecvThread::run () } /* for sunpro compiler */ -udpiiu::M_repeaterTimerNotify::~M_repeaterTimerNotify () +udpiiu::M_repeaterTimerNotify::~M_repeaterTimerNotify () { } /* * udpiiu::M_repeaterTimerNotify::repeaterRegistrationMessage () * - * register with the repeater + * register with the repeater */ void udpiiu :: M_repeaterTimerNotify :: repeaterRegistrationMessage ( unsigned attemptNumber ) { @@ -459,7 +459,7 @@ void udpiiu :: M_repeaterTimerNotify :: repeaterRegistrationMessage ( unsigned a /* * caRepeaterRegistrationMessage () * - * register with the repeater + * register with the repeater */ void epicsStdCall caRepeaterRegistrationMessage ( SOCKET sock, unsigned repeaterPort, unsigned attemptNumber ) @@ -469,19 +469,19 @@ void epicsStdCall caRepeaterRegistrationMessage ( int status; int len; - assert ( repeaterPort <= USHRT_MAX ); - unsigned short port = static_cast ( repeaterPort ); + assert ( repeaterPort <= USHRT_MAX ); + unsigned short port = static_cast ( repeaterPort ); /* - * In 3.13 beta 11 and before the CA repeater calls local_addr() - * to determine a local address and does not allow registration - * messages originating from other addresses. In these + * In 3.13 beta 11 and before the CA repeater calls local_addr() + * to determine a local address and does not allow registration + * messages originating from other addresses. In these * releases local_addr() returned the address of the first enabled * interface found, and this address may or may not have been the loop * back address. Starting with 3.13 beta 12 local_addr() was - * changed to always return the address of the first enabled + * changed to always return the address of the first enabled * non-loopback interface because a valid non-loopback local - * address is required in the beacon messages. Therefore, to + * address is required in the beacon messages. Therefore, to * guarantee compatibility with past versions of the repeater * we alternate between the address returned by local_addr() * and the loopback address here. @@ -526,9 +526,9 @@ void epicsStdCall caRepeaterRegistrationMessage ( */ # if defined ( DOES_NOT_ACCEPT_ZERO_LENGTH_UDP ) len = sizeof (msg); -# else +# else len = 0; -# endif +# endif status = sendto ( sock, (char *) &msg, len, 0, &saddr.sa, sizeof ( saddr ) ); @@ -542,13 +542,13 @@ void epicsStdCall caRepeaterRegistrationMessage ( * Linux returns SOCK_ECONNREFUSED * Windows 2000 returns SOCK_ECONNRESET */ - if ( errnoCpy != SOCK_EINTR && - errnoCpy != SOCK_ECONNREFUSED && + if ( errnoCpy != SOCK_EINTR && + errnoCpy != SOCK_ECONNREFUSED && errnoCpy != SOCK_ECONNRESET ) { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - fprintf ( stderr, "error sending registration message to CA repeater daemon was \"%s\"\n", + fprintf ( stderr, "error sending registration message to CA repeater daemon was \"%s\"\n", sockErrBuf ); } } @@ -564,7 +564,7 @@ void epicsStdCall caRepeaterRegistrationMessage ( * however the repeater detects this, prints a message, * and lets the other task start the repeater. * - * QUESTION: is there a better way to test for a port in use? + * QUESTION: is there a better way to test for a port in use? * ANSWER: none that I can find. * * Problems with checking for the repeater installed @@ -584,7 +584,7 @@ void epicsStdCall caStartRepeaterIfNotInstalled ( unsigned repeaterPort ) int status; SOCKET tmpSock; union { - struct sockaddr_in ia; + struct sockaddr_in ia; struct sockaddr sa; } bd; @@ -598,8 +598,8 @@ void epicsStdCall caStartRepeaterIfNotInstalled ( unsigned repeaterPort ) ca_uint16_t port = static_cast < ca_uint16_t > ( repeaterPort ); memset ( (char *) &bd, 0, sizeof ( bd ) ); bd.ia.sin_family = AF_INET; - bd.ia.sin_addr.s_addr = htonl ( INADDR_ANY ); - bd.ia.sin_port = htons ( port ); + bd.ia.sin_addr.s_addr = htonl ( INADDR_ANY ); + bd.ia.sin_port = htons ( port ); status = bind ( tmpSock, &bd.sa, sizeof ( bd ) ); if ( status < 0 ) { if ( SOCKERRNO == SOCK_EADDRINUSE ) { @@ -620,14 +620,14 @@ void epicsStdCall caStartRepeaterIfNotInstalled ( unsigned repeaterPort ) epicsSocketDestroy ( tmpSock ); if ( ! installed ) { - - /* - * This is not called if the repeater is known to be - * already running. (in the event of a race condition - * the 2nd repeater exits when unable to attach to the - * repeater's port) - */ - osiSpawnDetachedProcessReturn osptr = + + /* + * This is not called if the repeater is known to be + * already running. (in the event of a race condition + * the 2nd repeater exits when unable to attach to the + * repeater's port) + */ + osiSpawnDetachedProcessReturn osptr = osiSpawnDetachedProcess ( "CA Repeater", "caRepeater" ); if ( osptr == osiSpawnDetachedProcessNoSupport ) { epicsThreadId tid; @@ -644,19 +644,19 @@ void epicsStdCall caStartRepeaterIfNotInstalled ( unsigned repeaterPort ) } } -bool udpiiu::badUDPRespAction ( +bool udpiiu::badUDPRespAction ( const caHdr &msg, const osiSockAddr &netAddr, const epicsTime ¤tTime ) { char buf[64]; sockAddrToDottedIP ( &netAddr.sa, buf, sizeof ( buf ) ); char date[64]; currentTime.strftime ( date, sizeof ( date ), "%a %b %d %Y %H:%M:%S"); - errlogPrintf ( "CAC: Undecipherable ( bad msg code %u ) UDP message from %s at %s\n", + errlogPrintf ( "CAC: Undecipherable ( bad msg code %u ) UDP message from %s at %s\n", msg.m_cmmd, buf, date ); return false; } -bool udpiiu::versionAction ( +bool udpiiu::versionAction ( const caHdr & hdr, const osiSockAddr &, const epicsTime & /* currentTime */ ) { epicsGuard < epicsMutex > guard ( this->cacMutex ); @@ -670,12 +670,12 @@ bool udpiiu::versionAction ( return true; } -bool udpiiu :: searchRespAction ( - const caHdr & msg, const osiSockAddr & addr, +bool udpiiu :: searchRespAction ( + const caHdr & msg, const osiSockAddr & addr, const epicsTime & currentTime ) { /* - * we dont currently know what to do with channel's + * we dont currently know what to do with channel's * found to be at non-IP type addresses */ if ( addr.sa.sa_family != AF_INET ) { @@ -693,7 +693,7 @@ bool udpiiu :: searchRespAction ( * care is taken here not to break gcc 3.2 aggressive alias * analysis rules */ - const ca_uint8_t * pPayLoad = + const ca_uint8_t * pPayLoad = reinterpret_cast < const ca_uint8_t *> ( & msg + 1 ); unsigned byte0 = pPayLoad[0]; unsigned byte1 = pPayLoad[1]; @@ -728,21 +728,21 @@ bool udpiiu :: searchRespAction ( } if ( CA_V42 ( minorVersion ) ) { - cacRef.transferChanToVirtCircuit - ( msg.m_available, msg.m_cid, 0xffff, + cacRef.transferChanToVirtCircuit + ( msg.m_available, msg.m_cid, 0xffff, 0, minorVersion, serverAddr, currentTime ); } else { - cacRef.transferChanToVirtCircuit - ( msg.m_available, msg.m_cid, msg.m_dataType, + cacRef.transferChanToVirtCircuit + ( msg.m_available, msg.m_cid, msg.m_dataType, msg.m_count, minorVersion, serverAddr, currentTime ); } return true; } -bool udpiiu::beaconAction ( - const caHdr & msg, +bool udpiiu::beaconAction ( + const caHdr & msg, const osiSockAddr & net_addr, const epicsTime & currentTime ) { struct sockaddr_in ina; @@ -753,9 +753,9 @@ bool udpiiu::beaconAction ( return false; } - /* + /* * this allows a fan-out server to potentially - * insert the true address of the CA server + * insert the true address of the CA server * * old servers: * 1) set this field to one of the ip addresses of the host _or_ @@ -782,29 +782,29 @@ bool udpiiu::beaconAction ( unsigned protocolRevision = msg.m_dataType; ca_uint32_t beaconNumber = msg.m_cid; - this->cacRef.beaconNotify ( ina, currentTime, + this->cacRef.beaconNotify ( ina, currentTime, beaconNumber, protocolRevision ); return true; } -bool udpiiu::repeaterAckAction ( - const caHdr &, +bool udpiiu::repeaterAckAction ( + const caHdr &, const osiSockAddr &, const epicsTime &) { this->repeaterSubscribeTmr.confirmNotify (); return true; } -bool udpiiu::notHereRespAction ( - const caHdr &, +bool udpiiu::notHereRespAction ( + const caHdr &, const osiSockAddr &, const epicsTime & ) { return true; } -bool udpiiu::exceptionRespAction ( - const caHdr &msg, +bool udpiiu::exceptionRespAction ( + const caHdr &msg, const osiSockAddr & net_addr, const epicsTime & currentTime ) { const caHdr &reqMsg = * ( &msg + 1 ); @@ -814,22 +814,22 @@ bool udpiiu::exceptionRespAction ( currentTime.strftime ( date, sizeof ( date ), "%a %b %d %Y %H:%M:%S"); if ( msg.m_postsize > sizeof ( caHdr ) ){ - errlogPrintf ( - "error condition \"%s\" detected by %s with context \"%s\" at %s\n", - ca_message ( msg.m_available ), + errlogPrintf ( + "error condition \"%s\" detected by %s with context \"%s\" at %s\n", + ca_message ( msg.m_available ), name, reinterpret_cast ( &reqMsg + 1 ), date ); } else{ - errlogPrintf ( - "error condition \"%s\" detected by %s at %s\n", + errlogPrintf ( + "error condition \"%s\" detected by %s at %s\n", ca_message ( msg.m_available ), name, date ); } return true; } -void udpiiu::postMsg ( - const osiSockAddr & net_addr, +void udpiiu::postMsg ( + const osiSockAddr & net_addr, char * pInBuf, arrayElementCount blockSize, const epicsTime & currentTime ) { @@ -844,16 +844,16 @@ void udpiiu::postMsg ( if ( blockSize < sizeof ( *pCurMsg ) ) { char buf[64]; sockAddrToDottedIP ( &net_addr.sa, buf, sizeof ( buf ) ); - errlogPrintf ( - "%s: Undecipherable (too small) UDP msg from %s ignored\n", + errlogPrintf ( + "%s: Undecipherable (too small) UDP msg from %s ignored\n", __FILE__, buf ); return; } pCurMsg = reinterpret_cast < caHdr * > ( pInBuf ); - /* - * fix endian of bytes + /* + * fix endian of bytes */ pCurMsg->m_postsize = AlignedWireRef < epicsUInt16 > ( pCurMsg->m_postsize ); pCurMsg->m_cmmd = AlignedWireRef < epicsUInt16 > ( pCurMsg->m_cmmd ); @@ -881,8 +881,8 @@ void udpiiu::postMsg ( if ( size > blockSize ) { char buf[64]; sockAddrToDottedIP ( &net_addr.sa, buf, sizeof ( buf ) ); - errlogPrintf ( - "%s: Undecipherable (payload too small) UDP msg from %s ignored\n", + errlogPrintf ( + "%s: Undecipherable (payload too small) UDP msg from %s ignored\n", __FILE__, buf ); return; } @@ -919,14 +919,14 @@ bool udpiiu::pushVersionMsg () caHdr msg; AlignedWireRef < epicsUInt16 > ( msg.m_cmmd ) = CA_PROTO_VERSION; AlignedWireRef < epicsUInt32 > ( msg.m_available ) = 0; - AlignedWireRef < epicsUInt16 > ( msg.m_dataType ) = sequenceNoIsValid; + AlignedWireRef < epicsUInt16 > ( msg.m_dataType ) = sequenceNoIsValid; AlignedWireRef < epicsUInt16 > ( msg.m_count ) = CA_MINOR_PROTOCOL_REVISION; AlignedWireRef < epicsUInt32 > ( msg.m_cid ) = this->sequenceNumber; // sequence number return this->pushDatagramMsg ( guard, msg, 0, 0 ); } -bool udpiiu::pushDatagramMsg ( epicsGuard < epicsMutex > & guard, +bool udpiiu::pushDatagramMsg ( epicsGuard < epicsMutex > & guard, const caHdr & msg, const void * pExt, ca_uint16_t extsize ) { guard.assertIdenticalMutex ( this->cacMutex ); @@ -958,13 +958,13 @@ bool udpiiu::pushDatagramMsg ( epicsGuard < epicsMutex > & guard, return true; } -udpiiu :: SearchDestUDP :: SearchDestUDP ( +udpiiu :: SearchDestUDP :: SearchDestUDP ( const osiSockAddr & destAddr, udpiiu & udpiiuIn ) : _lastError (0u), _destAddr ( destAddr ), _udpiiu ( udpiiuIn ) { } -void udpiiu :: SearchDestUDP :: searchRequest ( +void udpiiu :: SearchDestUDP :: searchRequest ( epicsGuard < epicsMutex > & guard, const char * pBuf, size_t bufSize ) { guard.assertIdenticalMutex ( _udpiiu.cacMutex ); @@ -972,7 +972,7 @@ void udpiiu :: SearchDestUDP :: searchRequest ( int bufSizeAsInt = static_cast < int > ( bufSize ); while ( true ) { // This const_cast is needed for vxWorks: - int status = sendto ( _udpiiu.sock, const_cast(pBuf), bufSizeAsInt, 0, + int status = sendto ( _udpiiu.sock, const_cast(pBuf), bufSizeAsInt, 0, & _destAddr.sa, sizeof ( _destAddr.sa ) ); if ( status == bufSizeAsInt ) { if ( _lastError ) { @@ -1012,7 +1012,7 @@ void udpiiu :: SearchDestUDP :: searchRequest ( break; } else { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); char buf[64]; sockAddrToDottedIP ( &_destAddr.sa, buf, sizeof ( buf ) ); @@ -1026,8 +1026,8 @@ void udpiiu :: SearchDestUDP :: searchRequest ( } } } - -void udpiiu :: SearchDestUDP :: show ( + +void udpiiu :: SearchDestUDP :: show ( epicsGuard < epicsMutex > & guard, unsigned level ) const { guard.assertIdenticalMutex ( _udpiiu.cacMutex ); @@ -1036,17 +1036,17 @@ void udpiiu :: SearchDestUDP :: show ( :: printf ( "UDP Search destination \"%s\"\n", buf ); } -udpiiu :: SearchRespCallback :: SearchRespCallback ( udpiiu & udpiiuIn ) : +udpiiu :: SearchRespCallback :: SearchRespCallback ( udpiiu & udpiiuIn ) : _udpiiu ( udpiiuIn ) { } - + void udpiiu :: SearchRespCallback :: notify ( const caHdr & msg, const void * pPayloadUntyped, const osiSockAddr & addr, const epicsTime & currentTime ) -{ +{ /* - * we dont currently know what to do with channel's + * we dont currently know what to do with channel's * found to be at non-IP type addresses */ if ( addr.sa.sa_family != AF_INET ) { @@ -1098,25 +1098,25 @@ void udpiiu :: SearchRespCallback :: notify ( } if ( CA_V42 ( minorVersion ) ) { - _udpiiu.cacRef.transferChanToVirtCircuit - ( msg.m_available, msg.m_cid, 0xffff, + _udpiiu.cacRef.transferChanToVirtCircuit + ( msg.m_available, msg.m_cid, 0xffff, 0, minorVersion, serverAddr, currentTime ); } else { - _udpiiu.cacRef.transferChanToVirtCircuit - ( msg.m_available, msg.m_cid, msg.m_dataType, + _udpiiu.cacRef.transferChanToVirtCircuit + ( msg.m_available, msg.m_cid, msg.m_dataType, msg.m_count, minorVersion, serverAddr, currentTime ); } } -void udpiiu :: SearchRespCallback :: show ( +void udpiiu :: SearchRespCallback :: show ( epicsGuard < epicsMutex > & guard, unsigned level ) const { guard.assertIdenticalMutex ( _udpiiu.cacMutex ); ::printf ( "udpiiu :: SearchRespCallback\n" ); } -bool udpiiu :: datagramFlush ( +bool udpiiu :: datagramFlush ( epicsGuard < epicsMutex > & guard, const epicsTime & currentTime ) { guard.assertIdenticalMutex ( cacMutex ); @@ -1148,10 +1148,10 @@ void udpiiu :: show ( unsigned level ) const if ( level > 1u ) { ::printf ("\trepeater port %u\n", this->repeaterPort ); ::printf ("\tdefault server port %u\n", this->serverPort ); - ::printf ( "Search Destination List with %u items\n", + ::printf ( "Search Destination List with %u items\n", _searchDestList.count () ); if ( level > 2u ) { - tsDLIterConst < SearchDest > iter ( + tsDLIterConst < SearchDest > iter ( _searchDestList.firstIter () ); while ( iter.valid () ) { @@ -1192,54 +1192,54 @@ bool udpiiu::wakeupMsg () addr.ia.sin_port = htons ( this->localPort ); // send a wakeup msg so the UDP recv thread will exit - int status = sendto ( this->sock, reinterpret_cast < char * > ( &msg ), + int status = sendto ( this->sock, reinterpret_cast < char * > ( &msg ), sizeof (msg), 0, &addr.sa, sizeof ( addr.sa ) ); return status == sizeof (msg); } -void udpiiu::beaconAnomalyNotify ( - epicsGuard < epicsMutex > & cacGuard ) +void udpiiu::beaconAnomalyNotify ( + epicsGuard < epicsMutex > & cacGuard ) { - for ( unsigned i = this->beaconAnomalyTimerIndex+1u; + for ( unsigned i = this->beaconAnomalyTimerIndex+1u; i < this->nTimers; i++ ) { - this->ppSearchTmr[i]->moveChannels ( cacGuard, + this->ppSearchTmr[i]->moveChannels ( cacGuard, *this->ppSearchTmr[this->beaconAnomalyTimerIndex] ); } } -void udpiiu::uninstallChanDueToSuccessfulSearchResponse ( - epicsGuard < epicsMutex > & guard, nciu & chan, +void udpiiu::uninstallChanDueToSuccessfulSearchResponse ( + epicsGuard < epicsMutex > & guard, nciu & chan, const epicsTime & currentTime ) { - channelNode::channelState chanState = + channelNode::channelState chanState = chan.channelNode::listMember; if ( chanState == channelNode::cs_disconnGov ) { this->govTmr.uninstallChan ( guard, chan ); } else { - this->ppSearchTmr[ chan.getSearchTimerIndex ( guard ) ]-> - uninstallChanDueToSuccessfulSearchResponse ( - guard, chan, this->lastReceivedSeqNo, + this->ppSearchTmr[ chan.getSearchTimerIndex ( guard ) ]-> + uninstallChanDueToSuccessfulSearchResponse ( + guard, chan, this->lastReceivedSeqNo, this->lastReceivedSeqNoIsValid, currentTime ); } } -void udpiiu::uninstallChan ( +void udpiiu::uninstallChan ( epicsGuard < epicsMutex > & guard, nciu & chan ) { - channelNode::channelState chanState = + channelNode::channelState chanState = chan.channelNode::listMember; if ( chanState == channelNode::cs_disconnGov ) { this->govTmr.uninstallChan ( guard, chan ); } else { - this->ppSearchTmr[ chan.getSearchTimerIndex ( guard ) ]-> + this->ppSearchTmr[ chan.getSearchTimerIndex ( guard ) ]-> uninstallChan ( guard, chan ); } } bool udpiiu::searchMsg ( - epicsGuard < epicsMutex > & guard, ca_uint32_t id, + epicsGuard < epicsMutex > & guard, ca_uint32_t id, const char * pName, unsigned nameLength ) { caHdr msg; @@ -1248,25 +1248,25 @@ bool udpiiu::searchMsg ( AlignedWireRef < epicsUInt16 > ( msg.m_dataType ) = DONTREPLY; AlignedWireRef < epicsUInt16 > ( msg.m_count ) = CA_MINOR_PROTOCOL_REVISION; AlignedWireRef < epicsUInt32 > ( msg.m_cid ) = id; - return this->pushDatagramMsg ( + return this->pushDatagramMsg ( guard, msg, pName, (ca_uint16_t) nameLength ); } -void udpiiu::installNewChannel ( +void udpiiu::installNewChannel ( epicsGuard < epicsMutex > & guard, nciu & chan, netiiu * & piiu ) { piiu = this; this->ppSearchTmr[0]->installChannel ( guard, chan ); } -void udpiiu::installDisconnectedChannel ( +void udpiiu::installDisconnectedChannel ( epicsGuard < epicsMutex > & guard, nciu & chan ) { chan.setServerAddressUnknown ( *this, guard ); this->govTmr.installChan ( guard, chan ); } -void udpiiu::noSearchRespNotify ( +void udpiiu::noSearchRespNotify ( epicsGuard < epicsMutex > & guard, nciu & chan, unsigned index ) { const unsigned nTimersMinusOne = this->nTimers - 1; @@ -1279,32 +1279,32 @@ void udpiiu::noSearchRespNotify ( this->ppSearchTmr[index]->installChannel ( guard, chan ); } -void udpiiu::boostChannel ( +void udpiiu::boostChannel ( epicsGuard < epicsMutex > & guard, nciu & chan ) { this->ppSearchTmr[this->beaconAnomalyTimerIndex]-> installChannel ( guard, chan ); } -void udpiiu::govExpireNotify ( +void udpiiu::govExpireNotify ( epicsGuard < epicsMutex > & guard, nciu & chan ) { this->ppSearchTmr[0]->installChannel ( guard, chan ); } -int udpiiu :: M_repeaterTimerNotify :: printFormated ( - epicsGuard < epicsMutex > & cbGuard, +int udpiiu :: M_repeaterTimerNotify :: printFormated ( + epicsGuard < epicsMutex > & cbGuard, const char * pformat, ... ) { va_list theArgs; int status; va_start ( theArgs, pformat ); - + status = m_udpiiu.cacRef.varArgsPrintFormated ( cbGuard, pformat, theArgs ); - + va_end ( theArgs ); - + return status; } @@ -1331,7 +1331,7 @@ double udpiiu::getRTTE ( epicsGuard < epicsMutex > & guard ) const return this->rtteMean + 4 * this->rtteMeanDev; } -unsigned udpiiu::getHostName ( +unsigned udpiiu::getHostName ( epicsGuard < epicsMutex > & cacGuard, char *pBuf, unsigned bufLength ) const throw () { @@ -1356,71 +1356,71 @@ bool udpiiu::ca_v41_ok ( return netiiu::ca_v41_ok ( cacGuard ); } -void udpiiu::writeRequest ( - epicsGuard < epicsMutex > & guard, - nciu & chan, unsigned type, +void udpiiu::writeRequest ( + epicsGuard < epicsMutex > & guard, + nciu & chan, unsigned type, arrayElementCount nElem, const void * pValue ) { netiiu::writeRequest ( guard, chan, type, nElem, pValue ); } -void udpiiu::writeNotifyRequest ( - epicsGuard < epicsMutex > & guard, nciu & chan, - netWriteNotifyIO & io, unsigned type, +void udpiiu::writeNotifyRequest ( + epicsGuard < epicsMutex > & guard, nciu & chan, + netWriteNotifyIO & io, unsigned type, arrayElementCount nElem, const void *pValue ) { netiiu::writeNotifyRequest ( guard, chan, io, type, nElem, pValue ); } -void udpiiu::readNotifyRequest ( - epicsGuard < epicsMutex > & guard, nciu & chan, +void udpiiu::readNotifyRequest ( + epicsGuard < epicsMutex > & guard, nciu & chan, netReadNotifyIO & io, unsigned type, arrayElementCount nElem ) { netiiu::readNotifyRequest ( guard, chan, io, type, nElem ); } -void udpiiu::clearChannelRequest ( - epicsGuard < epicsMutex > & guard, +void udpiiu::clearChannelRequest ( + epicsGuard < epicsMutex > & guard, ca_uint32_t sid, ca_uint32_t cid ) { netiiu::clearChannelRequest ( guard, sid, cid ); } -void udpiiu::subscriptionRequest ( - epicsGuard < epicsMutex > & guard, nciu & chan, +void udpiiu::subscriptionRequest ( + epicsGuard < epicsMutex > & guard, nciu & chan, netSubscription & subscr ) { netiiu::subscriptionRequest ( guard, chan, subscr ); } -void udpiiu::subscriptionUpdateRequest ( - epicsGuard < epicsMutex > & guard, nciu & chan, +void udpiiu::subscriptionUpdateRequest ( + epicsGuard < epicsMutex > & guard, nciu & chan, netSubscription & subscr ) { netiiu::subscriptionUpdateRequest ( guard, chan, subscr ); } -void udpiiu::subscriptionCancelRequest ( - epicsGuard < epicsMutex > & guard, +void udpiiu::subscriptionCancelRequest ( + epicsGuard < epicsMutex > & guard, nciu & chan, netSubscription & subscr ) { netiiu::subscriptionCancelRequest ( guard, chan, subscr ); } -void udpiiu::flushRequest ( +void udpiiu::flushRequest ( epicsGuard < epicsMutex > & guard ) { netiiu::flushRequest ( guard ); } -unsigned udpiiu::requestMessageBytesPending ( +unsigned udpiiu::requestMessageBytesPending ( epicsGuard < epicsMutex > & guard ) { return netiiu::requestMessageBytesPending ( guard ); } -void udpiiu::flush ( +void udpiiu::flush ( epicsGuard < epicsMutex > & guard ) { netiiu::flush ( guard ); diff --git a/modules/ca/src/client/udpiiu.h b/modules/ca/src/client/udpiiu.h index 47ad4088d..2ab79dc95 100644 --- a/modules/ca/src/client/udpiiu.h +++ b/modules/ca/src/client/udpiiu.h @@ -7,19 +7,19 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* + * * - * * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 - * + * * Copyright, 1986, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #ifndef INC_udpiiu_H @@ -52,10 +52,10 @@ LIBCA_API void ca_repeater ( void ); class cac; class cacContextNotify; -class udpRecvThread : +class udpRecvThread : private epicsThreadRunable { public: - udpRecvThread ( + udpRecvThread ( class udpiiu & iiuIn, cacContextNotify &, epicsMutex &, const char * pName, unsigned stackSize, unsigned priority ); virtual ~udpRecvThread (); @@ -76,31 +76,31 @@ static const double maxSearchPeriodDefault = 5.0 * 60.0; // seconds static const double maxSearchPeriodLowerLimit = 60.0; // seconds static const double beaconAnomalySearchPeriod = 5.0; // seconds -class udpiiu : - private netiiu, - private searchTimerNotify, +class udpiiu : + private netiiu, + private searchTimerNotify, private disconnectGovernorNotify { public: - udpiiu ( + udpiiu ( epicsGuard < epicsMutex > & cacGuard, - class epicsTimerQueueActive &, - epicsMutex & callbackControl, - epicsMutex & mutualExclusion, + class epicsTimerQueueActive &, + epicsMutex & callbackControl, + epicsMutex & mutualExclusion, cacContextNotify &, class cac &, unsigned port, tsDLList < SearchDest > & ); virtual ~udpiiu (); - void installNewChannel ( + void installNewChannel ( epicsGuard < epicsMutex > &, nciu &, netiiu * & ); - void installDisconnectedChannel ( + void installDisconnectedChannel ( epicsGuard < epicsMutex > &, nciu & ); - void beaconAnomalyNotify ( + void beaconAnomalyNotify ( epicsGuard < epicsMutex > & guard ); - void shutdown ( epicsGuard < epicsMutex > & cbGuard, + void shutdown ( epicsGuard < epicsMutex > & cbGuard, epicsGuard < epicsMutex > & guard ); void show ( unsigned level ) const; - + // exceptions class noSocket {}; @@ -109,43 +109,43 @@ private: public SearchDest { public: SearchDestUDP ( const osiSockAddr &, udpiiu & ); - void searchRequest ( + void searchRequest ( epicsGuard < epicsMutex > &, const char * pBuf, size_t bufLen ); - void show ( + void show ( epicsGuard < epicsMutex > &, unsigned level ) const; private: int _lastError; osiSockAddr _destAddr; udpiiu & _udpiiu; }; - class SearchRespCallback : + class SearchRespCallback : public SearchDest :: Callback { public: SearchRespCallback ( udpiiu & ); void notify ( const caHdr &, const void * pPayload, const osiSockAddr &, const epicsTime & ); - void show ( + void show ( epicsGuard < epicsMutex > &, unsigned level ) const; private: udpiiu & _udpiiu; }; - class M_repeaterTimerNotify : + class M_repeaterTimerNotify : public repeaterTimerNotify { public: - M_repeaterTimerNotify ( udpiiu & iiu ) : + M_repeaterTimerNotify ( udpiiu & iiu ) : m_udpiiu ( iiu ) {} ~M_repeaterTimerNotify (); /* for sunpro compiler */ // repeaterTimerNotify - void repeaterRegistrationMessage ( + void repeaterRegistrationMessage ( unsigned attemptNumber ); - int printFormated ( - epicsGuard < epicsMutex > & callbackControl, + int printFormated ( + epicsGuard < epicsMutex > & callbackControl, const char * pformat, ... ); private: udpiiu & m_udpiiu; }; - char xmitBuf [MAX_UDP_SEND]; + char xmitBuf [MAX_UDP_SEND]; char recvBuf [MAX_UDP_RECV]; udpRecvThread recvThread; M_repeaterTimerNotify m_repeaterTimerNotify; @@ -182,120 +182,120 @@ private: bool wakeupMsg (); - void postMsg ( - const osiSockAddr & net_addr, + void postMsg ( + const osiSockAddr & net_addr, char *pInBuf, arrayElementCount blockSize, const epicsTime ¤Time ); - bool pushDatagramMsg ( epicsGuard < epicsMutex > &, - const caHdr & hdr, const void * pExt, + bool pushDatagramMsg ( epicsGuard < epicsMutex > &, + const caHdr & hdr, const void * pExt, ca_uint16_t extsize); - typedef bool ( udpiiu::*pProtoStubUDP ) ( - const caHdr &, + typedef bool ( udpiiu::*pProtoStubUDP ) ( + const caHdr &, const osiSockAddr &, const epicsTime & ); // UDP protocol dispatch table static const pProtoStubUDP udpJumpTableCAC[]; // UDP protocol stubs - bool versionAction ( - const caHdr &, + bool versionAction ( + const caHdr &, const osiSockAddr &, const epicsTime & ); - bool badUDPRespAction ( - const caHdr &msg, + bool badUDPRespAction ( + const caHdr &msg, const osiSockAddr &netAddr, const epicsTime & ); - bool searchRespAction ( - const caHdr &msg, + bool searchRespAction ( + const caHdr &msg, const osiSockAddr &net_addr, const epicsTime & ); - bool exceptionRespAction ( - const caHdr &msg, + bool exceptionRespAction ( + const caHdr &msg, const osiSockAddr &net_addr, const epicsTime & ); - bool beaconAction ( - const caHdr &msg, + bool beaconAction ( + const caHdr &msg, const osiSockAddr &net_addr, const epicsTime & ); - bool notHereRespAction ( - const caHdr &msg, + bool notHereRespAction ( + const caHdr &msg, const osiSockAddr &net_addr, const epicsTime & ); - bool repeaterAckAction ( - const caHdr &msg, + bool repeaterAckAction ( + const caHdr &msg, const osiSockAddr &net_addr, const epicsTime & ); // netiiu stubs - unsigned getHostName ( - epicsGuard < epicsMutex > &, char * pBuf, + unsigned getHostName ( + epicsGuard < epicsMutex > &, char * pBuf, unsigned bufLength ) const throw (); const char * pHostName ( - epicsGuard < epicsMutex > & ) const throw (); + epicsGuard < epicsMutex > & ) const throw (); bool ca_v41_ok ( epicsGuard < epicsMutex > & ) const; bool ca_v42_ok ( epicsGuard < epicsMutex > & ) const; - unsigned requestMessageBytesPending ( + unsigned requestMessageBytesPending ( epicsGuard < epicsMutex > & mutualExclusionGuard ); - void flush ( + void flush ( epicsGuard < epicsMutex > & mutualExclusionGuard ); - void writeRequest ( - epicsGuard < epicsMutex > &, nciu &, - unsigned type, arrayElementCount nElem, + void writeRequest ( + epicsGuard < epicsMutex > &, nciu &, + unsigned type, arrayElementCount nElem, const void *pValue ); - void writeNotifyRequest ( - epicsGuard < epicsMutex > &, - nciu &, netWriteNotifyIO &, - unsigned type, arrayElementCount nElem, + void writeNotifyRequest ( + epicsGuard < epicsMutex > &, + nciu &, netWriteNotifyIO &, + unsigned type, arrayElementCount nElem, const void *pValue ); - void readNotifyRequest ( - epicsGuard < epicsMutex > &, nciu &, - netReadNotifyIO &, unsigned type, + void readNotifyRequest ( + epicsGuard < epicsMutex > &, nciu &, + netReadNotifyIO &, unsigned type, arrayElementCount nElem ); - void clearChannelRequest ( - epicsGuard < epicsMutex > &, + void clearChannelRequest ( + epicsGuard < epicsMutex > &, ca_uint32_t sid, ca_uint32_t cid ); - void subscriptionRequest ( - epicsGuard < epicsMutex > &, + void subscriptionRequest ( + epicsGuard < epicsMutex > &, nciu &, netSubscription & ); - void subscriptionUpdateRequest ( - epicsGuard < epicsMutex > &, + void subscriptionUpdateRequest ( + epicsGuard < epicsMutex > &, nciu &, netSubscription & ); - void subscriptionCancelRequest ( - epicsGuard < epicsMutex > &, + void subscriptionCancelRequest ( + epicsGuard < epicsMutex > &, nciu & chan, netSubscription & subscr ); - void flushRequest ( + void flushRequest ( epicsGuard < epicsMutex > & ); void requestRecvProcessPostponedFlush ( epicsGuard < epicsMutex > & ); osiSockAddr getNetworkAddress ( epicsGuard < epicsMutex > & ) const; - void uninstallChan ( + void uninstallChan ( epicsGuard < epicsMutex > &, nciu & ); - void uninstallChanDueToSuccessfulSearchResponse ( - epicsGuard < epicsMutex > &, nciu &, + void uninstallChanDueToSuccessfulSearchResponse ( + epicsGuard < epicsMutex > &, nciu &, const class epicsTime & currentTime ); double receiveWatchdogDelay ( epicsGuard < epicsMutex > & ) const; bool searchMsg ( - epicsGuard < epicsMutex > &, ca_uint32_t id, + epicsGuard < epicsMutex > &, ca_uint32_t id, const char * pName, unsigned nameLength ); // searchTimerNotify stubs double getRTTE ( epicsGuard < epicsMutex > & ) const; void updateRTTE ( epicsGuard < epicsMutex > &, double rtte ); bool pushVersionMsg (); - void boostChannel ( + void boostChannel ( epicsGuard < epicsMutex > & guard, nciu & chan ); - void noSearchRespNotify ( + void noSearchRespNotify ( epicsGuard < epicsMutex > &, nciu & chan, unsigned index ); - bool datagramFlush ( + bool datagramFlush ( epicsGuard < epicsMutex > &, const epicsTime & currentTime ); - ca_uint32_t datagramSeqNumber ( + ca_uint32_t datagramSeqNumber ( epicsGuard < epicsMutex > & ) const; // disconnectGovernorNotify - void govExpireNotify ( + void govExpireNotify ( epicsGuard < epicsMutex > &, nciu & ); - udpiiu ( const udpiiu & ); - udpiiu & operator = ( const udpiiu & ); + udpiiu ( const udpiiu & ); + udpiiu & operator = ( const udpiiu & ); friend class udpRecvThread; diff --git a/modules/ca/src/client/virtualCircuit.h b/modules/ca/src/client/virtualCircuit.h index dd68cac93..7fb1f915e 100644 --- a/modules/ca/src/client/virtualCircuit.h +++ b/modules/ca/src/client/virtualCircuit.h @@ -7,19 +7,19 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* + * * - * * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 - * + * * Copyright, 1986, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #ifndef INC_virtualCircuit_H @@ -42,19 +42,19 @@ class callbackManager; // a modified ca header with capacity for large arrays struct caHdrLargeArray { - ca_uint32_t m_postsize; // size of message extension - ca_uint32_t m_count; // operation data count - ca_uint32_t m_cid; // channel identifier + ca_uint32_t m_postsize; // size of message extension + ca_uint32_t m_count; // operation data count + ca_uint32_t m_cid; // channel identifier ca_uint32_t m_available; // protocol stub dependent - ca_uint16_t m_dataType; // operation data type - ca_uint16_t m_cmmd; // operation to be performed + ca_uint16_t m_dataType; // operation data type + ca_uint16_t m_cmmd; // operation to be performed }; class ipAddrToAsciiEngine; class tcpRecvThread : private epicsThreadRunable { public: - tcpRecvThread ( + tcpRecvThread ( class tcpiiu & iiuIn, epicsMutex & cbMutexIn, cacContextNotify &, const char * pName, unsigned int stackSize, unsigned int priority ); virtual ~tcpRecvThread (); @@ -71,15 +71,15 @@ private: void run (); void connect ( epicsGuard < epicsMutex > & guard ); - bool validFillStatus ( - epicsGuard < epicsMutex > & guard, + bool validFillStatus ( + epicsGuard < epicsMutex > & guard, const statusWireIO & stat ); }; class tcpSendThread : private epicsThreadRunable { public: - tcpSendThread ( - class tcpiiu & iiuIn, const char * pName, + tcpSendThread ( + class tcpiiu & iiuIn, const char * pName, unsigned int stackSize, unsigned int priority ); virtual ~tcpSendThread (); void start (); @@ -110,49 +110,49 @@ private: class tcpiiu : public netiiu, public tsDLNode < tcpiiu >, - public tsSLNode < tcpiiu >, public caServerID, + public tsSLNode < tcpiiu >, public caServerID, private wireSendAdapter, private wireRecvAdapter { friend void SearchDestTCP::searchRequest ( epicsGuard < epicsMutex > & guard, const char * pbuf, size_t len ); public: - tcpiiu ( cac & cac, epicsMutex & mutualExclusion, epicsMutex & callbackControl, - cacContextNotify &, double connectionTimeout, epicsTimerQueue & timerQueue, - const osiSockAddr & addrIn, comBufMemoryManager &, unsigned minorVersion, + tcpiiu ( cac & cac, epicsMutex & mutualExclusion, epicsMutex & callbackControl, + cacContextNotify &, double connectionTimeout, epicsTimerQueue & timerQueue, + const osiSockAddr & addrIn, comBufMemoryManager &, unsigned minorVersion, ipAddrToAsciiEngine & engineIn, const cacChannel::priLev & priorityIn, SearchDestTCP * pSearchDestIn = NULL); ~tcpiiu (); void start ( epicsGuard < epicsMutex > & ); - void responsiveCircuitNotify ( + void responsiveCircuitNotify ( epicsGuard < epicsMutex > & cbGuard, epicsGuard < epicsMutex > & guard ); - void sendTimeoutNotify ( + void sendTimeoutNotify ( callbackManager & cbMgr, epicsGuard < epicsMutex > & guard ); - void receiveTimeoutNotify( + void receiveTimeoutNotify( callbackManager &, epicsGuard < epicsMutex > & ); - void beaconAnomalyNotify ( + void beaconAnomalyNotify ( epicsGuard < epicsMutex > & ); - void beaconArrivalNotify ( + void beaconArrivalNotify ( epicsGuard < epicsMutex > & ); - void probeResponseNotify ( + void probeResponseNotify ( epicsGuard < epicsMutex > & ); - void flushRequest ( + void flushRequest ( epicsGuard < epicsMutex > & ); - unsigned requestMessageBytesPending ( + unsigned requestMessageBytesPending ( epicsGuard < epicsMutex > & mutualExclusionGuard ); - void flush ( + void flush ( epicsGuard < epicsMutex > & mutualExclusionGuard ); void show ( unsigned level ) const; - bool setEchoRequestPending ( + bool setEchoRequestPending ( epicsGuard < epicsMutex > & ); void requestRecvProcessPostponedFlush ( epicsGuard < epicsMutex > & ); - void clearChannelRequest ( - epicsGuard < epicsMutex > &, + void clearChannelRequest ( + epicsGuard < epicsMutex > &, ca_uint32_t sid, ca_uint32_t cid ); bool ca_v41_ok ( @@ -164,41 +164,41 @@ public: bool ca_v49_ok ( epicsGuard < epicsMutex > & ) const; - unsigned getHostName ( + unsigned getHostName ( epicsGuard < epicsMutex > &, char *pBuf, unsigned bufLength ) const throw (); bool alive ( epicsGuard < epicsMutex > & ) const; bool connecting ( epicsGuard < epicsMutex > & ) const; - bool receiveThreadIsBusy ( + bool receiveThreadIsBusy ( epicsGuard < epicsMutex > & ); osiSockAddr getNetworkAddress ( epicsGuard < epicsMutex > & ) const; - int printFormated ( - epicsGuard < epicsMutex > & cbGuard, + int printFormated ( + epicsGuard < epicsMutex > & cbGuard, const char *pformat, ... ); - unsigned channelCount ( + unsigned channelCount ( epicsGuard < epicsMutex > & ); void disconnectAllChannels ( - epicsGuard < epicsMutex > & cbGuard, + epicsGuard < epicsMutex > & cbGuard, epicsGuard < epicsMutex > & guard, class udpiiu & ); void unlinkAllChannels ( - epicsGuard < epicsMutex > & cbGuard, + epicsGuard < epicsMutex > & cbGuard, epicsGuard < epicsMutex > & guard ); - void installChannel ( - epicsGuard < epicsMutex > &, nciu & chan, + void installChannel ( + epicsGuard < epicsMutex > &, nciu & chan, unsigned sidIn, ca_uint16_t typeIn, arrayElementCount countIn ); - void uninstallChan ( + void uninstallChan ( epicsGuard < epicsMutex > & guard, nciu & chan ); - bool connectNotify ( + bool connectNotify ( epicsGuard < epicsMutex > &, nciu & chan ); - - void searchRespNotify ( + + void searchRespNotify ( const epicsTime &, const caHdrLargeArray & ); void versionRespNotify ( const caHdrLargeArray & ); - void * operator new ( size_t size, + void * operator new ( size_t size, tsFreeList < class tcpiiu, 32, epicsMutexNOOP > & ); epicsPlacementDeleteOperator (( void *, tsFreeList < class tcpiiu, 32, epicsMutexNOOP > & )) @@ -230,7 +230,7 @@ private: epicsMutex & mutex; epicsMutex & cbMutex; unsigned minorProtocolVersion; - enum iiu_conn_state { + enum iiu_conn_state { iiucs_connecting, // pending circuit connect iiucs_connected, // live circuit iiucs_clean_shutdown, // live circuit will shutdown when flush completes @@ -248,7 +248,7 @@ private: bool _receiveThreadIsBusy; bool busyStateDetected; // only modified by the recv thread bool flowControlActive; // only modified by the send process thread - bool echoRequestPending; + bool echoRequestPending; bool oldMsgHeaderAvailable; bool msgHeaderAvailable; bool earlyFlush; @@ -257,93 +257,93 @@ private: bool socketHasBeenClosed; bool unresponsiveCircuit; - bool processIncoming ( + bool processIncoming ( const epicsTime & currentTime, callbackManager & ); - unsigned sendBytes ( const void *pBuf, + unsigned sendBytes ( const void *pBuf, unsigned nBytesInBuf, const epicsTime & currentTime ); - void recvBytes ( + void recvBytes ( void * pBuf, unsigned nBytesInBuf, statusWireIO & ); const char * pHostName ( epicsGuard < epicsMutex > & ) const throw (); double receiveWatchdogDelay ( epicsGuard < epicsMutex > & ) const; - void unresponsiveCircuitNotify ( - epicsGuard < epicsMutex > & cbGuard, + void unresponsiveCircuitNotify ( + epicsGuard < epicsMutex > & cbGuard, epicsGuard < epicsMutex > & guard ); - void initiateCleanShutdown ( + void initiateCleanShutdown ( + epicsGuard < epicsMutex > & ); + void initiateAbortShutdown ( epicsGuard < epicsMutex > & ); - void initiateAbortShutdown ( - epicsGuard < epicsMutex > & ); void disconnectNotify ( epicsGuard < epicsMutex > & ); bool bytesArePendingInOS () const; - void decrementBlockingForFlushCount ( + void decrementBlockingForFlushCount ( epicsGuard < epicsMutex > & guard ); bool isNameService () const; // send protocol stubs - void echoRequest ( + void echoRequest ( epicsGuard < epicsMutex > & ); - void versionMessage ( + void versionMessage ( epicsGuard < epicsMutex > &, const cacChannel::priLev & priority ); void disableFlowControlRequest ( epicsGuard < epicsMutex > & ); void enableFlowControlRequest ( epicsGuard < epicsMutex > & ); - void hostNameSetRequest ( + void hostNameSetRequest ( epicsGuard < epicsMutex > & ); - void userNameSetRequest ( + void userNameSetRequest ( epicsGuard < epicsMutex > & ); - void createChannelRequest ( + void createChannelRequest ( nciu &, epicsGuard < epicsMutex > & ); - void writeRequest ( - epicsGuard < epicsMutex > &, nciu &, + void writeRequest ( + epicsGuard < epicsMutex > &, nciu &, unsigned type, arrayElementCount nElem, const void *pValue ); - void writeNotifyRequest ( - epicsGuard < epicsMutex > &, nciu &, - netWriteNotifyIO &, unsigned type, + void writeNotifyRequest ( + epicsGuard < epicsMutex > &, nciu &, + netWriteNotifyIO &, unsigned type, arrayElementCount nElem, const void *pValue ); - void readNotifyRequest ( - epicsGuard < epicsMutex > &, nciu &, - netReadNotifyIO &, unsigned type, + void readNotifyRequest ( + epicsGuard < epicsMutex > &, nciu &, + netReadNotifyIO &, unsigned type, arrayElementCount nElem ); - void subscriptionRequest ( - epicsGuard < epicsMutex > &, + void subscriptionRequest ( + epicsGuard < epicsMutex > &, nciu &, netSubscription & subscr ); - void subscriptionUpdateRequest ( - epicsGuard < epicsMutex > &, + void subscriptionUpdateRequest ( + epicsGuard < epicsMutex > &, nciu & chan, netSubscription & subscr ); - void subscriptionCancelRequest ( - epicsGuard < epicsMutex > &, + void subscriptionCancelRequest ( + epicsGuard < epicsMutex > &, nciu & chan, netSubscription & subscr ); void flushIfRecvProcessRequested ( epicsGuard < epicsMutex > & ); - bool sendThreadFlush ( + bool sendThreadFlush ( epicsGuard < epicsMutex > & ); // netiiu stubs - void uninstallChanDueToSuccessfulSearchResponse ( + void uninstallChanDueToSuccessfulSearchResponse ( epicsGuard < epicsMutex > &, nciu &, const class epicsTime & ); bool searchMsg ( - epicsGuard < epicsMutex > &, ca_uint32_t id, + epicsGuard < epicsMutex > &, ca_uint32_t id, const char * pName, unsigned nameLength ); friend class tcpRecvThread; friend class tcpSendThread; - tcpiiu ( const tcpiiu & ); - tcpiiu & operator = ( const tcpiiu & ); + tcpiiu ( const tcpiiu & ); + tcpiiu & operator = ( const tcpiiu & ); void operator delete ( void * ); }; -inline void * tcpiiu::operator new ( size_t size, +inline void * tcpiiu::operator new ( size_t size, tsFreeList < class tcpiiu, 32, epicsMutexNOOP > & mgr ) { return mgr.allocate ( size ); } - + #ifdef CXX_PLACEMENT_DELETE -inline void tcpiiu::operator delete ( void * pCadaver, +inline void tcpiiu::operator delete ( void * pCadaver, tsFreeList < class tcpiiu, 32, epicsMutexNOOP > & mgr ) { mgr.release ( pCadaver ); @@ -371,7 +371,7 @@ inline bool tcpiiu::ca_v49_ok ( inline bool tcpiiu::alive ( epicsGuard < epicsMutex > & ) const { - return ( this->state == iiucs_connecting || + return ( this->state == iiucs_connecting || this->state == iiucs_connected ); } @@ -381,14 +381,14 @@ inline bool tcpiiu::connecting ( return ( this->state == iiucs_connecting ); } -inline bool tcpiiu::receiveThreadIsBusy ( +inline bool tcpiiu::receiveThreadIsBusy ( epicsGuard < epicsMutex > & guard ) { guard.assertIdenticalMutex ( this->mutex ); return this->_receiveThreadIsBusy; } -inline void tcpiiu::beaconAnomalyNotify ( +inline void tcpiiu::beaconAnomalyNotify ( epicsGuard < epicsMutex > & guard ) { //guard.assertIdenticalMutex ( this->cacRef.mutexRef () ); diff --git a/modules/ca/src/perl/CA.pm b/modules/ca/src/perl/CA.pm index d79cdd33e..2c5232222 100644 --- a/modules/ca/src/perl/CA.pm +++ b/modules/ca/src/perl/CA.pm @@ -134,7 +134,7 @@ garbage-collected by Perl. =head2 Object Methods -The following methods are provided for channel objects returned by +The following methods are provided for channel objects returned by C<< CA->new() >>. =over 4 @@ -232,7 +232,7 @@ below. Callback subroutines should only call Perl's C, C or similar functions if they are expecting the program to exit at that time; attempts to C with an exception object in the callback and catch that using C in -the main thread are not likely to succeed and will probably result in a crash. +the main thread are not likely to succeed and will probably result in a crash. Callbacks should not perform any operations that would block for more than a fraction of a second as this will hold up network communications with the relevant server and could cause the Perl program and/or the Channel Access diff --git a/modules/ca/src/template/top/caClientApp/caExample.c b/modules/ca/src/template/top/caClientApp/caExample.c index cc342e237..5ab230827 100644 --- a/modules/ca/src/template/top/caClientApp/caExample.c +++ b/modules/ca/src/template/top/caClientApp/caExample.c @@ -8,12 +8,12 @@ int main(int argc,char **argv) { - double data; - chid mychid; + double data; + chid mychid; if(argc != 2) { - fprintf(stderr,"usage: caExample pvname\n"); - exit(1); + fprintf(stderr,"usage: caExample pvname\n"); + exit(1); } SEVCHK(ca_context_create(ca_disable_preemptive_callback),"ca_context_create"); SEVCHK(ca_create_channel(argv[1],NULL,NULL,10,&mychid),"ca_create_channel failure"); diff --git a/modules/ca/src/template/top/caClientApp/caMonitor.c b/modules/ca/src/template/top/caClientApp/caMonitor.c index 9554cc744..5adc90e7f 100644 --- a/modules/ca/src/template/top/caClientApp/caMonitor.c +++ b/modules/ca/src/template/top/caClientApp/caMonitor.c @@ -18,9 +18,9 @@ #define MAX_PV_NAME_LEN 40 typedef struct{ - char value[20]; - chid mychid; - evid myevid; + char value[20]; + chid mychid; + evid myevid; } MYNODE; @@ -28,16 +28,16 @@ static void printChidInfo(chid chid, char *message) { printf("\n%s\n",message); printf("pv: %s type(%d) nelements(%ld) host(%s)", - ca_name(chid),ca_field_type(chid),ca_element_count(chid), - ca_host_name(chid)); + ca_name(chid),ca_field_type(chid),ca_element_count(chid), + ca_host_name(chid)); printf(" read(%d) write(%d) state(%d)\n", - ca_read_access(chid),ca_write_access(chid),ca_state(chid)); + ca_read_access(chid),ca_write_access(chid),ca_state(chid)); } static void exceptionCallback(struct exception_handler_args args) { - chid chid = args.chid; - long stat = args.stat; /* Channel access status code*/ + chid chid = args.chid; + long stat = args.stat; /* Channel access status code*/ const char *channel; static char *noname = "unknown"; @@ -51,39 +51,39 @@ static void exceptionCallback(struct exception_handler_args args) static void connectionCallback(struct connection_handler_args args) { - chid chid = args.chid; + chid chid = args.chid; printChidInfo(chid,"connectionCallback"); } static void accessRightsCallback(struct access_rights_handler_args args) { - chid chid = args.chid; + chid chid = args.chid; printChidInfo(chid,"accessRightsCallback"); } static void eventCallback(struct event_handler_args eha) { - chid chid = eha.chid; + chid chid = eha.chid; if(eha.status!=ECA_NORMAL) { - printChidInfo(chid,"eventCallback"); + printChidInfo(chid,"eventCallback"); } else { - char *pdata = (char *)eha.dbr; - printf("Event Callback: %s = %s\n",ca_name(eha.chid),pdata); + char *pdata = (char *)eha.dbr; + printf("Event Callback: %s = %s\n",ca_name(eha.chid),pdata); } } int main(int argc,char **argv) { char *filename; - int npv = 0; - MYNODE *pmynode[MAX_PV]; - char *pname[MAX_PV]; - int i; - char tempStr[MAX_PV_NAME_LEN]; - char *pstr; - FILE *fp; + int npv = 0; + MYNODE *pmynode[MAX_PV]; + char *pname[MAX_PV]; + int i; + char tempStr[MAX_PV_NAME_LEN]; + char *pstr; + FILE *fp; if (argc != 2) { fprintf(stderr,"usage: caMonitor filename\n"); @@ -112,17 +112,17 @@ int main(int argc,char **argv) fclose(fp); SEVCHK(ca_context_create(ca_disable_preemptive_callback),"ca_context_create"); SEVCHK(ca_add_exception_event(exceptionCallback,NULL), - "ca_add_exception_event"); + "ca_add_exception_event"); for (i=0; imychid), - "ca_create_channel"); - SEVCHK(ca_replace_access_rights_event(pmynode[i]->mychid, - accessRightsCallback), - "ca_replace_access_rights_event"); - SEVCHK(ca_create_subscription(DBR_STRING,1,pmynode[i]->mychid, - DBE_VALUE,eventCallback,pmynode[i],&pmynode[i]->myevid), - "ca_create_subscription"); + SEVCHK(ca_create_channel(pname[i],connectionCallback, + pmynode[i],20,&pmynode[i]->mychid), + "ca_create_channel"); + SEVCHK(ca_replace_access_rights_event(pmynode[i]->mychid, + accessRightsCallback), + "ca_replace_access_rights_event"); + SEVCHK(ca_create_subscription(DBR_STRING,1,pmynode[i]->mychid, + DBE_VALUE,eventCallback,pmynode[i],&pmynode[i]->myevid), + "ca_create_subscription"); } /*Should never return from following call*/ SEVCHK(ca_pend_event(0.0),"ca_pend_event"); diff --git a/modules/ca/src/template/top/caPerlApp/camonitor.pl b/modules/ca/src/template/top/caPerlApp/camonitor.pl index 564688d68..3a61f2d6c 100644 --- a/modules/ca/src/template/top/caPerlApp/camonitor.pl +++ b/modules/ca/src/template/top/caPerlApp/camonitor.pl @@ -55,7 +55,7 @@ sub conn_callback { if ($opt_n && $type eq 'DBR_ENUM') || (!$opt_S && $type eq 'DBR_CHAR'); $type =~ s/^DBR_/DBR_TIME_/; - + $monitors{$chan} = $chan->create_subscription($opt_m, \&mon_callback, $type, 0+$opt_c); } @@ -93,7 +93,7 @@ sub display { my ($chan, $data) = @_; die "Internal error" unless ref $data eq 'HASH'; - + my $type = $data->{TYPE}; my $value = $data->{value}; if (ref $value eq 'ARRAY') { diff --git a/modules/ca/src/tools/caget.c b/modules/ca/src/tools/caget.c index 75225d07f..8f8e46f8e 100644 --- a/modules/ca/src/tools/caget.c +++ b/modules/ca/src/tools/caget.c @@ -8,7 +8,7 @@ * Copyright (c) 2002 Berliner Elektronenspeicherringgesellschaft fuer * Synchrotronstrahlung. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -109,12 +109,12 @@ static void usage (void) /*+************************************************************************** * - * Function: event_handler + * Function: event_handler * - * Description: CA event_handler for request type callback - * Allocates the dbr structure and copies the data + * Description: CA event_handler for request type callback + * Allocates the dbr structure and copies the data * - * Arg(s) In: args - event handler args (see CA manual) + * Arg(s) In: args - event handler args (see CA manual) * **************************************************************************-*/ @@ -137,22 +137,22 @@ static void event_handler (evargs args) /*+************************************************************************** * - * Function: caget + * Function: caget * - * Description: Issue read requests, wait for incoming data - * and print the data according to the selected format + * Description: Issue read requests, wait for incoming data + * and print the data according to the selected format * - * Arg(s) In: pvs - Pointer to an array of pv structures + * Arg(s) In: pvs - Pointer to an array of pv structures * nPvs - Number of elements in the pvs array * request - Request type * format - Output format * dbrType - Requested dbr type * reqElems - Requested number of (array) elements * - * Return(s): Error code: 0 = OK, 1 = Error + * Return(s): Error code: 0 = OK, 1 = Error * **************************************************************************-*/ - + static int caget (pv *pvs, int nPvs, RequestT request, OutputT format, chtype dbrType, unsigned long reqElems) { @@ -350,23 +350,23 @@ static int caget (pv *pvs, int nPvs, RequestT request, OutputT format, /*+************************************************************************** * - * Function: main + * Function: main * - * Description: caget main() - * Evaluate command line options, set up CA, connect the - * channels, collect and print the data as requested + * Description: caget main() + * Evaluate command line options, set up CA, connect the + * channels, collect and print the data as requested * - * Arg(s) In: [options] ... + * Arg(s) In: [options] ... * - * Arg(s) Out: none + * Arg(s) Out: none * - * Return(s): Standard return code (0=success, 1=error) + * Return(s): Standard return code (0=success, 1=error) * **************************************************************************-*/ static void complainIfNotPlainAndSet (OutputT *current, const OutputT requested) { - if (*current != plain) + if (*current != plain) fprintf(stderr, "Options t,d,a are mutually exclusive. " "('caget -h' for help.)\n"); @@ -467,7 +467,7 @@ int main (int argc, char *argv[]) case 'f': case 'g': if (sscanf(optarg, "%d", &digits) != 1) - fprintf(stderr, + fprintf(stderr, "Invalid precision argument '%s' " "for option '-%c' - ignored.\n", optarg, opt); else diff --git a/modules/ca/src/tools/cainfo.c b/modules/ca/src/tools/cainfo.c index fc18ccd3f..13696de34 100644 --- a/modules/ca/src/tools/cainfo.c +++ b/modules/ca/src/tools/cainfo.c @@ -7,7 +7,7 @@ * Copyright (c) 2002 Berliner Elektronenspeicherringgesellschaft fuer * Synchrotronstrahlung. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -51,17 +51,17 @@ void usage (void) /*+************************************************************************** * - * Function: cainfo + * Function: cainfo * - * Description: Print CA info data or call ca_client_status + * Description: Print CA info data or call ca_client_status * - * Arg(s) In: pvs - Pointer to an array of pv structures + * Arg(s) In: pvs - Pointer to an array of pv structures * nPvs - Number of elements in the pvs array * - * Return(s): Error code: 0 = OK, 1 = Error + * Return(s): Error code: 0 = OK, 1 = Error * **************************************************************************-*/ - + int cainfo (pv *pvs, int nPvs) { int n; @@ -114,17 +114,17 @@ int cainfo (pv *pvs, int nPvs) /*+************************************************************************** * - * Function: main + * Function: main * - * Description: cainfo main() - * Evaluate command line options, set up CA, connect the - * channels, print the data as requested + * Description: cainfo main() + * Evaluate command line options, set up CA, connect the + * channels, print the data as requested * - * Arg(s) In: [options] ... + * Arg(s) In: [options] ... * - * Arg(s) Out: none + * Arg(s) Out: none * - * Return(s): Standard return code (0=success, 1=error) + * Return(s): Standard return code (0=success, 1=error) * **************************************************************************-*/ diff --git a/modules/ca/src/tools/camonitor.c b/modules/ca/src/tools/camonitor.c index 6799182be..e83883702 100644 --- a/modules/ca/src/tools/camonitor.c +++ b/modules/ca/src/tools/camonitor.c @@ -7,7 +7,7 @@ * Copyright (c) 2002 Berliner Elektronenspeicherringgesellschaft fuer * Synchrotronstrahlung. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -95,12 +95,12 @@ void usage (void) /*+************************************************************************** * - * Function: event_handler + * Function: event_handler * - * Description: CA event_handler for request type callback - * Prints the event data + * Description: CA event_handler for request type callback + * Prints the event data * - * Arg(s) In: args - event handler args (see CA manual) + * Arg(s) In: args - event handler args (see CA manual) * **************************************************************************-*/ @@ -125,11 +125,11 @@ static void event_handler (evargs args) /*+************************************************************************** * - * Function: connection_handler + * Function: connection_handler * - * Description: CA connection_handler + * Description: CA connection_handler * - * Arg(s) In: args - connection_handler_args (see CA manual) + * Arg(s) In: args - connection_handler_args (see CA manual) * **************************************************************************-*/ @@ -189,17 +189,17 @@ static void connection_handler ( struct connection_handler_args args ) /*+************************************************************************** * - * Function: main + * Function: main * - * Description: camonitor main() - * Evaluate command line options, set up CA, connect the - * channels, collect and print the data as requested + * Description: camonitor main() + * Evaluate command line options, set up CA, connect the + * channels, collect and print the data as requested * - * Arg(s) In: [options] ... + * Arg(s) In: [options] ... * - * Arg(s) Out: none + * Arg(s) Out: none * - * Return(s): Standard return code (0=success, 1=error) + * Return(s): Standard return code (0=success, 1=error) * **************************************************************************-*/ @@ -303,7 +303,7 @@ int main (int argc, char *argv[]) case 'f': case 'g': if (sscanf(optarg, "%d", &digits) != 1) - fprintf(stderr, + fprintf(stderr, "Invalid precision argument '%s' " "for option '-%c' - ignored.\n", optarg, opt); else diff --git a/modules/ca/src/tools/caput.c b/modules/ca/src/tools/caput.c index 79ffef8c3..0cd923e72 100644 --- a/modules/ca/src/tools/caput.c +++ b/modules/ca/src/tools/caput.c @@ -110,18 +110,18 @@ void put_event_handler ( struct event_handler_args args ) /*+************************************************************************** * - * Function: caget + * Function: caget * - * Description: Issue read request, wait for incoming data - * and print the data + * Description: Issue read request, wait for incoming data + * and print the data * - * Arg(s) In: pvs - Pointer to an array of pv structures + * Arg(s) In: pvs - Pointer to an array of pv structures * nPvs - Number of elements in the pvs array * format - Output format * dbrType - Requested dbr type * reqElems - Requested number of (array) elements * - * Return(s): Error code: 0 = OK, 1 = Error + * Return(s): Error code: 0 = OK, 1 = Error * **************************************************************************-*/ @@ -241,17 +241,17 @@ int caget (pv *pvs, int nPvs, OutputT format, /*+************************************************************************** * - * Function: main + * Function: main * - * Description: caput main() - * Evaluate command line options, set up CA, connect the - * channel, put and print the data + * Description: caput main() + * Evaluate command line options, set up CA, connect the + * channel, put and print the data * - * Arg(s) In: [options] ... + * Arg(s) In: [options] ... * - * Arg(s) Out: none + * Arg(s) Out: none * - * Return(s): Standard return code (0=success, 1=error) + * Return(s): Standard return code (0=success, 1=error) * **************************************************************************-*/ diff --git a/modules/ca/src/tools/tool_lib.c b/modules/ca/src/tools/tool_lib.c index 29b252e37..e5dbd1afb 100644 --- a/modules/ca/src/tools/tool_lib.c +++ b/modules/ca/src/tools/tool_lib.c @@ -7,7 +7,7 @@ * Copyright (c) 2002 Berliner Elektronenspeicherringgesellschaft fuer * Synchrotronstrahlung. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -94,15 +94,15 @@ static void sprint_long (char *ret, dbr_long_t val, IntFormatT outType) /*+************************************************************************** * - * Function: val2str + * Function: val2str * - * Description: Print (convert) value to a string + * Description: Print (convert) value to a string * - * Arg(s) In: v - Pointer to dbr_... structure + * Arg(s) In: v - Pointer to dbr_... structure * type - Numeric dbr type - * index - Index of element to print (for arrays) + * index - Index of element to print (for arrays) * - * Return(s): Pointer to static output string + * Return(s): Pointer to static output string * **************************************************************************-*/ @@ -192,14 +192,14 @@ char *val2str (const void *v, unsigned type, int index) /*+************************************************************************** * - * Function: dbr2str + * Function: dbr2str * - * Description: Print (convert) additional information contained in dbr_... + * Description: Print (convert) additional information contained in dbr_... * - * Arg(s) In: value - Pointer to dbr_... structure + * Arg(s) In: value - Pointer to dbr_... structure * type - Numeric dbr type * - * Return(s): Pointer to static output string + * Return(s): Pointer to static output string * **************************************************************************-*/ @@ -398,16 +398,16 @@ char *dbr2str (const void *value, unsigned type) /*+************************************************************************** * - * Function: print_time_val_sts + * Function: print_time_val_sts * - * Description: Print (to stdout) one wide output line + * Description: Print (to stdout) one wide output line * (name, timestamp, value, status, severity) * - * Arg(s) In: pv - Pointer to pv structure + * Arg(s) In: pv - Pointer to pv structure * nElems - Number of elements (array) * **************************************************************************-*/ - + #define PRN_TIME_VAL_STS(TYPE,TYPE_ENUM) \ printAbs = !pv->firstStampPrinted; \ \ @@ -555,22 +555,22 @@ void print_time_val_sts (pv* pv, unsigned long reqElems) /*+************************************************************************** * - * Function: create_pvs + * Function: create_pvs * - * Description: Creates an arbitrary number of PVs + * Description: Creates an arbitrary number of PVs * - * Arg(s) In: pvs - Pointer to an array of pv structures + * Arg(s) In: pvs - Pointer to an array of pv structures * nPvs - Number of elements in the pvs array * pCB - Connection state change callback * - * Arg(s) Out: none + * Arg(s) Out: none * - * Return(s): Error code: + * Return(s): Error code: * 0 - All PVs created * 1 - Some PV(s) not created * **************************************************************************-*/ - + int create_pvs (pv* pvs, int nPvs, caCh *pCB) { int n; @@ -603,21 +603,21 @@ int create_pvs (pv* pvs, int nPvs, caCh *pCB) /*+************************************************************************** * - * Function: connect_pvs + * Function: connect_pvs * - * Description: Connects an arbitrary number of PVs + * Description: Connects an arbitrary number of PVs * - * Arg(s) In: pvs - Pointer to an array of pv structures + * Arg(s) In: pvs - Pointer to an array of pv structures * nPvs - Number of elements in the pvs array * - * Arg(s) Out: none + * Arg(s) Out: none * - * Return(s): Error code: + * Return(s): Error code: * 0 - All PVs connected * 1 - Some PV(s) not connected * **************************************************************************-*/ - + int connect_pvs (pv* pvs, int nPvs) { int returncode = create_pvs ( pvs, nPvs, 0); @@ -630,7 +630,7 @@ int connect_pvs (pv* pvs, int nPvs) { fprintf(stderr, "Channel connect timed out: some PV(s) not found.\n"); } else { - fprintf(stderr, "Channel connect timed out: '%s' not found.\n", + fprintf(stderr, "Channel connect timed out: '%s' not found.\n", pvs[0].name); } returncode = 1; diff --git a/modules/ca/src/tools/tool_lib.h b/modules/ca/src/tools/tool_lib.h index 58cf182c0..b53609eac 100644 --- a/modules/ca/src/tools/tool_lib.h +++ b/modules/ca/src/tools/tool_lib.h @@ -6,7 +6,7 @@ * Copyright (c) 2002 Berliner Elektronenspeicherringgesellschaft fuer * Synchrotronstrahlung. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -64,7 +64,7 @@ typedef enum { absolute, relative, incremental, incrementalByChan } TimeT; typedef enum { dec, bin, oct, hex } IntFormatT; /* Structure representing one PV (= channel) */ -typedef struct +typedef struct { char* name; chid chid; diff --git a/modules/database/src/ioc/as/asCa.c b/modules/database/src/ioc/as/asCa.c index b64a6ddc0..ffd8c0ab5 100644 --- a/modules/database/src/ioc/as/asCa.c +++ b/modules/database/src/ioc/as/asCa.c @@ -5,7 +5,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* Author: Marty Kraimer Date: 10-15-93 */ @@ -43,14 +43,14 @@ epicsExportAddress(int,asCaDebug); static int firstTime = TRUE; static epicsThreadId threadid=0; static int caInitializing=FALSE; -static epicsMutexId asCaTaskLock; /*lock access to task */ -static epicsEventId asCaTaskWait; /*Wait for task to respond*/ -static epicsEventId asCaTaskAddChannels; /*Tell asCaTask to add channels*/ -static epicsEventId asCaTaskClearChannels;/*Tell asCaTask to clear channels*/ +static epicsMutexId asCaTaskLock; /*lock access to task */ +static epicsEventId asCaTaskWait; /*Wait for task to respond*/ +static epicsEventId asCaTaskAddChannels; /*Tell asCaTask to add channels*/ +static epicsEventId asCaTaskClearChannels; /*Tell asCaTask to clear channels*/ typedef struct { struct dbr_sts_double rtndata; - chid chid; + chid chid; } CAPVT; static void exceptionCallback(struct exception_handler_args args) @@ -90,9 +90,9 @@ static void exceptionCallback(struct exception_handler_args args) /*connectCallback only handles disconnects*/ static void connectCallback(struct connection_handler_args arg) { - chid chid = arg.chid; - ASGINP *pasginp = (ASGINP *)ca_puser(chid); - ASG *pasg = pasginp->pasg; + chid chid = arg.chid; + ASGINP *pasginp = (ASGINP *)ca_puser(chid); + ASG *pasg = pasginp->pasg; if(ca_state(chid)!=cs_conn) { if(!(pasg->inpBad & (1<inpIndex))) { @@ -107,11 +107,11 @@ static void connectCallback(struct connection_handler_args arg) static void eventCallback(struct event_handler_args arg) { - int caStatus = arg.status; - chid chid = arg.chid; - ASGINP *pasginp = (ASGINP *)arg.usr; - ASG *pasg; - CAPVT *pcapvt; + int caStatus = arg.status; + chid chid = arg.chid; + ASGINP *pasginp = (ASGINP *)arg.usr; + ASG *pasg; + CAPVT *pcapvt; const struct dbr_sts_double *pdata; if(caStatus!=ECA_NORMAL) { @@ -163,10 +163,10 @@ static void eventCallback(struct event_handler_args arg) static void asCaTask(void) { - ASG *pasg; - ASGINP *pasginp; - CAPVT *pcapvt; - int status; + ASG *pasg; + ASGINP *pasginp; + CAPVT *pcapvt; + int status; taskwdInsert(epicsThreadGetIdSelf(),NULL,NULL); SEVCHK(ca_context_create(ca_enable_preemptive_callback), diff --git a/modules/database/src/ioc/as/asCa.h b/modules/database/src/ioc/as/asCa.h index a99cb544a..5a2f05b29 100644 --- a/modules/database/src/ioc/as/asCa.h +++ b/modules/database/src/ioc/as/asCa.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* asCa.h */ diff --git a/modules/database/src/ioc/as/asDbLib.c b/modules/database/src/ioc/as/asDbLib.c index 49be480bc..6420a40d5 100644 --- a/modules/database/src/ioc/as/asDbLib.c +++ b/modules/database/src/ioc/as/asDbLib.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* Author: Marty Kraimer Date: 02-11-94*/ @@ -36,32 +36,32 @@ #include "dbStaticLib.h" #include "recSup.h" -static char *pacf=NULL; -static char *psubstitutions=NULL; -static epicsThreadId asInitTheadId=0; -static int firstTime = TRUE; +static char *pacf=NULL; +static char *psubstitutions=NULL; +static epicsThreadId asInitTheadId=0; +static int firstTime = TRUE; static long asDbAddRecords(void) { - DBENTRY dbentry; - DBENTRY *pdbentry=&dbentry; - long status; - dbCommon *precord; + DBENTRY dbentry; + DBENTRY *pdbentry=&dbentry; + long status; + dbCommon *precord; dbInitEntry(pdbbase,pdbentry); status = dbFirstRecordType(pdbentry); while(!status) { - status = dbFirstRecord(pdbentry); - while(!status) { - precord = pdbentry->precnode->precord; - if(!precord->asp) { - status = asAddMember(&precord->asp, precord->asg); - if(status) errMessage(status,"asDbAddRecords:asAddMember"); - asPutMemberPvt(precord->asp,precord); - } - status = dbNextRecord(pdbentry); - } - status = dbNextRecordType(pdbentry); + status = dbFirstRecord(pdbentry); + while(!status) { + precord = pdbentry->precnode->precord; + if(!precord->asp) { + status = asAddMember(&precord->asp, precord->asg); + if(status) errMessage(status,"asDbAddRecords:asAddMember"); + asPutMemberPvt(precord->asp,precord); + } + status = dbNextRecord(pdbentry); + } + status = dbNextRecordType(pdbentry); } dbFinishEntry(pdbentry); return(0); @@ -92,14 +92,14 @@ int asSetSubstitutions(const char *substitutions) { if(psubstitutions) free ((void *)psubstitutions); if(substitutions) { - psubstitutions = calloc(1,strlen(substitutions)+1); - if(!psubstitutions) { - errMessage(0,"asSetSubstitutions calloc failure"); - } else { - strcpy(psubstitutions,substitutions); - } + psubstitutions = calloc(1,strlen(substitutions)+1); + if(!psubstitutions) { + errMessage(0,"asSetSubstitutions calloc failure"); + } else { + strcpy(psubstitutions,substitutions); + } } else { - psubstitutions = NULL; + psubstitutions = NULL; } return(0); } @@ -117,9 +117,9 @@ static void asInitCommonOnce(void *arg) static long asInitCommon(void) { - long status; - int asWasActive = asActive; - int wasFirstTime = firstTime; + long status; + int asWasActive = asActive; + int wasFirstTime = firstTime; static epicsThreadOnceId asInitCommonOnceFlag = EPICS_THREAD_ONCE_INIT; @@ -140,11 +140,11 @@ static long asInitCommon(void) } status = asInitFile(pacf,psubstitutions); if(asActive) { - if(!asWasActive) { + if(!asWasActive) { dbSpcAsRegisterCallback(asSpcAsCallback); asDbAddRecords(); } - asCaStart(); + asCaStart(); } return(status); } @@ -179,8 +179,8 @@ static void asInitTask(ASDBCALLBACK *pcallback) taskwdRemove(epicsThreadGetIdSelf()); asInitTheadId = 0; if(pcallback) { - pcallback->status = status; - callbackRequest(&pcallback->callback); + pcallback->status = status; + callbackRequest(&pcallback->callback); } } @@ -188,24 +188,24 @@ int asInitAsyn(ASDBCALLBACK *pcallback) { if(!pacf) return(0); if(asInitTheadId) { - errMessage(-1,"asInit: asInitTask already active"); - if(pcallback) { - pcallback->status = S_asLib_InitFailed; - callbackRequest(&pcallback->callback); - } - return(-1); + errMessage(-1,"asInit: asInitTask already active"); + if(pcallback) { + pcallback->status = S_asLib_InitFailed; + callbackRequest(&pcallback->callback); + } + return(-1); } asInitTheadId = epicsThreadCreate("asInitTask", (epicsThreadPriorityCAServerHigh + 1), epicsThreadGetStackSize(epicsThreadStackBig), (EPICSTHREADFUNC)asInitTask,(void *)pcallback); if(asInitTheadId==0) { - errMessage(0,"asInit: epicsThreadCreate Error"); - if(pcallback) { - pcallback->status = S_asLib_InitFailed; - callbackRequest(&pcallback->callback); - } - asInitTheadId = 0; + errMessage(0,"asInit: epicsThreadCreate Error"); + if(pcallback) { + pcallback->status = S_asLib_InitFailed; + callbackRequest(&pcallback->callback); + } + asInitTheadId = 0; } return(0); } @@ -227,18 +227,18 @@ static void astacCallback(ASCLIENTPVT clientPvt,asClientStatus status) recordname = (char *)asGetClientPvt(clientPvt); printf("astac callback %s: status=%d",recordname,status); printf(" get %s put %s\n",(asCheckGet(clientPvt) ? "Yes" : "No"), - (asCheckPut(clientPvt) ? "Yes" : "No")); + (asCheckPut(clientPvt) ? "Yes" : "No")); } int astac(const char *pname,const char *user,const char *location) { - DBADDR *paddr; - long status; - ASCLIENTPVT *pasclientpvt=NULL; - dbCommon *precord; - dbFldDes *pflddes; - char *puser; - char *plocation; + DBADDR *paddr; + long status; + ASCLIENTPVT *pasclientpvt=NULL; + dbCommon *precord; + dbFldDes *pflddes; + char *puser; + char *plocation; if (!pname || !user || !location){ printf("Usage: astac \"record name\", \"user\", \"host\"\n"); @@ -248,8 +248,8 @@ int astac(const char *pname,const char *user,const char *location) pasclientpvt = (ASCLIENTPVT *)(paddr + 1); status=dbNameToAddr(pname,paddr); if(status) { - errMessage(status,"dbNameToAddr error"); - return(1); + errMessage(status,"dbNameToAddr error"); + return(1); } precord = paddr->precord; pflddes = paddr->pfldDes; @@ -259,20 +259,20 @@ int astac(const char *pname,const char *user,const char *location) strcpy(plocation,location); status = asAddClient(pasclientpvt,precord->asp, - (int)pflddes->as_level,puser,plocation); + (int)pflddes->as_level,puser,plocation); if(status) { - errMessage(status,"asAddClient error"); - return(1); + errMessage(status,"asAddClient error"); + return(1); } else { - asPutClientPvt(*pasclientpvt,(void *)precord->name); - asRegisterClientCallback(*pasclientpvt,astacCallback); + asPutClientPvt(*pasclientpvt,(void *)precord->name); + asRegisterClientCallback(*pasclientpvt,astacCallback); } return(0); } static void myMemberCallback(ASMEMBERPVT memPvt,FILE *fp) { - dbCommon *precord; + dbCommon *precord; precord = asGetMemberPvt(memPvt); if(precord) fprintf(fp," Record:%s",precord->name); diff --git a/modules/database/src/ioc/as/asDbLib.h b/modules/database/src/ioc/as/asDbLib.h index 235bbbd4b..289210dd0 100644 --- a/modules/database/src/ioc/as/asDbLib.h +++ b/modules/database/src/ioc/as/asDbLib.h @@ -18,8 +18,8 @@ #include "shareLib.h" typedef struct { - epicsCallback callback; - long status; + epicsCallback callback; + long status; } ASDBCALLBACK; struct dbChannel; diff --git a/modules/database/src/ioc/as/asIocRegister.c b/modules/database/src/ioc/as/asIocRegister.c index 2fa79dfb0..6556cfea4 100644 --- a/modules/database/src/ioc/as/asIocRegister.c +++ b/modules/database/src/ioc/as/asIocRegister.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include "asLib.h" diff --git a/modules/database/src/ioc/as/asIocRegister.h b/modules/database/src/ioc/as/asIocRegister.h index a7421cdac..d5b88b4c6 100644 --- a/modules/database/src/ioc/as/asIocRegister.h +++ b/modules/database/src/ioc/as/asIocRegister.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef INC_asIocRegister_H diff --git a/modules/database/src/ioc/as/ascheck.c b/modules/database/src/ioc/as/ascheck.c index 7272ef4ae..a0db819e5 100644 --- a/modules/database/src/ioc/as/ascheck.c +++ b/modules/database/src/ioc/as/ascheck.c @@ -7,7 +7,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* Author: Marty Kraimer Date: 03-24-94 */ +/* Author: Marty Kraimer Date: 03-24-94 */ #include #include @@ -21,35 +21,35 @@ int main(int argc,char **argv) { int argn = 1; - char *sub = NULL; - int subLength = 0; - char **pstr; - char *psep; - int *len; - long status = 0; + char *sub = NULL; + int subLength = 0; + char **pstr; + char *psep; + int *len; + long status = 0; static char *subSep = ","; /* Look for -Smacro=value options */ while (argc>argn && (strncmp(argv[argn], "-S", 2)==0)) { - pstr = ⊂ - psep = subSep; - len = &subLength; - if (strlen(argv[argn])==2) { - dbCatString(pstr, len, argv[++argn], psep); - } else { - dbCatString(pstr, len, argv[argn]+2, psep); - } - argn++; + pstr = ⊂ + psep = subSep; + len = &subLength; + if (strlen(argv[argn])==2) { + dbCatString(pstr, len, argv[++argn], psep); + } else { + dbCatString(pstr, len, argv[argn]+2, psep); + } + argn++; } if (argc == argn) { - status = asInitFP(stdin, sub); - if(status) errlogPrintf("ascheck: Access Security File failed.\n"); + status = asInitFP(stdin, sub); + if(status) errlogPrintf("ascheck: Access Security File failed.\n"); } else if (argc == argn+1) { - status = asInitFile(argv[argn], sub); - if(status) errlogPrintf("ascheck: Access Security File failed.\n"); + status = asInitFile(argv[argn], sub); + if(status) errlogPrintf("ascheck: Access Security File failed.\n"); } else { - printf("usage: ascheck [-Smac=sub ...] [<] file\n"); - status = -1; + printf("usage: ascheck [-Smac=sub ...] [<] file\n"); + status = -1; } errlogFlush(); return status; diff --git a/modules/database/src/ioc/bpt/cvtTable.h b/modules/database/src/ioc/bpt/cvtTable.h index 374666450..e7d2cf019 100644 --- a/modules/database/src/ioc/bpt/cvtTable.h +++ b/modules/database/src/ioc/bpt/cvtTable.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Breakpoint Tables @@ -15,7 +15,7 @@ */ #ifndef INCcvtTableh -#define INCcvtTableh 1 +#define INCcvtTableh 1 #include "shareLib.h" diff --git a/modules/database/src/ioc/bpt/makeBpt.c b/modules/database/src/ioc/bpt/makeBpt.c index 93095f1c2..a3f37c152 100644 --- a/modules/database/src/ioc/bpt/makeBpt.c +++ b/modules/database/src/ioc/bpt/makeBpt.c @@ -5,12 +5,12 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* - * Author: Marty Kraimer - * Date: 9/28/95 - * Replacement for old bldCvtTable + * Author: Marty Kraimer + * Date: 9/28/95 + * Replacement for old bldCvtTable */ #include @@ -27,40 +27,40 @@ #define MAX_LINE_SIZE 160 #define MAX_BREAKS 100 struct brkCreateInfo { - double engLow; /* Lowest value desired: engineering units */ - double engHigh; /* Highest value desired: engineering units */ - double rawLow; /* Raw value for EngLow */ - double rawHigh; /* Raw value for EngHigh */ - double accuracy; /* accuracy desired in engineering units */ - double tblEngFirst;/* First table value: engineering units */ - double tblEngLast; /* Last table value: engineering units */ - double tblEngDelta;/* Change per table entry: eng units */ - long nTable; /* number of table entries */ - /* (last-first)/delta + 1 */ - double *pTable; /* addr of data table */ + double engLow; /* Lowest value desired: engineering units */ + double engHigh; /* Highest value desired: engineering units */ + double rawLow; /* Raw value for EngLow */ + double rawHigh; /* Raw value for EngHigh */ + double accuracy; /* accuracy desired in engineering units */ + double tblEngFirst; /* First table value: engineering units */ + double tblEngLast; /* Last table value: engineering units */ + double tblEngDelta; /* Change per table entry: eng units */ + long nTable; /* number of table entries */ + /* (last-first)/delta + 1 */ + double *pTable; /* addr of data table */ } brkCreateInfo; -typedef struct brkInt { /* breakpoint interval */ - double raw; /* raw value for beginning of interval */ - double slope; /* slope for interval */ - double eng; /* converted value for beginning of interval */ +typedef struct brkInt { /* breakpoint interval */ + double raw; /* raw value for beginning of interval */ + double slope; /* slope for interval */ + double eng; /* converted value for beginning of interval */ } brkInt; brkInt brkint[MAX_BREAKS]; static int create_break(struct brkCreateInfo *pbci, brkInt *pabrkInt, - int max_breaks, int *n_breaks); + int max_breaks, int *n_breaks); static char inbuf[MAX_LINE_SIZE]; static int linenum=0; typedef struct dataList{ - struct dataList *next; - double value; + struct dataList *next; + double value; }dataList; static int getNumber(char **pbeg, double *value) { - int nchars=0; + int nchars=0; while(isspace((int)**pbeg) && **pbeg!= '\0') (*pbeg)++; if(**pbeg == '!' || **pbeg == '\0') return(-1); @@ -68,7 +68,7 @@ static int getNumber(char **pbeg, double *value) *pbeg += nchars; return(0); } - + static void errExit(char *pmessage) { fprintf(stderr, "%s\n", pmessage); @@ -78,98 +78,98 @@ static void errExit(char *pmessage) int main(int argc, char **argv) { - char *pbeg; - char *pend; - double value; - char *pname = NULL; - dataList *phead; - dataList *pdataList; - dataList *pnext; - double *pdata; - long ndata; - int nBreak,n; - size_t len; - char *outFilename; - char *pext; - FILE *outFile; - FILE *inFile; - char *plastSlash; - + char *pbeg; + char *pend; + double value; + char *pname = NULL; + dataList *phead; + dataList *pdataList; + dataList *pnext; + double *pdata; + long ndata; + int nBreak,n; + size_t len; + char *outFilename; + char *pext; + FILE *outFile; + FILE *inFile; + char *plastSlash; + if(argc<2) { - fprintf(stderr,"usage: makeBpt file.data [outfile]\n"); - exit(-1); + fprintf(stderr,"usage: makeBpt file.data [outfile]\n"); + exit(-1); } if (argc==2) { - plastSlash = strrchr(argv[1],'/'); - plastSlash = (plastSlash ? plastSlash+1 : argv[1]); - outFilename = calloc(1,strlen(plastSlash)+2); - if(!outFilename) { - fprintf(stderr,"calloc failed\n"); - exit(-1); - } - strcpy(outFilename,plastSlash); - pext = strstr(outFilename,".data"); - if(!pext) { - fprintf(stderr,"Input file MUST have .data extension\n"); - exit(-1); - } - strcpy(pext,".dbd"); + plastSlash = strrchr(argv[1],'/'); + plastSlash = (plastSlash ? plastSlash+1 : argv[1]); + outFilename = calloc(1,strlen(plastSlash)+2); + if(!outFilename) { + fprintf(stderr,"calloc failed\n"); + exit(-1); + } + strcpy(outFilename,plastSlash); + pext = strstr(outFilename,".data"); + if(!pext) { + fprintf(stderr,"Input file MUST have .data extension\n"); + exit(-1); + } + strcpy(pext,".dbd"); } else { - outFilename = calloc(1,strlen(argv[2])+1); - if(!outFilename) { - fprintf(stderr,"calloc failed\n"); - exit(-1); - } - strcpy(outFilename,argv[2]); + outFilename = calloc(1,strlen(argv[2])+1); + if(!outFilename) { + fprintf(stderr,"calloc failed\n"); + exit(-1); + } + strcpy(outFilename,argv[2]); } inFile = fopen(argv[1],"r"); if(!inFile) { - fprintf(stderr,"Error opening %s\n",argv[1]); - exit(-1); + fprintf(stderr,"Error opening %s\n",argv[1]); + exit(-1); } outFile = fopen(outFilename,"w"); if(!outFile) { - fprintf(stderr,"Error opening %s\n",outFilename); - exit(-1); + fprintf(stderr,"Error opening %s\n",outFilename); + exit(-1); } while(fgets(inbuf,MAX_LINE_SIZE,inFile)) { - linenum++; - pbeg = inbuf; - while(isspace((int)*pbeg) && *pbeg!= '\0') pbeg++; - if(*pbeg == '!' || *pbeg == '\0') continue; - while(*pbeg!='"' && *pbeg!= '\0') pbeg++; - if(*pbeg!='"' ) errExit("Illegal Header"); - pbeg++; pend = pbeg; - while(*pend!='"' && *pend!= '\0') pend++; - if(*pend!='"') errExit("Illegal Header"); - len = pend - pbeg; - if(len<=1) errExit("Illegal Header"); - pname = calloc(len+1,sizeof(char)); - if(!pname) { - fprintf(stderr,"calloc failed while processing line %d\n",linenum); - exit(-1); - } - strncpy(pname,pbeg,len); - pname[len]='\0'; - pbeg = pend + 1; - if(getNumber(&pbeg,&value)) errExit("Illegal Header"); - brkCreateInfo.engLow = value; - if(getNumber(&pbeg,&value)) errExit("Illegal Header"); - brkCreateInfo.rawLow = value; - if(getNumber(&pbeg,&value)) errExit("Illegal Header"); - brkCreateInfo.engHigh = value; - if(getNumber(&pbeg,&value)) errExit("Illegal Header"); - brkCreateInfo.rawHigh = value; - if(getNumber(&pbeg,&value)) errExit("Illegal Header"); - brkCreateInfo.accuracy = value; - if(getNumber(&pbeg,&value)) errExit("Illegal Header"); - brkCreateInfo.tblEngFirst = value; - if(getNumber(&pbeg,&value)) errExit("Illegal Header"); - brkCreateInfo.tblEngLast = value; - if(getNumber(&pbeg,&value)) errExit("Illegal Header"); - brkCreateInfo.tblEngDelta = value; - goto got_header; + linenum++; + pbeg = inbuf; + while(isspace((int)*pbeg) && *pbeg!= '\0') pbeg++; + if(*pbeg == '!' || *pbeg == '\0') continue; + while(*pbeg!='"' && *pbeg!= '\0') pbeg++; + if(*pbeg!='"' ) errExit("Illegal Header"); + pbeg++; pend = pbeg; + while(*pend!='"' && *pend!= '\0') pend++; + if(*pend!='"') errExit("Illegal Header"); + len = pend - pbeg; + if(len<=1) errExit("Illegal Header"); + pname = calloc(len+1,sizeof(char)); + if(!pname) { + fprintf(stderr,"calloc failed while processing line %d\n",linenum); + exit(-1); + } + strncpy(pname,pbeg,len); + pname[len]='\0'; + pbeg = pend + 1; + if(getNumber(&pbeg,&value)) errExit("Illegal Header"); + brkCreateInfo.engLow = value; + if(getNumber(&pbeg,&value)) errExit("Illegal Header"); + brkCreateInfo.rawLow = value; + if(getNumber(&pbeg,&value)) errExit("Illegal Header"); + brkCreateInfo.engHigh = value; + if(getNumber(&pbeg,&value)) errExit("Illegal Header"); + brkCreateInfo.rawHigh = value; + if(getNumber(&pbeg,&value)) errExit("Illegal Header"); + brkCreateInfo.accuracy = value; + if(getNumber(&pbeg,&value)) errExit("Illegal Header"); + brkCreateInfo.tblEngFirst = value; + if(getNumber(&pbeg,&value)) errExit("Illegal Header"); + brkCreateInfo.tblEngLast = value; + if(getNumber(&pbeg,&value)) errExit("Illegal Header"); + brkCreateInfo.tblEngDelta = value; + goto got_header; } errExit("Illegal Header"); got_header: @@ -177,48 +177,48 @@ got_header: ndata = 0; errno = 0; while(fgets(inbuf,MAX_LINE_SIZE,inFile)) { - double value; + double value; - linenum++; - pbeg = inbuf; - while(!getNumber(&pbeg,&value)) { - ndata++; - pdataList = (dataList *)calloc(1,sizeof(dataList)); - if(!pdataList) { - fprintf(stderr,"calloc failed (after header)" - " while processing line %d\n",linenum); - exit(-1); - } - if(!phead) - phead = pdataList; - else - pnext->next = pdataList; - pdataList->value = value; - pnext = pdataList; - } + linenum++; + pbeg = inbuf; + while(!getNumber(&pbeg,&value)) { + ndata++; + pdataList = (dataList *)calloc(1,sizeof(dataList)); + if(!pdataList) { + fprintf(stderr,"calloc failed (after header)" + " while processing line %d\n",linenum); + exit(-1); + } + if(!phead) + phead = pdataList; + else + pnext->next = pdataList; + pdataList->value = value; + pnext = pdataList; + } } if(!pname) { - errExit("create_break failed: no name specified\n"); + errExit("create_break failed: no name specified\n"); } brkCreateInfo.nTable = ndata; pdata = (double *)calloc(brkCreateInfo.nTable,sizeof(double)); if(!pdata) { - fprintf(stderr,"calloc failed for table length %ld\n",brkCreateInfo.nTable); - exit(-1); + fprintf(stderr,"calloc failed for table length %ld\n",brkCreateInfo.nTable); + exit(-1); } pnext = phead; for(n=0; nvalue; - pdataList = pnext; - pnext = pnext->next; - free((void *)pdataList); + pdata[n] = pnext->value; + pdataList = pnext; + pnext = pnext->next; + free((void *)pdataList); } brkCreateInfo.pTable = pdata; - if(create_break(&brkCreateInfo,&brkint[0],MAX_BREAKS,&nBreak)) - errExit("create_break failed\n"); + if(create_break(&brkCreateInfo,&brkint[0],MAX_BREAKS,&nBreak)) + errExit("create_break failed\n"); fprintf(outFile,"breaktable(%s) {\n",pname); for(n=0; nengLow >= pbci->engHigh) { - errExit("create_break: engLow >= engHigh"); - return (-1); + errExit("create_break: engLow >= engHigh"); + return (-1); } if ((pbci->engLow < pbci->tblEngFirst) - || (pbci->engHigh > pbci->tblEngLast)) { - errExit("create_break: engLow > engHigh"); - return (-1); + || (pbci->engHigh > pbci->tblEngLast)) { + errExit("create_break: engLow > engHigh"); + return (-1); } if (pbci->tblEngDelta <= 0.0) { - errExit("create_break: tblEngDelta <= 0.0"); - return (-1); + errExit("create_break: tblEngDelta <= 0.0"); + return (-1); } if (ntable < 3) { - errExit("raw data must have at least 3 elements"); - return (-1); + errExit("raw data must have at least 3 elements"); + return (-1); } /*************************************************************************** - Convert Table to raw values + Convert Table to raw values * * raw and table values are assumed to be related by an equation of the form: * @@ -296,23 +296,23 @@ static int create_break( struct brkCreateInfo *pbci, brkInt *pabrkInt, ilow = (pbci->engLow - pbci->tblEngFirst) / (pbci->tblEngDelta); i = (int) ilow; if (i >= ntable - 1) - i = ntable - 2; + i = ntable - 2; tbllow = table[i] + (table[i + 1] - table[i]) * (ilow - (double) i); /* Find engHigh in Table and then compute tblHigh */ ihigh = (pbci->engHigh - pbci->tblEngFirst) / (pbci->tblEngDelta); i = (int) ihigh; if (i >= ntable - 1) - i = ntable - 2; + i = ntable - 2; tblhigh = table[i] + (table[i + 1] - table[i]) * (ihigh - (double) i); /* compute slope and offset */ slope = (pbci->rawHigh - pbci->rawLow) / (tblhigh - tbllow); offset = pbci->rawHigh - slope * tblhigh; /* convert table to raw units */ for (i = 0; i < ntable; i++) - table[i] = table[i] * slope + offset; + table[i] = table[i] * slope + offset; /***************************************************************************** - * Now create break point table + * Now create break point table * * The algorithm does the following: * @@ -320,11 +320,11 @@ static int create_break( struct brkCreateInfo *pbci, brkInt *pabrkInt, * * 1) Use a relatively large portion of the remaining table as an interval * 2) It attempts to use the entire interval as a breakpoint interval - * Success is determined by the following algorithm: - * a) compute the slope using the entire interval + * Success is determined by the following algorithm: + * a) compute the slope using the entire interval * b) for each table entry in the interval determine the eng value - * using the slope just determined. - * c) compare the computed value with eng value associated with table + * using the slope just determined. + * c) compare the computed value with eng value associated with table * d) if all table entries are within the accuracy desired then success. * 3) If successful then attempt to expand the interval and try again. * Note that it is expanded by up to 1/10 of the table size. @@ -337,7 +337,7 @@ static int create_break( struct brkCreateInfo *pbci, brkInt *pabrkInt, /* Must start with table entry corresponding to engLow; */ i = (int) ilow; if (i >= ntable - 1) - i = ntable - 2; + i = ntable - 2; rawBeg = table[i] + (table[i + 1] - table[i]) * (ilow - (double) i); engBeg = pbci->engLow; ibeg = (int) (ilow); /* Make sure that ibeg > ilow */ @@ -349,77 +349,77 @@ static int create_break( struct brkCreateInfo *pbci, brkInt *pabrkInt, pbrkInt->eng = engBeg; /* determine next breakpoint interval */ while ((engBeg <= pbci->engHigh) && (ibeg < ntable - 1)) { - /* determine next interval to try. Up to 1/10 full range */ - rawEnd = rawBeg; - engEnd = engBeg; - iend = ibeg; - inc = (int) ((ihigh - ilow) / 10.0); - if (inc < 1) - inc = 1; - valid = TRUE; - /* keep trying intervals until cant do better */ - expanding = TRUE; /* originally we are trying larger and larger - * intervals */ - while (valid) { - imax = iend + inc; - if (imax >= ntable) { - /* don't go past end of table */ - imax = ntable - 1; - inc = ntable - iend - 1; - expanding = FALSE; - } - if (imax > (int) (ihigh + 1.0)) { /* Don't go to far past - * engHigh */ - imax = (int) (ihigh + 1.0); - inc = (int) (ihigh + 1.0) - iend; - expanding = FALSE; - } - if (imax <= ibeg) - break; /* failure */ - rawEnd = table[imax]; - engEnd = pbci->tblEngFirst + (double) imax *(pbci->tblEngDelta); - slope = (engEnd - engBeg) / (rawEnd - rawBeg); - all_ok = TRUE; - for (i = ibeg + 1; i <= imax; i++) { - engCalc = engBeg + slope * (table[i] - rawBeg); - engActual = pbci->tblEngFirst + ((double) i) * (pbci->tblEngDelta); - error = engCalc - engActual; - if (error < 0.0) - error = -error; - if (error >= pbci->accuracy) { - /* we will be trying smaller intervals */ - expanding = FALSE; - /* just decrease inc and let while(valid) try again */ - inc--; - all_ok = FALSE; - break; - } - } /* end for */ - if (all_ok) { - iend = imax; - /* if not expanding we found interval */ - if (!expanding) - break; - /* will automatically try larger interval */ - } - } /* end while(valid) */ - /* either we failed or optimal interval has been found */ - if ((iend <= ibeg) && (iend < (int) ihigh)) { - errExit("Could not meet accuracy criteria"); - return (-1); - } - pbrkInt->slope = slope; - /* get ready for next breakpoint interval */ - if (n++ >= max_breaks) { - errExit("Break point table too large"); - return (-1); - } - ibeg = iend; - pbrkInt++; - rawBeg = rawEnd; - engBeg = engEnd; - pbrkInt->raw = rawBeg; - pbrkInt->eng = engBeg + (pbrkInt->raw - rawBeg) * slope; + /* determine next interval to try. Up to 1/10 full range */ + rawEnd = rawBeg; + engEnd = engBeg; + iend = ibeg; + inc = (int) ((ihigh - ilow) / 10.0); + if (inc < 1) + inc = 1; + valid = TRUE; + /* keep trying intervals until cant do better */ + expanding = TRUE; /* originally we are trying larger and larger + * intervals */ + while (valid) { + imax = iend + inc; + if (imax >= ntable) { + /* don't go past end of table */ + imax = ntable - 1; + inc = ntable - iend - 1; + expanding = FALSE; + } + if (imax > (int) (ihigh + 1.0)) { /* Don't go to far past + * engHigh */ + imax = (int) (ihigh + 1.0); + inc = (int) (ihigh + 1.0) - iend; + expanding = FALSE; + } + if (imax <= ibeg) + break; /* failure */ + rawEnd = table[imax]; + engEnd = pbci->tblEngFirst + (double) imax *(pbci->tblEngDelta); + slope = (engEnd - engBeg) / (rawEnd - rawBeg); + all_ok = TRUE; + for (i = ibeg + 1; i <= imax; i++) { + engCalc = engBeg + slope * (table[i] - rawBeg); + engActual = pbci->tblEngFirst + ((double) i) * (pbci->tblEngDelta); + error = engCalc - engActual; + if (error < 0.0) + error = -error; + if (error >= pbci->accuracy) { + /* we will be trying smaller intervals */ + expanding = FALSE; + /* just decrease inc and let while(valid) try again */ + inc--; + all_ok = FALSE; + break; + } + } /* end for */ + if (all_ok) { + iend = imax; + /* if not expanding we found interval */ + if (!expanding) + break; + /* will automatically try larger interval */ + } + } /* end while(valid) */ + /* either we failed or optimal interval has been found */ + if ((iend <= ibeg) && (iend < (int) ihigh)) { + errExit("Could not meet accuracy criteria"); + return (-1); + } + pbrkInt->slope = slope; + /* get ready for next breakpoint interval */ + if (n++ >= max_breaks) { + errExit("Break point table too large"); + return (-1); + } + ibeg = iend; + pbrkInt++; + rawBeg = rawEnd; + engBeg = engEnd; + pbrkInt->raw = rawBeg; + pbrkInt->eng = engBeg + (pbrkInt->raw - rawBeg) * slope; } pbrkInt->slope = 0.0; *n_breaks = n; diff --git a/modules/database/src/ioc/db/callback.c b/modules/database/src/ioc/db/callback.c index c2272a4f4..30ceb118c 100644 --- a/modules/database/src/ioc/db/callback.c +++ b/modules/database/src/ioc/db/callback.c @@ -9,10 +9,10 @@ \*************************************************************************/ /* callback.c */ -/* general purpose callback tasks */ +/* general purpose callback tasks */ /* * Original Author: Marty Kraimer - * Date: 07-18-91 + * Date: 07-18-91 */ #include diff --git a/modules/database/src/ioc/db/callback.h b/modules/database/src/ioc/db/callback.h index a77a888f9..c86a9a840 100644 --- a/modules/database/src/ioc/db/callback.h +++ b/modules/database/src/ioc/db/callback.h @@ -5,13 +5,13 @@ * Operator of Los Alamos National Laboratory. * Copyright (c) 2013 ITER Organization. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* includes for general purpose callback tasks */ +/* includes for general purpose callback tasks */ /* * Original Author: Marty Kraimer - * Date: 07-18-91 + * Date: 07-18-91 */ #ifndef INCcallbackh @@ -27,9 +27,9 @@ extern "C" { * WINDOWS also has a "CALLBACK" type def */ #if defined(_WIN32) && !defined(EPICS_NO_CALLBACK) -# ifdef CALLBACK -# undef CALLBACK -# endif /*CALLBACK*/ +# ifdef CALLBACK +# undef CALLBACK +# endif /*CALLBACK*/ #endif /*_WIN32*/ #define NUM_CALLBACK_PRIORITIES 3 @@ -38,9 +38,9 @@ extern "C" { #define priorityHigh 2 typedef struct callbackPvt { - void (*callback)(struct callbackPvt*); - int priority; - void *user; /*for use by callback user*/ + void (*callback)(struct callbackPvt*); + int priority; + void *user; /*for use by callback user*/ void *timer; /*for use by callback itself*/ }epicsCallback; diff --git a/modules/database/src/ioc/db/cvtBpt.c b/modules/database/src/ioc/db/cvtBpt.c index 2689483ee..54c9b71ae 100644 --- a/modules/database/src/ioc/db/cvtBpt.c +++ b/modules/database/src/ioc/db/cvtBpt.c @@ -5,14 +5,14 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ - + /* cvtBpt.c - Convert using breakpoint table * * Author: Marty Kraimer * Date: 04OCT95 - * This is adaptation of old bldCvtTable + * This is adaptation of old bldCvtTable */ #include "epicsPrint.h" @@ -24,179 +24,179 @@ #include "dbStaticLib.h" static brkTable *findBrkTable(short linr) -{ - dbMenu *pdbMenu; +{ + dbMenu *pdbMenu; pdbMenu = dbFindMenu(pdbbase,"menuConvert"); if (!pdbMenu) { - epicsPrintf("findBrkTable: menuConvert not loaded!\n"); - return NULL; + epicsPrintf("findBrkTable: menuConvert not loaded!\n"); + return NULL; } if (linr < 0 || linr >= pdbMenu->nChoice) { - epicsPrintf("findBrkTable: linr=%d but menuConvert only has %d choices\n", - linr,pdbMenu->nChoice); - return NULL; + epicsPrintf("findBrkTable: linr=%d but menuConvert only has %d choices\n", + linr,pdbMenu->nChoice); + return NULL; } return dbFindBrkTable(pdbbase,pdbMenu->papChoiceValue[linr]); } /* Used by both ao and ai record types */ long cvtRawToEngBpt(double *pval, short linr, short init, - void **ppbrk, short *plbrk) + void **ppbrk, short *plbrk) { - double val = *pval; - long status = 0; - brkTable *pbrkTable; - brkInt *pInt, *nInt; - short lbrk; - int number; + double val = *pval; + long status = 0; + brkTable *pbrkTable; + brkInt *pInt, *nInt; + short lbrk; + int number; if (linr < 2) - return -1; + return -1; if (init || *ppbrk == NULL) { - pbrkTable = findBrkTable(linr); - if (!pbrkTable) - return S_dbLib_badField; - - *ppbrk = (void *)pbrkTable; - *plbrk = 0; + pbrkTable = findBrkTable(linr); + if (!pbrkTable) + return S_dbLib_badField; + + *ppbrk = (void *)pbrkTable; + *plbrk = 0; } else - pbrkTable = (brkTable *)*ppbrk; - + pbrkTable = (brkTable *)*ppbrk; + number = pbrkTable->number; lbrk = *plbrk; - + /* Limit index to the size of the table */ if (lbrk < 0) - lbrk = 0; + lbrk = 0; else if (lbrk > number-2) - lbrk = number-2; - + lbrk = number-2; + pInt = & pbrkTable->paBrkInt[lbrk]; nInt = pInt + 1; - + if (nInt->raw > pInt->raw) { - /* raw values increase down the table */ - while (val > nInt->raw) { - lbrk++; - pInt = nInt++; - if (lbrk > number-2) { - status = 1; - break; - } - } - while (val < pInt->raw) { - if (lbrk <= 0) { - status = 1; - break; - } - lbrk--; - nInt = pInt--; - } + /* raw values increase down the table */ + while (val > nInt->raw) { + lbrk++; + pInt = nInt++; + if (lbrk > number-2) { + status = 1; + break; + } + } + while (val < pInt->raw) { + if (lbrk <= 0) { + status = 1; + break; + } + lbrk--; + nInt = pInt--; + } } else { - /* raw values decrease down the table */ - while (val <= nInt->raw) { - lbrk++; - pInt = nInt++; - if (lbrk > number-2) { - status = 1; - break; - } - } - while(val > pInt->raw) { - if (lbrk <= 0) { - status = 1; - break; - } - lbrk--; - nInt = pInt--; - } + /* raw values decrease down the table */ + while (val <= nInt->raw) { + lbrk++; + pInt = nInt++; + if (lbrk > number-2) { + status = 1; + break; + } + } + while(val > pInt->raw) { + if (lbrk <= 0) { + status = 1; + break; + } + lbrk--; + nInt = pInt--; + } } - + *plbrk = lbrk; *pval = pInt->eng + (val - pInt->raw) * pInt->slope; - + return status; } /* Used by the ao record type */ long cvtEngToRawBpt(double *pval, short linr, short init, - void **ppbrk, short *plbrk) + void **ppbrk, short *plbrk) { - double val = *pval; - long status = 0; - brkTable *pbrkTable; - brkInt *pInt, *nInt; - short lbrk; - int number; + double val = *pval; + long status = 0; + brkTable *pbrkTable; + brkInt *pInt, *nInt; + short lbrk; + int number; if (linr < 2) - return -1; - + return -1; + if (init || *ppbrk == NULL) { /*must find breakpoint table*/ - pbrkTable = findBrkTable(linr); - if (!pbrkTable) - return S_dbLib_badField; - - *ppbrk = (void *)pbrkTable; - /* start at the beginning */ - *plbrk = 0; + pbrkTable = findBrkTable(linr); + if (!pbrkTable) + return S_dbLib_badField; + + *ppbrk = (void *)pbrkTable; + /* start at the beginning */ + *plbrk = 0; } else - pbrkTable = (brkTable *)*ppbrk; - + pbrkTable = (brkTable *)*ppbrk; + number = pbrkTable->number; lbrk = *plbrk; - + /* Limit index to the size of the table */ if (lbrk < 0) - lbrk = 0; + lbrk = 0; else if (lbrk > number-2) - lbrk = number-2; - + lbrk = number-2; + pInt = & pbrkTable->paBrkInt[lbrk]; nInt = pInt + 1; - + if (nInt->eng > pInt->eng) { - /* eng values increase down the table */ - while (val > nInt->eng) { - lbrk++; - pInt = nInt++; - if (lbrk > number-2) { - status = 1; - break; - } - } - while (val < pInt->eng) { - if (lbrk <= 0) { - status = 1; - break; - } - lbrk--; - nInt = pInt--; - } + /* eng values increase down the table */ + while (val > nInt->eng) { + lbrk++; + pInt = nInt++; + if (lbrk > number-2) { + status = 1; + break; + } + } + while (val < pInt->eng) { + if (lbrk <= 0) { + status = 1; + break; + } + lbrk--; + nInt = pInt--; + } } else { - /* eng values decrease down the table */ - while (val <= nInt->eng) { - lbrk++; - pInt = nInt++; - if (lbrk > number-2) { - status = 1; - break; - } - } - while (val > pInt->eng) { - if (lbrk <= 0) { - status = 1; - break; - } - lbrk--; - nInt = pInt--; - } + /* eng values decrease down the table */ + while (val <= nInt->eng) { + lbrk++; + pInt = nInt++; + if (lbrk > number-2) { + status = 1; + break; + } + } + while (val > pInt->eng) { + if (lbrk <= 0) { + status = 1; + break; + } + lbrk--; + nInt = pInt--; + } } - + *plbrk = lbrk; *pval = pInt->raw + (val - pInt->eng) / pInt->slope; - + return status; } diff --git a/modules/database/src/ioc/db/dbAccess.c b/modules/database/src/ioc/db/dbAccess.c index 799b6a79f..40d522b94 100644 --- a/modules/database/src/ioc/db/dbAccess.c +++ b/modules/database/src/ioc/db/dbAccess.c @@ -111,176 +111,176 @@ void dbSpcAsRegisterCallback(SPC_ASCALLBACK func) long dbPutSpecial(DBADDR *paddr,int pass) { - long int (*pspecial)()=NULL; + long int (*pspecial)()=NULL; rset *prset; - dbCommon *precord = paddr->precord; - long status=0; - long special=paddr->special; + dbCommon *precord = paddr->precord; + long status=0; + long special=paddr->special; prset = dbGetRset(paddr); if(special<100) { /*global processing*/ - if((special==SPC_NOMOD) && (pass==0)) { - status = S_db_noMod; - recGblDbaddrError(status,paddr,"dbPut"); - return(status); - }else if(special==SPC_SCAN){ - if(pass==0) - scanDelete(precord); - else - scanAdd(precord); - }else if((special==SPC_AS) && (pass==1)) { + if((special==SPC_NOMOD) && (pass==0)) { + status = S_db_noMod; + recGblDbaddrError(status,paddr,"dbPut"); + return(status); + }else if(special==SPC_SCAN){ + if(pass==0) + scanDelete(precord); + else + scanAdd(precord); + }else if((special==SPC_AS) && (pass==1)) { if(spcAsCallback) (*spcAsCallback)(precord); - } + } }else { - if( prset && (pspecial = (prset->special))) { - status=(*pspecial)(paddr,pass); - if(status) return(status); - } else if(pass==0){ - recGblRecSupError(S_db_noSupport,paddr,"dbPut", "special"); - return(S_db_noSupport); - } + if( prset && (pspecial = (prset->special))) { + status=(*pspecial)(paddr,pass); + if(status) return(status); + } else if(pass==0){ + recGblRecSupError(S_db_noSupport,paddr,"dbPut", "special"); + return(S_db_noSupport); + } } return(0); } static void get_enum_strs(DBADDR *paddr, char **ppbuffer, - rset *prset,long *options) + rset *prset,long *options) { - short field_type=paddr->field_type; - dbFldDes *pdbFldDes = paddr->pfldDes; - dbMenu *pdbMenu; - dbDeviceMenu *pdbDeviceMenu; - char **papChoice; - unsigned long no_str; - char *ptemp; - struct dbr_enumStrs *pdbr_enumStrs=(struct dbr_enumStrs*)(*ppbuffer); + short field_type=paddr->field_type; + dbFldDes *pdbFldDes = paddr->pfldDes; + dbMenu *pdbMenu; + dbDeviceMenu *pdbDeviceMenu; + char **papChoice; + unsigned long no_str; + char *ptemp; + struct dbr_enumStrs *pdbr_enumStrs=(struct dbr_enumStrs*)(*ppbuffer); unsigned int i; - memset(pdbr_enumStrs,'\0',dbr_enumStrs_size); - switch(field_type) { - case DBF_ENUM: - if( prset && prset->get_enum_strs ) { - (*prset->get_enum_strs)(paddr,pdbr_enumStrs); - } else { - *options = (*options)^DBR_ENUM_STRS;/*Turn off option*/ - } - break; - case DBF_MENU: - pdbMenu = (dbMenu *)pdbFldDes->ftPvt; - no_str = pdbMenu->nChoice; - papChoice= pdbMenu->papChoiceValue; - goto choice_common; - case DBF_DEVICE: - pdbDeviceMenu = (dbDeviceMenu *)pdbFldDes->ftPvt; + memset(pdbr_enumStrs,'\0',dbr_enumStrs_size); + switch(field_type) { + case DBF_ENUM: + if( prset && prset->get_enum_strs ) { + (*prset->get_enum_strs)(paddr,pdbr_enumStrs); + } else { + *options = (*options)^DBR_ENUM_STRS;/*Turn off option*/ + } + break; + case DBF_MENU: + pdbMenu = (dbMenu *)pdbFldDes->ftPvt; + no_str = pdbMenu->nChoice; + papChoice= pdbMenu->papChoiceValue; + goto choice_common; + case DBF_DEVICE: + pdbDeviceMenu = (dbDeviceMenu *)pdbFldDes->ftPvt; if(!pdbDeviceMenu) { *options = (*options)^DBR_ENUM_STRS;/*Turn off option*/ break; } - no_str = pdbDeviceMenu->nChoice; - papChoice = pdbDeviceMenu->papChoice; - goto choice_common; + no_str = pdbDeviceMenu->nChoice; + papChoice = pdbDeviceMenu->papChoice; + goto choice_common; choice_common: - i = sizeof(pdbr_enumStrs->strs)/ - sizeof(pdbr_enumStrs->strs[0]); - if(ino_str = no_str; - ptemp = &(pdbr_enumStrs->strs[0][0]); - for (i=0; istrs[0])); - *(ptemp+sizeof(pdbr_enumStrs->strs[0])-1) = 0; - } - ptemp += sizeof(pdbr_enumStrs->strs[0]); - } - break; - default: - *options = (*options)^DBR_ENUM_STRS;/*Turn off option*/ - break; - } - *ppbuffer = ((char *)*ppbuffer) + dbr_enumStrs_size; - return; + i = sizeof(pdbr_enumStrs->strs)/ + sizeof(pdbr_enumStrs->strs[0]); + if(ino_str = no_str; + ptemp = &(pdbr_enumStrs->strs[0][0]); + for (i=0; istrs[0])); + *(ptemp+sizeof(pdbr_enumStrs->strs[0])-1) = 0; + } + ptemp += sizeof(pdbr_enumStrs->strs[0]); + } + break; + default: + *options = (*options)^DBR_ENUM_STRS;/*Turn off option*/ + break; + } + *ppbuffer = ((char *)*ppbuffer) + dbr_enumStrs_size; + return; } static void get_graphics(DBADDR *paddr, char **ppbuffer, - rset *prset,long *options) + rset *prset,long *options) { - struct dbr_grDouble grd; - int got_data=FALSE; + struct dbr_grDouble grd; + int got_data=FALSE; grd.upper_disp_limit = grd.lower_disp_limit = 0.0; - if( prset && prset->get_graphic_double ) { - (*prset->get_graphic_double)(paddr,&grd); - got_data=TRUE; - } - if( (*options) & (DBR_GR_LONG) ) { - char *pbuffer=*ppbuffer; + if( prset && prset->get_graphic_double ) { + (*prset->get_graphic_double)(paddr,&grd); + got_data=TRUE; + } + if( (*options) & (DBR_GR_LONG) ) { + char *pbuffer=*ppbuffer; - if(got_data) { - struct dbr_grLong *pgr=(struct dbr_grLong*)pbuffer; - pgr->upper_disp_limit = (epicsInt32)grd.upper_disp_limit; - pgr->lower_disp_limit = (epicsInt32)grd.lower_disp_limit; - } else { - memset(pbuffer,'\0',dbr_grLong_size); - *options = (*options) ^ DBR_GR_LONG; /*Turn off option*/ - } - *ppbuffer = ((char *)*ppbuffer) + dbr_grLong_size; - } - if( (*options) & (DBR_GR_DOUBLE) ) { - char *pbuffer=*ppbuffer; + if(got_data) { + struct dbr_grLong *pgr=(struct dbr_grLong*)pbuffer; + pgr->upper_disp_limit = (epicsInt32)grd.upper_disp_limit; + pgr->lower_disp_limit = (epicsInt32)grd.lower_disp_limit; + } else { + memset(pbuffer,'\0',dbr_grLong_size); + *options = (*options) ^ DBR_GR_LONG; /*Turn off option*/ + } + *ppbuffer = ((char *)*ppbuffer) + dbr_grLong_size; + } + if( (*options) & (DBR_GR_DOUBLE) ) { + char *pbuffer=*ppbuffer; - if(got_data) { - struct dbr_grDouble *pgr=(struct dbr_grDouble*)pbuffer; - pgr->upper_disp_limit = grd.upper_disp_limit; - pgr->lower_disp_limit = grd.lower_disp_limit; - } else { - memset(pbuffer,'\0',dbr_grDouble_size); - *options = (*options) ^ DBR_GR_DOUBLE; /*Turn off option*/ - } - *ppbuffer = ((char *)*ppbuffer) + dbr_grDouble_size; - } - return; + if(got_data) { + struct dbr_grDouble *pgr=(struct dbr_grDouble*)pbuffer; + pgr->upper_disp_limit = grd.upper_disp_limit; + pgr->lower_disp_limit = grd.lower_disp_limit; + } else { + memset(pbuffer,'\0',dbr_grDouble_size); + *options = (*options) ^ DBR_GR_DOUBLE; /*Turn off option*/ + } + *ppbuffer = ((char *)*ppbuffer) + dbr_grDouble_size; + } + return; } static void get_control(DBADDR *paddr, char **ppbuffer, - rset *prset,long *options) + rset *prset,long *options) { - struct dbr_ctrlDouble ctrld; - int got_data=FALSE; + struct dbr_ctrlDouble ctrld; + int got_data=FALSE; ctrld.upper_ctrl_limit = ctrld.lower_ctrl_limit = 0.0; - if( prset && prset->get_control_double ) { - (*prset->get_control_double)(paddr,&ctrld); - got_data=TRUE; - } - if( (*options) & (DBR_CTRL_LONG) ) { - char *pbuffer=*ppbuffer; + if( prset && prset->get_control_double ) { + (*prset->get_control_double)(paddr,&ctrld); + got_data=TRUE; + } + if( (*options) & (DBR_CTRL_LONG) ) { + char *pbuffer=*ppbuffer; - if(got_data) { - struct dbr_ctrlLong *pctrl=(struct dbr_ctrlLong*)pbuffer; - pctrl->upper_ctrl_limit = (epicsInt32)ctrld.upper_ctrl_limit; - pctrl->lower_ctrl_limit = (epicsInt32)ctrld.lower_ctrl_limit; - } else { - memset(pbuffer,'\0',dbr_ctrlLong_size); - *options = (*options) ^ DBR_CTRL_LONG; /*Turn off option*/ - } - *ppbuffer = ((char *)*ppbuffer) + dbr_ctrlLong_size; - } - if( (*options) & (DBR_CTRL_DOUBLE) ) { - char *pbuffer=*ppbuffer; + if(got_data) { + struct dbr_ctrlLong *pctrl=(struct dbr_ctrlLong*)pbuffer; + pctrl->upper_ctrl_limit = (epicsInt32)ctrld.upper_ctrl_limit; + pctrl->lower_ctrl_limit = (epicsInt32)ctrld.lower_ctrl_limit; + } else { + memset(pbuffer,'\0',dbr_ctrlLong_size); + *options = (*options) ^ DBR_CTRL_LONG; /*Turn off option*/ + } + *ppbuffer = ((char *)*ppbuffer) + dbr_ctrlLong_size; + } + if( (*options) & (DBR_CTRL_DOUBLE) ) { + char *pbuffer=*ppbuffer; - if(got_data) { - struct dbr_ctrlDouble *pctrl=(struct dbr_ctrlDouble*)pbuffer; - pctrl->upper_ctrl_limit = ctrld.upper_ctrl_limit; - pctrl->lower_ctrl_limit = ctrld.lower_ctrl_limit; - } else { - memset(pbuffer,'\0',dbr_ctrlDouble_size); - *options = (*options) ^ DBR_CTRL_DOUBLE; /*Turn off option*/ - } - *ppbuffer = ((char *)*ppbuffer) + dbr_ctrlDouble_size; - } - return; + if(got_data) { + struct dbr_ctrlDouble *pctrl=(struct dbr_ctrlDouble*)pbuffer; + pctrl->upper_ctrl_limit = ctrld.upper_ctrl_limit; + pctrl->lower_ctrl_limit = ctrld.lower_ctrl_limit; + } else { + memset(pbuffer,'\0',dbr_ctrlDouble_size); + *options = (*options) ^ DBR_CTRL_DOUBLE; /*Turn off option*/ + } + *ppbuffer = ((char *)*ppbuffer) + dbr_ctrlDouble_size; + } + return; } static void get_alarm(DBADDR *paddr, char **ppbuffer, @@ -332,21 +332,21 @@ static void get_alarm(DBADDR *paddr, char **ppbuffer, static void getOptions(DBADDR *paddr, char **poriginal, long *options, void *pflin) { - db_field_log *pfl= (db_field_log *)pflin; - rset *prset; - short field_type; - dbCommon *pcommon; - char *pbuffer = *poriginal; + db_field_log *pfl= (db_field_log *)pflin; + rset *prset; + short field_type; + dbCommon *pcommon; + char *pbuffer = *poriginal; if (!pfl || pfl->type == dbfl_type_rec) field_type = paddr->field_type; else field_type = pfl->field_type; - prset=dbGetRset(paddr); - /* Process options */ - pcommon = paddr->precord; - if( (*options) & DBR_STATUS ) { - unsigned short *pushort = (unsigned short *)pbuffer; + prset=dbGetRset(paddr); + /* Process options */ + pcommon = paddr->precord; + if( (*options) & DBR_STATUS ) { + unsigned short *pushort = (unsigned short *)pbuffer; if (!pfl || pfl->type == dbfl_type_rec) { *pushort++ = pcommon->stat; @@ -355,32 +355,32 @@ static void getOptions(DBADDR *paddr, char **poriginal, long *options, *pushort++ = pfl->stat; *pushort++ = pfl->sevr; } - *pushort++ = pcommon->acks; - *pushort++ = pcommon->ackt; - pbuffer = (char *)pushort; - } - if( (*options) & DBR_UNITS ) { - memset(pbuffer,'\0',dbr_units_size); - if( prset && prset->get_units ){ - (*prset->get_units)(paddr, pbuffer); - pbuffer[DB_UNITS_SIZE-1] = '\0'; - } else { - *options ^= DBR_UNITS; /*Turn off DBR_UNITS*/ - } - pbuffer += dbr_units_size; - } - if( (*options) & DBR_PRECISION ) { - memset(pbuffer, '\0', dbr_precision_size); - if((field_type==DBF_FLOAT || field_type==DBF_DOUBLE) - && prset && prset->get_precision ){ + *pushort++ = pcommon->acks; + *pushort++ = pcommon->ackt; + pbuffer = (char *)pushort; + } + if( (*options) & DBR_UNITS ) { + memset(pbuffer,'\0',dbr_units_size); + if( prset && prset->get_units ){ + (*prset->get_units)(paddr, pbuffer); + pbuffer[DB_UNITS_SIZE-1] = '\0'; + } else { + *options ^= DBR_UNITS; /*Turn off DBR_UNITS*/ + } + pbuffer += dbr_units_size; + } + if( (*options) & DBR_PRECISION ) { + memset(pbuffer, '\0', dbr_precision_size); + if((field_type==DBF_FLOAT || field_type==DBF_DOUBLE) + && prset && prset->get_precision ){ (*prset->get_precision)(paddr,(long *)pbuffer); - } else { - *options ^= DBR_PRECISION; /*Turn off DBR_PRECISION*/ - } - pbuffer += dbr_precision_size; - } - if( (*options) & DBR_TIME ) { - epicsUInt32 *ptime = (epicsUInt32 *)pbuffer; + } else { + *options ^= DBR_PRECISION; /*Turn off DBR_PRECISION*/ + } + pbuffer += dbr_precision_size; + } + if( (*options) & DBR_TIME ) { + epicsUInt32 *ptime = (epicsUInt32 *)pbuffer; if (!pfl || pfl->type == dbfl_type_rec) { *ptime++ = pcommon->time.secPastEpoch; @@ -388,26 +388,26 @@ static void getOptions(DBADDR *paddr, char **poriginal, long *options, } else { *ptime++ = pfl->time.secPastEpoch; *ptime++ = pfl->time.nsec; - } - pbuffer = (char *)ptime; - } - if( (*options) & DBR_ENUM_STRS ) - get_enum_strs(paddr, &pbuffer, prset, options); - if( (*options) & (DBR_GR_LONG|DBR_GR_DOUBLE )) - get_graphics(paddr, &pbuffer, prset, options); - if((*options) & (DBR_CTRL_LONG | DBR_CTRL_DOUBLE )) - get_control(paddr, &pbuffer, prset, options); - if((*options) & (DBR_AL_LONG | DBR_AL_DOUBLE )) - get_alarm(paddr, &pbuffer, prset, options); - *poriginal = pbuffer; + } + pbuffer = (char *)ptime; + } + if( (*options) & DBR_ENUM_STRS ) + get_enum_strs(paddr, &pbuffer, prset, options); + if( (*options) & (DBR_GR_LONG|DBR_GR_DOUBLE )) + get_graphics(paddr, &pbuffer, prset, options); + if((*options) & (DBR_CTRL_LONG | DBR_CTRL_DOUBLE )) + get_control(paddr, &pbuffer, prset, options); + if((*options) & (DBR_AL_LONG | DBR_AL_DOUBLE )) + get_alarm(paddr, &pbuffer, prset, options); + *poriginal = pbuffer; } rset * dbGetRset(const struct dbAddr *paddr) { - struct dbFldDes *pfldDes = paddr->pfldDes; + struct dbFldDes *pfldDes = paddr->pfldDes; - if(!pfldDes) return(0); - return(pfldDes->pdbRecordType->prset); + if(!pfldDes) return(0); + return(pfldDes->pdbRecordType->prset); } long dbPutAttribute( @@ -466,7 +466,7 @@ long dbProcess(dbCommon *precord) char context[40] = ""; long status = 0; int *ptrace; - int set_trace = FALSE; + int set_trace = FALSE; dbFldDes *pdbFldDes; int callNotifyCompletion = FALSE; @@ -1220,11 +1220,11 @@ cleanup: long dbPutField(DBADDR *paddr, short dbrType, const void *pbuffer, long nRequest) { - long status = 0; - long special = paddr->special; - dbFldDes *pfldDes = paddr->pfldDes; - dbCommon *precord = paddr->precord; - short dbfType = paddr->field_type; + long status = 0; + long special = paddr->special; + dbFldDes *pfldDes = paddr->pfldDes; + dbCommon *precord = paddr->precord; + short dbfType = paddr->field_type; if (special == SPC_ATTRIBUTE) return S_db_noMod; diff --git a/modules/database/src/ioc/db/dbAccess.h b/modules/database/src/ioc/db/dbAccess.h index 96246b302..fa7c4a7fa 100644 --- a/modules/database/src/ioc/db/dbAccess.h +++ b/modules/database/src/ioc/db/dbAccess.h @@ -4,9 +4,9 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* dbAccess.h */ +/* dbAccess.h */ #ifndef INCdbAccessh #define INCdbAccessh diff --git a/modules/database/src/ioc/db/dbAccessDefs.h b/modules/database/src/ioc/db/dbAccessDefs.h index 805dfd41f..5ccfa6314 100644 --- a/modules/database/src/ioc/db/dbAccessDefs.h +++ b/modules/database/src/ioc/db/dbAccessDefs.h @@ -6,7 +6,7 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* dbAccessDefs.h */ +/* dbAccessDefs.h */ #ifndef INCdbAccessDefsh #define INCdbAccessDefsh @@ -38,7 +38,7 @@ epicsShareExtern volatile int interruptAccept; epicsShareExtern int dbAccessDebugPUTF; /* The database field and request types are defined in dbFldTypes.h*/ -/* Data Base Request Options */ +/* Data Base Request Options */ #define DBR_STATUS 0x00000001 #define DBR_UNITS 0x00000002 #define DBR_PRECISION 0x00000004 @@ -57,9 +57,9 @@ epicsShareExtern int dbAccessDebugPUTF; * of 10 float values + DBR_STATUS and DBR_TIME options * * struct { - * DBRstatus - * DBRtime - * epicsFloat32 value[10] + * DBRstatus + * DBRtime + * epicsFloat32 value[10] * } buffer; * * IMPORTANT!! The DBRoptions must be given in the order that they @@ -74,9 +74,9 @@ epicsShareExtern int dbAccessDebugPUTF; * rtnval=dbGetField(paddr,DBR_FLOAT,&buffer,&options,&number_elements); * * When dbGetField returns: - * rtnval is error status (0 means success) - * options has a bit set for each option that was accepted - * number_elements is actual number of elements obtained + * rtnval is error status (0 means success) + * options has a bit set for each option that was accepted + * number_elements is actual number of elements obtained * * The individual items can be refered to by the expressions:: * @@ -90,9 +90,9 @@ epicsShareExtern int dbAccessDebugPUTF; * The following is also a valid declaration: * * typedef struct { - * DBRstatus - * DBRtime - * epicsFloat32 value[10] + * DBRstatus + * DBRtime + * epicsFloat32 value[10] * } MYBUFFER; * * With this definition you can give definitions such as the following: @@ -103,13 +103,13 @@ epicsShareExtern int dbAccessDebugPUTF; /* Macros for defining each option */ #define DBRstatus \ - epicsUInt16 status; /* alarm status */\ - epicsUInt16 severity; /* alarm severity*/\ - epicsUInt16 acks; /* alarm ack severity*/\ - epicsUInt16 ackt; /* Acknowledge transient alarms?*/ + epicsUInt16 status; /* alarm status */\ + epicsUInt16 severity; /* alarm severity*/\ + epicsUInt16 acks; /* alarm ack severity*/\ + epicsUInt16 ackt; /* Acknowledge transient alarms?*/ #define DB_UNITS_SIZE 16 #define DBRunits \ - char units[DB_UNITS_SIZE]; /* units */ + char units[DB_UNITS_SIZE]; /* units */ #define DBRprecision union { \ long dp; /* number of decimal places*/\ double unused; /* for alignment */\ @@ -119,11 +119,11 @@ epicsShareExtern int dbAccessDebugPUTF; * too late to change now. DBRprecision must be padded to * maintain 8-byte alignment. */ #define DBRtime \ - epicsTimeStamp time; /* time stamp*/ + epicsTimeStamp time; /* time stamp*/ #define DBRenumStrs \ - epicsUInt32 no_str; /* number of strings*/\ - epicsInt32 padenumStrs; /*padding to force 8 byte align*/\ - char strs[DB_MAX_CHOICES][MAX_STRING_SIZE]; /* string values */ + epicsUInt32 no_str; /* number of strings*/\ + epicsInt32 padenumStrs; /*padding to force 8 byte align*/\ + char strs[DB_MAX_CHOICES][MAX_STRING_SIZE]; /* string values */ #define DBRgrLong \ epicsInt32 upper_disp_limit; /*upper limit of graph*/\ epicsInt32 lower_disp_limit; /*lower limit of graph*/ @@ -175,23 +175,23 @@ struct dbr_alDouble {DBRalDouble}; #ifndef INCerrMdefh #include "errMdef.h" #endif -#define S_db_notFound (M_dbAccess| 1) /*Process Variable Not Found*/ -#define S_db_badDbrtype (M_dbAccess| 3) /*Illegal Database Request Type*/ -#define S_db_noMod (M_dbAccess| 5) /*Attempt to modify noMod field*/ -#define S_db_badLset (M_dbAccess| 7) /*Illegal Lock Set*/ -#define S_db_precision (M_dbAccess| 9) /*get precision failed */ -#define S_db_onlyOne (M_dbAccess|11) /*Only one element allowed*/ -#define S_db_badChoice (M_dbAccess|13) /*Illegal choice*/ -#define S_db_badField (M_dbAccess|15) /*Illegal field value*/ -#define S_db_lsetLogic (M_dbAccess|17) /*Logic error generating lock sets*/ +#define S_db_notFound (M_dbAccess| 1) /*Process Variable Not Found*/ +#define S_db_badDbrtype (M_dbAccess| 3) /*Illegal Database Request Type*/ +#define S_db_noMod (M_dbAccess| 5) /*Attempt to modify noMod field*/ +#define S_db_badLset (M_dbAccess| 7) /*Illegal Lock Set*/ +#define S_db_precision (M_dbAccess| 9) /*get precision failed */ +#define S_db_onlyOne (M_dbAccess|11) /*Only one element allowed*/ +#define S_db_badChoice (M_dbAccess|13) /*Illegal choice*/ +#define S_db_badField (M_dbAccess|15) /*Illegal field value*/ +#define S_db_lsetLogic (M_dbAccess|17) /*Logic error generating lock sets*/ #define S_db_noLSET (M_dbAccess|21) /*No link support table or entry*/ -#define S_db_noRSET (M_dbAccess|31) /*missing record support entry table*/ -#define S_db_noSupport (M_dbAccess|33) /*RSET or DSXT routine not defined*/ -#define S_db_BadSub (M_dbAccess|35) /*Subroutine not found*/ +#define S_db_noRSET (M_dbAccess|31) /*missing record support entry table*/ +#define S_db_noSupport (M_dbAccess|33) /*RSET or DSXT routine not defined*/ +#define S_db_BadSub (M_dbAccess|35) /*Subroutine not found*/ /*!!!! Do not change next line without changing src/rsrv/server.h!!!!!!!!*/ -#define S_db_Pending (M_dbAccess|37) /*Request is pending*/ +#define S_db_Pending (M_dbAccess|37) /*Request is pending*/ -#define S_db_Blocked (M_dbAccess|39) /*Request is Blocked*/ +#define S_db_Blocked (M_dbAccess|39) /*Request is Blocked*/ #define S_db_putDisabled (M_dbAccess|41) /*putFields are disabled*/ #define S_db_badHWaddr (M_dbAccess|43) /*Hardware link type not on INP/OUT*/ #define S_db_bkptSet (M_dbAccess|53) /*Breakpoint already set*/ diff --git a/modules/database/src/ioc/db/dbBkpt.c b/modules/database/src/ioc/db/dbBkpt.c index b3fdd2da4..e36f62abc 100644 --- a/modules/database/src/ioc/db/dbBkpt.c +++ b/modules/database/src/ioc/db/dbBkpt.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* dbBkpt.c */ /* @@ -89,7 +89,7 @@ static long FIND_CONT_NODE( * dbb() and dbd() add a breakpoint to a record or delete one * from a record. dbstat() prints out comprehensive breakpoint * status information. - * + * * Breakpoints may be set on a per lockset basis. When a * breakpoint is set in a lockset, a new task is created. A * separate task gets created for _every_ lockset containing @@ -201,7 +201,7 @@ static long FIND_CONT_NODE( struct LS_LIST **ppnode, struct dbCommon **pprecord) { - struct dbAddr addr; + struct dbAddr addr; struct LS_LIST *pnode; struct dbCommon *precord = NULL; long status = 0; @@ -211,7 +211,7 @@ static long FIND_CONT_NODE( * Search through stack, taking the first entry that * is currently stopped at a breakpoint. */ - pnode = (struct LS_LIST *) ellFirst(&lset_stack); + pnode = (struct LS_LIST *) ellFirst(&lset_stack); while (pnode != NULL) { if (pnode->precord != NULL) { precord = pnode->precord; @@ -219,7 +219,7 @@ static long FIND_CONT_NODE( } pnode = (struct LS_LIST *) ellNext((ELLNODE *)pnode); } - + if (pnode == NULL) { printf(" BKPT> No records are currently stopped\n"); return(S_db_notStopped); @@ -295,7 +295,7 @@ long dbb(const char *record_name) precord = addr.precord; if (precord->bkpt & BKPT_ON_MASK) { - printf(" BKPT> Breakpoint already set in this record\n"); + printf(" BKPT> Breakpoint already set in this record\n"); return(S_db_bkptSet); } @@ -354,13 +354,13 @@ long dbb(const char *record_name) epicsMutexUnlock(bkpt_stack_sem); return(1); } - pbl->precord = precord; + pbl->precord = precord; ellAdd(&pnode->bp_list, (ELLNODE *)pbl); /* * Turn on breakpoint field in record */ - precord->bkpt |= BKPT_ON_MASK; + precord->bkpt |= BKPT_ON_MASK; if (! pnode->taskid) { @@ -455,7 +455,7 @@ long dbd(const char *record_name) } if (pbl == NULL) { - printf(" BKPT> Logic Error in dbd()\n"); + printf(" BKPT> Logic Error in dbd()\n"); precord->bkpt &= BKPT_OFF_MASK; epicsMutexUnlock(bkpt_stack_sem); dbScanUnlock(precord); @@ -663,9 +663,9 @@ int dbBkpt(dbCommon *precord) /* * Take and give a semaphore to check for breakpoints - * every time a record is processed. Slow. Thank - * goodness breakpoint checking is turned off during - * normal operation. + * every time a record is processed. Slow. Thank + * goodness breakpoint checking is turned off during + * normal operation. */ epicsMutexMustLock(bkpt_stack_sem); FIND_LOCKSET(precord, pnode); @@ -696,7 +696,7 @@ int dbBkpt(dbCommon *precord) * is used to determine if the source of processing is the * continuation task or an external source. If it is an external * source, queue its execution, but dump out of dbProcess without - * calling record support. + * calling record support. */ if (pnode->taskid && (epicsThreadGetIdSelf() != pnode->taskid)) { /* CONTINUE TASK CANNOT ENTER HERE */ @@ -706,7 +706,7 @@ int dbBkpt(dbCommon *precord) * not already exist. */ FIND_QUEUE_ENTRY(&pnode->ep_queue, pqe, precord); - + if (pqe == NULL) { pqe = (struct EP_LIST *) malloc(sizeof(struct EP_LIST)); @@ -746,7 +746,7 @@ int dbBkpt(dbCommon *precord) /* * Release the semaphore, letting the continuation * task begin execution of the new entrypoint. - */ + */ epicsEventSignal(pnode->ex_sem); } return(1); @@ -903,7 +903,7 @@ long dbstat(void) pnode->l_num, pnode->precord->name, ellCount(&pnode->bp_list), pnode->taskid); /* for each entrypoint detected, print out entrypoint statistics */ - pqe = (struct EP_LIST *) ellFirst(&pnode->ep_queue); + pqe = (struct EP_LIST *) ellFirst(&pnode->ep_queue); while (pqe != NULL) { double diff = epicsTimeDiffInSeconds(&time,&pqe->time); if (diff) { diff --git a/modules/database/src/ioc/db/dbBkpt.h b/modules/database/src/ioc/db/dbBkpt.h index 7240b701c..ed2bc76be 100644 --- a/modules/database/src/ioc/db/dbBkpt.h +++ b/modules/database/src/ioc/db/dbBkpt.h @@ -5,9 +5,9 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* dbBkpt.h */ +/* dbBkpt.h */ /* * Author: Matthew Needes * Date: 8-30-93 @@ -32,7 +32,7 @@ extern "C" { struct BP_LIST { ELLNODE *next_list; - ELLNODE *prev_list; + ELLNODE *prev_list; struct dbCommon *precord; }; @@ -41,7 +41,7 @@ struct BP_LIST { * detected for a lockset. */ struct EP_LIST { - ELLNODE *next_list; + ELLNODE *next_list; ELLNODE *prev_list; struct dbCommon *entrypoint; /* pointer to entry point in lockset */ unsigned long count; /* number of times record processed */ diff --git a/modules/database/src/ioc/db/dbCAC.h b/modules/database/src/ioc/db/dbCAC.h index 2d97fac35..0dab81bef 100644 --- a/modules/database/src/ioc/db/dbCAC.h +++ b/modules/database/src/ioc/db/dbCAC.h @@ -8,9 +8,9 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ /* - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 * * NOTES: * 1) This interface is preliminary and will change in the future diff --git a/modules/database/src/ioc/db/dbCa.c b/modules/database/src/ioc/db/dbCa.c index 45e178cae..3403f2c8d 100644 --- a/modules/database/src/ioc/db/dbCa.c +++ b/modules/database/src/ioc/db/dbCa.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -641,7 +641,7 @@ static long getControlLimits(const struct link *plink, *low = pca->controlLimits[0]; *high = pca->controlLimits[1]; } - epicsMutexUnlock(pca->lock); + epicsMutexUnlock(pca->lock); return gotAttributes ? 0 : -1; } @@ -657,7 +657,7 @@ static long getGraphicLimits(const struct link *plink, *low = pca->displayLimits[0]; *high = pca->displayLimits[1]; } - epicsMutexUnlock(pca->lock); + epicsMutexUnlock(pca->lock); return gotAttributes ? 0 : -1; } @@ -687,7 +687,7 @@ static long getPrecision(const struct link *plink, short *precision) pcaGetCheck gotAttributes = pca->gotAttributes; if (gotAttributes) *precision = pca->precision; - epicsMutexUnlock(pca->lock); + epicsMutexUnlock(pca->lock); return gotAttributes ? 0 : -1; } @@ -890,8 +890,8 @@ static void eventCallback(struct event_handler_args arg) /* Disable the record scan if we also have a string monitor */ doScan = !(plink->value.pv_link.pvlMask & pvlOptInpString); /* fall through */ - case DBR_TIME_STRING: - case DBR_TIME_SHORT: + case DBR_TIME_STRING: + case DBR_TIME_SHORT: case DBR_TIME_FLOAT: case DBR_TIME_CHAR: case DBR_TIME_LONG: @@ -970,7 +970,7 @@ done: static void accessRightsCallback(struct access_rights_handler_args arg) { caLink *pca = (caLink *)ca_puser(arg.chid); - struct link *plink; + struct link *plink; struct pv_link *ppv_link; dbCommon *precord; diff --git a/modules/database/src/ioc/db/dbCaPvt.h b/modules/database/src/ioc/db/dbCaPvt.h index c6bdf359b..f8ea758cc 100644 --- a/modules/database/src/ioc/db/dbCaPvt.h +++ b/modules/database/src/ioc/db/dbCaPvt.h @@ -22,41 +22,41 @@ #include "link.h" /* link_action mask */ -#define CA_CLEAR_CHANNEL 0x1 -#define CA_CONNECT 0x2 -#define CA_WRITE_NATIVE 0x4 -#define CA_WRITE_STRING 0x8 -#define CA_MONITOR_NATIVE 0x10 -#define CA_MONITOR_STRING 0x20 -#define CA_GET_ATTRIBUTES 0x40 -#define CA_SYNC 0x1000 +#define CA_CLEAR_CHANNEL 0x1 +#define CA_CONNECT 0x2 +#define CA_WRITE_NATIVE 0x4 +#define CA_WRITE_STRING 0x8 +#define CA_MONITOR_NATIVE 0x10 +#define CA_MONITOR_STRING 0x20 +#define CA_GET_ATTRIBUTES 0x40 +#define CA_SYNC 0x1000 /* write type */ #define CA_PUT 0x1 #define CA_PUT_CALLBACK 0x2 typedef struct caLink { - ELLNODE node; - int refcount; - epicsMutexId lock; - struct link *plink; - char *pvname; - chid chid; - short link_action; + ELLNODE node; + int refcount; + epicsMutexId lock; + struct link *plink; + char *pvname; + chid chid; + short link_action; /* The following have new values after each data event*/ - epicsEnum16 sevr; - epicsEnum16 stat; - epicsTimeStamp timeStamp; + epicsEnum16 sevr; + epicsEnum16 stat; + epicsTimeStamp timeStamp; /* The following have values after connection*/ - short dbrType; + short dbrType; size_t elementSize; /* size of one element in pgetNative */ unsigned long nelements; /* PVs max array size */ unsigned long usedelements; /* currently used in pgetNative */ unsigned long putnelements; /* currently used in pputNative */ - char hasReadAccess; - char hasWriteAccess; + char hasReadAccess; + char hasWriteAccess; char isConnected; - char gotFirstConnection; + char gotFirstConnection; /* The following are for dbCaAddLinkCallback */ dbCaCallback connect; dbCaCallback monitor; @@ -67,7 +67,7 @@ typedef struct caLink void *putUserPvt; /* The following are for access to additional attributes*/ char gotAttributes; - dbCaCallback getAttributes; + dbCaCallback getAttributes; void *getAttributesPvt; /* The following have values after getAttribEventCallback*/ double controlLimits[2]; @@ -76,22 +76,22 @@ typedef struct caLink short precision; char units[MAX_UNITS_SIZE]; /* units of value */ /* The following are for handling data*/ - void *pgetNative; - char *pgetString; - void *pputNative; - char *pputString; - evid evidNative; - evid evidString; - char gotInNative; - char gotInString; - char gotOutNative; - char gotOutString; - char newOutNative; - char newOutString; + void *pgetNative; + char *pgetString; + void *pputNative; + char *pputString; + evid evidNative; + evid evidString; + char gotInNative; + char gotInString; + char gotOutNative; + char gotOutString; + char newOutNative; + char newOutString; unsigned char scanningOnce; /* The following are for dbcar*/ - unsigned long nDisconnect; - unsigned long nNoWrite; /*only modified by dbCaPutLink*/ + unsigned long nDisconnect; + unsigned long nNoWrite; /*only modified by dbCaPutLink*/ unsigned long nUpdate; }caLink; diff --git a/modules/database/src/ioc/db/dbCaTest.c b/modules/database/src/ioc/db/dbCaTest.c index 18ef393ca..3f6ab1a78 100644 --- a/modules/database/src/ioc/db/dbCaTest.c +++ b/modules/database/src/ioc/db/dbCaTest.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* dbCaTest.c */ @@ -155,7 +155,7 @@ done: printf(" (%lu disconnects, %lu writes prohibited)\n\n", nDisconnect, nNoWrite); dbFinishEntry(pdbentry); - + if ( level > 2 && dbCaClientContext != 0 ) { ca_context_status ( dbCaClientContext, level - 2 ); } diff --git a/modules/database/src/ioc/db/dbCaTest.h b/modules/database/src/ioc/db/dbCaTest.h index ed501df2d..9be2c9053 100644 --- a/modules/database/src/ioc/db/dbCaTest.h +++ b/modules/database/src/ioc/db/dbCaTest.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef INC_dbCaTest_H diff --git a/modules/database/src/ioc/db/dbChannelIO.cpp b/modules/database/src/ioc/db/dbChannelIO.cpp index a086d3e56..72fbbcca4 100644 --- a/modules/database/src/ioc/db/dbChannelIO.cpp +++ b/modules/database/src/ioc/db/dbChannelIO.cpp @@ -7,10 +7,10 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 +/* + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #include @@ -48,7 +48,7 @@ dbChannelIO::~dbChannelIO () { } -void dbChannelIO::destructor ( CallbackGuard & cbGuard, +void dbChannelIO::destructor ( CallbackGuard & cbGuard, epicsGuard < epicsMutex > & guard ) { guard.assertIdenticalMutex ( this->mutex ); diff --git a/modules/database/src/ioc/db/dbChannelIO.h b/modules/database/src/ioc/db/dbChannelIO.h index 5eb7c4eb2..a31bdcd55 100644 --- a/modules/database/src/ioc/db/dbChannelIO.h +++ b/modules/database/src/ioc/db/dbChannelIO.h @@ -9,9 +9,9 @@ \*************************************************************************/ /* - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 * * NOTES: * 1) This interface is preliminary and will change in the future diff --git a/modules/database/src/ioc/db/dbContext.cpp b/modules/database/src/ioc/db/dbContext.cpp index 36cc66538..3a156c603 100644 --- a/modules/database/src/ioc/db/dbContext.cpp +++ b/modules/database/src/ioc/db/dbContext.cpp @@ -6,10 +6,10 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 +/* + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #include @@ -123,7 +123,7 @@ cacChannel & dbContext::createChannel ( void dbContext::destroyChannel ( CallbackGuard & cbGuard, - epicsGuard < epicsMutex > & guard, + epicsGuard < epicsMutex > & guard, dbChannelIO & chan ) { guard.assertIdenticalMutex ( this->mutex ); @@ -281,7 +281,7 @@ void dbContext::initiatePutNotify ( void dbContext::destroyAllIO ( CallbackGuard & cbGuard, - epicsGuard < epicsMutex > & guard, + epicsGuard < epicsMutex > & guard, dbChannelIO & chan ) { guard.assertIdenticalMutex ( this->mutex ); @@ -315,7 +315,7 @@ void dbContext::destroyAllIO ( } void dbContext::ioCancel ( - CallbackGuard & cbGuard, epicsGuard < epicsMutex > & guard, + CallbackGuard & cbGuard, epicsGuard < epicsMutex > & guard, dbChannelIO & chan, const cacChannel::ioid &id ) { guard.assertIdenticalMutex ( this->mutex ); diff --git a/modules/database/src/ioc/db/dbContextReadNotifyCache.cpp b/modules/database/src/ioc/db/dbContextReadNotifyCache.cpp index e3196b25d..74be2c63a 100644 --- a/modules/database/src/ioc/db/dbContextReadNotifyCache.cpp +++ b/modules/database/src/ioc/db/dbContextReadNotifyCache.cpp @@ -38,18 +38,18 @@ public: dbContextReadNotifyCacheAllocator & allocator, unsigned long size ) : _allocator ( allocator ), _p ( allocator.alloc ( size ) ) {} ~privateAutoDestroyPtr () { _allocator.free ( _p ); } - char * get () const { return _p; } + char * get () const { return _p; } private: dbContextReadNotifyCacheAllocator & _allocator; char * _p; - privateAutoDestroyPtr ( const privateAutoDestroyPtr & ); - privateAutoDestroyPtr & operator = ( const privateAutoDestroyPtr & ); + privateAutoDestroyPtr ( const privateAutoDestroyPtr & ); + privateAutoDestroyPtr & operator = ( const privateAutoDestroyPtr & ); }; // extra effort taken here to not hold the lock when calling the callback void dbContextReadNotifyCache::callReadNotify ( epicsGuard < epicsMutex > & guard, struct dbChannel * dbch, - unsigned type, unsigned long count, cacReadNotify & notify ) + unsigned type, unsigned long count, cacReadNotify & notify ) { guard.assertIdenticalMutex ( _mutex ); diff --git a/modules/database/src/ioc/db/dbConvert.h b/modules/database/src/ioc/db/dbConvert.h index afd13c7c2..9c2414cb8 100644 --- a/modules/database/src/ioc/db/dbConvert.h +++ b/modules/database/src/ioc/db/dbConvert.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* dbConvert.h */ diff --git a/modules/database/src/ioc/db/dbConvertFast.h b/modules/database/src/ioc/db/dbConvertFast.h index cd9f4f963..53ca4c3cb 100644 --- a/modules/database/src/ioc/db/dbConvertFast.h +++ b/modules/database/src/ioc/db/dbConvertFast.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* dbConvertFast.h */ diff --git a/modules/database/src/ioc/db/dbConvertJSON.c b/modules/database/src/ioc/db/dbConvertJSON.c index eb697eeda..e341799ed 100644 --- a/modules/database/src/ioc/db/dbConvertJSON.c +++ b/modules/database/src/ioc/db/dbConvertJSON.c @@ -2,7 +2,7 @@ * Copyright (c) 2016 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* dbConvertJSON.c */ @@ -129,7 +129,7 @@ static int dbcj_end_map(void *ctx) { static int dbcj_start_array(void *ctx) { parseContext *parser = (parseContext *) ctx; - if (++parser->depth > 1) + if (++parser->depth > 1) errlogPrintf("dbConvertJSON: Embedded arrays not supported\n"); return (parser->depth == 1); diff --git a/modules/database/src/ioc/db/dbConvertJSON.h b/modules/database/src/ioc/db/dbConvertJSON.h index 7dd8e4aed..867aec4b1 100644 --- a/modules/database/src/ioc/db/dbConvertJSON.h +++ b/modules/database/src/ioc/db/dbConvertJSON.h @@ -2,7 +2,7 @@ * Copyright (c) 2016 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* dbConvertJSON.h */ diff --git a/modules/database/src/ioc/db/dbEvent.c b/modules/database/src/ioc/db/dbEvent.c index 0d96e12e5..ed8c37cd9 100644 --- a/modules/database/src/ioc/db/dbEvent.c +++ b/modules/database/src/ioc/db/dbEvent.c @@ -156,7 +156,7 @@ int dbel ( const char *pname, unsigned level ) if ( ! pname ) return DB_EVENT_OK; status = dbNameToAddr ( pname, &addr ); if ( status != 0 ) { - errMessage ( status, " dbNameToAddr failed" ); + errMessage ( status, " dbNameToAddr failed" ); return DB_EVENT_ERROR; } @@ -165,7 +165,7 @@ int dbel ( const char *pname, unsigned level ) pevent = (struct evSubscrip *) ellFirst ( &addr.precord->mlis ); if ( ! pevent ) { - printf ( "\"%s\": No PV event subscriptions ( monitors ).\n", pname ); + printf ( "\"%s\": No PV event subscriptions ( monitors ).\n", pname ); UNLOCKREC (addr.precord); return DB_EVENT_OK; } @@ -177,14 +177,14 @@ int dbel ( const char *pname, unsigned level ) pdbFldDes = dbChannelFldDes(pevent->chan); if ( level > 0 ) { - printf ( "%4.4s", pdbFldDes->name ); + printf ( "%4.4s", pdbFldDes->name ); - printf ( " { " ); - if ( pevent->select & DBE_VALUE ) printf( "VALUE " ); - if ( pevent->select & DBE_LOG ) printf( "LOG " ); - if ( pevent->select & DBE_ALARM ) printf( "ALARM " ); - if ( pevent->select & DBE_PROPERTY ) printf( "PROPERTY " ); - printf ( "}" ); + printf ( " { " ); + if ( pevent->select & DBE_VALUE ) printf( "VALUE " ); + if ( pevent->select & DBE_LOG ) printf( "LOG " ); + if ( pevent->select & DBE_ALARM ) printf( "ALARM " ); + if ( pevent->select & DBE_PROPERTY ) printf( "PROPERTY " ); + printf ( "}" ); if ( pevent->npend ) { printf ( " undelivered=%ld", pevent->npend ); @@ -239,7 +239,7 @@ int dbel ( const char *pname, unsigned level ) ( void * ) pevent->ev_que->evUser ); } - printf( "\n" ); + printf( "\n" ); } pevent = (struct evSubscrip *) ellNext ( &pevent->node ); @@ -371,7 +371,7 @@ void db_close_events (dbEventCtx ctx) */ static struct event_que * create_ev_que ( struct event_user * const evUser ) { - struct event_que * const ev_que = (struct event_que *) + struct event_que * const ev_que = (struct event_que *) freeListCalloc ( dbevEventQueueFreeList ); if ( ! ev_que ) { return NULL; @@ -415,7 +415,7 @@ dbEventSubscription db_add_event ( while ( TRUE ) { int success = 0; LOCKEVQUE ( ev_que ); - success = ( ev_que->quota + ev_que->nCanceled < + success = ( ev_que->quota + ev_que->nCanceled < EVENTQUESIZE - EVENTENTRIES ); if ( success ) { ev_que->quota += EVENTENTRIES; @@ -1097,7 +1097,7 @@ int db_start_events ( /* * db_event_change_priority() */ -void db_event_change_priority ( dbEventCtx ctx, +void db_event_change_priority ( dbEventCtx ctx, unsigned epicsPriority ) { struct event_user * const evUser = ( struct event_user * ) ctx; diff --git a/modules/database/src/ioc/db/dbEvent.h b/modules/database/src/ioc/db/dbEvent.h index 374e84996..0c9059902 100644 --- a/modules/database/src/ioc/db/dbEvent.h +++ b/modules/database/src/ioc/db/dbEvent.h @@ -68,7 +68,7 @@ epicsShareFunc void db_cleanup_events(void); #endif typedef void EVENTFUNC (void *user_arg, struct dbChannel *chan, - int eventsRemaining, struct db_field_log *pfl); + int eventsRemaining, struct db_field_log *pfl); typedef void * dbEventSubscription; epicsShareFunc dbEventSubscription db_add_event ( diff --git a/modules/database/src/ioc/db/dbFastLinkConv.c b/modules/database/src/ioc/db/dbFastLinkConv.c index 9c719890b..ab797448d 100644 --- a/modules/database/src/ioc/db/dbFastLinkConv.c +++ b/modules/database/src/ioc/db/dbFastLinkConv.c @@ -38,7 +38,7 @@ #include "recGbl.h" #include "recSup.h" #include "special.h" - + /* * In the following functions: @@ -1045,7 +1045,7 @@ static long cvt_f_st( long precision = 6; if(paddr) prset = dbGetRset(paddr); - + if (prset && prset->get_precision) status = (*prset->get_precision)(paddr, &precision); cvtFloatToString(*from, to, (unsigned short)precision); @@ -1140,7 +1140,7 @@ static long cvt_d_st( long precision = 6; if(paddr) prset = dbGetRset(paddr); - + if (prset && prset->get_precision) status = (*prset->get_precision)(paddr, &precision); cvtDoubleToString(*from, to, (unsigned short)precision); @@ -1313,7 +1313,7 @@ static long cvt_e_st_get( long status; if(paddr) prset = dbGetRset(paddr); - + if (prset && prset->get_enum_str) return (*prset->get_enum_str)(paddr, to); @@ -1335,20 +1335,20 @@ static long cvt_menu_st( epicsEnum16 *from, char *to, const dbAddr *paddr) - { - dbFldDes *pdbFldDes; - dbMenu *pdbMenu; - char **papChoiceValue; - char *pchoice; + { + dbFldDes *pdbFldDes; + dbMenu *pdbMenu; + char **papChoiceValue; + char *pchoice; - if(! paddr + if(! paddr || !(pdbFldDes = paddr->pfldDes) || !(pdbMenu = (dbMenu *)pdbFldDes->ftPvt) || *from>=pdbMenu->nChoice || !(papChoiceValue = pdbMenu->papChoiceValue) || !(pchoice=papChoiceValue[*from])) { - recGblDbaddrError(S_db_badChoice,paddr,"dbFastLinkConv(cvt_menu_st)"); - return(S_db_badChoice); + recGblDbaddrError(S_db_badChoice,paddr,"dbFastLinkConv(cvt_menu_st)"); + return(S_db_badChoice); } strncpy(to,pchoice,MAX_STRING_SIZE); return(0); @@ -1360,20 +1360,20 @@ static long cvt_device_st( epicsEnum16 *from, char *to, const dbAddr *paddr) - { - dbFldDes *pdbFldDes; - dbDeviceMenu *pdbDeviceMenu; - char **papChoice; - char *pchoice; + { + dbFldDes *pdbFldDes; + dbDeviceMenu *pdbDeviceMenu; + char **papChoice; + char *pchoice; - if(!paddr + if(!paddr || !(pdbFldDes = paddr->pfldDes) || !(pdbDeviceMenu = (dbDeviceMenu *)pdbFldDes->ftPvt) || *from>=pdbDeviceMenu->nChoice || !(papChoice= pdbDeviceMenu->papChoice) || !(pchoice=papChoice[*from])) { - recGblDbaddrError(S_db_badChoice,paddr,"dbFastLinkConv(cvt_device_st)"); - return(S_db_badChoice); + recGblDbaddrError(S_db_badChoice,paddr,"dbFastLinkConv(cvt_device_st)"); + return(S_db_badChoice); } strncpy(to,pchoice,MAX_STRING_SIZE); return(0); diff --git a/modules/database/src/ioc/db/dbIocRegister.c b/modules/database/src/ioc/db/dbIocRegister.c index 2c3a81393..6716773b1 100644 --- a/modules/database/src/ioc/db/dbIocRegister.c +++ b/modules/database/src/ioc/db/dbIocRegister.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include "iocsh.h" diff --git a/modules/database/src/ioc/db/dbIocRegister.h b/modules/database/src/ioc/db/dbIocRegister.h index 973009c5b..91c126524 100644 --- a/modules/database/src/ioc/db/dbIocRegister.h +++ b/modules/database/src/ioc/db/dbIocRegister.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef INC_dbIocRegister_H diff --git a/modules/database/src/ioc/db/dbLock.c b/modules/database/src/ioc/db/dbLock.c index 8df755b2c..8579d6a1f 100644 --- a/modules/database/src/ioc/db/dbLock.c +++ b/modules/database/src/ioc/db/dbLock.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include @@ -882,16 +882,16 @@ static char *msstring[4]={"NMS","MS","MSI","MSS"}; long dblsr(char *recordname,int level) { - int link; - DBENTRY dbentry; - DBENTRY *pdbentry=&dbentry; - long status; - dbCommon *precord; - lockSet *plockSet; - lockRecord *plockRecord; - dbRecordType *pdbRecordType; - dbFldDes *pdbFldDes; - DBLINK *plink; + int link; + DBENTRY dbentry; + DBENTRY *pdbentry=&dbentry; + long status; + dbCommon *precord; + lockSet *plockSet; + lockRecord *plockRecord; + dbRecordType *pdbRecordType; + dbFldDes *pdbFldDes; + DBLINK *plink; if (recordname && ((*recordname == '\0') || !strcmp(recordname,"*"))) recordname = NULL; @@ -923,7 +923,7 @@ long dblsr(char *recordname,int level) printf("%s\n",precord->name); if(level<=1) continue; for(link=0; (linkno_links) ; link++) { - DBADDR *pdbAddr; + DBADDR *pdbAddr; pdbFldDes = pdbRecordType->papFldDes[pdbRecordType->link_ind[link]]; plink = (DBLINK *)((char *)precord + pdbFldDes->offset); if(plink->type != DB_LINK) continue; @@ -983,8 +983,8 @@ long dbLockShowLocked(int level) int * dbLockSetAddrTrace(dbCommon *precord) { - lockRecord *plockRecord = precord->lset; - lockSet *plockSet = plockRecord->plockSet; + lockRecord *plockRecord = precord->lset; + lockSet *plockSet = plockRecord->plockSet; return(&plockSet->trace); } diff --git a/modules/database/src/ioc/db/dbLock.h b/modules/database/src/ioc/db/dbLock.h index e15ddd0e9..cc0289a7a 100644 --- a/modules/database/src/ioc/db/dbLock.h +++ b/modules/database/src/ioc/db/dbLock.h @@ -5,10 +5,10 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* dbLock.h */ -/* Author: Marty Kraimer Date: 12MAR96 */ +/* Author: Marty Kraimer Date: 12MAR96 */ #ifndef INCdbLockh #define INCdbLockh diff --git a/modules/database/src/ioc/db/dbLockPvt.h b/modules/database/src/ioc/db/dbLockPvt.h index 79ccd44d8..980037e45 100644 --- a/modules/database/src/ioc/db/dbLockPvt.h +++ b/modules/database/src/ioc/db/dbLockPvt.h @@ -24,10 +24,10 @@ * are guarded by its lock. */ typedef struct dbLockSet { - ELLNODE node; - ELLLIST lockRecordList; /* holds lockRecord::node */ - epicsMutexId lock; - unsigned long id; + ELLNODE node; + ELLLIST lockRecordList; /* holds lockRecord::node */ + epicsMutexId lock; + unsigned long id; int refcount; #ifdef LOCKSET_DEBUG @@ -48,15 +48,15 @@ struct lockRecord; * plockSet is guarded by spin. */ typedef struct lockRecord { - ELLNODE node; /* in lockSet::lockRecordList */ + ELLNODE node; /* in lockSet::lockRecordList */ /* The association between lockRecord and lockSet * can only be changed while the lockSet is held, * and the lockRecord's spinlock is held. * It may be read which either lock is held. */ - lockSet *plockSet; + lockSet *plockSet; /* the association between lockRecord and dbCommon never changes */ - dbCommon *precord; + dbCommon *precord; epicsSpinId spin; /* temp used during lockset split. diff --git a/modules/database/src/ioc/db/dbNotify.c b/modules/database/src/ioc/db/dbNotify.c index e25ce4aa0..7bb5b276e 100644 --- a/modules/database/src/ioc/db/dbNotify.c +++ b/modules/database/src/ioc/db/dbNotify.c @@ -8,7 +8,7 @@ \*************************************************************************/ /* dbNotify.c */ /* - * Author: Marty Kraimer + * Author: Marty Kraimer * Andrew Johnson * * Extracted from dbLink.c @@ -151,7 +151,7 @@ static void restartCheck(processNotifyRecord *ppnr) dbCommon *precord = ppnr->precord; processNotify *pfirst; notifyPvt *pnotifyPvt; - + assert(precord->ppn); pfirst = (processNotify *) ellFirst(&ppnr->restartList); if (!pfirst) { @@ -188,7 +188,7 @@ static void callDone(dbCommon *precord, processNotify *ppn) } if (!pnotifyPvt->cancelWait && !pnotifyPvt->userCallbackWait) { notifyCleanup(ppn); - epicsMutexUnlock(pnotifyGlobal->lock); + epicsMutexUnlock(pnotifyGlobal->lock); return; } if (pnotifyPvt->cancelWait) { @@ -213,7 +213,7 @@ static void processNotifyCommon(processNotify *ppn, dbCommon *precord, int first if (precord->ppn && pnotifyPvt->state != notifyRestartCallbackRequested) { /* Another processNotify owns the record */ - pnotifyPvt->state = notifyWaitForRestart; + pnotifyPvt->state = notifyWaitForRestart; ellSafeAdd(&precord->ppnr->restartList, &ppn->restartNode); epicsMutexUnlock(pnotifyGlobal->lock); dbScanUnlock(precord); @@ -225,7 +225,7 @@ static void processNotifyCommon(processNotify *ppn, dbCommon *precord, int first if (precord->pact) { precord->ppn = ppn; ellSafeAdd(&pnotifyPvt->waitList, &precord->ppnr->waitNode); - pnotifyPvt->state = notifyRestartInProgress; + pnotifyPvt->state = notifyRestartInProgress; epicsMutexUnlock(pnotifyGlobal->lock); dbScanUnlock(precord); return; @@ -347,7 +347,7 @@ void dbProcessNotify(processNotify *ppn) if (ppn->requestType == processGetRequest || ppn->requestType == putProcessGetRequest) { ppn->getCallback(ppn, getFieldType); - + } ppn->doneCallback(ppn); return; @@ -413,7 +413,7 @@ void dbNotifyCancel(processNotify *ppn) epicsMutexUnlock(pnotifyGlobal->lock); return; case notifyNotActive: - break; + break; case notifyWaitForRestart: assert(precord->ppn); assert(precord->ppn!=ppn); @@ -425,7 +425,7 @@ void dbNotifyCancel(processNotify *ppn) processNotifyRecord *ppnrWait; while ((ppnrWait = (processNotifyRecord *) - ellFirst(&pnotifyPvt->waitList))) { + ellFirst(&pnotifyPvt->waitList))) { ellSafeDelete(&pnotifyPvt->waitList, &ppnrWait->waitNode); restartCheck(ppnrWait); } @@ -569,7 +569,7 @@ static void doneCallback(processNotify *ppn) printf("dbtpnCallback: success record=%s\n", pname); else printf("%s dbtpnCallback processNotify.status %d\n", - pname, (int) status); + pname, (int) status); epicsEventSignal(ptpnInfo->callbackDone); } @@ -602,7 +602,7 @@ long dbtpn(char *pname, char *pvalue) printf("dbtpn: No such channel\n"); return -1; } - + ppn = dbCalloc(1, sizeof(processNotify)); ppn->requestType = pvalue ? putProcessRequest : processGetRequest; ppn->chan = chan; @@ -671,7 +671,7 @@ int dbNotifyDump(void) ppnRestart = (processNotify *)ellFirst( &precord->ppnr->restartList); if (ppnRestart) - printf("%s restartList\n", precord->name); + printf("%s restartList\n", precord->name); while (ppnRestart) { printf(" %s\n", dbChannelRecord(ppnRestart->chan)->name); ppnRestart = (processNotify *) ellNext( diff --git a/modules/database/src/ioc/db/dbNotify.h b/modules/database/src/ioc/db/dbNotify.h index 5641cff0f..c9f708ac6 100644 --- a/modules/database/src/ioc/db/dbNotify.h +++ b/modules/database/src/ioc/db/dbNotify.h @@ -6,7 +6,7 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* dbNotify.h */ +/* dbNotify.h */ #ifndef INCdbNotifyh #define INCdbNotifyh @@ -89,7 +89,7 @@ epicsShareFunc void dbNotifyCompletion(struct dbCommon *precord); epicsShareFunc int db_put_process( processNotify *processNotify,notifyPutType type, int src_type,const void *psrc, int no_elements); - + /* dbtpn is test routine for dbNotify putProcessRequest */ epicsShareFunc long dbtpn(char *recordname,char *value); @@ -98,7 +98,7 @@ epicsShareFunc int dbNotifyDump(void); /* This module provides code to handle process notify. * client code semantics are: - * 1) The client code allocates storage for a processNotify structure. + * 1) The client code allocates storage for a processNotify structure. * This structure can be used for multiple calls to dbProcessNotify. * The client is responsible for setting the following fields : * requestType - The type of request. @@ -107,7 +107,7 @@ epicsShareFunc int dbNotifyDump(void); * getCallback - If request is processGetRequest or putProcessGetRequest * doneCallback - Must be set * usrPvt - For exclusive use of client. dbNotify does not access this field - * 2) The client calls dbProcessNotify. + * 2) The client calls dbProcessNotify. * 3) putCallback is called after dbNotify has claimed the record instance * but before a potential process is requested. * The putCallback MUST issue the correct put request @@ -140,22 +140,22 @@ epicsShareFunc int dbNotifyDump(void); * The other global routines (dbNotifyAdd and dbNotifyCompletion) are called by: * * dbAccess.c - * dbScanPassive and dbScanLink - * call dbNotifyAdd just before calling dbProcess - * dbProcess - * Calls dbNotifyCompletion if dbProcess does not call process + * dbScanPassive and dbScanLink + * call dbNotifyAdd just before calling dbProcess + * dbProcess + * Calls dbNotifyCompletion if dbProcess does not call process * Unless pact is already true. - * recGbl - * recGblFwdLink calls dbNotifyCompletion + * recGbl + * recGblFwdLink calls dbNotifyCompletion * * Two fields in dbCommon are used for put notify. - * ppn pointer to processNotify - * If a record is part of a put notify group, - * This field is the address of the associated processNotify. - * As soon as a record completes processing the field is set NULL - * ppnr pointer to processNotifyRecord, which is a private structure + * ppn pointer to processNotify + * If a record is part of a put notify group, + * This field is the address of the associated processNotify. + * As soon as a record completes processing the field is set NULL + * ppnr pointer to processNotifyRecord, which is a private structure * owned by dbNotify. - * dbNotify is reponsible for this structure. + * dbNotify is reponsible for this structure. * */ #ifdef __cplusplus diff --git a/modules/database/src/ioc/db/dbPutNotifyBlocker.cpp b/modules/database/src/ioc/db/dbPutNotifyBlocker.cpp index 1a796cdbd..27b5d4b7f 100644 --- a/modules/database/src/ioc/db/dbPutNotifyBlocker.cpp +++ b/modules/database/src/ioc/db/dbPutNotifyBlocker.cpp @@ -7,8 +7,8 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* - * Author: +/* + * Author: * Jeffrey O. Hill * johill@lanl.gov * 505 665 1831 @@ -48,7 +48,7 @@ dbPutNotifyBlocker::~dbPutNotifyBlocker () { } -void dbPutNotifyBlocker::destructor ( CallbackGuard & cbGuard, +void dbPutNotifyBlocker::destructor ( CallbackGuard & cbGuard, epicsGuard < epicsMutex > & guard ) { guard.assertIdenticalMutex ( this->mutex ); @@ -103,7 +103,7 @@ extern "C" int putNotifyPut ( processNotify *ppn, notifyPutType type ) extern "C" void putNotifyCompletion ( processNotify *ppn ) { - dbPutNotifyBlocker * const pBlocker = + dbPutNotifyBlocker * const pBlocker = static_cast < dbPutNotifyBlocker * > ( ppn->usrPvt ); epicsGuard < epicsMutex > guard ( pBlocker->mutex ); cacWriteNotify * const pNtfy = pBlocker->pNotify; @@ -111,14 +111,14 @@ extern "C" void putNotifyCompletion ( processNotify *ppn ) pBlocker->pNotify = 0; // Its necessary to signal the initiators now before we call // the user callback. This is less efficent, and potentially - // causes more thread context switching, but its probably - // unavoidable because its possible that the use callback + // causes more thread context switching, but its probably + // unavoidable because its possible that the use callback // might destroy this object. pBlocker->block.signal (); if ( pBlocker->pn.status != notifyOK ) { - pNtfy->exception ( + pNtfy->exception ( guard, ECA_PUTFAIL, "put notify unsuccessful", - static_cast < unsigned > (pBlocker->dbrType), + static_cast < unsigned > (pBlocker->dbrType), static_cast < unsigned > (pBlocker->nRequest) ); } else { diff --git a/modules/database/src/ioc/db/dbPutNotifyBlocker.h b/modules/database/src/ioc/db/dbPutNotifyBlocker.h index 6ca11cc5d..dd402005b 100644 --- a/modules/database/src/ioc/db/dbPutNotifyBlocker.h +++ b/modules/database/src/ioc/db/dbPutNotifyBlocker.h @@ -8,10 +8,10 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 +/* + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #ifndef dbPutNotifyBlockerh @@ -75,8 +75,8 @@ private: epicsGuard < epicsMutex > &, unsigned long newSize ); friend void putNotifyCompletion ( processNotify * ppn ); friend int putNotifyPut ( processNotify *ppn, notifyPutType type ); - dbPutNotifyBlocker ( const dbPutNotifyBlocker & ); - dbPutNotifyBlocker & operator = ( const dbPutNotifyBlocker & ); + dbPutNotifyBlocker ( const dbPutNotifyBlocker & ); + dbPutNotifyBlocker & operator = ( const dbPutNotifyBlocker & ); virtual ~dbPutNotifyBlocker (); void operator delete ( void * ); }; diff --git a/modules/database/src/ioc/db/dbScan.h b/modules/database/src/ioc/db/dbScan.h index 622103c3b..de0e94dac 100644 --- a/modules/database/src/ioc/db/dbScan.h +++ b/modules/database/src/ioc/db/dbScan.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Author: Marty Kraimer diff --git a/modules/database/src/ioc/db/dbSubscriptionIO.cpp b/modules/database/src/ioc/db/dbSubscriptionIO.cpp index 5b9b85ef5..688ee9466 100644 --- a/modules/database/src/ioc/db/dbSubscriptionIO.cpp +++ b/modules/database/src/ioc/db/dbSubscriptionIO.cpp @@ -7,10 +7,10 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 +/* + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #include @@ -56,14 +56,14 @@ dbSubscriptionIO::~dbSubscriptionIO () { } -void dbSubscriptionIO::destructor ( CallbackGuard & cbGuard, +void dbSubscriptionIO::destructor ( CallbackGuard & cbGuard, epicsGuard < epicsMutex > & guard ) { guard.assertIdenticalMutex ( this->mutex ); this->~dbSubscriptionIO (); } -void dbSubscriptionIO::unsubscribe ( CallbackGuard & cbGuard, +void dbSubscriptionIO::unsubscribe ( CallbackGuard & cbGuard, epicsGuard < epicsMutex > & guard ) { guard.assertIdenticalMutex ( this->mutex ); @@ -112,7 +112,7 @@ void dbSubscriptionIO::operator delete ( void * pCadaver, #endif extern "C" void dbSubscriptionEventCallback ( void *pPrivate, struct dbChannel * /* dbch */, - int /* eventsRemaining */, struct db_field_log *pfl ) + int /* eventsRemaining */, struct db_field_log *pfl ) { dbSubscriptionIO * pIO = static_cast < dbSubscriptionIO * > ( pPrivate ); pIO->chan.callStateNotify ( pIO->type, pIO->count, pfl, pIO->notify ); diff --git a/modules/database/src/ioc/db/dbTest.h b/modules/database/src/ioc/db/dbTest.h index a4d90e2ad..6dc2a90d4 100644 --- a/modules/database/src/ioc/db/dbTest.h +++ b/modules/database/src/ioc/db/dbTest.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef INC_dbTest_H diff --git a/modules/database/src/ioc/db/db_convert.h b/modules/database/src/ioc/db/db_convert.h index 530eba569..0ba2aee58 100644 --- a/modules/database/src/ioc/db/db_convert.h +++ b/modules/database/src/ioc/db/db_convert.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* db_convert.h */ @@ -41,27 +41,27 @@ epicsShareExtern unsigned short dbDBRoldToDBFnew[DBR_DOUBLE+1]; epicsShareExtern unsigned short dbDBRnewToDBRold[newDBR_ENUM+1]; #ifdef DB_CONVERT_GBLSOURCE unsigned short dbDBRoldToDBFnew[DBR_DOUBLE+1] = { - 0, /*DBR_STRING to DBF_STRING*/ - 3, /*DBR_INT to DBF_SHORT*/ - 9, /*DBR_FLOAT to DBF_FLOAT*/ - 11, /*DBR_ENUM to DBF_ENUM*/ - 1, /*DBR_CHAR to DBF_CHAR*/ - 5, /*DBR_LONG to DBF_LONG*/ - 10 /*DBR_DOUBLE to DBF_DOUBLE*/ + 0, /*DBR_STRING to DBF_STRING*/ + 3, /*DBR_INT to DBF_SHORT*/ + 9, /*DBR_FLOAT to DBF_FLOAT*/ + 11, /*DBR_ENUM to DBF_ENUM*/ + 1, /*DBR_CHAR to DBF_CHAR*/ + 5, /*DBR_LONG to DBF_LONG*/ + 10 /*DBR_DOUBLE to DBF_DOUBLE*/ }; unsigned short dbDBRnewToDBRold[newDBR_ENUM+1] = { - 0, /*DBR_STRING to DBR_STRING*/ - 4, /*DBR_CHAR to DBR_CHAR*/ - 4, /*DBR_UCHAR to DBR_CHAR*/ - 1, /*DBR_SHORT to DBR_SHORT*/ - 5, /*DBR_USHORT to DBR_LONG*/ - 5, /*DBR_LONG to DBR_LONG*/ - 6, /*DBR_ULONG to DBR_DOUBLE*/ - 6, /*DBR_INT64 to DBR_DOUBLE*/ - 6, /*DBR_UINT64 to DBR_DOUBLE*/ - 2, /*DBR_FLOAT to DBR_FLOAT*/ - 6, /*DBR_DOUBLE to DBR_DOUBLE*/ - 3, /*DBR_ENUM to DBR_ENUM*/ + 0, /*DBR_STRING to DBR_STRING*/ + 4, /*DBR_CHAR to DBR_CHAR*/ + 4, /*DBR_UCHAR to DBR_CHAR*/ + 1, /*DBR_SHORT to DBR_SHORT*/ + 5, /*DBR_USHORT to DBR_LONG*/ + 5, /*DBR_LONG to DBR_LONG*/ + 6, /*DBR_ULONG to DBR_DOUBLE*/ + 6, /*DBR_INT64 to DBR_DOUBLE*/ + 6, /*DBR_UINT64 to DBR_DOUBLE*/ + 2, /*DBR_FLOAT to DBR_FLOAT*/ + 6, /*DBR_DOUBLE to DBR_DOUBLE*/ + 3, /*DBR_ENUM to DBR_ENUM*/ }; #endif /*DB_CONVERT_GBLSOURCE*/ diff --git a/modules/database/src/ioc/db/db_field_log.h b/modules/database/src/ioc/db/db_field_log.h index 1534517bb..a6aa8d24f 100644 --- a/modules/database/src/ioc/db/db_field_log.h +++ b/modules/database/src/ioc/db/db_field_log.h @@ -38,20 +38,20 @@ extern "C" { * will adjust automatically, it just compares field sizes. */ union native_value { - epicsInt8 dbf_char; - epicsInt16 dbf_short; - epicsEnum16 dbf_enum; - epicsInt32 dbf_long; - epicsFloat32 dbf_float; - epicsFloat64 dbf_double; + epicsInt8 dbf_char; + epicsInt16 dbf_short; + epicsEnum16 dbf_enum; + epicsInt32 dbf_long; + epicsFloat32 dbf_float; + epicsFloat64 dbf_double; #ifdef DB_EVENT_LOG_STRINGS - char dbf_string[MAX_STRING_SIZE]; + char dbf_string[MAX_STRING_SIZE]; #endif }; /* - * structure to log the state of a data base field at the time - * an event is triggered. + * structure to log the state of a data base field at the time + * an event is triggered. */ struct db_field_log; typedef void (dbfl_freeFunc)(struct db_field_log *pfl); diff --git a/modules/database/src/ioc/db/db_test.c b/modules/database/src/ioc/db/db_test.c index 544cfdde2..5594b4c39 100644 --- a/modules/database/src/ioc/db/db_test.c +++ b/modules/database/src/ioc/db/db_test.c @@ -30,7 +30,7 @@ #include "dbNotify.h" #include "db_test.h" -#define MAX_ELEMS 10 +#define MAX_ELEMS 10 int gft(const char *pname) { diff --git a/modules/database/src/ioc/db/db_test.h b/modules/database/src/ioc/db/db_test.h index 88eb14c21..f6d02916c 100644 --- a/modules/database/src/ioc/db/db_test.h +++ b/modules/database/src/ioc/db/db_test.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef INCLdb_testh diff --git a/modules/database/src/ioc/db/recGbl.c b/modules/database/src/ioc/db/recGbl.c index 8fd90bbda..93ac8aa6f 100644 --- a/modules/database/src/ioc/db/recGbl.c +++ b/modules/database/src/ioc/db/recGbl.c @@ -59,8 +59,8 @@ static void getMaxRangeValues(short field_type, double *pupper_limit, void recGblDbaddrError(long status, const struct dbAddr *paddr, const char *pmessage) { - dbCommon *precord = 0; - dbFldDes *pdbFldDes = 0; + dbCommon *precord = 0; + dbFldDes *pdbFldDes = 0; if(paddr) { pdbFldDes = paddr->pfldDes; @@ -78,7 +78,7 @@ void recGblDbaddrError(long status, const struct dbAddr *paddr, void recGblRecordError(long status, void *pdbc, const char *pmessage) { - dbCommon *precord = pdbc; + dbCommon *precord = pdbc; errPrintf(status,0,0, "PV: %s %s\n", @@ -190,24 +190,24 @@ unsigned short recGblResetAlarms(void *precord) pdbc->nsev = 0; if (prev_sevr != new_sevr) { - stat_mask = DBE_ALARM; - db_post_events(pdbc, &pdbc->sevr, DBE_VALUE); + stat_mask = DBE_ALARM; + db_post_events(pdbc, &pdbc->sevr, DBE_VALUE); } if (prev_stat != new_stat) { - stat_mask |= DBE_VALUE; + stat_mask |= DBE_VALUE; } if (stat_mask) { - db_post_events(pdbc, &pdbc->stat, stat_mask); - val_mask = DBE_ALARM; + db_post_events(pdbc, &pdbc->stat, stat_mask); + val_mask = DBE_ALARM; - if (!pdbc->ackt || new_sevr >= pdbc->acks) { - pdbc->acks = new_sevr; - db_post_events(pdbc, &pdbc->acks, DBE_VALUE); - } + if (!pdbc->ackt || new_sevr >= pdbc->acks) { + pdbc->acks = new_sevr; + db_post_events(pdbc, &pdbc->acks, DBE_VALUE); + } - if (recGblAlarmHook) { - (*recGblAlarmHook)(pdbc, prev_sevr, prev_stat); - } + if (recGblAlarmHook) { + (*recGblAlarmHook)(pdbc, prev_sevr, prev_stat); + } } return val_mask; } @@ -217,8 +217,8 @@ int recGblSetSevr(void *precord, epicsEnum16 new_stat, epicsEnum16 new_sevr) struct dbCommon *prec = precord; if (prec->nsev < new_sevr) { prec->nsta = new_stat; - prec->nsev = new_sevr; - return TRUE; + prec->nsev = new_sevr; + return TRUE; } return FALSE; } @@ -228,17 +228,17 @@ void recGblInheritSevr(int msMode, void *precord, epicsEnum16 stat, { switch (msMode) { case pvlOptNMS: - break; + break; case pvlOptMSI: if (sevr < INVALID_ALARM) - break; - /* Fall through */ + break; + /* Fall through */ case pvlOptMS: - recGblSetSevr(precord, LINK_ALARM, sevr); - break; + recGblSetSevr(precord, LINK_ALARM, sevr); + break; case pvlOptMSS: recGblSetSevr(precord, stat, sevr); - break; + break; } } @@ -251,9 +251,9 @@ void recGblFwdLink(void *precord) /*Handle dbPutFieldNotify record completions*/ if(pdbc->ppn) dbNotifyCompletion(pdbc); if(pdbc->rpro) { - /*If anyone requested reprocessing do it*/ - pdbc->rpro = FALSE; - scanOnce(pdbc); + /*If anyone requested reprocessing do it*/ + pdbc->rpro = FALSE; + scanOnce(pdbc); } /*In case putField caused put we are all done */ pdbc->putf = FALSE; diff --git a/modules/database/src/ioc/db/recGbl.h b/modules/database/src/ioc/db/recGbl.h index 20de9568a..57add164c 100644 --- a/modules/database/src/ioc/db/recGbl.h +++ b/modules/database/src/ioc/db/recGbl.h @@ -7,7 +7,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ /* recGbl.h */ -/* Record Global +/* Record Global * Author: Marty Kraimer * Date: 13Jun95 */ diff --git a/modules/database/src/ioc/dbStatic/dbBase.h b/modules/database/src/ioc/dbStatic/dbBase.h index 9e61211c6..f8bf63855 100644 --- a/modules/database/src/ioc/dbStatic/dbBase.h +++ b/modules/database/src/ioc/dbStatic/dbBase.h @@ -22,39 +22,39 @@ #include "devSup.h" typedef struct dbMenu { - ELLNODE node; - char *name; - int nChoice; - char **papChoiceName; - char **papChoiceValue; + ELLNODE node; + char *name; + int nChoice; + char **papChoiceName; + char **papChoiceValue; }dbMenu; typedef struct drvSup { - ELLNODE node; - char *name; - struct drvet *pdrvet; + ELLNODE node; + char *name; + struct drvet *pdrvet; }drvSup; typedef struct devSup { - ELLNODE node; - char *name; - char *choice; - int link_type; - /*Following only available on run time system*/ - dset *pdset; - struct dsxt *pdsxt; /* Extended device support */ + ELLNODE node; + char *name; + char *choice; + int link_type; + /*Following only available on run time system*/ + dset *pdset; + struct dsxt *pdsxt; /* Extended device support */ }devSup; typedef struct linkSup { - ELLNODE node; - char *name; - char *jlif_name; - struct jlif *pjlif; + ELLNODE node; + char *name; + char *jlif_name; + struct jlif *pjlif; } linkSup; typedef struct dbDeviceMenu { - int nChoice; - char **papChoice; + int nChoice; + char **papChoice; }dbDeviceMenu; /* conversion types*/ @@ -64,47 +64,47 @@ typedef enum {ASL0,ASL1} asLevel; /*Breakpoint Tables */ typedef struct brkInt{ /* breakpoint interval */ - double raw; /*raw value for beginning of interval */ - double slope; /*slope for interval */ - double eng; /*converted value for beginning of interval*/ + double raw; /*raw value for beginning of interval */ + double slope; /*slope for interval */ + double eng; /*converted value for beginning of interval*/ }brkInt; typedef struct brkTable { /* breakpoint table */ - ELLNODE node; - char *name; /*breakpoint table name */ - long number; /*number of brkInt in this table*/ - struct brkInt *paBrkInt; /* ptr to array of brkInts */ + ELLNODE node; + char *name; /*breakpoint table name */ + long number; /*number of brkInt in this table */ + struct brkInt *paBrkInt; /* ptr to array of brkInts */ }brkTable; typedef struct dbFldDes{ /* field description */ - char *prompt; /*Prompt string for DCT*/ - char *name; /*Field name*/ - char *extra; /*C def for DBF_NOACCESS*/ + char *prompt; /*Prompt string for DCT */ + char *name; /*Field name */ + char *extra; /*C def for DBF_NOACCESS */ struct dbRecordType *pdbRecordType; - short indRecordType; /*within dbRecordType.papFldDes */ - short special; /*Special processing requirements */ - dbfType field_type; /*Field type as defined in dbFldTypes.h */ - unsigned int process_passive:1;/*should dbPutField process passive */ - unsigned int prop:1;/*field is a metadata, post DBE_PROPERTY on change*/ - unsigned int isDevLink:1; /* true for INP/OUT fields */ - ctType base; /*base for integer to string conversions*/ - short promptgroup; /*prompt, i.e. gui group */ - short interest; /*interest level */ - asLevel as_level; /*access security level */ - char *initial; /*initial value */ - /*If (DBF_MENU,DBF_DEVICE) ftPvt is (pdbMenu,pdbDeviceMenu) */ - void *ftPvt; - /*On no runtime following only set for STRING */ - short size; /*length in bytes of a field element */ + short indRecordType; /*within dbRecordType.papFldDes */ + short special; /*Special processing requirements */ + dbfType field_type; /*Field type as defined in dbFldTypes.h */ + unsigned int process_passive:1;/*should dbPutField process passive */ + unsigned int prop:1; /*field is a metadata, post DBE_PROPERTY on change*/ + unsigned int isDevLink:1; /* true for INP/OUT fields */ + ctType base; /*base for integer to string conversions*/ + short promptgroup; /*prompt, i.e. gui group */ + short interest; /*interest level */ + asLevel as_level; /*access security level */ + char *initial; /*initial value */ + /*If (DBF_MENU,DBF_DEVICE) ftPvt is (pdbMenu,pdbDeviceMenu) */ + void *ftPvt; + /*On no runtime following only set for STRING */ + short size; /*length in bytes of a field element */ /*The following are only available on run time system*/ - unsigned short offset; /*Offset in bytes from beginning of record*/ + unsigned short offset; /*Offset in bytes from beginning of record*/ }dbFldDes; -typedef struct dbInfoNode { /*non-field per-record information*/ - ELLNODE node; - char *name; - char *string; - void *pointer; +typedef struct dbInfoNode { /*non-field per-record information*/ + ELLNODE node; + char *name; + char *string; + void *pointer; }dbInfoNode; #define DBRN_FLAGS_VISIBLE 1 @@ -112,11 +112,11 @@ typedef struct dbInfoNode { /*non-field per-record information*/ #define DBRN_FLAGS_HASALIAS 4 typedef struct dbRecordNode { - ELLNODE node; - void *precord; - char *recordname; - ELLLIST infoList; /*LIST head of info nodes*/ - int flags; + ELLNODE node; + void *precord; + char *recordname; + ELLLIST infoList; /*LIST head of info nodes*/ + int flags; struct dbRecordNode *aliasedRecnode; /* NULL unless flags|DBRN_FLAGS_ISALIAS */ }dbRecordNode; @@ -124,64 +124,64 @@ typedef struct dbRecordNode { /*pdbFldDes is so that other access routines work correctly*/ /*Until base supports char * value MUST be fixed length string*/ typedef struct dbRecordAttribute { - ELLNODE node; - char *name; - dbFldDes *pdbFldDes; - char value[MAX_STRING_SIZE]; + ELLNODE node; + char *name; + dbFldDes *pdbFldDes; + char value[MAX_STRING_SIZE]; }dbRecordAttribute; typedef struct dbText { - ELLNODE node; - char *text; + ELLNODE node; + char *text; }dbText; typedef struct dbVariableDef { - ELLNODE node; - char *name; - char *type; + ELLNODE node; + char *name; + char *type; }dbVariableDef; typedef struct dbRecordType { - ELLNODE node; - ELLLIST attributeList; /*LIST head of attributes*/ - ELLLIST recList; /*LIST head of sorted dbRecordNodes*/ - ELLLIST devList; /*List of associated device support*/ - ELLLIST cdefList; /*LIST of Cdef text items*/ - char *name; - short no_fields; /* number of fields defined */ - short no_prompt; /* number of fields to configure*/ - short no_links; /* number of links */ - short no_aliases; /* number of aliases in recList */ - short *link_ind; /* addr of array of ind in papFldDes*/ - char **papsortFldName;/* ptr to array of ptr to fld names*/ - short *sortFldInd; /* addr of array of ind in papFldDes*/ - dbFldDes *pvalFldDes; /*pointer dbFldDes for VAL field*/ - short indvalFlddes; /*ind in papFldDes*/ - dbFldDes **papFldDes; /* ptr to array of ptr to fldDes*/ + ELLNODE node; + ELLLIST attributeList; /*LIST head of attributes*/ + ELLLIST recList; /*LIST head of sorted dbRecordNodes*/ + ELLLIST devList; /*List of associated device support*/ + ELLLIST cdefList; /*LIST of Cdef text items*/ + char *name; + short no_fields; /* number of fields defined */ + short no_prompt; /* number of fields to configure*/ + short no_links; /* number of links */ + short no_aliases; /* number of aliases in recList */ + short *link_ind; /* addr of array of ind in papFldDes*/ + char **papsortFldName;/* ptr to array of ptr to fld names*/ + short *sortFldInd; /* addr of array of ind in papFldDes*/ + dbFldDes *pvalFldDes; /*pointer dbFldDes for VAL field*/ + short indvalFlddes; /*ind in papFldDes*/ + dbFldDes **papFldDes; /* ptr to array of ptr to fldDes*/ /*The following are only available on run time system*/ - rset *prset; - int rec_size; /*record size in bytes */ + rset *prset; + int rec_size; /*record size in bytes */ }dbRecordType; struct dbPvd; /* Contents private to dbPvdLib code */ struct gphPvt; /* Contents private to gpHashLib code */ typedef struct dbBase { - ELLLIST menuList; - ELLLIST recordTypeList; - ELLLIST drvList; - ELLLIST linkList; - ELLLIST registrarList; - ELLLIST functionList; - ELLLIST variableList; - ELLLIST bptList; + ELLLIST menuList; + ELLLIST recordTypeList; + ELLLIST drvList; + ELLLIST linkList; + ELLLIST registrarList; + ELLLIST functionList; + ELLLIST variableList; + ELLLIST bptList; ELLLIST filterList; ELLLIST guiGroupList; - void *pathPvt; - struct dbPvd *ppvd; - struct gphPvt *pgpHash; - short ignoreMissingMenus; - short loadCdefs; + void *pathPvt; + struct dbPvd *ppvd; + struct gphPvt *pgpHash; + short ignoreMissingMenus; + short loadCdefs; }dbBase; #endif diff --git a/modules/database/src/ioc/dbStatic/dbFldTypes.h b/modules/database/src/ioc/dbStatic/dbFldTypes.h index 5a2848951..c7767b8c7 100644 --- a/modules/database/src/ioc/dbStatic/dbFldTypes.h +++ b/modules/database/src/ioc/dbStatic/dbFldTypes.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Author: Marty Kraimer @@ -22,53 +22,53 @@ extern "C" { /* field types */ typedef enum { - DBF_STRING, - DBF_CHAR, - DBF_UCHAR, - DBF_SHORT, - DBF_USHORT, - DBF_LONG, - DBF_ULONG, - DBF_INT64, - DBF_UINT64, - DBF_FLOAT, - DBF_DOUBLE, - DBF_ENUM, - DBF_MENU, - DBF_DEVICE, - DBF_INLINK, - DBF_OUTLINK, - DBF_FWDLINK, - DBF_NOACCESS + DBF_STRING, + DBF_CHAR, + DBF_UCHAR, + DBF_SHORT, + DBF_USHORT, + DBF_LONG, + DBF_ULONG, + DBF_INT64, + DBF_UINT64, + DBF_FLOAT, + DBF_DOUBLE, + DBF_ENUM, + DBF_MENU, + DBF_DEVICE, + DBF_INLINK, + DBF_OUTLINK, + DBF_FWDLINK, + DBF_NOACCESS }dbfType; #define DBF_NTYPES DBF_NOACCESS+1 typedef struct mapdbfType{ - char *strvalue; - dbfType value; + char *strvalue; + dbfType value; }mapdbfType; epicsShareExtern mapdbfType pamapdbfType[]; #ifdef DBFLDTYPES_GBLSOURCE mapdbfType pamapdbfType[DBF_NTYPES] = { - {"DBF_STRING",DBF_STRING}, - {"DBF_CHAR",DBF_CHAR}, - {"DBF_UCHAR",DBF_UCHAR}, - {"DBF_SHORT",DBF_SHORT}, - {"DBF_USHORT",DBF_USHORT}, - {"DBF_LONG",DBF_LONG}, - {"DBF_ULONG",DBF_ULONG}, - {"DBF_INT64",DBF_INT64}, - {"DBF_UINT64",DBF_UINT64}, - {"DBF_FLOAT",DBF_FLOAT}, - {"DBF_DOUBLE",DBF_DOUBLE}, - {"DBF_ENUM",DBF_ENUM}, - {"DBF_MENU",DBF_MENU}, - {"DBF_DEVICE",DBF_DEVICE}, - {"DBF_INLINK",DBF_INLINK}, - {"DBF_OUTLINK",DBF_OUTLINK}, - {"DBF_FWDLINK",DBF_FWDLINK}, - {"DBF_NOACCESS",DBF_NOACCESS} + {"DBF_STRING",DBF_STRING}, + {"DBF_CHAR",DBF_CHAR}, + {"DBF_UCHAR",DBF_UCHAR}, + {"DBF_SHORT",DBF_SHORT}, + {"DBF_USHORT",DBF_USHORT}, + {"DBF_LONG",DBF_LONG}, + {"DBF_ULONG",DBF_ULONG}, + {"DBF_INT64",DBF_INT64}, + {"DBF_UINT64",DBF_UINT64}, + {"DBF_FLOAT",DBF_FLOAT}, + {"DBF_DOUBLE",DBF_DOUBLE}, + {"DBF_ENUM",DBF_ENUM}, + {"DBF_MENU",DBF_MENU}, + {"DBF_DEVICE",DBF_DEVICE}, + {"DBF_INLINK",DBF_INLINK}, + {"DBF_OUTLINK",DBF_OUTLINK}, + {"DBF_FWDLINK",DBF_FWDLINK}, + {"DBF_NOACCESS",DBF_NOACCESS} }; #endif /*DBFLDTYPES_GBLSOURCE*/ @@ -85,8 +85,8 @@ mapdbfType pamapdbfType[DBF_NTYPES] = { #define DBR_FLOAT DBF_FLOAT #define DBR_DOUBLE DBF_DOUBLE #define DBR_ENUM DBF_ENUM -#define DBR_PUT_ACKT DBR_ENUM+1 -#define DBR_PUT_ACKS DBR_PUT_ACKT+1 +#define DBR_PUT_ACKT DBR_ENUM+1 +#define DBR_PUT_ACKS DBR_PUT_ACKT+1 #define DBR_NOACCESS DBF_NOACCESS #define VALID_DB_REQ(x) ((x >= 0) && (x <= DBR_ENUM)) #define INVALID_DB_REQ(x) ((x < 0) || (x > DBR_ENUM)) diff --git a/modules/database/src/ioc/dbStatic/dbLex.l b/modules/database/src/ioc/dbStatic/dbLex.l index cfbb5bda4..1c0e58b93 100644 --- a/modules/database/src/ioc/dbStatic/dbLex.l +++ b/modules/database/src/ioc/dbStatic/dbLex.l @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ newline "\n" @@ -16,18 +16,18 @@ escape {backslash}. stringchar [^"\n\\] bareword [a-zA-Z0-9_\-+:.\[\]<>;] -punctuation [:,\[\]{}] -normalchar [^"\\\0-\x1f] -barechar [a-zA-Z0-9_\-+.] -escapedchar ({backslash}["\\/bfnrt]) -hexdigit [0-9a-fA-F] -unicodechar ({backslash}"u"{hexdigit}{4}) -jsonchar ({normalchar}|{escapedchar}|{unicodechar}) -jsondqstr ({doublequote}{jsonchar}*{doublequote}) -int ("-"?([0-9]|[1-9][0-9]+)) -frac ("."[0-9]+) -exp ([eE][+-]?[0-9]+) -number ({int}{frac}?{exp}?) +punctuation [:,\[\]{}] +normalchar [^"\\\0-\x1f] +barechar [a-zA-Z0-9_\-+.] +escapedchar ({backslash}["\\/bfnrt]) +hexdigit [0-9a-fA-F] +unicodechar ({backslash}"u"{hexdigit}{4}) +jsonchar ({normalchar}|{escapedchar}|{unicodechar}) +jsondqstr ({doublequote}{jsonchar}*{doublequote}) +int ("-"?([0-9]|[1-9][0-9]+)) +frac ("."[0-9]+) +exp ([eE][+-]?[0-9]+) +number ({int}{frac}?{exp}?) %{ #undef YY_INPUT @@ -35,8 +35,8 @@ number ({int}{frac}?{exp}?) static int yyreset(void) { - BEGIN INITIAL; - return(0); + BEGIN INITIAL; + return(0); } %} @@ -45,90 +45,90 @@ static int yyreset(void) %% -"include" return(tokenINCLUDE); -"path" return(tokenPATH); -"addpath" return(tokenADDPATH); -"menu" return(tokenMENU); -"choice" return(tokenCHOICE); -"recordtype" return(tokenRECORDTYPE); -"field" return(tokenFIELD); -"device" return(tokenDEVICE); -"driver" return(tokenDRIVER); -"link" return(tokenLINK); -"breaktable" return(tokenBREAKTABLE); -"record" return(tokenRECORD); -"grecord" return(tokenGRECORD); -"alias" return(tokenALIAS); -"info" return(tokenINFO); -"registrar" return(tokenREGISTRAR); -"function" return(tokenFUNCTION); -"variable" return(tokenVARIABLE); +"include" return(tokenINCLUDE); +"path" return(tokenPATH); +"addpath" return(tokenADDPATH); +"menu" return(tokenMENU); +"choice" return(tokenCHOICE); +"recordtype" return(tokenRECORDTYPE); +"field" return(tokenFIELD); +"device" return(tokenDEVICE); +"driver" return(tokenDRIVER); +"link" return(tokenLINK); +"breaktable" return(tokenBREAKTABLE); +"record" return(tokenRECORD); +"grecord" return(tokenGRECORD); +"alias" return(tokenALIAS); +"info" return(tokenINFO); +"registrar" return(tokenREGISTRAR); +"function" return(tokenFUNCTION); +"variable" return(tokenVARIABLE); {bareword}+ { /* unquoted string or number */ - yylval.Str = dbmfStrdup((char *) yytext); - return(tokenSTRING); + yylval.Str = dbmfStrdup((char *) yytext); + return(tokenSTRING); } {doublequote}({stringchar}|{escape})*{doublequote} { /* quoted string */ - yylval.Str = dbmfStrdup((char *) yytext+1); - yylval.Str[strlen(yylval.Str)-1] = '\0'; - return(tokenSTRING); + yylval.Str = dbmfStrdup((char *) yytext+1); + yylval.Str[strlen(yylval.Str)-1] = '\0'; + return(tokenSTRING); } -%.* { /*C definition in recordtype*/ - yylval.Str = dbmfStrdup((char *) yytext+1); - return(tokenCDEFS); +%.* { /*C definition in recordtype*/ + yylval.Str = dbmfStrdup((char *) yytext+1); + return(tokenCDEFS); } -"{" return(yytext[0]); -"}" return(yytext[0]); -"(" return(yytext[0]); -")" return(yytext[0]); -"," return(yytext[0]); +"{" return(yytext[0]); +"}" return(yytext[0]); +"(" return(yytext[0]); +")" return(yytext[0]); +"," return(yytext[0]); {doublequote}({stringchar}|{escape})*{newline} { /* bad string */ - yyerrorAbort("Newline in string, closing quote missing"); + yyerrorAbort("Newline in string, closing quote missing"); } -"null" return jsonNULL; -"true" return jsonTRUE; -"false" return jsonFALSE; +"null" return jsonNULL; +"true" return jsonTRUE; +"false" return jsonFALSE; -{punctuation} return yytext[0]; +{punctuation} return yytext[0]; {jsondqstr} { - yylval.Str = dbmfStrdup((char *) yytext); - return jsonSTRING; + yylval.Str = dbmfStrdup((char *) yytext); + return jsonSTRING; } {number} { - yylval.Str = dbmfStrdup((char *) yytext); - return jsonNUMBER; + yylval.Str = dbmfStrdup((char *) yytext); + return jsonNUMBER; } {barechar}+ { - yylval.Str = dbmfStrdup((char *) yytext); - return jsonBARE; + yylval.Str = dbmfStrdup((char *) yytext); + return jsonBARE; } -{comment}.* ; +{comment}.* ; -{whitespace} ; +{whitespace} ; -. { - char message[40]; - YY_BUFFER_STATE *dummy=0; +. { + char message[40]; + YY_BUFFER_STATE *dummy=0; - if (isprint((int) yytext[0])) { - sprintf(message, "Invalid character '%c'", yytext[0]); - } - else { - sprintf(message, "Invalid character 0x%2.2x", yytext[0]); - } - yyerrorAbort(message); - /*The following suppresses compiler warning messages*/ - if(FALSE) yyunput('c',(unsigned char *) message); - if(FALSE) yy_switch_to_buffer(*dummy); + if (isprint((int) yytext[0])) { + sprintf(message, "Invalid character '%c'", yytext[0]); + } + else { + sprintf(message, "Invalid character 0x%2.2x", yytext[0]); + } + yyerrorAbort(message); + /*The following suppresses compiler warning messages*/ + if(FALSE) yyunput('c',(unsigned char *) message); + if(FALSE) yy_switch_to_buffer(*dummy); } %% diff --git a/modules/database/src/ioc/dbStatic/dbLexRoutines.c b/modules/database/src/ioc/dbStatic/dbLexRoutines.c index e06070b0a..91b3acc68 100644 --- a/modules/database/src/ioc/dbStatic/dbLexRoutines.c +++ b/modules/database/src/ioc/dbStatic/dbLexRoutines.c @@ -76,7 +76,7 @@ static void dbRecordtypeFieldItem(char *name,char *value); static short findOrAddGuiGroup(const char *name); static void dbDevice(char *recordtype,char *linktype, - char *dsetname,char *choicestring); + char *dsetname,char *choicestring); static void dbDriver(char *name); static void dbLinkType(char *name, char *jlif_name); static void dbRegistrar(char *name); @@ -98,11 +98,11 @@ static char *mac_input_buffer=NULL; static char *my_buffer_ptr=NULL; static MAC_HANDLE *macHandle = NULL; typedef struct inputFile{ - ELLNODE node; - char *path; - char *filename; - FILE *fp; - int line_num; + ELLNODE node; + char *path; + char *filename; + FILE *fp; + int line_num; }inputFile; static ELLLIST inputFileList = ELLLIST_INIT; @@ -110,8 +110,8 @@ static inputFile *pinputFileNow = NULL; static DBBASE *pdbbase = NULL; typedef struct tempListNode { - ELLNODE node; - void *item; + ELLNODE node; + void *item; }tempListNode; static ELLLIST tempList = ELLLIST_INIT; @@ -126,7 +126,7 @@ static void yyerrorAbort(char *str) static void allocTemp(void *pvoid) { - tempListNode *ptempListNode; + tempListNode *ptempListNode; ptempListNode = freeListCalloc(freeListPvt); ptempListNode->item = pvoid; @@ -135,8 +135,8 @@ static void allocTemp(void *pvoid) static void *popFirstTemp(void) { - tempListNode *ptempListNode; - void *ptemp; + tempListNode *ptempListNode; + void *ptemp; ptempListNode = (tempListNode *)ellFirst(&tempList); ptemp = ptempListNode->item; @@ -147,7 +147,7 @@ static void *popFirstTemp(void) static void *getLastTemp(void) { - tempListNode *ptempListNode; + tempListNode *ptempListNode; ptempListNode = (tempListNode *)ellLast(&tempList); return(ptempListNode->item); @@ -155,9 +155,9 @@ static void *getLastTemp(void) static char *dbOpenFile(DBBASE *pdbbase,const char *filename,FILE **fp) { - ELLLIST *ppathList = (ELLLIST *)pdbbase->pathPvt; - dbPathNode *pdbPathNode; - char *fullfilename; + ELLLIST *ppathList = (ELLLIST *)pdbbase->pathPvt; + dbPathNode *pdbPathNode; + char *fullfilename; *fp = 0; if (!filename) return 0; @@ -191,12 +191,12 @@ static void freeInputFileList(void) inputFile *pinputFileNow; while((pinputFileNow=(inputFile *)ellFirst(&inputFileList))) { - if(fclose(pinputFileNow->fp)) - errPrintf(0,__FILE__, __LINE__, - "Closing file %s",pinputFileNow->filename); - free((void *)pinputFileNow->filename); - ellDelete(&inputFileList,(ELLNODE *)pinputFileNow); - free((void *)pinputFileNow); + if(fclose(pinputFileNow->fp)) + errPrintf(0,__FILE__, __LINE__, + "Closing file %s",pinputFileNow->filename); + free((void *)pinputFileNow->filename); + ellDelete(&inputFileList,(ELLNODE *)pinputFileNow); + free((void *)pinputFileNow); } } @@ -210,12 +210,12 @@ int cmp_dbRecordNode(const ELLNODE *lhs, const ELLNODE *rhs) } static long dbReadCOM(DBBASE **ppdbbase,const char *filename, FILE *fp, - const char *path,const char *substitutions) + const char *path,const char *substitutions) { - long status; - inputFile *pinputFile = NULL; - char *penv; - char **macPairs; + long status; + inputFile *pinputFile = NULL; + char *penv; + char **macPairs; if (ellCount(&tempList)) { epicsPrintf("dbReadCOM: Parser stack dirty %d\n", ellCount(&tempList)); @@ -227,32 +227,32 @@ static long dbReadCOM(DBBASE **ppdbbase,const char *filename, FILE *fp, if(*ppdbbase == 0) *ppdbbase = dbAllocBase(); pdbbase = *ppdbbase; if(path && strlen(path)>0) { - dbPath(pdbbase,path); + dbPath(pdbbase,path); } else { - penv = getenv("EPICS_DB_INCLUDE_PATH"); - if(penv) { - dbPath(pdbbase,penv); - } else { - dbPath(pdbbase,"."); - } + penv = getenv("EPICS_DB_INCLUDE_PATH"); + if(penv) { + dbPath(pdbbase,penv); + } else { + dbPath(pdbbase,"."); + } } my_buffer = dbCalloc(MY_BUFFER_SIZE,sizeof(char)); freeListInitPvt(&freeListPvt,sizeof(tempListNode),100); if(substitutions) { - if(macCreateHandle(&macHandle,NULL)) { - epicsPrintf("macCreateHandle error\n"); + if(macCreateHandle(&macHandle,NULL)) { + epicsPrintf("macCreateHandle error\n"); status = -1; - goto cleanup; - } - macParseDefns(macHandle,(char *)substitutions,&macPairs); - if(macPairs ==NULL) { - macDeleteHandle(macHandle); - macHandle = NULL; - } else { - macInstallMacros(macHandle,macPairs); - free((void *)macPairs); - mac_input_buffer = dbCalloc(MY_BUFFER_SIZE,sizeof(char)); - } + goto cleanup; + } + macParseDefns(macHandle,(char *)substitutions,&macPairs); + if(macPairs ==NULL) { + macDeleteHandle(macHandle); + macHandle = NULL; + } else { + macInstallMacros(macHandle,macPairs); + free((void *)macPairs); + mac_input_buffer = dbCalloc(MY_BUFFER_SIZE,sizeof(char)); + } macSuppressWarning(macHandle,dbQuietMacroWarnings); } pinputFile = dbCalloc(1,sizeof(inputFile)); @@ -290,26 +290,26 @@ static long dbReadCOM(DBBASE **ppdbbase,const char *filename, FILE *fp, dbFreePath(pdbbase); if(!status) { /*add RTYP and VERS as an attribute */ - DBENTRY dbEntry; - DBENTRY *pdbEntry = &dbEntry; - long localStatus; + DBENTRY dbEntry; + DBENTRY *pdbEntry = &dbEntry; + long localStatus; - dbInitEntry(pdbbase,pdbEntry); - localStatus = dbFirstRecordType(pdbEntry); - while(!localStatus) { - localStatus = dbPutRecordAttribute(pdbEntry,"RTYP", - dbGetRecordTypeName(pdbEntry)); - if(!localStatus) { - localStatus = dbPutRecordAttribute(pdbEntry,"VERS", - "none specified"); - } - if(localStatus) { - fprintf(stderr,"dbPutRecordAttribute status %ld\n",status); - } else { - localStatus = dbNextRecordType(pdbEntry); - } - } - dbFinishEntry(pdbEntry); + dbInitEntry(pdbbase,pdbEntry); + localStatus = dbFirstRecordType(pdbEntry); + while(!localStatus) { + localStatus = dbPutRecordAttribute(pdbEntry,"RTYP", + dbGetRecordTypeName(pdbEntry)); + if(!localStatus) { + localStatus = dbPutRecordAttribute(pdbEntry,"VERS", + "none specified"); + } + if(localStatus) { + fprintf(stderr,"dbPutRecordAttribute status %ld\n",status); + } else { + localStatus = dbNextRecordType(pdbEntry); + } + } + dbFinishEntry(pdbEntry); } cleanup: if(dbRecordsAbcSorted) { @@ -334,48 +334,48 @@ cleanup: } long dbReadDatabase(DBBASE **ppdbbase,const char *filename, - const char *path,const char *substitutions) + const char *path,const char *substitutions) {return (dbReadCOM(ppdbbase,filename,0,path,substitutions));} long dbReadDatabaseFP(DBBASE **ppdbbase,FILE *fp, - const char *path,const char *substitutions) + const char *path,const char *substitutions) {return (dbReadCOM(ppdbbase,0,fp,path,substitutions));} static int db_yyinput(char *buf, int max_size) { size_t l,n; - char *fgetsRtn; + char *fgetsRtn; if(yyAbort) return(0); if(*my_buffer_ptr==0) { - while(TRUE) { /*until we get some input*/ - if(macHandle) { - fgetsRtn = fgets(mac_input_buffer,MY_BUFFER_SIZE, - pinputFileNow->fp); - if(fgetsRtn) { - int exp = macExpandString(macHandle,mac_input_buffer, - my_buffer,MY_BUFFER_SIZE); - if (exp < 0) { - fprintf(stderr, "Warning: '%s' line %d has undefined macros\n", - pinputFileNow->filename, pinputFileNow->line_num+1); - } - } - } else { - fgetsRtn = fgets(my_buffer,MY_BUFFER_SIZE,pinputFileNow->fp); - } - if(fgetsRtn) break; - if(fclose(pinputFileNow->fp)) - errPrintf(0,__FILE__, __LINE__, - "Closing file %s",pinputFileNow->filename); - free((void *)pinputFileNow->filename); - ellDelete(&inputFileList,(ELLNODE *)pinputFileNow); - free((void *)pinputFileNow); - pinputFileNow = (inputFile *)ellLast(&inputFileList); - if(!pinputFileNow) return(0); - } - if(dbStaticDebug) fprintf(stderr,"%s",my_buffer); - pinputFileNow->line_num++; - my_buffer_ptr = &my_buffer[0]; + while(TRUE) { /*until we get some input*/ + if(macHandle) { + fgetsRtn = fgets(mac_input_buffer,MY_BUFFER_SIZE, + pinputFileNow->fp); + if(fgetsRtn) { + int exp = macExpandString(macHandle,mac_input_buffer, + my_buffer,MY_BUFFER_SIZE); + if (exp < 0) { + fprintf(stderr, "Warning: '%s' line %d has undefined macros\n", + pinputFileNow->filename, pinputFileNow->line_num+1); + } + } + } else { + fgetsRtn = fgets(my_buffer,MY_BUFFER_SIZE,pinputFileNow->fp); + } + if(fgetsRtn) break; + if(fclose(pinputFileNow->fp)) + errPrintf(0,__FILE__, __LINE__, + "Closing file %s",pinputFileNow->filename); + free((void *)pinputFileNow->filename); + ellDelete(&inputFileList,(ELLNODE *)pinputFileNow); + free((void *)pinputFileNow); + pinputFileNow = (inputFile *)ellLast(&inputFileList); + if(!pinputFileNow) return(0); + } + if(dbStaticDebug) fprintf(stderr,"%s",my_buffer); + pinputFileNow->line_num++; + my_buffer_ptr = &my_buffer[0]; } l = strlen(my_buffer_ptr); n = (l<=max_size ? l : max_size); @@ -389,16 +389,16 @@ static void dbIncludePrint(void) inputFile *pinputFile = pinputFileNow; while (pinputFile) { - epicsPrintf(" in"); - if (pinputFile->path) - epicsPrintf(" path \"%s\" ",pinputFile->path); - if (pinputFile->filename) { - epicsPrintf(" file \"%s\"",pinputFile->filename); - } else { - epicsPrintf(" standard input"); - } - epicsPrintf(" line %d\n",pinputFile->line_num); - pinputFile = (inputFile *)ellPrevious(&pinputFile->node); + epicsPrintf(" in"); + if (pinputFile->path) + epicsPrintf(" path \"%s\" ",pinputFile->path); + if (pinputFile->filename) { + epicsPrintf(" file \"%s\"",pinputFile->filename); + } else { + epicsPrintf(" standard input"); + } + epicsPrintf(" line %d\n",pinputFile->line_num); + pinputFile = (inputFile *)ellPrevious(&pinputFile->node); } return; } @@ -415,8 +415,8 @@ static void dbAddPathCmd(char *path) static void dbIncludeNew(char *filename) { - inputFile *pinputFile; - FILE *fp; + inputFile *pinputFile; + FILE *fp; pinputFile = dbCalloc(1,sizeof(inputFile)); pinputFile->filename = macEnvExpand(filename); @@ -435,8 +435,8 @@ static void dbIncludeNew(char *filename) static void dbMenuHead(char *name) { - dbMenu *pdbMenu; - GPHENTRY *pgphentry; + dbMenu *pdbMenu; + GPHENTRY *pgphentry; if (!*name) { yyerrorAbort("dbMenuHead: Menu name can't be empty"); @@ -444,8 +444,8 @@ static void dbMenuHead(char *name) } pgphentry = gphFind(pdbbase->pgpHash,name,&pdbbase->menuList); if(pgphentry) { - duplicate = TRUE; - return; + duplicate = TRUE; + return; } if(ellCount(&tempList)) yyerrorAbort("dbMenuHead: tempList not empty"); pdbMenu = dbCalloc(1,sizeof(dbMenu)); @@ -466,45 +466,45 @@ static void dbMenuChoice(char *name,char *value) static void dbMenuBody(void) { - dbMenu *pnewMenu; - dbMenu *pMenu; - int nChoice; - int i; - GPHENTRY *pgphentry; + dbMenu *pnewMenu; + dbMenu *pMenu; + int nChoice; + int i; + GPHENTRY *pgphentry; if(duplicate) { - duplicate = FALSE; - return; + duplicate = FALSE; + return; } pnewMenu = (dbMenu *)popFirstTemp(); pnewMenu->nChoice = nChoice = ellCount(&tempList)/2; pnewMenu->papChoiceName = dbCalloc(pnewMenu->nChoice,sizeof(char *)); pnewMenu->papChoiceValue = dbCalloc(pnewMenu->nChoice,sizeof(char *)); for(i=0; ipapChoiceName[i] = (char *)popFirstTemp(); - pnewMenu->papChoiceValue[i] = (char *)popFirstTemp(); + pnewMenu->papChoiceName[i] = (char *)popFirstTemp(); + pnewMenu->papChoiceValue[i] = (char *)popFirstTemp(); } if(ellCount(&tempList)) yyerrorAbort("dbMenuBody: tempList not empty"); /* Add menu in sorted order */ pMenu = (dbMenu *)ellFirst(&pdbbase->menuList); while(pMenu && strcmp(pMenu->name,pnewMenu->name) >0 ) - pMenu = (dbMenu *)ellNext(&pMenu->node); + pMenu = (dbMenu *)ellNext(&pMenu->node); if(pMenu) - ellInsert(&pdbbase->menuList,ellPrevious(&pMenu->node),&pnewMenu->node); + ellInsert(&pdbbase->menuList,ellPrevious(&pMenu->node),&pnewMenu->node); else - ellAdd(&pdbbase->menuList,&pnewMenu->node); + ellAdd(&pdbbase->menuList,&pnewMenu->node); pgphentry = gphAdd(pdbbase->pgpHash,pnewMenu->name,&pdbbase->menuList); if(!pgphentry) { - yyerrorAbort("gphAdd failed"); + yyerrorAbort("gphAdd failed"); } else { - pgphentry->userPvt = pnewMenu; + pgphentry->userPvt = pnewMenu; } } static void dbRecordtypeHead(char *name) { - dbRecordType *pdbRecordType; - GPHENTRY *pgphentry; + dbRecordType *pdbRecordType; + GPHENTRY *pgphentry; if (!*name) { yyerrorAbort("dbRecordtypeHead: Recordtype name can't be empty"); @@ -512,21 +512,21 @@ static void dbRecordtypeHead(char *name) } pgphentry = gphFind(pdbbase->pgpHash,name,&pdbbase->recordTypeList); if(pgphentry) { - duplicate = TRUE; - return; + duplicate = TRUE; + return; } pdbRecordType = dbCalloc(1,sizeof(dbRecordType)); pdbRecordType->name = epicsStrDup(name); if (pdbbase->loadCdefs) ellInit(&pdbRecordType->cdefList); if(ellCount(&tempList)) - yyerrorAbort("dbRecordtypeHead tempList not empty"); + yyerrorAbort("dbRecordtypeHead tempList not empty"); allocTemp(pdbRecordType); } static void dbRecordtypeFieldHead(char *name,char *type) { - dbFldDes *pdbFldDes; - int i; + dbFldDes *pdbFldDes; + int i; if (!*name) { yyerrorAbort("dbRecordtypeFieldHead: Field name can't be empty"); @@ -563,7 +563,7 @@ static short findOrAddGuiGroup(const char *name) static void dbRecordtypeFieldItem(char *name,char *value) { - dbFldDes *pdbFldDes; + dbFldDes *pdbFldDes; if(duplicate) return; pdbFldDes = (dbFldDes *)getLastTemp(); @@ -590,7 +590,7 @@ static void dbRecordtypeFieldItem(char *name,char *value) return; } if(strcmp(name,"special")==0) { - int i; + int i; for(i=0; ispecial = pamapspcType[i].value; @@ -653,16 +653,16 @@ static void dbRecordtypeFieldItem(char *name,char *value) } static void dbRecordtypeCdef(char *text) { - dbText *pdbCdef; - tempListNode *ptempListNode; - dbRecordType *pdbRecordType; + dbText *pdbCdef; + tempListNode *ptempListNode; + dbRecordType *pdbRecordType; if (!pdbbase->loadCdefs || duplicate) return; ptempListNode = (tempListNode *)ellFirst(&tempList); pdbRecordType = ptempListNode->item; pdbCdef = dbCalloc(1,sizeof(dbText)); - if (text[0] == ' ') text++; /* strip leading space if present */ + if (text[0] == ' ') text++; /* strip leading space if present */ pdbCdef->text = epicsStrDup(text); ellAdd(&pdbRecordType->cdefList, &pdbCdef->node); return; @@ -675,7 +675,7 @@ static void dbRecordtypeEmpty(void) if (duplicate) { duplicate = FALSE; - return; + return; } ptempListNode = (tempListNode *)ellFirst(&tempList); @@ -687,20 +687,20 @@ static void dbRecordtypeEmpty(void) static void dbRecordtypeBody(void) { - dbRecordType *pdbRecordType; - dbFldDes *pdbFldDes; - int i,j,ilink; - GPHENTRY *pgphentry; - int no_fields,no_prompt,no_links; - dbfType field_type; - char *psortFldNameTemp; - short psortFldIndTemp; - char **papsortFldName; - short *sortFldInd; + dbRecordType *pdbRecordType; + dbFldDes *pdbFldDes; + int i,j,ilink; + GPHENTRY *pgphentry; + int no_fields,no_prompt,no_links; + dbfType field_type; + char *psortFldNameTemp; + short psortFldIndTemp; + char **papsortFldName; + short *sortFldInd; if(duplicate) { - duplicate = FALSE; - return; + duplicate = FALSE; + return; } pdbRecordType= (dbRecordType *)popFirstTemp(); pdbRecordType->no_fields = no_fields = ellCount(&tempList); @@ -709,19 +709,19 @@ static void dbRecordtypeBody(void) pdbRecordType->sortFldInd = dbCalloc(no_fields,sizeof(short)); no_prompt = no_links = 0; for(i=0; ipdbRecordType = pdbRecordType; - pdbFldDes->indRecordType = i; - pdbRecordType->papFldDes[i] = pdbFldDes; - if(pdbFldDes->promptgroup) no_prompt++; - field_type = pdbFldDes->field_type; - if((field_type>=DBF_INLINK) && (field_type<=DBF_FWDLINK))no_links++; - if((field_type==DBF_STRING) && (pdbFldDes->size==0)) - fprintf(stderr,"recordtype(%s).%s size not specified\n", - pdbRecordType->name,pdbFldDes->name); - if((field_type==DBF_NOACCESS) && (pdbFldDes->extra==0)) - fprintf(stderr,"recordtype(%s).%s extra not specified\n", - pdbRecordType->name,pdbFldDes->name); + pdbFldDes = (dbFldDes *)popFirstTemp(); + pdbFldDes->pdbRecordType = pdbRecordType; + pdbFldDes->indRecordType = i; + pdbRecordType->papFldDes[i] = pdbFldDes; + if(pdbFldDes->promptgroup) no_prompt++; + field_type = pdbFldDes->field_type; + if((field_type>=DBF_INLINK) && (field_type<=DBF_FWDLINK))no_links++; + if((field_type==DBF_STRING) && (pdbFldDes->size==0)) + fprintf(stderr,"recordtype(%s).%s size not specified\n", + pdbRecordType->name,pdbFldDes->name); + if((field_type==DBF_NOACCESS) && (pdbFldDes->extra==0)) + fprintf(stderr,"recordtype(%s).%s extra not specified\n", + pdbRecordType->name,pdbFldDes->name); } if (ellCount(&tempList)) yyerrorAbort("dbRecordtypeBody: tempList not empty"); @@ -730,79 +730,79 @@ static void dbRecordtypeBody(void) pdbRecordType->link_ind = dbCalloc(no_links,sizeof(short)); ilink = 0; for(i=0; ipapFldDes[i]; + pdbFldDes = pdbRecordType->papFldDes[i]; /* if prompt is null make it a null string */ if(!pdbFldDes->prompt) pdbFldDes->prompt = dbCalloc(1,sizeof(char)); - field_type = pdbFldDes->field_type; - if((field_type>=DBF_INLINK) && (field_type<=DBF_FWDLINK)) - pdbRecordType->link_ind[ilink++] = i; - if(strcmp(pdbFldDes->name,"VAL")==0) { - pdbRecordType->pvalFldDes = pdbRecordType->papFldDes[i]; - pdbRecordType->indvalFlddes = i; - } - pdbRecordType->papsortFldName[i] = pdbFldDes->name; - pdbRecordType->sortFldInd[i] = i; + field_type = pdbFldDes->field_type; + if((field_type>=DBF_INLINK) && (field_type<=DBF_FWDLINK)) + pdbRecordType->link_ind[ilink++] = i; + if(strcmp(pdbFldDes->name,"VAL")==0) { + pdbRecordType->pvalFldDes = pdbRecordType->papFldDes[i]; + pdbRecordType->indvalFlddes = i; + } + pdbRecordType->papsortFldName[i] = pdbFldDes->name; + pdbRecordType->sortFldInd[i] = i; } /*Now sort fields. Sorry dumb sort algorithm */ papsortFldName = pdbRecordType->papsortFldName; sortFldInd = pdbRecordType->sortFldInd; for(i=0; iattributeList); ellInit(&pdbRecordType->recList); ellInit(&pdbRecordType->devList); pgphentry = gphAdd(pdbbase->pgpHash,pdbRecordType->name, - &pdbbase->recordTypeList); + &pdbbase->recordTypeList); if(!pgphentry) { - yyerrorAbort("gphAdd failed"); + yyerrorAbort("gphAdd failed"); } else { - pgphentry->userPvt = pdbRecordType; + pgphentry->userPvt = pdbRecordType; } ellAdd(&pdbbase->recordTypeList,&pdbRecordType->node); } static void dbDevice(char *recordtype,char *linktype, - char *dsetname,char *choicestring) + char *dsetname,char *choicestring) { - devSup *pdevSup; - dbRecordType *pdbRecordType; - GPHENTRY *pgphentry; - int i,link_type; + devSup *pdevSup; + dbRecordType *pdbRecordType; + GPHENTRY *pgphentry; + int i,link_type; pgphentry = gphFind(pdbbase->pgpHash,recordtype,&pdbbase->recordTypeList); if(!pgphentry) { epicsPrintf("Record type \"%s\" not found for device \"%s\"\n", recordtype, choicestring); - yyerror(NULL); - return; + yyerror(NULL); + return; } link_type=-1; for(i=0; iuserPvt; pgphentry = gphFind(pdbbase->pgpHash,choicestring,&pdbRecordType->devList); if(pgphentry) { - return; + return; } pdevSup = dbCalloc(1,sizeof(devSup)); pdevSup->name = epicsStrDup(dsetname); @@ -810,17 +810,17 @@ static void dbDevice(char *recordtype,char *linktype, pdevSup->link_type = link_type; pgphentry = gphAdd(pdbbase->pgpHash,pdevSup->choice,&pdbRecordType->devList); if(!pgphentry) { - yyerrorAbort("gphAdd failed"); + yyerrorAbort("gphAdd failed"); } else { - pgphentry->userPvt = pdevSup; + pgphentry->userPvt = pdevSup; } ellAdd(&pdbRecordType->devList,&pdevSup->node); } static void dbDriver(char *name) { - drvSup *pdrvSup; - GPHENTRY *pgphentry; + drvSup *pdrvSup; + GPHENTRY *pgphentry; if (!*name) { yyerrorAbort("dbDriver: Driver name can't be empty"); @@ -828,13 +828,13 @@ static void dbDriver(char *name) } pgphentry = gphFind(pdbbase->pgpHash,name,&pdbbase->drvList); if(pgphentry) { - return; + return; } pdrvSup = dbCalloc(1,sizeof(drvSup)); pdrvSup->name = epicsStrDup(name); pgphentry = gphAdd(pdbbase->pgpHash,pdrvSup->name,&pdbbase->drvList); if(!pgphentry) { - yyerrorAbort("gphAdd failed"); + yyerrorAbort("gphAdd failed"); } pgphentry->userPvt = pdrvSup; ellAdd(&pdbbase->drvList,&pdrvSup->node); @@ -847,14 +847,14 @@ static void dbLinkType(char *name, char *jlif_name) pgphentry = gphFind(pdbbase->pgpHash, name, &pdbbase->linkList); if (pgphentry) { - return; + return; } pLinkSup = dbCalloc(1,sizeof(linkSup)); pLinkSup->name = epicsStrDup(name); pLinkSup->jlif_name = epicsStrDup(jlif_name); pgphentry = gphAdd(pdbbase->pgpHash, pLinkSup->name, &pdbbase->linkList); if (!pgphentry) { - yyerrorAbort("gphAdd failed"); + yyerrorAbort("gphAdd failed"); } pgphentry->userPvt = pLinkSup; ellAdd(&pdbbase->linkList, &pLinkSup->node); @@ -862,8 +862,8 @@ static void dbLinkType(char *name, char *jlif_name) static void dbRegistrar(char *name) { - dbText *ptext; - GPHENTRY *pgphentry; + dbText *ptext; + GPHENTRY *pgphentry; if (!*name) { yyerrorAbort("dbRegistrar: Registrar name can't be empty"); @@ -871,13 +871,13 @@ static void dbRegistrar(char *name) } pgphentry = gphFind(pdbbase->pgpHash,name,&pdbbase->registrarList); if(pgphentry) { - return; + return; } ptext = dbCalloc(1,sizeof(dbText)); ptext->text = epicsStrDup(name); pgphentry = gphAdd(pdbbase->pgpHash,ptext->text,&pdbbase->registrarList); if(!pgphentry) { - yyerrorAbort("gphAdd failed"); + yyerrorAbort("gphAdd failed"); } pgphentry->userPvt = ptext; ellAdd(&pdbbase->registrarList,&ptext->node); @@ -908,8 +908,8 @@ static void dbFunction(char *name) static void dbVariable(char *name, char *type) { - dbVariableDef *pvar; - GPHENTRY *pgphentry; + dbVariableDef *pvar; + GPHENTRY *pgphentry; if (!*name) { yyerrorAbort("dbVariable: Variable name can't be empty"); @@ -917,14 +917,14 @@ static void dbVariable(char *name, char *type) } pgphentry = gphFind(pdbbase->pgpHash,name,&pdbbase->variableList); if(pgphentry) { - return; + return; } pvar = dbCalloc(1,sizeof(dbVariableDef)); pvar->name = epicsStrDup(name); pvar->type = epicsStrDup(type); pgphentry = gphAdd(pdbbase->pgpHash,pvar->name,&pdbbase->variableList); if(!pgphentry) { - yyerrorAbort("gphAdd failed"); + yyerrorAbort("gphAdd failed"); } pgphentry->userPvt = pvar; ellAdd(&pdbbase->variableList,&pvar->node); @@ -932,8 +932,8 @@ static void dbVariable(char *name, char *type) static void dbBreakHead(char *name) { - brkTable *pbrkTable; - GPHENTRY *pgphentry; + brkTable *pbrkTable; + GPHENTRY *pgphentry; if (!*name) { yyerrorAbort("dbBreakHead: Breaktable name can't be empty"); @@ -941,8 +941,8 @@ static void dbBreakHead(char *name) } pgphentry = gphFind(pdbbase->pgpHash,name,&pdbbase->bptList); if(pgphentry) { - duplicate = TRUE; - return; + duplicate = TRUE; + return; } pbrkTable = dbCalloc(1,sizeof(brkTable)); pbrkTable->name = epicsStrDup(name); @@ -955,82 +955,82 @@ static void dbBreakItem(char *value) double dummy; if (duplicate) return; if (epicsScanDouble(value, &dummy) != 1) { - yyerrorAbort("Non-numeric value in breaktable"); + yyerrorAbort("Non-numeric value in breaktable"); } allocTemp(epicsStrDup(value)); } static void dbBreakBody(void) { - brkTable *pnewbrkTable; - brkInt *paBrkInt; - brkTable *pbrkTable; - int number, down=0; - int i; - GPHENTRY *pgphentry; + brkTable *pnewbrkTable; + brkInt *paBrkInt; + brkTable *pbrkTable; + int number, down=0; + int i; + GPHENTRY *pgphentry; if (duplicate) { - duplicate = FALSE; - return; + duplicate = FALSE; + return; } pnewbrkTable = (brkTable *)popFirstTemp(); number = ellCount(&tempList); if (number % 2) { - yyerrorAbort("breaktable: Raw value missing"); - return; + yyerrorAbort("breaktable: Raw value missing"); + return; } number /= 2; if (number < 2) { - yyerrorAbort("breaktable: Must have at least two points!"); - return; + yyerrorAbort("breaktable: Must have at least two points!"); + return; } pnewbrkTable->number = number; pnewbrkTable->paBrkInt = paBrkInt = dbCalloc(number, sizeof(brkInt)); for (i=0; ibptList); while (pbrkTable) { - if (strcmp(pbrkTable->name, pnewbrkTable->name) > 0) { - ellInsert(&pdbbase->bptList, ellPrevious((ELLNODE *)pbrkTable), - (ELLNODE *)pnewbrkTable); - break; - } - pbrkTable = (brkTable *)ellNext(&pbrkTable->node); + if (strcmp(pbrkTable->name, pnewbrkTable->name) > 0) { + ellInsert(&pdbbase->bptList, ellPrevious((ELLNODE *)pbrkTable), + (ELLNODE *)pnewbrkTable); + break; + } + pbrkTable = (brkTable *)ellNext(&pbrkTable->node); } if (!pbrkTable) ellAdd(&pdbbase->bptList, &pnewbrkTable->node); pgphentry = gphAdd(pdbbase->pgpHash,pnewbrkTable->name,&pdbbase->bptList); if (!pgphentry) { - yyerrorAbort("dbBreakBody: gphAdd failed"); - return; + yyerrorAbort("dbBreakBody: gphAdd failed"); + return; } pgphentry->userPvt = pnewbrkTable; } diff --git a/modules/database/src/ioc/dbStatic/dbPvdLib.c b/modules/database/src/ioc/dbStatic/dbPvdLib.c index 15fc5f401..9e1695bea 100644 --- a/modules/database/src/ioc/dbStatic/dbPvdLib.c +++ b/modules/database/src/ioc/dbStatic/dbPvdLib.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* dbPvdLib.c */ @@ -84,7 +84,7 @@ PVDENTRY *dbPvdFind(dbBase *pdbbase, const char *name, size_t lenName) dbPvd *ppvd = pdbbase->ppvd; dbPvdBucket *pbucket; PVDENTRY *ppvdNode; - + pbucket = ppvd->buckets[epicsMemHash(name, lenName, 0) & ppvd->mask]; if (pbucket == NULL) return NULL; diff --git a/modules/database/src/ioc/dbStatic/dbStaticIocRegister.c b/modules/database/src/ioc/dbStatic/dbStaticIocRegister.c index d7c02b6e0..554762504 100644 --- a/modules/database/src/ioc/dbStatic/dbStaticIocRegister.c +++ b/modules/database/src/ioc/dbStatic/dbStaticIocRegister.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include "iocsh.h" diff --git a/modules/database/src/ioc/dbStatic/dbStaticIocRegister.h b/modules/database/src/ioc/dbStatic/dbStaticIocRegister.h index 0b7ff743b..03e8ccdbe 100644 --- a/modules/database/src/ioc/dbStatic/dbStaticIocRegister.h +++ b/modules/database/src/ioc/dbStatic/dbStaticIocRegister.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef INC_dbStaticIocRegister_H diff --git a/modules/database/src/ioc/dbStatic/dbStaticLib.c b/modules/database/src/ioc/dbStatic/dbStaticLib.c index d05ca15e1..1664542d0 100644 --- a/modules/database/src/ioc/dbStatic/dbStaticLib.c +++ b/modules/database/src/ioc/dbStatic/dbStaticLib.c @@ -48,7 +48,7 @@ int dbStaticDebug = 0; static char *pNullString = ""; -#define messagesize 276 +#define messagesize 276 #define RPCL_LEN INFIX_TO_POSTFIX_SIZE(80) /* Must be big enough to hold a 64-bit integer in base 10, but in @@ -61,22 +61,22 @@ static char *ppstring[5]={" NPP"," PP"," CA"," CP"," CPP"}; static char *msstring[4]={" NMS"," MS"," MSI"," MSS"}; maplinkType pamaplinkType[LINK_NTYPES] = { - {"CONSTANT",CONSTANT}, - {"PV_LINK",PV_LINK}, - {"VME_IO",VME_IO}, - {"CAMAC_IO",CAMAC_IO}, - {"AB_IO",AB_IO}, - {"GPIB_IO",GPIB_IO}, - {"BITBUS_IO",BITBUS_IO}, - {"MACRO_LINK",MACRO_LINK}, - {"JSON_LINK",JSON_LINK}, - {"PN_LINK",PN_LINK}, - {"DB_LINK",DB_LINK}, - {"CA_LINK",CA_LINK}, - {"INST_IO",INST_IO}, - {"BBGPIB_IO",BBGPIB_IO}, - {"RF_IO",RF_IO}, - {"VXI_IO",VXI_IO} + {"CONSTANT",CONSTANT}, + {"PV_LINK",PV_LINK}, + {"VME_IO",VME_IO}, + {"CAMAC_IO",CAMAC_IO}, + {"AB_IO",AB_IO}, + {"GPIB_IO",GPIB_IO}, + {"BITBUS_IO",BITBUS_IO}, + {"MACRO_LINK",MACRO_LINK}, + {"JSON_LINK",JSON_LINK}, + {"PN_LINK",PN_LINK}, + {"DB_LINK",DB_LINK}, + {"CA_LINK",CA_LINK}, + {"INST_IO",INST_IO}, + {"BBGPIB_IO",BBGPIB_IO}, + {"RF_IO",RF_IO}, + {"VXI_IO",VXI_IO} }; /*forward references for private routines*/ @@ -111,23 +111,23 @@ void dbFreeLinkContents(struct link *plink) char *parm = NULL; switch(plink->type) { - case CONSTANT: free((void *)plink->value.constantStr); break; - case MACRO_LINK: free((void *)plink->value.macro_link.macroStr); break; - case PV_LINK: free((void *)plink->value.pv_link.pvname); break; - case JSON_LINK: - dbJLinkFree(plink->value.json.jlink); - parm = plink->value.json.string; - break; - case VME_IO: parm = plink->value.vmeio.parm; break; - case CAMAC_IO: parm = plink->value.camacio.parm; break; - case AB_IO: parm = plink->value.abio.parm; break; - case GPIB_IO: parm = plink->value.gpibio.parm; break; - case BITBUS_IO: parm = plink->value.bitbusio.parm;break; - case INST_IO: parm = plink->value.instio.string; break; - case BBGPIB_IO: parm = plink->value.bbgpibio.parm;break; - case RF_IO: break; - case VXI_IO: parm = plink->value.vxiio.parm; break; - default: + case CONSTANT: free((void *)plink->value.constantStr); break; + case MACRO_LINK: free((void *)plink->value.macro_link.macroStr); break; + case PV_LINK: free((void *)plink->value.pv_link.pvname); break; + case JSON_LINK: + dbJLinkFree(plink->value.json.jlink); + parm = plink->value.json.string; + break; + case VME_IO: parm = plink->value.vmeio.parm; break; + case CAMAC_IO: parm = plink->value.camacio.parm; break; + case AB_IO: parm = plink->value.abio.parm; break; + case GPIB_IO: parm = plink->value.gpibio.parm; break; + case BITBUS_IO: parm = plink->value.bitbusio.parm;break; + case INST_IO: parm = plink->value.instio.string; break; + case BBGPIB_IO: parm = plink->value.bbgpibio.parm;break; + case RF_IO: break; + case VXI_IO: parm = plink->value.vxiio.parm; break; + default: epicsPrintf("dbFreeLink called but link type %d unknown\n", plink->type); } if(parm && (parm != pNullString)) free((void *)parm); @@ -139,16 +139,16 @@ void dbFreeLinkContents(struct link *plink) void dbFreePath(DBBASE *pdbbase) { - ELLLIST *ppathList; - dbPathNode *pdbPathNode; + ELLLIST *ppathList; + dbPathNode *pdbPathNode; if(!pdbbase) return; ppathList = (ELLLIST *)pdbbase->pathPvt; if(!ppathList) return; while((pdbPathNode = (dbPathNode *)ellFirst(ppathList))) { - ellDelete(ppathList,&pdbPathNode->node); - free((void *)pdbPathNode->directory); - free((void *)pdbPathNode); + ellDelete(ppathList,&pdbPathNode->node); + free((void *)pdbPathNode->directory); + free((void *)pdbPathNode); } free((void *)ppathList); pdbbase->pathPvt = 0; @@ -237,14 +237,14 @@ static void realToString(double value, char *preturn, int isdouble) { static const double delta[2] = {1e-6, 1e-15}; static const int precision[2] = {6, 14}; - double absvalue; - int logval,prec; + double absvalue; + int logval,prec; size_t end; - char tstr[30]; - char *ptstr = &tstr[0]; - int round; - int ise = FALSE; - char *loce = NULL; + char tstr[30]; + char *ptstr = &tstr[0]; + int round; + int ise = FALSE; + char *loce = NULL; if (value == 0) { strcpy(preturn, "0"); @@ -335,23 +335,23 @@ static void doubleToString(double value, char *preturn) /*Public only for dbStaticNoRun*/ dbDeviceMenu *dbGetDeviceMenu(DBENTRY *pdbentry) { - dbRecordType *precordType = pdbentry->precordType; - dbFldDes *pflddes = pdbentry->pflddes; - dbDeviceMenu *pdbDeviceMenu; - devSup *pdevSup; - int ind; - int nChoice; + dbRecordType *precordType = pdbentry->precordType; + dbFldDes *pflddes = pdbentry->pflddes; + dbDeviceMenu *pdbDeviceMenu; + devSup *pdevSup; + int ind; + int nChoice; if(!precordType) return(NULL); if(!pflddes) return(NULL); if(pflddes->field_type!=DBF_DEVICE) return(NULL); if(pflddes->ftPvt){ - pdbDeviceMenu = (dbDeviceMenu *)pflddes->ftPvt; - if(pdbDeviceMenu->nChoice == ellCount(&precordType->devList)) - return(pdbDeviceMenu); - free((void *)pdbDeviceMenu->papChoice); - free((void *)pdbDeviceMenu); - pflddes->ftPvt = NULL; + pdbDeviceMenu = (dbDeviceMenu *)pflddes->ftPvt; + if(pdbDeviceMenu->nChoice == ellCount(&precordType->devList)) + return(pdbDeviceMenu); + free((void *)pdbDeviceMenu->papChoice); + free((void *)pdbDeviceMenu); + pflddes->ftPvt = NULL; } nChoice = ellCount(&precordType->devList); if(nChoice <= 0) return(NULL); @@ -361,9 +361,9 @@ dbDeviceMenu *dbGetDeviceMenu(DBENTRY *pdbentry) pdevSup = (devSup *)ellFirst(&precordType->devList); ind = 0; while(pdevSup) { - pdbDeviceMenu->papChoice[ind] = pdevSup->choice; - ind++; - pdevSup = (devSup *)ellNext(&pdevSup->node); + pdbDeviceMenu->papChoice[ind] = pdevSup->choice; + ind++; + pdevSup = (devSup *)ellNext(&pdevSup->node); } pflddes->ftPvt = pdbDeviceMenu; return(pdbDeviceMenu); @@ -371,27 +371,27 @@ dbDeviceMenu *dbGetDeviceMenu(DBENTRY *pdbentry) /* Beginning of Public Routines */ -#define INC_SIZE 256 +#define INC_SIZE 256 void dbCatString(char **string,int *stringLength,char *src,char *separator) { if((*string==NULL) || ((strlen(*string)+strlen(src)+2) > (size_t)*stringLength)) { - char *newString; - size_t size; + char *newString; + size_t size; size = strlen(src); - if(*string) size += strlen(*string); - /*Make size multiple of INC_SIZE*/ - size = ((size + 2 + INC_SIZE)/INC_SIZE) * INC_SIZE; - newString = dbCalloc(size,sizeof(char)); - if(*string) { - strcpy(newString,*string); - free((void *)(*string)); - } - *string = newString; + if(*string) size += strlen(*string); + /*Make size multiple of INC_SIZE*/ + size = ((size + 2 + INC_SIZE)/INC_SIZE) * INC_SIZE; + newString = dbCalloc(size,sizeof(char)); + if(*string) { + strcpy(newString,*string); + free((void *)(*string)); + } + *string = newString; } if(*stringLength>0) { - strcat(*string,separator); + strcat(*string,separator); *stringLength += (int) strlen(separator); } strcat(*string,src); @@ -400,7 +400,7 @@ void dbCatString(char **string,int *stringLength,char *src,char *separator) dbBase * dbAllocBase(void) { - dbBase *pdbbase; + dbBase *pdbbase; pdbbase = dbCalloc(1,sizeof(dbBase)); ellInit(&pdbbase->menuList); @@ -418,30 +418,30 @@ dbBase * dbAllocBase(void) } void dbFreeBase(dbBase *pdbbase) { - dbMenu *pdbMenu; - dbMenu *pdbMenuNext; - dbRecordType *pdbRecordType; - dbRecordType *pdbRecordTypeNext; - dbFldDes * pdbFldDes; - dbRecordAttribute *pAttribute; - dbRecordAttribute *pAttributeNext; - devSup *pdevSup; - devSup *pdevSupNext; - dbText *ptext; - dbText *ptextNext; + dbMenu *pdbMenu; + dbMenu *pdbMenuNext; + dbRecordType *pdbRecordType; + dbRecordType *pdbRecordTypeNext; + dbFldDes *pdbFldDes; + dbRecordAttribute *pAttribute; + dbRecordAttribute *pAttributeNext; + devSup *pdevSup; + devSup *pdevSupNext; + dbText *ptext; + dbText *ptextNext; dbVariableDef *pvar; dbVariableDef *pvarNext; - drvSup *pdrvSup; - drvSup *pdrvSupNext; - linkSup *plinkSup; - brkTable *pbrkTable; - brkTable *pbrkTableNext; - chFilterPlugin *pfilt; - chFilterPlugin *pfiltNext; - dbGuiGroup *pguiGroup; - dbGuiGroup *pguiGroupNext; - int i; - DBENTRY dbentry; + drvSup *pdrvSup; + drvSup *pdrvSupNext; + linkSup *plinkSup; + brkTable *pbrkTable; + brkTable *pbrkTableNext; + chFilterPlugin *pfilt; + chFilterPlugin *pfiltNext; + dbGuiGroup *pguiGroup; + dbGuiGroup *pguiGroupNext; + int i; + DBENTRY dbentry; long status; dbInitEntry(pdbbase,&dbentry); @@ -632,8 +632,8 @@ void dbInitEntry(dbBase *pdbbase,DBENTRY *pdbentry) void dbFinishEntry(DBENTRY *pdbentry) { if(pdbentry->message) { - free((void *)pdbentry->message); - pdbentry->message = NULL; + free((void *)pdbentry->message); + pdbentry->message = NULL; } } @@ -664,64 +664,64 @@ long dbPath(DBBASE *pdbbase,const char *path) long dbAddPath(DBBASE *pdbbase,const char *path) { - ELLLIST *ppathList; - const char *pcolon; - const char *plast; - unsigned expectingPath; - unsigned sawMissingPath; + ELLLIST *ppathList; + const char *pcolon; + const char *plast; + unsigned expectingPath; + unsigned sawMissingPath; if(!pdbbase) return(-1); ppathList = (ELLLIST *)pdbbase->pathPvt; if(!ppathList) { - ppathList = dbCalloc(1,sizeof(ELLLIST)); - ellInit(ppathList); - pdbbase->pathPvt = (void *)ppathList; + ppathList = dbCalloc(1,sizeof(ELLLIST)); + ellInit(ppathList); + pdbbase->pathPvt = (void *)ppathList; } if (!path) return(0); /* Empty path strings are ignored */ /* care is taken to properly deal with white space * 1) preceding and trailing white space is removed from paths * 2) white space inbetween path separator counts as an empty name - * (see below) + * (see below) */ expectingPath = FALSE; sawMissingPath = FALSE; while (*path) { - size_t len; + size_t len; - /* preceding white space is removed */ - if (isspace((int)*path)) { - path++; - continue; - } - pcolon = strstr (path, OSI_PATH_LIST_SEPARATOR); - if (pcolon==path) { - sawMissingPath = TRUE; - path += strlen (OSI_PATH_LIST_SEPARATOR); - continue; - } - if (pcolon) { - plast = pcolon - 1; - expectingPath = TRUE; - } else { - plast = strlen (path) + path - 1; - expectingPath = FALSE; - } - /* trailing white space is removed */ - while (isspace((int)*plast)) { - plast--; - } + /* preceding white space is removed */ + if (isspace((int)*path)) { + path++; + continue; + } + pcolon = strstr (path, OSI_PATH_LIST_SEPARATOR); + if (pcolon==path) { + sawMissingPath = TRUE; + path += strlen (OSI_PATH_LIST_SEPARATOR); + continue; + } + if (pcolon) { + plast = pcolon - 1; + expectingPath = TRUE; + } else { + plast = strlen (path) + path - 1; + expectingPath = FALSE; + } + /* trailing white space is removed */ + while (isspace((int)*plast)) { + plast--; + } - /* - * len is always nonzero because we found something that - * 1) isnt white space - * 2) isnt a path separator - */ - len = (plast - path) + 1; - if (dbAddOnePath (pdbbase, path, (unsigned) len)) return (-1); - path += len; - if (pcolon) { - path += strlen(OSI_PATH_LIST_SEPARATOR); - } + /* + * len is always nonzero because we found something that + * 1) isnt white space + * 2) isnt a path separator + */ + len = (plast - path) + 1; + if (dbAddOnePath (pdbbase, path, (unsigned) len)) return (-1); + path += len; + if (pcolon) { + path += strlen(OSI_PATH_LIST_SEPARATOR); + } } /* @@ -729,15 +729,15 @@ long dbAddPath(DBBASE *pdbbase,const char *path) * empty means current directory */ if (expectingPath||sawMissingPath) { - return dbAddOnePath (pdbbase, ".", 1); + return dbAddOnePath (pdbbase, ".", 1); } return(0); } static long dbAddOnePath (DBBASE *pdbbase, const char *path, unsigned length) { - ELLLIST *ppathList; - dbPathNode *pdbPathNode; + ELLLIST *ppathList; + dbPathNode *pdbPathNode; if(!pdbbase) return(-1); ppathList = (ELLLIST *)pdbbase->pathPvt; @@ -777,7 +777,7 @@ short dbGetPromptGroupKeyFromName(DBBASE *pdbbase, const char *name) long dbWriteRecord(DBBASE *ppdbbase,const char *filename, - const char *precordTypename,int level) + const char *precordTypename,int level) { FILE *stream; long status; @@ -792,10 +792,10 @@ long dbWriteRecord(DBBASE *ppdbbase,const char *filename, long dbWriteRecordFP( DBBASE *pdbbase,FILE *fp,const char *precordTypename,int level) { - DBENTRY dbentry; - DBENTRY *pdbentry=&dbentry; - long status; - int dctonly; + DBENTRY dbentry; + DBENTRY *pdbentry=&dbentry; + long status; + int dctonly; dctonly = ((level>1) ? FALSE : TRUE); dbInitEntry(pdbbase,pdbentry); @@ -805,66 +805,66 @@ long dbWriteRecordFP( } if(!precordTypename) { - status = dbFirstRecordType(pdbentry); - if(status) { - /* No record descriptions, so no record instances */ - dbFinishEntry(pdbentry); - return(0); - } + status = dbFirstRecordType(pdbentry); + if(status) { + /* No record descriptions, so no record instances */ + dbFinishEntry(pdbentry); + return(0); + } } else { - status = dbFindRecordType(pdbentry,precordTypename); - if(status) { - fprintf(stderr,"dbWriteRecordFP: No record description for %s\n", - precordTypename); - dbFinishEntry(pdbentry); - return(status); - } + status = dbFindRecordType(pdbentry,precordTypename); + if(status) { + fprintf(stderr,"dbWriteRecordFP: No record description for %s\n", + precordTypename); + dbFinishEntry(pdbentry); + return(status); + } } while(!status) { - status = dbFirstRecord(pdbentry); - while(!status) { + status = dbFirstRecord(pdbentry); + while(!status) { if (dbIsAlias(pdbentry)) { status = dbNextRecord(pdbentry); continue; } - if(dbIsVisibleRecord(pdbentry)) - fprintf(fp,"grecord(%s,\"%s\") {\n", - dbGetRecordTypeName(pdbentry),dbGetRecordName(pdbentry)); - else - fprintf(fp,"record(%s,\"%s\") {\n", - dbGetRecordTypeName(pdbentry),dbGetRecordName(pdbentry)); - status = dbFirstField(pdbentry,dctonly); - while(!status) { - if (!dbIsDefaultValue(pdbentry) || level>0) { - char *pvalstring = dbGetString(pdbentry); + if(dbIsVisibleRecord(pdbentry)) + fprintf(fp,"grecord(%s,\"%s\") {\n", + dbGetRecordTypeName(pdbentry),dbGetRecordName(pdbentry)); + else + fprintf(fp,"record(%s,\"%s\") {\n", + dbGetRecordTypeName(pdbentry),dbGetRecordName(pdbentry)); + status = dbFirstField(pdbentry,dctonly); + while(!status) { + if (!dbIsDefaultValue(pdbentry) || level>0) { + char *pvalstring = dbGetString(pdbentry); - if (!pvalstring) { - fprintf(fp,"\tfield(%s,\"\")\n", - dbGetFieldName(pdbentry)); - } else { - fprintf(fp,"\tfield(%s,\"", - dbGetFieldName(pdbentry)); - epicsStrPrintEscaped(fp,pvalstring,strlen(pvalstring)); - fprintf(fp,"\")\n"); - } - } else if(level>0) { /*generate 0 length string*/ - fprintf(fp,"\tfield(%s,\"\")\n",dbGetFieldName(pdbentry)); - } - status=dbNextField(pdbentry,dctonly); - } - status = dbFirstInfo(pdbentry); - while (!status) { - const char *pinfostr = dbGetInfoString(pdbentry); + if (!pvalstring) { + fprintf(fp,"\tfield(%s,\"\")\n", + dbGetFieldName(pdbentry)); + } else { + fprintf(fp,"\tfield(%s,\"", + dbGetFieldName(pdbentry)); + epicsStrPrintEscaped(fp,pvalstring,strlen(pvalstring)); + fprintf(fp,"\")\n"); + } + } else if(level>0) { /*generate 0 length string*/ + fprintf(fp,"\tfield(%s,\"\")\n",dbGetFieldName(pdbentry)); + } + status=dbNextField(pdbentry,dctonly); + } + status = dbFirstInfo(pdbentry); + while (!status) { + const char *pinfostr = dbGetInfoString(pdbentry); - fprintf(fp, "\tinfo(\"%s\",\"", - dbGetInfoName(pdbentry)); - epicsStrPrintEscaped(fp, pinfostr, strlen(pinfostr)); - fprintf(fp, "\")\n"); - status = dbNextInfo(pdbentry); - } - fprintf(fp,"}\n"); - status = dbNextRecord(pdbentry); - } + fprintf(fp, "\tinfo(\"%s\",\"", + dbGetInfoName(pdbentry)); + epicsStrPrintEscaped(fp, pinfostr, strlen(pinfostr)); + fprintf(fp, "\")\n"); + status = dbNextInfo(pdbentry); + } + fprintf(fp,"}\n"); + status = dbNextRecord(pdbentry); + } status = dbFirstRecord(pdbentry); while (!status) { if (!dbIsAlias(pdbentry)) { @@ -875,8 +875,8 @@ long dbWriteRecordFP( dbRecordName(pdbentry), dbGetRecordName(pdbentry)); status = dbNextRecord(pdbentry); } - if(precordTypename) break; - status = dbNextRecordType(pdbentry); + if(precordTypename) break; + status = dbNextRecordType(pdbentry); } dbFinishEntry(pdbentry); return(0); @@ -896,13 +896,13 @@ long dbWriteMenu( long dbWriteMenuFP(DBBASE *pdbbase,FILE *fp,const char *menuName) { - dbMenu *pdbMenu; - int gotMatch; - int i; + dbMenu *pdbMenu; + int gotMatch; + int i; if(!pdbbase) { - fprintf(stderr,"pdbbase not specified\n"); - return(-1); + fprintf(stderr,"pdbbase not specified\n"); + return(-1); } if (menuName) { if (*menuName == 0 || *menuName == '*') @@ -910,21 +910,21 @@ long dbWriteMenuFP(DBBASE *pdbbase,FILE *fp,const char *menuName) } pdbMenu = (dbMenu *)ellFirst(&pdbbase->menuList); while(pdbMenu) { - if(menuName) { - gotMatch = (strcmp(menuName,pdbMenu->name)==0) ? TRUE : FALSE; - }else { - gotMatch=TRUE; - } - if(gotMatch) { - fprintf(fp,"menu(%s) {\n",pdbMenu->name); - for(i=0; inChoice; i++) { - fprintf(fp,"\tchoice(%s,\"%s\")\n",pdbMenu->papChoiceName[i], - pdbMenu->papChoiceValue[i]); - } - fprintf(fp,"}\n"); - if(menuName) break; - } - pdbMenu = (dbMenu *)ellNext(&pdbMenu->node); + if(menuName) { + gotMatch = (strcmp(menuName,pdbMenu->name)==0) ? TRUE : FALSE; + }else { + gotMatch=TRUE; + } + if(gotMatch) { + fprintf(fp,"menu(%s) {\n",pdbMenu->name); + for(i=0; inChoice; i++) { + fprintf(fp,"\tchoice(%s,\"%s\")\n",pdbMenu->papChoiceName[i], + pdbMenu->papChoiceValue[i]); + } + fprintf(fp,"}\n"); + if(menuName) break; + } + pdbMenu = (dbMenu *)ellNext(&pdbMenu->node); } return(0); } @@ -944,14 +944,14 @@ long dbWriteRecordType( long dbWriteRecordTypeFP( DBBASE *pdbbase,FILE *fp,const char *recordTypeName) { - dbRecordType *pdbRecordType; - dbFldDes *pdbFldDes; - int gotMatch; - int i; + dbRecordType *pdbRecordType; + dbFldDes *pdbFldDes; + int gotMatch; + int i; if(!pdbbase) { - fprintf(stderr,"pdbbase not specified\n"); - return(-1); + fprintf(stderr,"pdbbase not specified\n"); + return(-1); } if (recordTypeName) { if (*recordTypeName == 0 || *recordTypeName == '*') @@ -960,62 +960,62 @@ long dbWriteRecordTypeFP( for(pdbRecordType = (dbRecordType *)ellFirst(&pdbbase->recordTypeList); pdbRecordType; pdbRecordType = (dbRecordType *)ellNext(&pdbRecordType->node)) { - if(recordTypeName) { - gotMatch = (strcmp(recordTypeName,pdbRecordType->name)==0) - ? TRUE : FALSE; - }else { - gotMatch=TRUE; - } - if(!gotMatch) continue; - fprintf(fp,"recordtype(%s) {\n",pdbRecordType->name); - for(i=0; ino_fields; i++) { - int j; + if(recordTypeName) { + gotMatch = (strcmp(recordTypeName,pdbRecordType->name)==0) + ? TRUE : FALSE; + }else { + gotMatch=TRUE; + } + if(!gotMatch) continue; + fprintf(fp,"recordtype(%s) {\n",pdbRecordType->name); + for(i=0; ino_fields; i++) { + int j; - pdbFldDes = pdbRecordType->papFldDes[i]; - fprintf(fp,"\tfield(%s,%s) {\n",pdbFldDes->name, - dbGetFieldTypeString(pdbFldDes->field_type)); - if(pdbFldDes->prompt) - fprintf(fp,"\t\tprompt(\"%s\")\n",pdbFldDes->prompt); - if(pdbFldDes->initial) - fprintf(fp,"\t\tinitial(\"%s\")\n",pdbFldDes->initial); + pdbFldDes = pdbRecordType->papFldDes[i]; + fprintf(fp,"\tfield(%s,%s) {\n",pdbFldDes->name, + dbGetFieldTypeString(pdbFldDes->field_type)); + if(pdbFldDes->prompt) + fprintf(fp,"\t\tprompt(\"%s\")\n",pdbFldDes->prompt); + if(pdbFldDes->initial) + fprintf(fp,"\t\tinitial(\"%s\")\n",pdbFldDes->initial); if (pdbFldDes->promptgroup) { fprintf(fp,"\t\tpromptgroup(\"%s\")\n", dbGetPromptGroupNameFromKey(pdbbase, pdbFldDes->promptgroup)); } if(pdbFldDes->special) { - if(pdbFldDes->special >= SPC_NTYPES) { - fprintf(fp,"\t\tspecial(%d)\n",pdbFldDes->special); - } else for(j=0; jspecial) { - fprintf(fp,"\t\tspecial(%s)\n", - pamapspcType[j].strvalue); - break; - } - } - } - if(pdbFldDes->extra) - fprintf(fp,"\t\textra(\"%s\")\n",pdbFldDes->extra); - if(pdbFldDes->field_type==DBF_MENU) { - if(pdbFldDes->ftPvt) - fprintf(fp,"\t\tmenu(%s)\n", - ((dbMenu *)pdbFldDes->ftPvt)->name); - else - fprintf(stderr,"\t\t menu: NOT FOUND\n"); - } - if(pdbFldDes->field_type==DBF_STRING) { - fprintf(fp,"\t\tsize(%d)\n", - pdbFldDes->size); - } - if(pdbFldDes->process_passive) fprintf(fp,"\t\tpp(TRUE)\n"); - if(pdbFldDes->prop) fprintf(fp,"\t\tprop(YES)\n"); - if(pdbFldDes->base) fprintf(fp,"\t\tbase(HEX)\n"); - if(pdbFldDes->interest) - fprintf(fp,"\t\tinterest(%d)\n",pdbFldDes->interest); - if(!pdbFldDes->as_level) fprintf(fp,"\t\tasl(ASL0)\n"); - fprintf(fp,"\t}\n"); - } - fprintf(fp,"}\n"); - if(recordTypeName) break; + if(pdbFldDes->special >= SPC_NTYPES) { + fprintf(fp,"\t\tspecial(%d)\n",pdbFldDes->special); + } else for(j=0; jspecial) { + fprintf(fp,"\t\tspecial(%s)\n", + pamapspcType[j].strvalue); + break; + } + } + } + if(pdbFldDes->extra) + fprintf(fp,"\t\textra(\"%s\")\n",pdbFldDes->extra); + if(pdbFldDes->field_type==DBF_MENU) { + if(pdbFldDes->ftPvt) + fprintf(fp,"\t\tmenu(%s)\n", + ((dbMenu *)pdbFldDes->ftPvt)->name); + else + fprintf(stderr,"\t\t menu: NOT FOUND\n"); + } + if(pdbFldDes->field_type==DBF_STRING) { + fprintf(fp,"\t\tsize(%d)\n", + pdbFldDes->size); + } + if(pdbFldDes->process_passive) fprintf(fp,"\t\tpp(TRUE)\n"); + if(pdbFldDes->prop) fprintf(fp,"\t\tprop(YES)\n"); + if(pdbFldDes->base) fprintf(fp,"\t\tbase(HEX)\n"); + if(pdbFldDes->interest) + fprintf(fp,"\t\tinterest(%d)\n",pdbFldDes->interest); + if(!pdbFldDes->as_level) fprintf(fp,"\t\tasl(ASL0)\n"); + fprintf(fp,"\t}\n"); + } + fprintf(fp,"}\n"); + if(recordTypeName) break; } return(0); } @@ -1033,31 +1033,31 @@ long dbWriteDevice(DBBASE *pdbbase,const char *filename) long dbWriteDeviceFP(DBBASE *pdbbase,FILE *fp) { - dbRecordType *pdbRecordType; - devSup *pdevSup; + dbRecordType *pdbRecordType; + devSup *pdevSup; if(!pdbbase) { - fprintf(stderr,"dbWriteDeviceFP: pdbbase not specified\n"); - return(-1); + fprintf(stderr,"dbWriteDeviceFP: pdbbase not specified\n"); + return(-1); } for(pdbRecordType = (dbRecordType *)ellFirst(&pdbbase->recordTypeList); pdbRecordType; pdbRecordType = (dbRecordType *)ellNext(&pdbRecordType->node)) { - for(pdevSup = (devSup *)ellFirst(&pdbRecordType->devList); - pdevSup; pdevSup = (devSup *)ellNext(&pdevSup->node)) { - int j; + for(pdevSup = (devSup *)ellFirst(&pdbRecordType->devList); + pdevSup; pdevSup = (devSup *)ellNext(&pdevSup->node)) { + int j; - for(j=0; j< LINK_NTYPES; j++) { - if(pamaplinkType[j].value==pdevSup->link_type) break; - } - if(j>=LINK_NTYPES) { - fprintf(fp,"link_type not valid\n"); - continue; - } - fprintf(fp,"device(%s,%s,%s,\"%s\")\n", - pdbRecordType->name, - pamaplinkType[j].strvalue, - pdevSup->name,pdevSup->choice); - } + for(j=0; j< LINK_NTYPES; j++) { + if(pamaplinkType[j].value==pdevSup->link_type) break; + } + if(j>=LINK_NTYPES) { + fprintf(fp,"link_type not valid\n"); + continue; + } + fprintf(fp,"device(%s,%s,%s,\"%s\")\n", + pdbRecordType->name, + pamaplinkType[j].strvalue, + pdevSup->name,pdevSup->choice); + } } return(0); } @@ -1075,15 +1075,15 @@ long dbWriteDriver(DBBASE *pdbbase,const char *filename) long dbWriteDriverFP(DBBASE *pdbbase,FILE *fp) { - drvSup *pdrvSup; + drvSup *pdrvSup; if(!pdbbase) { - fprintf(stderr,"pdbbase not specified\n"); - return(-1); + fprintf(stderr,"pdbbase not specified\n"); + return(-1); } for(pdrvSup = (drvSup *)ellFirst(&pdbbase->drvList); pdrvSup; pdrvSup = (drvSup *)ellNext(&pdrvSup->node)) { - fprintf(fp,"driver(%s)\n",pdrvSup->name); + fprintf(fp,"driver(%s)\n",pdrvSup->name); } return(0); } @@ -1093,27 +1093,27 @@ long dbWriteLinkFP(DBBASE *pdbbase, FILE *fp) linkSup *plinkSup; if (!pdbbase) { - fprintf(stderr, "pdbbase not specified\n"); - return -1; + fprintf(stderr, "pdbbase not specified\n"); + return -1; } for (plinkSup = (linkSup *) ellFirst(&pdbbase->linkList); plinkSup; plinkSup = (linkSup *) ellNext(&plinkSup->node)) { - fprintf(fp, "link(%s,%s)\n", plinkSup->name, plinkSup->jlif_name); + fprintf(fp, "link(%s,%s)\n", plinkSup->name, plinkSup->jlif_name); } return 0; } long dbWriteRegistrarFP(DBBASE *pdbbase,FILE *fp) { - dbText *ptext; + dbText *ptext; if(!pdbbase) { - fprintf(stderr,"pdbbase not specified\n"); - return(-1); + fprintf(stderr,"pdbbase not specified\n"); + return(-1); } for(ptext = (dbText *)ellFirst(&pdbbase->registrarList); ptext; ptext = (dbText *)ellNext(&ptext->node)) { - fprintf(fp,"registrar(%s)\n",ptext->text); + fprintf(fp,"registrar(%s)\n",ptext->text); } return(0); } @@ -1123,27 +1123,27 @@ long dbWriteFunctionFP(DBBASE *pdbbase,FILE *fp) dbText *ptext; if(!pdbbase) { - fprintf(stderr,"pdbbase not specified\n"); - return(-1); + fprintf(stderr,"pdbbase not specified\n"); + return(-1); } for(ptext = (dbText *)ellFirst(&pdbbase->functionList); ptext; ptext = (dbText *)ellNext(&ptext->node)) { - fprintf(fp,"function(%s)\n",ptext->text); + fprintf(fp,"function(%s)\n",ptext->text); } return(0); } long dbWriteVariableFP(DBBASE *pdbbase,FILE *fp) { - dbVariableDef *pvar; + dbVariableDef *pvar; if(!pdbbase) { - fprintf(stderr,"pdbbase not specified\n"); - return(-1); + fprintf(stderr,"pdbbase not specified\n"); + return(-1); } for(pvar = (dbVariableDef *)ellFirst(&pdbbase->variableList); pvar; pvar = (dbVariableDef *)ellNext(&pvar->node)) { - fprintf(fp,"variable(%s,%s)\n",pvar->name,pvar->type); + fprintf(fp,"variable(%s,%s)\n",pvar->name,pvar->type); } return(0); } @@ -1161,32 +1161,32 @@ long dbWriteBreaktable(DBBASE *pdbbase,const char *filename) long dbWriteBreaktableFP(DBBASE *pdbbase,FILE *fp) { - brkTable *pbrkTable; - brkInt *pbrkInt; - int i; + brkTable *pbrkTable; + brkInt *pbrkInt; + int i; if (!pdbbase) { - fprintf(stderr,"pdbbase not specified\n"); - return(-1); + fprintf(stderr,"pdbbase not specified\n"); + return(-1); } for (pbrkTable = (brkTable *)ellFirst(&pdbbase->bptList); - pbrkTable; - pbrkTable = (brkTable *)ellNext(&pbrkTable->node)) { - fprintf(fp,"breaktable(%s) {\n",pbrkTable->name); - pbrkInt = pbrkTable->paBrkInt; - for(i=0; i < pbrkTable->number; i++) { - fprintf(fp,"\t%e, %e\n",pbrkInt->raw,pbrkInt->eng); - pbrkInt++; - } - fprintf(fp,"}\n"); + pbrkTable; + pbrkTable = (brkTable *)ellNext(&pbrkTable->node)) { + fprintf(fp,"breaktable(%s) {\n",pbrkTable->name); + pbrkInt = pbrkTable->paBrkInt; + for(i=0; i < pbrkTable->number; i++) { + fprintf(fp,"\t%e, %e\n",pbrkInt->raw,pbrkInt->eng); + pbrkInt++; + } + fprintf(fp,"}\n"); } return(0); } long dbFindRecordType(DBENTRY *pdbentry,const char *recordType) { - dbBase *pdbbase = pdbentry->pdbbase; - GPHENTRY *phash; + dbBase *pdbbase = pdbentry->pdbbase; + GPHENTRY *phash; zeroDbentry(pdbentry); phash = gphFind(pdbbase->pgpHash,recordType,&pdbbase->recordTypeList); @@ -1230,44 +1230,44 @@ int dbGetNRecordTypes(DBENTRY *pdbentry) long dbPutRecordAttribute( DBENTRY *pdbentry, const char *name, const char*value) { - dbRecordType *precordType = pdbentry->precordType; - int createNew = TRUE; - int compare; - dbRecordAttribute *pattribute; + dbRecordType *precordType = pdbentry->precordType; + int createNew = TRUE; + int compare; + dbRecordAttribute *pattribute; if(!precordType) return(S_dbLib_recordTypeNotFound); pattribute = (dbRecordAttribute *)ellFirst(&precordType->attributeList); /*put new attribute name in sort order*/ while(pattribute) { - compare = strcmp(pattribute->name,name); - if(compare==0) { - createNew = FALSE; - } - if(compare>=0) break; - pattribute = (dbRecordAttribute *)ellNext(&pattribute->node); + compare = strcmp(pattribute->name,name); + if(compare==0) { + createNew = FALSE; + } + if(compare>=0) break; + pattribute = (dbRecordAttribute *)ellNext(&pattribute->node); } if(createNew) { - dbRecordAttribute *pnew; - dbFldDes *pdbFldDes; + dbRecordAttribute *pnew; + dbFldDes *pdbFldDes; - pnew = dbCalloc(1,sizeof(dbRecordAttribute)); - if(pattribute) { - ellInsert(&precordType->attributeList,pattribute->node.previous, - &pnew->node); - } else { - ellAdd(&precordType->attributeList,&pnew->node); - } - pattribute = pnew; - pattribute->name = dbCalloc(strlen(name)+1,sizeof(char)); - strcpy(pattribute->name,name); - pdbFldDes = dbCalloc(1,sizeof(dbFldDes)); - pdbFldDes->name = pattribute->name; - pdbFldDes->pdbRecordType = precordType; - pdbFldDes->special = SPC_ATTRIBUTE; - pdbFldDes->field_type = DBF_STRING; - pdbFldDes->as_level = ASL1; - pdbFldDes->size = MAX_STRING_SIZE; - pattribute->pdbFldDes = pdbFldDes; + pnew = dbCalloc(1,sizeof(dbRecordAttribute)); + if(pattribute) { + ellInsert(&precordType->attributeList,pattribute->node.previous, + &pnew->node); + } else { + ellAdd(&precordType->attributeList,&pnew->node); + } + pattribute = pnew; + pattribute->name = dbCalloc(strlen(name)+1,sizeof(char)); + strcpy(pattribute->name,name); + pdbFldDes = dbCalloc(1,sizeof(dbFldDes)); + pdbFldDes->name = pattribute->name; + pdbFldDes->pdbRecordType = precordType; + pdbFldDes->special = SPC_ATTRIBUTE; + pdbFldDes->field_type = DBF_STRING; + pdbFldDes->as_level = ASL1; + pdbFldDes->size = MAX_STRING_SIZE; + pattribute->pdbFldDes = pdbFldDes; } strncpy(pattribute->value,value,MAX_STRING_SIZE); pattribute->value[MAX_STRING_SIZE-1] = 0; @@ -1322,60 +1322,60 @@ long dbFirstField(DBENTRY *pdbentry,int dctonly) long dbNextField(DBENTRY *pdbentry,int dctonly) { - dbRecordType *precordType = pdbentry->precordType; - dbRecordNode *precnode = pdbentry->precnode; - dbFldDes *pflddes; - short indfield = pdbentry->indfield; + dbRecordType *precordType = pdbentry->precordType; + dbRecordNode *precnode = pdbentry->precnode; + dbFldDes *pflddes; + short indfield = pdbentry->indfield; if(!precordType) return(S_dbLib_recordTypeNotFound); indfield++; while(TRUE) { - if(indfield>=precordType->no_fields) { - pdbentry->indfield = 0; - pdbentry->pflddes = NULL; - pdbentry->pfield = NULL; - return(S_dbLib_fieldNotFound); - } - pflddes = precordType->papFldDes[indfield]; - if(!dctonly || pflddes->promptgroup) { - /*Skip field if dctonly and no device support*/ - if(!dctonly || (pflddes->field_type!=DBF_DEVICE) - || (ellCount(&precordType->devList)>0)) { - pdbentry->indfield = indfield; - pdbentry->pflddes = pflddes; - pdbentry->indfield = indfield; - if(precnode) { - dbGetFieldAddress(pdbentry); - }else { - pdbentry->pfield = NULL; - } - return(0); - } - } - indfield++; + if(indfield>=precordType->no_fields) { + pdbentry->indfield = 0; + pdbentry->pflddes = NULL; + pdbentry->pfield = NULL; + return(S_dbLib_fieldNotFound); + } + pflddes = precordType->papFldDes[indfield]; + if(!dctonly || pflddes->promptgroup) { + /*Skip field if dctonly and no device support*/ + if(!dctonly || (pflddes->field_type!=DBF_DEVICE) + || (ellCount(&precordType->devList)>0)) { + pdbentry->indfield = indfield; + pdbentry->pflddes = pflddes; + pdbentry->indfield = indfield; + if(precnode) { + dbGetFieldAddress(pdbentry); + }else { + pdbentry->pfield = NULL; + } + return(0); + } + } + indfield++; } } int dbGetNFields(DBENTRY *pdbentry,int dctonly) { - dbRecordType *precordType = pdbentry->precordType; - dbFldDes *pflddes; - int indfield,n; + dbRecordType *precordType = pdbentry->precordType; + dbFldDes *pflddes; + int indfield,n; if(!precordType) return(S_dbLib_recordTypeNotFound); n = 0; for(indfield=0; indfieldno_fields; indfield++) { - pflddes = precordType->papFldDes[indfield]; - if(dctonly && (pflddes->field_type==DBF_DEVICE) - && (ellCount(&precordType->devList)==0) ) continue; - if(!dctonly || pflddes->promptgroup) n++; + pflddes = precordType->papFldDes[indfield]; + if(dctonly && (pflddes->field_type==DBF_DEVICE) + && (ellCount(&precordType->devList)==0) ) continue; + if(!dctonly || pflddes->promptgroup) n++; } return(n); } char * dbGetFieldName(DBENTRY *pdbentry) { - dbFldDes *pflddes = pdbentry->pflddes; + dbFldDes *pflddes = pdbentry->pflddes; if(!pflddes) return(NULL); return(pflddes->name); @@ -1383,7 +1383,7 @@ char * dbGetFieldName(DBENTRY *pdbentry) char * dbGetDefault(DBENTRY *pdbentry) { - dbFldDes *pflddes = pdbentry->pflddes; + dbFldDes *pflddes = pdbentry->pflddes; if(!pflddes) return(NULL); return(pflddes->initial); @@ -1391,7 +1391,7 @@ char * dbGetDefault(DBENTRY *pdbentry) char * dbGetPrompt(DBENTRY *pdbentry) { - dbFldDes *pflddes = pdbentry->pflddes; + dbFldDes *pflddes = pdbentry->pflddes; if(!pflddes) return(NULL); return(&pflddes->prompt[0]); @@ -1399,7 +1399,7 @@ char * dbGetPrompt(DBENTRY *pdbentry) int dbGetPromptGroup(DBENTRY *pdbentry) { - dbFldDes *pflddes = pdbentry->pflddes; + dbFldDes *pflddes = pdbentry->pflddes; if(!pflddes) return(0); return(pflddes->promptgroup); @@ -1407,12 +1407,12 @@ int dbGetPromptGroup(DBENTRY *pdbentry) long dbCreateRecord(DBENTRY *pdbentry,const char *precordName) { - dbRecordType *precordType = pdbentry->precordType; - dbFldDes *pdbFldDes; - PVDENTRY *ppvd; - ELLLIST *preclist = NULL; - dbRecordNode *pNewRecNode = NULL; - long status = 0; + dbRecordType *precordType = pdbentry->precordType; + dbFldDes *pdbFldDes; + PVDENTRY *ppvd; + ELLLIST *preclist = NULL; + dbRecordNode *pNewRecNode = NULL; + long status = 0; if(!precordType) return(S_dbLib_recordTypeNotFound); /*Get size of NAME field*/ @@ -1442,12 +1442,12 @@ long dbCreateRecord(DBENTRY *pdbentry,const char *precordName) long dbDeleteAliases(DBENTRY *pdbentry) { - dbBase *pdbbase = pdbentry->pdbbase; - dbRecordType *precordType = pdbentry->precordType; - dbRecordNode *precnode = pdbentry->precnode; - ELLLIST *preclist = &precordType->recList; - dbRecordNode *pAliasNode, *pAliasNodeNext; - DBENTRY dbentry; + dbBase *pdbbase = pdbentry->pdbbase; + dbRecordType *precordType = pdbentry->precordType; + dbRecordNode *precnode = pdbentry->precnode; + ELLLIST *preclist = &precordType->recList; + dbRecordNode *pAliasNode, *pAliasNodeNext; + DBENTRY dbentry; void *precord; if (!precnode) return S_dbLib_recNotFound; @@ -1471,11 +1471,11 @@ long dbDeleteAliases(DBENTRY *pdbentry) long dbDeleteRecord(DBENTRY *pdbentry) { - dbBase *pdbbase = pdbentry->pdbbase; - dbRecordType *precordType = pdbentry->precordType; - dbRecordNode *precnode = pdbentry->precnode; - ELLLIST *preclist; - long status; + dbBase *pdbbase = pdbentry->pdbbase; + dbRecordType *precordType = pdbentry->precordType; + dbRecordNode *precnode = pdbentry->precnode; + ELLLIST *preclist; + long status; if (!precnode) return S_dbLib_recNotFound; if (precnode->flags & DBRN_FLAGS_HASALIAS) @@ -1501,22 +1501,22 @@ long dbDeleteRecord(DBENTRY *pdbentry) long dbFreeRecords(DBBASE *pdbbase) { - DBENTRY dbentry; - dbRecordType *pdbRecordType; - dbRecordNode *pdbRecordNode; - dbRecordNode *pdbRecordNodeNext; + DBENTRY dbentry; + dbRecordType *pdbRecordType; + dbRecordNode *pdbRecordNode; + dbRecordNode *pdbRecordNodeNext; dbInitEntry(pdbbase,&dbentry); pdbRecordType = (dbRecordType *)ellFirst(&pdbbase->recordTypeList); while(pdbRecordType) { - pdbRecordNode = (dbRecordNode *)ellFirst(&pdbRecordType->recList); - while(pdbRecordNode) { - pdbRecordNodeNext = (dbRecordNode *)ellNext(&pdbRecordNode->node); - if(!dbFindRecord(&dbentry,pdbRecordNode->recordname)) - dbDeleteRecord(&dbentry); - pdbRecordNode = pdbRecordNodeNext; - } - pdbRecordType = (dbRecordType *)ellNext(&pdbRecordType->node); + pdbRecordNode = (dbRecordNode *)ellFirst(&pdbRecordType->recList); + while(pdbRecordNode) { + pdbRecordNodeNext = (dbRecordNode *)ellNext(&pdbRecordNode->node); + if(!dbFindRecord(&dbentry,pdbRecordNode->recordname)) + dbDeleteRecord(&dbentry); + pdbRecordNode = pdbRecordNodeNext; + } + pdbRecordType = (dbRecordType *)ellNext(&pdbRecordType->node); } dbFinishEntry(&dbentry); return(0); @@ -1560,8 +1560,8 @@ long dbFindRecord(DBENTRY *pdbentry, const char *pname) long dbFirstRecord(DBENTRY *pdbentry) { - dbRecordType *precordType = pdbentry->precordType; - dbRecordNode *precnode; + dbRecordType *precordType = pdbentry->precordType; + dbRecordNode *precnode; zeroDbentry(pdbentry); if(!precordType) return(S_dbLib_recordTypeNotFound); @@ -1574,8 +1574,8 @@ long dbFirstRecord(DBENTRY *pdbentry) long dbNextRecord(DBENTRY *pdbentry) { - dbRecordNode *precnode=pdbentry->precnode; - long status=0; + dbRecordNode *precnode=pdbentry->precnode; + long status=0; if(!precnode) return(S_dbLib_recNotFound); precnode = (dbRecordNode *)ellNext(&precnode->node); @@ -1587,7 +1587,7 @@ long dbNextRecord(DBENTRY *pdbentry) int dbGetNRecords(DBENTRY *pdbentry) { - dbRecordType *precordType = pdbentry->precordType; + dbRecordType *precordType = pdbentry->precordType; if(!precordType) return(0); return(ellCount(&precordType->recList)); @@ -1595,7 +1595,7 @@ int dbGetNRecords(DBENTRY *pdbentry) int dbGetNAliases(DBENTRY *pdbentry) { - dbRecordType *precordType = pdbentry->precordType; + dbRecordType *precordType = pdbentry->precordType; if(!precordType) return(0); return(precordType->no_aliases); @@ -1613,7 +1613,7 @@ char * dbGetRecordName(DBENTRY *pdbentry) long dbVisibleRecord(DBENTRY *pdbentry) { - dbRecordNode *precnode = pdbentry->precnode; + dbRecordNode *precnode = pdbentry->precnode; if(!precnode) return(S_dbLib_recNotFound); precnode->flags |= DBRN_FLAGS_VISIBLE; @@ -1622,7 +1622,7 @@ long dbVisibleRecord(DBENTRY *pdbentry) long dbInvisibleRecord(DBENTRY *pdbentry) { - dbRecordNode *precnode = pdbentry->precnode; + dbRecordNode *precnode = pdbentry->precnode; if(!precnode) return(S_dbLib_recNotFound); precnode->flags &= ~DBRN_FLAGS_VISIBLE; @@ -1631,7 +1631,7 @@ long dbInvisibleRecord(DBENTRY *pdbentry) int dbIsVisibleRecord(DBENTRY *pdbentry) { - dbRecordNode *precnode = pdbentry->precnode; + dbRecordNode *precnode = pdbentry->precnode; if(!precnode) return 0; return precnode->flags & DBRN_FLAGS_VISIBLE ? 1 : 0; @@ -1691,7 +1691,7 @@ int dbFollowAlias(DBENTRY *pdbentry) int dbIsAlias(DBENTRY *pdbentry) { - dbRecordNode *precnode = pdbentry->precnode; + dbRecordNode *precnode = pdbentry->precnode; if(!precnode) return 0; return precnode->flags & DBRN_FLAGS_ISALIAS ? 1 : 0; @@ -1699,29 +1699,29 @@ int dbIsAlias(DBENTRY *pdbentry) long dbCopyRecord(DBENTRY *pdbentry,const char *newRecordName,int overWriteOK) { - dbRecordType *precordType = pdbentry->precordType; - dbFldDes *pdbFldDes; - dbRecordNode *precnode = pdbentry->precnode; - long status; - DBENTRY dbentry; - char *pvalue; + dbRecordType *precordType = pdbentry->precordType; + dbFldDes *pdbFldDes; + dbRecordNode *precnode = pdbentry->precnode; + long status; + DBENTRY dbentry; + char *pvalue; if(!precordType) return(S_dbLib_recordTypeNotFound); /*Get size of NAME field*/ pdbFldDes = precordType->papFldDes[0]; if(!pdbFldDes || (strcmp(pdbFldDes->name,"NAME")!=0)) - return(S_dbLib_nameLength); + return(S_dbLib_nameLength); if((int)strlen(newRecordName)>=pdbFldDes->size) return(S_dbLib_nameLength); if (!precnode || dbIsAlias(pdbentry)) return S_dbLib_recNotFound; dbInitEntry(pdbentry->pdbbase,&dbentry); status = dbFindRecord(&dbentry,newRecordName); if(!status) { - if(!overWriteOK) { - dbFinishEntry(&dbentry); - return(S_dbLib_recExists); - } - status = dbDeleteRecord(&dbentry); - if(status) return(status); + if(!overWriteOK) { + dbFinishEntry(&dbentry); + return(S_dbLib_recExists); + } + status = dbDeleteRecord(&dbentry); + if(status) return(status); } dbFinishEntry(&dbentry); if((status = dbFindRecordType(&dbentry,precordType->name))) return(status); @@ -1729,23 +1729,23 @@ long dbCopyRecord(DBENTRY *pdbentry,const char *newRecordName,int overWriteOK) if((status = dbFirstField(pdbentry,TRUE))) return(status); if((status = dbFirstField(&dbentry,TRUE))) return(status); while(!status) { - if(!dbIsDefaultValue(pdbentry)) { - pvalue = dbGetString(pdbentry); - if((status = dbPutString(&dbentry,pvalue))) return(status); - } - status = dbNextField(pdbentry,TRUE); - if(!status) status = dbNextField(&dbentry,TRUE); - if(!status && (pdbentry->pflddes!=dbentry.pflddes)) { - epicsPrintf("dbCopyRecord: Logic Error\n"); - return(-1); - } + if(!dbIsDefaultValue(pdbentry)) { + pvalue = dbGetString(pdbentry); + if((status = dbPutString(&dbentry,pvalue))) return(status); + } + status = dbNextField(pdbentry,TRUE); + if(!status) status = dbNextField(&dbentry,TRUE); + if(!status && (pdbentry->pflddes!=dbentry.pflddes)) { + epicsPrintf("dbCopyRecord: Logic Error\n"); + return(-1); + } } /*Copy the info strings too*/ status = dbFirstInfo(pdbentry); while (!status) { - status = dbPutInfo(&dbentry, dbGetInfoName(pdbentry), dbGetInfoString(pdbentry)); - if (status) return (status); - status = dbNextInfo(pdbentry); + status = dbPutInfo(&dbentry, dbGetInfoName(pdbentry), dbGetInfoString(pdbentry)); + if (status) return (status); + status = dbNextInfo(pdbentry); } /*Leave pdbentry pointing to newRecordName*/ return(dbFindRecord(pdbentry,newRecordName)); @@ -1836,9 +1836,9 @@ int dbFoundField(DBENTRY *pdbentry) char * dbGetString(DBENTRY *pdbentry) { - dbFldDes *pflddes = pdbentry->pflddes; - void *pfield = pdbentry->pfield; - DBLINK *plink; + dbFldDes *pflddes = pdbentry->pflddes; + void *pfield = pdbentry->pfield; + DBLINK *plink; if (!pflddes) { dbMsgCpy(pdbentry, "fldDes not found"); @@ -1876,164 +1876,164 @@ char * dbGetString(DBENTRY *pdbentry) case DBF_DOUBLE: case DBF_MENU: case DBF_DEVICE: - return(dbGetStringNum(pdbentry)); + return(dbGetStringNum(pdbentry)); case DBF_INLINK: case DBF_OUTLINK: - plink = (DBLINK *)pfield; - switch(plink->type) { - case CONSTANT: - if (plink->value.constantStr) { - dbMsgCpy(pdbentry, plink->value.constantStr); - } else if (plink->text) { - dbMsgCpy(pdbentry, plink->text); - } else { - dbMsgCpy(pdbentry, ""); - } - break; - case MACRO_LINK: - if (plink->value.macro_link.macroStr) { - dbMsgCpy(pdbentry, plink->value.macro_link.macroStr); - } else { - dbMsgCpy(pdbentry, ""); - } - break; - case JSON_LINK: - dbMsgCpy(pdbentry, plink->value.json.string); - break; + plink = (DBLINK *)pfield; + switch(plink->type) { + case CONSTANT: + if (plink->value.constantStr) { + dbMsgCpy(pdbentry, plink->value.constantStr); + } else if (plink->text) { + dbMsgCpy(pdbentry, plink->text); + } else { + dbMsgCpy(pdbentry, ""); + } + break; + case MACRO_LINK: + if (plink->value.macro_link.macroStr) { + dbMsgCpy(pdbentry, plink->value.macro_link.macroStr); + } else { + dbMsgCpy(pdbentry, ""); + } + break; + case JSON_LINK: + dbMsgCpy(pdbentry, plink->value.json.string); + break; case PN_LINK: dbMsgPrint(pdbentry, "%s%s", plink->value.pv_link.pvname ? plink->value.pv_link.pvname : "", msstring[plink->value.pv_link.pvlMask&pvlOptMsMode]); - break; - case PV_LINK: - case CA_LINK: - case DB_LINK: { - int ppind; - short pvlMask; + break; + case PV_LINK: + case CA_LINK: + case DB_LINK: { + int ppind; + short pvlMask; - pvlMask = plink->value.pv_link.pvlMask; - if (pvlMask&pvlOptPP) ppind=1; - else if(pvlMask&pvlOptCA) ppind=2; - else if(pvlMask&pvlOptCP) ppind=3; - else if(pvlMask&pvlOptCPP) ppind=4; - else ppind=0; + pvlMask = plink->value.pv_link.pvlMask; + if (pvlMask&pvlOptPP) ppind=1; + else if(pvlMask&pvlOptCA) ppind=2; + else if(pvlMask&pvlOptCP) ppind=3; + else if(pvlMask&pvlOptCPP) ppind=4; + else ppind=0; dbMsgPrint(pdbentry, "%s%s%s%s", plink->value.pv_link.pvname ? plink->value.pv_link.pvname : "", (plink->flags & DBLINK_FLAG_TSELisTIME) ? ".TIME" : "", ppstring[ppind], msstring[plink->value.pv_link.pvlMask&pvlOptMsMode]); - break; - } - case VME_IO: - dbMsgPrint(pdbentry, "#C%d S%d @%s", - plink->value.vmeio.card,plink->value.vmeio.signal, - plink->value.vmeio.parm); - break; - case CAMAC_IO: - dbMsgPrint(pdbentry, "#B%d C%d N%d A%d F%d @%s", - plink->value.camacio.b,plink->value.camacio.c, - plink->value.camacio.n,plink->value.camacio.a, - plink->value.camacio.f,plink->value.camacio.parm); - break; - case RF_IO: - dbMsgPrint(pdbentry, "#R%d M%d D%d E%d", - plink->value.rfio.cryo, - plink->value.rfio.micro, - plink->value.rfio.dataset, - plink->value.rfio.element); - break; - case AB_IO: - dbMsgPrint(pdbentry, "#L%d A%d C%d S%d @%s", - plink->value.abio.link,plink->value.abio.adapter, - plink->value.abio.card,plink->value.abio.signal, - plink->value.abio.parm); - break; - case GPIB_IO: - dbMsgPrint(pdbentry, "#L%d A%d @%s", - plink->value.gpibio.link,plink->value.gpibio.addr, - plink->value.gpibio.parm); - break; - case BITBUS_IO: - dbMsgPrint(pdbentry, "#L%u N%u P%u S%u @%s", - plink->value.bitbusio.link,plink->value.bitbusio.node, - plink->value.bitbusio.port,plink->value.bitbusio.signal, - plink->value.bitbusio.parm); - break; - case BBGPIB_IO: - dbMsgPrint(pdbentry, "#L%u B%u G%u @%s", - plink->value.bbgpibio.link,plink->value.bbgpibio.bbaddr, - plink->value.bbgpibio.gpibaddr,plink->value.bbgpibio.parm); - break; - case INST_IO: - dbMsgPrint(pdbentry, "@%s", plink->value.instio.string); - break; - case VXI_IO : - if (plink->value.vxiio.flag == VXIDYNAMIC) - dbMsgPrint(pdbentry, "#V%d C%d S%d @%s", - plink->value.vxiio.frame,plink->value.vxiio.slot, - plink->value.vxiio.signal,plink->value.vxiio.parm); - else - dbMsgPrint(pdbentry, "#V%d S%d @%s", - plink->value.vxiio.la,plink->value.vxiio.signal, - plink->value.vxiio.parm); - break; - default : - return(NULL); - } - break; + break; + } + case VME_IO: + dbMsgPrint(pdbentry, "#C%d S%d @%s", + plink->value.vmeio.card,plink->value.vmeio.signal, + plink->value.vmeio.parm); + break; + case CAMAC_IO: + dbMsgPrint(pdbentry, "#B%d C%d N%d A%d F%d @%s", + plink->value.camacio.b,plink->value.camacio.c, + plink->value.camacio.n,plink->value.camacio.a, + plink->value.camacio.f,plink->value.camacio.parm); + break; + case RF_IO: + dbMsgPrint(pdbentry, "#R%d M%d D%d E%d", + plink->value.rfio.cryo, + plink->value.rfio.micro, + plink->value.rfio.dataset, + plink->value.rfio.element); + break; + case AB_IO: + dbMsgPrint(pdbentry, "#L%d A%d C%d S%d @%s", + plink->value.abio.link,plink->value.abio.adapter, + plink->value.abio.card,plink->value.abio.signal, + plink->value.abio.parm); + break; + case GPIB_IO: + dbMsgPrint(pdbentry, "#L%d A%d @%s", + plink->value.gpibio.link,plink->value.gpibio.addr, + plink->value.gpibio.parm); + break; + case BITBUS_IO: + dbMsgPrint(pdbentry, "#L%u N%u P%u S%u @%s", + plink->value.bitbusio.link,plink->value.bitbusio.node, + plink->value.bitbusio.port,plink->value.bitbusio.signal, + plink->value.bitbusio.parm); + break; + case BBGPIB_IO: + dbMsgPrint(pdbentry, "#L%u B%u G%u @%s", + plink->value.bbgpibio.link,plink->value.bbgpibio.bbaddr, + plink->value.bbgpibio.gpibaddr,plink->value.bbgpibio.parm); + break; + case INST_IO: + dbMsgPrint(pdbentry, "@%s", plink->value.instio.string); + break; + case VXI_IO : + if (plink->value.vxiio.flag == VXIDYNAMIC) + dbMsgPrint(pdbentry, "#V%d C%d S%d @%s", + plink->value.vxiio.frame,plink->value.vxiio.slot, + plink->value.vxiio.signal,plink->value.vxiio.parm); + else + dbMsgPrint(pdbentry, "#V%d S%d @%s", + plink->value.vxiio.la,plink->value.vxiio.signal, + plink->value.vxiio.parm); + break; + default : + return(NULL); + } + break; case DBF_FWDLINK: { - DBLINK *plink=(DBLINK *)pfield; + DBLINK *plink=(DBLINK *)pfield; - switch(plink->type) { - case CONSTANT: - if (plink->value.constantStr) { - dbMsgCpy(pdbentry, plink->value.constantStr); - } else if (plink->text) { - dbMsgCpy(pdbentry, plink->text); - } else { - dbMsgCpy(pdbentry, ""); - } - break; - case MACRO_LINK: - if (plink->value.macro_link.macroStr) { - dbMsgCpy(pdbentry, plink->value.macro_link.macroStr); - } else { - dbMsgCpy(pdbentry, ""); - } - break; - case JSON_LINK: - dbMsgCpy(pdbentry, plink->value.json.string); - break; - case PV_LINK: - case CA_LINK: - case DB_LINK: { - int ppind; - short pvlMask; + switch(plink->type) { + case CONSTANT: + if (plink->value.constantStr) { + dbMsgCpy(pdbentry, plink->value.constantStr); + } else if (plink->text) { + dbMsgCpy(pdbentry, plink->text); + } else { + dbMsgCpy(pdbentry, ""); + } + break; + case MACRO_LINK: + if (plink->value.macro_link.macroStr) { + dbMsgCpy(pdbentry, plink->value.macro_link.macroStr); + } else { + dbMsgCpy(pdbentry, ""); + } + break; + case JSON_LINK: + dbMsgCpy(pdbentry, plink->value.json.string); + break; + case PV_LINK: + case CA_LINK: + case DB_LINK: { + int ppind; + short pvlMask; - pvlMask = plink->value.pv_link.pvlMask; - if (pvlMask&pvlOptCA) ppind=2; - else ppind=0; + pvlMask = plink->value.pv_link.pvlMask; + if (pvlMask&pvlOptCA) ppind=2; + else ppind=0; dbMsgPrint(pdbentry, "%s%s", plink->value.pv_link.pvname ? plink->value.pv_link.pvname : "", ppind ? ppstring[ppind] : ""); - break; - } - default : - return(NULL); - } - } - break; + break; + } + default : + return(NULL); + } + } + break; default: - return(NULL); + return(NULL); } return pdbentry->message; } char *dbGetStringNum(DBENTRY *pdbentry) { - dbFldDes *pflddes = pdbentry->pflddes; - void *pfield = pdbentry->pfield; - char *message; + dbFldDes *pflddes = pdbentry->pflddes; + void *pfield = pdbentry->pfield; + char *message; unsigned char cvttype; /* the following assumes that messagesize is large enough @@ -2536,38 +2536,38 @@ fail: long dbPutString(DBENTRY *pdbentry,const char *pstring) { - dbFldDes *pflddes = pdbentry->pflddes; - void *pfield = pdbentry->pfield; - long status=0; - int macroIsOk; - int stringHasMacro=FALSE; + dbFldDes *pflddes = pdbentry->pflddes; + void *pfield = pdbentry->pfield; + long status=0; + int macroIsOk; + int stringHasMacro=FALSE; if(!pflddes) return(S_dbLib_flddesNotFound); macroIsOk = dbIsMacroOk(pdbentry); stringHasMacro = strstr(pstring,"$(") || strstr(pstring,"${"); if(!macroIsOk && stringHasMacro) { - epicsPrintf("%s.%s Has unexpanded macro\n", - dbGetRecordName(pdbentry),dbGetFieldName(pdbentry)); - return(S_dbLib_badField); + epicsPrintf("%s.%s Has unexpanded macro\n", + dbGetRecordName(pdbentry),dbGetFieldName(pdbentry)); + return(S_dbLib_badField); } switch (pflddes->field_type) { case DBF_STRING: - if(!pfield) return(S_dbLib_fieldNotFound); - if(strlen(pstring) >= (size_t)pflddes->size) return S_dbLib_strLen; - strncpy((char *)pfield, pstring, pflddes->size-1); + if(!pfield) return(S_dbLib_fieldNotFound); + if(strlen(pstring) >= (size_t)pflddes->size) return S_dbLib_strLen; + strncpy((char *)pfield, pstring, pflddes->size-1); ((char *)pfield)[pflddes->size-1] = 0; - if((pflddes->special == SPC_CALC) && !stringHasMacro) { - char rpcl[RPCL_LEN]; - short err; + if((pflddes->special == SPC_CALC) && !stringHasMacro) { + char rpcl[RPCL_LEN]; + short err; - if (postfix(pstring,rpcl,&err)) { - status = S_dbLib_badField; - errlogPrintf("%s in CALC expression '%s'\n", - calcErrorStr(err), pstring); - } - } - break; + if (postfix(pstring,rpcl,&err)) { + status = S_dbLib_badField; + errlogPrintf("%s in CALC expression '%s'\n", + calcErrorStr(err), pstring); + } + } + break; case DBF_CHAR: case DBF_SHORT: @@ -2612,17 +2612,17 @@ long dbPutString(DBENTRY *pdbentry,const char *pstring) break; default: - return S_dbLib_badField; + return S_dbLib_badField; } if (!status && strcmp(pflddes->name, "VAL") == 0) { - DBENTRY dbentry; + DBENTRY dbentry; - dbCopyEntryContents(pdbentry, &dbentry); - if (!dbFindField(&dbentry, "UDF")) { - dbPutString(&dbentry, "0"); - } - dbFinishEntry(&dbentry); + dbCopyEntryContents(pdbentry, &dbentry); + if (!dbFindField(&dbentry, "UDF")) { + dbPutString(&dbentry, "0"); + } + dbFinishEntry(&dbentry); } return(status); } @@ -2849,7 +2849,7 @@ first: if (status) return status; status = dbFirstRecord(pdbentry); } - status = dbFirstInfo(pdbentry); + status = dbFirstInfo(pdbentry); } if (!pattern || !*pattern) return 0; if (epicsStrGlobMatch(dbGetInfoName(pdbentry), pattern)) return 0; @@ -2866,19 +2866,19 @@ long dbFindInfo(DBENTRY *pdbentry,const char *name) pinfo = (dbInfoNode *)ellFirst(&precnode->infoList); while (pinfo) { - if (!strcmp(pinfo->name, name)) { - pdbentry->pinfonode = pinfo; - return (0); - } - pinfo = (dbInfoNode *)ellNext(&pinfo->node); + if (!strcmp(pinfo->name, name)) { + pdbentry->pinfonode = pinfo; + return (0); + } + pinfo = (dbInfoNode *)ellNext(&pinfo->node); } return (S_dbLib_infoNotFound); } long dbDeleteInfo(DBENTRY *pdbentry) { - dbRecordNode *precnode = pdbentry->precnode; - dbInfoNode *pinfo = pdbentry->pinfonode; + dbRecordNode *precnode = pdbentry->precnode; + dbInfoNode *pinfo = pdbentry->pinfonode; if (!precnode) return (S_dbLib_recNotFound); if (!pinfo) return (S_dbLib_infoNotFound); @@ -2952,15 +2952,15 @@ long dbPutInfo(DBENTRY *pdbentry,const char *name,const char *string) if (!pinfo) return (S_dbLib_outMem); pinfo->name = calloc(1,1+strlen(name)); if (!pinfo->name) { - free(pinfo); - return (S_dbLib_outMem); + free(pinfo); + return (S_dbLib_outMem); } strcpy(pinfo->name, name); pinfo->string = calloc(1,1+strlen(string)); if (!pinfo->string) { - free(pinfo->name); - free(pinfo); - return (S_dbLib_outMem); + free(pinfo->name); + free(pinfo); + return (S_dbLib_outMem); } strcpy(pinfo->string, string); ellAdd(&precnode->infoList,&pinfo->node); @@ -3012,112 +3012,112 @@ dbMenu * dbFindMenu(dbBase *pdbbase,const char *name) char ** dbGetMenuChoices(DBENTRY *pdbentry) { - dbFldDes *pflddes = pdbentry->pflddes; + dbFldDes *pflddes = pdbentry->pflddes; if(!pflddes) return(NULL); switch (pflddes->field_type) { case DBF_MENU: { - dbMenu *pdbMenu = (dbMenu *)pflddes->ftPvt; + dbMenu *pdbMenu = (dbMenu *)pflddes->ftPvt; - if(!pdbMenu) return(NULL); - return(pdbMenu->papChoiceValue); - } + if(!pdbMenu) return(NULL); + return(pdbMenu->papChoiceValue); + } case DBF_DEVICE: { - dbDeviceMenu *pdbDeviceMenu; + dbDeviceMenu *pdbDeviceMenu; - pdbDeviceMenu = dbGetDeviceMenu(pdbentry); - if(!pdbDeviceMenu) return(NULL); - return(pdbDeviceMenu->papChoice); - } + pdbDeviceMenu = dbGetDeviceMenu(pdbentry); + if(!pdbDeviceMenu) return(NULL); + return(pdbDeviceMenu->papChoice); + } default: - return(NULL); + return(NULL); } } int dbGetNMenuChoices(DBENTRY *pdbentry) { - dbFldDes *pflddes = pdbentry->pflddes; + dbFldDes *pflddes = pdbentry->pflddes; if(!pflddes) return(-1); switch (pflddes->field_type) { case DBF_MENU: { - dbMenu *pdbMenu = (dbMenu *)pflddes->ftPvt; + dbMenu *pdbMenu = (dbMenu *)pflddes->ftPvt; - if(!pdbMenu) return(0); - return(pdbMenu->nChoice); - } + if(!pdbMenu) return(0); + return(pdbMenu->nChoice); + } case DBF_DEVICE: { - dbDeviceMenu *pdbDeviceMenu; + dbDeviceMenu *pdbDeviceMenu; - pdbDeviceMenu = dbGetDeviceMenu(pdbentry); - if(!pdbDeviceMenu) return(0); - return(pdbDeviceMenu->nChoice); - } + pdbDeviceMenu = dbGetDeviceMenu(pdbentry); + if(!pdbDeviceMenu) return(0); + return(pdbDeviceMenu->nChoice); + } default: - break; + break; } return (-1); } char * dbGetMenuStringFromIndex(DBENTRY *pdbentry, int index) { - dbFldDes *pflddes = pdbentry->pflddes; + dbFldDes *pflddes = pdbentry->pflddes; if(!pflddes) return(NULL); switch (pflddes->field_type) { case DBF_MENU: { - dbMenu *pdbMenu = (dbMenu *)pflddes->ftPvt; + dbMenu *pdbMenu = (dbMenu *)pflddes->ftPvt; - if(!pdbMenu) return(NULL); - if(index<0 || index>=pdbMenu->nChoice) return(NULL); - return(pdbMenu->papChoiceValue[index]); - } + if(!pdbMenu) return(NULL); + if(index<0 || index>=pdbMenu->nChoice) return(NULL); + return(pdbMenu->papChoiceValue[index]); + } case DBF_DEVICE: { - dbDeviceMenu *pdbDeviceMenu; + dbDeviceMenu *pdbDeviceMenu; - pdbDeviceMenu = dbGetDeviceMenu(pdbentry); - if(!pdbDeviceMenu) return(NULL); - if(index<0 || index>=pdbDeviceMenu->nChoice) return(NULL); - return(pdbDeviceMenu->papChoice[index]); - } + pdbDeviceMenu = dbGetDeviceMenu(pdbentry); + if(!pdbDeviceMenu) return(NULL); + if(index<0 || index>=pdbDeviceMenu->nChoice) return(NULL); + return(pdbDeviceMenu->papChoice[index]); + } default: - break; + break; } return (NULL); } int dbGetMenuIndexFromString(DBENTRY *pdbentry, const char *choice) { - dbFldDes *pflddes = pdbentry->pflddes; - int ind; - int nChoice = 0; - char **papChoice = NULL; + dbFldDes *pflddes = pdbentry->pflddes; + int ind; + int nChoice = 0; + char **papChoice = NULL; if(!pflddes) return(-1); switch (pflddes->field_type) { case DBF_MENU: { - dbMenu *pdbMenu = (dbMenu *)pflddes->ftPvt; + dbMenu *pdbMenu = (dbMenu *)pflddes->ftPvt; - if(!pdbMenu) return(-1); - papChoice = pdbMenu->papChoiceValue; - nChoice = pdbMenu->nChoice; - break; - } + if(!pdbMenu) return(-1); + papChoice = pdbMenu->papChoiceValue; + nChoice = pdbMenu->nChoice; + break; + } case DBF_DEVICE: { - dbDeviceMenu *pdbDeviceMenu; + dbDeviceMenu *pdbDeviceMenu; - pdbDeviceMenu = dbGetDeviceMenu(pdbentry); - if(!pdbDeviceMenu) return(-1); - papChoice = pdbDeviceMenu->papChoice; - nChoice = pdbDeviceMenu->nChoice; - break; - } + pdbDeviceMenu = dbGetDeviceMenu(pdbentry); + if(!pdbDeviceMenu) return(-1); + papChoice = pdbDeviceMenu->papChoice; + nChoice = pdbDeviceMenu->nChoice; + break; + } default: - return(-1); + return(-1); } if(nChoice<=0 || !papChoice) return(-1); for(ind=0; indpflddes; if(pflddes->field_type !=DBF_DEVICE) return(NULL); @@ -3155,7 +3155,7 @@ linkSup* dbFindLinkSup(dbBase *pdbbase, const char *name) { int dbGetNLinks(DBENTRY *pdbentry) { - dbRecordType *precordType = pdbentry->precordType; + dbRecordType *precordType = pdbentry->precordType; if(!precordType) return(S_dbLib_recordTypeNotFound); return((int)precordType->no_links); @@ -3180,22 +3180,22 @@ long dbGetLinkField(DBENTRY *pdbentry, int index) void dbDumpPath(DBBASE *pdbbase) { - ELLLIST *ppathList; - dbPathNode *pdbPathNode; + ELLLIST *ppathList; + dbPathNode *pdbPathNode; if(!pdbbase) { - fprintf(stderr,"pdbbase not specified\n"); - return; + fprintf(stderr,"pdbbase not specified\n"); + return; } ppathList = (ELLLIST *)pdbbase->pathPvt; if(!ppathList || !(pdbPathNode = (dbPathNode *)ellFirst(ppathList))) { - printf("no path defined\n"); - return; + printf("no path defined\n"); + return; } while(pdbPathNode) { - printf("%s",pdbPathNode->directory); - pdbPathNode = (dbPathNode *)ellNext(&pdbPathNode->node); - if(pdbPathNode) printf("%s", OSI_PATH_LIST_SEPARATOR); + printf("%s",pdbPathNode->directory); + pdbPathNode = (dbPathNode *)ellNext(&pdbPathNode->node); + if(pdbPathNode) printf("%s", OSI_PATH_LIST_SEPARATOR); } printf("\n"); return; @@ -3205,8 +3205,8 @@ void dbDumpRecord( dbBase *pdbbase,const char *precordTypename,int level) { if(!pdbbase) { - fprintf(stderr,"pdbbase not specified\n"); - return; + fprintf(stderr,"pdbbase not specified\n"); + return; } dbWriteRecordFP(pdbbase,stdout,precordTypename,level); } @@ -3214,167 +3214,167 @@ void dbDumpRecord( void dbDumpMenu(dbBase *pdbbase,const char *menuName) { if(!pdbbase) { - fprintf(stderr,"pdbbase not specified\n"); - return; + fprintf(stderr,"pdbbase not specified\n"); + return; } dbWriteMenuFP(pdbbase,stdout,menuName); } void dbDumpRecordType(DBBASE *pdbbase,const char *recordTypeName) { - dbRecordType *pdbRecordType; - dbFldDes *pdbFldDes; - int gotMatch; - int i; + dbRecordType *pdbRecordType; + dbFldDes *pdbFldDes; + int gotMatch; + int i; if(!pdbbase) { - fprintf(stderr,"pdbbase not specified\n"); - return; + fprintf(stderr,"pdbbase not specified\n"); + return; } for(pdbRecordType = (dbRecordType *)ellFirst(&pdbbase->recordTypeList); pdbRecordType; pdbRecordType = (dbRecordType *)ellNext(&pdbRecordType->node)) { - if(recordTypeName) { - gotMatch = (strcmp(recordTypeName,pdbRecordType->name)==0) - ? TRUE : FALSE; - }else { - gotMatch=TRUE; - } - if(!gotMatch) continue; - printf("name(%s) no_fields(%hd) no_prompt(%hd) no_links(%hd)\n", - pdbRecordType->name,pdbRecordType->no_fields, - pdbRecordType->no_prompt,pdbRecordType->no_links); - printf("index name\tsortind sortname\n"); - for(i=0; ino_fields; i++) { - pdbFldDes = pdbRecordType->papFldDes[i]; - printf("%5d %s\t%7d %s\n", - i,pdbFldDes->name, - pdbRecordType->sortFldInd[i],pdbRecordType->papsortFldName[i]); - } - printf("link_ind "); - for(i=0; ino_links; i++) - printf(" %hd",pdbRecordType->link_ind[i]); - printf("\n"); - printf("indvalFlddes %d name %s\n",pdbRecordType->indvalFlddes, - pdbRecordType->pvalFldDes->name); - printf("rset * %p rec_size %d\n", - (void *)pdbRecordType->prset,pdbRecordType->rec_size); - if(recordTypeName) break; + if(recordTypeName) { + gotMatch = (strcmp(recordTypeName,pdbRecordType->name)==0) + ? TRUE : FALSE; + }else { + gotMatch=TRUE; + } + if(!gotMatch) continue; + printf("name(%s) no_fields(%hd) no_prompt(%hd) no_links(%hd)\n", + pdbRecordType->name,pdbRecordType->no_fields, + pdbRecordType->no_prompt,pdbRecordType->no_links); + printf("index name\tsortind sortname\n"); + for(i=0; ino_fields; i++) { + pdbFldDes = pdbRecordType->papFldDes[i]; + printf("%5d %s\t%7d %s\n", + i,pdbFldDes->name, + pdbRecordType->sortFldInd[i],pdbRecordType->papsortFldName[i]); + } + printf("link_ind "); + for(i=0; ino_links; i++) + printf(" %hd",pdbRecordType->link_ind[i]); + printf("\n"); + printf("indvalFlddes %d name %s\n",pdbRecordType->indvalFlddes, + pdbRecordType->pvalFldDes->name); + printf("rset * %p rec_size %d\n", + (void *)pdbRecordType->prset,pdbRecordType->rec_size); + if(recordTypeName) break; } } void dbDumpField( DBBASE *pdbbase,const char *recordTypeName,const char *fname) { - dbRecordType *pdbRecordType; - dbFldDes *pdbFldDes; - int gotMatch; - int i; - dbRecordAttribute *pAttribute; + dbRecordType *pdbRecordType; + dbFldDes *pdbFldDes; + int gotMatch; + int i; + dbRecordAttribute *pAttribute; if(!pdbbase) { - fprintf(stderr,"pdbbase not specified\n"); - return; + fprintf(stderr,"pdbbase not specified\n"); + return; } for(pdbRecordType = (dbRecordType *)ellFirst(&pdbbase->recordTypeList); pdbRecordType; pdbRecordType = (dbRecordType *)ellNext(&pdbRecordType->node)) { - if(recordTypeName) { - gotMatch = (strcmp(recordTypeName,pdbRecordType->name)==0) - ? TRUE : FALSE; - }else { - gotMatch=TRUE; - } - if(!gotMatch) continue; - printf("recordtype(%s) \n",pdbRecordType->name); - for(i=0; ino_fields; i++) { - int j; + if(recordTypeName) { + gotMatch = (strcmp(recordTypeName,pdbRecordType->name)==0) + ? TRUE : FALSE; + }else { + gotMatch=TRUE; + } + if(!gotMatch) continue; + printf("recordtype(%s) \n",pdbRecordType->name); + for(i=0; ino_fields; i++) { + int j; - pdbFldDes = pdbRecordType->papFldDes[i]; - if(fname && strcmp(fname,pdbFldDes->name)!=0) continue; - printf(" %s\n", pdbFldDes->name); + pdbFldDes = pdbRecordType->papFldDes[i]; + if(fname && strcmp(fname,pdbFldDes->name)!=0) continue; + printf(" %s\n", pdbFldDes->name); printf("\t prompt: %s\n", (pdbFldDes->prompt ? pdbFldDes->prompt : "")); printf("\t extra: %s\n", (pdbFldDes->extra ? pdbFldDes->extra: "")); - printf("\t indRecordType: %hd\n",pdbFldDes->indRecordType); - printf("\t special: %hd ",pdbFldDes->special); - if(pdbFldDes->special) { - for(j=0; jspecial) { - printf("%s",pamapspcType[j].strvalue); - break; - } - } - } - printf("\n"); + printf("\t indRecordType: %hd\n",pdbFldDes->indRecordType); + printf("\t special: %hd ",pdbFldDes->special); + if(pdbFldDes->special) { + for(j=0; jspecial) { + printf("%s",pamapspcType[j].strvalue); + break; + } + } + } + printf("\n"); printf("\t field_type: %s\n", dbGetFieldTypeString(pdbFldDes->field_type)); - printf("\tprocess_passive: %u\n",pdbFldDes->process_passive); - printf("\t property: %u\n",pdbFldDes->prop); - printf("\t base: %d\n",pdbFldDes->base); - if(!pdbFldDes->promptgroup) { - printf("\t promptgroup: %d\n",pdbFldDes->promptgroup); - } else { + printf("\tprocess_passive: %u\n",pdbFldDes->process_passive); + printf("\t property: %u\n",pdbFldDes->prop); + printf("\t base: %d\n",pdbFldDes->base); + if(!pdbFldDes->promptgroup) { + printf("\t promptgroup: %d\n",pdbFldDes->promptgroup); + } else { printf("\t promptgroup: %s\n", dbGetPromptGroupNameFromKey(pdbbase, pdbFldDes->promptgroup)); } - printf("\t interest: %hd\n", pdbFldDes->interest); - printf("\t as_level: %d\n",pdbFldDes->as_level); + printf("\t interest: %hd\n", pdbFldDes->interest); + printf("\t as_level: %d\n",pdbFldDes->as_level); printf("\t initial: %s\n", (pdbFldDes->initial ? pdbFldDes->initial : "")); - if(pdbFldDes->field_type==DBF_MENU) { - if(pdbFldDes->ftPvt) - printf("\t\t menu: %s\n", - ((dbMenu *)pdbFldDes->ftPvt)->name); - else - printf("\t\t menu: NOT FOUND\n"); - } - if(pdbFldDes->field_type==DBF_DEVICE) { - printf("\t ftPvt: %p\n",pdbFldDes->ftPvt); - } - printf("\t size: %hd\n",pdbFldDes->size); - printf("\t offset: %hd\n",pdbFldDes->offset); - } - pAttribute = - (dbRecordAttribute *)ellFirst(&pdbRecordType->attributeList); - while(pAttribute) { - printf("Attribute: name %s value %s\n", - pAttribute->name,pAttribute->value); - pAttribute = (dbRecordAttribute *)ellNext(&pAttribute->node); - } - if(recordTypeName) break; + if(pdbFldDes->field_type==DBF_MENU) { + if(pdbFldDes->ftPvt) + printf("\t\t menu: %s\n", + ((dbMenu *)pdbFldDes->ftPvt)->name); + else + printf("\t\t menu: NOT FOUND\n"); + } + if(pdbFldDes->field_type==DBF_DEVICE) { + printf("\t ftPvt: %p\n",pdbFldDes->ftPvt); + } + printf("\t size: %hd\n",pdbFldDes->size); + printf("\t offset: %hd\n",pdbFldDes->offset); + } + pAttribute = + (dbRecordAttribute *)ellFirst(&pdbRecordType->attributeList); + while(pAttribute) { + printf("Attribute: name %s value %s\n", + pAttribute->name,pAttribute->value); + pAttribute = (dbRecordAttribute *)ellNext(&pAttribute->node); + } + if(recordTypeName) break; } } void dbDumpDevice(DBBASE *pdbbase,const char *recordTypeName) { - dbRecordType *pdbRecordType; - devSup *pdevSup; - int gotMatch; + dbRecordType *pdbRecordType; + devSup *pdevSup; + int gotMatch; if (recordTypeName) { if (*recordTypeName == 0 || *recordTypeName == '*') recordTypeName = 0; } if(!pdbbase) { - fprintf(stderr,"pdbbase not specified\n"); - return; + fprintf(stderr,"pdbbase not specified\n"); + return; } for(pdbRecordType = (dbRecordType *)ellFirst(&pdbbase->recordTypeList); pdbRecordType; pdbRecordType = (dbRecordType *)ellNext(&pdbRecordType->node)) { - if(recordTypeName) { - gotMatch = (strcmp(recordTypeName,pdbRecordType->name)==0) - ? TRUE : FALSE; - }else { - gotMatch=TRUE; - } - if(!gotMatch) continue; - printf("recordtype(%s)\n",pdbRecordType->name); - for(pdevSup = (devSup *)ellFirst(&pdbRecordType->devList); - pdevSup; pdevSup = (devSup *)ellNext(&pdevSup->node)) { - printf(" device name: %s\n",pdevSup->name); - printf("\tchoice: %s\n",pdevSup->choice); - printf("\tlink_type: %d\n",pdevSup->link_type); - printf("\tpdset: %p\n",(void *)pdevSup->pdset); + if(recordTypeName) { + gotMatch = (strcmp(recordTypeName,pdbRecordType->name)==0) + ? TRUE : FALSE; + }else { + gotMatch=TRUE; + } + if(!gotMatch) continue; + printf("recordtype(%s)\n",pdbRecordType->name); + for(pdevSup = (devSup *)ellFirst(&pdbRecordType->devList); + pdevSup; pdevSup = (devSup *)ellNext(&pdevSup->node)) { + printf(" device name: %s\n",pdevSup->name); + printf("\tchoice: %s\n",pdevSup->choice); + printf("\tlink_type: %d\n",pdevSup->link_type); + printf("\tpdset: %p\n",(void *)pdevSup->pdset); if (pdevSup->pdset) { static const char *names[] = { " - report()", @@ -3392,23 +3392,23 @@ void dbDumpDevice(DBBASE *pdbbase,const char *recordTypeName) printf("\t func %d: %p%s\n", i, (void *)*pfunc, name); } } - printf("\tpdsxt: %p\n",(void *)pdevSup->pdsxt); + printf("\tpdsxt: %p\n",(void *)pdevSup->pdsxt); if (pdevSup->pdsxt) { printf("\t add_record: %p\n", (void *)pdevSup->pdsxt->add_record); printf("\t del_record: %p\n", (void *)pdevSup->pdsxt->del_record); } - } - if(recordTypeName) break; + } + if(recordTypeName) break; } } void dbDumpDriver(DBBASE *pdbbase) { if(!pdbbase) { - fprintf(stderr,"pdbbase not specified\n"); - return; + fprintf(stderr,"pdbbase not specified\n"); + return; } dbWriteDriverFP(pdbbase,stdout); } @@ -3416,8 +3416,8 @@ void dbDumpDriver(DBBASE *pdbbase) void dbDumpLink(DBBASE *pdbbase) { if(!pdbbase) { - fprintf(stderr,"pdbbase not specified\n"); - return; + fprintf(stderr,"pdbbase not specified\n"); + return; } dbWriteLinkFP(pdbbase,stdout); } @@ -3425,8 +3425,8 @@ void dbDumpLink(DBBASE *pdbbase) void dbDumpRegistrar(DBBASE *pdbbase) { if(!pdbbase) { - fprintf(stderr,"pdbbase not specified\n"); - return; + fprintf(stderr,"pdbbase not specified\n"); + return; } dbWriteRegistrarFP(pdbbase,stdout); } @@ -3434,8 +3434,8 @@ void dbDumpRegistrar(DBBASE *pdbbase) void dbDumpFunction(DBBASE *pdbbase) { if(!pdbbase) { - fprintf(stderr,"pdbbase not specified\n"); - return; + fprintf(stderr,"pdbbase not specified\n"); + return; } dbWriteFunctionFP(pdbbase,stdout); } @@ -3443,8 +3443,8 @@ void dbDumpFunction(DBBASE *pdbbase) void dbDumpVariable(DBBASE *pdbbase) { if(!pdbbase) { - fprintf(stderr,"pdbbase not specified\n"); - return; + fprintf(stderr,"pdbbase not specified\n"); + return; } dbWriteVariableFP(pdbbase,stdout); } @@ -3453,23 +3453,23 @@ void dbDumpBreaktable(DBBASE *pdbbase,const char *name) { brkTable *pbrkTable; brkInt *pbrkInt; - int ind; + int ind; if(!pdbbase) { - fprintf(stderr,"pdbbase not specified\n"); - return; + fprintf(stderr,"pdbbase not specified\n"); + return; } for(pbrkTable = (brkTable *)ellFirst(&pdbbase->bptList); pbrkTable; pbrkTable = (brkTable *)ellNext(&pbrkTable->node)) { - if (name && strcmp(name,pbrkTable->name)!=0) continue; - printf("breaktable(%s) {\n",pbrkTable->name); - pbrkInt = pbrkTable->paBrkInt; - for(ind=0; ind < pbrkTable->number; ind++) { - printf("\traw=%f slope=%e eng=%f\n", - pbrkInt->raw, pbrkInt->slope, pbrkInt->eng); - pbrkInt++; - } - printf("}\n"); + if (name && strcmp(name,pbrkTable->name)!=0) continue; + printf("breaktable(%s) {\n",pbrkTable->name); + pbrkInt = pbrkTable->paBrkInt; + for(ind=0; ind < pbrkTable->number; ind++) { + printf("\traw=%f slope=%e eng=%f\n", + pbrkInt->raw, pbrkInt->slope, pbrkInt->eng); + pbrkInt++; + } + printf("}\n"); } return; } diff --git a/modules/database/src/ioc/dbStatic/dbStaticLib.h b/modules/database/src/ioc/dbStatic/dbStaticLib.h index e0a2ddc6b..ffa5fa25d 100644 --- a/modules/database/src/ioc/dbStatic/dbStaticLib.h +++ b/modules/database/src/ioc/dbStatic/dbStaticLib.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Author: Marty Kraimer diff --git a/modules/database/src/ioc/dbStatic/dbStaticPvt.h b/modules/database/src/ioc/dbStatic/dbStaticPvt.h index 85fc02217..f35c5bc08 100644 --- a/modules/database/src/ioc/dbStatic/dbStaticPvt.h +++ b/modules/database/src/ioc/dbStatic/dbStaticPvt.h @@ -9,7 +9,7 @@ \*************************************************************************/ /* dbStaticPvt.h */ /* - * Author: Marty Kraimer + * Author: Marty Kraimer * Date: 06Jun95 */ @@ -79,8 +79,8 @@ epicsShareFunc void dbFreeLinkInfo(dbLinkInfo *pinfo); /* The following is for path */ typedef struct dbPathNode { - ELLNODE node; - char *directory; + ELLNODE node; + char *directory; } dbPathNode; /* Element of the global gui group list */ @@ -93,13 +93,13 @@ typedef struct dbGuiGroup { /*The following are in dbPvdLib.c*/ /*directory*/ typedef struct{ - ELLNODE node; - dbRecordType *precordType; - dbRecordNode *precnode; + ELLNODE node; + dbRecordType *precordType; + dbRecordNode *precnode; }PVDENTRY; epicsShareFunc int dbPvdTableSize(int size); extern int dbStaticDebug; -void dbPvdInitPvt(DBBASE *pdbbase); +void dbPvdInitPvt(DBBASE *pdbbase); PVDENTRY *dbPvdFind(DBBASE *pdbbase,const char *name,size_t lenname); PVDENTRY *dbPvdAdd(DBBASE *pdbbase,dbRecordType *precordType,dbRecordNode *precnode); void dbPvdDelete(DBBASE *pdbbase,dbRecordNode *precnode); diff --git a/modules/database/src/ioc/dbStatic/dbStaticRun.c b/modules/database/src/ioc/dbStatic/dbStaticRun.c index 461bf5894..78514a458 100644 --- a/modules/database/src/ioc/dbStatic/dbStaticRun.c +++ b/modules/database/src/ioc/dbStatic/dbStaticRun.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /*dbStaticLibRun.c*/ @@ -68,14 +68,14 @@ void devExtend(dsxt *pdsxt) long dbAllocRecord(DBENTRY *pdbentry,const char *precordName) { - dbRecordType *pdbRecordType = pdbentry->precordType; - dbRecordNode *precnode = pdbentry->precnode; - dbFldDes *pflddes; - int i; - dbCommonPvt *ppvt; - dbCommon *precord; - char *pfield; - + dbRecordType *pdbRecordType = pdbentry->precordType; + dbRecordNode *precnode = pdbentry->precnode; + dbFldDes *pflddes; + int i; + dbCommonPvt *ppvt; + dbCommon *precord; + char *pfield; + if(!pdbRecordType) return(S_dbLib_recordTypeNotFound); if(!precnode) return(S_dbLib_recNotFound); if(pdbRecordType->rec_size == 0) { @@ -131,8 +131,8 @@ long dbAllocRecord(DBENTRY *pdbentry,const char *precordName) case DBF_USHORT: case DBF_LONG: case DBF_ULONG: - case DBF_INT64: - case DBF_UINT64: + case DBF_INT64: + case DBF_UINT64: case DBF_FLOAT: case DBF_DOUBLE: case DBF_ENUM: @@ -188,7 +188,7 @@ long dbGetFieldAddress(DBENTRY *pdbentry) { dbRecordType *pdbRecordType = pdbentry->precordType; dbRecordNode *precnode = pdbentry->precnode; - dbFldDes *pflddes = pdbentry->pflddes; + dbFldDes *pflddes = pdbentry->pflddes; if(!pdbRecordType) return(S_dbLib_recordTypeNotFound); if(!precnode) return(S_dbLib_recNotFound); @@ -202,8 +202,8 @@ char *dbRecordName(DBENTRY *pdbentry) { dbRecordType *pdbRecordType = pdbentry->precordType; dbRecordNode *precnode = pdbentry->precnode; - dbFldDes *pflddes; - char *precord; + dbFldDes *pflddes; + char *precord; if(!pdbRecordType) return(0); if(!precnode) return(0); diff --git a/modules/database/src/ioc/dbStatic/dbYacc.y b/modules/database/src/ioc/dbStatic/dbYacc.y index 9dc8c5081..d03edbb3e 100644 --- a/modules/database/src/ioc/dbStatic/dbYacc.y +++ b/modules/database/src/ioc/dbStatic/dbYacc.y @@ -19,7 +19,7 @@ static int yyAbort = 0; %union { - char *Str; + char *Str; } %token tokenINCLUDE tokenPATH tokenADDPATH @@ -36,318 +36,318 @@ static int yyAbort = 0; %% -database: /* empty */ - | database_item_list - ; +database: /* empty */ + | database_item_list + ; -database_item_list: database_item_list database_item - | database_item - ; +database_item_list: database_item_list database_item + | database_item + ; -database_item: include - | path - | addpath - | tokenMENU menu_head menu_body - | tokenRECORDTYPE recordtype_head recordtype_body - | device - | driver - | link - | registrar - | function - | variable - | tokenBREAKTABLE break_head break_body - | tokenRECORD record_head record_body - | tokenGRECORD grecord_head record_body - | alias - ; +database_item: include + | path + | addpath + | tokenMENU menu_head menu_body + | tokenRECORDTYPE recordtype_head recordtype_body + | device + | driver + | link + | registrar + | function + | variable + | tokenBREAKTABLE break_head break_body + | tokenRECORD record_head record_body + | tokenGRECORD grecord_head record_body + | alias + ; -include: tokenINCLUDE tokenSTRING +include: tokenINCLUDE tokenSTRING { - if(dbStaticDebug>2) printf("include : %s\n",$2); - dbIncludeNew($2); dbmfFree($2); + if(dbStaticDebug>2) printf("include : %s\n",$2); + dbIncludeNew($2); dbmfFree($2); }; -path: tokenPATH tokenSTRING +path: tokenPATH tokenSTRING { - if(dbStaticDebug>2) printf("path : %s\n",$2); - dbPathCmd($2); dbmfFree($2); + if(dbStaticDebug>2) printf("path : %s\n",$2); + dbPathCmd($2); dbmfFree($2); }; -addpath: tokenADDPATH tokenSTRING +addpath: tokenADDPATH tokenSTRING { - if(dbStaticDebug>2) printf("addpath : %s\n",$2); - dbAddPathCmd($2); dbmfFree($2); + if(dbStaticDebug>2) printf("addpath : %s\n",$2); + dbAddPathCmd($2); dbmfFree($2); }; -menu_head: '(' tokenSTRING ')' +menu_head: '(' tokenSTRING ')' { - if(dbStaticDebug>2) printf("menu_head %s\n",$2); - dbMenuHead($2); dbmfFree($2); + if(dbStaticDebug>2) printf("menu_head %s\n",$2); + dbMenuHead($2); dbmfFree($2); }; -menu_body: '{' choice_list '}' +menu_body: '{' choice_list '}' { - if(dbStaticDebug>2) printf("menu_body\n"); - dbMenuBody(); + if(dbStaticDebug>2) printf("menu_body\n"); + dbMenuBody(); }; -choice_list: choice_list choice | choice; +choice_list: choice_list choice | choice; -choice: tokenCHOICE '(' tokenSTRING ',' tokenSTRING ')' +choice: tokenCHOICE '(' tokenSTRING ',' tokenSTRING ')' { - if(dbStaticDebug>2) printf("choice %s %s\n",$3,$5); - dbMenuChoice($3,$5); dbmfFree($3); dbmfFree($5); + if(dbStaticDebug>2) printf("choice %s %s\n",$3,$5); + dbMenuChoice($3,$5); dbmfFree($3); dbmfFree($5); } - | include; + | include; recordtype_head: '(' tokenSTRING ')' { - if(dbStaticDebug>2) printf("recordtype_head %s\n",$2); - dbRecordtypeHead($2); dbmfFree($2); + if(dbStaticDebug>2) printf("recordtype_head %s\n",$2); + dbRecordtypeHead($2); dbmfFree($2); }; recordtype_body: '{' '}' { - if(dbStaticDebug>2) printf("empty recordtype_body\n"); - dbRecordtypeEmpty(); + if(dbStaticDebug>2) printf("empty recordtype_body\n"); + dbRecordtypeEmpty(); } - | '{' recordtype_field_list '}' + | '{' recordtype_field_list '}' { - if(dbStaticDebug>2) printf("recordtype_body\n"); - dbRecordtypeBody(); + if(dbStaticDebug>2) printf("recordtype_body\n"); + dbRecordtypeBody(); }; -recordtype_field_list: recordtype_field_list recordtype_field - | recordtype_field; +recordtype_field_list: recordtype_field_list recordtype_field + | recordtype_field; recordtype_field: tokenFIELD recordtype_field_head recordtype_field_body - | tokenCDEFS + | tokenCDEFS { - if(dbStaticDebug>2) printf("recordtype_cdef %s", $1); - dbRecordtypeCdef($1); dbmfFree($1); + if(dbStaticDebug>2) printf("recordtype_cdef %s", $1); + dbRecordtypeCdef($1); dbmfFree($1); } - | include ; + | include ; -recordtype_field_head: '(' tokenSTRING ',' tokenSTRING ')' +recordtype_field_head: '(' tokenSTRING ',' tokenSTRING ')' { - if(dbStaticDebug>2) printf("recordtype_field_head %s %s\n",$2,$4); - dbRecordtypeFieldHead($2,$4); dbmfFree($2); dbmfFree($4); + if(dbStaticDebug>2) printf("recordtype_field_head %s %s\n",$2,$4); + dbRecordtypeFieldHead($2,$4); dbmfFree($2); dbmfFree($4); }; -recordtype_field_body: '{' recordtype_field_item_list '}' ; +recordtype_field_body: '{' recordtype_field_item_list '}' ; recordtype_field_item_list: recordtype_field_item_list recordtype_field_item - | recordtype_field_item; + | recordtype_field_item; -recordtype_field_item: tokenSTRING '(' tokenSTRING ')' +recordtype_field_item: tokenSTRING '(' tokenSTRING ')' { - if(dbStaticDebug>2) printf("recordtype_field_item %s %s\n",$1,$3); - dbRecordtypeFieldItem($1,$3); dbmfFree($1); dbmfFree($3); + if(dbStaticDebug>2) printf("recordtype_field_item %s %s\n",$1,$3); + dbRecordtypeFieldItem($1,$3); dbmfFree($1); dbmfFree($3); } - | tokenMENU '(' tokenSTRING ')' + | tokenMENU '(' tokenSTRING ')' { - if(dbStaticDebug>2) printf("recordtype_field_item %s (%s)\n","menu",$3); - dbRecordtypeFieldItem("menu",$3); dbmfFree($3); + if(dbStaticDebug>2) printf("recordtype_field_item %s (%s)\n","menu",$3); + dbRecordtypeFieldItem("menu",$3); dbmfFree($3); }; device: tokenDEVICE '(' - tokenSTRING ',' tokenSTRING ',' tokenSTRING ',' tokenSTRING ')' + tokenSTRING ',' tokenSTRING ',' tokenSTRING ',' tokenSTRING ')' { - if(dbStaticDebug>2) printf("device %s %s %s %s\n",$3,$5,$7,$9); - dbDevice($3,$5,$7,$9); - dbmfFree($3); dbmfFree($5); - dbmfFree($7); dbmfFree($9); + if(dbStaticDebug>2) printf("device %s %s %s %s\n",$3,$5,$7,$9); + dbDevice($3,$5,$7,$9); + dbmfFree($3); dbmfFree($5); + dbmfFree($7); dbmfFree($9); }; driver: tokenDRIVER '(' tokenSTRING ')' { - if(dbStaticDebug>2) printf("driver %s\n",$3); - dbDriver($3); dbmfFree($3); + if(dbStaticDebug>2) printf("driver %s\n",$3); + dbDriver($3); dbmfFree($3); }; link: tokenLINK '(' tokenSTRING ',' tokenSTRING ')' { - if(dbStaticDebug>2) printf("link %s %s\n",$3,$5); - dbLinkType($3,$5); - dbmfFree($3); dbmfFree($5); + if(dbStaticDebug>2) printf("link %s %s\n",$3,$5); + dbLinkType($3,$5); + dbmfFree($3); dbmfFree($5); }; registrar: tokenREGISTRAR '(' tokenSTRING ')' { - if(dbStaticDebug>2) printf("registrar %s\n",$3); - dbRegistrar($3); dbmfFree($3); + if(dbStaticDebug>2) printf("registrar %s\n",$3); + dbRegistrar($3); dbmfFree($3); }; function: tokenFUNCTION '(' tokenSTRING ')' { - if(dbStaticDebug>2) printf("function %s\n",$3); - dbFunction($3); dbmfFree($3); + if(dbStaticDebug>2) printf("function %s\n",$3); + dbFunction($3); dbmfFree($3); }; variable: tokenVARIABLE '(' tokenSTRING ')' { - if(dbStaticDebug>2) printf("variable %s\n",$3); - dbVariable($3,"int"); dbmfFree($3); + if(dbStaticDebug>2) printf("variable %s\n",$3); + dbVariable($3,"int"); dbmfFree($3); } | tokenVARIABLE '(' tokenSTRING ',' tokenSTRING ')' { - if(dbStaticDebug>2) printf("variable %s, %s\n",$3,$5); - dbVariable($3,$5); dbmfFree($3); dbmfFree($5); + if(dbStaticDebug>2) printf("variable %s, %s\n",$3,$5); + dbVariable($3,$5); dbmfFree($3); dbmfFree($5); }; break_head: '(' tokenSTRING ')' { - if(dbStaticDebug>2) printf("break_head %s\n",$2); - dbBreakHead($2); dbmfFree($2); + if(dbStaticDebug>2) printf("break_head %s\n",$2); + dbBreakHead($2); dbmfFree($2); }; break_body : '{' break_list '}' { - if(dbStaticDebug>2) printf("break_body\n"); - dbBreakBody(); + if(dbStaticDebug>2) printf("break_body\n"); + dbBreakBody(); }; break_list: break_list ',' break_item - | break_list break_item - | break_item; + | break_list break_item + | break_item; break_item: tokenSTRING { - if(dbStaticDebug>2) printf("break_item tokenSTRING %s\n",$1); - dbBreakItem($1); dbmfFree($1); + if(dbStaticDebug>2) printf("break_item tokenSTRING %s\n",$1); + dbBreakItem($1); dbmfFree($1); }; grecord_head: '(' tokenSTRING ',' tokenSTRING ')' { - if(dbStaticDebug>2) printf("grecord_head %s %s\n",$2,$4); - dbRecordHead($2,$4,1); dbmfFree($2); dbmfFree($4); + if(dbStaticDebug>2) printf("grecord_head %s %s\n",$2,$4); + dbRecordHead($2,$4,1); dbmfFree($2); dbmfFree($4); }; record_head: '(' tokenSTRING ',' tokenSTRING ')' { - if(dbStaticDebug>2) printf("record_head %s %s\n",$2,$4); - dbRecordHead($2,$4,0); dbmfFree($2); dbmfFree($4); + if(dbStaticDebug>2) printf("record_head %s %s\n",$2,$4); + dbRecordHead($2,$4,0); dbmfFree($2); dbmfFree($4); }; record_body: /* empty */ { - if(dbStaticDebug>2) printf("null record_body\n"); - dbRecordBody(); + if(dbStaticDebug>2) printf("null record_body\n"); + dbRecordBody(); } - | '{' '}' + | '{' '}' { - if(dbStaticDebug>2) printf("empty record_body\n"); - dbRecordBody(); + if(dbStaticDebug>2) printf("empty record_body\n"); + dbRecordBody(); } | '{' record_field_list '}' { - if(dbStaticDebug>2) printf("record_body\n"); - dbRecordBody(); + if(dbStaticDebug>2) printf("record_body\n"); + dbRecordBody(); }; -record_field_list: record_field_list record_field - | record_field; +record_field_list: record_field_list record_field + | record_field; record_field: tokenFIELD '(' tokenSTRING ',' - { BEGIN JSON; } json_value { BEGIN INITIAL; } ')' + { BEGIN JSON; } json_value { BEGIN INITIAL; } ')' { - if(dbStaticDebug>2) printf("record_field %s %s\n",$3,$6); - dbRecordField($3,$6); dbmfFree($3); dbmfFree($6); + if(dbStaticDebug>2) printf("record_field %s %s\n",$3,$6); + dbRecordField($3,$6); dbmfFree($3); dbmfFree($6); } - | tokenINFO '(' tokenSTRING ',' - { BEGIN JSON; } json_value { BEGIN INITIAL; } ')' + | tokenINFO '(' tokenSTRING ',' + { BEGIN JSON; } json_value { BEGIN INITIAL; } ')' { - if(dbStaticDebug>2) printf("record_info %s %s\n",$3,$6); - dbRecordInfo($3,$6); dbmfFree($3); dbmfFree($6); + if(dbStaticDebug>2) printf("record_info %s %s\n",$3,$6); + dbRecordInfo($3,$6); dbmfFree($3); dbmfFree($6); } - | tokenALIAS '(' tokenSTRING ')' + | tokenALIAS '(' tokenSTRING ')' { - if(dbStaticDebug>2) printf("record_alias %s\n",$3); - dbRecordAlias($3); dbmfFree($3); + if(dbStaticDebug>2) printf("record_alias %s\n",$3); + dbRecordAlias($3); dbmfFree($3); } - | include ; + | include ; alias: tokenALIAS '(' tokenSTRING ',' tokenSTRING ')' { - if(dbStaticDebug>2) printf("alias %s %s\n",$3,$5); - dbAlias($3,$5); dbmfFree($3); dbmfFree($5); + if(dbStaticDebug>2) printf("alias %s %s\n",$3,$5); + dbAlias($3,$5); dbmfFree($3); dbmfFree($5); }; json_object: '{' '}' { - $$ = dbmfStrdup("{}"); - if (dbStaticDebug>2) printf("json %s\n", $$); + $$ = dbmfStrdup("{}"); + if (dbStaticDebug>2) printf("json %s\n", $$); } - | '{' json_members '}' + | '{' json_members '}' { - $$ = dbmfStrcat3("{", $2, "}"); - dbmfFree($2); - if (dbStaticDebug>2) printf("json %s\n", $$); + $$ = dbmfStrcat3("{", $2, "}"); + dbmfFree($2); + if (dbStaticDebug>2) printf("json %s\n", $$); }; json_members: json_pair - | json_pair ',' - | json_pair ',' json_members + | json_pair ',' + | json_pair ',' json_members { - $$ = dbmfStrcat3($1, ",", $3); - dbmfFree($1); dbmfFree($3); - if (dbStaticDebug>2) printf("json %s\n", $$); + $$ = dbmfStrcat3($1, ",", $3); + dbmfFree($1); dbmfFree($3); + if (dbStaticDebug>2) printf("json %s\n", $$); }; json_pair: json_string ':' json_value { - $$ = dbmfStrcat3($1, ":", $3); - dbmfFree($1); dbmfFree($3); - if (dbStaticDebug>2) printf("json %s\n", $$); + $$ = dbmfStrcat3($1, ":", $3); + dbmfFree($1); dbmfFree($3); + if (dbStaticDebug>2) printf("json %s\n", $$); }; json_string: jsonSTRING - | jsonBARE + | jsonBARE { - $$ = dbmfStrcat3("\"", $1, "\""); - dbmfFree($1); - if (dbStaticDebug>2) printf("json %s\n", $$); + $$ = dbmfStrcat3("\"", $1, "\""); + dbmfFree($1); + if (dbStaticDebug>2) printf("json %s\n", $$); }; json_array: '[' ']' { - $$ = dbmfStrdup("[]"); - if (dbStaticDebug>2) printf("json %s\n", $$); + $$ = dbmfStrdup("[]"); + if (dbStaticDebug>2) printf("json %s\n", $$); } - | '[' json_elements ']' + | '[' json_elements ']' { - $$ = dbmfStrcat3("[", $2, "]"); - dbmfFree($2); - if (dbStaticDebug>2) printf("json %s\n", $$); + $$ = dbmfStrcat3("[", $2, "]"); + dbmfFree($2); + if (dbStaticDebug>2) printf("json %s\n", $$); }; json_elements: json_value - | json_value ',' -{ /* Retain the trailing ',' so link parser can distinguish a - * 1-element const list from a PV name (commas are illegal) - */ - $$ = dbmfStrcat3($1, ",", ""); - dbmfFree($1); - if (dbStaticDebug>2) printf("json %s\n", $$); + | json_value ',' +{ /* Retain the trailing ',' so link parser can distinguish a + * 1-element const list from a PV name (commas are illegal) + */ + $$ = dbmfStrcat3($1, ",", ""); + dbmfFree($1); + if (dbStaticDebug>2) printf("json %s\n", $$); }; - | json_value ',' json_elements + | json_value ',' json_elements { - $$ = dbmfStrcat3($1, ",", $3); - dbmfFree($1); dbmfFree($3); - if (dbStaticDebug>2) printf("json %s\n", $$); + $$ = dbmfStrcat3($1, ",", $3); + dbmfFree($1); dbmfFree($3); + if (dbStaticDebug>2) printf("json %s\n", $$); }; -json_value: jsonNULL { $$ = dbmfStrdup("null"); } - | jsonTRUE { $$ = dbmfStrdup("true"); } - | jsonFALSE { $$ = dbmfStrdup("false"); } - | jsonNUMBER - | json_string - | json_array - | json_object ; +json_value: jsonNULL { $$ = dbmfStrdup("null"); } + | jsonTRUE { $$ = dbmfStrdup("true"); } + | jsonFALSE { $$ = dbmfStrdup("false"); } + | jsonNUMBER + | json_string + | json_array + | json_object ; %% @@ -370,14 +370,14 @@ static int yyerror(char *str) } static long pvt_yy_parse(void) { - static int FirstFlag = 1; - long rtnval; + static int FirstFlag = 1; + long rtnval; if (!FirstFlag) { - yyAbort = FALSE; - yyFailed = FALSE; - yyreset(); - yyrestart(NULL); + yyAbort = FALSE; + yyFailed = FALSE; + yyreset(); + yyrestart(NULL); } FirstFlag = 0; rtnval = yyparse(); diff --git a/modules/database/src/ioc/dbStatic/devSup.h b/modules/database/src/ioc/dbStatic/devSup.h index c54f476d4..d1deaa2d9 100644 --- a/modules/database/src/ioc/dbStatic/devSup.h +++ b/modules/database/src/ioc/dbStatic/devSup.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /** @file devSup.h * @@ -130,19 +130,19 @@ typedef struct dsxt { #ifdef __cplusplus extern "C" { - typedef long (*DEVSUPFUN)(void *); /* ptr to device support function*/ + typedef long (*DEVSUPFUN)(void *); /* ptr to device support function*/ #else - typedef long (*DEVSUPFUN)(); /* ptr to device support function*/ + typedef long (*DEVSUPFUN)(); /* ptr to device support function*/ #endif #ifndef USE_TYPED_DSET typedef struct dset { /* device support entry table */ - long number; /*number of support routines*/ - DEVSUPFUN report; /*print report*/ - DEVSUPFUN init; /*init support layer*/ - DEVSUPFUN init_record; /*init device for particular record*/ - DEVSUPFUN get_ioint_info; /* get io interrupt information*/ + long number; /*number of support routines*/ + DEVSUPFUN report; /*print report*/ + DEVSUPFUN init; /*init support layer*/ + DEVSUPFUN init_record; /*init device for particular record*/ + DEVSUPFUN get_ioint_info; /* get io interrupt information*/ /*other functions are record dependent*/ } dset; diff --git a/modules/database/src/ioc/dbStatic/drvSup.h b/modules/database/src/ioc/dbStatic/drvSup.h index 193d57482..2560cfe84 100644 --- a/modules/database/src/ioc/dbStatic/drvSup.h +++ b/modules/database/src/ioc/dbStatic/drvSup.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /** @file drvSup.h * @@ -40,7 +40,7 @@ typedef typed_drvet drvet; /* These interfaces may eventually get deprecated */ -typedef long (*DRVSUPFUN) (); /* ptr to driver support function */ +typedef long (*DRVSUPFUN) (); /* ptr to driver support function */ typedef struct drvet { /* driver entry table */ long number; /* number of support routines */ diff --git a/modules/database/src/ioc/dbStatic/guigroup.h b/modules/database/src/ioc/dbStatic/guigroup.h index 4e2f2e1dd..88b9a9283 100644 --- a/modules/database/src/ioc/dbStatic/guigroup.h +++ b/modules/database/src/ioc/dbStatic/guigroup.h @@ -5,12 +5,12 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* - these are used in the pmt (prompt) field of the record support - ascii files. They represent field groupings for dct tools + these are used in the pmt (prompt) field of the record support + ascii files. They represent field groupings for dct tools */ #ifndef __gui_group_h__ diff --git a/modules/database/src/ioc/dbStatic/link.h b/modules/database/src/ioc/dbStatic/link.h index 2e3c77820..2d213aa8a 100644 --- a/modules/database/src/ioc/dbStatic/link.h +++ b/modules/database/src/ioc/dbStatic/link.h @@ -24,22 +24,22 @@ extern "C" { #endif /* link types */ -#define CONSTANT 0 -#define PV_LINK 1 -#define VME_IO 2 -#define CAMAC_IO 3 -#define AB_IO 4 -#define GPIB_IO 5 -#define BITBUS_IO 6 -#define MACRO_LINK 7 +#define CONSTANT 0 +#define PV_LINK 1 +#define VME_IO 2 +#define CAMAC_IO 3 +#define AB_IO 4 +#define GPIB_IO 5 +#define BITBUS_IO 6 +#define MACRO_LINK 7 #define JSON_LINK 8 -#define PN_LINK 9 -#define DB_LINK 10 -#define CA_LINK 11 -#define INST_IO 12 /* instrument */ -#define BBGPIB_IO 13 /* bitbus -> gpib */ -#define RF_IO 14 -#define VXI_IO 15 +#define PN_LINK 9 +#define DB_LINK 10 +#define CA_LINK 11 +#define INST_IO 12 /* instrument */ +#define BBGPIB_IO 13 /* bitbus -> gpib */ +#define RF_IO 14 +#define VXI_IO 15 #define LINK_NTYPES 16 typedef struct maplinkType { char *strvalue; @@ -48,25 +48,25 @@ typedef struct maplinkType { epicsShareExtern maplinkType pamaplinkType[]; -#define VXIDYNAMIC 0 -#define VXISTATIC 1 +#define VXIDYNAMIC 0 +#define VXISTATIC 1 -/* structure of a PV_LINK DB_LINK and a CA_LINK */ -/*Options defined by pvlMask */ -#define pvlOptMsMode 0x3 /*Maximize Severity mode selection*/ -#define pvlOptNMS 0 /*Don't Maximize Severity*/ -#define pvlOptMS 1 /*Maximize Severity always*/ -#define pvlOptMSI 2 /*Maximize Severity if INVALID*/ -#define pvlOptMSS 3 /*Maximize Severity and copy Status*/ -#define pvlOptPP 0x4 /*Process Passive*/ -#define pvlOptCA 0x8 /*Always make it a CA link*/ -#define pvlOptCP 0x10 /*CA + process on monitor*/ -#define pvlOptCPP 0x20 /*CA + process passive record on monitor*/ -#define pvlOptFWD 0x40 /*Generate ca_put for forward link*/ -#define pvlOptInpNative 0x80 /*Input native*/ -#define pvlOptInpString 0x100 /*Input as string*/ -#define pvlOptOutNative 0x200 /*Output native*/ -#define pvlOptOutString 0x400 /*Output as string*/ +/* structure of a PV_LINK DB_LINK and a CA_LINK */ +/*Options defined by pvlMask */ +#define pvlOptMsMode 0x3 /*Maximize Severity mode selection*/ +#define pvlOptNMS 0 /*Don't Maximize Severity*/ +#define pvlOptMS 1 /*Maximize Severity always*/ +#define pvlOptMSI 2 /*Maximize Severity if INVALID*/ +#define pvlOptMSS 3 /*Maximize Severity and copy Status*/ +#define pvlOptPP 0x4 /*Process Passive*/ +#define pvlOptCA 0x8 /*Always make it a CA link*/ +#define pvlOptCP 0x10 /*CA + process on monitor*/ +#define pvlOptCPP 0x20 /*CA + process passive record on monitor*/ +#define pvlOptFWD 0x40 /*Generate ca_put for forward link*/ +#define pvlOptInpNative 0x80 /*Input native*/ +#define pvlOptInpString 0x100 /*Input as string*/ +#define pvlOptOutNative 0x200 /*Output native*/ +#define pvlOptOutString 0x400 /*Output as string*/ /* DBLINK Flag bits */ #define DBLINK_FLAG_INITIALIZED 1 /* dbInitLink() called */ @@ -80,12 +80,12 @@ struct dbCommon; typedef long (*LINKCVT)(); struct pv_link { - ELLNODE backlinknode; - char *pvname; /* pvname link points to */ - void *pvt; /* CA or DB private */ - LINKCVT getCvt; /* input conversion function */ - short pvlMask; /* Options mask */ - short lastGetdbrType; /* last dbrType for DB or CA get */ + ELLNODE backlinknode; + char *pvname; /* pvname link points to */ + void *pvt; /* CA or DB private */ + LINKCVT getCvt; /* input conversion function */ + short pvlMask; /* Options mask */ + short lastGetdbrType; /* last dbrType for DB or CA get */ }; struct jlink; @@ -96,63 +96,63 @@ struct json_link { /* structure of a VME io channel */ struct vmeio { - short card; - short signal; - char *parm; + short card; + short signal; + char *parm; }; /* structure of a CAMAC io channel */ struct camacio { - short b; - short c; - short n; - short a; - short f; - char *parm; + short b; + short c; + short n; + short a; + short f; + char *parm; }; /* structure of a RF io channel */ struct rfio { - short branch; - short cryo; - short micro; - short dataset; - short element; - long ext; + short branch; + short cryo; + short micro; + short dataset; + short element; + long ext; }; /* structure of a Allen-Bradley io channel */ struct abio { - short link; - short adapter; - short card; - short signal; - char *parm; + short link; + short adapter; + short card; + short signal; + char *parm; }; /* structure of a gpib io channel */ struct gpibio { - short link; - short addr; /* device address */ - char *parm; + short link; + short addr; /* device address */ + char *parm; }; /* structure of a bitbus io channel */ struct bitbusio { - unsigned char link; - unsigned char node; - unsigned char port; - unsigned char signal; - char *parm; + unsigned char link; + unsigned char node; + unsigned char port; + unsigned char signal; + char *parm; }; /* structure of a bitbus to gpib io channel */ struct bbgpibio { - unsigned char link; - unsigned char bbaddr; - unsigned char gpibaddr; - unsigned char pad; - char *parm; + unsigned char link; + unsigned char bbaddr; + unsigned char gpibaddr; + unsigned char pad; + char *parm; }; /* structure of an instrument io link */ @@ -162,35 +162,35 @@ struct instio { /* structure of a vxi link */ struct vxiio { - short flag; /* 0 = frame/slot, 1 = SA */ - short frame; - short slot; - short la; /* logical address if flag =1 */ - short signal; - char *parm; + short flag; /* 0 = frame/slot, 1 = SA */ + short frame; + short slot; + short la; /* logical address if flag =1 */ + short signal; + char *parm; }; /* union of possible address structures */ union value { - char *constantStr; /*constant string*/ - struct macro_link macro_link; /* link containing macro substitution*/ + char *constantStr; /*constant string*/ + struct macro_link macro_link; /* link containing macro substitution*/ struct json_link json; /* JSON-encoded link */ - struct pv_link pv_link; /* link to process variable*/ - struct vmeio vmeio; /* vme io point */ - struct camacio camacio; /* camac io point */ - struct rfio rfio; /* CEBAF RF buffer interface */ - struct abio abio; /* allen-bradley io point */ - struct gpibio gpibio; - struct bitbusio bitbusio; - struct instio instio; /* instrument io link */ - struct bbgpibio bbgpibio; /* bitbus to gpib io link */ - struct vxiio vxiio; /* vxi io */ + struct pv_link pv_link; /* link to process variable*/ + struct vmeio vmeio; /* vme io point */ + struct camacio camacio; /* camac io point */ + struct rfio rfio; /* CEBAF RF buffer interface */ + struct abio abio; /* allen-bradley io point */ + struct gpibio gpibio; + struct bitbusio bitbusio; + struct instio instio; /* instrument io link */ + struct bbgpibio bbgpibio; /* bitbus to gpib io link */ + struct vxiio vxiio; /* vxi io */ }; struct lset; struct link { - struct dbCommon *precord; /* Pointer to record owning link */ + struct dbCommon *precord; /* Pointer to record owning link */ short type; short flags; struct lset *lset; diff --git a/modules/database/src/ioc/dbStatic/recSup.h b/modules/database/src/ioc/dbStatic/recSup.h index 2850e6292..ba77c34df 100644 --- a/modules/database/src/ioc/dbStatic/recSup.h +++ b/modules/database/src/ioc/dbStatic/recSup.h @@ -4,10 +4,10 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* recSup.h - * Record Support + * Record Support * Author: Marty Kraimer * Date: 6-1-90 */ @@ -64,22 +64,22 @@ typedef struct typed_rset rset; typedef long (*RECSUPFUN) () EPICS_DEPRECATED; /* ptr to record support function*/ -struct rset { /* record support entry table */ - long number; /*number of support routines */ - long (*report)(); /*print report */ - long (*init)(); /*init support */ - long (*init_record)(); /*init record */ - long (*process)(); /*process record */ - long (*special)(); /*special processing */ - long (*get_value)(); /*no longer used */ - long (*cvt_dbaddr)(); /*cvt dbAddr */ +struct rset { /* record support entry table */ + long number; /*number of support routines*/ + long (*report)(); /*print report */ + long (*init)(); /*init support */ + long (*init_record)(); /*init record */ + long (*process)(); /*process record */ + long (*special)(); /*special processing */ + long (*get_value)(); /*no longer used */ + long (*cvt_dbaddr)(); /*cvt dbAddr */ long (*get_array_info)(); long (*put_array_info)(); long (*get_units)(); long (*get_precision)(); - long (*get_enum_str)(); /*get string from enum item*/ - long (*get_enum_strs)();/*get all enum strings */ - long (*put_enum_str)(); /*put string from enum item*/ + long (*get_enum_str)(); /*get string from enum item */ + long (*get_enum_strs)();/*get all enum strings */ + long (*put_enum_str)(); /*put string from enum item */ long (*get_graphic_double)(); long (*get_control_double)(); long (*get_alarm_double)(); diff --git a/modules/database/src/ioc/dbStatic/special.h b/modules/database/src/ioc/dbStatic/special.h index 055287a64..313ba8c2b 100644 --- a/modules/database/src/ioc/dbStatic/special.h +++ b/modules/database/src/ioc/dbStatic/special.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* special.h */ @@ -23,41 +23,41 @@ extern "C" { /*NOTE Do NOT add aditional definitions with out modifying dbLexRoutines.c */ /* types 1-99 are global. Record specific must start with 100 */ -#define SPC_NOMOD 1 /*Field must not be modified */ -#define SPC_DBADDR 2 /*db_name_to_addr must call cvt_dbaddr */ -#define SPC_SCAN 3 /*A scan related field is being changed */ -#define SPC_ALARMACK 5 /*Special Alarm Acknowledgement*/ -#define SPC_AS 6 /* Access Security*/ -#define SPC_ATTRIBUTE 7 /* psuedo field, i.e. attribute field*/ +#define SPC_NOMOD 1 /*Field must not be modified*/ +#define SPC_DBADDR 2 /*db_name_to_addr must call cvt_dbaddr*/ +#define SPC_SCAN 3 /*A scan related field is being changed*/ +#define SPC_ALARMACK 5 /*Special Alarm Acknowledgement*/ +#define SPC_AS 6 /* Access Security*/ +#define SPC_ATTRIBUTE 7 /* psuedo field, i.e. attribute field*/ /* useful when record support must be notified of a field changing value*/ -#define SPC_MOD 100 -/* used by all records that support a reset field */ -#define SPC_RESET 101 /*The res field is being modified*/ +#define SPC_MOD 100 +/* used by all records that support a reset field*/ +#define SPC_RESET 101 /*The res field is being modified*/ /* Specific to conversion (Currently only ai */ -#define SPC_LINCONV 102 /*A linear conversion field is being changed*/ +#define SPC_LINCONV 102 /*A linear conversion field is being changed*/ /* Specific to calculation records */ -#define SPC_CALC 103 /*The CALC field is being changed*/ +#define SPC_CALC 103 /*The CALC field is being changed*/ #define SPC_NTYPES 9 typedef struct mapspcType{ - char *strvalue; - int value; + char *strvalue; + int value; }mapspcType; #ifndef SPECIAL_GBLSOURCE extern mapspcType pamapspcType[]; #else mapspcType pamapspcType[SPC_NTYPES] = { - {"SPC_NOMOD",SPC_NOMOD}, - {"SPC_DBADDR",SPC_DBADDR}, - {"SPC_SCAN",SPC_SCAN}, - {"SPC_ALARMACK",SPC_ALARMACK}, - {"SPC_AS",SPC_AS}, - {"SPC_MOD",SPC_MOD}, - {"SPC_RESET",SPC_RESET}, - {"SPC_LINCONV",SPC_LINCONV}, - {"SPC_CALC",SPC_CALC} + {"SPC_NOMOD",SPC_NOMOD}, + {"SPC_DBADDR",SPC_DBADDR}, + {"SPC_SCAN",SPC_SCAN}, + {"SPC_ALARMACK",SPC_ALARMACK}, + {"SPC_AS",SPC_AS}, + {"SPC_MOD",SPC_MOD}, + {"SPC_RESET",SPC_RESET}, + {"SPC_LINCONV",SPC_LINCONV}, + {"SPC_CALC",SPC_CALC} }; #endif /*SPECIAL_GBLSOURCE*/ diff --git a/modules/database/src/ioc/dbtemplate/dbLoadTemplate.h b/modules/database/src/ioc/dbtemplate/dbLoadTemplate.h index d08357b6e..8316931e7 100644 --- a/modules/database/src/ioc/dbtemplate/dbLoadTemplate.h +++ b/modules/database/src/ioc/dbtemplate/dbLoadTemplate.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* dbLoadTemplate.h */ diff --git a/modules/database/src/ioc/dbtemplate/dbLoadTemplate.y b/modules/database/src/ioc/dbtemplate/dbLoadTemplate.y index 1a4a47caf..20c403d59 100644 --- a/modules/database/src/ioc/dbtemplate/dbLoadTemplate.y +++ b/modules/database/src/ioc/dbtemplate/dbLoadTemplate.y @@ -4,7 +4,7 @@ * Copyright (c) 2006 UChicago, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include @@ -307,9 +307,9 @@ variable_definition: WORD EQUALS WORD ; %% - + #include "dbLoadTemplate_lex.c" - + static int yyerror(char* str) { if (str) diff --git a/modules/database/src/ioc/dbtemplate/dbLoadTemplate_lex.l b/modules/database/src/ioc/dbtemplate/dbLoadTemplate_lex.l index c6a99a8a1..4ea7b8063 100644 --- a/modules/database/src/ioc/dbtemplate/dbLoadTemplate_lex.l +++ b/modules/database/src/ioc/dbtemplate/dbLoadTemplate_lex.l @@ -2,7 +2,7 @@ * Copyright (c) 2006 UChicago, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ newline "\n" diff --git a/modules/database/src/ioc/dbtemplate/dbtoolsIocRegister.c b/modules/database/src/ioc/dbtemplate/dbtoolsIocRegister.c index 879f67e19..0efbccbf0 100644 --- a/modules/database/src/ioc/dbtemplate/dbtoolsIocRegister.c +++ b/modules/database/src/ioc/dbtemplate/dbtoolsIocRegister.c @@ -2,7 +2,7 @@ * Copyright (c) 2007 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include "iocsh.h" diff --git a/modules/database/src/ioc/dbtemplate/dbtoolsIocRegister.h b/modules/database/src/ioc/dbtemplate/dbtoolsIocRegister.h index ef35b2dfa..460182cd1 100644 --- a/modules/database/src/ioc/dbtemplate/dbtoolsIocRegister.h +++ b/modules/database/src/ioc/dbtemplate/dbtoolsIocRegister.h @@ -2,7 +2,7 @@ * Copyright (c) 2007 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef INC_dbtoolsIocRegister_H diff --git a/modules/database/src/ioc/misc/dlload.c b/modules/database/src/ioc/misc/dlload.c index ddf04f455..819f0f406 100644 --- a/modules/database/src/ioc/misc/dlload.c +++ b/modules/database/src/ioc/misc/dlload.c @@ -2,7 +2,7 @@ * Copyright (c) 2009 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include "epicsFindSymbol.h" diff --git a/modules/database/src/ioc/misc/epicsRelease.h b/modules/database/src/ioc/misc/epicsRelease.h index 298a1403b..0a2e99219 100644 --- a/modules/database/src/ioc/misc/epicsRelease.h +++ b/modules/database/src/ioc/misc/epicsRelease.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* epicsRelease.h */ diff --git a/modules/database/src/ioc/misc/iocInit.c b/modules/database/src/ioc/misc/iocInit.c index 4ce35ba18..d9abd6344 100644 --- a/modules/database/src/ioc/misc/iocInit.c +++ b/modules/database/src/ioc/misc/iocInit.c @@ -508,7 +508,7 @@ static void doInitRecord0(dbRecordType *pdbRecordType, dbCommon *precord, /* Initial UDF severity */ if (precord->udf && precord->stat == UDF_ALARM) - precord->sevr = precord->udfs; + precord->sevr = precord->udfs; /* Init DSET NOTE that result may be NULL */ pdevSup = dbDTYPtoDevSup(pdbRecordType, precord->dtyp); diff --git a/modules/database/src/ioc/misc/iocInit.h b/modules/database/src/ioc/misc/iocInit.h index 7e73b620a..cf1a6e294 100644 --- a/modules/database/src/ioc/misc/iocInit.h +++ b/modules/database/src/ioc/misc/iocInit.h @@ -4,9 +4,9 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* iocInit.h ioc initialization */ +/* iocInit.h ioc initialization */ #ifndef INCiocInith #define INCiocInith diff --git a/modules/database/src/ioc/misc/iocshRegisterCommon.h b/modules/database/src/ioc/misc/iocshRegisterCommon.h index 62a5d7c1b..b12edd67b 100644 --- a/modules/database/src/ioc/misc/iocshRegisterCommon.h +++ b/modules/database/src/ioc/misc/iocshRegisterCommon.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* iocshRegisterCommon.h */ /* Author: Marty Kraimer Date: 27APR2000 */ diff --git a/modules/database/src/ioc/misc/miscIocRegister.c b/modules/database/src/ioc/misc/miscIocRegister.c index 4dffdfca0..9fb78ebd4 100644 --- a/modules/database/src/ioc/misc/miscIocRegister.c +++ b/modules/database/src/ioc/misc/miscIocRegister.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include diff --git a/modules/database/src/ioc/misc/miscIocRegister.h b/modules/database/src/ioc/misc/miscIocRegister.h index 78a54d620..d38a385f3 100644 --- a/modules/database/src/ioc/misc/miscIocRegister.h +++ b/modules/database/src/ioc/misc/miscIocRegister.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef INC_miscIocRegister_H diff --git a/modules/database/src/ioc/registry/registryCommon.c b/modules/database/src/ioc/registry/registryCommon.c index dbd10d8f9..ba75a9a37 100644 --- a/modules/database/src/ioc/registry/registryCommon.c +++ b/modules/database/src/ioc/registry/registryCommon.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* registryCommon.c */ diff --git a/modules/database/src/ioc/registry/registryCommon.h b/modules/database/src/ioc/registry/registryCommon.h index 51b32dee3..625cbdc64 100644 --- a/modules/database/src/ioc/registry/registryCommon.h +++ b/modules/database/src/ioc/registry/registryCommon.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef INC_registryCommon_H diff --git a/modules/database/src/ioc/registry/registryDeviceSupport.h b/modules/database/src/ioc/registry/registryDeviceSupport.h index 78cdea6f0..6b62eea75 100644 --- a/modules/database/src/ioc/registry/registryDeviceSupport.h +++ b/modules/database/src/ioc/registry/registryDeviceSupport.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef INC_registryDeviceSupport_H diff --git a/modules/database/src/ioc/registry/registryDriverSupport.h b/modules/database/src/ioc/registry/registryDriverSupport.h index 79be29295..fa9970f80 100644 --- a/modules/database/src/ioc/registry/registryDriverSupport.h +++ b/modules/database/src/ioc/registry/registryDriverSupport.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef INC_registryDriverSupport_H diff --git a/modules/database/src/ioc/registry/registryFunction.h b/modules/database/src/ioc/registry/registryFunction.h index e20513771..da6ff6139 100644 --- a/modules/database/src/ioc/registry/registryFunction.h +++ b/modules/database/src/ioc/registry/registryFunction.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef INC_registryFunction_H diff --git a/modules/database/src/ioc/registry/registryIocRegister.c b/modules/database/src/ioc/registry/registryIocRegister.c index e36a809df..d4c959d2c 100644 --- a/modules/database/src/ioc/registry/registryIocRegister.c +++ b/modules/database/src/ioc/registry/registryIocRegister.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include "iocsh.h" diff --git a/modules/database/src/ioc/registry/registryIocRegister.h b/modules/database/src/ioc/registry/registryIocRegister.h index ca02ce0e3..bf65e973c 100644 --- a/modules/database/src/ioc/registry/registryIocRegister.h +++ b/modules/database/src/ioc/registry/registryIocRegister.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef INC_registryIocRegister_H diff --git a/modules/database/src/ioc/registry/registryJLinks.h b/modules/database/src/ioc/registry/registryJLinks.h index 7e6a8933e..7bb7efaa1 100644 --- a/modules/database/src/ioc/registry/registryJLinks.h +++ b/modules/database/src/ioc/registry/registryJLinks.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef INC_registryJLinks_H diff --git a/modules/database/src/ioc/registry/registryRecordType.h b/modules/database/src/ioc/registry/registryRecordType.h index 29ba714e8..f9326c698 100644 --- a/modules/database/src/ioc/registry/registryRecordType.h +++ b/modules/database/src/ioc/registry/registryRecordType.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef INC_registryRecordType_H diff --git a/modules/database/src/ioc/rsrv/camessage.c b/modules/database/src/ioc/rsrv/camessage.c index 10ab5024c..c34b06025 100644 --- a/modules/database/src/ioc/rsrv/camessage.c +++ b/modules/database/src/ioc/rsrv/camessage.c @@ -595,7 +595,7 @@ static void read_reply ( void *pArg, struct dbChannel *dbch, } /* - * Ensures timely response for events, but does queue + * Ensures timely response for events, but does queue * them up like db requests when the OPI does not keep up. */ if ( ! eventsRemaining ) @@ -679,7 +679,7 @@ static int read_action ( caHdrLargeArray *mp, void *pPayloadIn, struct client *p status = caNetConvert ( mp->m_dataType, pPayload, pPayload, TRUE /* host -> net format */, mp->m_count ); - if ( status != ECA_NORMAL ) { + if ( status != ECA_NORMAL ) { send_err ( mp, status, pClient, RECORD_NAME ( pciu->dbch ) ); SEND_UNLOCK ( pClient ); return RSRV_OK; @@ -779,7 +779,7 @@ static int write_action ( caHdrLargeArray *mp, status = caNetConvert ( mp->m_dataType, pPayload, pPayload, FALSE /* net -> host format */, mp->m_count ); - if ( status != ECA_NORMAL ) { + if ( status != ECA_NORMAL ) { log_header ("invalid data type", client, mp, pPayload, 0); SEND_LOCK(client); send_err( @@ -849,7 +849,7 @@ static int host_name_action ( caHdrLargeArray *mp, void *pPayload, pName = (char *) pPayload; size = epicsStrnLen(pName, mp->m_postsize)+1; if (size > 512 || size > mp->m_postsize) { - log_header ( "bad (very long) host name", + log_header ( "bad (very long) host name", client, mp, pPayload, 0 ); SEND_LOCK(client); send_err( @@ -936,7 +936,7 @@ static int client_name_action ( caHdrLargeArray *mp, void *pPayload, pName = (char *) pPayload; size = epicsStrnLen(pName, mp->m_postsize)+1; if (size > 512 || size > mp->m_postsize) { - log_header ("a very long user name was specified", + log_header ("a very long user name was specified", client, mp, pPayload, 0); SEND_LOCK(client); send_err( @@ -1325,7 +1325,7 @@ static int claim_ciu_action ( caHdrLargeArray *mp, { struct channel_in_use * pciu = (struct channel_in_use *) ppn->usrPvt; struct rsrv_put_notify *pNotify; - + if(ppn->status==notifyCanceled) return 0; /* * No locking in this method because only a dbNotifyCancel could interrupt @@ -1337,7 +1337,7 @@ static int claim_ciu_action ( caHdrLargeArray *mp, return db_put_process(ppn,type, pNotify->dbrType,pNotify->pbuffer,pNotify->nRequest); } - + /* * write_notify_done_callback() * @@ -1760,7 +1760,7 @@ static int write_notify_action ( caHdrLargeArray *mp, void *pPayload, status = caNetConvert ( mp->m_dataType, pPayload, pciu->pPutNotify->pbuffer, FALSE /* net -> host format */, mp->m_count ); - if ( status != ECA_NORMAL ) { + if ( status != ECA_NORMAL ) { log_header ("invalid data type", client, mp, pPayload, 0); putNotifyErrorReply ( client, mp, status ); return RSRV_ERROR; @@ -1954,7 +1954,7 @@ static int clear_channel_reply ( caHdrLargeArray *mp, errMessage(status, RECORD_NAME(pciu->dbch)); return RSRV_ERROR; } - + epicsMutexMustLock ( client->chanListLock ); if ( pciu->state == rsrvCS_inService || pciu->state == rsrvCS_pendConnectResp ) { @@ -2252,7 +2252,7 @@ static int search_reply_udp ( caHdrLargeArray *mp, void *pPayload, struct client /* * search_reply_tcp () */ -static int search_reply_tcp ( +static int search_reply_tcp ( caHdrLargeArray *mp, void *pPayload, struct client *client ) { char *pName = (char *) pPayload; @@ -2270,7 +2270,7 @@ static int search_reply_tcp ( * check the sanity of the message */ if (mp->m_postsize<=1) { - log_header ("empty PV name in UDP search request?", + log_header ("empty PV name in UDP search request?", client, mp, pPayload, 0); return RSRV_OK; } @@ -2289,9 +2289,9 @@ static int search_reply_tcp ( */ spaceAvailOnFreeList = freeListItemsAvail ( rsrvChanFreeList ) > 0 && freeListItemsAvail ( rsrvEventFreeList ) > reasonableMonitorSpace; - spaceNeeded = sizeof (struct channel_in_use) + + spaceNeeded = sizeof (struct channel_in_use) + reasonableMonitorSpace * sizeof (struct event_ext); - if ( ! ( osiSufficentSpaceInPool(spaceNeeded) || spaceAvailOnFreeList ) ) { + if ( ! ( osiSufficentSpaceInPool(spaceNeeded) || spaceAvailOnFreeList ) ) { SEND_LOCK(client); send_err ( mp, ECA_ALLOCMEM, client, "Server memory exhausted" ); SEND_UNLOCK(client); @@ -2299,7 +2299,7 @@ static int search_reply_tcp ( } SEND_LOCK ( client ); - status = cas_copy_in_header ( client, CA_PROTO_SEARCH, + status = cas_copy_in_header ( client, CA_PROTO_SEARCH, 0, ca_server_port, 0, ~0U, mp->m_available, 0 ); if ( status != ECA_NORMAL ) { SEND_UNLOCK ( client ); diff --git a/modules/database/src/ioc/rsrv/camsgtask.c b/modules/database/src/ioc/rsrv/camsgtask.c index 04a7e780e..2124e7d58 100644 --- a/modules/database/src/ioc/rsrv/camsgtask.c +++ b/modules/database/src/ioc/rsrv/camsgtask.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Author: Jeffrey O. Hill @@ -57,7 +57,7 @@ void camsgtask ( void *pParm ) if (status < 0) { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); errlogPrintf("CAS: FIONREAD error: %s\n", sockErrBuf); @@ -69,7 +69,7 @@ void camsgtask ( void *pParm ) client->recv.stk = 0; assert ( client->recv.maxstk >= client->recv.cnt ); - nchars = recv ( client->sock, &client->recv.buf[client->recv.cnt], + nchars = recv ( client->sock, &client->recv.buf[client->recv.cnt], (int) ( client->recv.maxstk - client->recv.cnt ), 0 ); if ( nchars == 0 ){ if ( CASDEBUG > 0 ) { @@ -127,9 +127,9 @@ void camsgtask ( void *pParm ) /* * overlapping regions handled - * properly by memmove + * properly by memmove */ - memmove (client->recv.buf, + memmove (client->recv.buf, &client->recv.buf[client->recv.stk], bytes_left); client->recv.cnt = bytes_left; } @@ -142,9 +142,9 @@ void camsgtask ( void *pParm ) /* flush any queued messages before shutdown */ cas_send_bs_msg(client, 1); - + client->recv.cnt = 0ul; - + /* * disconnect when there are severe message errors */ diff --git a/modules/database/src/ioc/rsrv/caserverio.c b/modules/database/src/ioc/rsrv/caserverio.c index afce46e25..eceb35b40 100644 --- a/modules/database/src/ioc/rsrv/caserverio.c +++ b/modules/database/src/ioc/rsrv/caserverio.c @@ -5,9 +5,9 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* * Author: Jeffrey O. Hill * hill@luke.lanl.gov * (505) 665 1831 @@ -75,7 +75,7 @@ void cas_send_bs_msg ( struct client *pclient, int lock_needed ) } else { unsigned bytesLeft = pclient->send.stk - transferSize; - memmove ( pclient->send.buf, &pclient->send.buf[transferSize], + memmove ( pclient->send.buf, &pclient->send.buf[transferSize], bytesLeft ); pclient->send.stk = bytesLeft; } @@ -103,7 +103,7 @@ void cas_send_bs_msg ( struct client *pclient, int lock_needed ) ipAddrToDottedIP ( &pclient->addr, buf, sizeof(buf) ); - if ( + if ( anerrno == SOCK_ECONNABORTED || anerrno == SOCK_ECONNRESET || anerrno == SOCK_EPIPE || @@ -112,7 +112,7 @@ void cas_send_bs_msg ( struct client *pclient, int lock_needed ) } else { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); errlogPrintf ( "CAS: TCP send to %s failed: %s\n", buf, sockErrBuf); @@ -138,7 +138,7 @@ void cas_send_bs_msg ( struct client *pclient, int lock_needed ) int status = shutdown ( pclient->sock, SHUT_RDWR ); if ( status ) { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); errlogPrintf ("CAS: Socket shutdown error: %s\n", sockErrBuf ); @@ -174,7 +174,7 @@ void cas_send_dg_msg ( struct client * pclient ) { int status; int sizeDG; - char * pDG; + char * pDG; caHdr * pMsg; if ( CASDEBUG > 2 && pclient->send.stk ) { @@ -208,14 +208,14 @@ void cas_send_dg_msg ( struct client * pclient ) epicsTimeGetCurrent ( &pclient->time_at_last_send ); } else { - errlogPrintf ( + errlogPrintf ( "CAS: System failed to send entire udp frame?\n" ); } } else { char sockErrBuf[64]; char buf[128]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); ipAddrToDottedIP ( &pclient->addr, buf, sizeof(buf) ); errlogPrintf( "CAS: UDP send to %s failed: %s\n", @@ -238,19 +238,19 @@ void cas_send_dg_msg ( struct client * pclient ) /* * - * cas_copy_in_header() + * cas_copy_in_header() * * Allocate space in the outgoing message buffer and * copy in message header. Return pointer to message body. * * send lock must be on while in this routine * - * Returns a valid ptr to message body or NULL if the msg + * Returns a valid ptr to message body or NULL if the msg * will not fit. - */ -int cas_copy_in_header ( + */ +int cas_copy_in_header ( struct client *pclient, ca_uint16_t response, ca_uint32_t payloadSize, - ca_uint16_t dataType, ca_uint32_t nElem, ca_uint32_t cid, + ca_uint16_t dataType, ca_uint32_t nElem, ca_uint32_t cid, ca_uint32_t responseSpecific, void **ppPayload ) { unsigned msgSize; @@ -319,7 +319,7 @@ int cas_copy_in_header ( /* zero out pad bytes */ if ( alignedPayloadSize > payloadSize ) { char *p = ( char * ) *ppPayload; - memset ( p + payloadSize, '\0', + memset ( p + payloadSize, '\0', alignedPayloadSize - payloadSize ); } @@ -367,7 +367,7 @@ void cas_commit_msg ( struct client *pClient, ca_uint32_t size ) } /* - * this assumes that we have already checked to see + * this assumes that we have already checked to see * if sufficent bytes are available */ ca_uint16_t rsrvGetUInt16 ( struct message_buffer *recv ) @@ -375,7 +375,7 @@ ca_uint16_t rsrvGetUInt16 ( struct message_buffer *recv ) ca_uint8_t *pBuf = ( ca_uint8_t * ) recv->buf; ca_uint16_t result; /* - * this assumes that we have already checked to see + * this assumes that we have already checked to see * if sufficent bytes are available */ assert ( recv->cnt - recv->stk >= 2u ); @@ -385,7 +385,7 @@ ca_uint16_t rsrvGetUInt16 ( struct message_buffer *recv ) } /* - * this assumes that we have already checked to see + * this assumes that we have already checked to see * if sufficent bytes are available */ ca_uint32_t rsrvGetUInt32 ( struct message_buffer *recv ) @@ -393,7 +393,7 @@ ca_uint32_t rsrvGetUInt32 ( struct message_buffer *recv ) ca_uint8_t *pBuf = ( ca_uint8_t * ) recv->buf; ca_uint32_t result; /* - * this assumes that we have already checked to see + * this assumes that we have already checked to see * if sufficent bytes are available */ assert ( recv->cnt - recv->stk >= 4u ); diff --git a/modules/database/src/ioc/rsrv/cast_server.c b/modules/database/src/ioc/rsrv/cast_server.c index 4039d0f6f..ac2ad8fc7 100644 --- a/modules/database/src/ioc/rsrv/cast_server.c +++ b/modules/database/src/ioc/rsrv/cast_server.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Author: Jeffrey O. Hill @@ -16,7 +16,7 @@ * ------------ * .01 * Dont send channel found message unless there is memory, a task slot, - * and a TCP socket available. Send a diagnostic instead. + * and a TCP socket available. Send a diagnostic instead. * Or ... make the timeout shorter? This is only a problem if * they persist in trying to make a connection after getting no * response. @@ -48,7 +48,7 @@ #define epicsExportSharedSymbols #include "rsrv.h" #include "server.h" - + #define TIMEOUT 60.0 /* sec */ /* @@ -68,7 +68,7 @@ static void clean_addrq(struct client *client) epicsTimeGetCurrent ( ¤t ); epicsMutexMustLock ( client->chanListLock ); - pnextciu = (struct channel_in_use *) + pnextciu = (struct channel_in_use *) client->chanList.node.next; while( (pciu = pnextciu) ) { @@ -111,7 +111,7 @@ static void clean_addrq(struct client *client) * CAST_SERVER * * service UDP messages - * + * */ void cast_server(void *pParm) { @@ -169,12 +169,12 @@ void cast_server(void *pParm) client->recv.buf, client->recv.maxstk, 0, - (struct sockaddr *)&new_recv_addr, + (struct sockaddr *)&new_recv_addr, &recv_addr_size); if (status < 0) { if (SOCKERRNO != SOCK_EINTR) { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); epicsPrintf ("CAS: UDP recv error: %s\n", sockErrBuf); @@ -201,16 +201,16 @@ void cast_server(void *pParm) client->seqNoOfReq = 0; /* - * If we are talking to a new client flush to the old one - * in case we are holding UDP messages waiting to + * If we are talking to a new client flush to the old one + * in case we are holding UDP messages waiting to * see if the next message is for this same client. */ if (client->send.stk>sizeof(caHdr)) { status = memcmp(&client->addr, &new_recv_addr, recv_addr_size); - if(status){ - /* - * if the address is different + if(status){ + /* + * if the address is different */ cas_send_dg_msg(client); client->addr = new_recv_addr; @@ -222,9 +222,9 @@ void cast_server(void *pParm) if (CASDEBUG>1) { char buf[40]; - + ipAddrToDottedIP (&client->addr, buf, sizeof(buf)); - errlogPrintf ("CAS: cast server msg of %d bytes from addr %s\n", + errlogPrintf ("CAS: cast server msg of %d bytes from addr %s\n", client->recv.cnt, buf); } diff --git a/modules/database/src/ioc/rsrv/online_notify.c b/modules/database/src/ioc/rsrv/online_notify.c index 4627c39de..8f2ae3bcb 100644 --- a/modules/database/src/ioc/rsrv/online_notify.c +++ b/modules/database/src/ioc/rsrv/online_notify.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * tell CA clients this a server has joined the network @@ -47,9 +47,9 @@ void rsrv_online_notify_task(void *pParm) int status; ca_uint32_t beaconCounter = 0; int *lastError; - + taskwdInsert (epicsThreadGetIdSelf(),NULL,NULL); - + if ( envGetConfigParamPtr ( & EPICS_CAS_BEACON_PERIOD ) ) { longStatus = envGetDoubleConfigParam ( & EPICS_CAS_BEACON_PERIOD, & maxPeriod ); } @@ -63,7 +63,7 @@ void rsrv_online_notify_task(void *pParm) epicsPrintf ("Setting \"%s\" = %f\n", EPICS_CAS_BEACON_PERIOD.name, maxPeriod); } - + delay = 0.02; /* initial beacon period in sec */ maxdelay = maxPeriod; diff --git a/modules/database/src/std/dev/asSubRecordFunctions.c b/modules/database/src/std/dev/asSubRecordFunctions.c index 5bbd95886..15d190f46 100644 --- a/modules/database/src/std/dev/asSubRecordFunctions.c +++ b/modules/database/src/std/dev/asSubRecordFunctions.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* asSubRecordFunctions.c */ @@ -36,16 +36,16 @@ static void myCallback(epicsCallback *pcallback) { - ASDBCALLBACK *pasdbcallback = (ASDBCALLBACK *)pcallback; - subRecord *precord; - rset *prset; + ASDBCALLBACK *pasdbcallback = (ASDBCALLBACK *)pcallback; + subRecord *precord; + rset *prset; callbackGetUser(precord,pcallback); prset=(rset *)(precord->rset); precord->val = 0.0; if(pasdbcallback->status) { - recGblSetSevr(precord,READ_ALARM,precord->brsv); - recGblRecordError(pasdbcallback->status,precord,"asInit Failed"); + recGblSetSevr(precord,READ_ALARM,precord->brsv); + recGblRecordError(pasdbcallback->status,precord,"asInit Failed"); } dbScanLock((dbCommon *)precord); (*prset->process)((dbCommon *)precord); @@ -69,11 +69,11 @@ long asSubProcess(subRecord *precord) ASDBCALLBACK *pcallback = (ASDBCALLBACK *)precord->dpvt; if(!precord->pact && precord->val==1.0) { - db_post_events(precord,&precord->val,DBE_VALUE); - callbackSetPriority(precord->prio,&pcallback->callback); - asInitAsyn(pcallback); - precord->pact=TRUE; - return(1); + db_post_events(precord,&precord->val,DBE_VALUE); + callbackSetPriority(precord->prio,&pcallback->callback); + asInitAsyn(pcallback); + precord->pact=TRUE; + return(1); } db_post_events(precord,&precord->val,DBE_VALUE); return(0); diff --git a/modules/database/src/std/dev/devAaoSoft.c b/modules/database/src/std/dev/devAaoSoft.c index 98a84cd1a..68e2c049e 100644 --- a/modules/database/src/std/dev/devAaoSoft.c +++ b/modules/database/src/std/dev/devAaoSoft.c @@ -4,12 +4,12 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * devAaoSoft.c - Device Support Routines for soft Waveform Records - * + * * Original Author: Bob Dalesio * Current Author: Dirk Zimoch * Date: 27-MAY-2010 diff --git a/modules/database/src/std/dev/devAiSoft.c b/modules/database/src/std/dev/devAiSoft.c index 136c7f5fe..e41d9fedb 100644 --- a/modules/database/src/std/dev/devAiSoft.c +++ b/modules/database/src/std/dev/devAiSoft.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/database/src/std/dev/devAiSoftRaw.c b/modules/database/src/std/dev/devAiSoftRaw.c index 39bf6b956..d460b4b4d 100644 --- a/modules/database/src/std/dev/devAiSoftRaw.c +++ b/modules/database/src/std/dev/devAiSoftRaw.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/database/src/std/dev/devAoSoft.c b/modules/database/src/std/dev/devAoSoft.c index 8772cdede..fbca4c16d 100644 --- a/modules/database/src/std/dev/devAoSoft.c +++ b/modules/database/src/std/dev/devAoSoft.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* devAoSoft.c */ diff --git a/modules/database/src/std/dev/devAoSoftCallback.c b/modules/database/src/std/dev/devAoSoftCallback.c index 5144c772a..aab70d7a2 100644 --- a/modules/database/src/std/dev/devAoSoftCallback.c +++ b/modules/database/src/std/dev/devAoSoftCallback.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* devAoSoftCallbackCallback.c */ /* diff --git a/modules/database/src/std/dev/devAoSoftRaw.c b/modules/database/src/std/dev/devAoSoftRaw.c index bb2ae7d94..4d7da797b 100644 --- a/modules/database/src/std/dev/devAoSoftRaw.c +++ b/modules/database/src/std/dev/devAoSoftRaw.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* devAoSoftRaw.c */ diff --git a/modules/database/src/std/dev/devBiSoft.c b/modules/database/src/std/dev/devBiSoft.c index 41a308ae7..a3e7fa14b 100644 --- a/modules/database/src/std/dev/devBiSoft.c +++ b/modules/database/src/std/dev/devBiSoft.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/database/src/std/dev/devBiSoftRaw.c b/modules/database/src/std/dev/devBiSoftRaw.c index 90fbcbbcc..377ad7a92 100644 --- a/modules/database/src/std/dev/devBiSoftRaw.c +++ b/modules/database/src/std/dev/devBiSoftRaw.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/database/src/std/dev/devBoSoft.c b/modules/database/src/std/dev/devBoSoft.c index b86454252..6c0e6c618 100644 --- a/modules/database/src/std/dev/devBoSoft.c +++ b/modules/database/src/std/dev/devBoSoft.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* devBoSoft.c - Device Support Routines for Soft Binary Output*/ @@ -42,11 +42,11 @@ epicsExportAddress(dset, devBoSoft); static long init_record(dbCommon *pcommon) { long status=0; - + /* dont convert */ status=2; return status; - + } /* end init_record() */ static long write_bo(boRecord *prec) diff --git a/modules/database/src/std/dev/devBoSoftRaw.c b/modules/database/src/std/dev/devBoSoftRaw.c index b0bd8542a..6d72e53c7 100644 --- a/modules/database/src/std/dev/devBoSoftRaw.c +++ b/modules/database/src/std/dev/devBoSoftRaw.c @@ -5,13 +5,13 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* devBoSoftRaw.c - Device Support Routines for SoftRaw Binary Output*/ /* - * Author: Janet Anderson - * Date: 3-28-92 + * Author: Janet Anderson + * Date: 3-28-92 */ @@ -41,11 +41,11 @@ epicsExportAddress(dset, devBoSoftRaw); static long init_record(dbCommon *pcommon) { long status; - + /*Don't convert*/ status = 2; return status; - + } /* end init_record() */ static long write_bo(boRecord *prec) diff --git a/modules/database/src/std/dev/devCalcoutSoft.c b/modules/database/src/std/dev/devCalcoutSoft.c index 52ee11b8d..fcca421ef 100644 --- a/modules/database/src/std/dev/devCalcoutSoft.c +++ b/modules/database/src/std/dev/devCalcoutSoft.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* devCalcoutSoft.c */ diff --git a/modules/database/src/std/dev/devCalcoutSoftCallback.c b/modules/database/src/std/dev/devCalcoutSoftCallback.c index 3d357b8d9..ca93a5ff5 100644 --- a/modules/database/src/std/dev/devCalcoutSoftCallback.c +++ b/modules/database/src/std/dev/devCalcoutSoftCallback.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* devCalcoutSoftCallback.c */ diff --git a/modules/database/src/std/dev/devEnviron.c b/modules/database/src/std/dev/devEnviron.c index 8e4bd7937..df09d8735 100644 --- a/modules/database/src/std/dev/devEnviron.c +++ b/modules/database/src/std/dev/devEnviron.c @@ -2,7 +2,7 @@ * Copyright (c) 2016 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* devEnviron.c */ diff --git a/modules/database/src/std/dev/devEventSoft.c b/modules/database/src/std/dev/devEventSoft.c index 4020c91f8..55ca8744c 100644 --- a/modules/database/src/std/dev/devEventSoft.c +++ b/modules/database/src/std/dev/devEventSoft.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/database/src/std/dev/devGeneralTime.c b/modules/database/src/std/dev/devGeneralTime.c index f03275165..3b1a55139 100644 --- a/modules/database/src/std/dev/devGeneralTime.c +++ b/modules/database/src/std/dev/devGeneralTime.c @@ -4,8 +4,8 @@ \*************************************************************************/ /* - * Original Author: Sheng Peng, ORNL / SNS Project - * Date: 07/2004 + * Original Author: Sheng Peng, ORNL / SNS Project + * Date: 07/2004 * * EPICS device support for general timestamp support * diff --git a/modules/database/src/std/dev/devHistogramSoft.c b/modules/database/src/std/dev/devHistogramSoft.c index a410fef5c..30159c174 100644 --- a/modules/database/src/std/dev/devHistogramSoft.c +++ b/modules/database/src/std/dev/devHistogramSoft.c @@ -5,12 +5,12 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* devHistogramSoft.c */ /* - * Author: Janet Anderson - * Date: 07/02/91 + * Author: Janet Anderson + * Date: 07/02/91 */ #include #include diff --git a/modules/database/src/std/dev/devI64inSoft.c b/modules/database/src/std/dev/devI64inSoft.c index 76a049b85..d2b3560f1 100644 --- a/modules/database/src/std/dev/devI64inSoft.c +++ b/modules/database/src/std/dev/devI64inSoft.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/database/src/std/dev/devI64outSoft.c b/modules/database/src/std/dev/devI64outSoft.c index f94b90855..26caab6ec 100644 --- a/modules/database/src/std/dev/devI64outSoft.c +++ b/modules/database/src/std/dev/devI64outSoft.c @@ -9,7 +9,7 @@ /* * Original Author: Janet Anderson - * Date: 09-23-91 + * Date: 09-23-91 */ #include diff --git a/modules/database/src/std/dev/devLiSoft.c b/modules/database/src/std/dev/devLiSoft.c index 4c9912bc6..6bbbf604b 100644 --- a/modules/database/src/std/dev/devLiSoft.c +++ b/modules/database/src/std/dev/devLiSoft.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/database/src/std/dev/devLoSoft.c b/modules/database/src/std/dev/devLoSoft.c index c9b8fe342..6df61dede 100644 --- a/modules/database/src/std/dev/devLoSoft.c +++ b/modules/database/src/std/dev/devLoSoft.c @@ -5,12 +5,12 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* devLoSoft.c */ /* - * Author: Janet Anderson - * Date: 09-23-91 + * Author: Janet Anderson + * Date: 09-23-91 */ #include #include @@ -40,7 +40,7 @@ static long init_record(dbCommon *pcommon) return 0; } /* end init_record() */ -static long write_longout(longoutRecord *prec) +static long write_longout(longoutRecord *prec) { dbPutLink(&prec->out,DBR_LONG, &prec->val,1); return 0; diff --git a/modules/database/src/std/dev/devLoSoftCallback.c b/modules/database/src/std/dev/devLoSoftCallback.c index 3883e1906..484b1b086 100644 --- a/modules/database/src/std/dev/devLoSoftCallback.c +++ b/modules/database/src/std/dev/devLoSoftCallback.c @@ -36,7 +36,7 @@ longoutdset devLoSoftCallback = { }; epicsExportAddress(dset, devLoSoftCallback); -static long write_longout(longoutRecord *prec) +static long write_longout(longoutRecord *prec) { struct link *plink = &prec->out; long status; diff --git a/modules/database/src/std/dev/devLsoSoftCallback.c b/modules/database/src/std/dev/devLsoSoftCallback.c index 08fca77c2..0db224f42 100644 --- a/modules/database/src/std/dev/devLsoSoftCallback.c +++ b/modules/database/src/std/dev/devLsoSoftCallback.c @@ -2,7 +2,7 @@ * Copyright (c) 2012 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Author: Andrew Johnson diff --git a/modules/database/src/std/dev/devMbbiDirectSoft.c b/modules/database/src/std/dev/devMbbiDirectSoft.c index 2138500be..8b9b6cfba 100644 --- a/modules/database/src/std/dev/devMbbiDirectSoft.c +++ b/modules/database/src/std/dev/devMbbiDirectSoft.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/database/src/std/dev/devMbbiDirectSoftRaw.c b/modules/database/src/std/dev/devMbbiDirectSoftRaw.c index 007568648..8f4962301 100644 --- a/modules/database/src/std/dev/devMbbiDirectSoftRaw.c +++ b/modules/database/src/std/dev/devMbbiDirectSoftRaw.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/database/src/std/dev/devMbbiSoft.c b/modules/database/src/std/dev/devMbbiSoft.c index d1e0716b3..bffbd94bd 100644 --- a/modules/database/src/std/dev/devMbbiSoft.c +++ b/modules/database/src/std/dev/devMbbiSoft.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/database/src/std/dev/devMbbiSoftCallback.c b/modules/database/src/std/dev/devMbbiSoftCallback.c index 6466b4c14..9419c76c1 100644 --- a/modules/database/src/std/dev/devMbbiSoftCallback.c +++ b/modules/database/src/std/dev/devMbbiSoftCallback.c @@ -100,7 +100,7 @@ static long add_record(dbCommon *pcommon) pdevPvt = calloc(1, sizeof(*pdevPvt)); if (!pdevPvt) { - long status = S_db_noMemory; + long status = S_db_noMemory; recGblRecordError(status, (void *)prec, "devMbbiSoftCallback (add_record) out of memory, calloc() failed"); diff --git a/modules/database/src/std/dev/devMbbiSoftRaw.c b/modules/database/src/std/dev/devMbbiSoftRaw.c index 40617ab6b..ffa8835f9 100644 --- a/modules/database/src/std/dev/devMbbiSoftRaw.c +++ b/modules/database/src/std/dev/devMbbiSoftRaw.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/database/src/std/dev/devMbboDirectSoft.c b/modules/database/src/std/dev/devMbboDirectSoft.c index dc769b2ca..2a93d1a30 100644 --- a/modules/database/src/std/dev/devMbboDirectSoft.c +++ b/modules/database/src/std/dev/devMbboDirectSoft.c @@ -19,7 +19,7 @@ #include "mbboDirectRecord.h" #include "epicsExport.h" -static long write_mbbo(mbboDirectRecord *prec) +static long write_mbbo(mbboDirectRecord *prec) { dbPutLink(&prec->out, DBR_ULONG, &prec->val, 1); return 0; diff --git a/modules/database/src/std/dev/devMbboDirectSoftRaw.c b/modules/database/src/std/dev/devMbboDirectSoftRaw.c index f3d45a7fb..6a9221ac6 100644 --- a/modules/database/src/std/dev/devMbboDirectSoftRaw.c +++ b/modules/database/src/std/dev/devMbboDirectSoftRaw.c @@ -32,7 +32,7 @@ static long init_record(dbCommon *pcommon) return 2; /* Don't convert */ } -static long write_mbbo(mbboDirectRecord *prec) +static long write_mbbo(mbboDirectRecord *prec) { epicsUInt32 data; diff --git a/modules/database/src/std/dev/devMbboSoft.c b/modules/database/src/std/dev/devMbboSoft.c index dfe856982..a861a6a6c 100644 --- a/modules/database/src/std/dev/devMbboSoft.c +++ b/modules/database/src/std/dev/devMbboSoft.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* devMbboSoft.c */ /* @@ -40,7 +40,7 @@ static long init_record(dbCommon *pcommon) { /*dont convert*/ return 2; - + } /* end init_record() */ static long write_mbbo(mbboRecord *prec) diff --git a/modules/database/src/std/dev/devPrintfSoft.c b/modules/database/src/std/dev/devPrintfSoft.c index 053b6e44d..a2043b1e2 100644 --- a/modules/database/src/std/dev/devPrintfSoft.c +++ b/modules/database/src/std/dev/devPrintfSoft.c @@ -2,7 +2,7 @@ * Copyright (c) 2012 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Author: Andrew Johnson diff --git a/modules/database/src/std/dev/devPrintfSoftCallback.c b/modules/database/src/std/dev/devPrintfSoftCallback.c index a17efc400..cce2ccb0c 100644 --- a/modules/database/src/std/dev/devPrintfSoftCallback.c +++ b/modules/database/src/std/dev/devPrintfSoftCallback.c @@ -2,7 +2,7 @@ * Copyright (c) 2012 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Author: Andrew Johnson diff --git a/modules/database/src/std/dev/devSiSoft.c b/modules/database/src/std/dev/devSiSoft.c index 7b978033a..47c92b032 100644 --- a/modules/database/src/std/dev/devSiSoft.c +++ b/modules/database/src/std/dev/devSiSoft.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/database/src/std/dev/devSoSoft.c b/modules/database/src/std/dev/devSoSoft.c index 5af5a52d6..0a39bf5ad 100644 --- a/modules/database/src/std/dev/devSoSoft.c +++ b/modules/database/src/std/dev/devSoSoft.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Author: Janet Anderson diff --git a/modules/database/src/std/dev/devStdio.c b/modules/database/src/std/dev/devStdio.c index d8646d95a..7cdff4239 100644 --- a/modules/database/src/std/dev/devStdio.c +++ b/modules/database/src/std/dev/devStdio.c @@ -2,7 +2,7 @@ * Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include diff --git a/modules/database/src/std/dev/devTimestamp.c b/modules/database/src/std/dev/devTimestamp.c index 06f694eac..ebf437179 100644 --- a/modules/database/src/std/dev/devTimestamp.c +++ b/modules/database/src/std/dev/devTimestamp.c @@ -8,7 +8,7 @@ /* * Device support for EPICS time stamps * - * Original Author: Eric Norum + * Original Author: Eric Norum */ #include "dbDefs.h" diff --git a/modules/database/src/std/link/lnkCalc.c b/modules/database/src/std/link/lnkCalc.c index 5bcc485d7..bf0cc6728 100644 --- a/modules/database/src/std/link/lnkCalc.c +++ b/modules/database/src/std/link/lnkCalc.c @@ -196,7 +196,7 @@ static jlif_result lnkCalc_string(jlink *pjlink, const char *val, size_t len) } inbuf = malloc(len+1); - if(!inbuf) { + if(!inbuf) { errlogPrintf("lnkCalc: Out of memory\n"); free(postbuf); return jlif_stop; diff --git a/modules/database/src/std/rec/aSubRecord.c b/modules/database/src/std/rec/aSubRecord.c index b7d2286b6..666558bbf 100644 --- a/modules/database/src/std/rec/aSubRecord.c +++ b/modules/database/src/std/rec/aSubRecord.c @@ -348,7 +348,7 @@ static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd) aSubRecord *prec = (aSubRecord *)paddr->precord; int fieldIndex = dbGetFieldIndex(paddr); int linkNumber; - + linkNumber = get_inlinkNumber(fieldIndex); if (linkNumber >= 0) { dbGetGraphicLimits(&prec->inpa + linkNumber, diff --git a/modules/database/src/std/rec/aiRecord.c b/modules/database/src/std/rec/aiRecord.c index 512a01287..3bc6a5545 100644 --- a/modules/database/src/std/rec/aiRecord.c +++ b/modules/database/src/std/rec/aiRecord.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* aiRecord.c - Record Support Routines for Analog Input records */ @@ -63,26 +63,26 @@ static long get_precision(const DBADDR *, long *); static long get_graphic_double(DBADDR *, struct dbr_grDouble *); static long get_control_double(DBADDR *, struct dbr_ctrlDouble *); static long get_alarm_double(DBADDR *, struct dbr_alDouble *); - + rset aiRSET={ - RSETNUMBER, - report, - initialize, - init_record, - process, - special, - get_value, - cvt_dbaddr, - get_array_info, - put_array_info, - get_units, - get_precision, - get_enum_str, - get_enum_strs, - put_enum_str, - get_graphic_double, - get_control_double, - get_alarm_double + RSETNUMBER, + report, + initialize, + init_record, + process, + special, + get_value, + cvt_dbaddr, + get_array_info, + put_array_info, + get_units, + get_precision, + get_enum_str, + get_enum_strs, + put_enum_str, + get_graphic_double, + get_control_double, + get_alarm_double }; epicsExportAddress(rset,aiRSET); @@ -94,8 +94,8 @@ static long readValue(aiRecord *prec); static long init_record(struct dbCommon *pcommon, int pass) { struct aiRecord *prec = (struct aiRecord *)pcommon; - aidset *pdset; - double eoff = prec->eoff, eslo = prec->eslo; + aidset *pdset; + double eoff = prec->eoff, eslo = prec->eslo; if (pass == 0) return 0; @@ -103,27 +103,27 @@ static long init_record(struct dbCommon *pcommon, int pass) recGblInitConstantLink(&prec->siol, DBF_DOUBLE, &prec->sval); if(!(pdset = (aidset *)(prec->dset))) { - recGblRecordError(S_dev_noDSET,(void *)prec,"ai: init_record"); - return(S_dev_noDSET); + recGblRecordError(S_dev_noDSET,(void *)prec,"ai: init_record"); + return(S_dev_noDSET); } /* must have read_ai function defined */ if ((pdset->common.number < 6) || (pdset->read_ai == NULL)) { - recGblRecordError(S_dev_missingSup,(void *)prec,"ai: init_record"); - return(S_dev_missingSup); + recGblRecordError(S_dev_missingSup,(void *)prec,"ai: init_record"); + return(S_dev_missingSup); } prec->init = TRUE; /*The following is for old device support that doesnt know about eoff*/ if ((prec->eslo==1.0) && (prec->eoff==0.0)) { - prec->eoff = prec->egul; + prec->eoff = prec->egul; } if (pdset->common.init_record) { long status = pdset->common.init_record(pcommon); - if (prec->linr == menuConvertSLOPE) { - prec->eoff = eoff; - prec->eslo = eslo; - } - return (status); + if (prec->linr == menuConvertSLOPE) { + prec->eoff = eoff; + prec->eslo = eslo; + } + return (status); } prec->mlst = prec->val; prec->alst = prec->val; @@ -135,46 +135,46 @@ static long init_record(struct dbCommon *pcommon, int pass) static long process(struct dbCommon *pcommon) { struct aiRecord *prec = (struct aiRecord *)pcommon; - aidset *pdset = (aidset *)(prec->dset); - long status; + aidset *pdset = (aidset *)(prec->dset); + long status; unsigned char pact=prec->pact; - epicsTimeStamp timeLast; + epicsTimeStamp timeLast; - if( (pdset==NULL) || (pdset->read_ai==NULL) ) { - prec->pact=TRUE; - recGblRecordError(S_dev_missingSup,(void *)prec,"read_ai"); - return(S_dev_missingSup); - } - timeLast = prec->time; + if( (pdset==NULL) || (pdset->read_ai==NULL) ) { + prec->pact=TRUE; + recGblRecordError(S_dev_missingSup,(void *)prec,"read_ai"); + return(S_dev_missingSup); + } + timeLast = prec->time; - status=readValue(prec); /* read the new value */ - /* check if device support set pact */ - if ( !pact && prec->pact ) return(0); - prec->pact = TRUE; + status=readValue(prec); /* read the new value */ + /* check if device support set pact */ + if ( !pact && prec->pact ) return(0); + prec->pact = TRUE; recGblGetTimeStampSimm(prec, prec->simm, &prec->siol); - if (status==0) convert(prec); - else if (status==2) status=0; + if (status==0) convert(prec); + else if (status==2) status=0; if (status == 0) prec->udf = isnan(prec->val); - /* check for alarms */ - checkAlarms(prec,&timeLast); - /* check event list */ - monitor(prec); - /* process the forward scan link record */ + /* check for alarms */ + checkAlarms(prec,&timeLast); + /* check event list */ + monitor(prec); + /* process the forward scan link record */ recGblFwdLink(prec); - prec->init=FALSE; - prec->pact=FALSE; - return(status); + prec->init=FALSE; + prec->pact=FALSE; + return(status); } static long special(DBADDR *paddr,int after) { - aiRecord *prec = (aiRecord *)(paddr->precord); - aidset *pdset = (aidset *) (prec->dset); + aiRecord *prec = (aiRecord *)(paddr->precord); + aidset *pdset = (aidset *) (prec->dset); int special_type = paddr->special; switch(special_type) { @@ -215,7 +215,7 @@ static long special(DBADDR *paddr,int after) static long get_units(DBADDR *paddr, char *units) { - aiRecord *prec=(aiRecord *)paddr->precord; + aiRecord *prec=(aiRecord *)paddr->precord; if(paddr->pfldDes->field_type == DBF_DOUBLE) { switch (dbGetFieldIndex(paddr)) { @@ -232,7 +232,7 @@ static long get_units(DBADDR *paddr, char *units) static long get_precision(const DBADDR *paddr, long *precision) { - aiRecord *prec=(aiRecord *)paddr->precord; + aiRecord *prec=(aiRecord *)paddr->precord; *precision = prec->prec; if (dbGetFieldIndex(paddr) == indexof(VAL)) return(0); @@ -242,7 +242,7 @@ static long get_precision(const DBADDR *paddr, long *precision) static long get_graphic_double(DBADDR *paddr,struct dbr_grDouble *pgd) { - aiRecord *prec=(aiRecord *)paddr->precord; + aiRecord *prec=(aiRecord *)paddr->precord; switch (dbGetFieldIndex(paddr)) { case indexof(VAL): @@ -265,7 +265,7 @@ static long get_graphic_double(DBADDR *paddr,struct dbr_grDouble *pgd) static long get_control_double(DBADDR *paddr,struct dbr_ctrlDouble *pcd) { - aiRecord *prec=(aiRecord *)paddr->precord; + aiRecord *prec=(aiRecord *)paddr->precord; switch (dbGetFieldIndex(paddr)) { case indexof(VAL): @@ -277,8 +277,8 @@ static long get_control_double(DBADDR *paddr,struct dbr_ctrlDouble *pcd) case indexof(ALST): case indexof(MLST): case indexof(SVAL): - pcd->upper_ctrl_limit = prec->hopr; - pcd->lower_ctrl_limit = prec->lopr; + pcd->upper_ctrl_limit = prec->hopr; + pcd->lower_ctrl_limit = prec->lopr; break; default: recGblGetControlDouble(paddr,pcd); @@ -288,7 +288,7 @@ static long get_control_double(DBADDR *paddr,struct dbr_ctrlDouble *pcd) static long get_alarm_double(DBADDR *paddr,struct dbr_alDouble *pad) { - aiRecord *prec=(aiRecord *)paddr->precord; + aiRecord *prec=(aiRecord *)paddr->precord; if (dbGetFieldIndex(paddr) == indexof(VAL)) { pad->upper_alarm_limit = prec->hhsv ? prec->hihi : epicsNAN; @@ -369,7 +369,7 @@ static void checkAlarms(aiRecord *prec, epicsTimeStamp *lastTime) * level, otherwise to a higher. */ afvl = alpha * afvl + - ((afvl > 0) ? (1 - alpha) : (alpha - 1)) * alarmRange; + ((afvl > 0) ? (1 - alpha) : (alpha - 1)) * alarmRange; if (afvl - floor(afvl) > THRESHOLD) afvl = -afvl; /* reverse rounding */ @@ -411,38 +411,38 @@ static void checkAlarms(aiRecord *prec, epicsTimeStamp *lastTime) static void convert(aiRecord *prec) { - double val; + double val; - val = (double)prec->rval + (double)prec->roff; - /* adjust slope and offset */ - if(prec->aslo!=0.0) val*=prec->aslo; - val+=prec->aoff; + val = (double)prec->rval + (double)prec->roff; + /* adjust slope and offset */ + if(prec->aslo!=0.0) val*=prec->aslo; + val+=prec->aoff; - /* convert raw to engineering units and signal units */ - switch (prec->linr) { - case menuConvertNO_CONVERSION: - break; /* do nothing*/ - - case menuConvertLINEAR: - case menuConvertSLOPE: - val = (val * prec->eslo) + prec->eoff; - break; - - default: /* must use breakpoint table */ - if (cvtRawToEngBpt(&val,prec->linr,prec->init,(void *)&prec->pbrk,&prec->lbrk)!=0) { - recGblSetSevr(prec,SOFT_ALARM,MAJOR_ALARM); - } - } + /* convert raw to engineering units and signal units */ + switch (prec->linr) { + case menuConvertNO_CONVERSION: + break; /* do nothing*/ - /* apply smoothing algorithm */ + case menuConvertLINEAR: + case menuConvertSLOPE: + val = (val * prec->eslo) + prec->eoff; + break; + + default: /* must use breakpoint table */ + if (cvtRawToEngBpt(&val,prec->linr,prec->init,(void *)&prec->pbrk,&prec->lbrk)!=0) { + recGblSetSevr(prec,SOFT_ALARM,MAJOR_ALARM); + } + } + + /* apply smoothing algorithm */ if (prec->smoo != 0.0 && finite(prec->val)){ - if (prec->init) prec->val = val; /* initial condition */ - prec->val = val * (1.00 - prec->smoo) + (prec->val * prec->smoo); - }else{ - prec->val = val; - } - return; + if (prec->init) prec->val = val; /* initial condition */ + prec->val = val * (1.00 - prec->smoo) + (prec->val * prec->smoo); + }else{ + prec->val = val; + } + return; } static void monitor(aiRecord *prec) @@ -455,15 +455,15 @@ static void monitor(aiRecord *prec) /* check for archive change */ recGblCheckDeadband(&prec->alst, prec->val, prec->adel, &monitor_mask, DBE_ARCHIVE); - /* send out monitors connected to the value field */ - if (monitor_mask){ - db_post_events(prec,&prec->val,monitor_mask); - if(prec->oraw != prec->rval) { - db_post_events(prec,&prec->rval,monitor_mask); - prec->oraw = prec->rval; - } - } - return; + /* send out monitors connected to the value field */ + if (monitor_mask){ + db_post_events(prec,&prec->val,monitor_mask); + if(prec->oraw != prec->rval) { + db_post_events(prec,&prec->rval,monitor_mask); + prec->oraw = prec->rval; + } + } + return; } static long readValue(aiRecord *prec) @@ -477,40 +477,40 @@ static long readValue(aiRecord *prec) } switch (prec->simm) { - case menuSimmNO: - status = pdset->read_ai(prec); - break; + case menuSimmNO: + status = pdset->read_ai(prec); + break; - case menuSimmYES: - case menuSimmRAW: { - recGblSetSevr(prec, SIMM_ALARM, prec->sims); - if (prec->pact || (prec->sdly < 0.)) { - status = dbGetLink(&prec->siol, DBR_DOUBLE, &prec->sval, 0, 0); - if (status == 0) { - if (prec->simm == menuSimmYES) { - prec->val = prec->sval; - status = 2; /* don't convert */ - } else { - prec->rval = (long)floor(prec->sval); - status = 0; /* convert RVAL */ + case menuSimmYES: + case menuSimmRAW: { + recGblSetSevr(prec, SIMM_ALARM, prec->sims); + if (prec->pact || (prec->sdly < 0.)) { + status = dbGetLink(&prec->siol, DBR_DOUBLE, &prec->sval, 0, 0); + if (status == 0) { + if (prec->simm == menuSimmYES) { + prec->val = prec->sval; + status = 2; /* don't convert */ + } else { + prec->rval = (long)floor(prec->sval); + status = 0; /* convert RVAL */ + } } + prec->pact = FALSE; + } else { /* !prec->pact && delay >= 0. */ + epicsCallback *pvt = prec->simpvt; + if (!pvt) { + pvt = calloc(1, sizeof(epicsCallback)); /* very lazy allocation of callback structure */ + prec->simpvt = pvt; + } + if (pvt) callbackRequestProcessCallbackDelayed(pvt, prec->prio, prec, prec->sdly); + prec->pact = TRUE; } - prec->pact = FALSE; - } else { /* !prec->pact && delay >= 0. */ - epicsCallback *pvt = prec->simpvt; - if (!pvt) { - pvt = calloc(1, sizeof(epicsCallback)); /* very lazy allocation of callback structure */ - prec->simpvt = pvt; - } - if (pvt) callbackRequestProcessCallbackDelayed(pvt, prec->prio, prec, prec->sdly); - prec->pact = TRUE; + break; } - break; - } - default: - recGblSetSevr(prec, SOFT_ALARM, INVALID_ALARM); - status = -1; + default: + recGblSetSevr(prec, SOFT_ALARM, INVALID_ALARM); + status = -1; } return status; diff --git a/modules/database/src/std/rec/aoRecord.c b/modules/database/src/std/rec/aoRecord.c index 3f9a84e89..0aeb30527 100644 --- a/modules/database/src/std/rec/aoRecord.c +++ b/modules/database/src/std/rec/aoRecord.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* aoRecord.c - Record Support Routines for Analog Output records */ @@ -64,23 +64,23 @@ static long get_control_double(DBADDR *, struct dbr_ctrlDouble *); static long get_alarm_double(DBADDR *, struct dbr_alDouble *); rset aoRSET={ - RSETNUMBER, - report, - initialize, - init_record, - process, - special, - get_value, - cvt_dbaddr, - get_array_info, - put_array_info, - get_units, - get_precision, - get_enum_str, - get_enum_strs, - put_enum_str, - get_graphic_double, - get_control_double, + RSETNUMBER, + report, + initialize, + init_record, + process, + special, + get_value, + cvt_dbaddr, + get_array_info, + put_array_info, + get_units, + get_precision, + get_enum_str, + get_enum_strs, + put_enum_str, + get_graphic_double, + get_control_double, get_alarm_double }; epicsExportAddress(rset,aoRSET); @@ -95,17 +95,17 @@ static long init_record(struct dbCommon *pcommon, int pass) { struct aoRecord *prec = (struct aoRecord *)pcommon; aodset *pdset; - double eoff = prec->eoff, eslo = prec->eslo; - double value; - long status = 0; + double eoff = prec->eoff, eslo = prec->eslo; + double value; + long status = 0; if (pass == 0) return 0; recGblInitSimm(pcommon, &prec->sscn, &prec->oldsimm, &prec->simm, &prec->siml); if(!(pdset = (aodset *)(prec->dset))) { - recGblRecordError(S_dev_noDSET,(void *)prec,"ao: init_record"); - return(S_dev_noDSET); + recGblRecordError(S_dev_noDSET,(void *)prec,"ao: init_record"); + return(S_dev_noDSET); } /* get the initial value if dol is a constant*/ if (recGblInitConstantLink(&prec->dol,DBF_DOUBLE,&prec->val)) @@ -113,43 +113,43 @@ static long init_record(struct dbCommon *pcommon, int pass) /* must have write_ao function defined */ if ((pdset->common.number < 6) || (pdset->write_ao ==NULL)) { - recGblRecordError(S_dev_missingSup,(void *)prec,"ao: init_record"); - return(S_dev_missingSup); + recGblRecordError(S_dev_missingSup,(void *)prec,"ao: init_record"); + return(S_dev_missingSup); } prec->init = TRUE; /*The following is for old device support that doesnt know about eoff*/ if ((prec->eslo==1.0) && (prec->eoff==0.0)) { - prec->eoff = prec->egul; + prec->eoff = prec->egul; } if (pdset->common.init_record) { status = pdset->common.init_record(pcommon); - if (prec->linr == menuConvertSLOPE) { - prec->eoff = eoff; - prec->eslo = eslo; - } + if (prec->linr == menuConvertSLOPE) { + prec->eoff = eoff; + prec->eslo = eslo; + } switch(status){ case(0): /* convert */ - value = (double)prec->rval + (double)prec->roff; - if(prec->aslo!=0.0) value *= prec->aslo; - value += prec->aoff; + value = (double)prec->rval + (double)prec->roff; + if(prec->aslo!=0.0) value *= prec->aslo; + value += prec->aoff; if (prec->linr == menuConvertNO_CONVERSION){ - ; /*do nothing*/ + ; /*do nothing*/ } else if ((prec->linr == menuConvertLINEAR) || - (prec->linr == menuConvertSLOPE)) { + (prec->linr == menuConvertSLOPE)) { value = value*prec->eslo + prec->eoff; }else{ if(cvtRawToEngBpt(&value,prec->linr,prec->init, - (void *)&prec->pbrk,&prec->lbrk)!=0) break; + (void *)&prec->pbrk,&prec->lbrk)!=0) break; } - prec->val = value; - prec->udf = isnan(value); + prec->val = value; + prec->udf = isnan(value); break; case(2): /* no convert */ break; default: - recGblRecordError(S_dev_badInitRet,(void *)prec,"ao: init_record"); - return(S_dev_badInitRet); + recGblRecordError(S_dev_badInitRet,(void *)prec,"ao: init_record"); + return(S_dev_badInitRet); } } prec->oval = prec->pval = prec->val; @@ -165,18 +165,18 @@ static long process(struct dbCommon *pcommon) { struct aoRecord *prec = (struct aoRecord *)pcommon; aodset *pdset = (aodset *)(prec->dset); - long status=0; - unsigned char pact=prec->pact; - double value; + long status=0; + unsigned char pact=prec->pact; + double value; - if ((pdset==NULL) || (pdset->write_ao==NULL)) { - prec->pact=TRUE; - recGblRecordError(S_dev_missingSup,(void *)prec,"write_ao"); - return(S_dev_missingSup); - } + if ((pdset==NULL) || (pdset->write_ao==NULL)) { + prec->pact=TRUE; + recGblRecordError(S_dev_missingSup,(void *)prec,"write_ao"); + return(S_dev_missingSup); + } - /* fetch value and convert*/ - if (prec->pact == FALSE) { + /* fetch value and convert*/ + if (prec->pact == FALSE) { if (!dbLinkIsConstant(&prec->dol) && prec->omsl == menuOmslclosed_loop) { status = fetch_value(prec, &value); @@ -184,52 +184,52 @@ static long process(struct dbCommon *pcommon) else { value = prec->val; } - if(!status) convert(prec, value); - prec->udf = isnan(prec->val); - } + if(!status) convert(prec, value); + prec->udf = isnan(prec->val); + } - /* check for alarms */ - checkAlarms(prec); + /* check for alarms */ + checkAlarms(prec); - if (prec->nsev < INVALID_ALARM ) - status=writeValue(prec); /* write the new value */ - else { - switch (prec->ivoa) { - case (menuIvoaContinue_normally) : - status=writeValue(prec); /* write the new value */ - break; - case (menuIvoaDon_t_drive_outputs) : - break; - case (menuIvoaSet_output_to_IVOV) : - if(prec->pact == FALSE){ - prec->val=prec->ivov; - value=prec->ivov; - convert(prec,value); - } - status=writeValue(prec); /* write the new value */ - break; - default : - status=-1; - recGblRecordError(S_db_badField,(void *)prec, - "ao:process Illegal IVOA field"); - } - } + if (prec->nsev < INVALID_ALARM ) + status=writeValue(prec); /* write the new value */ + else { + switch (prec->ivoa) { + case (menuIvoaContinue_normally) : + status=writeValue(prec); /* write the new value */ + break; + case (menuIvoaDon_t_drive_outputs) : + break; + case (menuIvoaSet_output_to_IVOV) : + if(prec->pact == FALSE){ + prec->val=prec->ivov; + value=prec->ivov; + convert(prec,value); + } + status=writeValue(prec); /* write the new value */ + break; + default : + status=-1; + recGblRecordError(S_db_badField,(void *)prec, + "ao:process Illegal IVOA field"); + } + } - /* check if device support set pact */ - if ( !pact && prec->pact ) return(0); - prec->pact = TRUE; + /* check if device support set pact */ + if ( !pact && prec->pact ) return(0); + prec->pact = TRUE; recGblGetTimeStampSimm(prec, prec->simm, NULL); - /* check event list */ - monitor(prec); + /* check event list */ + monitor(prec); - /* process the forward scan link record */ + /* process the forward scan link record */ recGblFwdLink(prec); - prec->init=FALSE; - prec->pact=FALSE; - return(status); + prec->init=FALSE; + prec->pact=FALSE; + return(status); } static long special(DBADDR *paddr, int after) @@ -244,20 +244,20 @@ static long special(DBADDR *paddr, int after) recGblDbaddrError(S_db_noMod,paddr,"ao: special"); return(S_db_noMod); } - prec->init=TRUE; + prec->init=TRUE; if ((prec->linr == menuConvertLINEAR) && pdset->special_linconv) { - double eoff = prec->eoff; - double eslo = prec->eslo; - long status; - prec->eoff = prec->egul; - status = (*pdset->special_linconv)(prec,after); - if (eoff != prec->eoff) - db_post_events(prec, &prec->eoff, DBE_VALUE|DBE_LOG); + double eoff = prec->eoff; + double eslo = prec->eslo; + long status; + prec->eoff = prec->egul; + status = (*pdset->special_linconv)(prec,after); + if (eoff != prec->eoff) + db_post_events(prec, &prec->eoff, DBE_VALUE|DBE_LOG); if (eslo != prec->eslo) - db_post_events(prec, &prec->eslo, DBE_VALUE|DBE_LOG); - return (status); - } - return (0); + db_post_events(prec, &prec->eslo, DBE_VALUE|DBE_LOG); + return (status); + } + return (0); case(SPC_MOD): if (dbGetFieldIndex(paddr) == aoRecordSIMM) { if (!after) @@ -276,7 +276,7 @@ static long special(DBADDR *paddr, int after) static long get_units(DBADDR * paddr,char *units) { - aoRecord *prec=(aoRecord *)paddr->precord; + aoRecord *prec=(aoRecord *)paddr->precord; if(paddr->pfldDes->field_type == DBF_DOUBLE) { switch (dbGetFieldIndex(paddr)) { @@ -292,7 +292,7 @@ static long get_units(DBADDR * paddr,char *units) static long get_precision(const DBADDR *paddr,long *precision) { - aoRecord *prec=(aoRecord *)paddr->precord; + aoRecord *prec=(aoRecord *)paddr->precord; *precision = prec->prec; switch (dbGetFieldIndex(paddr)) { @@ -308,7 +308,7 @@ static long get_precision(const DBADDR *paddr,long *precision) static long get_graphic_double(DBADDR *paddr,struct dbr_grDouble *pgd) { - aoRecord *prec=(aoRecord *)paddr->precord; + aoRecord *prec=(aoRecord *)paddr->precord; switch (dbGetFieldIndex(paddr)) { case indexof(VAL): @@ -333,7 +333,7 @@ static long get_graphic_double(DBADDR *paddr,struct dbr_grDouble *pgd) static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd) { - aoRecord *prec=(aoRecord *)paddr->precord; + aoRecord *prec=(aoRecord *)paddr->precord; switch (dbGetFieldIndex(paddr)) { case indexof(VAL): @@ -356,7 +356,7 @@ static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd) } static long get_alarm_double(DBADDR *paddr, struct dbr_alDouble *pad) { - aoRecord *prec=(aoRecord *)paddr->precord; + aoRecord *prec=(aoRecord *)paddr->precord; if(dbGetFieldIndex(paddr) == indexof(VAL)){ pad->upper_alarm_limit = prec->hhsv ? prec->hihi : epicsNAN; @@ -425,27 +425,27 @@ static void checkAlarms(aoRecord *prec) static long fetch_value(aoRecord *prec,double *pvalue) { - short save_pact; - long status; + short save_pact; + long status; - save_pact = prec->pact; - prec->pact = TRUE; + save_pact = prec->pact; + prec->pact = TRUE; - /* don't allow dbputs to val field */ - prec->val=prec->pval; + /* don't allow dbputs to val field */ + prec->val=prec->pval; - status = dbGetLink(&prec->dol,DBR_DOUBLE,pvalue,0,0); - prec->pact = save_pact; + status = dbGetLink(&prec->dol,DBR_DOUBLE,pvalue,0,0); + prec->pact = save_pact; - if (status) { - recGblSetSevr(prec,LINK_ALARM,INVALID_ALARM); - return(status); - } + if (status) { + recGblSetSevr(prec,LINK_ALARM,INVALID_ALARM); + return(status); + } - if (prec->oif == aoOIF_Incremental) - *pvalue += prec->val; + if (prec->oif == aoOIF_Incremental) + *pvalue += prec->val; - return(0); + return(0); } static void convert(aoRecord *prec, double value) @@ -477,19 +477,19 @@ static void convert(aoRecord *prec, double value) /* convert */ switch (prec->linr) { - case menuConvertNO_CONVERSION: - break; /* do nothing*/ - case menuConvertLINEAR: - case menuConvertSLOPE: - if (prec->eslo == 0.0) value = 0; - else value = (value - prec->eoff) / prec->eslo; - break; - default: - if (cvtEngToRawBpt(&value, prec->linr, prec->init, - (void *)&prec->pbrk, &prec->lbrk) != 0) { - recGblSetSevr(prec, SOFT_ALARM, MAJOR_ALARM); - return; - } + case menuConvertNO_CONVERSION: + break; /* do nothing*/ + case menuConvertLINEAR: + case menuConvertSLOPE: + if (prec->eslo == 0.0) value = 0; + else value = (value - prec->eoff) / prec->eslo; + break; + default: + if (cvtEngToRawBpt(&value, prec->linr, prec->init, + (void *)&prec->pbrk, &prec->lbrk) != 0) { + recGblSetSevr(prec, SOFT_ALARM, MAJOR_ALARM); + return; + } } value -= prec->aoff; if (prec->aslo != 0) value /= prec->aslo; @@ -525,22 +525,22 @@ static void monitor(aoRecord *prec) db_post_events(prec,&prec->val,monitor_mask); } - if(prec->omod) monitor_mask |= (DBE_VALUE|DBE_LOG); - if(monitor_mask) { - prec->omod = FALSE; - db_post_events(prec,&prec->oval,monitor_mask); - if(prec->oraw != prec->rval) { - db_post_events(prec,&prec->rval, - monitor_mask|DBE_VALUE|DBE_LOG); - prec->oraw = prec->rval; - } - if(prec->orbv != prec->rbv) { - db_post_events(prec,&prec->rbv, - monitor_mask|DBE_VALUE|DBE_LOG); - prec->orbv = prec->rbv; - } - } - return; + if(prec->omod) monitor_mask |= (DBE_VALUE|DBE_LOG); + if(monitor_mask) { + prec->omod = FALSE; + db_post_events(prec,&prec->oval,monitor_mask); + if(prec->oraw != prec->rval) { + db_post_events(prec,&prec->rval, + monitor_mask|DBE_VALUE|DBE_LOG); + prec->oraw = prec->rval; + } + if(prec->orbv != prec->rbv) { + db_post_events(prec,&prec->rbv, + monitor_mask|DBE_VALUE|DBE_LOG); + prec->orbv = prec->rbv; + } + } + return; } static long writeValue(aoRecord *prec) diff --git a/modules/database/src/std/rec/biRecord.c b/modules/database/src/std/rec/biRecord.c index c26ed79ee..24522c063 100644 --- a/modules/database/src/std/rec/biRecord.c +++ b/modules/database/src/std/rec/biRecord.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* recBi.c - Record Support Routines for Binary Input records */ @@ -58,23 +58,23 @@ static long put_enum_str(const DBADDR *, const char *); #define get_control_double NULL #define get_alarm_double NULL rset biRSET={ - RSETNUMBER, - report, - initialize, - init_record, - process, - special, - get_value, - cvt_dbaddr, - get_array_info, - put_array_info, - get_units, - get_precision, - get_enum_str, - get_enum_strs, - put_enum_str, - get_graphic_double, - get_control_double, + RSETNUMBER, + report, + initialize, + init_record, + process, + special, + get_value, + cvt_dbaddr, + get_array_info, + put_array_info, + get_units, + get_precision, + get_enum_str, + get_enum_strs, + put_enum_str, + get_graphic_double, + get_control_double, get_alarm_double }; epicsExportAddress(rset,biRSET); @@ -95,13 +95,13 @@ static long init_record(struct dbCommon *pcommon, int pass) recGblInitConstantLink(&prec->siol, DBF_USHORT, &prec->sval); if(!(pdset = (bidset *)(prec->dset))) { - recGblRecordError(S_dev_noDSET,(void *)prec,"bi: init_record"); - return(S_dev_noDSET); + recGblRecordError(S_dev_noDSET,(void *)prec,"bi: init_record"); + return(S_dev_noDSET); } /* must have read_bi function defined */ if( (pdset->common.number < 5) || (pdset->read_bi == NULL) ) { - recGblRecordError(S_dev_missingSup,(void *)prec,"bi: init_record"); - return(S_dev_missingSup); + recGblRecordError(S_dev_missingSup,(void *)prec,"bi: init_record"); + return(S_dev_missingSup); } if( pdset->common.init_record ) { if((status=(*pdset->common.init_record)(pcommon))) return(status); @@ -116,37 +116,37 @@ static long process(struct dbCommon *pcommon) { struct biRecord *prec = (struct biRecord *)pcommon; bidset *pdset = (bidset *)(prec->dset); - long status; - unsigned char pact=prec->pact; + long status; + unsigned char pact=prec->pact; - if( (pdset==NULL) || (pdset->read_bi==NULL) ) { - prec->pact=TRUE; - recGblRecordError(S_dev_missingSup,(void *)prec,"read_bi"); - return(S_dev_missingSup); - } + if( (pdset==NULL) || (pdset->read_bi==NULL) ) { + prec->pact=TRUE; + recGblRecordError(S_dev_missingSup,(void *)prec,"read_bi"); + return(S_dev_missingSup); + } - status=readValue(prec); /* read the new value */ - /* check if device support set pact */ - if ( !pact && prec->pact ) return(0); - prec->pact = TRUE; + status=readValue(prec); /* read the new value */ + /* check if device support set pact */ + if ( !pact && prec->pact ) return(0); + prec->pact = TRUE; recGblGetTimeStampSimm(prec, prec->simm, &prec->siol); if(status==0) { /* convert rval to val */ - if(prec->rval==0) prec->val =0; - else prec->val = 1; - prec->udf = FALSE; - } - else if(status==2) status=0; - /* check for alarms */ - checkAlarms(prec); - /* check event list */ - monitor(prec); - /* process the forward scan link record */ - recGblFwdLink(prec); + if(prec->rval==0) prec->val =0; + else prec->val = 1; + prec->udf = FALSE; + } + else if(status==2) status=0; + /* check for alarms */ + checkAlarms(prec); + /* check event list */ + monitor(prec); + /* process the forward scan link record */ + recGblFwdLink(prec); - prec->pact=FALSE; - return(status); + prec->pact=FALSE; + return(status); } static long special(DBADDR *paddr, int after) @@ -171,29 +171,29 @@ static long special(DBADDR *paddr, int after) static long get_enum_str(const DBADDR *paddr, char *pstring) { - biRecord *prec=(biRecord *)paddr->precord; - int index; - unsigned short *pfield = (unsigned short *)paddr->pfield; + biRecord *prec=(biRecord *)paddr->precord; + int index; + unsigned short *pfield = (unsigned short *)paddr->pfield; index = dbGetFieldIndex(paddr); if(index!=biRecordVAL) { - strcpy(pstring,"Illegal_Value"); + strcpy(pstring,"Illegal_Value"); } else if(*pfield==0) { - strncpy(pstring,prec->znam,sizeof(prec->znam)); - pstring[sizeof(prec->znam)] = 0; + strncpy(pstring,prec->znam,sizeof(prec->znam)); + pstring[sizeof(prec->znam)] = 0; } else if(*pfield==1) { - strncpy(pstring,prec->onam,sizeof(prec->onam)); - pstring[sizeof(prec->onam)] = 0; + strncpy(pstring,prec->onam,sizeof(prec->onam)); + pstring[sizeof(prec->onam)] = 0; } else { - strcpy(pstring,"Illegal_Value"); + strcpy(pstring,"Illegal_Value"); } return(0); } static long get_enum_strs(const DBADDR *paddr,struct dbr_enumStrs *pes) { - biRecord *prec=(biRecord *)paddr->precord; + biRecord *prec=(biRecord *)paddr->precord; pes->no_str = 2; memset(pes->strs,'\0',sizeof(pes->strs)); @@ -218,52 +218,52 @@ static long put_enum_str(const DBADDR *paddr, const char *pstring) static void checkAlarms(biRecord *prec) { - unsigned short val = prec->val; + unsigned short val = prec->val; - if(prec->udf == TRUE){ - recGblSetSevr(prec,UDF_ALARM,prec->udfs); - return; - } + if(prec->udf == TRUE){ + recGblSetSevr(prec,UDF_ALARM,prec->udfs); + return; + } - if(val>1)return; - /* check for state alarm */ - if (val == 0){ - recGblSetSevr(prec,STATE_ALARM,prec->zsv); - }else{ - recGblSetSevr(prec,STATE_ALARM,prec->osv); - } + if(val>1)return; + /* check for state alarm */ + if (val == 0){ + recGblSetSevr(prec,STATE_ALARM,prec->zsv); + }else{ + recGblSetSevr(prec,STATE_ALARM,prec->osv); + } /* check for cos alarm */ - if(val == prec->lalm) return; + if(val == prec->lalm) return; recGblSetSevr(prec,COS_ALARM,prec->cosv); - prec->lalm = val; - return; + prec->lalm = val; + return; } static void monitor(biRecord *prec) { - unsigned short monitor_mask; + unsigned short monitor_mask; - monitor_mask = recGblResetAlarms(prec); - /* check for value change */ - if (prec->mlst != prec->val){ - /* post events for value change and archive change */ - monitor_mask |= (DBE_VALUE | DBE_LOG); - /* update last value monitored */ - prec->mlst = prec->val; - } + monitor_mask = recGblResetAlarms(prec); + /* check for value change */ + if (prec->mlst != prec->val){ + /* post events for value change and archive change */ + monitor_mask |= (DBE_VALUE | DBE_LOG); + /* update last value monitored */ + prec->mlst = prec->val; + } - /* send out monitors connected to the value field */ - if (monitor_mask){ - db_post_events(prec,&prec->val,monitor_mask); - } - if(prec->oraw!=prec->rval) { - db_post_events(prec,&prec->rval, - monitor_mask|DBE_VALUE|DBE_LOG); - prec->oraw = prec->rval; - } - return; + /* send out monitors connected to the value field */ + if (monitor_mask){ + db_post_events(prec,&prec->val,monitor_mask); + } + if(prec->oraw!=prec->rval) { + db_post_events(prec,&prec->rval, + monitor_mask|DBE_VALUE|DBE_LOG); + prec->oraw = prec->rval; + } + return; } static long readValue(biRecord *prec) diff --git a/modules/database/src/std/rec/boRecord.c b/modules/database/src/std/rec/boRecord.c index 94aa58782..ca26e40e5 100644 --- a/modules/database/src/std/rec/boRecord.c +++ b/modules/database/src/std/rec/boRecord.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* recBo.c - Record Support Routines for Binary Output records */ @@ -60,24 +60,24 @@ static long get_control_double(DBADDR *, struct dbr_ctrlDouble *); #define get_alarm_double NULL rset boRSET={ - RSETNUMBER, - report, - initialize, - init_record, - process, - special, - get_value, - cvt_dbaddr, - get_array_info, - put_array_info, - get_units, - get_precision, - get_enum_str, - get_enum_strs, - put_enum_str, - get_graphic_double, - get_control_double, - get_alarm_double + RSETNUMBER, + report, + initialize, + init_record, + process, + special, + get_value, + cvt_dbaddr, + get_array_info, + put_array_info, + get_units, + get_precision, + get_enum_str, + get_enum_strs, + put_enum_str, + get_graphic_double, + get_control_double, + get_alarm_double }; epicsExportAddress(rset,boRSET); @@ -105,15 +105,15 @@ static void myCallbackFunc(epicsCallback *arg) prec=(boRecord *)pcallback->precord; dbScanLock((struct dbCommon *)prec); if(prec->pact) { - if((prec->val==1) && (prec->high>0)){ - myCallback *pcallback; - pcallback = (myCallback *)(prec->rpvt); + if((prec->val==1) && (prec->high>0)){ + myCallback *pcallback; + pcallback = (myCallback *)(prec->rpvt); callbackSetPriority(prec->prio, &pcallback->callback); callbackRequestDelayed(&pcallback->callback,(double)prec->high); - } + } } else { - prec->val = 0; - dbProcess((struct dbCommon *)prec); + prec->val = 0; + dbProcess((struct dbCommon *)prec); } dbScanUnlock((struct dbCommon *)prec); } @@ -155,17 +155,17 @@ static long init_record(struct dbCommon *pcommon,int pass) if (pdset->common.init_record) { status=(*pdset->common.init_record)(pcommon); - if(status==0) { - if(prec->rval==0) prec->val = 0; - else prec->val = 1; - prec->udf = FALSE; - } else if (status==2) status=0; + if(status==0) { + if(prec->rval==0) prec->val = 0; + else prec->val = 1; + prec->udf = FALSE; + } else if (status==2) status=0; } prec->mlst = prec->val; /* convert val to rval */ if ( prec->mask != 0 ) { - if(prec->val==0) prec->rval = 0; - else prec->rval = prec->mask; + if(prec->val==0) prec->rval = 0; + else prec->rval = prec->mask; } else prec->rval = (epicsUInt32)prec->val; prec->mlst = prec->val; @@ -179,86 +179,86 @@ static long process(struct dbCommon *pcommon) { struct boRecord *prec = (struct boRecord *)pcommon; bodset *pdset = (bodset *)(prec->dset); - long status=0; - unsigned char pact=prec->pact; + long status=0; + unsigned char pact=prec->pact; - if( (pdset==NULL) || (pdset->write_bo==NULL) ) { - prec->pact=TRUE; - recGblRecordError(S_dev_missingSup,(void *)prec,"write_bo"); - return(S_dev_missingSup); - } - if (!prec->pact) { - if (!dbLinkIsConstant(&prec->dol) && - prec->omsl == menuOmslclosed_loop) { - unsigned short val; + if( (pdset==NULL) || (pdset->write_bo==NULL) ) { + prec->pact=TRUE; + recGblRecordError(S_dev_missingSup,(void *)prec,"write_bo"); + return(S_dev_missingSup); + } + if (!prec->pact) { + if (!dbLinkIsConstant(&prec->dol) && + prec->omsl == menuOmslclosed_loop) { + unsigned short val; - prec->pact = TRUE; - status=dbGetLink(&prec->dol,DBR_USHORT, &val,0,0); - prec->pact = FALSE; - if(status==0){ - prec->val = val; - prec->udf = FALSE; - }else { - recGblSetSevr(prec,LINK_ALARM,INVALID_ALARM); - } - } - - /* convert val to rval */ - if ( prec->mask != 0 ) { - if(prec->val==0) prec->rval = 0; - else prec->rval = prec->mask; - } else prec->rval = (epicsUInt32)prec->val; - } - - /* check for alarms */ - checkAlarms(prec); - - if (prec->nsev < INVALID_ALARM ) - status=writeValue(prec); /* write the new value */ - else { - switch (prec->ivoa) { - case (menuIvoaContinue_normally) : - status=writeValue(prec); /* write the new value */ - break; - case (menuIvoaDon_t_drive_outputs) : - break; - case (menuIvoaSet_output_to_IVOV) : - if(prec->pact == FALSE){ - /* convert val to rval */ - prec->val=prec->ivov; - if ( prec->mask != 0 ) { - if(prec->val==0) prec->rval = 0; - else prec->rval = prec->mask; - } else prec->rval = (epicsUInt32)prec->val; - } - status=writeValue(prec); /* write the new value */ - break; - default : - status=-1; - recGblRecordError(S_db_badField,(void *)prec, - "bo:process Illegal IVOA field"); - } + prec->pact = TRUE; + status=dbGetLink(&prec->dol,DBR_USHORT, &val,0,0); + prec->pact = FALSE; + if(status==0){ + prec->val = val; + prec->udf = FALSE; + }else { + recGblSetSevr(prec,LINK_ALARM,INVALID_ALARM); + } } - /* check if device support set pact */ - if ( !pact && prec->pact ) return(0); - prec->pact = TRUE; + /* convert val to rval */ + if ( prec->mask != 0 ) { + if(prec->val==0) prec->rval = 0; + else prec->rval = prec->mask; + } else prec->rval = (epicsUInt32)prec->val; + } + + /* check for alarms */ + checkAlarms(prec); + + if (prec->nsev < INVALID_ALARM ) + status=writeValue(prec); /* write the new value */ + else { + switch (prec->ivoa) { + case (menuIvoaContinue_normally) : + status=writeValue(prec); /* write the new value */ + break; + case (menuIvoaDon_t_drive_outputs) : + break; + case (menuIvoaSet_output_to_IVOV) : + if(prec->pact == FALSE){ + /* convert val to rval */ + prec->val=prec->ivov; + if ( prec->mask != 0 ) { + if(prec->val==0) prec->rval = 0; + else prec->rval = prec->mask; + } else prec->rval = (epicsUInt32)prec->val; + } + status=writeValue(prec); /* write the new value */ + break; + default : + status=-1; + recGblRecordError(S_db_badField,(void *)prec, + "bo:process Illegal IVOA field"); + } + } + + /* check if device support set pact */ + if ( !pact && prec->pact ) return(0); + prec->pact = TRUE; recGblGetTimeStampSimm(prec, prec->simm, NULL); - if((prec->val==1) && (prec->high>0)){ - myCallback *pcallback; - pcallback = (myCallback *)(prec->rpvt); - callbackSetPriority(prec->prio, &pcallback->callback); - callbackRequestDelayed(&pcallback->callback,(double)prec->high); - } - /* check event list */ - monitor(prec); - /* process the forward scan link record */ - recGblFwdLink(prec); + if((prec->val==1) && (prec->high>0)){ + myCallback *pcallback; + pcallback = (myCallback *)(prec->rpvt); + callbackSetPriority(prec->prio, &pcallback->callback); + callbackRequestDelayed(&pcallback->callback,(double)prec->high); + } + /* check event list */ + monitor(prec); + /* process the forward scan link record */ + recGblFwdLink(prec); - prec->pact=FALSE; - return(status); + prec->pact=FALSE; + return(status); } static long special(DBADDR *paddr, int after) @@ -267,17 +267,17 @@ static long special(DBADDR *paddr, int after) int special_type = paddr->special; switch(special_type) { - case(SPC_MOD): - if (dbGetFieldIndex(paddr) == boRecordSIMM) { - if (!after) - recGblSaveSimm(prec->sscn, &prec->oldsimm, prec->simm); - else - recGblCheckSimm((dbCommon *)prec, &prec->sscn, prec->oldsimm, prec->simm); - return(0); - } - default: - recGblDbaddrError(S_db_badChoice, paddr, "bo: special"); - return(S_db_badChoice); + case(SPC_MOD): + if (dbGetFieldIndex(paddr) == boRecordSIMM) { + if (!after) + recGblSaveSimm(prec->sscn, &prec->oldsimm, prec->simm); + else + recGblCheckSimm((dbCommon *)prec, &prec->sscn, prec->oldsimm, prec->simm); + return(0); + } + default: + recGblDbaddrError(S_db_badChoice, paddr, "bo: special"); + return(S_db_badChoice); } } @@ -311,29 +311,29 @@ static long get_control_double(DBADDR *paddr,struct dbr_ctrlDouble *pcd) static long get_enum_str(const DBADDR *paddr, char *pstring) { - boRecord *prec=(boRecord *)paddr->precord; - int index; - unsigned short *pfield = (unsigned short *)paddr->pfield; + boRecord *prec=(boRecord *)paddr->precord; + int index; + unsigned short *pfield = (unsigned short *)paddr->pfield; index = dbGetFieldIndex(paddr); if(index!=indexof(VAL)) { - strcpy(pstring,"Illegal_Value"); + strcpy(pstring,"Illegal_Value"); } else if(*pfield==0) { - strncpy(pstring,prec->znam,sizeof(prec->znam)); - pstring[sizeof(prec->znam)] = 0; + strncpy(pstring,prec->znam,sizeof(prec->znam)); + pstring[sizeof(prec->znam)] = 0; } else if(*pfield==1) { - strncpy(pstring,prec->onam,sizeof(prec->onam)); - pstring[sizeof(prec->onam)] = 0; + strncpy(pstring,prec->onam,sizeof(prec->onam)); + pstring[sizeof(prec->onam)] = 0; } else { - strcpy(pstring,"Illegal_Value"); + strcpy(pstring,"Illegal_Value"); } return(0); } static long get_enum_strs(const DBADDR *paddr,struct dbr_enumStrs *pes) { - boRecord *prec=(boRecord *)paddr->precord; + boRecord *prec=(boRecord *)paddr->precord; /*SETTING no_str=0 breaks channel access clients*/ pes->no_str = 2; @@ -357,55 +357,55 @@ static long put_enum_str(const DBADDR *paddr, const char *pstring) static void checkAlarms(boRecord *prec) { - unsigned short val = prec->val; + unsigned short val = prec->val; - /* check for udf alarm */ - if(prec->udf == TRUE ){ - recGblSetSevr(prec,UDF_ALARM,prec->udfs); - } + /* check for udf alarm */ + if(prec->udf == TRUE ){ + recGblSetSevr(prec,UDF_ALARM,prec->udfs); + } - /* check for state alarm */ - if (val == 0){ - recGblSetSevr(prec,STATE_ALARM,prec->zsv); - }else{ - recGblSetSevr(prec,STATE_ALARM,prec->osv); - } + /* check for state alarm */ + if (val == 0){ + recGblSetSevr(prec,STATE_ALARM,prec->zsv); + }else{ + recGblSetSevr(prec,STATE_ALARM,prec->osv); + } /* check for cos alarm */ - if(val == prec->lalm) return; - recGblSetSevr(prec,COS_ALARM,prec->cosv); - prec->lalm = val; - return; + if(val == prec->lalm) return; + recGblSetSevr(prec,COS_ALARM,prec->cosv); + prec->lalm = val; + return; } static void monitor(boRecord *prec) { - unsigned short monitor_mask; + unsigned short monitor_mask; - monitor_mask = recGblResetAlarms(prec); - /* check for value change */ - if (prec->mlst != prec->val){ - /* post events for value change and archive change */ - monitor_mask |= (DBE_VALUE | DBE_LOG); - /* update last value monitored */ - prec->mlst = prec->val; - } + monitor_mask = recGblResetAlarms(prec); + /* check for value change */ + if (prec->mlst != prec->val){ + /* post events for value change and archive change */ + monitor_mask |= (DBE_VALUE | DBE_LOG); + /* update last value monitored */ + prec->mlst = prec->val; + } - /* send out monitors connected to the value field */ - if (monitor_mask){ - db_post_events(prec,&prec->val,monitor_mask); - } - if(prec->oraw!=prec->rval) { - db_post_events(prec,&prec->rval, - monitor_mask|DBE_VALUE|DBE_LOG); - prec->oraw = prec->rval; - } - if(prec->orbv!=prec->rbv) { - db_post_events(prec,&prec->rbv, - monitor_mask|DBE_VALUE|DBE_LOG); - prec->orbv = prec->rbv; - } - return; + /* send out monitors connected to the value field */ + if (monitor_mask){ + db_post_events(prec,&prec->val,monitor_mask); + } + if(prec->oraw!=prec->rval) { + db_post_events(prec,&prec->rval, + monitor_mask|DBE_VALUE|DBE_LOG); + prec->oraw = prec->rval; + } + if(prec->orbv!=prec->rbv) { + db_post_events(prec,&prec->rbv, + monitor_mask|DBE_VALUE|DBE_LOG); + prec->orbv = prec->rbv; + } + return; } static long writeValue(boRecord *prec) diff --git a/modules/database/src/std/rec/calcRecord.c b/modules/database/src/std/rec/calcRecord.c index d72792a57..f05223842 100644 --- a/modules/database/src/std/rec/calcRecord.c +++ b/modules/database/src/std/rec/calcRecord.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* Record Support Routines for Calculation records */ @@ -206,7 +206,7 @@ static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd) calcRecord *prec = (calcRecord *)paddr->precord; int fieldIndex = dbGetFieldIndex(paddr); int linkNumber; - + switch (fieldIndex) { case indexof(VAL): case indexof(HIHI): @@ -234,7 +234,7 @@ static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd) static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd) { calcRecord *prec = (calcRecord *)paddr->precord; - + switch (dbGetFieldIndex(paddr)) { case indexof(VAL): case indexof(HIHI): @@ -281,24 +281,24 @@ static long get_alarm_double(DBADDR *paddr, struct dbr_alDouble *pad) static void checkAlarms(calcRecord *prec, epicsTimeStamp *timeLast) { - enum { - range_Lolo = 1, - range_Low, - range_Normal, - range_High, - range_Hihi - } alarmRange; - static const epicsEnum16 range_stat[] = { - SOFT_ALARM, LOLO_ALARM, LOW_ALARM, - NO_ALARM, HIGH_ALARM, HIHI_ALARM - }; + enum { + range_Lolo = 1, + range_Low, + range_Normal, + range_High, + range_Hihi + } alarmRange; + static const epicsEnum16 range_stat[] = { + SOFT_ALARM, LOLO_ALARM, LOW_ALARM, + NO_ALARM, HIGH_ALARM, HIHI_ALARM + }; double val, hyst, lalm, alev, aftc, afvl; epicsEnum16 asev; if (prec->udf) { recGblSetSevr(prec, UDF_ALARM, prec->udfs); - prec->afvl = 0; + prec->afvl = 0; return; } diff --git a/modules/database/src/std/rec/calcoutRecord.c b/modules/database/src/std/rec/calcoutRecord.c index 75edcce47..f06ca927a 100644 --- a/modules/database/src/std/rec/calcoutRecord.c +++ b/modules/database/src/std/rec/calcoutRecord.c @@ -210,7 +210,7 @@ static long init_record(struct dbCommon *pcommon, int pass) prpvt->cbScheduled = 0; prec->epvt = eventNameToHandle(prec->oevt); - + if (pcalcoutDSET->common.init_record) pcalcoutDSET->common.init_record(pcommon); prec->pval = prec->val; prec->mlst = prec->val; @@ -261,7 +261,7 @@ static long process(struct dbCommon *pcommon) doOutput = (prec->val != 0.0); break; default: - doOutput = 0; + doOutput = 0; break; } prec->pval = prec->val; @@ -458,7 +458,7 @@ static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd) calcoutRecord *prec = (calcoutRecord *)paddr->precord; int fieldIndex = dbGetFieldIndex(paddr); int linkNumber; - + switch (fieldIndex) { case indexof(VAL): case indexof(HIHI): @@ -474,7 +474,7 @@ static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd) case indexof(ODLY): recGblGetGraphicDouble(paddr,pgd); pgd->lower_disp_limit = 0.0; - break; + break; default: linkNumber = get_linkNumber(fieldIndex); if (linkNumber >= 0) { @@ -490,7 +490,7 @@ static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd) static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd) { calcoutRecord *prec = (calcoutRecord *)paddr->precord; - + switch (dbGetFieldIndex(paddr)) { case indexof(VAL): case indexof(HIHI): diff --git a/modules/database/src/std/rec/dfanoutRecord.c b/modules/database/src/std/rec/dfanoutRecord.c index 4672fc413..820e014c5 100644 --- a/modules/database/src/std/rec/dfanoutRecord.c +++ b/modules/database/src/std/rec/dfanoutRecord.c @@ -2,17 +2,17 @@ * Copyright (c) 2002 Southeastern Universities Research Association, as * Operator of Thomas Jefferson National Accelerator Facility. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* recDfanout.c - Record Support Routines for Dfanout records */ /* - * Original Author: Matt Bickley (Sometime in 1994) + * Original Author: Matt Bickley (Sometime in 1994) * * Modification Log: * ----------------- * .01 1994 mhb Started with longout record to make the data fanout - * .02 May 10, 96 jt Bug Fix + * .02 May 10, 96 jt Bug Fix * .03 11SEP2000 mrk LONG=>DOUBLE, add SELL,SELN,SELM */ @@ -62,24 +62,24 @@ static long get_control_double(DBADDR *,struct dbr_ctrlDouble *); static long get_alarm_double(DBADDR *,struct dbr_alDouble *); rset dfanoutRSET={ - RSETNUMBER, - report, - initialize, - init_record, - process, - special, - get_value, - cvt_dbaddr, - get_array_info, - put_array_info, - get_units, - get_precision, - get_enum_str, - get_enum_strs, - put_enum_str, - get_graphic_double, - get_control_double, - get_alarm_double + RSETNUMBER, + report, + initialize, + init_record, + process, + special, + get_value, + cvt_dbaddr, + get_array_info, + put_array_info, + get_units, + get_precision, + get_enum_str, + get_enum_strs, + put_enum_str, + get_graphic_double, + get_control_double, + get_alarm_double }; epicsExportAddress(rset,dfanoutRSET); @@ -183,8 +183,8 @@ static long get_control_double(DBADDR *paddr,struct dbr_ctrlDouble *pcd) case indexof(LALM): case indexof(ALST): case indexof(MLST): - pcd->upper_ctrl_limit = prec->hopr; - pcd->lower_ctrl_limit = prec->lopr; + pcd->upper_ctrl_limit = prec->hopr; + pcd->lower_ctrl_limit = prec->lopr; break; default: recGblGetControlDouble(paddr,pcd); @@ -194,7 +194,7 @@ static long get_control_double(DBADDR *paddr,struct dbr_ctrlDouble *pcd) static long get_alarm_double(DBADDR *paddr,struct dbr_alDouble *pad) { dfanoutRecord *prec=(dfanoutRecord *)paddr->precord; - + if(dbGetFieldIndex(paddr) == indexof(VAL)) { pad->upper_alarm_limit = prec->hhsv ? prec->hihi : epicsNAN; pad->upper_warning_limit = prec->hsv ? prec->high : epicsNAN; diff --git a/modules/database/src/std/rec/eventRecord.c b/modules/database/src/std/rec/eventRecord.c index d6f103dc8..baec5ba4e 100644 --- a/modules/database/src/std/rec/eventRecord.c +++ b/modules/database/src/std/rec/eventRecord.c @@ -59,24 +59,24 @@ static long special(DBADDR *, int); #define get_alarm_double NULL rset eventRSET={ - RSETNUMBER, - report, - initialize, - init_record, - process, - special, - get_value, - cvt_dbaddr, - get_array_info, - put_array_info, - get_units, - get_precision, - get_enum_str, - get_enum_strs, - put_enum_str, - get_graphic_double, - get_control_double, - get_alarm_double + RSETNUMBER, + report, + initialize, + init_record, + process, + special, + get_value, + cvt_dbaddr, + get_array_info, + put_array_info, + get_units, + get_precision, + get_enum_str, + get_enum_strs, + put_enum_str, + get_graphic_double, + get_control_double, + get_alarm_double }; epicsExportAddress(rset,eventRSET); @@ -96,7 +96,7 @@ static long init_record(struct dbCommon *pcommon, int pass) recGblInitConstantLink(&prec->siol, DBF_STRING, &prec->sval); if( (pdset=(eventdset *)(prec->dset)) && (pdset->common.init_record) ) - status=(*pdset->common.init_record)(pcommon); + status=(*pdset->common.init_record)(pcommon); prec->epvt = eventNameToHandle(prec->val); @@ -107,27 +107,27 @@ static long process(struct dbCommon *pcommon) { struct eventRecord *prec = (struct eventRecord *)pcommon; eventdset *pdset = (eventdset *)(prec->dset); - long status=0; - unsigned char pact=prec->pact; + long status=0; + unsigned char pact=prec->pact; - if((pdset!=NULL) && (pdset->common.number >= 5) && pdset->read_event ) - status=readValue(prec); /* read the new value */ - /* check if device support set pact */ - if ( !pact && prec->pact ) return(0); - prec->pact = TRUE; + if((pdset!=NULL) && (pdset->common.number >= 5) && pdset->read_event ) + status=readValue(prec); /* read the new value */ + /* check if device support set pact */ + if ( !pact && prec->pact ) return(0); + prec->pact = TRUE; - postEvent(prec->epvt); + postEvent(prec->epvt); recGblGetTimeStampSimm(prec, prec->simm, &prec->siol); - /* check event list */ - monitor(prec); + /* check event list */ + monitor(prec); - /* process the forward scan link record */ - recGblFwdLink(prec); + /* process the forward scan link record */ + recGblFwdLink(prec); - prec->pact=FALSE; - return(status); + prec->pact=FALSE; + return(status); } diff --git a/modules/database/src/std/rec/fanoutRecord.c b/modules/database/src/std/rec/fanoutRecord.c index 3ac6b66c6..dac7d5894 100644 --- a/modules/database/src/std/rec/fanoutRecord.c +++ b/modules/database/src/std/rec/fanoutRecord.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/database/src/std/rec/histogramRecord.c b/modules/database/src/std/rec/histogramRecord.c index e6ee97b2b..ee980d57e 100644 --- a/modules/database/src/std/rec/histogramRecord.c +++ b/modules/database/src/std/rec/histogramRecord.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* histogramRecord.c - Record Support Routines for Histogram records */ diff --git a/modules/database/src/std/rec/int64inRecord.c b/modules/database/src/std/rec/int64inRecord.c index cb4d85340..87f11869e 100644 --- a/modules/database/src/std/rec/int64inRecord.c +++ b/modules/database/src/std/rec/int64inRecord.c @@ -4,13 +4,13 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* int64inRecord.c - Record Support Routines for int64in records */ /* * Original Author: Janet Anderson - * Date: 9/23/91 + * Date: 9/23/91 */ #include @@ -58,27 +58,27 @@ static long get_units(DBADDR *, char *); #define put_enum_str NULL static long get_graphic_double(DBADDR *, struct dbr_grDouble *); static long get_control_double(DBADDR *, struct dbr_ctrlDouble *); -static long get_alarm_double(DBADDR *, struct dbr_alDouble *); +static long get_alarm_double(DBADDR *, struct dbr_alDouble *); rset int64inRSET={ - RSETNUMBER, - report, - initialize, - init_record, - process, - special, - get_value, - cvt_dbaddr, - get_array_info, - put_array_info, - get_units, - get_precision, - get_enum_str, - get_enum_strs, - put_enum_str, - get_graphic_double, - get_control_double, - get_alarm_double + RSETNUMBER, + report, + initialize, + init_record, + process, + special, + get_value, + cvt_dbaddr, + get_array_info, + put_array_info, + get_units, + get_precision, + get_enum_str, + get_enum_strs, + put_enum_str, + get_graphic_double, + get_control_double, + get_alarm_double }; epicsExportAddress(rset,int64inRSET); @@ -101,13 +101,13 @@ static long init_record(dbCommon *pcommon, int pass) recGblInitConstantLink(&prec->siol, DBF_INT64, &prec->sval); if(!(pdset = (int64indset *)(prec->dset))) { - recGblRecordError(S_dev_noDSET,(void *)prec,"int64in: init_record"); - return(S_dev_noDSET); + recGblRecordError(S_dev_noDSET,(void *)prec,"int64in: init_record"); + return(S_dev_noDSET); } /* must have read_int64in function defined */ if ((pdset->common.number < 5) || (pdset->read_int64in == NULL)) { - recGblRecordError(S_dev_missingSup,(void *)prec,"int64in: init_record"); - return(S_dev_missingSup); + recGblRecordError(S_dev_missingSup,(void *)prec,"int64in: init_record"); + return(S_dev_missingSup); } if (pdset->common.init_record) { if ((status = pdset->common.init_record(pcommon))) return status; @@ -122,35 +122,35 @@ static long process(dbCommon *pcommon) { int64inRecord *prec = (int64inRecord*)pcommon; int64indset *pdset = (int64indset *)(prec->dset); - long status; - unsigned char pact=prec->pact; - epicsTimeStamp timeLast; + long status; + unsigned char pact=prec->pact; + epicsTimeStamp timeLast; - if( (pdset==NULL) || (pdset->read_int64in==NULL) ) { - prec->pact=TRUE; - recGblRecordError(S_dev_missingSup,(void *)prec,"read_int64in"); - return(S_dev_missingSup); - } - timeLast = prec->time; + if( (pdset==NULL) || (pdset->read_int64in==NULL) ) { + prec->pact=TRUE; + recGblRecordError(S_dev_missingSup,(void *)prec,"read_int64in"); + return(S_dev_missingSup); + } + timeLast = prec->time; - status=readValue(prec); /* read the new value */ - /* check if device support set pact */ - if ( !pact && prec->pact ) return(0); - prec->pact = TRUE; + status=readValue(prec); /* read the new value */ + /* check if device support set pact */ + if ( !pact && prec->pact ) return(0); + prec->pact = TRUE; recGblGetTimeStampSimm(prec, prec->simm, &prec->siol); if (status==0) prec->udf = FALSE; - /* check for alarms */ - checkAlarms(prec, &timeLast); - /* check event list */ - monitor(prec); - /* process the forward scan link record */ - recGblFwdLink(prec); + /* check for alarms */ + checkAlarms(prec, &timeLast); + /* check event list */ + monitor(prec); + /* process the forward scan link record */ + recGblFwdLink(prec); - prec->pact=FALSE; - return(status); + prec->pact=FALSE; + return(status); } static long special(DBADDR *paddr, int after) @@ -231,7 +231,7 @@ static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd) return(0); } -static long get_alarm_double(DBADDR *paddr, struct dbr_alDouble *pad) +static long get_alarm_double(DBADDR *paddr, struct dbr_alDouble *pad) { int64inRecord *prec=(int64inRecord *)paddr->precord; @@ -257,7 +257,7 @@ static void checkAlarms(int64inRecord *prec, epicsTimeStamp *timeLast) SOFT_ALARM, LOLO_ALARM, LOW_ALARM, NO_ALARM, HIGH_ALARM, HIHI_ALARM }; - + double aftc, afvl; epicsInt64 val, hyst, lalm; epicsInt64 alev; diff --git a/modules/database/src/std/rec/int64outRecord.c b/modules/database/src/std/rec/int64outRecord.c index c90518e1d..10c48ec0b 100644 --- a/modules/database/src/std/rec/int64outRecord.c +++ b/modules/database/src/std/rec/int64outRecord.c @@ -9,8 +9,8 @@ /* * Original Author: Janet Anderson - * Date: 9/23/91 - */ + * Date: 9/23/91 + */ #include #include #include @@ -58,24 +58,24 @@ static long get_control_double(DBADDR *, struct dbr_ctrlDouble *); static long get_alarm_double(DBADDR *, struct dbr_alDouble *); rset int64outRSET={ - RSETNUMBER, - report, - initialize, - init_record, - process, - special, - get_value, - cvt_dbaddr, - get_array_info, - put_array_info, - get_units, - get_precision, - get_enum_str, - get_enum_strs, - put_enum_str, - get_graphic_double, - get_control_double, - get_alarm_double + RSETNUMBER, + report, + initialize, + init_record, + process, + special, + get_value, + cvt_dbaddr, + get_array_info, + put_array_info, + get_units, + get_precision, + get_enum_str, + get_enum_strs, + put_enum_str, + get_graphic_double, + get_control_double, + get_alarm_double }; epicsExportAddress(rset,int64outRSET); @@ -97,17 +97,17 @@ static long init_record(dbCommon *pcommon, int pass) recGblInitSimm(pcommon, &prec->sscn, &prec->oldsimm, &prec->simm, &prec->siml); if(!(pdset = (int64outdset *)(prec->dset))) { - recGblRecordError(S_dev_noDSET,(void *)prec,"int64out: init_record"); - return(S_dev_noDSET); + recGblRecordError(S_dev_noDSET,(void *)prec,"int64out: init_record"); + return(S_dev_noDSET); } /* must have write_int64out functions defined */ if ((pdset->common.number < 5) || (pdset->write_int64out == NULL)) { - recGblRecordError(S_dev_missingSup,(void *)prec,"int64out: init_record"); - return(S_dev_missingSup); + recGblRecordError(S_dev_missingSup,(void *)prec,"int64out: init_record"); + return(S_dev_missingSup); } if (prec->dol.type == CONSTANT) { - if(recGblInitConstantLink(&prec->dol,DBF_INT64,&prec->val)) - prec->udf=FALSE; + if(recGblInitConstantLink(&prec->dol,DBF_INT64,&prec->val)) + prec->udf=FALSE; } if (pdset->common.init_record) { if ((status = pdset->common.init_record(pcommon))) return status; @@ -122,68 +122,68 @@ static long process(dbCommon *pcommon) { int64outRecord *prec = (int64outRecord*)pcommon; int64outdset *pdset = (int64outdset *)(prec->dset); - long status=0; - epicsInt64 value; - unsigned char pact=prec->pact; + long status=0; + epicsInt64 value; + unsigned char pact=prec->pact; - if( (pdset==NULL) || (pdset->write_int64out==NULL) ) { - prec->pact=TRUE; - recGblRecordError(S_dev_missingSup,(void *)prec,"write_int64out"); - return(S_dev_missingSup); - } - if (!prec->pact) { - if((prec->dol.type != CONSTANT) + if( (pdset==NULL) || (pdset->write_int64out==NULL) ) { + prec->pact=TRUE; + recGblRecordError(S_dev_missingSup,(void *)prec,"write_int64out"); + return(S_dev_missingSup); + } + if (!prec->pact) { + if((prec->dol.type != CONSTANT) && (prec->omsl == menuOmslclosed_loop)) { - status = dbGetLink(&(prec->dol),DBR_INT64, - &value,0,0); - if (prec->dol.type!=CONSTANT && RTN_SUCCESS(status)) - prec->udf=FALSE; - } - else { - value = prec->val; - } - if (!status) convert(prec,value); - } - - /* check for alarms */ - checkAlarms(prec); - - if (prec->nsev < INVALID_ALARM ) - status=writeValue(prec); /* write the new value */ - else { - switch (prec->ivoa) { - case (menuIvoaContinue_normally) : - status=writeValue(prec); /* write the new value */ - break; - case (menuIvoaDon_t_drive_outputs) : - break; - case (menuIvoaSet_output_to_IVOV) : - if(prec->pact == FALSE){ - prec->val=prec->ivov; - } - status=writeValue(prec); /* write the new value */ - break; - default : - status=-1; - recGblRecordError(S_db_badField,(void *)prec, - "int64out:process Illegal IVOA field"); - } + status = dbGetLink(&(prec->dol),DBR_INT64, + &value,0,0); + if (prec->dol.type!=CONSTANT && RTN_SUCCESS(status)) + prec->udf=FALSE; } + else { + value = prec->val; + } + if (!status) convert(prec,value); + } - /* check if device support set pact */ - if ( !pact && prec->pact ) return(0); - prec->pact = TRUE; + /* check for alarms */ + checkAlarms(prec); + + if (prec->nsev < INVALID_ALARM ) + status=writeValue(prec); /* write the new value */ + else { + switch (prec->ivoa) { + case (menuIvoaContinue_normally) : + status=writeValue(prec); /* write the new value */ + break; + case (menuIvoaDon_t_drive_outputs) : + break; + case (menuIvoaSet_output_to_IVOV) : + if(prec->pact == FALSE){ + prec->val=prec->ivov; + } + status=writeValue(prec); /* write the new value */ + break; + default : + status=-1; + recGblRecordError(S_db_badField,(void *)prec, + "int64out:process Illegal IVOA field"); + } + } + + /* check if device support set pact */ + if ( !pact && prec->pact ) return(0); + prec->pact = TRUE; recGblGetTimeStampSimm(prec, prec->simm, NULL); - /* check event list */ - monitor(prec); + /* check event list */ + monitor(prec); - /* process the forward scan link record */ - recGblFwdLink(prec); + /* process the forward scan link record */ + recGblFwdLink(prec); - prec->pact=FALSE; - return(status); + prec->pact=FALSE; + return(status); } static long special(DBADDR *paddr, int after) @@ -221,7 +221,7 @@ static long get_units(DBADDR *paddr,char *units) static long get_graphic_double(DBADDR *paddr,struct dbr_grDouble *pgd) { int64outRecord *prec=(int64outRecord *)paddr->precord; - + switch (dbGetFieldIndex(paddr)) { case indexof(VAL): case indexof(HIHI): @@ -410,9 +410,9 @@ static long writeValue(int64outRecord *prec) static void convert(int64outRecord *prec, epicsInt64 value) { /* check drive limits */ - if(prec->drvh > prec->drvl) { - if (value > prec->drvh) value = prec->drvh; - else if (value < prec->drvl) value = prec->drvl; - } - prec->val = value; + if(prec->drvh > prec->drvl) { + if (value > prec->drvh) value = prec->drvh; + else if (value < prec->drvl) value = prec->drvl; + } + prec->val = value; } diff --git a/modules/database/src/std/rec/longinRecord.c b/modules/database/src/std/rec/longinRecord.c index 299cfb8e6..9f9f5a61e 100644 --- a/modules/database/src/std/rec/longinRecord.c +++ b/modules/database/src/std/rec/longinRecord.c @@ -4,13 +4,13 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* recLongin.c - Record Support Routines for Longin records */ /* - * Author: Janet Anderson - * Date: 9/23/91 + * Author: Janet Anderson + * Date: 9/23/91 */ #include @@ -59,27 +59,27 @@ static long get_units(DBADDR *, char *); #define put_enum_str NULL static long get_graphic_double(DBADDR *, struct dbr_grDouble *); static long get_control_double(DBADDR *, struct dbr_ctrlDouble *); -static long get_alarm_double(DBADDR *, struct dbr_alDouble *); +static long get_alarm_double(DBADDR *, struct dbr_alDouble *); rset longinRSET={ - RSETNUMBER, - report, - initialize, - init_record, - process, - special, - get_value, - cvt_dbaddr, - get_array_info, - put_array_info, - get_units, - get_precision, - get_enum_str, - get_enum_strs, - put_enum_str, - get_graphic_double, - get_control_double, - get_alarm_double + RSETNUMBER, + report, + initialize, + init_record, + process, + special, + get_value, + cvt_dbaddr, + get_array_info, + put_array_info, + get_units, + get_precision, + get_enum_str, + get_enum_strs, + put_enum_str, + get_graphic_double, + get_control_double, + get_alarm_double }; epicsExportAddress(rset,longinRSET); @@ -126,35 +126,35 @@ static long process(struct dbCommon *pcommon) { struct longinRecord *prec = (struct longinRecord *)pcommon; longindset *pdset = (longindset *)(prec->dset); - long status; - unsigned char pact=prec->pact; - epicsTimeStamp timeLast; + long status; + unsigned char pact=prec->pact; + epicsTimeStamp timeLast; - if( (pdset==NULL) || (pdset->read_longin==NULL) ) { - prec->pact=TRUE; - recGblRecordError(S_dev_missingSup,(void *)prec,"read_longin"); - return(S_dev_missingSup); - } - timeLast = prec->time; + if( (pdset==NULL) || (pdset->read_longin==NULL) ) { + prec->pact=TRUE; + recGblRecordError(S_dev_missingSup,(void *)prec,"read_longin"); + return(S_dev_missingSup); + } + timeLast = prec->time; - status=readValue(prec); /* read the new value */ - /* check if device support set pact */ - if ( !pact && prec->pact ) return(0); - prec->pact = TRUE; + status=readValue(prec); /* read the new value */ + /* check if device support set pact */ + if ( !pact && prec->pact ) return(0); + prec->pact = TRUE; recGblGetTimeStampSimm(prec, prec->simm, &prec->siol); if (status==0) prec->udf = FALSE; - /* check for alarms */ - checkAlarms(prec, &timeLast); - /* check event list */ - monitor(prec); - /* process the forward scan link record */ - recGblFwdLink(prec); + /* check for alarms */ + checkAlarms(prec, &timeLast); + /* check event list */ + monitor(prec); + /* process the forward scan link record */ + recGblFwdLink(prec); - prec->pact=FALSE; - return(status); + prec->pact=FALSE; + return(status); } static long special(DBADDR *paddr, int after) @@ -236,7 +236,7 @@ static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd) return(0); } -static long get_alarm_double(DBADDR *paddr, struct dbr_alDouble *pad) +static long get_alarm_double(DBADDR *paddr, struct dbr_alDouble *pad) { longinRecord *prec=(longinRecord *)paddr->precord; @@ -253,7 +253,7 @@ static long get_alarm_double(DBADDR *paddr, struct dbr_alDouble *pad) static void checkAlarms(longinRecord *prec, epicsTimeStamp *timeLast) { - enum { + enum { range_Lolo = 1, range_Low, range_Normal, @@ -264,7 +264,7 @@ static void checkAlarms(longinRecord *prec, epicsTimeStamp *timeLast) SOFT_ALARM, LOLO_ALARM, LOW_ALARM, NO_ALARM, HIGH_ALARM, HIHI_ALARM }; - + double aftc, afvl; epicsInt32 val, hyst, lalm; epicsInt32 alev; diff --git a/modules/database/src/std/rec/longoutRecord.c b/modules/database/src/std/rec/longoutRecord.c index 238fb691c..46bd5200d 100644 --- a/modules/database/src/std/rec/longoutRecord.c +++ b/modules/database/src/std/rec/longoutRecord.c @@ -4,13 +4,13 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* - * Author: Janet Anderson - * Date: 9/23/91 - */ + * Author: Janet Anderson + * Date: 9/23/91 + */ #include #include #include @@ -59,24 +59,24 @@ static long get_control_double(DBADDR *, struct dbr_ctrlDouble *); static long get_alarm_double(DBADDR *, struct dbr_alDouble *); rset longoutRSET={ - RSETNUMBER, - report, - initialize, - init_record, - process, - special, - get_value, - cvt_dbaddr, - get_array_info, - put_array_info, - get_units, - get_precision, - get_enum_str, - get_enum_strs, - put_enum_str, - get_graphic_double, - get_control_double, - get_alarm_double + RSETNUMBER, + report, + initialize, + init_record, + process, + special, + get_value, + cvt_dbaddr, + get_array_info, + put_array_info, + get_units, + get_precision, + get_enum_str, + get_enum_strs, + put_enum_str, + get_graphic_double, + get_control_double, + get_alarm_double }; epicsExportAddress(rset,longoutRSET); @@ -125,67 +125,67 @@ static long process(struct dbCommon *pcommon) { struct longoutRecord *prec = (struct longoutRecord *)pcommon; longoutdset *pdset = (longoutdset *)(prec->dset); - long status=0; - epicsInt32 value; - unsigned char pact=prec->pact; + long status=0; + epicsInt32 value; + unsigned char pact=prec->pact; - if( (pdset==NULL) || (pdset->write_longout==NULL) ) { - prec->pact=TRUE; - recGblRecordError(S_dev_missingSup,(void *)prec,"write_longout"); - return(S_dev_missingSup); - } - if (!prec->pact) { - if (!dbLinkIsConstant(&prec->dol) && - prec->omsl == menuOmslclosed_loop) { - status = dbGetLink(&prec->dol, DBR_LONG, &value, 0, 0); - if (!dbLinkIsConstant(&prec->dol) && !status) - prec->udf=FALSE; - } - else { - value = prec->val; - } - if (!status) convert(prec,value); - } - - /* check for alarms */ - checkAlarms(prec); - - if (prec->nsev < INVALID_ALARM ) - status=writeValue(prec); /* write the new value */ - else { - switch (prec->ivoa) { - case (menuIvoaContinue_normally) : - status=writeValue(prec); /* write the new value */ - break; - case (menuIvoaDon_t_drive_outputs) : - break; - case (menuIvoaSet_output_to_IVOV) : - if(prec->pact == FALSE){ - prec->val=prec->ivov; - } - status=writeValue(prec); /* write the new value */ - break; - default : - status=-1; - recGblRecordError(S_db_badField,(void *)prec, - "longout:process Illegal IVOA field"); - } + if( (pdset==NULL) || (pdset->write_longout==NULL) ) { + prec->pact=TRUE; + recGblRecordError(S_dev_missingSup,(void *)prec,"write_longout"); + return(S_dev_missingSup); + } + if (!prec->pact) { + if (!dbLinkIsConstant(&prec->dol) && + prec->omsl == menuOmslclosed_loop) { + status = dbGetLink(&prec->dol, DBR_LONG, &value, 0, 0); + if (!dbLinkIsConstant(&prec->dol) && !status) + prec->udf=FALSE; } + else { + value = prec->val; + } + if (!status) convert(prec,value); + } - /* check if device support set pact */ - if ( !pact && prec->pact ) return(0); - prec->pact = TRUE; + /* check for alarms */ + checkAlarms(prec); + + if (prec->nsev < INVALID_ALARM ) + status=writeValue(prec); /* write the new value */ + else { + switch (prec->ivoa) { + case (menuIvoaContinue_normally) : + status=writeValue(prec); /* write the new value */ + break; + case (menuIvoaDon_t_drive_outputs) : + break; + case (menuIvoaSet_output_to_IVOV) : + if(prec->pact == FALSE){ + prec->val=prec->ivov; + } + status=writeValue(prec); /* write the new value */ + break; + default : + status=-1; + recGblRecordError(S_db_badField,(void *)prec, + "longout:process Illegal IVOA field"); + } + } + + /* check if device support set pact */ + if ( !pact && prec->pact ) return(0); + prec->pact = TRUE; recGblGetTimeStampSimm(prec, prec->simm, NULL); - /* check event list */ - monitor(prec); + /* check event list */ + monitor(prec); - /* process the forward scan link record */ - recGblFwdLink(prec); + /* process the forward scan link record */ + recGblFwdLink(prec); - prec->pact=FALSE; - return(status); + prec->pact=FALSE; + return(status); } static long special(DBADDR *paddr, int after) @@ -223,7 +223,7 @@ static long get_units(DBADDR *paddr,char *units) static long get_graphic_double(DBADDR *paddr,struct dbr_grDouble *pgd) { longoutRecord *prec=(longoutRecord *)paddr->precord; - + switch (dbGetFieldIndex(paddr)) { case indexof(VAL): case indexof(HIHI): @@ -414,9 +414,9 @@ static long writeValue(longoutRecord *prec) static void convert(longoutRecord *prec, epicsInt32 value) { /* check drive limits */ - if(prec->drvh > prec->drvl) { - if (value > prec->drvh) value = prec->drvh; - else if (value < prec->drvl) value = prec->drvl; - } - prec->val = value; + if(prec->drvh > prec->drvl) { + if (value > prec->drvh) value = prec->drvh; + else if (value < prec->drvl) value = prec->drvl; + } + prec->val = value; } diff --git a/modules/database/src/std/rec/mbbiDirectRecord.c b/modules/database/src/std/rec/mbbiDirectRecord.c index d3515119a..7974256ef 100644 --- a/modules/database/src/std/rec/mbbiDirectRecord.c +++ b/modules/database/src/std/rec/mbbiDirectRecord.c @@ -197,7 +197,7 @@ static long special(DBADDR *paddr, int after) static long get_precision(const DBADDR *paddr,long *precision) { - mbbiDirectRecord *prec=(mbbiDirectRecord *)paddr->precord; + mbbiDirectRecord *prec=(mbbiDirectRecord *)paddr->precord; if(dbGetFieldIndex(paddr)==mbbiDirectRecordVAL) *precision = prec->nobt; else diff --git a/modules/database/src/std/rec/mbbiRecord.c b/modules/database/src/std/rec/mbbiRecord.c index ba24d52e3..73ade5e91 100644 --- a/modules/database/src/std/rec/mbbiRecord.c +++ b/modules/database/src/std/rec/mbbiRecord.c @@ -5,7 +5,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/database/src/std/rec/mbboDirectRecord.c b/modules/database/src/std/rec/mbboDirectRecord.c index 2f928198d..e2e542277 100644 --- a/modules/database/src/std/rec/mbboDirectRecord.c +++ b/modules/database/src/std/rec/mbboDirectRecord.c @@ -305,7 +305,7 @@ static long special(DBADDR *paddr, int after) static long get_precision(const DBADDR *paddr,long *precision) { - mbboDirectRecord *prec=(mbboDirectRecord *)paddr->precord; + mbboDirectRecord *prec=(mbboDirectRecord *)paddr->precord; if(dbGetFieldIndex(paddr)==mbboDirectRecordVAL) *precision = prec->nobt; else diff --git a/modules/database/src/std/rec/mbboRecord.c b/modules/database/src/std/rec/mbboRecord.c index b54988d6d..748893180 100644 --- a/modules/database/src/std/rec/mbboRecord.c +++ b/modules/database/src/std/rec/mbboRecord.c @@ -5,7 +5,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* mbboRecord.c - Record Support Routines for multi bit binary Output records */ diff --git a/modules/database/src/std/rec/permissiveRecord.c b/modules/database/src/std/rec/permissiveRecord.c index e553931bc..d93545a39 100644 --- a/modules/database/src/std/rec/permissiveRecord.c +++ b/modules/database/src/std/rec/permissiveRecord.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* recPermissive.c - Record Support Routines for Permissive records */ @@ -53,24 +53,24 @@ static long process(struct dbCommon *); #define get_alarm_double NULL rset permissiveRSET={ - RSETNUMBER, - report, - initialize, - init_record, - process, - special, - get_value, - cvt_dbaddr, - get_array_info, - put_array_info, - get_units, - get_precision, - get_enum_str, - get_enum_strs, - put_enum_str, - get_graphic_double, - get_control_double, - get_alarm_double + RSETNUMBER, + report, + initialize, + init_record, + process, + special, + get_value, + cvt_dbaddr, + get_array_info, + put_array_info, + get_units, + get_precision, + get_enum_str, + get_enum_strs, + put_enum_str, + get_graphic_double, + get_control_double, + get_alarm_double }; epicsExportAddress(rset,permissiveRSET); @@ -104,12 +104,12 @@ static void monitor(permissiveRecord *prec) prec->oval = val; prec->oflg = wflg; if(oval != val) { - db_post_events(prec,&prec->val, - monitor_mask|DBE_VALUE|DBE_LOG); + db_post_events(prec,&prec->val, + monitor_mask|DBE_VALUE|DBE_LOG); } if(oflg != wflg) { db_post_events(prec,&prec->wflg, - monitor_mask|DBE_VALUE|DBE_LOG); + monitor_mask|DBE_VALUE|DBE_LOG); } return; } diff --git a/modules/database/src/std/rec/printfRecord.c b/modules/database/src/std/rec/printfRecord.c index 8a8edb133..c8b244184 100644 --- a/modules/database/src/std/rec/printfRecord.c +++ b/modules/database/src/std/rec/printfRecord.c @@ -2,7 +2,7 @@ * Copyright (c) 2012 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* Printf record type */ @@ -130,7 +130,7 @@ static void doPrintf(printfRecord *prec) flags |= F_BADLNK; break; case 'h': - if (flags & (F_LONGLONG | F_LONG | F_CHAR)) + if (flags & (F_LONGLONG | F_LONG | F_CHAR)) flags |= F_BADFMT; else if (flags & F_SHORT) flags = (flags & ~F_SHORT) | F_CHAR; @@ -138,11 +138,11 @@ static void doPrintf(printfRecord *prec) flags |= F_SHORT; break; case 'l': - if (flags & (F_LONGLONG | F_SHORT | F_CHAR)) + if (flags & (F_LONGLONG | F_SHORT | F_CHAR)) flags |= F_BADFMT; - else if (flags & F_LONG) + else if (flags & F_LONG) flags = (flags & ~F_LONG) | F_LONGLONG; - else + else flags |= F_LONG; break; default: diff --git a/modules/database/src/std/rec/selRecord.c b/modules/database/src/std/rec/selRecord.c index 56a995c8f..65fbce30b 100644 --- a/modules/database/src/std/rec/selRecord.c +++ b/modules/database/src/std/rec/selRecord.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* selRecord.c - Record Support Routines for Select records */ @@ -55,28 +55,28 @@ static long get_control_double(DBADDR *, struct dbr_ctrlDouble *); static long get_alarm_double(DBADDR *, struct dbr_alDouble *); rset selRSET={ - RSETNUMBER, - report, - initialize, - init_record, - process, - special, - get_value, - cvt_dbaddr, - get_array_info, - put_array_info, - get_units, - get_precision, - get_enum_str, - get_enum_strs, - put_enum_str, - get_graphic_double, - get_control_double, - get_alarm_double + RSETNUMBER, + report, + initialize, + init_record, + process, + special, + get_value, + cvt_dbaddr, + get_array_info, + put_array_info, + get_units, + get_precision, + get_enum_str, + get_enum_strs, + put_enum_str, + get_graphic_double, + get_control_double, + get_alarm_double }; epicsExportAddress(rset,selRSET); -#define SEL_MAX 12 +#define SEL_MAX 12 static void checkAlarms(selRecord *); static void do_sel(selRecord *); @@ -111,7 +111,7 @@ static long process(struct dbCommon *pcommon) struct selRecord *prec = (struct selRecord *)pcommon; prec->pact = TRUE; if ( RTN_SUCCESS(fetch_values(prec)) ) { - do_sel(prec); + do_sel(prec); } recGblGetTimeStamp(prec); @@ -134,7 +134,7 @@ static long process(struct dbCommon *pcommon) static long get_units(DBADDR *paddr, char *units) { - selRecord *prec=(selRecord *)paddr->precord; + selRecord *prec=(selRecord *)paddr->precord; if(paddr->pfldDes->field_type == DBF_DOUBLE) { strncpy(units,prec->egu,DB_UNITS_SIZE); @@ -144,7 +144,7 @@ static long get_units(DBADDR *paddr, char *units) static long get_precision(const DBADDR *paddr, long *precision) { - selRecord *prec=(selRecord *)paddr->precord; + selRecord *prec=(selRecord *)paddr->precord; double *pvalue,*plvalue; int i; @@ -155,10 +155,10 @@ static long get_precision(const DBADDR *paddr, long *precision) pvalue = &prec->a; plvalue = &prec->la; for(i=0; ipfield==(void *)&pvalue - || paddr->pfield==(void *)&plvalue){ - return(0); - } + if(paddr->pfield==(void *)&pvalue + || paddr->pfield==(void *)&plvalue){ + return(0); + } } recGblGetPrec(paddr,precision); return(0); @@ -167,9 +167,9 @@ static long get_precision(const DBADDR *paddr, long *precision) static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd) { - selRecord *prec=(selRecord *)paddr->precord; + selRecord *prec=(selRecord *)paddr->precord; int index = dbGetFieldIndex(paddr); - + switch (index) { case indexof(VAL): case indexof(HIHI): @@ -201,9 +201,9 @@ static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd) static long get_control_double(struct dbAddr *paddr, struct dbr_ctrlDouble *pcd) { - selRecord *prec=(selRecord *)paddr->precord; + selRecord *prec=(selRecord *)paddr->precord; int index = dbGetFieldIndex(paddr); - + switch (index) { case indexof(VAL): case indexof(HIHI): @@ -235,7 +235,7 @@ static long get_control_double(struct dbAddr *paddr, struct dbr_ctrlDouble *pcd) static long get_alarm_double(DBADDR *paddr, struct dbr_alDouble *pad) { - selRecord *prec=(selRecord *)paddr->precord; + selRecord *prec=(selRecord *)paddr->precord; if(dbGetFieldIndex(paddr) == indexof(VAL)) { pad->upper_alarm_limit = prec->hhsv ? prec->hihi : epicsNAN; @@ -305,9 +305,9 @@ static void checkAlarms(selRecord *prec) static void monitor(selRecord *prec) { unsigned monitor_mask; - double *pnew; - double *pprev; - int i; + double *pnew; + double *pprev; + int i; monitor_mask = recGblResetAlarms(prec); @@ -325,27 +325,27 @@ static void monitor(selRecord *prec) /* trigger monitors of the SELN field */ if (prec->nlst != prec->seln) { - prec->nlst = prec->seln; - db_post_events(prec, &prec->seln, monitor_mask); + prec->nlst = prec->seln; + db_post_events(prec, &prec->seln, monitor_mask); } /* check all input fields for changes, even if VAL hasn't changed */ for(i=0, pnew=&prec->a, pprev=&prec->la; ia; @@ -409,29 +409,29 @@ static void do_sel(selRecord *prec) */ static int fetch_values(selRecord *prec) { - struct link *plink; - double *pvalue; - int i; - long status; + struct link *plink; + double *pvalue; + int i; + long status; plink = &prec->inpa; pvalue = &prec->a; /* If mechanism is selSELM_Specified, only get the selected input*/ if(prec->selm == selSELM_Specified) { - /* fetch the select index */ - status=dbGetLink(&(prec->nvl),DBR_USHORT,&(prec->seln),0,0); - if (!RTN_SUCCESS(status) || (prec->seln >= SEL_MAX)) - return(status); + /* fetch the select index */ + status=dbGetLink(&(prec->nvl),DBR_USHORT,&(prec->seln),0,0); + if (!RTN_SUCCESS(status) || (prec->seln >= SEL_MAX)) + return(status); - plink += prec->seln; - pvalue += prec->seln; + plink += prec->seln; + pvalue += prec->seln; - status=dbGetLink(plink,DBR_DOUBLE, pvalue,0,0); - return(status); + status=dbGetLink(plink,DBR_DOUBLE, pvalue,0,0); + return(status); } /* fetch all inputs*/ for(i=0; i #include @@ -321,7 +321,7 @@ static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd) { seqRecord *prec = (seqRecord *) paddr->precord; int fieldOffset = dbGetFieldIndex(paddr) - indexof(DLY1); - + if (fieldOffset >= 0) switch (fieldOffset & 2) { case 0: /* DLYn */ diff --git a/modules/database/src/std/rec/stateRecord.c b/modules/database/src/std/rec/stateRecord.c index 78eee9936..a48272828 100644 --- a/modules/database/src/std/rec/stateRecord.c +++ b/modules/database/src/std/rec/stateRecord.c @@ -4,13 +4,13 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* recState.c - Record Support Routines for State records */ /* * Original Author: Bob Dalesio - * Date: 10-10-90 + * Date: 10-10-90 */ #include @@ -55,24 +55,24 @@ static long process(struct dbCommon *); #define get_alarm_double NULL rset stateRSET={ - RSETNUMBER, - report, - initialize, - init_record, - process, - special, - get_value, - cvt_dbaddr, - get_array_info, - put_array_info, - get_units, - get_precision, - get_enum_str, - get_enum_strs, - put_enum_str, - get_graphic_double, - get_control_double, - get_alarm_double + RSETNUMBER, + report, + initialize, + init_record, + process, + special, + get_value, + cvt_dbaddr, + get_array_info, + put_array_info, + get_units, + get_precision, + get_enum_str, + get_enum_strs, + put_enum_str, + get_graphic_double, + get_control_double, + get_alarm_double }; epicsExportAddress(rset,stateRSET); @@ -95,14 +95,14 @@ static long process(struct dbCommon *pcommon) { struct stateRecord *prec = (struct stateRecord *)pcommon; - prec->udf = FALSE; - prec->pact=TRUE; - recGblGetTimeStamp(prec); - monitor(prec); - /* process the forward scan link record */ - recGblFwdLink(prec); - prec->pact=FALSE; - return(0); + prec->udf = FALSE; + prec->pact=TRUE; + recGblGetTimeStamp(prec); + monitor(prec); + /* process the forward scan link record */ + recGblFwdLink(prec); + prec->pact=FALSE; + return(0); } static void monitor(stateRecord *prec) @@ -113,7 +113,7 @@ static void monitor(stateRecord *prec) monitor_mask = recGblResetAlarms(prec); if(strncmp(prec->oval,prec->val,sizeof(prec->val))) { db_post_events(prec,&(prec->val[0]),monitor_mask|DBE_VALUE|DBE_LOG); - strncpy(prec->oval,prec->val,sizeof(prec->oval)); + strncpy(prec->oval,prec->val,sizeof(prec->oval)); } return; } diff --git a/modules/database/src/std/rec/stringinRecord.c b/modules/database/src/std/rec/stringinRecord.c index 3c6776204..5b4a1853f 100644 --- a/modules/database/src/std/rec/stringinRecord.c +++ b/modules/database/src/std/rec/stringinRecord.c @@ -4,13 +4,13 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* recStringin.c - Record Support Routines for Stringin records */ /* - * Author: Janet Anderson - * Date: 4/23/91 + * Author: Janet Anderson + * Date: 4/23/91 */ @@ -59,24 +59,24 @@ static long special(DBADDR *, int); #define get_alarm_double NULL rset stringinRSET={ - RSETNUMBER, - report, - initialize, - init_record, - process, - special, - get_value, - cvt_dbaddr, - get_array_info, - put_array_info, - get_units, - get_precision, - get_enum_str, - get_enum_strs, - put_enum_str, - get_graphic_double, - get_control_double, - get_alarm_double + RSETNUMBER, + report, + initialize, + init_record, + process, + special, + get_value, + cvt_dbaddr, + get_array_info, + put_array_info, + get_units, + get_precision, + get_enum_str, + get_enum_strs, + put_enum_str, + get_graphic_double, + get_control_double, + get_alarm_double }; epicsExportAddress(rset,stringinRSET); @@ -123,29 +123,29 @@ static long process(struct dbCommon *pcommon) { struct stringinRecord *prec = (struct stringinRecord *)pcommon; stringindset *pdset = (stringindset *)(prec->dset); - long status; - unsigned char pact=prec->pact; + long status; + unsigned char pact=prec->pact; - if( (pdset==NULL) || (pdset->read_stringin==NULL) ) { - prec->pact=TRUE; - recGblRecordError(S_dev_missingSup,(void *)prec,"read_stringin"); - return(S_dev_missingSup); - } + if( (pdset==NULL) || (pdset->read_stringin==NULL) ) { + prec->pact=TRUE; + recGblRecordError(S_dev_missingSup,(void *)prec,"read_stringin"); + return(S_dev_missingSup); + } - status=readValue(prec); /* read the new value */ - /* check if device support set pact */ - if ( !pact && prec->pact ) return(0); + status=readValue(prec); /* read the new value */ + /* check if device support set pact */ + if ( !pact && prec->pact ) return(0); prec->pact = TRUE; recGblGetTimeStampSimm(prec, prec->simm, &prec->siol); - /* check event list */ - monitor(prec); - /* process the forward scan link record */ - recGblFwdLink(prec); + /* check event list */ + monitor(prec); + /* process the forward scan link record */ + recGblFwdLink(prec); - prec->pact=FALSE; - return(status); + prec->pact=FALSE; + return(status); } static long special(DBADDR *paddr, int after) diff --git a/modules/database/src/std/rec/stringoutRecord.c b/modules/database/src/std/rec/stringoutRecord.c index 786d295cf..e20aa3d6b 100644 --- a/modules/database/src/std/rec/stringoutRecord.c +++ b/modules/database/src/std/rec/stringoutRecord.c @@ -4,14 +4,14 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* recStringout.c - Record Support Routines for Stringout records */ /* - * Author: Janet Anderson - * Date: 4/23/91 - */ + * Author: Janet Anderson + * Date: 4/23/91 + */ #include @@ -61,24 +61,24 @@ static long special(DBADDR *, int); #define get_alarm_double NULL rset stringoutRSET={ - RSETNUMBER, - report, - initialize, - init_record, - process, - special, - get_value, - cvt_dbaddr, - get_array_info, - put_array_info, - get_units, - get_precision, - get_enum_str, - get_enum_strs, - put_enum_str, - get_graphic_double, - get_control_double, - get_alarm_double + RSETNUMBER, + report, + initialize, + init_record, + process, + special, + get_value, + cvt_dbaddr, + get_array_info, + put_array_info, + get_units, + get_precision, + get_enum_str, + get_enum_strs, + put_enum_str, + get_graphic_double, + get_control_double, + get_alarm_double }; epicsExportAddress(rset,stringoutRSET); @@ -126,58 +126,58 @@ static long process(struct dbCommon *pcommon) { struct stringoutRecord *prec = (struct stringoutRecord *)pcommon; stringoutdset *pdset = (stringoutdset *)(prec->dset); - long status=0; - unsigned char pact=prec->pact; + long status=0; + unsigned char pact=prec->pact; - if( (pdset==NULL) || (pdset->write_stringout==NULL) ) { - prec->pact=TRUE; - recGblRecordError(S_dev_missingSup,(void *)prec,"write_stringout"); - return(S_dev_missingSup); - } - if (!prec->pact && - !dbLinkIsConstant(&prec->dol) && - prec->omsl == menuOmslclosed_loop) { - status = dbGetLink(&prec->dol, DBR_STRING, prec->val, 0, 0); - if (!dbLinkIsConstant(&prec->dol) && !status) - prec->udf=FALSE; - } + if( (pdset==NULL) || (pdset->write_stringout==NULL) ) { + prec->pact=TRUE; + recGblRecordError(S_dev_missingSup,(void *)prec,"write_stringout"); + return(S_dev_missingSup); + } + if (!prec->pact && + !dbLinkIsConstant(&prec->dol) && + prec->omsl == menuOmslclosed_loop) { + status = dbGetLink(&prec->dol, DBR_STRING, prec->val, 0, 0); + if (!dbLinkIsConstant(&prec->dol) && !status) + prec->udf=FALSE; + } - if(prec->udf == TRUE ){ - recGblSetSevr(prec,UDF_ALARM,prec->udfs); - } + if(prec->udf == TRUE ){ + recGblSetSevr(prec,UDF_ALARM,prec->udfs); + } - if (prec->nsev < INVALID_ALARM ) + if (prec->nsev < INVALID_ALARM ) + status=writeValue(prec); /* write the new value */ + else { + switch (prec->ivoa) { + case (menuIvoaContinue_normally) : status=writeValue(prec); /* write the new value */ - else { - switch (prec->ivoa) { - case (menuIvoaContinue_normally) : - status=writeValue(prec); /* write the new value */ - break; - case (menuIvoaDon_t_drive_outputs) : - break; - case (menuIvoaSet_output_to_IVOV) : - if(prec->pact == FALSE){ - strncpy(prec->val, prec->ivov, sizeof(prec->val)); - } - status=writeValue(prec); /* write the new value */ - break; - default : - status=-1; - recGblRecordError(S_db_badField,(void *)prec, - "stringout:process Illegal IVOA field"); + break; + case (menuIvoaDon_t_drive_outputs) : + break; + case (menuIvoaSet_output_to_IVOV) : + if(prec->pact == FALSE){ + strncpy(prec->val, prec->ivov, sizeof(prec->val)); } + status=writeValue(prec); /* write the new value */ + break; + default : + status=-1; + recGblRecordError(S_db_badField,(void *)prec, + "stringout:process Illegal IVOA field"); } + } - /* check if device support set pact */ - if ( !pact && prec->pact ) return(0); + /* check if device support set pact */ + if ( !pact && prec->pact ) return(0); - prec->pact = TRUE; + prec->pact = TRUE; recGblGetTimeStampSimm(prec, prec->simm, NULL); - monitor(prec); - recGblFwdLink(prec); - prec->pact=FALSE; - return(status); + monitor(prec); + recGblFwdLink(prec); + prec->pact=FALSE; + return(status); } static long special(DBADDR *paddr, int after) diff --git a/modules/database/src/std/rec/subRecord.c b/modules/database/src/std/rec/subRecord.c index 1fc007034..b542e65f5 100644 --- a/modules/database/src/std/rec/subRecord.c +++ b/modules/database/src/std/rec/subRecord.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* Record Support Routines for Subroutine records */ @@ -241,7 +241,7 @@ static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd) subRecord *prec = (subRecord *)paddr->precord; int fieldIndex = dbGetFieldIndex(paddr); int linkNumber; - + switch (fieldIndex) { case indexof(VAL): case indexof(HIHI): @@ -269,7 +269,7 @@ static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd) static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd) { subRecord *prec = (subRecord *)paddr->precord; - + switch (dbGetFieldIndex(paddr)) { case indexof(VAL): case indexof(HIHI): @@ -308,7 +308,7 @@ static long get_alarm_double(DBADDR *paddr, struct dbr_alDouble *pad) &pad->upper_warning_limit, &pad->upper_alarm_limit); } else - recGblGetAlarmDouble(paddr, pad); + recGblGetAlarmDouble(paddr, pad); } return 0; } diff --git a/modules/database/src/std/softIoc/makeInstallDir.pl b/modules/database/src/std/softIoc/makeInstallDir.pl index b090280eb..deab00313 100644 --- a/modules/database/src/std/softIoc/makeInstallDir.pl +++ b/modules/database/src/std/softIoc/makeInstallDir.pl @@ -3,7 +3,7 @@ # Copyright (c) 2010 UChicago Argonne LLC, as Operator of Argonne # National Laboratory. # EPICS BASE is distributed subject to a Software License Agreement found -# in file LICENSE that is included with this distribution. +# in file LICENSE that is included with this distribution. #************************************************************************* use strict; diff --git a/modules/database/src/std/softIoc/softMain.cpp b/modules/database/src/std/softIoc/softMain.cpp index 85a3b730d..2a6223e6c 100644 --- a/modules/database/src/std/softIoc/softMain.cpp +++ b/modules/database/src/std/softIoc/softMain.cpp @@ -7,7 +7,7 @@ * found in the file LICENSE that is included with this distribution. \*************************************************************************/ -/* Author: Andrew Johnson Date: 2003-04-08 */ +/* Author: Andrew Johnson Date: 2003-04-08 */ #include #include @@ -212,7 +212,7 @@ int main(int argc, char *argv[]) std::cout<<"# End "<=2) { + if(argc>=2) { iocsh(argv[1]); epicsThreadSleep(.2); } diff --git a/modules/database/src/template/top/exampleApp/src/devXxxSoft.c b/modules/database/src/template/top/exampleApp/src/devXxxSoft.c index 0507fdfd0..add7d5202 100644 --- a/modules/database/src/template/top/exampleApp/src/devXxxSoft.c +++ b/modules/database/src/template/top/exampleApp/src/devXxxSoft.c @@ -21,25 +21,25 @@ static long init_record(); static long read_xxx(); struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_xxx; + long number; + DEVSUPFUN report; + DEVSUPFUN init; + DEVSUPFUN init_record; + DEVSUPFUN get_ioint_info; + DEVSUPFUN read_xxx; }devXxxSoft={ - 5, - NULL, - NULL, - init_record, - NULL, - read_xxx, + 5, + NULL, + NULL, + init_record, + NULL, + read_xxx, }; epicsExportAddress(dset,devXxxSoft); static long init_record(pxxx) - struct xxxRecord *pxxx; + struct xxxRecord *pxxx; { if(recGblInitConstantLink(&pxxx->inp,DBF_DOUBLE,&pxxx->val)) pxxx->udf = FALSE; @@ -47,7 +47,7 @@ static long init_record(pxxx) } static long read_xxx(pxxx) - struct xxxRecord *pxxx; + struct xxxRecord *pxxx; { long status; diff --git a/modules/database/src/template/top/exampleApp/src/sncExample.stt b/modules/database/src/template/top/exampleApp/src/sncExample.stt index 235f3f45c..5237618db 100644 --- a/modules/database/src/template/top/exampleApp/src/sncExample.stt +++ b/modules/database/src/template/top/exampleApp/src/sncExample.stt @@ -5,18 +5,18 @@ monitor v; ss ss1 { state init { - when (delay(10)) { - printf("sncExample: Startup delay over\n"); - } state low + when (delay(10)) { + printf("sncExample: Startup delay over\n"); + } state low } state low { - when (v > 5.0) { - printf("sncExample: Changing to high\n"); - } state high + when (v > 5.0) { + printf("sncExample: Changing to high\n"); + } state high } state high { - when (v <= 5.0) { - printf("sncExample: Changing to low\n"); - } state low + when (v <= 5.0) { + printf("sncExample: Changing to low\n"); + } state low } } diff --git a/modules/database/src/template/top/exampleApp/src/xxxRecord.c b/modules/database/src/template/top/exampleApp/src/xxxRecord.c index 97640d2b6..418ed2ba9 100644 --- a/modules/database/src/template/top/exampleApp/src/xxxRecord.c +++ b/modules/database/src/template/top/exampleApp/src/xxxRecord.c @@ -1,6 +1,6 @@ /* xxxRecord.c */ /* Example record support module */ - + #include #include #include @@ -40,36 +40,36 @@ static long get_precision(const DBADDR *, long *); static long get_graphic_double(DBADDR *, struct dbr_grDouble *); static long get_control_double(DBADDR *, struct dbr_ctrlDouble *); static long get_alarm_double(DBADDR *, struct dbr_alDouble *); - + rset xxxRSET={ - RSETNUMBER, - report, - initialize, - init_record, - process, - special, - get_value, - cvt_dbaddr, - get_array_info, - put_array_info, - get_units, - get_precision, - get_enum_str, - get_enum_strs, - put_enum_str, - get_graphic_double, - get_control_double, - get_alarm_double + RSETNUMBER, + report, + initialize, + init_record, + process, + special, + get_value, + cvt_dbaddr, + get_array_info, + put_array_info, + get_units, + get_precision, + get_enum_str, + get_enum_strs, + put_enum_str, + get_graphic_double, + get_control_double, + get_alarm_double }; epicsExportAddress(rset,xxxRSET); typedef struct xxxset { /* xxx input dset */ - long number; - DEVSUPFUN dev_report; - DEVSUPFUN init; - DEVSUPFUN init_record; /*returns: (-1,0)=>(failure,success)*/ - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_xxx; + long number; + DEVSUPFUN dev_report; + DEVSUPFUN init; + DEVSUPFUN init_record; /*returns: (-1,0)=>(failure,success)*/ + DEVSUPFUN get_ioint_info; + DEVSUPFUN read_xxx; }xxxdset; static void checkAlarms(xxxRecord *prec); @@ -77,62 +77,62 @@ static void monitor(xxxRecord *prec); static long init_record(struct dbCommon *pcommon, int pass) { - xxxRecord *prec = (xxxRecord *)pcommon; - xxxdset *pdset; - long status; + xxxRecord *prec = (xxxRecord *)pcommon; + xxxdset *pdset; + long status; if (pass==0) return(0); if(!(pdset = (xxxdset *)(prec->dset))) { - recGblRecordError(S_dev_noDSET,(void *)prec,"xxx: init_record"); - return(S_dev_noDSET); + recGblRecordError(S_dev_noDSET,(void *)prec,"xxx: init_record"); + return(S_dev_noDSET); } /* must have read_xxx function defined */ if( (pdset->number < 5) || (pdset->read_xxx == NULL) ) { - recGblRecordError(S_dev_missingSup,(void *)prec,"xxx: init_record"); - return(S_dev_missingSup); + recGblRecordError(S_dev_missingSup,(void *)prec,"xxx: init_record"); + return(S_dev_missingSup); } if( pdset->init_record ) { - if((status=(*pdset->init_record)(prec))) return(status); + if((status=(*pdset->init_record)(prec))) return(status); } return(0); } static long process(struct dbCommon *pcommon) { - xxxRecord *prec = (xxxRecord *)pcommon; - xxxdset *pdset = (xxxdset *)(prec->dset); - long status; - unsigned char pact=prec->pact; + xxxRecord *prec = (xxxRecord *)pcommon; + xxxdset *pdset = (xxxdset *)(prec->dset); + long status; + unsigned char pact=prec->pact; - if( (pdset==NULL) || (pdset->read_xxx==NULL) ) { - prec->pact=TRUE; - recGblRecordError(S_dev_missingSup,(void *)prec,"read_xxx"); - return(S_dev_missingSup); - } + if( (pdset==NULL) || (pdset->read_xxx==NULL) ) { + prec->pact=TRUE; + recGblRecordError(S_dev_missingSup,(void *)prec,"read_xxx"); + return(S_dev_missingSup); + } - /* pact must not be set until after calling device support */ - status=(*pdset->read_xxx)(prec); - /* check if device support set pact */ - if ( !pact && prec->pact ) return(0); - prec->pact = TRUE; + /* pact must not be set until after calling device support */ + status=(*pdset->read_xxx)(prec); + /* check if device support set pact */ + if ( !pact && prec->pact ) return(0); + prec->pact = TRUE; - recGblGetTimeStamp(prec); - /* check for alarms */ - checkAlarms(prec); - /* check event list */ - monitor(prec); - /* process the forward scan link record */ + recGblGetTimeStamp(prec); + /* check for alarms */ + checkAlarms(prec); + /* check event list */ + monitor(prec); + /* process the forward scan link record */ recGblFwdLink(prec); - prec->pact=FALSE; - return(status); + prec->pact=FALSE; + return(status); } static long get_units(DBADDR *paddr, char *units) { - xxxRecord *prec=(xxxRecord *)paddr->precord; + xxxRecord *prec=(xxxRecord *)paddr->precord; strncpy(units,prec->egu,DB_UNITS_SIZE); return(0); @@ -140,7 +140,7 @@ static long get_units(DBADDR *paddr, char *units) static long get_precision(const DBADDR *paddr, long *precision) { - xxxRecord *prec=(xxxRecord *)paddr->precord; + xxxRecord *prec=(xxxRecord *)paddr->precord; *precision = prec->prec; if(paddr->pfield == (void *)&prec->val) return(0); @@ -150,8 +150,8 @@ static long get_precision(const DBADDR *paddr, long *precision) static long get_graphic_double(DBADDR *paddr,struct dbr_grDouble *pgd) { - xxxRecord *prec=(xxxRecord *)paddr->precord; - int fieldIndex = dbGetFieldIndex(paddr); + xxxRecord *prec=(xxxRecord *)paddr->precord; + int fieldIndex = dbGetFieldIndex(paddr); if(fieldIndex == xxxRecordVAL || fieldIndex == xxxRecordHIHI @@ -168,24 +168,24 @@ static long get_graphic_double(DBADDR *paddr,struct dbr_grDouble *pgd) static long get_control_double(DBADDR *paddr,struct dbr_ctrlDouble *pcd) { - xxxRecord *prec=(xxxRecord *)paddr->precord; - int fieldIndex = dbGetFieldIndex(paddr); + xxxRecord *prec=(xxxRecord *)paddr->precord; + int fieldIndex = dbGetFieldIndex(paddr); if(fieldIndex == xxxRecordVAL || fieldIndex == xxxRecordHIHI || fieldIndex == xxxRecordHIGH || fieldIndex == xxxRecordLOW || fieldIndex == xxxRecordLOLO) { - pcd->upper_ctrl_limit = prec->hopr; - pcd->lower_ctrl_limit = prec->lopr; + pcd->upper_ctrl_limit = prec->hopr; + pcd->lower_ctrl_limit = prec->lopr; } else recGblGetControlDouble(paddr,pcd); return(0); } static long get_alarm_double(DBADDR *paddr,struct dbr_alDouble *pad) { - xxxRecord *prec=(xxxRecord *)paddr->precord; - int fieldIndex = dbGetFieldIndex(paddr); + xxxRecord *prec=(xxxRecord *)paddr->precord; + int fieldIndex = dbGetFieldIndex(paddr); if(fieldIndex == xxxRecordVAL) { pad->upper_alarm_limit = prec->hhsv ? prec->hihi : epicsNAN; @@ -198,76 +198,76 @@ static long get_alarm_double(DBADDR *paddr,struct dbr_alDouble *pad) static void checkAlarms(xxxRecord *prec) { - double val, hyst, lalm; - float hihi, high, low, lolo; - unsigned short hhsv, llsv, hsv, lsv; + double val, hyst, lalm; + float hihi, high, low, lolo; + unsigned short hhsv, llsv, hsv, lsv; - if(prec->udf == TRUE ){ - recGblSetSevr(prec,UDF_ALARM,prec->udfs); - return; - } - hihi = prec->hihi; lolo = prec->lolo; high = prec->high; low = prec->low; - hhsv = prec->hhsv; llsv = prec->llsv; hsv = prec->hsv; lsv = prec->lsv; - val = prec->val; hyst = prec->hyst; lalm = prec->lalm; + if(prec->udf == TRUE ){ + recGblSetSevr(prec,UDF_ALARM,prec->udfs); + return; + } + hihi = prec->hihi; lolo = prec->lolo; high = prec->high; low = prec->low; + hhsv = prec->hhsv; llsv = prec->llsv; hsv = prec->hsv; lsv = prec->lsv; + val = prec->val; hyst = prec->hyst; lalm = prec->lalm; - /* alarm condition hihi */ - if (hhsv && (val >= hihi || ((lalm==hihi) && (val >= hihi-hyst)))){ - if (recGblSetSevr(prec,HIHI_ALARM,prec->hhsv)) prec->lalm = hihi; - return; - } + /* alarm condition hihi */ + if (hhsv && (val >= hihi || ((lalm==hihi) && (val >= hihi-hyst)))){ + if (recGblSetSevr(prec,HIHI_ALARM,prec->hhsv)) prec->lalm = hihi; + return; + } - /* alarm condition lolo */ - if (llsv && (val <= lolo || ((lalm==lolo) && (val <= lolo+hyst)))){ - if (recGblSetSevr(prec,LOLO_ALARM,prec->llsv)) prec->lalm = lolo; - return; - } + /* alarm condition lolo */ + if (llsv && (val <= lolo || ((lalm==lolo) && (val <= lolo+hyst)))){ + if (recGblSetSevr(prec,LOLO_ALARM,prec->llsv)) prec->lalm = lolo; + return; + } - /* alarm condition high */ - if (hsv && (val >= high || ((lalm==high) && (val >= high-hyst)))){ - if (recGblSetSevr(prec,HIGH_ALARM,prec->hsv)) prec->lalm = high; - return; - } + /* alarm condition high */ + if (hsv && (val >= high || ((lalm==high) && (val >= high-hyst)))){ + if (recGblSetSevr(prec,HIGH_ALARM,prec->hsv)) prec->lalm = high; + return; + } - /* alarm condition low */ - if (lsv && (val <= low || ((lalm==low) && (val <= low+hyst)))){ - if (recGblSetSevr(prec,LOW_ALARM,prec->lsv)) prec->lalm = low; - return; - } + /* alarm condition low */ + if (lsv && (val <= low || ((lalm==low) && (val <= low+hyst)))){ + if (recGblSetSevr(prec,LOW_ALARM,prec->lsv)) prec->lalm = low; + return; + } - /* we get here only if val is out of alarm by at least hyst */ - prec->lalm = val; - return; + /* we get here only if val is out of alarm by at least hyst */ + prec->lalm = val; + return; } static void monitor(xxxRecord *prec) { - unsigned short monitor_mask; - double delta; + unsigned short monitor_mask; + double delta; monitor_mask = recGblResetAlarms(prec); - /* check for value change */ - delta = prec->mlst - prec->val; - if(delta<0.0) delta = -delta; - if (delta > prec->mdel) { - /* post events for value change */ - monitor_mask |= DBE_VALUE; - /* update last value monitored */ - prec->mlst = prec->val; - } + /* check for value change */ + delta = prec->mlst - prec->val; + if(delta<0.0) delta = -delta; + if (delta > prec->mdel) { + /* post events for value change */ + monitor_mask |= DBE_VALUE; + /* update last value monitored */ + prec->mlst = prec->val; + } - /* check for archive change */ - delta = prec->alst - prec->val; - if(delta<0.0) delta = -delta; - if (delta > prec->adel) { - /* post events on value field for archive change */ - monitor_mask |= DBE_LOG; - /* update last archive value monitored */ - prec->alst = prec->val; - } + /* check for archive change */ + delta = prec->alst - prec->val; + if(delta<0.0) delta = -delta; + if (delta > prec->adel) { + /* post events on value field for archive change */ + monitor_mask |= DBE_LOG; + /* update last archive value monitored */ + prec->alst = prec->val; + } - /* send out monitors connected to the value field */ - if (monitor_mask){ - db_post_events(prec,&prec->val,monitor_mask); - } - return; + /* send out monitors connected to the value field */ + if (monitor_mask){ + db_post_events(prec,&prec->val,monitor_mask); + } + return; } diff --git a/modules/database/src/template/top/iocApp/src/_APPNAME_Main.cpp b/modules/database/src/template/top/iocApp/src/_APPNAME_Main.cpp index ae0ecb68a..fe4f105ed 100644 --- a/modules/database/src/template/top/iocApp/src/_APPNAME_Main.cpp +++ b/modules/database/src/template/top/iocApp/src/_APPNAME_Main.cpp @@ -13,7 +13,7 @@ int main(int argc,char *argv[]) { - if(argc>=2) { + if(argc>=2) { iocsh(argv[1]); epicsThreadSleep(.2); } diff --git a/modules/database/src/tools/DBD.pm b/modules/database/src/tools/DBD.pm index aabe26d26..511155901 100644 --- a/modules/database/src/tools/DBD.pm +++ b/modules/database/src/tools/DBD.pm @@ -22,7 +22,7 @@ sub new { my $this = { 'DBD::Breaktable' => {}, 'DBD::Driver' => {}, - 'DBD::Link' => {}, + 'DBD::Link' => {}, 'DBD::Function' => {}, 'DBD::Menu' => {}, 'DBD::Recordtype' => {}, diff --git a/modules/database/src/tools/DBD/Parser.pm b/modules/database/src/tools/DBD/Parser.pm index 4b845b0d1..92a1f35aa 100644 --- a/modules/database/src/tools/DBD/Parser.pm +++ b/modules/database/src/tools/DBD/Parser.pm @@ -116,11 +116,11 @@ sub parseCommon { # Extract POD if (m/\G ( = [a-zA-Z] )/xgc) { - # The above regex was split from the one below for performance. - # Using m/\G ( = [a-zA-Z] .* ) \n/ is slow in Perl 5.20 and later. - my $directive = $1; - m/\G ( .* ) \n/xgc; - $directive .= $1; + # The above regex was split from the one below for performance. + # Using m/\G ( = [a-zA-Z] .* ) \n/ is slow in Perl 5.20 and later. + my $directive = $1; + m/\G ( .* ) \n/xgc; + $directive .= $1; $obj->add_pod($directive, parsePod()); } elsif (m/\G \# /xgc) { diff --git a/modules/database/src/tools/makeIncludeDbd.pl b/modules/database/src/tools/makeIncludeDbd.pl index ab728da83..768e794a7 100644 --- a/modules/database/src/tools/makeIncludeDbd.pl +++ b/modules/database/src/tools/makeIncludeDbd.pl @@ -4,7 +4,7 @@ # Copyright (c) 2014 UChicago Argonne LLC, as Operator of Argonne # National Laboratory. # EPICS BASE is distributed subject to a Software License Agreement found -# in file LICENSE that is included with this distribution. +# in file LICENSE that is included with this distribution. #************************************************************************* use strict; diff --git a/modules/database/test/ioc/db/callbackParallelTest.c b/modules/database/test/ioc/db/callbackParallelTest.c index a985cd2d8..6f3fb82c4 100644 --- a/modules/database/test/ioc/db/callbackParallelTest.c +++ b/modules/database/test/ioc/db/callbackParallelTest.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * Copyright (c) 2013 ITER Organization. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* Author: Marty Kraimer Date: 26JAN2000 */ diff --git a/modules/database/test/ioc/db/callbackTest.c b/modules/database/test/ioc/db/callbackTest.c index 4b7e24d78..7268466e1 100644 --- a/modules/database/test/ioc/db/callbackTest.c +++ b/modules/database/test/ioc/db/callbackTest.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * Copyright (c) 2013 ITER Organization. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* Author: Marty Kraimer Date: 26JAN2000 */ @@ -61,7 +61,7 @@ static void myCallback(epicsCallback *pCallback) myPvt *pmyPvt; callbackGetUser(pmyPvt, pCallback); - + pmyPvt->pass++; if (pmyPvt->pass == 1) { diff --git a/modules/database/test/ioc/db/dbCaLinkTest.c b/modules/database/test/ioc/db/dbCaLinkTest.c index 62be1c0da..ed11d8816 100644 --- a/modules/database/test/ioc/db/dbCaLinkTest.c +++ b/modules/database/test/ioc/db/dbCaLinkTest.c @@ -32,7 +32,7 @@ typedef void * chid; typedef void * evid; epicsShareExtern const unsigned short dbr_value_size[]; epicsShareExtern short epicsShareAPI ca_field_type (chid chan); -#define MAX_UNITS_SIZE 8 +#define MAX_UNITS_SIZE 8 #include "dbCaPvt.h" #include "errlog.h" diff --git a/modules/database/test/ioc/db/dbPutLinkTest.c b/modules/database/test/ioc/db/dbPutLinkTest.c index 179b913ce..2dde8fe76 100644 --- a/modules/database/test/ioc/db/dbPutLinkTest.c +++ b/modules/database/test/ioc/db/dbPutLinkTest.c @@ -459,7 +459,7 @@ static void testLinkInitFail(void) eltc(0); testOk(dbReadDatabase(&pdbbase, "dbBadLink.db", "." OSI_PATH_LIST_SEPARATOR ".." OSI_PATH_LIST_SEPARATOR "../O.Common" OSI_PATH_LIST_SEPARATOR - "O.Common", NULL) != 0, "dbReadDatabase returned error (expected)"); + "O.Common", NULL) != 0, "dbReadDatabase returned error (expected)"); testIocInitOk(); eltc(1); diff --git a/modules/database/test/std/rec/mbbioDirectTest.c b/modules/database/test/std/rec/mbbioDirectTest.c index fb011f662..246cc336b 100644 --- a/modules/database/test/std/rec/mbbioDirectTest.c +++ b/modules/database/test/std/rec/mbbioDirectTest.c @@ -36,7 +36,7 @@ void testmbbioFields(const char* rec, unsigned int value) { char field[40]; unsigned int i; - + testdbGetFieldEqual(rec, DBF_ULONG, value); for (i=0; i < 32; i++) { @@ -50,7 +50,7 @@ void testmbbioRecords(unsigned int count, unsigned int value) { char rec[40]; unsigned int i; - + for (i = 1; i <= count; i++) { sprintf(rec, "do%d", i); @@ -66,7 +66,7 @@ void putN(const char* pattern, unsigned int count, unsigned int value) { char field[40]; unsigned int i; - + for (i = 1; i <= count; i++) { sprintf(field, pattern, i); @@ -79,7 +79,7 @@ void testN(const char* pattern, unsigned int count, unsigned int value) { char field[40]; unsigned int i; - + for (i = 1; i <= count; i++) { sprintf(field, pattern, i); @@ -96,7 +96,7 @@ MAIN(mbbioDirectTest) unsigned int simvalue = 0; char macros [40]; const unsigned int N = 2; - + testPlan(N*((32+1)*2*4+4+3)); testdbPrepare(); diff --git a/modules/database/test/std/rec/seqTest.c b/modules/database/test/std/rec/seqTest.c index f43d15f29..37d579ece 100644 --- a/modules/database/test/std/rec/seqTest.c +++ b/modules/database/test/std/rec/seqTest.c @@ -1,5 +1,5 @@ /*************************************************************************\ -* Copyright (c) 2020 Gabriel Fedel +* Copyright (c) 2020 Gabriel Fedel * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ diff --git a/modules/database/test/tools/Device.plt b/modules/database/test/tools/Device.plt index 7ef85e5ce..d06b6bf8a 100644 --- a/modules/database/test/tools/Device.plt +++ b/modules/database/test/tools/Device.plt @@ -13,17 +13,17 @@ is $dev->link_type, 'VME_IO', 'Link type'; is $dev->choice, 'Device', 'Choice string'; ok $dev->legal_addr('#C0xFEED S123 @xxx'), 'Address legal'; my %dev_addrs = ( - CONSTANT => '12345', - PV_LINK => 'Any:Record.NAME CPP.MS', - VME_IO => '# C1 S2 @Anything', - CAMAC_IO => '# B1 C2 N3 A4 F5 @Anything', - RF_IO => '# R1 M2 D3 E4', - AB_IO => '# L1 A2 C3 S4 @Anything', - GPIB_IO => '# L1 A2 @Anything', - BITBUS_IO => '# L1 N2 P3 S4 @Anything', - BBGPIB_IO => '# L1 B2 G3 @Anything', - VXI_IO => '# V1 C2 S3 @Anything', - INST_IO => '@Anything' + CONSTANT => '12345', + PV_LINK => 'Any:Record.NAME CPP.MS', + VME_IO => '# C1 S2 @Anything', + CAMAC_IO => '# B1 C2 N3 A4 F5 @Anything', + RF_IO => '# R1 M2 D3 E4', + AB_IO => '# L1 A2 C3 S4 @Anything', + GPIB_IO => '# L1 A2 @Anything', + BITBUS_IO => '# L1 N2 P3 S4 @Anything', + BBGPIB_IO => '# L1 B2 G3 @Anything', + VXI_IO => '# V1 C2 S3 @Anything', + INST_IO => '@Anything' ); while (my ($link, $addr) = each(%dev_addrs)) { $dev->init($link, 'test', 'Device'); diff --git a/modules/libcom/RTEMS/rtems_config.c b/modules/libcom/RTEMS/rtems_config.c index 796b1049b..be1098cc0 100644 --- a/modules/libcom/RTEMS/rtems_config.c +++ b/modules/libcom/RTEMS/rtems_config.c @@ -2,7 +2,7 @@ * Copyright (c) 2002 The University of Saskatchewan * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * RTEMS configuration for EPICS diff --git a/modules/libcom/RTEMS/rtems_netconfig.c b/modules/libcom/RTEMS/rtems_netconfig.c index d0c500c92..ed9fd15e4 100644 --- a/modules/libcom/RTEMS/rtems_netconfig.c +++ b/modules/libcom/RTEMS/rtems_netconfig.c @@ -1,7 +1,7 @@ /*************************************************************************\ * Copyright (c) 2002 The University of Saskatchewan * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * RTEMS network configuration for EPICS @@ -29,7 +29,7 @@ static struct rtems_bsdnet_ifconfig loopback_config = { * The following conditionals select the network interface card. * * On RTEMS-pc386 targets all network drivers which support run-time - * probing are linked. + * probing are linked. * On other targets the network interface specified by the board-support * package is used. * To use a different NIC for a particular application, copy this file to the diff --git a/modules/libcom/RTEMS/rtems_util.c b/modules/libcom/RTEMS/rtems_util.c index ca64f9650..e01e7bf15 100644 --- a/modules/libcom/RTEMS/rtems_util.c +++ b/modules/libcom/RTEMS/rtems_util.c @@ -2,7 +2,7 @@ * Copyright (c) 2002 The University of Saskatchewan * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * RTEMS utilitiy routines for EPICS @@ -24,7 +24,7 @@ * Like connect(), but with an explicit timeout */ int connectWithTimeout (int sfd, - struct sockaddr *addr, + struct sockaddr *addr, int addrlen, struct timeval *timeout) { diff --git a/modules/libcom/src/as/asLib.h b/modules/libcom/src/as/asLib.h index 652e9d56f..d9eb07b13 100644 --- a/modules/libcom/src/as/asLib.h +++ b/modules/libcom/src/as/asLib.h @@ -5,7 +5,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* Author: Marty Kraimer Date: 09-27-93*/ @@ -30,7 +30,7 @@ typedef struct asgMember *ASMEMBERPVT; typedef struct asgClient *ASCLIENTPVT; typedef int (*ASINPUTFUNCPTR)(char *buf,int max_size); typedef enum{ - asClientCOAR /*Change of access rights*/ + asClientCOAR /*Change of access rights*/ /*For now this is all*/ } asClientStatus; @@ -125,20 +125,20 @@ LIBCOM_API void * epicsStdCall asTrapWriteBeforeWithData( LIBCOM_API void epicsStdCall asTrapWriteAfterWrite(void *pvt); -#define S_asLib_clientsExist (M_asLib| 1) /*Client Exists*/ -#define S_asLib_noUag (M_asLib| 2) /*User Access Group does not exist*/ -#define S_asLib_noHag (M_asLib| 3) /*Host Access Group does not exist*/ -#define S_asLib_noAccess (M_asLib| 4) /*access security: no access allowed*/ -#define S_asLib_noModify (M_asLib| 5) /*access security: no modification allowed*/ -#define S_asLib_badConfig (M_asLib| 6) /*access security: bad configuration file*/ -#define S_asLib_badCalc (M_asLib| 7) /*access security: bad calculation espression*/ -#define S_asLib_dupAsg (M_asLib| 8) /*Duplicate Access Security Group */ -#define S_asLib_InitFailed (M_asLib| 9) /*access security: Init failed*/ -#define S_asLib_asNotActive (M_asLib|10) /*access security is not active*/ -#define S_asLib_badMember (M_asLib|11) /*access security: bad ASMEMBERPVT*/ -#define S_asLib_badClient (M_asLib|12) /*access security: bad ASCLIENTPVT*/ -#define S_asLib_badAsg (M_asLib|13) /*access security: bad ASG*/ -#define S_asLib_noMemory (M_asLib|14) /*access security: no Memory */ +#define S_asLib_clientsExist (M_asLib| 1) /*Client Exists*/ +#define S_asLib_noUag (M_asLib| 2) /*User Access Group does not exist*/ +#define S_asLib_noHag (M_asLib| 3) /*Host Access Group does not exist*/ +#define S_asLib_noAccess (M_asLib| 4) /*access security: no access allowed*/ +#define S_asLib_noModify (M_asLib| 5) /*access security: no modification allowed*/ +#define S_asLib_badConfig (M_asLib| 6) /*access security: bad configuration file*/ +#define S_asLib_badCalc (M_asLib| 7) /*access security: bad calculation espression*/ +#define S_asLib_dupAsg (M_asLib| 8) /*Duplicate Access Security Group */ +#define S_asLib_InitFailed (M_asLib| 9) /*access security: Init failed*/ +#define S_asLib_asNotActive (M_asLib|10) /*access security is not active*/ +#define S_asLib_badMember (M_asLib|11) /*access security: bad ASMEMBERPVT*/ +#define S_asLib_badClient (M_asLib|12) /*access security: bad ASCLIENTPVT*/ +#define S_asLib_badAsg (M_asLib|13) /*access security: bad ASG*/ +#define S_asLib_noMemory (M_asLib|14) /*access security: no Memory */ /*Private declarations */ LIBCOM_API extern int asActive; @@ -150,92 +150,92 @@ struct gphPvt; /*Base pointers for access security*/ typedef struct asBase{ - ELLLIST uagList; - ELLLIST hagList; - ELLLIST asgList; - struct gphPvt *phash; + ELLLIST uagList; + ELLLIST hagList; + ELLLIST asgList; + struct gphPvt *phash; } ASBASE; LIBCOM_API extern volatile ASBASE *pasbase; /*Defs for User Access Groups*/ typedef struct{ - ELLNODE node; - char *user; + ELLNODE node; + char *user; } UAGNAME; typedef struct uag{ - ELLNODE node; - char *name; - ELLLIST list; /*list of UAGNAME*/ + ELLNODE node; + char *name; + ELLLIST list; /*list of UAGNAME*/ } UAG; /*Defs for Host Access Groups*/ typedef struct{ - ELLNODE node; - char host[1]; + ELLNODE node; + char host[1]; } HAGNAME; typedef struct hag{ - ELLNODE node; - char *name; - ELLLIST list; /*list of HAGNAME*/ + ELLNODE node; + char *name; + ELLLIST list; /*list of HAGNAME*/ } HAG; /*Defs for Access SecurityGroups*/ typedef struct { - ELLNODE node; - UAG *puag; + ELLNODE node; + UAG *puag; }ASGUAG; typedef struct { - ELLNODE node; - HAG *phag; + ELLNODE node; + HAG *phag; }ASGHAG; #define AS_TRAP_WRITE 1 typedef struct{ - ELLNODE node; - asAccessRights access; - int level; - unsigned long inpUsed; /*bitmap of which inputs are used*/ - int result; /*Result of calc converted to TRUE/FALSE*/ - char *calc; - void *rpcl; - ELLLIST uagList; /*List of ASGUAG*/ - ELLLIST hagList; /*List of ASGHAG*/ - int trapMask; + ELLNODE node; + asAccessRights access; + int level; + unsigned long inpUsed; /*bitmap of which inputs are used*/ + int result; /*Result of calc converted to TRUE/FALSE*/ + char *calc; + void *rpcl; + ELLLIST uagList; /*List of ASGUAG*/ + ELLLIST hagList; /*List of ASGHAG*/ + int trapMask; } ASGRULE; typedef struct{ - ELLNODE node; - char *inp; - void *capvt; - struct asg *pasg; - int inpIndex; + ELLNODE node; + char *inp; + void *capvt; + struct asg *pasg; + int inpIndex; }ASGINP; typedef struct asg{ - ELLNODE node; - char *name; - ELLLIST inpList; - ELLLIST ruleList; - ELLLIST memberList; - double *pavalue; /*pointer to array of input values*/ - unsigned long inpBad; /*bitmap of which inputs are bad*/ - unsigned long inpChanged; /*bitmap of inputs that changed*/ + ELLNODE node; + char *name; + ELLLIST inpList; + ELLLIST ruleList; + ELLLIST memberList; + double *pavalue; /*pointer to array of input values*/ + unsigned long inpBad; /*bitmap of which inputs are bad*/ + unsigned long inpChanged; /*bitmap of inputs that changed*/ } ASG; typedef struct asgMember { - ELLNODE node; - ASG *pasg; - ELLLIST clientList; - const char *asgName; - void *userPvt; + ELLNODE node; + ASG *pasg; + ELLLIST clientList; + const char *asgName; + void *userPvt; } ASGMEMBER; typedef struct asgClient { - ELLNODE node; - ASGMEMBER *pasgMember; - const char *user; - char *host; - void *userPvt; - ASCLIENTCALLBACK pcallback; - int level; - asAccessRights access; - int trapMask; + ELLNODE node; + ASGMEMBER *pasgMember; + const char *user; + char *host; + void *userPvt; + ASCLIENTCALLBACK pcallback; + int level; + asAccessRights access; + int trapMask; } ASGCLIENT; LIBCOM_API long epicsStdCall asComputeAsg(ASG *pasg); diff --git a/modules/libcom/src/as/asLib.y b/modules/libcom/src/as/asLib.y index 55d48ebad..729893270 100644 --- a/modules/libcom/src/as/asLib.y +++ b/modules/libcom/src/as/asLib.y @@ -20,189 +20,189 @@ static ASGRULE *yyAsgRule=NULL; %start asconfig -%token tokenUAG tokenHAG tokenASG tokenRULE tokenCALC +%token tokenUAG tokenHAG tokenASG tokenRULE tokenCALC %token tokenINP %token tokenINTEGER %token tokenSTRING %union { - int Int; + int Int; char *Str; } %% -asconfig: asconfig asconfig_item - | asconfig_item +asconfig: asconfig asconfig_item + | asconfig_item -asconfig_item: tokenUAG uag_head uag_body - | tokenUAG uag_head - | tokenHAG hag_head hag_body - | tokenHAG hag_head - | tokenASG asg_head asg_body - | tokenASG asg_head - ; +asconfig_item: tokenUAG uag_head uag_body + | tokenUAG uag_head + | tokenHAG hag_head hag_body + | tokenHAG hag_head + | tokenASG asg_head asg_body + | tokenASG asg_head + ; -uag_head: '(' tokenSTRING ')' - { - yyUag = asUagAdd($2); - if(!yyUag) yyerror(""); - free((void *)$2); - } - ; +uag_head: '(' tokenSTRING ')' + { + yyUag = asUagAdd($2); + if(!yyUag) yyerror(""); + free((void *)$2); + } + ; -uag_body: '{' uag_user_list '}' - { - ; - } - ; +uag_body: '{' uag_user_list '}' + { + ; + } + ; -uag_user_list: uag_user_list ',' uag_user_list_name - | uag_user_list_name - ; +uag_user_list: uag_user_list ',' uag_user_list_name + | uag_user_list_name + ; -uag_user_list_name: tokenSTRING - { - if (asUagAddUser(yyUag,$1)) - yyerror(""); - free((void *)$1); - } - ; +uag_user_list_name: tokenSTRING + { + if (asUagAddUser(yyUag,$1)) + yyerror(""); + free((void *)$1); + } + ; -hag_head: '(' tokenSTRING ')' - { - yyHag = asHagAdd($2); - if(!yyHag) yyerror(""); - free((void *)$2); - } - ; +hag_head: '(' tokenSTRING ')' + { + yyHag = asHagAdd($2); + if(!yyHag) yyerror(""); + free((void *)$2); + } + ; -hag_body: '{' hag_host_list '}' - ; +hag_body: '{' hag_host_list '}' + ; -hag_host_list: hag_host_list ',' hag_host_list_name - | hag_host_list_name - ; +hag_host_list: hag_host_list ',' hag_host_list_name + | hag_host_list_name + ; -hag_host_list_name: tokenSTRING - { - if (asHagAddHost(yyHag,$1)) - yyerror(""); - free((void *)$1); - } - ; +hag_host_list_name: tokenSTRING + { + if (asHagAddHost(yyHag,$1)) + yyerror(""); + free((void *)$1); + } + ; -asg_head: '(' tokenSTRING ')' - { - yyAsg = asAsgAdd($2); - if(!yyAsg) yyerror(""); - free((void *)$2); - } - ; +asg_head: '(' tokenSTRING ')' + { + yyAsg = asAsgAdd($2); + if(!yyAsg) yyerror(""); + free((void *)$2); + } + ; -asg_body: '{' asg_body_list '}' - { - } +asg_body: '{' asg_body_list '}' + { + } -asg_body_list: asg_body_list asg_body_item - | asg_body_item +asg_body_list: asg_body_list asg_body_item + | asg_body_item -asg_body_item: inp_config | rule_config - ; +asg_body_item: inp_config | rule_config + ; -inp_config: tokenINP '(' tokenSTRING ')' - { - if (asAsgAddInp(yyAsg,$3,$1)) - yyerror(""); - free((void *)$3); - } - ; +inp_config: tokenINP '(' tokenSTRING ')' + { + if (asAsgAddInp(yyAsg,$3,$1)) + yyerror(""); + free((void *)$3); + } + ; -rule_config: tokenRULE rule_head rule_body - | tokenRULE rule_head +rule_config: tokenRULE rule_head rule_body + | tokenRULE rule_head rule_head: rule_head_manditory rule_head_options -rule_head_manditory: '(' tokenINTEGER ',' tokenSTRING - { - asAccessRights rights; +rule_head_manditory: '(' tokenINTEGER ',' tokenSTRING + { + asAccessRights rights; - if((strcmp($4,"NONE")==0)) { - rights=asNOACCESS; - } else if((strcmp($4,"READ")==0)) { - rights=asREAD; - } else if((strcmp($4,"WRITE")==0)) { - rights=asWRITE; - } else { - yyerror("Access rights must be NONE, READ or WRITE"); - rights = asNOACCESS; - } - yyAsgRule = asAsgAddRule(yyAsg,rights,$2); - free((void *)$4); - } - ; + if((strcmp($4,"NONE")==0)) { + rights=asNOACCESS; + } else if((strcmp($4,"READ")==0)) { + rights=asREAD; + } else if((strcmp($4,"WRITE")==0)) { + rights=asWRITE; + } else { + yyerror("Access rights must be NONE, READ or WRITE"); + rights = asNOACCESS; + } + yyAsgRule = asAsgAddRule(yyAsg,rights,$2); + free((void *)$4); + } + ; rule_head_options: ')' | rule_log_options rule_log_options: ',' tokenSTRING ')' - { - if((strcmp($2,"TRAPWRITE")==0)) { - long status; - status = asAsgAddRuleOptions(yyAsgRule,AS_TRAP_WRITE); - if(status) yyerror(""); - } else if((strcmp($2,"NOTRAPWRITE")!=0)) { - yyerror("Log options must be TRAPWRITE or NOTRAPWRITE"); - } - free((void *)$2); + { + if((strcmp($2,"TRAPWRITE")==0)) { + long status; + status = asAsgAddRuleOptions(yyAsgRule,AS_TRAP_WRITE); + if(status) yyerror(""); + } else if((strcmp($2,"NOTRAPWRITE")!=0)) { + yyerror("Log options must be TRAPWRITE or NOTRAPWRITE"); } - ; + free((void *)$2); + } + ; -rule_body: '{' rule_list '}' - ; +rule_body: '{' rule_list '}' + ; -rule_list: rule_list rule_list_item - | rule_list_item - ; +rule_list: rule_list rule_list_item + | rule_list_item + ; rule_list_item: tokenUAG '(' rule_uag_list ')' - | tokenHAG '(' rule_hag_list ')' - | tokenCALC '(' tokenSTRING ')' - { - if (asAsgRuleCalc(yyAsgRule,$3)) - yyerror(""); - free((void *)$3); - } - ; + | tokenHAG '(' rule_hag_list ')' + | tokenCALC '(' tokenSTRING ')' + { + if (asAsgRuleCalc(yyAsgRule,$3)) + yyerror(""); + free((void *)$3); + } + ; -rule_uag_list: rule_uag_list ',' rule_uag_list_name - | rule_uag_list_name - ; +rule_uag_list: rule_uag_list ',' rule_uag_list_name + | rule_uag_list_name + ; -rule_uag_list_name: tokenSTRING - { - if (asAsgRuleUagAdd(yyAsgRule,$1)) - yyerror(""); - free((void *)$1); - } - ; +rule_uag_list_name: tokenSTRING + { + if (asAsgRuleUagAdd(yyAsgRule,$1)) + yyerror(""); + free((void *)$1); + } + ; -rule_hag_list: rule_hag_list ',' rule_hag_list_name - | rule_hag_list_name - ; +rule_hag_list: rule_hag_list ',' rule_hag_list_name + | rule_hag_list_name + ; -rule_hag_list_name: tokenSTRING - { - if (asAsgRuleHagAdd(yyAsgRule,$1)) - yyerror(""); - free((void *)$1); - } - ; +rule_hag_list_name: tokenSTRING + { + if (asAsgRuleHagAdd(yyAsgRule,$1)) + yyerror(""); + free((void *)$1); + } + ; %% - + #include "asLib_lex.c" - + static int yyerror(char *str) { if (strlen(str)) @@ -214,15 +214,15 @@ static int yyerror(char *str) } static int myParse(ASINPUTFUNCPTR inputfunction) { - static int FirstFlag = 1; - int rtnval; - + static int FirstFlag = 1; + int rtnval; + my_yyinput = &inputfunction; if (!FirstFlag) { - line_num=1; - yyFailed = FALSE; - yyreset(); - yyrestart(NULL); + line_num=1; + yyFailed = FALSE; + yyreset(); + yyrestart(NULL); } FirstFlag = 0; rtnval = yyparse(); diff --git a/modules/libcom/src/as/asLibRoutines.c b/modules/libcom/src/as/asLibRoutines.c index 1d9f80cb1..9e74c4b18 100644 --- a/modules/libcom/src/as/asLibRoutines.c +++ b/modules/libcom/src/as/asLibRoutines.c @@ -83,14 +83,14 @@ static void asInitializeOnce(void *arg) } long epicsStdCall asInitialize(ASINPUTFUNCPTR inputfunction) { - ASG *pasg; - long status; - ASBASE *pasbaseold; - GPHENTRY *pgphentry; - UAG *puag; - UAGNAME *puagname; - HAG *phag; - HAGNAME *phagname; + ASG *pasg; + long status; + ASBASE *pasbaseold; + GPHENTRY *pgphentry; + UAG *puag; + UAGNAME *puagname; + HAG *phag; + HAGNAME *phagname; static epicsThreadOnceId asInitializeOnceFlag = EPICS_THREAD_ONCE_INIT; epicsThreadOnce(&asInitializeOnceFlag,asInitializeOnce,(void *)0); @@ -103,63 +103,63 @@ long epicsStdCall asInitialize(ASINPUTFUNCPTR inputfunction) asAsgAdd(DEFAULT); status = myParse(inputfunction); if(status) { - status = S_asLib_badConfig; - /*Not safe to call asFreeAll */ - UNLOCK; - return(status); + status = S_asLib_badConfig; + /*Not safe to call asFreeAll */ + UNLOCK; + return(status); } pasg = (ASG *)ellFirst(&pasbasenew->asgList); while(pasg) { - pasg->pavalue = asCalloc(CALCPERFORM_NARGS, sizeof(double)); - pasg = (ASG *)ellNext(&pasg->node); + pasg->pavalue = asCalloc(CALCPERFORM_NARGS, sizeof(double)); + pasg = (ASG *)ellNext(&pasg->node); } gphInitPvt(&pasbasenew->phash, 256); /*Hash each uagname and each hagname*/ puag = (UAG *)ellFirst(&pasbasenew->uagList); while(puag) { - puagname = (UAGNAME *)ellFirst(&puag->list); - while(puagname) { - pgphentry = gphAdd(pasbasenew->phash,puagname->user,puag); - if(!pgphentry) { - errlogPrintf("Duplicated user '%s' in UAG '%s'\n", - puagname->user, puag->name); - } - puagname = (UAGNAME *)ellNext(&puagname->node); - } - puag = (UAG *)ellNext(&puag->node); + puagname = (UAGNAME *)ellFirst(&puag->list); + while(puagname) { + pgphentry = gphAdd(pasbasenew->phash,puagname->user,puag); + if(!pgphentry) { + errlogPrintf("Duplicated user '%s' in UAG '%s'\n", + puagname->user, puag->name); + } + puagname = (UAGNAME *)ellNext(&puagname->node); + } + puag = (UAG *)ellNext(&puag->node); } phag = (HAG *)ellFirst(&pasbasenew->hagList); while(phag) { - phagname = (HAGNAME *)ellFirst(&phag->list); - while(phagname) { - pgphentry = gphAdd(pasbasenew->phash,phagname->host,phag); - if(!pgphentry) { - errlogPrintf("Duplicated host '%s' in HAG '%s'\n", - phagname->host, phag->name); - } - phagname = (HAGNAME *)ellNext(&phagname->node); - } - phag = (HAG *)ellNext(&phag->node); + phagname = (HAGNAME *)ellFirst(&phag->list); + while(phagname) { + pgphentry = gphAdd(pasbasenew->phash,phagname->host,phag); + if(!pgphentry) { + errlogPrintf("Duplicated host '%s' in HAG '%s'\n", + phagname->host, phag->name); + } + phagname = (HAGNAME *)ellNext(&phagname->node); + } + phag = (HAG *)ellNext(&phag->node); } pasbaseold = (ASBASE *)pasbase; pasbase = (ASBASE volatile *)pasbasenew; if(pasbaseold) { - ASG *poldasg; - ASGMEMBER *poldmem; - ASGMEMBER *pnextoldmem; + ASG *poldasg; + ASGMEMBER *poldmem; + ASGMEMBER *pnextoldmem; - poldasg = (ASG *)ellFirst(&pasbaseold->asgList); - while(poldasg) { - poldmem = (ASGMEMBER *)ellFirst(&poldasg->memberList); - while(poldmem) { - pnextoldmem = (ASGMEMBER *)ellNext(&poldmem->node); - ellDelete(&poldasg->memberList,&poldmem->node); - status = asAddMemberPvt(&poldmem,poldmem->asgName); - poldmem = pnextoldmem; - } - poldasg = (ASG *)ellNext(&poldasg->node); - } - asFreeAll(pasbaseold); + poldasg = (ASG *)ellFirst(&pasbaseold->asgList); + while(poldasg) { + poldmem = (ASGMEMBER *)ellFirst(&poldasg->memberList); + while(poldmem) { + pnextoldmem = (ASGMEMBER *)ellNext(&poldmem->node); + ellDelete(&poldasg->memberList,&poldmem->node); + status = asAddMemberPvt(&poldmem,poldmem->asgName); + poldmem = pnextoldmem; + } + poldasg = (ASG *)ellNext(&poldasg->node); + } + asFreeAll(pasbaseold); } asActive = TRUE; UNLOCK; @@ -173,13 +173,13 @@ long epicsStdCall asInitFile(const char *filename,const char *substitutions) fp = fopen(filename,"r"); if(!fp) { - errlogPrintf("asInitFile: Can't open file '%s'\n", filename); - return(S_asLib_badConfig); + errlogPrintf("asInitFile: Can't open file '%s'\n", filename); + return(S_asLib_badConfig); } status = asInitFP(fp,substitutions); if(fclose(fp)==EOF) { - errMessage(0,"asInitFile: fclose failed!"); - if(!status) status = S_asLib_badConfig; + errMessage(0,"asInitFile: fclose failed!"); + if(!status) status = S_asLib_badConfig; } return(status); } @@ -193,26 +193,26 @@ static MAC_HANDLE *macHandle = NULL; static int myInputFunction(char *buf, int max_size) { - int l,n; + int l,n; char *fgetsRtn; - + if(*my_buffer_ptr==0) { - if(macHandle) { - fgetsRtn = fgets(mac_input_buffer,BUF_SIZE,stream); - if(fgetsRtn) { - n = macExpandString(macHandle,mac_input_buffer, - my_buffer,BUF_SIZE); - if(n<0) { - errlogPrintf("access security: macExpandString failed\n" - "input line: %s\n",mac_input_buffer); - return(0); - } - } - } else { - fgetsRtn = fgets(my_buffer,BUF_SIZE,stream); - } - if(fgetsRtn==NULL) return(0); - my_buffer_ptr = my_buffer; + if(macHandle) { + fgetsRtn = fgets(mac_input_buffer,BUF_SIZE,stream); + if(fgetsRtn) { + n = macExpandString(macHandle,mac_input_buffer, + my_buffer,BUF_SIZE); + if(n<0) { + errlogPrintf("access security: macExpandString failed\n" + "input line: %s\n",mac_input_buffer); + return(0); + } + } + } else { + fgetsRtn = fgets(my_buffer,BUF_SIZE,stream); + } + if(fgetsRtn==NULL) return(0); + my_buffer_ptr = my_buffer; } l = strlen(my_buffer_ptr); n = (l<=max_size ? l : max_size); @@ -223,34 +223,34 @@ static int myInputFunction(char *buf, int max_size) long epicsStdCall asInitFP(FILE *fp,const char *substitutions) { - char buffer[BUF_SIZE]; - char mac_buffer[BUF_SIZE]; - long status; - char **macPairs; + char buffer[BUF_SIZE]; + char mac_buffer[BUF_SIZE]; + long status; + char **macPairs; buffer[0] = 0; my_buffer = buffer; my_buffer_ptr = my_buffer; stream = fp; if(substitutions) { - if((status = macCreateHandle(&macHandle,NULL))) { - errMessage(status,"asInitFP: macCreateHandle error"); - return(status); - } - macParseDefns(macHandle,substitutions,&macPairs); - if(macPairs ==NULL) { - macDeleteHandle(macHandle); - macHandle = NULL; - } else { - macInstallMacros(macHandle,macPairs); - free(macPairs); - mac_input_buffer = mac_buffer; - } + if((status = macCreateHandle(&macHandle,NULL))) { + errMessage(status,"asInitFP: macCreateHandle error"); + return(status); + } + macParseDefns(macHandle,substitutions,&macPairs); + if(macPairs ==NULL) { + macDeleteHandle(macHandle); + macHandle = NULL; + } else { + macInstallMacros(macHandle,macPairs); + free(macPairs); + mac_input_buffer = mac_buffer; + } } - status = asInitialize(myInputFunction); + status = asInitialize(myInputFunction); if(macHandle) { - macDeleteHandle(macHandle); - macHandle = NULL; + macDeleteHandle(macHandle); + macHandle = NULL; } return(status); } @@ -285,7 +285,7 @@ long epicsStdCall asInitMem(const char *acf, const char *substitutions) long epicsStdCall asAddMember(ASMEMBERPVT *pasMemberPvt,const char *asgName) { - long status; + long status; if(!asActive) return(S_asLib_asNotActive); LOCK; @@ -296,7 +296,7 @@ long epicsStdCall asAddMember(ASMEMBERPVT *pasMemberPvt,const char *asgName) long epicsStdCall asRemoveMember(ASMEMBERPVT *asMemberPvt) { - ASGMEMBER *pasgmember; + ASGMEMBER *pasgmember; if(!asActive) return(S_asLib_asNotActive); pasgmember = *asMemberPvt; @@ -307,11 +307,11 @@ long epicsStdCall asRemoveMember(ASMEMBERPVT *asMemberPvt) return(S_asLib_clientsExist); } if(pasgmember->pasg) { - ellDelete(&pasgmember->pasg->memberList,&pasgmember->node); + ellDelete(&pasgmember->pasg->memberList,&pasgmember->node); } else { - errMessage(-1,"Logic error in asRemoveMember"); - UNLOCK; - return(-1); + errMessage(-1,"Logic error in asRemoveMember"); + UNLOCK; + return(-1); } free(pasgmember); *asMemberPvt = NULL; @@ -321,19 +321,19 @@ long epicsStdCall asRemoveMember(ASMEMBERPVT *asMemberPvt) long epicsStdCall asChangeGroup(ASMEMBERPVT *asMemberPvt,const char *newAsgName) { - ASGMEMBER *pasgmember; - long status; + ASGMEMBER *pasgmember; + long status; if(!asActive) return(S_asLib_asNotActive); pasgmember = *asMemberPvt; if(!pasgmember) return(S_asLib_badMember); LOCK; if(pasgmember->pasg) { - ellDelete(&pasgmember->pasg->memberList,&pasgmember->node); + ellDelete(&pasgmember->pasg->memberList,&pasgmember->node); } else { - errMessage(-1,"Logic error in asChangeGroup"); - UNLOCK; - return(-1); + errMessage(-1,"Logic error in asChangeGroup"); + UNLOCK; + return(-1); } status = asAddMemberPvt(asMemberPvt,newAsgName); UNLOCK; @@ -342,7 +342,7 @@ long epicsStdCall asChangeGroup(ASMEMBERPVT *asMemberPvt,const char *newAsgName) void * epicsStdCall asGetMemberPvt(ASMEMBERPVT asMemberPvt) { - ASGMEMBER *pasgmember = asMemberPvt; + ASGMEMBER *pasgmember = asMemberPvt; if(!asActive) return(NULL); if(!pasgmember) return(NULL); @@ -351,7 +351,7 @@ void * epicsStdCall asGetMemberPvt(ASMEMBERPVT asMemberPvt) void epicsStdCall asPutMemberPvt(ASMEMBERPVT asMemberPvt,void *userPvt) { - ASGMEMBER *pasgmember = asMemberPvt; + ASGMEMBER *pasgmember = asMemberPvt; if(!asActive) return; if(!pasgmember) return; @@ -360,13 +360,13 @@ void epicsStdCall asPutMemberPvt(ASMEMBERPVT asMemberPvt,void *userPvt) } long epicsStdCall asAddClient(ASCLIENTPVT *pasClientPvt,ASMEMBERPVT asMemberPvt, - int asl,const char *user,char *host) + int asl,const char *user,char *host) { - ASGMEMBER *pasgmember = asMemberPvt; - ASGCLIENT *pasgclient; - int len, i; + ASGMEMBER *pasgmember = asMemberPvt; + ASGCLIENT *pasgclient; + int len, i; - long status; + long status; if(!asActive) return(S_asLib_asNotActive); if(!pasgmember) return(S_asLib_badMember); pasgclient = freeListCalloc(freeListPvt); @@ -390,9 +390,9 @@ long epicsStdCall asAddClient(ASCLIENTPVT *pasClientPvt,ASMEMBERPVT asMemberPvt, long epicsStdCall asChangeClient( ASCLIENTPVT asClientPvt,int asl,const char *user,char *host) { - ASGCLIENT *pasgclient = asClientPvt; - long status; - int len, i; + ASGCLIENT *pasgclient = asClientPvt; + long status; + int len, i; if(!asActive) return(S_asLib_asNotActive); if(!pasgclient) return(S_asLib_badClient); @@ -411,17 +411,17 @@ long epicsStdCall asChangeClient( long epicsStdCall asRemoveClient(ASCLIENTPVT *asClientPvt) { - ASGCLIENT *pasgclient = *asClientPvt; - ASGMEMBER *pasgMember; + ASGCLIENT *pasgclient = *asClientPvt; + ASGMEMBER *pasgMember; if(!asActive) return(S_asLib_asNotActive); if(!pasgclient) return(S_asLib_badClient); LOCK; pasgMember = pasgclient->pasgMember; if(!pasgMember) { - errMessage(-1,"asRemoveClient: No ASGMEMBER"); - UNLOCK; - return(-1); + errMessage(-1,"asRemoveClient: No ASGMEMBER"); + UNLOCK; + return(-1); } ellDelete(&pasgMember->clientList,&pasgclient->node); UNLOCK; @@ -431,9 +431,9 @@ long epicsStdCall asRemoveClient(ASCLIENTPVT *asClientPvt) } long epicsStdCall asRegisterClientCallback(ASCLIENTPVT asClientPvt, - ASCLIENTCALLBACK pcallback) + ASCLIENTCALLBACK pcallback) { - ASGCLIENT *pasgclient = asClientPvt; + ASGCLIENT *pasgclient = asClientPvt; if(!asActive) return(S_asLib_asNotActive); if(!pasgclient) return(S_asLib_badClient); @@ -446,7 +446,7 @@ long epicsStdCall asRegisterClientCallback(ASCLIENTPVT asClientPvt, void * epicsStdCall asGetClientPvt(ASCLIENTPVT asClientPvt) { - ASGCLIENT *pasgclient = asClientPvt; + ASGCLIENT *pasgclient = asClientPvt; if(!asActive) return(NULL); if(!pasgclient) return(NULL); @@ -455,7 +455,7 @@ void * epicsStdCall asGetClientPvt(ASCLIENTPVT asClientPvt) void epicsStdCall asPutClientPvt(ASCLIENTPVT asClientPvt,void *userPvt) { - ASGCLIENT *pasgclient = asClientPvt; + ASGCLIENT *pasgclient = asClientPvt; if(!asActive) return; if(!pasgclient) return; LOCK; @@ -502,154 +502,154 @@ static const char *asAccessName[] = {"NONE","READ","WRITE"}; static const char *asTrapOption[] = {"NOTRAPWRITE","TRAPWRITE"}; static const char *asLevelName[] = {"ASL0","ASL1"}; int epicsStdCall asDump( - void (*memcallback)(struct asgMember *,FILE *), - void (*clientcallback)(struct asgClient *,FILE *), - int verbose) + void (*memcallback)(struct asgMember *,FILE *), + void (*clientcallback)(struct asgClient *,FILE *), + int verbose) { return asDumpFP(stdout,memcallback,clientcallback,verbose); } int epicsStdCall asDumpFP( - FILE *fp, - void (*memcallback)(struct asgMember *,FILE *), - void (*clientcallback)(struct asgClient *,FILE *), - int verbose) + FILE *fp, + void (*memcallback)(struct asgMember *,FILE *), + void (*clientcallback)(struct asgClient *,FILE *), + int verbose) { - UAG *puag; - UAGNAME *puagname; - HAG *phag; - HAGNAME *phagname; - ASG *pasg; - ASGINP *pasginp; - ASGRULE *pasgrule; - ASGHAG *pasghag; - ASGUAG *pasguag; - ASGMEMBER *pasgmember; - ASGCLIENT *pasgclient; + UAG *puag; + UAGNAME *puagname; + HAG *phag; + HAGNAME *phagname; + ASG *pasg; + ASGINP *pasginp; + ASGRULE *pasgrule; + ASGHAG *pasghag; + ASGUAG *pasguag; + ASGMEMBER *pasgmember; + ASGCLIENT *pasgclient; if(!asActive) return(0); puag = (UAG *)ellFirst(&pasbase->uagList); if(!puag) fprintf(fp,"No UAGs\n"); while(puag) { - fprintf(fp,"UAG(%s)",puag->name); - puagname = (UAGNAME *)ellFirst(&puag->list); - if(puagname) fprintf(fp," {"); else fprintf(fp,"\n"); - while(puagname) { - fprintf(fp,"%s",puagname->user); - puagname = (UAGNAME *)ellNext(&puagname->node); - if(puagname) fprintf(fp,","); else fprintf(fp,"}\n"); - } - puag = (UAG *)ellNext(&puag->node); + fprintf(fp,"UAG(%s)",puag->name); + puagname = (UAGNAME *)ellFirst(&puag->list); + if(puagname) fprintf(fp," {"); else fprintf(fp,"\n"); + while(puagname) { + fprintf(fp,"%s",puagname->user); + puagname = (UAGNAME *)ellNext(&puagname->node); + if(puagname) fprintf(fp,","); else fprintf(fp,"}\n"); + } + puag = (UAG *)ellNext(&puag->node); } phag = (HAG *)ellFirst(&pasbase->hagList); if(!phag) fprintf(fp,"No HAGs\n"); while(phag) { - fprintf(fp,"HAG(%s)",phag->name); - phagname = (HAGNAME *)ellFirst(&phag->list); - if(phagname) fprintf(fp," {"); else fprintf(fp,"\n"); - while(phagname) { - fprintf(fp,"%s",phagname->host); - phagname = (HAGNAME *)ellNext(&phagname->node); - if(phagname) fprintf(fp,","); else fprintf(fp,"}\n"); - } - phag = (HAG *)ellNext(&phag->node); + fprintf(fp,"HAG(%s)",phag->name); + phagname = (HAGNAME *)ellFirst(&phag->list); + if(phagname) fprintf(fp," {"); else fprintf(fp,"\n"); + while(phagname) { + fprintf(fp,"%s",phagname->host); + phagname = (HAGNAME *)ellNext(&phagname->node); + if(phagname) fprintf(fp,","); else fprintf(fp,"}\n"); + } + phag = (HAG *)ellNext(&phag->node); } pasg = (ASG *)ellFirst(&pasbase->asgList); if(!pasg) fprintf(fp,"No ASGs\n"); while(pasg) { - int print_end_brace; + int print_end_brace; - fprintf(fp,"ASG(%s)",pasg->name); - pasginp = (ASGINP *)ellFirst(&pasg->inpList); - pasgrule = (ASGRULE *)ellFirst(&pasg->ruleList); - if(pasginp || pasgrule) { - fprintf(fp," {\n"); - print_end_brace = TRUE; - } else { - fprintf(fp,"\n"); - print_end_brace = FALSE; - } - while(pasginp) { + fprintf(fp,"ASG(%s)",pasg->name); + pasginp = (ASGINP *)ellFirst(&pasg->inpList); + pasgrule = (ASGRULE *)ellFirst(&pasg->ruleList); + if(pasginp || pasgrule) { + fprintf(fp," {\n"); + print_end_brace = TRUE; + } else { + fprintf(fp,"\n"); + print_end_brace = FALSE; + } + while(pasginp) { - fprintf(fp,"\tINP%c(%s)",(pasginp->inpIndex + 'A'),pasginp->inp); - if(verbose) { - if((pasg->inpBad & (1ul << pasginp->inpIndex))) - fprintf(fp," INVALID"); - else - fprintf(fp," VALID"); - fprintf(fp," value=%f",pasg->pavalue[pasginp->inpIndex]); - } - fprintf(fp,"\n"); - pasginp = (ASGINP *)ellNext(&pasginp->node); - } - while(pasgrule) { - int print_end_brace; + fprintf(fp,"\tINP%c(%s)",(pasginp->inpIndex + 'A'),pasginp->inp); + if(verbose) { + if((pasg->inpBad & (1ul << pasginp->inpIndex))) + fprintf(fp," INVALID"); + else + fprintf(fp," VALID"); + fprintf(fp," value=%f",pasg->pavalue[pasginp->inpIndex]); + } + fprintf(fp,"\n"); + pasginp = (ASGINP *)ellNext(&pasginp->node); + } + while(pasgrule) { + int print_end_brace; - fprintf(fp,"\tRULE(%d,%s,%s)", - pasgrule->level,asAccessName[pasgrule->access], + fprintf(fp,"\tRULE(%d,%s,%s)", + pasgrule->level,asAccessName[pasgrule->access], asTrapOption[pasgrule->trapMask]); - pasguag = (ASGUAG *)ellFirst(&pasgrule->uagList); - pasghag = (ASGHAG *)ellFirst(&pasgrule->hagList); - if(pasguag || pasghag || pasgrule->calc) { - fprintf(fp," {\n"); - print_end_brace = TRUE; - } else { - fprintf(fp,"\n"); - print_end_brace = FALSE; - } - if(pasguag) fprintf(fp,"\t\tUAG("); - while(pasguag) { - fprintf(fp,"%s",pasguag->puag->name); - pasguag = (ASGUAG *)ellNext(&pasguag->node); - if(pasguag) fprintf(fp,","); else fprintf(fp,")\n"); - } - pasghag = (ASGHAG *)ellFirst(&pasgrule->hagList); - if(pasghag) fprintf(fp,"\t\tHAG("); - while(pasghag) { - fprintf(fp,"%s",pasghag->phag->name); - pasghag = (ASGHAG *)ellNext(&pasghag->node); - if(pasghag) fprintf(fp,","); else fprintf(fp,")\n"); - } - if(pasgrule->calc) { - fprintf(fp,"\t\tCALC(\"%s\")",pasgrule->calc); - if(verbose) - fprintf(fp," result=%s",(pasgrule->result==1 ? "TRUE" : "FALSE")); - fprintf(fp,"\n"); - } - if(print_end_brace) fprintf(fp,"\t}\n"); - pasgrule = (ASGRULE *)ellNext(&pasgrule->node); - } - pasgmember = (ASGMEMBER *)ellFirst(&pasg->memberList); - if(!verbose) pasgmember = NULL; - if(pasgmember) fprintf(fp,"\tMEMBERLIST\n"); - while(pasgmember) { - if(strlen(pasgmember->asgName)==0) - fprintf(fp,"\t\t"); - else - fprintf(fp,"\t\t%s",pasgmember->asgName); - if(memcallback) memcallback(pasgmember,fp); - fprintf(fp,"\n"); - pasgclient = (ASGCLIENT *)ellFirst(&pasgmember->clientList); - while(pasgclient) { - fprintf(fp,"\t\t\t %s %s",pasgclient->user,pasgclient->host); - if(pasgclient->level>=0 && pasgclient->level<=1) - fprintf(fp," %s",asLevelName[pasgclient->level]); - else - fprintf(fp," Illegal Level %d",pasgclient->level); - if(pasgclient->access<=2) - fprintf(fp," %s %s", + pasguag = (ASGUAG *)ellFirst(&pasgrule->uagList); + pasghag = (ASGHAG *)ellFirst(&pasgrule->hagList); + if(pasguag || pasghag || pasgrule->calc) { + fprintf(fp," {\n"); + print_end_brace = TRUE; + } else { + fprintf(fp,"\n"); + print_end_brace = FALSE; + } + if(pasguag) fprintf(fp,"\t\tUAG("); + while(pasguag) { + fprintf(fp,"%s",pasguag->puag->name); + pasguag = (ASGUAG *)ellNext(&pasguag->node); + if(pasguag) fprintf(fp,","); else fprintf(fp,")\n"); + } + pasghag = (ASGHAG *)ellFirst(&pasgrule->hagList); + if(pasghag) fprintf(fp,"\t\tHAG("); + while(pasghag) { + fprintf(fp,"%s",pasghag->phag->name); + pasghag = (ASGHAG *)ellNext(&pasghag->node); + if(pasghag) fprintf(fp,","); else fprintf(fp,")\n"); + } + if(pasgrule->calc) { + fprintf(fp,"\t\tCALC(\"%s\")",pasgrule->calc); + if(verbose) + fprintf(fp," result=%s",(pasgrule->result==1 ? "TRUE" : "FALSE")); + fprintf(fp,"\n"); + } + if(print_end_brace) fprintf(fp,"\t}\n"); + pasgrule = (ASGRULE *)ellNext(&pasgrule->node); + } + pasgmember = (ASGMEMBER *)ellFirst(&pasg->memberList); + if(!verbose) pasgmember = NULL; + if(pasgmember) fprintf(fp,"\tMEMBERLIST\n"); + while(pasgmember) { + if(strlen(pasgmember->asgName)==0) + fprintf(fp,"\t\t"); + else + fprintf(fp,"\t\t%s",pasgmember->asgName); + if(memcallback) memcallback(pasgmember,fp); + fprintf(fp,"\n"); + pasgclient = (ASGCLIENT *)ellFirst(&pasgmember->clientList); + while(pasgclient) { + fprintf(fp,"\t\t\t %s %s",pasgclient->user,pasgclient->host); + if(pasgclient->level>=0 && pasgclient->level<=1) + fprintf(fp," %s",asLevelName[pasgclient->level]); + else + fprintf(fp," Illegal Level %d",pasgclient->level); + if(pasgclient->access<=2) + fprintf(fp," %s %s", asAccessName[pasgclient->access], asTrapOption[pasgclient->trapMask]); - else - fprintf(fp," Illegal Access %d",pasgclient->access); - if(clientcallback) clientcallback(pasgclient,fp); - fprintf(fp,"\n"); - pasgclient = (ASGCLIENT *)ellNext(&pasgclient->node); - } - pasgmember = (ASGMEMBER *)ellNext(&pasgmember->node); - } - if(print_end_brace) fprintf(fp,"}\n"); - pasg = (ASG *)ellNext(&pasg->node); + else + fprintf(fp," Illegal Access %d",pasgclient->access); + if(clientcallback) clientcallback(pasgclient,fp); + fprintf(fp,"\n"); + pasgclient = (ASGCLIENT *)ellNext(&pasgclient->node); + } + pasgmember = (ASGMEMBER *)ellNext(&pasgmember->node); + } + if(print_end_brace) fprintf(fp,"}\n"); + pasg = (ASG *)ellNext(&pasg->node); } return(0); } @@ -661,26 +661,26 @@ int epicsStdCall asDumpUag(const char *uagname) int epicsStdCall asDumpUagFP(FILE *fp,const char *uagname) { - UAG *puag; - UAGNAME *puagname; + UAG *puag; + UAGNAME *puagname; if(!asActive) return(0); puag = (UAG *)ellFirst(&pasbase->uagList); if(!puag) fprintf(fp,"No UAGs\n"); while(puag) { - if(uagname && strcmp(uagname,puag->name)!=0) { - puag = (UAG *)ellNext(&puag->node); - continue; - } - fprintf(fp,"UAG(%s)",puag->name); - puagname = (UAGNAME *)ellFirst(&puag->list); - if(puagname) fprintf(fp," {"); else fprintf(fp,"\n"); - while(puagname) { - fprintf(fp,"%s",puagname->user); - puagname = (UAGNAME *)ellNext(&puagname->node); - if(puagname) fprintf(fp,","); else fprintf(fp,"}\n"); - } - puag = (UAG *)ellNext(&puag->node); + if(uagname && strcmp(uagname,puag->name)!=0) { + puag = (UAG *)ellNext(&puag->node); + continue; + } + fprintf(fp,"UAG(%s)",puag->name); + puagname = (UAGNAME *)ellFirst(&puag->list); + if(puagname) fprintf(fp," {"); else fprintf(fp,"\n"); + while(puagname) { + fprintf(fp,"%s",puagname->user); + puagname = (UAGNAME *)ellNext(&puagname->node); + if(puagname) fprintf(fp,","); else fprintf(fp,"}\n"); + } + puag = (UAG *)ellNext(&puag->node); } return(0); } @@ -692,26 +692,26 @@ int epicsStdCall asDumpHag(const char *hagname) int epicsStdCall asDumpHagFP(FILE *fp,const char *hagname) { - HAG *phag; - HAGNAME *phagname; + HAG *phag; + HAGNAME *phagname; if(!asActive) return(0); phag = (HAG *)ellFirst(&pasbase->hagList); if(!phag) fprintf(fp,"No HAGs\n"); while(phag) { - if(hagname && strcmp(hagname,phag->name)!=0) { - phag = (HAG *)ellNext(&phag->node); - continue; - } - fprintf(fp,"HAG(%s)",phag->name); - phagname = (HAGNAME *)ellFirst(&phag->list); - if(phagname) fprintf(fp," {"); else fprintf(fp,"\n"); - while(phagname) { - fprintf(fp,"%s",phagname->host); - phagname = (HAGNAME *)ellNext(&phagname->node); - if(phagname) fprintf(fp,","); else fprintf(fp,"}\n"); - } - phag = (HAG *)ellNext(&phag->node); + if(hagname && strcmp(hagname,phag->name)!=0) { + phag = (HAG *)ellNext(&phag->node); + continue; + } + fprintf(fp,"HAG(%s)",phag->name); + phagname = (HAGNAME *)ellFirst(&phag->list); + if(phagname) fprintf(fp," {"); else fprintf(fp,"\n"); + while(phagname) { + fprintf(fp,"%s",phagname->host); + phagname = (HAGNAME *)ellNext(&phagname->node); + if(phagname) fprintf(fp,","); else fprintf(fp,"}\n"); + } + phag = (HAG *)ellNext(&phag->node); } return(0); } @@ -723,79 +723,79 @@ int epicsStdCall asDumpRules(const char *asgname) int epicsStdCall asDumpRulesFP(FILE *fp,const char *asgname) { - ASG *pasg; - ASGINP *pasginp; - ASGRULE *pasgrule; - ASGHAG *pasghag; - ASGUAG *pasguag; + ASG *pasg; + ASGINP *pasginp; + ASGRULE *pasgrule; + ASGHAG *pasghag; + ASGUAG *pasguag; if(!asActive) return(0); pasg = (ASG *)ellFirst(&pasbase->asgList); if(!pasg) fprintf(fp,"No ASGs\n"); while(pasg) { - int print_end_brace; + int print_end_brace; - if(asgname && strcmp(asgname,pasg->name)!=0) { - pasg = (ASG *)ellNext(&pasg->node); - continue; - } - fprintf(fp,"ASG(%s)",pasg->name); - pasginp = (ASGINP *)ellFirst(&pasg->inpList); - pasgrule = (ASGRULE *)ellFirst(&pasg->ruleList); - if(pasginp || pasgrule) { - fprintf(fp," {\n"); - print_end_brace = TRUE; - } else { - fprintf(fp,"\n"); - print_end_brace = FALSE; - } - while(pasginp) { + if(asgname && strcmp(asgname,pasg->name)!=0) { + pasg = (ASG *)ellNext(&pasg->node); + continue; + } + fprintf(fp,"ASG(%s)",pasg->name); + pasginp = (ASGINP *)ellFirst(&pasg->inpList); + pasgrule = (ASGRULE *)ellFirst(&pasg->ruleList); + if(pasginp || pasgrule) { + fprintf(fp," {\n"); + print_end_brace = TRUE; + } else { + fprintf(fp,"\n"); + print_end_brace = FALSE; + } + while(pasginp) { - fprintf(fp,"\tINP%c(%s)",(pasginp->inpIndex + 'A'),pasginp->inp); - if ((pasg->inpBad & (1ul << pasginp->inpIndex))) - fprintf(fp," INVALID"); - fprintf(fp," value=%f",pasg->pavalue[pasginp->inpIndex]); - fprintf(fp,"\n"); - pasginp = (ASGINP *)ellNext(&pasginp->node); - } - while(pasgrule) { - int print_end_brace; + fprintf(fp,"\tINP%c(%s)",(pasginp->inpIndex + 'A'),pasginp->inp); + if ((pasg->inpBad & (1ul << pasginp->inpIndex))) + fprintf(fp," INVALID"); + fprintf(fp," value=%f",pasg->pavalue[pasginp->inpIndex]); + fprintf(fp,"\n"); + pasginp = (ASGINP *)ellNext(&pasginp->node); + } + while(pasgrule) { + int print_end_brace; - fprintf(fp,"\tRULE(%d,%s,%s)", - pasgrule->level,asAccessName[pasgrule->access], + fprintf(fp,"\tRULE(%d,%s,%s)", + pasgrule->level,asAccessName[pasgrule->access], asTrapOption[pasgrule->trapMask]); - pasguag = (ASGUAG *)ellFirst(&pasgrule->uagList); - pasghag = (ASGHAG *)ellFirst(&pasgrule->hagList); - if(pasguag || pasghag || pasgrule->calc) { - fprintf(fp," {\n"); - print_end_brace = TRUE; - } else { - fprintf(fp,"\n"); - print_end_brace = FALSE; - } - if(pasguag) fprintf(fp,"\t\tUAG("); - while(pasguag) { - fprintf(fp,"%s",pasguag->puag->name); - pasguag = (ASGUAG *)ellNext(&pasguag->node); - if(pasguag) fprintf(fp,","); else fprintf(fp,")\n"); - } - pasghag = (ASGHAG *)ellFirst(&pasgrule->hagList); - if(pasghag) fprintf(fp,"\t\tHAG("); - while(pasghag) { - fprintf(fp,"%s",pasghag->phag->name); - pasghag = (ASGHAG *)ellNext(&pasghag->node); - if(pasghag) fprintf(fp,","); else fprintf(fp,")\n"); - } - if(pasgrule->calc) { - fprintf(fp,"\t\tCALC(\"%s\")",pasgrule->calc); - fprintf(fp," result=%s",(pasgrule->result==1 ? "TRUE" : "FALSE")); - fprintf(fp,"\n"); - } - if(print_end_brace) fprintf(fp,"\t}\n"); - pasgrule = (ASGRULE *)ellNext(&pasgrule->node); - } - if(print_end_brace) fprintf(fp,"}\n"); - pasg = (ASG *)ellNext(&pasg->node); + pasguag = (ASGUAG *)ellFirst(&pasgrule->uagList); + pasghag = (ASGHAG *)ellFirst(&pasgrule->hagList); + if(pasguag || pasghag || pasgrule->calc) { + fprintf(fp," {\n"); + print_end_brace = TRUE; + } else { + fprintf(fp,"\n"); + print_end_brace = FALSE; + } + if(pasguag) fprintf(fp,"\t\tUAG("); + while(pasguag) { + fprintf(fp,"%s",pasguag->puag->name); + pasguag = (ASGUAG *)ellNext(&pasguag->node); + if(pasguag) fprintf(fp,","); else fprintf(fp,")\n"); + } + pasghag = (ASGHAG *)ellFirst(&pasgrule->hagList); + if(pasghag) fprintf(fp,"\t\tHAG("); + while(pasghag) { + fprintf(fp,"%s",pasghag->phag->name); + pasghag = (ASGHAG *)ellNext(&pasghag->node); + if(pasghag) fprintf(fp,","); else fprintf(fp,")\n"); + } + if(pasgrule->calc) { + fprintf(fp,"\t\tCALC(\"%s\")",pasgrule->calc); + fprintf(fp," result=%s",(pasgrule->result==1 ? "TRUE" : "FALSE")); + fprintf(fp,"\n"); + } + if(print_end_brace) fprintf(fp,"\t}\n"); + pasgrule = (ASGRULE *)ellNext(&pasgrule->node); + } + if(print_end_brace) fprintf(fp,"}\n"); + pasg = (ASG *)ellNext(&pasg->node); } return(0); } @@ -809,50 +809,50 @@ int epicsStdCall asDumpMem(const char *asgname,void (*memcallback)(ASMEMBERPVT,F int epicsStdCall asDumpMemFP(FILE *fp,const char *asgname, void (*memcallback)(ASMEMBERPVT,FILE *),int clients) { - ASG *pasg; - ASGMEMBER *pasgmember; - ASGCLIENT *pasgclient; + ASG *pasg; + ASGMEMBER *pasgmember; + ASGCLIENT *pasgclient; if(!asActive) return(0); pasg = (ASG *)ellFirst(&pasbase->asgList); if(!pasg) fprintf(fp,"No ASGs\n"); while(pasg) { - if(asgname && strcmp(asgname,pasg->name)!=0) { - pasg = (ASG *)ellNext(&pasg->node); - continue; - } - fprintf(fp,"ASG(%s)\n",pasg->name); - pasgmember = (ASGMEMBER *)ellFirst(&pasg->memberList); - if(pasgmember) fprintf(fp,"\tMEMBERLIST\n"); - while(pasgmember) { - if(strlen(pasgmember->asgName)==0) - fprintf(fp,"\t\t"); - else - fprintf(fp,"\t\t%s",pasgmember->asgName); - if(memcallback) memcallback(pasgmember,fp); - fprintf(fp,"\n"); - pasgclient = (ASGCLIENT *)ellFirst(&pasgmember->clientList); - if(!clients) pasgclient = NULL; - while(pasgclient) { - fprintf(fp,"\t\t\t %s %s", - pasgclient->user,pasgclient->host); - if(pasgclient->level>=0 && pasgclient->level<=1) - fprintf(fp," %s",asLevelName[pasgclient->level]); - else - fprintf(fp," Illegal Level %d",pasgclient->level); - if(pasgclient->access<=2) - fprintf(fp," %s %s", + if(asgname && strcmp(asgname,pasg->name)!=0) { + pasg = (ASG *)ellNext(&pasg->node); + continue; + } + fprintf(fp,"ASG(%s)\n",pasg->name); + pasgmember = (ASGMEMBER *)ellFirst(&pasg->memberList); + if(pasgmember) fprintf(fp,"\tMEMBERLIST\n"); + while(pasgmember) { + if(strlen(pasgmember->asgName)==0) + fprintf(fp,"\t\t"); + else + fprintf(fp,"\t\t%s",pasgmember->asgName); + if(memcallback) memcallback(pasgmember,fp); + fprintf(fp,"\n"); + pasgclient = (ASGCLIENT *)ellFirst(&pasgmember->clientList); + if(!clients) pasgclient = NULL; + while(pasgclient) { + fprintf(fp,"\t\t\t %s %s", + pasgclient->user,pasgclient->host); + if(pasgclient->level>=0 && pasgclient->level<=1) + fprintf(fp," %s",asLevelName[pasgclient->level]); + else + fprintf(fp," Illegal Level %d",pasgclient->level); + if(pasgclient->access<=2) + fprintf(fp," %s %s", asAccessName[pasgclient->access], asTrapOption[pasgclient->trapMask]); - else - fprintf(fp," Illegal Access %d",pasgclient->access); - fprintf(fp,"\n"); - pasgclient = (ASGCLIENT *)ellNext(&pasgclient->node); - } - pasgmember = (ASGMEMBER *)ellNext(&pasgmember->node); - } - pasg = (ASG *)ellNext(&pasg->node); + else + fprintf(fp," Illegal Access %d",pasgclient->access); + fprintf(fp,"\n"); + pasgclient = (ASGCLIENT *)ellNext(&pasgclient->node); + } + pasgmember = (ASGMEMBER *)ellNext(&pasgmember->node); + } + pasg = (ASG *)ellNext(&pasg->node); } return(0); } @@ -880,36 +880,36 @@ LIBCOM_API void * epicsStdCall asCalloc(size_t nobj,size_t size) } LIBCOM_API char * epicsStdCall asStrdup(unsigned char *str) { - size_t len = strlen((char *) str); - char *buf = asCalloc(1, len + 1); - strcpy(buf, (char *) str); - return buf; + size_t len = strlen((char *) str); + char *buf = asCalloc(1, len + 1); + strcpy(buf, (char *) str); + return buf; } static long asAddMemberPvt(ASMEMBERPVT *pasMemberPvt,const char *asgName) { - ASGMEMBER *pasgmember; - ASG *pgroup; - ASGCLIENT *pasgclient; + ASGMEMBER *pasgmember; + ASG *pgroup; + ASGCLIENT *pasgclient; if(*pasMemberPvt) { - pasgmember = *pasMemberPvt; + pasgmember = *pasMemberPvt; } else { - pasgmember = asCalloc(1,sizeof(ASGMEMBER)); - ellInit(&pasgmember->clientList); - *pasMemberPvt = pasgmember; + pasgmember = asCalloc(1,sizeof(ASGMEMBER)); + ellInit(&pasgmember->clientList); + *pasMemberPvt = pasgmember; } pasgmember->asgName = asgName; pgroup = (ASG *)ellFirst(&pasbase->asgList); while(pgroup) { - if(strcmp(pgroup->name,pasgmember->asgName)==0) goto got_it; - pgroup = (ASG *)ellNext(&pgroup->node); + if(strcmp(pgroup->name,pasgmember->asgName)==0) goto got_it; + pgroup = (ASG *)ellNext(&pgroup->node); } /* Put it in DEFAULT*/ pgroup = (ASG *)ellFirst(&pasbase->asgList); while(pgroup) { - if(strcmp(pgroup->name,DEFAULT)==0) goto got_it; - pgroup = (ASG *)ellNext(&pgroup->node); + if(strcmp(pgroup->name,DEFAULT)==0) goto got_it; + pgroup = (ASG *)ellNext(&pgroup->node); } errMessage(-1,"Logic Error in asAddMember"); return(-1); @@ -918,8 +918,8 @@ got_it: ellAdd(&pgroup->memberList,&pasgmember->node); pasgclient = (ASGCLIENT *)ellFirst(&pasgmember->clientList); while(pasgclient) { - asComputePvt((ASCLIENTPVT)pasgclient); - pasgclient = (ASGCLIENT *)ellNext(&pasgclient->node); + asComputePvt((ASCLIENTPVT)pasgclient); + pasgclient = (ASGCLIENT *)ellNext(&pasgclient->node); } return(0); } @@ -931,58 +931,58 @@ static long asComputeAllAsgPvt(void) if(!asActive) return(S_asLib_asNotActive); pasg = (ASG *)ellFirst(&pasbase->asgList); while(pasg) { - asComputeAsgPvt(pasg); - pasg = (ASG *)ellNext(&pasg->node); + asComputeAsgPvt(pasg); + pasg = (ASG *)ellNext(&pasg->node); } return(0); } static long asComputeAsgPvt(ASG *pasg) { - ASGRULE *pasgrule; - ASGMEMBER *pasgmember; - ASGCLIENT *pasgclient; + ASGRULE *pasgrule; + ASGMEMBER *pasgmember; + ASGCLIENT *pasgclient; if(!asActive) return(S_asLib_asNotActive); pasgrule = (ASGRULE *)ellFirst(&pasg->ruleList); while(pasgrule) { - double result = pasgrule->result; /* set for VAL */ - long status; + double result = pasgrule->result; /* set for VAL */ + long status; - if(pasgrule->calc && (pasg->inpChanged & pasgrule->inpUsed)) { - status = calcPerform(pasg->pavalue,&result,pasgrule->rpcl); - if(status) { - pasgrule->result = 0; - errMessage(status,"asComputeAsg"); - } else { - pasgrule->result = ((result>.99) && (result<1.01)) ? 1 : 0; - } - } - pasgrule = (ASGRULE *)ellNext(&pasgrule->node); + if(pasgrule->calc && (pasg->inpChanged & pasgrule->inpUsed)) { + status = calcPerform(pasg->pavalue,&result,pasgrule->rpcl); + if(status) { + pasgrule->result = 0; + errMessage(status,"asComputeAsg"); + } else { + pasgrule->result = ((result>.99) && (result<1.01)) ? 1 : 0; + } + } + pasgrule = (ASGRULE *)ellNext(&pasgrule->node); } pasg->inpChanged = FALSE; pasgmember = (ASGMEMBER *)ellFirst(&pasg->memberList); while(pasgmember) { - pasgclient = (ASGCLIENT *)ellFirst(&pasgmember->clientList); - while(pasgclient) { - asComputePvt((ASCLIENTPVT)pasgclient); - pasgclient = (ASGCLIENT *)ellNext(&pasgclient->node); - } - pasgmember = (ASGMEMBER *)ellNext(&pasgmember->node); + pasgclient = (ASGCLIENT *)ellFirst(&pasgmember->clientList); + while(pasgclient) { + asComputePvt((ASCLIENTPVT)pasgclient); + pasgclient = (ASGCLIENT *)ellNext(&pasgclient->node); + } + pasgmember = (ASGMEMBER *)ellNext(&pasgmember->node); } return(0); } static long asComputePvt(ASCLIENTPVT asClientPvt) { - asAccessRights access=asNOACCESS; - int trapMask=0; - ASGCLIENT *pasgclient = asClientPvt; - ASGMEMBER *pasgMember; - ASG *pasg; - ASGRULE *pasgrule; - asAccessRights oldaccess; - GPHENTRY *pgphentry; + asAccessRights access=asNOACCESS; + int trapMask=0; + ASGCLIENT *pasgclient = asClientPvt; + ASGMEMBER *pasgMember; + ASG *pasg; + ASGRULE *pasgrule; + asAccessRights oldaccess; + GPHENTRY *pgphentry; if(!asActive) return(S_asLib_asNotActive); if(!pasgclient) return(S_asLib_badClient); @@ -993,135 +993,135 @@ static long asComputePvt(ASCLIENTPVT asClientPvt) oldaccess=pasgclient->access; pasgrule = (ASGRULE *)ellFirst(&pasg->ruleList); while(pasgrule) { - if(access == asWRITE) break; - if(access>=pasgrule->access) goto next_rule; - if(pasgclient->level > pasgrule->level) goto next_rule; - /*if uagList is empty then no need to check uag*/ - if(ellCount(&pasgrule->uagList)>0){ - ASGUAG *pasguag; - UAG *puag; + if(access == asWRITE) break; + if(access>=pasgrule->access) goto next_rule; + if(pasgclient->level > pasgrule->level) goto next_rule; + /*if uagList is empty then no need to check uag*/ + if(ellCount(&pasgrule->uagList)>0){ + ASGUAG *pasguag; + UAG *puag; - pasguag = (ASGUAG *)ellFirst(&pasgrule->uagList); - while(pasguag) { - if((puag = pasguag->puag)) { - pgphentry = gphFind(pasbase->phash,pasgclient->user,puag); - if(pgphentry) goto check_hag; - } - pasguag = (ASGUAG *)ellNext(&pasguag->node); - } - goto next_rule; - } + pasguag = (ASGUAG *)ellFirst(&pasgrule->uagList); + while(pasguag) { + if((puag = pasguag->puag)) { + pgphentry = gphFind(pasbase->phash,pasgclient->user,puag); + if(pgphentry) goto check_hag; + } + pasguag = (ASGUAG *)ellNext(&pasguag->node); + } + goto next_rule; + } check_hag: - /*if hagList is empty then no need to check hag*/ - if(ellCount(&pasgrule->hagList)>0) { - ASGHAG *pasghag; - HAG *phag; + /*if hagList is empty then no need to check hag*/ + if(ellCount(&pasgrule->hagList)>0) { + ASGHAG *pasghag; + HAG *phag; - pasghag = (ASGHAG *)ellFirst(&pasgrule->hagList); - while(pasghag) { - if((phag = pasghag->phag)) { - pgphentry=gphFind(pasbase->phash,pasgclient->host,phag); - if(pgphentry) goto check_calc; - } - pasghag = (ASGHAG *)ellNext(&pasghag->node); - } - goto next_rule; - } + pasghag = (ASGHAG *)ellFirst(&pasgrule->hagList); + while(pasghag) { + if((phag = pasghag->phag)) { + pgphentry=gphFind(pasbase->phash,pasgclient->host,phag); + if(pgphentry) goto check_calc; + } + pasghag = (ASGHAG *)ellNext(&pasghag->node); + } + goto next_rule; + } check_calc: - if(!pasgrule->calc - || (!(pasg->inpBad & pasgrule->inpUsed) && (pasgrule->result==1))) { - access = pasgrule->access; + if(!pasgrule->calc + || (!(pasg->inpBad & pasgrule->inpUsed) && (pasgrule->result==1))) { + access = pasgrule->access; trapMask = pasgrule->trapMask; } next_rule: - pasgrule = (ASGRULE *)ellNext(&pasgrule->node); + pasgrule = (ASGRULE *)ellNext(&pasgrule->node); } pasgclient->access = access; pasgclient->trapMask = trapMask; if(pasgclient->pcallback && oldaccess!=access) { - (*pasgclient->pcallback)(pasgclient,asClientCOAR); + (*pasgclient->pcallback)(pasgclient,asClientCOAR); } return(0); } void asFreeAll(ASBASE *pasbase) { - UAG *puag; - UAGNAME *puagname; - HAG *phag; - HAGNAME *phagname; - ASG *pasg; - ASGINP *pasginp; - ASGRULE *pasgrule; - ASGHAG *pasghag; - ASGUAG *pasguag; - void *pnext; + UAG *puag; + UAGNAME *puagname; + HAG *phag; + HAGNAME *phagname; + ASG *pasg; + ASGINP *pasginp; + ASGRULE *pasgrule; + ASGHAG *pasghag; + ASGUAG *pasguag; + void *pnext; puag = (UAG *)ellFirst(&pasbase->uagList); while(puag) { - puagname = (UAGNAME *)ellFirst(&puag->list); - while(puagname) { - pnext = ellNext(&puagname->node); - ellDelete(&puag->list,&puagname->node); - free(puagname); - puagname = pnext; - } - pnext = ellNext(&puag->node); - ellDelete(&pasbase->uagList,&puag->node); - free(puag); - puag = pnext; + puagname = (UAGNAME *)ellFirst(&puag->list); + while(puagname) { + pnext = ellNext(&puagname->node); + ellDelete(&puag->list,&puagname->node); + free(puagname); + puagname = pnext; + } + pnext = ellNext(&puag->node); + ellDelete(&pasbase->uagList,&puag->node); + free(puag); + puag = pnext; } phag = (HAG *)ellFirst(&pasbase->hagList); while(phag) { - phagname = (HAGNAME *)ellFirst(&phag->list); - while(phagname) { - pnext = ellNext(&phagname->node); - ellDelete(&phag->list,&phagname->node); - free(phagname); - phagname = pnext; - } - pnext = ellNext(&phag->node); - ellDelete(&pasbase->hagList,&phag->node); - free(phag); - phag = pnext; + phagname = (HAGNAME *)ellFirst(&phag->list); + while(phagname) { + pnext = ellNext(&phagname->node); + ellDelete(&phag->list,&phagname->node); + free(phagname); + phagname = pnext; + } + pnext = ellNext(&phag->node); + ellDelete(&pasbase->hagList,&phag->node); + free(phag); + phag = pnext; } pasg = (ASG *)ellFirst(&pasbase->asgList); while(pasg) { - free(pasg->pavalue); - pasginp = (ASGINP *)ellFirst(&pasg->inpList); - while(pasginp) { - pnext = ellNext(&pasginp->node); - ellDelete(&pasg->inpList,&pasginp->node); - free(pasginp); - pasginp = pnext; - } - pasgrule = (ASGRULE *)ellFirst(&pasg->ruleList); - while(pasgrule) { - free(pasgrule->calc); - free(pasgrule->rpcl); - pasguag = (ASGUAG *)ellFirst(&pasgrule->uagList); - while(pasguag) { - pnext = ellNext(&pasguag->node); - ellDelete(&pasgrule->uagList,&pasguag->node); - free(pasguag); - pasguag = pnext; - } - pasghag = (ASGHAG *)ellFirst(&pasgrule->hagList); - while(pasghag) { - pnext = ellNext(&pasghag->node); - ellDelete(&pasgrule->hagList,&pasghag->node); - free(pasghag); - pasghag = pnext; - } - pnext = ellNext(&pasgrule->node); - ellDelete(&pasg->ruleList,&pasgrule->node); - free(pasgrule); - pasgrule = pnext; - } - pnext = ellNext(&pasg->node); - ellDelete(&pasbase->asgList,&pasg->node); - free(pasg); - pasg = pnext; + free(pasg->pavalue); + pasginp = (ASGINP *)ellFirst(&pasg->inpList); + while(pasginp) { + pnext = ellNext(&pasginp->node); + ellDelete(&pasg->inpList,&pasginp->node); + free(pasginp); + pasginp = pnext; + } + pasgrule = (ASGRULE *)ellFirst(&pasg->ruleList); + while(pasgrule) { + free(pasgrule->calc); + free(pasgrule->rpcl); + pasguag = (ASGUAG *)ellFirst(&pasgrule->uagList); + while(pasguag) { + pnext = ellNext(&pasguag->node); + ellDelete(&pasgrule->uagList,&pasguag->node); + free(pasguag); + pasguag = pnext; + } + pasghag = (ASGHAG *)ellFirst(&pasgrule->hagList); + while(pasghag) { + pnext = ellNext(&pasghag->node); + ellDelete(&pasgrule->hagList,&pasghag->node); + free(pasghag); + pasghag = pnext; + } + pnext = ellNext(&pasgrule->node); + ellDelete(&pasg->ruleList,&pasgrule->node); + free(pasgrule); + pasgrule = pnext; + } + pnext = ellNext(&pasg->node); + ellDelete(&pasbase->asgList,&pasg->node); + free(pasg); + pasg = pnext; } gphFreeMem(pasbase->phash); free(pasbase); @@ -1130,31 +1130,31 @@ void asFreeAll(ASBASE *pasbase) /*Beginning of routines called by lex code*/ static UAG *asUagAdd(const char *uagName) { - UAG *pprev; - UAG *pnext; - UAG *puag; - int cmpvalue; - ASBASE *pasbase = (ASBASE *)pasbasenew; + UAG *pprev; + UAG *pnext; + UAG *puag; + int cmpvalue; + ASBASE *pasbase = (ASBASE *)pasbasenew; /*Insert in alphabetic order*/ pnext = (UAG *)ellFirst(&pasbase->uagList); while(pnext) { - cmpvalue = strcmp(uagName,pnext->name); - if(cmpvalue < 0) break; - if(cmpvalue==0) { - errlogPrintf("Duplicate User Access Group named '%s'\n", uagName); - return(NULL); - } - pnext = (UAG *)ellNext(&pnext->node); + cmpvalue = strcmp(uagName,pnext->name); + if(cmpvalue < 0) break; + if(cmpvalue==0) { + errlogPrintf("Duplicate User Access Group named '%s'\n", uagName); + return(NULL); + } + pnext = (UAG *)ellNext(&pnext->node); } puag = asCalloc(1,sizeof(UAG)+strlen(uagName)+1); ellInit(&puag->list); puag->name = (char *)(puag+1); strcpy(puag->name,uagName); if(pnext==NULL) { /*Add to end of list*/ - ellAdd(&pasbase->uagList,&puag->node); + ellAdd(&pasbase->uagList,&puag->node); } else { - pprev = (UAG *)ellPrevious(&pnext->node); + pprev = (UAG *)ellPrevious(&pnext->node); ellInsert(&pasbase->uagList,&pprev->node,&puag->node); } return(puag); @@ -1162,7 +1162,7 @@ static UAG *asUagAdd(const char *uagName) static long asUagAddUser(UAG *puag,const char *user) { - UAGNAME *puagname; + UAGNAME *puagname; if(!puag) return(0); puagname = asCalloc(1,sizeof(UAGNAME)+strlen(user)+1); @@ -1174,32 +1174,32 @@ static long asUagAddUser(UAG *puag,const char *user) static HAG *asHagAdd(const char *hagName) { - HAG *pprev; - HAG *pnext; - HAG *phag; - int cmpvalue; - ASBASE *pasbase = (ASBASE *)pasbasenew; + HAG *pprev; + HAG *pnext; + HAG *phag; + int cmpvalue; + ASBASE *pasbase = (ASBASE *)pasbasenew; /*Insert in alphabetic order*/ pnext = (HAG *)ellFirst(&pasbase->hagList); while(pnext) { - cmpvalue = strcmp(hagName,pnext->name); - if(cmpvalue < 0) break; - if(cmpvalue==0) { - errlogPrintf("Duplicate Host Access Group named '%s'\n", hagName); - return(NULL); - } - pnext = (HAG *)ellNext(&pnext->node); + cmpvalue = strcmp(hagName,pnext->name); + if(cmpvalue < 0) break; + if(cmpvalue==0) { + errlogPrintf("Duplicate Host Access Group named '%s'\n", hagName); + return(NULL); + } + pnext = (HAG *)ellNext(&pnext->node); } phag = asCalloc(1,sizeof(HAG)+strlen(hagName)+1); ellInit(&phag->list); phag->name = (char *)(phag+1); strcpy(phag->name,hagName); if(pnext==NULL) { /*Add to end of list*/ - ellAdd(&pasbase->hagList,&phag->node); + ellAdd(&pasbase->hagList,&phag->node); } else { - pprev = (HAG *)ellPrevious(&pnext->node); - ellInsert(&pasbase->hagList,&pprev->node,&phag->node); + pprev = (HAG *)ellPrevious(&pnext->node); + ellInsert(&pasbase->hagList,&pprev->node,&phag->node); } return(phag); } @@ -1246,27 +1246,27 @@ static long asHagAddHost(HAG *phag,const char *host) static ASG *asAsgAdd(const char *asgName) { - ASG *pprev; - ASG *pnext; - ASG *pasg; - int cmpvalue; - ASBASE *pasbase = (ASBASE *)pasbasenew; + ASG *pprev; + ASG *pnext; + ASG *pasg; + int cmpvalue; + ASBASE *pasbase = (ASBASE *)pasbasenew; /*Insert in alphabetic order*/ pnext = (ASG *)ellFirst(&pasbase->asgList); while(pnext) { - cmpvalue = strcmp(asgName,pnext->name); - if(cmpvalue < 0) break; - if(cmpvalue==0) { - if(strcmp(DEFAULT,pnext->name)==0) { - if(ellCount(&pnext->inpList)==0 - && ellCount(&pnext->ruleList)==0) - return(pnext); - } - errlogPrintf("Duplicate Access Security Group named '%s'\n", asgName); - return(NULL); - } - pnext = (ASG *)ellNext(&pnext->node); + cmpvalue = strcmp(asgName,pnext->name); + if(cmpvalue < 0) break; + if(cmpvalue==0) { + if(strcmp(DEFAULT,pnext->name)==0) { + if(ellCount(&pnext->inpList)==0 + && ellCount(&pnext->ruleList)==0) + return(pnext); + } + errlogPrintf("Duplicate Access Security Group named '%s'\n", asgName); + return(NULL); + } + pnext = (ASG *)ellNext(&pnext->node); } pasg = asCalloc(1,sizeof(ASG)+strlen(asgName)+1); ellInit(&pasg->inpList); @@ -1275,17 +1275,17 @@ static ASG *asAsgAdd(const char *asgName) pasg->name = (char *)(pasg+1); strcpy(pasg->name,asgName); if(pnext==NULL) { /*Add to end of list*/ - ellAdd(&pasbase->asgList,&pasg->node); + ellAdd(&pasbase->asgList,&pasg->node); } else { - pprev = (ASG *)ellPrevious(&pnext->node); - ellInsert(&pasbase->asgList,&pprev->node,&pasg->node); + pprev = (ASG *)ellPrevious(&pnext->node); + ellInsert(&pasbase->asgList,&pprev->node,&pasg->node); } return(pasg); } static long asAsgAddInp(ASG *pasg,const char *inp,int inpIndex) { - ASGINP *pasginp; + ASGINP *pasginp; if(!pasg) return(0); pasginp = asCalloc(1,sizeof(ASGINP)+strlen(inp)+1); @@ -1299,7 +1299,7 @@ static long asAsgAddInp(ASG *pasg,const char *inp,int inpIndex) static ASGRULE *asAsgAddRule(ASG *pasg,asAccessRights access,int level) { - ASGRULE *pasgrule; + ASGRULE *pasgrule; if(!pasg) return(0); pasgrule = asCalloc(1,sizeof(ASGRULE)); @@ -1321,9 +1321,9 @@ static long asAsgAddRuleOptions(ASGRULE *pasgrule,int trapMask) static long asAsgRuleUagAdd(ASGRULE *pasgrule, const char *name) { - ASGUAG *pasguag; - UAG *puag; - ASBASE *pasbase = (ASBASE *)pasbasenew; + ASGUAG *pasguag; + UAG *puag; + ASBASE *pasbase = (ASBASE *)pasbasenew; if (!pasgrule) return 0; @@ -1347,9 +1347,9 @@ static long asAsgRuleUagAdd(ASGRULE *pasgrule, const char *name) static long asAsgRuleHagAdd(ASGRULE *pasgrule, const char *name) { - ASGHAG *pasghag; - HAG *phag; - ASBASE *pasbase = (ASBASE *)pasbasenew; + ASGHAG *pasghag; + HAG *phag; + ASBASE *pasbase = (ASBASE *)pasbasenew; if (!pasgrule) return 0; @@ -1385,24 +1385,24 @@ static long asAsgRuleCalc(ASGRULE *pasgrule,const char *calc) pasgrule->rpcl = asCalloc(1, INFIX_TO_POSTFIX_SIZE(insize)); status = postfix(pasgrule->calc, pasgrule->rpcl, &err); if(status) { - free(pasgrule->calc); - free(pasgrule->rpcl); - pasgrule->calc = NULL; - pasgrule->rpcl = NULL; - status = S_asLib_badCalc; - errlogPrintf("%s in CALC expression '%s'\n", calcErrorStr(err), calc); - return status; + free(pasgrule->calc); + free(pasgrule->rpcl); + pasgrule->calc = NULL; + pasgrule->rpcl = NULL; + status = S_asLib_badCalc; + errlogPrintf("%s in CALC expression '%s'\n", calcErrorStr(err), calc); + return status; } calcArgUsage(pasgrule->rpcl, &pasgrule->inpUsed, &stores); /* Until someone proves stores are not dangerous, don't allow them */ if (stores) { - free(pasgrule->calc); - free(pasgrule->rpcl); - pasgrule->calc = NULL; - pasgrule->rpcl = NULL; - status = S_asLib_badCalc; - errlogPrintf("Assignment operator used in CALC expression '%s'\n", - calc); + free(pasgrule->calc); + free(pasgrule->rpcl); + pasgrule->calc = NULL; + pasgrule->rpcl = NULL; + status = S_asLib_badCalc; + errlogPrintf("Assignment operator used in CALC expression '%s'\n", + calc); } return(status); } diff --git a/modules/libcom/src/as/asLib_lex.l b/modules/libcom/src/as/asLib_lex.l index 924105c14..bb8826d20 100644 --- a/modules/libcom/src/as/asLib_lex.l +++ b/modules/libcom/src/as/asLib_lex.l @@ -26,69 +26,69 @@ static ASINPUTFUNCPTR *my_yyinput; static int yyreset(void) { - line_num=1; - BEGIN INITIAL; - return(0); + line_num=1; + BEGIN INITIAL; + return(0); } %} %% -UAG { return(tokenUAG); } -HAG { return(tokenHAG); } -ASG { return(tokenASG); } -RULE { return(tokenRULE); } -CALC { return(tokenCALC); } +UAG { return(tokenUAG); } +HAG { return(tokenHAG); } +ASG { return(tokenASG); } +RULE { return(tokenRULE); } +CALC { return(tokenCALC); } INP{link} { - yylval.Int = (unsigned char)yytext[3]; - yylval.Int -= 'A'; - return(tokenINP); + yylval.Int = (unsigned char)yytext[3]; + yylval.Int -= 'A'; + return(tokenINP); } {digit}+ { /*integer*/ - yylval.Int = atoi((char *)yytext); - return(tokenINTEGER); + yylval.Int = atoi((char *)yytext); + return(tokenINTEGER); } {name}+ { /*unquoted string*/ - yylval.Str=asStrdup(yytext); - return(tokenSTRING); + yylval.Str=asStrdup(yytext); + return(tokenSTRING); } {doublequote}({stringchar}|{escape})*{doublequote} { /* quoted string */ - yylval.Str=asStrdup(yytext+1); - yylval.Str[strlen(yylval.Str)-1] = '\0'; - return(tokenSTRING); + yylval.Str=asStrdup(yytext+1); + yylval.Str[strlen(yylval.Str)-1] = '\0'; + return(tokenSTRING); } {doublequote}({stringchar}|{escape})*{newline} { /* bad string */ - yyerror("Newline in quoted string, closing quote missing"); + yyerror("Newline in quoted string, closing quote missing"); } -{punctuation} { return(yytext[0]); } +{punctuation} { return(yytext[0]); } -{newline} { line_num++; } +{newline} { line_num++; } -{comment}.* ; -{whitespace} ; +{comment}.* ; +{whitespace} ; -. { - char message[40]; - YY_BUFFER_STATE *dummy=0; +. { + char message[40]; + YY_BUFFER_STATE *dummy=0; - if (isprint((int) yytext[0])) { - sprintf(message, "Invalid character '%c'", yytext[0]); - } - else { - sprintf(message, "Invalid character 0x%2.2x", yytext[0]); - } - yyerror(message); + if (isprint((int) yytext[0])) { + sprintf(message, "Invalid character '%c'", yytext[0]); + } + else { + sprintf(message, "Invalid character 0x%2.2x", yytext[0]); + } + yyerror(message); - /*The following suppress compiler warning messages*/ - if (0) yyunput('c',(unsigned char *) message); - if (0) yy_switch_to_buffer(*dummy); + /*The following suppress compiler warning messages*/ + if (0) yyunput('c',(unsigned char *) message); + if (0) yy_switch_to_buffer(*dummy); } %% diff --git a/modules/libcom/src/as/asTrapWrite.c b/modules/libcom/src/as/asTrapWrite.c index fe7b246e6..05a899fa7 100644 --- a/modules/libcom/src/as/asTrapWrite.c +++ b/modules/libcom/src/as/asTrapWrite.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /*asTrapWrite.c */ /* Author: Marty Kraimer Date: 07NOV2000 */ @@ -45,7 +45,7 @@ typedef struct writeMessage { asTrapWriteMessage message; ELLLIST listenerPvtList; }writeMessage; - + typedef struct asTrapWritePvt { @@ -76,7 +76,7 @@ asTrapWriteId epicsStdCall asTrapWriteRegisterListener( listener *plistener; if(pasTrapWritePvt==0) asTrapWriteInit(); plistener = callocMustSucceed(1,sizeof(listener),"asTrapWriteRegisterListener"); - plistener->func = func; + plistener->func = func; epicsMutexMustLock(pasTrapWritePvt->lock); ellAdd(&pasTrapWritePvt->listenerList,&plistener->node); epicsMutexUnlock(pasTrapWritePvt->lock); diff --git a/modules/libcom/src/bucketLib/bucketLib.c b/modules/libcom/src/bucketLib/bucketLib.c index c8ef9a2b0..39681208e 100644 --- a/modules/libcom/src/bucketLib/bucketLib.c +++ b/modules/libcom/src/bucketLib/bucketLib.c @@ -4,16 +4,16 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Author: Jeffrey O. Hill * hill@atdiv.lanl.gov * (505) 665 1831 - * Date: 9-93 + * Date: 9-93 * - * NOTES: - * .01 Storage for identifier must persist until an item is deleted + * NOTES: + * .01 Storage for identifier must persist until an item is deleted */ #include @@ -24,7 +24,7 @@ #include #include "epicsAssert.h" -#include "freeList.h" /* bucketLib uses freeListLib inside the DLL */ +#include "freeList.h" /* bucketLib uses freeListLib inside the DLL */ #include "bucketLib.h" /* @@ -42,19 +42,19 @@ static bucketHash bucketPointerHash; static bucketHash bucketStringHash; typedef struct { - bucketHash *pHash; - bucketCompare *pCompare; - buckTypeOfId type; + bucketHash *pHash; + bucketCompare *pCompare; + buckTypeOfId type; }bucketSET; static bucketSET BSET[] = { - {bucketUnsignedHash, bucketUnsignedCompare, bidtUnsigned}, - {bucketPointerHash, bucketPointerCompare, bidtPointer}, - {bucketStringHash, bucketStringCompare, bidtString} + {bucketUnsignedHash, bucketUnsignedCompare, bidtUnsigned}, + {bucketPointerHash, bucketPointerCompare, bidtPointer}, + {bucketStringHash, bucketStringCompare, bidtString} }; -static int bucketAddItem(BUCKET *prb, bucketSET *pBSET, - const void *pId, const void *pApp); +static int bucketAddItem(BUCKET *prb, bucketSET *pBSET, + const void *pId, const void *pApp); static void *bucketLookupItem(BUCKET *pb, bucketSET *pBSET, const void *pId); @@ -62,12 +62,12 @@ static void *bucketLookupItem(BUCKET *pb, bucketSET *pBSET, const void *pId); /* * bucket id bit width */ -#define BUCKETID_BIT_WIDTH (sizeof(BUCKETID)*CHAR_BIT) +#define BUCKETID_BIT_WIDTH (sizeof(BUCKETID)*CHAR_BIT) /* * Maximum bucket size */ -#define BUCKET_MAX_WIDTH 12 +#define BUCKET_MAX_WIDTH 12 /* @@ -75,21 +75,21 @@ static void *bucketLookupItem(BUCKET *pb, bucketSET *pBSET, const void *pId); */ static ITEM **bucketUnsignedCompare (ITEM **ppi, const void *pId) { - unsigned id; - unsigned *pItemId; - ITEM *pi; + unsigned id; + unsigned *pItemId; + ITEM *pi; - id = * (unsigned *) pId; - while ( (pi = *ppi) ) { - if (bidtUnsigned == pi->type) { - pItemId = (unsigned *) pi->pId; - if (id == *pItemId) { - return ppi; - } - } - ppi = &pi->pItem; - } - return NULL; + id = * (unsigned *) pId; + while ( (pi = *ppi) ) { + if (bidtUnsigned == pi->type) { + pItemId = (unsigned *) pi->pId; + if (id == *pItemId) { + return ppi; + } + } + ppi = &pi->pItem; + } + return NULL; } @@ -98,21 +98,21 @@ static ITEM **bucketUnsignedCompare (ITEM **ppi, const void *pId) */ static ITEM **bucketPointerCompare (ITEM **ppi, const void *pId) { - void *ptr; - void **pItemId; - ITEM *pi; + void *ptr; + void **pItemId; + ITEM *pi; - ptr = * (void **) pId; - while ( (pi = *ppi) ) { - if (bidtPointer == pi->type ) { - pItemId = (void **) pi->pId; - if (ptr == *pItemId) { - return ppi; - } - } - ppi = &pi->pItem; - } - return NULL; + ptr = * (void **) pId; + while ( (pi = *ppi) ) { + if (bidtPointer == pi->type ) { + pItemId = (void **) pi->pId; + if (ptr == *pItemId) { + return ppi; + } + } + ppi = &pi->pItem; + } + return NULL; } @@ -121,20 +121,20 @@ static ITEM **bucketPointerCompare (ITEM **ppi, const void *pId) */ static ITEM **bucketStringCompare (ITEM **ppi, const void *pId) { - const char *pStr = pId; - ITEM *pi; - int status; + const char *pStr = pId; + ITEM *pi; + int status; - while ( (pi = *ppi) ) { - if (bidtString == pi->type) { - status = strcmp (pStr, (char *)pi->pId); - if (status == '\0') { - return ppi; - } - } - ppi = &pi->pItem; - } - return NULL; + while ( (pi = *ppi) ) { + if (bidtString == pi->type) { + status = strcmp (pStr, (char *)pi->pId); + if (status == '\0') { + return ppi; + } + } + ppi = &pi->pItem; + } + return NULL; } @@ -143,20 +143,20 @@ static ITEM **bucketStringCompare (ITEM **ppi, const void *pId) */ static BUCKETID bucketUnsignedHash (BUCKET *pb, const void *pId) { - const unsigned *pUId = (const unsigned *) pId; - unsigned src; - BUCKETID hashid; + const unsigned *pUId = (const unsigned *) pId; + unsigned src; + BUCKETID hashid; - src = *pUId; - hashid = src; - src = src >> pb->hashIdNBits; - while (src) { - hashid = hashid ^ src; - src = src >> pb->hashIdNBits; - } - hashid = hashid & pb->hashIdMask; + src = *pUId; + hashid = src; + src = src >> pb->hashIdNBits; + while (src) { + hashid = hashid ^ src; + src = src >> pb->hashIdNBits; + } + hashid = hashid & pb->hashIdMask; - return hashid; + return hashid; } @@ -165,26 +165,26 @@ static BUCKETID bucketUnsignedHash (BUCKET *pb, const void *pId) */ static BUCKETID bucketPointerHash (BUCKET *pb, const void *pId) { - void * const *ppId = (void * const *) pId; - size_t src; - BUCKETID hashid; + void * const *ppId = (void * const *) pId; + size_t src; + BUCKETID hashid; - /* - * This makes the assumption that size_t - * can be used to hold a pointer value - * (this assumption may not port to all - * CPU architectures) - */ - src = (size_t) *ppId; - hashid = src; - src = src >> pb->hashIdNBits; - while(src){ - hashid = hashid ^ src; - src = src >> pb->hashIdNBits; - } - hashid = hashid & pb->hashIdMask; + /* + * This makes the assumption that size_t + * can be used to hold a pointer value + * (this assumption may not port to all + * CPU architectures) + */ + src = (size_t) *ppId; + hashid = src; + src = src >> pb->hashIdNBits; + while(src){ + hashid = hashid ^ src; + src = src >> pb->hashIdNBits; + } + hashid = hashid & pb->hashIdMask; - return hashid; + return hashid; } @@ -193,21 +193,21 @@ static BUCKETID bucketPointerHash (BUCKET *pb, const void *pId) */ static BUCKETID bucketStringHash (BUCKET *pb, const void *pId) { - const char *pStr = (const char *) pId; - BUCKETID hashid; - unsigned i; + const char *pStr = (const char *) pId; + BUCKETID hashid; + unsigned i; - hashid = 0; - i = 1; - while(*pStr){ - hashid += *pStr * i; - pStr++; - i++; - } + hashid = 0; + i = 1; + while(*pStr){ + hashid += *pStr * i; + pStr++; + i++; + } - hashid = hashid % (pb->hashIdMask+1); + hashid = hashid % (pb->hashIdMask+1); - return hashid; + return hashid; } @@ -217,65 +217,65 @@ static BUCKETID bucketStringHash (BUCKET *pb, const void *pId) */ LIBCOM_API BUCKET * epicsStdCall bucketCreate (unsigned nHashTableEntries) { - BUCKETID mask; - unsigned nbits; - BUCKET *pb; + BUCKETID mask; + unsigned nbits; + BUCKET *pb; - /* - * no absurd sized buckets - */ - if (nHashTableEntries<=1) { - fprintf (stderr, "Tiny bucket create failed\n"); - return NULL; - } + /* + * no absurd sized buckets + */ + if (nHashTableEntries<=1) { + fprintf (stderr, "Tiny bucket create failed\n"); + return NULL; + } - /* - * count the number of bits in the bucket id - */ + /* + * count the number of bits in the bucket id + */ if ( BUCKETID_BIT_WIDTH > 0 ) { - for (nbits=0; nbits=BUCKETID_BIT_WIDTH) { - fprintf ( - stderr, - "%s at %d: Requested index width=%d to large. max=%ld\n", - __FILE__, - __LINE__, - nbits, - (long)(BUCKETID_BIT_WIDTH-1)); - return NULL; - } + /* + * indexWidth must be specified at least one + * bit less than the bit size of type BUCKETID + */ + if (nbits>=BUCKETID_BIT_WIDTH) { + fprintf ( + stderr, + "%s at %d: Requested index width=%d to large. max=%ld\n", + __FILE__, + __LINE__, + nbits, + (long)(BUCKETID_BIT_WIDTH-1)); + return NULL; + } - pb = (BUCKET *) calloc(1, sizeof(*pb)); - if (!pb) { - return pb; - } + pb = (BUCKET *) calloc(1, sizeof(*pb)); + if (!pb) { + return pb; + } - pb->hashIdMask = mask; - pb->hashIdNBits = nbits; - freeListInitPvt(&pb->freeListPVT, sizeof(ITEM), 1024); + pb->hashIdMask = mask; + pb->hashIdNBits = nbits; + freeListInitPvt(&pb->freeListPVT, sizeof(ITEM), 1024); - pb->pTable = (ITEM **) calloc (mask+1, sizeof(*pb->pTable)); - if (!pb->pTable) { - freeListCleanup(pb->freeListPVT); - free (pb); - return NULL; - } - return pb; + pb->pTable = (ITEM **) calloc (mask+1, sizeof(*pb->pTable)); + if (!pb->pTable) { + freeListCleanup(pb->freeListPVT); + free (pb); + return NULL; + } + return pb; } @@ -284,20 +284,20 @@ LIBCOM_API BUCKET * epicsStdCall bucketCreate (unsigned nHashTableEntries) */ LIBCOM_API int epicsStdCall bucketFree (BUCKET *prb) { - /* - * deleting a bucket with entries in use - * will cause memory leaks and is not allowed - */ - assert (prb->nInUse==0); + /* + * deleting a bucket with entries in use + * will cause memory leaks and is not allowed + */ + assert (prb->nInUse==0); - /* - * free the free list - */ - freeListCleanup(prb->freeListPVT); - free (prb->pTable); - free (prb); + /* + * free the free list + */ + freeListCleanup(prb->freeListPVT); + free (prb->pTable); + free (prb); - return S_bucket_success; + return S_bucket_success; } @@ -305,59 +305,59 @@ LIBCOM_API int epicsStdCall bucketFree (BUCKET *prb) * bucketAddItem() */ LIBCOM_API int epicsStdCall - bucketAddItemUnsignedId(BUCKET *prb, const unsigned *pId, const void *pApp) + bucketAddItemUnsignedId(BUCKET *prb, const unsigned *pId, const void *pApp) { - return bucketAddItem(prb, &BSET[bidtUnsigned], pId, pApp); + return bucketAddItem(prb, &BSET[bidtUnsigned], pId, pApp); } LIBCOM_API int epicsStdCall - bucketAddItemPointerId(BUCKET *prb, void * const *pId, const void *pApp) + bucketAddItemPointerId(BUCKET *prb, void * const *pId, const void *pApp) { - return bucketAddItem(prb, &BSET[bidtPointer], pId, pApp); + return bucketAddItem(prb, &BSET[bidtPointer], pId, pApp); } LIBCOM_API int epicsStdCall - bucketAddItemStringId(BUCKET *prb, const char *pId, const void *pApp) + bucketAddItemStringId(BUCKET *prb, const char *pId, const void *pApp) { - return bucketAddItem(prb, &BSET[bidtString], pId, pApp); + return bucketAddItem(prb, &BSET[bidtString], pId, pApp); } static int bucketAddItem(BUCKET *prb, bucketSET *pBSET, const void *pId, const void *pApp) { - BUCKETID hashid; - ITEM **ppi; - ITEM **ppiExists; - ITEM *pi; + BUCKETID hashid; + ITEM **ppi; + ITEM **ppiExists; + ITEM *pi; - /* - * try to get it off the free list first. If - * that fails then malloc() - */ - pi = (ITEM *) freeListMalloc(prb->freeListPVT); - if (!pi) { - return S_bucket_noMemory; - } + /* + * try to get it off the free list first. If + * that fails then malloc() + */ + pi = (ITEM *) freeListMalloc(prb->freeListPVT); + if (!pi) { + return S_bucket_noMemory; + } - /* - * create the hash index - */ - hashid = (*pBSET->pHash) (prb, pId); + /* + * create the hash index + */ + hashid = (*pBSET->pHash) (prb, pId); - pi->pApp = pApp; - pi->pId = pId; - pi->type = pBSET->type; - assert ((hashid & ~prb->hashIdMask) == 0); - ppi = &prb->pTable[hashid]; - /* - * Dont reuse a resource id ! - */ - ppiExists = (*pBSET->pCompare) (ppi, pId); - if (ppiExists) { - freeListFree(prb->freeListPVT,pi); - return S_bucket_idInUse; - } - pi->pItem = *ppi; - prb->pTable[hashid] = pi; - prb->nInUse++; + pi->pApp = pApp; + pi->pId = pId; + pi->type = pBSET->type; + assert ((hashid & ~prb->hashIdMask) == 0); + ppi = &prb->pTable[hashid]; + /* + * Dont reuse a resource id ! + */ + ppiExists = (*pBSET->pCompare) (ppi, pId); + if (ppiExists) { + freeListFree(prb->freeListPVT,pi); + return S_bucket_idInUse; + } + pi->pItem = *ppi; + prb->pTable[hashid] = pi; + prb->nInUse++; - return S_bucket_success; + return S_bucket_success; } /* @@ -365,34 +365,34 @@ static int bucketAddItem(BUCKET *prb, bucketSET *pBSET, const void *pId, const v */ static void *bucketLookupAndRemoveItem (BUCKET *prb, bucketSET *pBSET, const void *pId) { - BUCKETID hashid; - ITEM **ppi; - ITEM *pi; + BUCKETID hashid; + ITEM **ppi; + ITEM *pi; void *pApp; - /* - * create the hash index - */ - hashid = (*pBSET->pHash) (prb, pId); + /* + * create the hash index + */ + hashid = (*pBSET->pHash) (prb, pId); - assert((hashid & ~prb->hashIdMask) == 0); - ppi = &prb->pTable[hashid]; - ppi = (*pBSET->pCompare) (ppi, pId); - if(!ppi){ - return NULL; - } - prb->nInUse--; - pi = *ppi; - *ppi = pi->pItem; + assert((hashid & ~prb->hashIdMask) == 0); + ppi = &prb->pTable[hashid]; + ppi = (*pBSET->pCompare) (ppi, pId); + if(!ppi){ + return NULL; + } + prb->nInUse--; + pi = *ppi; + *ppi = pi->pItem; pApp = (void *) pi->pApp; - /* - * stuff it on the free list - */ - freeListFree(prb->freeListPVT, pi); + /* + * stuff it on the free list + */ + freeListFree(prb->freeListPVT, pi); - return pApp; + return pApp; } LIBCOM_API void * epicsStdCall bucketLookupAndRemoveItemUnsignedId (BUCKET *prb, const unsigned *pId) { @@ -400,11 +400,11 @@ LIBCOM_API void * epicsStdCall bucketLookupAndRemoveItemUnsignedId (BUCKET *prb, } LIBCOM_API void * epicsStdCall bucketLookupAndRemoveItemPointerId (BUCKET *prb, void * const *pId) { - return bucketLookupAndRemoveItem(prb, &BSET[bidtPointer], pId); + return bucketLookupAndRemoveItem(prb, &BSET[bidtPointer], pId); } LIBCOM_API void * epicsStdCall bucketLookupAndRemoveItemStringId (BUCKET *prb, const char *pId) { - return bucketLookupAndRemoveItem(prb, &BSET[bidtString], pId); + return bucketLookupAndRemoveItem(prb, &BSET[bidtString], pId); } @@ -412,19 +412,19 @@ LIBCOM_API void * epicsStdCall bucketLookupAndRemoveItemStringId (BUCKET *prb, c * bucketRemoveItem() */ LIBCOM_API int epicsStdCall - bucketRemoveItemUnsignedId (BUCKET *prb, const unsigned *pId) + bucketRemoveItemUnsignedId (BUCKET *prb, const unsigned *pId) { return bucketLookupAndRemoveItem(prb, &BSET[bidtUnsigned], pId)?S_bucket_success:S_bucket_uknId; } LIBCOM_API int epicsStdCall - bucketRemoveItemPointerId (BUCKET *prb, void * const *pId) + bucketRemoveItemPointerId (BUCKET *prb, void * const *pId) { - return bucketLookupAndRemoveItem(prb, &BSET[bidtPointer], pId)?S_bucket_success:S_bucket_uknId; + return bucketLookupAndRemoveItem(prb, &BSET[bidtPointer], pId)?S_bucket_success:S_bucket_uknId; } LIBCOM_API int epicsStdCall - bucketRemoveItemStringId (BUCKET *prb, const char *pId) + bucketRemoveItemStringId (BUCKET *prb, const char *pId) { - return bucketLookupAndRemoveItem(prb, &BSET[bidtString], pId)?S_bucket_success:S_bucket_uknId; + return bucketLookupAndRemoveItem(prb, &BSET[bidtString], pId)?S_bucket_success:S_bucket_uknId; } @@ -432,40 +432,40 @@ LIBCOM_API int epicsStdCall * bucketLookupItem() */ LIBCOM_API void * epicsStdCall - bucketLookupItemUnsignedId (BUCKET *prb, const unsigned *pId) + bucketLookupItemUnsignedId (BUCKET *prb, const unsigned *pId) { - return bucketLookupItem(prb, &BSET[bidtUnsigned], pId); + return bucketLookupItem(prb, &BSET[bidtUnsigned], pId); } LIBCOM_API void * epicsStdCall - bucketLookupItemPointerId (BUCKET *prb, void * const *pId) + bucketLookupItemPointerId (BUCKET *prb, void * const *pId) { - return bucketLookupItem(prb, &BSET[bidtPointer], pId); + return bucketLookupItem(prb, &BSET[bidtPointer], pId); } LIBCOM_API void * epicsStdCall - bucketLookupItemStringId (BUCKET *prb, const char *pId) + bucketLookupItemStringId (BUCKET *prb, const char *pId) { - return bucketLookupItem(prb, &BSET[bidtString], pId); + return bucketLookupItem(prb, &BSET[bidtString], pId); } static void *bucketLookupItem (BUCKET *pb, bucketSET *pBSET, const void *pId) { - BUCKETID hashid; - ITEM **ppi; + BUCKETID hashid; + ITEM **ppi; - /* - * create the hash index - */ - hashid = (*pBSET->pHash) (pb, pId); - assert((hashid & ~pb->hashIdMask) == 0); + /* + * create the hash index + */ + hashid = (*pBSET->pHash) (pb, pId); + assert((hashid & ~pb->hashIdMask) == 0); - /* - * at the bottom level just - * linear search for it. - */ - ppi = (*pBSET->pCompare) (&pb->pTable[hashid], pId); - if(ppi){ - return (void *) (*ppi)->pApp; - } - return NULL; + /* + * at the bottom level just + * linear search for it. + */ + ppi = (*pBSET->pCompare) (&pb->pTable[hashid], pId); + if(ppi){ + return (void *) (*ppi)->pApp; + } + return NULL; } @@ -475,47 +475,47 @@ static void *bucketLookupItem (BUCKET *pb, bucketSET *pBSET, const void *pId) */ LIBCOM_API int epicsStdCall bucketShow(BUCKET *pb) { - ITEM **ppi; - ITEM *pi; - unsigned nElem; - double X; - double XX; - double mean; - double stdDev; - unsigned count; - unsigned maxEntries; + ITEM **ppi; + ITEM *pi; + unsigned nElem; + double X; + double XX; + double mean; + double stdDev; + unsigned count; + unsigned maxEntries; - printf( " Bucket entries in use = %d bytes in use = %ld\n", - pb->nInUse, - (long) (sizeof(*pb)+(pb->hashIdMask+1)* - sizeof(ITEM *)+pb->nInUse*sizeof(ITEM))); + printf( " Bucket entries in use = %d bytes in use = %ld\n", + pb->nInUse, + (long) (sizeof(*pb)+(pb->hashIdMask+1)* + sizeof(ITEM *)+pb->nInUse*sizeof(ITEM))); - ppi = pb->pTable; - nElem = pb->hashIdMask+1; - X = 0.0; - XX = 0.0; - maxEntries = 0; - while (ppi < &pb->pTable[nElem]) { - pi = *ppi; - count = 0; - while (pi) { - count++; - pi = pi->pItem; - } - X += count; - XX += count*count; - if (count > maxEntries) maxEntries = count; - ppi++; - } + ppi = pb->pTable; + nElem = pb->hashIdMask+1; + X = 0.0; + XX = 0.0; + maxEntries = 0; + while (ppi < &pb->pTable[nElem]) { + pi = *ppi; + count = 0; + while (pi) { + count++; + pi = pi->pItem; + } + X += count; + XX += count*count; + if (count > maxEntries) maxEntries = count; + ppi++; + } - mean = X/nElem; - stdDev = sqrt(XX/nElem - mean*mean); - printf( " Bucket entries/hash id - mean = %f std dev = %f max = %d\n", - mean, - stdDev, - maxEntries); + mean = X/nElem; + stdDev = sqrt(XX/nElem - mean*mean); + printf( " Bucket entries/hash id - mean = %f std dev = %f max = %d\n", + mean, + stdDev, + maxEntries); - return S_bucket_success; + return S_bucket_success; } diff --git a/modules/libcom/src/bucketLib/bucketLib.h b/modules/libcom/src/bucketLib/bucketLib.h index 497f4f9e6..0bf84acd5 100644 --- a/modules/libcom/src/bucketLib/bucketLib.h +++ b/modules/libcom/src/bucketLib/bucketLib.h @@ -31,26 +31,26 @@ extern "C" { #include "libComAPI.h" /** \brief Internal: bucket identifier */ -typedef unsigned BUCKETID; +typedef unsigned BUCKETID; /** \brief Internal: bucket key type */ typedef enum {bidtUnsigned, bidtPointer, bidtString} buckTypeOfId; /** \brief Internal: bucket item structure */ typedef struct item{ - struct item *pItem; - const void *pId; - const void *pApp; - buckTypeOfId type; + struct item *pItem; + const void *pId; + const void *pApp; + buckTypeOfId type; }ITEM; /** \brief Internal: Hash table structure */ typedef struct bucket{ - ITEM **pTable; - void *freeListPVT; - unsigned hashIdMask; - unsigned hashIdNBits; - unsigned nInUse; + ITEM **pTable; + void *freeListPVT; + unsigned hashIdMask; + unsigned hashIdNBits; + unsigned nInUse; }BUCKET; /** * \brief Creates a new hash table @@ -80,7 +80,7 @@ LIBCOM_API int epicsStdCall bucketShow (BUCKET *prb); * \return Status value */ LIBCOM_API int epicsStdCall bucketAddItemUnsignedId (BUCKET *prb, - const unsigned *pId, const void *pApp); + const unsigned *pId, const void *pApp); /** * \brief Add an item identified by a pointer to the table * \param *prb Pointer to the hash table @@ -89,7 +89,7 @@ LIBCOM_API int epicsStdCall bucketAddItemUnsignedId (BUCKET *prb, * \return Status value */ LIBCOM_API int epicsStdCall bucketAddItemPointerId (BUCKET *prb, - void * const *pId, const void *pApp); + void * const *pId, const void *pApp); /** * \brief Add an item identified by a string to the table * \param *prb Pointer to the hash table @@ -98,7 +98,7 @@ LIBCOM_API int epicsStdCall bucketAddItemPointerId (BUCKET *prb, * \return Status value */ LIBCOM_API int epicsStdCall bucketAddItemStringId (BUCKET *prb, - const char *pId, const void *pApp); + const char *pId, const void *pApp); /** * \brief Remove an item identified by a string from the table * \param *prb Pointer to the hash table @@ -172,23 +172,23 @@ LIBCOM_API void * epicsStdCall bucketLookupAndRemoveItemStringId (BUCKET *prb, c /** * \brief A synonym for S_bucket_success */ -#define BUCKET_SUCCESS S_bucket_success +#define BUCKET_SUCCESS S_bucket_success /** * \brief Success, must be 0. */ -#define S_bucket_success 0 +#define S_bucket_success 0 /** * \brief Memory allocation failed */ -#define S_bucket_noMemory (M_bucket | 1) /*Memory allocation failed*/ +#define S_bucket_noMemory (M_bucket | 1) /*Memory allocation failed*/ /** * \brief Identifier already in use */ -#define S_bucket_idInUse (M_bucket | 2) /*Identifier already in use*/ +#define S_bucket_idInUse (M_bucket | 2) /*Identifier already in use*/ /** * \brief Unknown identifier */ -#define S_bucket_uknId (M_bucket | 3) /*Unknown identifier*/ +#define S_bucket_uknId (M_bucket | 3) /*Unknown identifier*/ /** @} */ #ifdef __cplusplus diff --git a/modules/libcom/src/calc/calcPerform.c b/modules/libcom/src/calc/calcPerform.c index f55cbbdd1..69178f2ee 100644 --- a/modules/libcom/src/calc/calcPerform.c +++ b/modules/libcom/src/calc/calcPerform.c @@ -4,11 +4,11 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* - * Author: Julie Sander and Bob Dalesio - * Date: 07-27-87 + * Author: Julie Sander and Bob Dalesio + * Date: 07-27-87 */ #include @@ -44,10 +44,10 @@ static int cond_search(const char **ppinst, int match); LIBCOM_API long calcPerform(double *parg, double *presult, const char *pinst) { - double stack[CALCPERFORM_STACK+1]; /* zero'th entry not used */ - double *ptop; /* stack pointer */ - double top; /* value from top of stack */ - epicsInt32 itop; /* integer from top of stack */ + double stack[CALCPERFORM_STACK+1]; /* zero'th entry not used */ + double *ptop; /* stack pointer */ + double top; /* value from top of stack */ + epicsInt32 itop; /* integer from top of stack */ int op; int nargs; @@ -56,235 +56,235 @@ LIBCOM_API long /* RPN evaluation loop */ while ((op = *pinst++) != END_EXPRESSION){ - switch (op){ + switch (op){ - case LITERAL_DOUBLE: - memcpy(++ptop, pinst, sizeof(double)); - pinst += sizeof(double); - break; + case LITERAL_DOUBLE: + memcpy(++ptop, pinst, sizeof(double)); + pinst += sizeof(double); + break; - case LITERAL_INT: - memcpy(&itop, pinst, sizeof(epicsInt32)); - *++ptop = itop; - pinst += sizeof(epicsInt32); - break; + case LITERAL_INT: + memcpy(&itop, pinst, sizeof(epicsInt32)); + *++ptop = itop; + pinst += sizeof(epicsInt32); + break; - case FETCH_VAL: - *++ptop = *presult; - break; + case FETCH_VAL: + *++ptop = *presult; + break; - case FETCH_A: - case FETCH_B: - case FETCH_C: - case FETCH_D: - case FETCH_E: - case FETCH_F: - case FETCH_G: - case FETCH_H: - case FETCH_I: - case FETCH_J: - case FETCH_K: - case FETCH_L: - *++ptop = parg[op - FETCH_A]; - break; + case FETCH_A: + case FETCH_B: + case FETCH_C: + case FETCH_D: + case FETCH_E: + case FETCH_F: + case FETCH_G: + case FETCH_H: + case FETCH_I: + case FETCH_J: + case FETCH_K: + case FETCH_L: + *++ptop = parg[op - FETCH_A]; + break; - case STORE_A: - case STORE_B: - case STORE_C: - case STORE_D: - case STORE_E: - case STORE_F: - case STORE_G: - case STORE_H: - case STORE_I: - case STORE_J: - case STORE_K: - case STORE_L: - parg[op - STORE_A] = *ptop--; - break; + case STORE_A: + case STORE_B: + case STORE_C: + case STORE_D: + case STORE_E: + case STORE_F: + case STORE_G: + case STORE_H: + case STORE_I: + case STORE_J: + case STORE_K: + case STORE_L: + parg[op - STORE_A] = *ptop--; + break; - case CONST_PI: - *++ptop = PI; - break; + case CONST_PI: + *++ptop = PI; + break; - case CONST_D2R: - *++ptop = PI/180.; - break; + case CONST_D2R: + *++ptop = PI/180.; + break; - case CONST_R2D: - *++ptop = 180./PI; - break; + case CONST_R2D: + *++ptop = 180./PI; + break; - case UNARY_NEG: - *ptop = - *ptop; - break; + case UNARY_NEG: + *ptop = - *ptop; + break; - case ADD: - top = *ptop--; - *ptop += top; - break; + case ADD: + top = *ptop--; + *ptop += top; + break; - case SUB: - top = *ptop--; - *ptop -= top; - break; + case SUB: + top = *ptop--; + *ptop -= top; + break; - case MULT: - top = *ptop--; - *ptop *= top; - break; + case MULT: + top = *ptop--; + *ptop *= top; + break; - case DIV: - top = *ptop--; - *ptop /= top; - break; + case DIV: + top = *ptop--; + *ptop /= top; + break; - case MODULO: - itop = (epicsInt32) *ptop--; - if (itop) - *ptop = (epicsInt32) *ptop % itop; - else - *ptop = epicsNAN; - break; + case MODULO: + itop = (epicsInt32) *ptop--; + if (itop) + *ptop = (epicsInt32) *ptop % itop; + else + *ptop = epicsNAN; + break; - case POWER: - top = *ptop--; - *ptop = pow(*ptop, top); - break; + case POWER: + top = *ptop--; + *ptop = pow(*ptop, top); + break; - case ABS_VAL: - *ptop = fabs(*ptop); - break; + case ABS_VAL: + *ptop = fabs(*ptop); + break; - case EXP: - *ptop = exp(*ptop); - break; + case EXP: + *ptop = exp(*ptop); + break; - case LOG_10: - *ptop = log10(*ptop); - break; + case LOG_10: + *ptop = log10(*ptop); + break; - case LOG_E: - *ptop = log(*ptop); - break; + case LOG_E: + *ptop = log(*ptop); + break; - case MAX: - nargs = *pinst++; - while (--nargs) { - top = *ptop--; - if (*ptop < top || isnan(top)) - *ptop = top; - } - break; + case MAX: + nargs = *pinst++; + while (--nargs) { + top = *ptop--; + if (*ptop < top || isnan(top)) + *ptop = top; + } + break; - case MIN: - nargs = *pinst++; - while (--nargs) { - top = *ptop--; - if (*ptop > top || isnan(top)) - *ptop = top; - } - break; + case MIN: + nargs = *pinst++; + while (--nargs) { + top = *ptop--; + if (*ptop > top || isnan(top)) + *ptop = top; + } + break; - case SQU_RT: - *ptop = sqrt(*ptop); - break; + case SQU_RT: + *ptop = sqrt(*ptop); + break; - case ACOS: - *ptop = acos(*ptop); - break; + case ACOS: + *ptop = acos(*ptop); + break; - case ASIN: - *ptop = asin(*ptop); - break; + case ASIN: + *ptop = asin(*ptop); + break; - case ATAN: - *ptop = atan(*ptop); - break; + case ATAN: + *ptop = atan(*ptop); + break; - case ATAN2: - top = *ptop--; - *ptop = atan2(top, *ptop); /* Ouch!: Args backwards! */ - break; + case ATAN2: + top = *ptop--; + *ptop = atan2(top, *ptop); /* Ouch!: Args backwards! */ + break; - case COS: - *ptop = cos(*ptop); - break; + case COS: + *ptop = cos(*ptop); + break; - case SIN: - *ptop = sin(*ptop); - break; + case SIN: + *ptop = sin(*ptop); + break; - case TAN: - *ptop = tan(*ptop); - break; + case TAN: + *ptop = tan(*ptop); + break; - case COSH: - *ptop = cosh(*ptop); - break; + case COSH: + *ptop = cosh(*ptop); + break; - case SINH: - *ptop = sinh(*ptop); - break; + case SINH: + *ptop = sinh(*ptop); + break; - case TANH: - *ptop = tanh(*ptop); - break; + case TANH: + *ptop = tanh(*ptop); + break; - case CEIL: - *ptop = ceil(*ptop); - break; + case CEIL: + *ptop = ceil(*ptop); + break; - case FLOOR: - *ptop = floor(*ptop); - break; + case FLOOR: + *ptop = floor(*ptop); + break; - case FINITE: - nargs = *pinst++; - top = finite(*ptop); - while (--nargs) { - --ptop; - top = top && finite(*ptop); - } - *ptop = top; - break; + case FINITE: + nargs = *pinst++; + top = finite(*ptop); + while (--nargs) { + --ptop; + top = top && finite(*ptop); + } + *ptop = top; + break; - case ISINF: - *ptop = isinf(*ptop); - break; + case ISINF: + *ptop = isinf(*ptop); + break; - case ISNAN: - nargs = *pinst++; - top = isnan(*ptop); - while (--nargs) { - --ptop; - top = top || isnan(*ptop); - } - *ptop = top; - break; + case ISNAN: + nargs = *pinst++; + top = isnan(*ptop); + while (--nargs) { + --ptop; + top = top || isnan(*ptop); + } + *ptop = top; + break; - case NINT: - top = *ptop; - *ptop = (epicsInt32) (top >= 0 ? top + 0.5 : top - 0.5); - break; + case NINT: + top = *ptop; + *ptop = (epicsInt32) (top >= 0 ? top + 0.5 : top - 0.5); + break; - case RANDOM: - *++ptop = calcRandom(); - break; + case RANDOM: + *++ptop = calcRandom(); + break; - case REL_OR: - top = *ptop--; - *ptop = *ptop || top; - break; + case REL_OR: + top = *ptop--; + *ptop = *ptop || top; + break; - case REL_AND: - top = *ptop--; - *ptop = *ptop && top; - break; + case REL_AND: + top = *ptop--; + *ptop = *ptop && top; + break; - case REL_NOT: - *ptop = ! *ptop; - break; + case REL_NOT: + *ptop = ! *ptop; + break; /* Be VERY careful converting double to int in case bit 31 is set! * Out-of-range errors give very different results on different sytems. @@ -300,24 +300,24 @@ LIBCOM_API long #define d2i(x) ((x)<0?(epicsInt32)(x):(epicsInt32)(epicsUInt32)(x)) #define d2ui(x) ((x)<0?(epicsUInt32)(epicsInt32)(x):(epicsUInt32)(x)) - case BIT_OR: - top = *ptop--; - *ptop = (double)(d2i(*ptop) | d2i(top)); - break; + case BIT_OR: + top = *ptop--; + *ptop = (double)(d2i(*ptop) | d2i(top)); + break; - case BIT_AND: - top = *ptop--; - *ptop = (double)(d2i(*ptop) & d2i(top)); - break; + case BIT_AND: + top = *ptop--; + *ptop = (double)(d2i(*ptop) & d2i(top)); + break; - case BIT_EXCL_OR: - top = *ptop--; - *ptop = (double)(d2i(*ptop) ^ d2i(top)); - break; + case BIT_EXCL_OR: + top = *ptop--; + *ptop = (double)(d2i(*ptop) ^ d2i(top)); + break; - case BIT_NOT: - *ptop = (double)~d2i(*ptop); - break; + case BIT_NOT: + *ptop = (double)~d2i(*ptop); + break; /* In C the shift operators decide on an arithmetic or logical shift * based on whether the integer is signed or unsigned. @@ -327,72 +327,72 @@ LIBCOM_API long * double-casting through signed/unsigned here is important, see above. */ - case RIGHT_SHIFT_ARITH: - top = *ptop--; - *ptop = (double)(d2i(*ptop) >> (d2i(top) & 31)); - break; + case RIGHT_SHIFT_ARITH: + top = *ptop--; + *ptop = (double)(d2i(*ptop) >> (d2i(top) & 31)); + break; - case LEFT_SHIFT_ARITH: - top = *ptop--; - *ptop = (double)(d2i(*ptop) << (d2i(top) & 31)); - break; + case LEFT_SHIFT_ARITH: + top = *ptop--; + *ptop = (double)(d2i(*ptop) << (d2i(top) & 31)); + break; - case RIGHT_SHIFT_LOGIC: - top = *ptop--; - *ptop = (double)(d2ui(*ptop) >> (d2ui(top) & 31u)); - break; + case RIGHT_SHIFT_LOGIC: + top = *ptop--; + *ptop = (double)(d2ui(*ptop) >> (d2ui(top) & 31u)); + break; - case NOT_EQ: - top = *ptop--; - *ptop = *ptop != top; - break; + case NOT_EQ: + top = *ptop--; + *ptop = *ptop != top; + break; - case LESS_THAN: - top = *ptop--; - *ptop = *ptop < top; - break; + case LESS_THAN: + top = *ptop--; + *ptop = *ptop < top; + break; - case LESS_OR_EQ: - top = *ptop--; - *ptop = *ptop <= top; - break; + case LESS_OR_EQ: + top = *ptop--; + *ptop = *ptop <= top; + break; - case EQUAL: - top = *ptop--; - *ptop = *ptop == top; - break; + case EQUAL: + top = *ptop--; + *ptop = *ptop == top; + break; - case GR_OR_EQ: - top = *ptop--; - *ptop = *ptop >= top; - break; + case GR_OR_EQ: + top = *ptop--; + *ptop = *ptop >= top; + break; - case GR_THAN: - top = *ptop--; - *ptop = *ptop > top; - break; + case GR_THAN: + top = *ptop--; + *ptop = *ptop > top; + break; - case COND_IF: - if (*ptop-- == 0.0 && - cond_search(&pinst, COND_ELSE)) return -1; - break; + case COND_IF: + if (*ptop-- == 0.0 && + cond_search(&pinst, COND_ELSE)) return -1; + break; - case COND_ELSE: - if (cond_search(&pinst, COND_END)) return -1; - break; + case COND_ELSE: + if (cond_search(&pinst, COND_END)) return -1; + break; - case COND_END: - break; + case COND_END: + break; - default: - errlogPrintf("calcPerform: Bad Opcode %d at %p\n", op, pinst-1); - return -1; - } + default: + errlogPrintf("calcPerform: Bad Opcode %d at %p\n", op, pinst-1); + return -1; + } } /* The stack should now have one item on it, the expression value */ if (ptop != stack + 1) - return -1; + return -1; *presult = *ptop; return 0; } @@ -408,55 +408,55 @@ calcArgUsage(const char *pinst, unsigned long *pinputs, unsigned long *pstores) unsigned long stores = 0; char op; while ((op = *pinst++) != END_EXPRESSION) { - switch (op) { + switch (op) { - case LITERAL_DOUBLE: - pinst += sizeof(double); - break; - case LITERAL_INT: - pinst += sizeof(epicsInt32); - break; - case MIN: - case MAX: - case FINITE: - case ISNAN: - pinst++; - break; + case LITERAL_DOUBLE: + pinst += sizeof(double); + break; + case LITERAL_INT: + pinst += sizeof(epicsInt32); + break; + case MIN: + case MAX: + case FINITE: + case ISNAN: + pinst++; + break; - case FETCH_A: - case FETCH_B: - case FETCH_C: - case FETCH_D: - case FETCH_E: - case FETCH_F: - case FETCH_G: - case FETCH_H: - case FETCH_I: - case FETCH_J: - case FETCH_K: - case FETCH_L: - /* Don't claim to use an arg we already stored to */ - inputs |= (1 << (op - FETCH_A)) & ~stores; - break; + case FETCH_A: + case FETCH_B: + case FETCH_C: + case FETCH_D: + case FETCH_E: + case FETCH_F: + case FETCH_G: + case FETCH_H: + case FETCH_I: + case FETCH_J: + case FETCH_K: + case FETCH_L: + /* Don't claim to use an arg we already stored to */ + inputs |= (1 << (op - FETCH_A)) & ~stores; + break; - case STORE_A: - case STORE_B: - case STORE_C: - case STORE_D: - case STORE_E: - case STORE_F: - case STORE_G: - case STORE_H: - case STORE_I: - case STORE_J: - case STORE_K: - case STORE_L: - stores |= (1 << (op - STORE_A)); - break; + case STORE_A: + case STORE_B: + case STORE_C: + case STORE_D: + case STORE_E: + case STORE_F: + case STORE_G: + case STORE_H: + case STORE_I: + case STORE_J: + case STORE_K: + case STORE_L: + stores |= (1 << (op - STORE_A)); + break; - default: - break; - } + default: + break; + } } if (pinputs) *pinputs = inputs; if (pstores) *pstores = stores; @@ -492,27 +492,27 @@ static int cond_search(const char **ppinst, int match) int op; while ((op = *pinst++) != END_EXPRESSION) { - if (op == match && --count == 0) { - *ppinst = pinst; - return 0; - } - switch (op) { - case LITERAL_DOUBLE: - pinst += sizeof(double); - break; - case LITERAL_INT: - pinst += sizeof(epicsInt32); - break; - case MIN: - case MAX: - case FINITE: - case ISNAN: - pinst++; - break; - case COND_IF: - count++; - break; - } + if (op == match && --count == 0) { + *ppinst = pinst; + return 0; + } + switch (op) { + case LITERAL_DOUBLE: + pinst += sizeof(double); + break; + case LITERAL_INT: + pinst += sizeof(epicsInt32); + break; + case MIN: + case MAX: + case FINITE: + case ISNAN: + pinst++; + break; + case COND_IF: + count++; + break; + } } return 1; } diff --git a/modules/libcom/src/calc/postfix.c b/modules/libcom/src/calc/postfix.c index d034c1d0f..d96b1b5a6 100644 --- a/modules/libcom/src/calc/postfix.c +++ b/modules/libcom/src/calc/postfix.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Subroutines used to convert an infix expression to a postfix expression @@ -31,16 +31,16 @@ /* element types */ typedef enum { - OPERAND, - LITERAL_OPERAND, - STORE_OPERATOR, - UNARY_OPERATOR, - VARARG_OPERATOR, - BINARY_OPERATOR, - SEPERATOR, - CLOSE_PAREN, - CONDITIONAL, - EXPR_TERMINATOR, + OPERAND, + LITERAL_OPERAND, + STORE_OPERATOR, + UNARY_OPERATOR, + VARARG_OPERATOR, + BINARY_OPERATOR, + SEPERATOR, + CLOSE_PAREN, + CONDITIONAL, + EXPR_TERMINATOR, } element_type; @@ -49,12 +49,12 @@ typedef enum { * structure of an element */ typedef struct expression_element{ - char *name; /* character representation of an element */ - char in_stack_pri; /* priority on translation stack */ + char *name; /* character representation of an element */ + char in_stack_pri; /* priority on translation stack */ char in_coming_pri; /* priority in input string */ signed char runtime_effect; /* stack change, positive means push */ - element_type type; /* element type */ - rpn_opcode code; /* postfix opcode */ + element_type type; /* element type */ + rpn_opcode code; /* postfix opcode */ } ELEMENT; /* @@ -65,103 +65,103 @@ typedef struct expression_element{ * routine at the end of this file. */ static const ELEMENT operands[] = { -/* name prio's stack element type opcode */ -{"!", 7, 8, 0, UNARY_OPERATOR, REL_NOT}, -{"(", 0, 8, 0, UNARY_OPERATOR, NOT_GENERATED}, -{"-", 7, 8, 0, UNARY_OPERATOR, UNARY_NEG}, -{".", 0, 0, 1, LITERAL_OPERAND,LITERAL_DOUBLE}, -{"0", 0, 0, 1, LITERAL_OPERAND,LITERAL_DOUBLE}, -{"0X", 0, 0, 1, LITERAL_OPERAND,LITERAL_INT}, -{"1", 0, 0, 1, LITERAL_OPERAND,LITERAL_DOUBLE}, -{"2", 0, 0, 1, LITERAL_OPERAND,LITERAL_DOUBLE}, -{"3", 0, 0, 1, LITERAL_OPERAND,LITERAL_DOUBLE}, -{"4", 0, 0, 1, LITERAL_OPERAND,LITERAL_DOUBLE}, -{"5", 0, 0, 1, LITERAL_OPERAND,LITERAL_DOUBLE}, -{"6", 0, 0, 1, LITERAL_OPERAND,LITERAL_DOUBLE}, -{"7", 0, 0, 1, LITERAL_OPERAND,LITERAL_DOUBLE}, -{"8", 0, 0, 1, LITERAL_OPERAND,LITERAL_DOUBLE}, -{"9", 0, 0, 1, LITERAL_OPERAND,LITERAL_DOUBLE}, -{"A", 0, 0, 1, OPERAND, FETCH_A}, -{"ABS", 7, 8, 0, UNARY_OPERATOR, ABS_VAL}, -{"ACOS", 7, 8, 0, UNARY_OPERATOR, ACOS}, -{"ASIN", 7, 8, 0, UNARY_OPERATOR, ASIN}, -{"ATAN", 7, 8, 0, UNARY_OPERATOR, ATAN}, -{"ATAN2", 7, 8, -1, UNARY_OPERATOR, ATAN2}, -{"B", 0, 0, 1, OPERAND, FETCH_B}, -{"C", 0, 0, 1, OPERAND, FETCH_C}, -{"CEIL", 7, 8, 0, UNARY_OPERATOR, CEIL}, -{"COS", 7, 8, 0, UNARY_OPERATOR, COS}, -{"COSH", 7, 8, 0, UNARY_OPERATOR, COSH}, -{"D", 0, 0, 1, OPERAND, FETCH_D}, -{"D2R", 0, 0, 1, OPERAND, CONST_D2R}, -{"E", 0, 0, 1, OPERAND, FETCH_E}, -{"EXP", 7, 8, 0, UNARY_OPERATOR, EXP}, -{"F", 0, 0, 1, OPERAND, FETCH_F}, -{"FINITE", 7, 8, 0, VARARG_OPERATOR,FINITE}, -{"FLOOR", 7, 8, 0, UNARY_OPERATOR, FLOOR}, -{"G", 0, 0, 1, OPERAND, FETCH_G}, -{"H", 0, 0, 1, OPERAND, FETCH_H}, -{"I", 0, 0, 1, OPERAND, FETCH_I}, -{"INF", 0, 0, 1, LITERAL_OPERAND,LITERAL_DOUBLE}, -{"ISINF", 7, 8, 0, UNARY_OPERATOR, ISINF}, -{"ISNAN", 7, 8, 0, VARARG_OPERATOR,ISNAN}, -{"J", 0, 0, 1, OPERAND, FETCH_J}, -{"K", 0, 0, 1, OPERAND, FETCH_K}, -{"L", 0, 0, 1, OPERAND, FETCH_L}, -{"LN", 7, 8, 0, UNARY_OPERATOR, LOG_E}, -{"LOG", 7, 8, 0, UNARY_OPERATOR, LOG_10}, -{"LOGE", 7, 8, 0, UNARY_OPERATOR, LOG_E}, -{"MAX", 7, 8, 0, VARARG_OPERATOR,MAX}, -{"MIN", 7, 8, 0, VARARG_OPERATOR,MIN}, -{"NINT", 7, 8, 0, UNARY_OPERATOR, NINT}, -{"NAN", 0, 0, 1, LITERAL_OPERAND,LITERAL_DOUBLE}, -{"NOT", 7, 8, 0, UNARY_OPERATOR, BIT_NOT}, -{"PI", 0, 0, 1, OPERAND, CONST_PI}, -{"R2D", 0, 0, 1, OPERAND, CONST_R2D}, -{"RNDM", 0, 0, 1, OPERAND, RANDOM}, -{"SIN", 7, 8, 0, UNARY_OPERATOR, SIN}, -{"SINH", 7, 8, 0, UNARY_OPERATOR, SINH}, -{"SQR", 7, 8, 0, UNARY_OPERATOR, SQU_RT}, -{"SQRT", 7, 8, 0, UNARY_OPERATOR, SQU_RT}, -{"TAN", 7, 8, 0, UNARY_OPERATOR, TAN}, -{"TANH", 7, 8, 0, UNARY_OPERATOR, TANH}, -{"VAL", 0, 0, 1, OPERAND, FETCH_VAL}, -{"~", 7, 8, 0, UNARY_OPERATOR, BIT_NOT}, +/* name prio's stack element type opcode */ +{"!", 7, 8, 0, UNARY_OPERATOR, REL_NOT}, +{"(", 0, 8, 0, UNARY_OPERATOR, NOT_GENERATED}, +{"-", 7, 8, 0, UNARY_OPERATOR, UNARY_NEG}, +{".", 0, 0, 1, LITERAL_OPERAND,LITERAL_DOUBLE}, +{"0", 0, 0, 1, LITERAL_OPERAND,LITERAL_DOUBLE}, +{"0X", 0, 0, 1, LITERAL_OPERAND,LITERAL_INT}, +{"1", 0, 0, 1, LITERAL_OPERAND,LITERAL_DOUBLE}, +{"2", 0, 0, 1, LITERAL_OPERAND,LITERAL_DOUBLE}, +{"3", 0, 0, 1, LITERAL_OPERAND,LITERAL_DOUBLE}, +{"4", 0, 0, 1, LITERAL_OPERAND,LITERAL_DOUBLE}, +{"5", 0, 0, 1, LITERAL_OPERAND,LITERAL_DOUBLE}, +{"6", 0, 0, 1, LITERAL_OPERAND,LITERAL_DOUBLE}, +{"7", 0, 0, 1, LITERAL_OPERAND,LITERAL_DOUBLE}, +{"8", 0, 0, 1, LITERAL_OPERAND,LITERAL_DOUBLE}, +{"9", 0, 0, 1, LITERAL_OPERAND,LITERAL_DOUBLE}, +{"A", 0, 0, 1, OPERAND, FETCH_A}, +{"ABS", 7, 8, 0, UNARY_OPERATOR, ABS_VAL}, +{"ACOS", 7, 8, 0, UNARY_OPERATOR, ACOS}, +{"ASIN", 7, 8, 0, UNARY_OPERATOR, ASIN}, +{"ATAN", 7, 8, 0, UNARY_OPERATOR, ATAN}, +{"ATAN2", 7, 8, -1, UNARY_OPERATOR, ATAN2}, +{"B", 0, 0, 1, OPERAND, FETCH_B}, +{"C", 0, 0, 1, OPERAND, FETCH_C}, +{"CEIL", 7, 8, 0, UNARY_OPERATOR, CEIL}, +{"COS", 7, 8, 0, UNARY_OPERATOR, COS}, +{"COSH", 7, 8, 0, UNARY_OPERATOR, COSH}, +{"D", 0, 0, 1, OPERAND, FETCH_D}, +{"D2R", 0, 0, 1, OPERAND, CONST_D2R}, +{"E", 0, 0, 1, OPERAND, FETCH_E}, +{"EXP", 7, 8, 0, UNARY_OPERATOR, EXP}, +{"F", 0, 0, 1, OPERAND, FETCH_F}, +{"FINITE", 7, 8, 0, VARARG_OPERATOR,FINITE}, +{"FLOOR", 7, 8, 0, UNARY_OPERATOR, FLOOR}, +{"G", 0, 0, 1, OPERAND, FETCH_G}, +{"H", 0, 0, 1, OPERAND, FETCH_H}, +{"I", 0, 0, 1, OPERAND, FETCH_I}, +{"INF", 0, 0, 1, LITERAL_OPERAND,LITERAL_DOUBLE}, +{"ISINF", 7, 8, 0, UNARY_OPERATOR, ISINF}, +{"ISNAN", 7, 8, 0, VARARG_OPERATOR,ISNAN}, +{"J", 0, 0, 1, OPERAND, FETCH_J}, +{"K", 0, 0, 1, OPERAND, FETCH_K}, +{"L", 0, 0, 1, OPERAND, FETCH_L}, +{"LN", 7, 8, 0, UNARY_OPERATOR, LOG_E}, +{"LOG", 7, 8, 0, UNARY_OPERATOR, LOG_10}, +{"LOGE", 7, 8, 0, UNARY_OPERATOR, LOG_E}, +{"MAX", 7, 8, 0, VARARG_OPERATOR,MAX}, +{"MIN", 7, 8, 0, VARARG_OPERATOR,MIN}, +{"NINT", 7, 8, 0, UNARY_OPERATOR, NINT}, +{"NAN", 0, 0, 1, LITERAL_OPERAND,LITERAL_DOUBLE}, +{"NOT", 7, 8, 0, UNARY_OPERATOR, BIT_NOT}, +{"PI", 0, 0, 1, OPERAND, CONST_PI}, +{"R2D", 0, 0, 1, OPERAND, CONST_R2D}, +{"RNDM", 0, 0, 1, OPERAND, RANDOM}, +{"SIN", 7, 8, 0, UNARY_OPERATOR, SIN}, +{"SINH", 7, 8, 0, UNARY_OPERATOR, SINH}, +{"SQR", 7, 8, 0, UNARY_OPERATOR, SQU_RT}, +{"SQRT", 7, 8, 0, UNARY_OPERATOR, SQU_RT}, +{"TAN", 7, 8, 0, UNARY_OPERATOR, TAN}, +{"TANH", 7, 8, 0, UNARY_OPERATOR, TANH}, +{"VAL", 0, 0, 1, OPERAND, FETCH_VAL}, +{"~", 7, 8, 0, UNARY_OPERATOR, BIT_NOT}, }; static const ELEMENT operators[] = { -/* name prio's stack element type opcode */ -{"!=", 3, 3, -1, BINARY_OPERATOR,NOT_EQ}, -{"#", 3, 3, -1, BINARY_OPERATOR,NOT_EQ}, -{"%", 5, 5, -1, BINARY_OPERATOR,MODULO}, -{"&", 2, 2, -1, BINARY_OPERATOR,BIT_AND}, -{"&&", 2, 2, -1, BINARY_OPERATOR,REL_AND}, -{")", 0, 0, 0, CLOSE_PAREN, NOT_GENERATED}, -{"*", 5, 5, -1, BINARY_OPERATOR,MULT}, -{"**", 6, 6, -1, BINARY_OPERATOR,POWER}, -{"+", 4, 4, -1, BINARY_OPERATOR,ADD}, -{",", 0, 0, 0, SEPERATOR, NOT_GENERATED}, -{"-", 4, 4, -1, BINARY_OPERATOR,SUB}, -{"/", 5, 5, -1, BINARY_OPERATOR,DIV}, -{":", 0, 0, -1, CONDITIONAL, COND_ELSE}, -{":=", 0, 0, -1, STORE_OPERATOR, STORE_A}, -{";", 0, 0, 0, EXPR_TERMINATOR,NOT_GENERATED}, -{"<", 3, 3, -1, BINARY_OPERATOR,LESS_THAN}, -{"<<", 2, 2, -1, BINARY_OPERATOR,LEFT_SHIFT_ARITH}, -{"<=", 3, 3, -1, BINARY_OPERATOR,LESS_OR_EQ}, -{"=", 3, 3, -1, BINARY_OPERATOR,EQUAL}, -{"==", 3, 3, -1, BINARY_OPERATOR,EQUAL}, -{">", 3, 3, -1, BINARY_OPERATOR,GR_THAN}, -{">=", 3, 3, -1, BINARY_OPERATOR,GR_OR_EQ}, -{">>", 2, 2, -1, BINARY_OPERATOR,RIGHT_SHIFT_ARITH}, -{">>>", 2, 2, -1, BINARY_OPERATOR,RIGHT_SHIFT_LOGIC}, -{"?", 0, 0, -1, CONDITIONAL, COND_IF}, -{"AND", 2, 2, -1, BINARY_OPERATOR,BIT_AND}, -{"OR", 1, 1, -1, BINARY_OPERATOR,BIT_OR}, -{"XOR", 1, 1, -1, BINARY_OPERATOR,BIT_EXCL_OR}, -{"^", 6, 6, -1, BINARY_OPERATOR,POWER}, -{"|", 1, 1, -1, BINARY_OPERATOR,BIT_OR}, -{"||", 1, 1, -1, BINARY_OPERATOR,REL_OR}, +/* name prio's stack element type opcode */ +{"!=", 3, 3, -1, BINARY_OPERATOR,NOT_EQ}, +{"#", 3, 3, -1, BINARY_OPERATOR,NOT_EQ}, +{"%", 5, 5, -1, BINARY_OPERATOR,MODULO}, +{"&", 2, 2, -1, BINARY_OPERATOR,BIT_AND}, +{"&&", 2, 2, -1, BINARY_OPERATOR,REL_AND}, +{")", 0, 0, 0, CLOSE_PAREN, NOT_GENERATED}, +{"*", 5, 5, -1, BINARY_OPERATOR,MULT}, +{"**", 6, 6, -1, BINARY_OPERATOR,POWER}, +{"+", 4, 4, -1, BINARY_OPERATOR,ADD}, +{",", 0, 0, 0, SEPERATOR, NOT_GENERATED}, +{"-", 4, 4, -1, BINARY_OPERATOR,SUB}, +{"/", 5, 5, -1, BINARY_OPERATOR,DIV}, +{":", 0, 0, -1, CONDITIONAL, COND_ELSE}, +{":=", 0, 0, -1, STORE_OPERATOR, STORE_A}, +{";", 0, 0, 0, EXPR_TERMINATOR,NOT_GENERATED}, +{"<", 3, 3, -1, BINARY_OPERATOR,LESS_THAN}, +{"<<", 2, 2, -1, BINARY_OPERATOR,LEFT_SHIFT_ARITH}, +{"<=", 3, 3, -1, BINARY_OPERATOR,LESS_OR_EQ}, +{"=", 3, 3, -1, BINARY_OPERATOR,EQUAL}, +{"==", 3, 3, -1, BINARY_OPERATOR,EQUAL}, +{">", 3, 3, -1, BINARY_OPERATOR,GR_THAN}, +{">=", 3, 3, -1, BINARY_OPERATOR,GR_OR_EQ}, +{">>", 2, 2, -1, BINARY_OPERATOR,RIGHT_SHIFT_ARITH}, +{">>>", 2, 2, -1, BINARY_OPERATOR,RIGHT_SHIFT_LOGIC}, +{"?", 0, 0, -1, CONDITIONAL, COND_IF}, +{"AND", 2, 2, -1, BINARY_OPERATOR,BIT_AND}, +{"OR", 1, 1, -1, BINARY_OPERATOR,BIT_OR}, +{"XOR", 1, 1, -1, BINARY_OPERATOR,BIT_EXCL_OR}, +{"^", 6, 6, -1, BINARY_OPERATOR,POWER}, +{"|", 1, 1, -1, BINARY_OPERATOR,BIT_OR}, +{"||", 1, 1, -1, BINARY_OPERATOR,REL_OR}, }; @@ -180,22 +180,22 @@ static int if (**ppsrc == '\0') return FALSE; if (opnd) { - ptable = operands; - pel = ptable + NELEMENTS(operands) - 1; + ptable = operands; + pel = ptable + NELEMENTS(operands) - 1; } else { - ptable = operators; - pel = ptable + NELEMENTS(operators) - 1; + ptable = operators; + pel = ptable + NELEMENTS(operators) - 1; } while (pel >= ptable) { - size_t len = strlen(pel->name); + size_t len = strlen(pel->name); - if (epicsStrnCaseCmp(*ppsrc, pel->name, len) == 0) { - *ppel = pel; - *ppsrc += len; - return TRUE; - } - --pel; + if (epicsStrnCaseCmp(*ppsrc, pel->name, len) == 0) { + *ppel = pel; + *ppsrc += len; + return TRUE; + } + --pel; } return FALSE; } @@ -218,10 +218,10 @@ LIBCOM_API long char *pnext; if (psrc == NULL || *psrc == '\0' || - pout == NULL || perror == NULL) { - if (perror) *perror = CALC_ERR_NULL_ARG; - if (pout) *pout = END_EXPRESSION; - return -1; + pout == NULL || perror == NULL) { + if (perror) *perror = CALC_ERR_NULL_ARG; + if (pout) *pout = END_EXPRESSION; + return -1; } /* place the expression elements into postfix */ @@ -229,13 +229,13 @@ LIBCOM_API long *perror = CALC_ERR_NONE; while (get_element(operand_needed, &psrc, &pel)) { - switch (pel->type) { + switch (pel->type) { - case OPERAND: - *pout++ = pel->code; - runtime_depth += pel->runtime_effect; - operand_needed = FALSE; - break; + case OPERAND: + *pout++ = pel->code; + runtime_depth += pel->runtime_effect; + operand_needed = FALSE; + break; case LITERAL_OPERAND: runtime_depth += pel->runtime_effect; @@ -278,204 +278,204 @@ LIBCOM_API long operand_needed = FALSE; break; - case STORE_OPERATOR: - if (pout == pdest || pstacktop > stack || - *--pout < FETCH_A || *pout > FETCH_L) { - *perror = CALC_ERR_BAD_ASSIGNMENT; - goto bad; - } - /* Convert fetch into a store on the stack */ - *++pstacktop = *pel; - pstacktop->code = STORE_A + *pout - FETCH_A; - runtime_depth -= 1; - operand_needed = TRUE; - break; + case STORE_OPERATOR: + if (pout == pdest || pstacktop > stack || + *--pout < FETCH_A || *pout > FETCH_L) { + *perror = CALC_ERR_BAD_ASSIGNMENT; + goto bad; + } + /* Convert fetch into a store on the stack */ + *++pstacktop = *pel; + pstacktop->code = STORE_A + *pout - FETCH_A; + runtime_depth -= 1; + operand_needed = TRUE; + break; - case UNARY_OPERATOR: - case VARARG_OPERATOR: - /* Move operators of >= priority to the output */ - while ((pstacktop > stack) && - (pstacktop->in_stack_pri >= pel->in_coming_pri)) { - *pout++ = pstacktop->code; - if (pstacktop->type == VARARG_OPERATOR) { - *pout++ = 1 - pstacktop->runtime_effect; - } - runtime_depth += pstacktop->runtime_effect; - pstacktop--; - } + case UNARY_OPERATOR: + case VARARG_OPERATOR: + /* Move operators of >= priority to the output */ + while ((pstacktop > stack) && + (pstacktop->in_stack_pri >= pel->in_coming_pri)) { + *pout++ = pstacktop->code; + if (pstacktop->type == VARARG_OPERATOR) { + *pout++ = 1 - pstacktop->runtime_effect; + } + runtime_depth += pstacktop->runtime_effect; + pstacktop--; + } - /* Push new operator onto stack */ - pstacktop++; - *pstacktop = *pel; - break; + /* Push new operator onto stack */ + pstacktop++; + *pstacktop = *pel; + break; - case BINARY_OPERATOR: - /* Move operators of >= priority to the output */ - while ((pstacktop > stack) && - (pstacktop->in_stack_pri >= pel->in_coming_pri)) { - *pout++ = pstacktop->code; - if (pstacktop->type == VARARG_OPERATOR) { - *pout++ = 1 - pstacktop->runtime_effect; - } - runtime_depth += pstacktop->runtime_effect; - pstacktop--; - } + case BINARY_OPERATOR: + /* Move operators of >= priority to the output */ + while ((pstacktop > stack) && + (pstacktop->in_stack_pri >= pel->in_coming_pri)) { + *pout++ = pstacktop->code; + if (pstacktop->type == VARARG_OPERATOR) { + *pout++ = 1 - pstacktop->runtime_effect; + } + runtime_depth += pstacktop->runtime_effect; + pstacktop--; + } - /* Push new operator onto stack */ - pstacktop++; - *pstacktop = *pel; + /* Push new operator onto stack */ + pstacktop++; + *pstacktop = *pel; - operand_needed = TRUE; - break; + operand_needed = TRUE; + break; - case SEPERATOR: - /* Move operators to the output until open paren */ - while (pstacktop->name[0] != '(') { - if (pstacktop <= stack+1) { - *perror = CALC_ERR_BAD_SEPERATOR; - goto bad; - } - *pout++ = pstacktop->code; - if (pstacktop->type == VARARG_OPERATOR) { - *pout++ = 1 - pstacktop->runtime_effect; - } - runtime_depth += pstacktop->runtime_effect; - pstacktop--; - } - operand_needed = TRUE; - pstacktop->runtime_effect -= 1; - break; + case SEPERATOR: + /* Move operators to the output until open paren */ + while (pstacktop->name[0] != '(') { + if (pstacktop <= stack+1) { + *perror = CALC_ERR_BAD_SEPERATOR; + goto bad; + } + *pout++ = pstacktop->code; + if (pstacktop->type == VARARG_OPERATOR) { + *pout++ = 1 - pstacktop->runtime_effect; + } + runtime_depth += pstacktop->runtime_effect; + pstacktop--; + } + operand_needed = TRUE; + pstacktop->runtime_effect -= 1; + break; - case CLOSE_PAREN: - /* Move operators to the output until matching paren */ - while (pstacktop->name[0] != '(') { - if (pstacktop <= stack+1) { - *perror = CALC_ERR_PAREN_NOT_OPEN; - goto bad; - } - *pout++ = pstacktop->code; - if (pstacktop->type == VARARG_OPERATOR) { - *pout++ = 1 - pstacktop->runtime_effect; - } - runtime_depth += pstacktop->runtime_effect; - pstacktop--; - } - pstacktop--; /* remove ( from stack */ - /* if there is a vararg operator before the opening paren, - it inherits the (opening) paren's stack effect */ - if ((pstacktop > stack) && - pstacktop->type == VARARG_OPERATOR) { - pstacktop->runtime_effect = (pstacktop+1)->runtime_effect; - /* check for no arguments */ - if (pstacktop->runtime_effect > 0) { - *perror = CALC_ERR_INCOMPLETE; - goto bad; - } - } - break; + case CLOSE_PAREN: + /* Move operators to the output until matching paren */ + while (pstacktop->name[0] != '(') { + if (pstacktop <= stack+1) { + *perror = CALC_ERR_PAREN_NOT_OPEN; + goto bad; + } + *pout++ = pstacktop->code; + if (pstacktop->type == VARARG_OPERATOR) { + *pout++ = 1 - pstacktop->runtime_effect; + } + runtime_depth += pstacktop->runtime_effect; + pstacktop--; + } + pstacktop--; /* remove ( from stack */ + /* if there is a vararg operator before the opening paren, + it inherits the (opening) paren's stack effect */ + if ((pstacktop > stack) && + pstacktop->type == VARARG_OPERATOR) { + pstacktop->runtime_effect = (pstacktop+1)->runtime_effect; + /* check for no arguments */ + if (pstacktop->runtime_effect > 0) { + *perror = CALC_ERR_INCOMPLETE; + goto bad; + } + } + break; - case CONDITIONAL: - /* Move operators of > priority to the output */ - while ((pstacktop > stack) && - (pstacktop->in_stack_pri > pel->in_coming_pri)) { - *pout++ = pstacktop->code; - if (pstacktop->type == VARARG_OPERATOR) { - *pout++ = 1 - pstacktop->runtime_effect; - } - runtime_depth += pstacktop->runtime_effect; - pstacktop--; - } + case CONDITIONAL: + /* Move operators of > priority to the output */ + while ((pstacktop > stack) && + (pstacktop->in_stack_pri > pel->in_coming_pri)) { + *pout++ = pstacktop->code; + if (pstacktop->type == VARARG_OPERATOR) { + *pout++ = 1 - pstacktop->runtime_effect; + } + runtime_depth += pstacktop->runtime_effect; + pstacktop--; + } - /* Add new element to the output */ - *pout++ = pel->code; - runtime_depth += pel->runtime_effect; + /* Add new element to the output */ + *pout++ = pel->code; + runtime_depth += pel->runtime_effect; - /* For : operator, also push COND_END code to stack */ - if (pel->name[0] == ':') { - if (--cond_count < 0) { - *perror = CALC_ERR_CONDITIONAL; - goto bad; - } - pstacktop++; - *pstacktop = *pel; - pstacktop->code = COND_END; - pstacktop->runtime_effect = 0; - } else { - cond_count++; - } + /* For : operator, also push COND_END code to stack */ + if (pel->name[0] == ':') { + if (--cond_count < 0) { + *perror = CALC_ERR_CONDITIONAL; + goto bad; + } + pstacktop++; + *pstacktop = *pel; + pstacktop->code = COND_END; + pstacktop->runtime_effect = 0; + } else { + cond_count++; + } - operand_needed = TRUE; - break; + operand_needed = TRUE; + break; - case EXPR_TERMINATOR: - /* Move everything from stack to the output */ - while (pstacktop > stack) { - if (pstacktop->name[0] == '(') { - *perror = CALC_ERR_PAREN_OPEN; - goto bad; - } - *pout++ = pstacktop->code; - if (pstacktop->type == VARARG_OPERATOR) { - *pout++ = 1 - pstacktop->runtime_effect; - } - runtime_depth += pstacktop->runtime_effect; - pstacktop--; - } + case EXPR_TERMINATOR: + /* Move everything from stack to the output */ + while (pstacktop > stack) { + if (pstacktop->name[0] == '(') { + *perror = CALC_ERR_PAREN_OPEN; + goto bad; + } + *pout++ = pstacktop->code; + if (pstacktop->type == VARARG_OPERATOR) { + *pout++ = 1 - pstacktop->runtime_effect; + } + runtime_depth += pstacktop->runtime_effect; + pstacktop--; + } - if (cond_count != 0) { - *perror = CALC_ERR_CONDITIONAL; - goto bad; - } - if (runtime_depth > 1) { - *perror = CALC_ERR_TOOMANY; - goto bad; - } + if (cond_count != 0) { + *perror = CALC_ERR_CONDITIONAL; + goto bad; + } + if (runtime_depth > 1) { + *perror = CALC_ERR_TOOMANY; + goto bad; + } - operand_needed = TRUE; - break; + operand_needed = TRUE; + break; - default: - *perror = CALC_ERR_INTERNAL; - goto bad; - } + default: + *perror = CALC_ERR_INTERNAL; + goto bad; + } - if (runtime_depth < 0) { - *perror = CALC_ERR_UNDERFLOW; - goto bad; - } - if (runtime_depth >= CALCPERFORM_STACK) { - *perror = CALC_ERR_OVERFLOW; - goto bad; - } + if (runtime_depth < 0) { + *perror = CALC_ERR_UNDERFLOW; + goto bad; + } + if (runtime_depth >= CALCPERFORM_STACK) { + *perror = CALC_ERR_OVERFLOW; + goto bad; + } } if (*psrc != '\0') { - *perror = CALC_ERR_SYNTAX; - goto bad; + *perror = CALC_ERR_SYNTAX; + goto bad; } /* Move everything from stack to the output */ while (pstacktop > stack) { - if (pstacktop->name[0] == '(') { - *perror = CALC_ERR_PAREN_OPEN; - goto bad; - } - *pout++ = pstacktop->code; - if (pstacktop->type == VARARG_OPERATOR) { - *pout++ = 1 - pstacktop->runtime_effect; - } - runtime_depth += pstacktop->runtime_effect; - pstacktop--; + if (pstacktop->name[0] == '(') { + *perror = CALC_ERR_PAREN_OPEN; + goto bad; + } + *pout++ = pstacktop->code; + if (pstacktop->type == VARARG_OPERATOR) { + *pout++ = 1 - pstacktop->runtime_effect; + } + runtime_depth += pstacktop->runtime_effect; + pstacktop--; } *pout = END_EXPRESSION; if (cond_count != 0) { - *perror = CALC_ERR_CONDITIONAL; - goto bad; + *perror = CALC_ERR_CONDITIONAL; + goto bad; } if (operand_needed || runtime_depth != 1) { - *perror = CALC_ERR_INCOMPLETE; - goto bad; + *perror = CALC_ERR_INCOMPLETE; + goto bad; } return 0; @@ -493,24 +493,24 @@ LIBCOM_API const char * calcErrorStr(short error) { static const char *errStrs[] = { - "No error", - "Too many results returned", - "Badly formed numeric literal", - "Bad assignment target", - "Comma without enclosing parentheses", - "Close parenthesis found without open", - "Parenthesis still open at end of expression", - "Unbalanced conditional ?: operators", - "Incomplete expression, operand missing", - "Not enough operands provided", - "Runtime stack overflow", - "Syntax error, unknown operator/operand", - "NULL or empty input argument to postfix()", - "Internal error, unknown element type", + "No error", + "Too many results returned", + "Badly formed numeric literal", + "Bad assignment target", + "Comma without enclosing parentheses", + "Close parenthesis found without open", + "Parenthesis still open at end of expression", + "Unbalanced conditional ?: operators", + "Incomplete expression, operand missing", + "Not enough operands provided", + "Runtime stack overflow", + "Syntax error, unknown operator/operand", + "NULL or empty input argument to postfix()", + "Internal error, unknown element type", }; - + if (error < CALC_ERR_NONE || error > CALC_ERR_INTERNAL) - return NULL; + return NULL; return errStrs[error]; } @@ -523,105 +523,105 @@ LIBCOM_API void calcExprDump(const char *pinst) { static const char *opcodes[] = { - "End Expression", + "End Expression", /* Operands */ - "LITERAL_DOUBLE", "LITERAL_INT", "VAL", - "FETCH_A", "FETCH_B", "FETCH_C", "FETCH_D", "FETCH_E", "FETCH_F", - "FETCH_G", "FETCH_H", "FETCH_I", "FETCH_J", "FETCH_K", "FETCH_L", + "LITERAL_DOUBLE", "LITERAL_INT", "VAL", + "FETCH_A", "FETCH_B", "FETCH_C", "FETCH_D", "FETCH_E", "FETCH_F", + "FETCH_G", "FETCH_H", "FETCH_I", "FETCH_J", "FETCH_K", "FETCH_L", /* Assignment */ - "STORE_A", "STORE_B", "STORE_C", "STORE_D", "STORE_E", "STORE_F", - "STORE_G", "STORE_H", "STORE_I", "STORE_J", "STORE_K", "STORE_L", + "STORE_A", "STORE_B", "STORE_C", "STORE_D", "STORE_E", "STORE_F", + "STORE_G", "STORE_H", "STORE_I", "STORE_J", "STORE_K", "STORE_L", /* Trigonometry Constants */ - "CONST_PI", - "CONST_D2R", - "CONST_R2D", + "CONST_PI", + "CONST_D2R", + "CONST_R2D", /* Arithmetic */ - "UNARY_NEG", - "ADD", - "SUB", - "MULT", - "DIV", - "MODULO", - "POWER", + "UNARY_NEG", + "ADD", + "SUB", + "MULT", + "DIV", + "MODULO", + "POWER", /* Algebraic */ - "ABS_VAL", - "EXP", - "LOG_10", - "LOG_E", - "MAX", - "MIN", - "SQU_RT", + "ABS_VAL", + "EXP", + "LOG_10", + "LOG_E", + "MAX", + "MIN", + "SQU_RT", /* Trigonometric */ - "ACOS", - "ASIN", - "ATAN", - "ATAN2", - "COS", - "COSH", - "SIN", - "SINH", - "TAN", - "TANH", + "ACOS", + "ASIN", + "ATAN", + "ATAN2", + "COS", + "COSH", + "SIN", + "SINH", + "TAN", + "TANH", /* Numeric */ - "CEIL", - "FLOOR", - "FINITE", - "ISINF", - "ISNAN", - "NINT", - "RANDOM", + "CEIL", + "FLOOR", + "FINITE", + "ISINF", + "ISNAN", + "NINT", + "RANDOM", /* Boolean */ - "REL_OR", - "REL_AND", - "REL_NOT", + "REL_OR", + "REL_AND", + "REL_NOT", /* Bitwise */ - "BIT_OR", - "BIT_AND", - "BIT_EXCL_OR", - "BIT_NOT", - "RIGHT_SHIFT_ARITH", - "LEFT_SHIFT_ARITH", - "RIGHT_SHIFT_LOGIC", + "BIT_OR", + "BIT_AND", + "BIT_EXCL_OR", + "BIT_NOT", + "RIGHT_SHIFT_ARITH", + "LEFT_SHIFT_ARITH", + "RIGHT_SHIFT_LOGIC", /* Relationals */ - "NOT_EQ", - "LESS_THAN", - "LESS_OR_EQ", - "EQUAL", - "GR_OR_EQ", - "GR_THAN", + "NOT_EQ", + "LESS_THAN", + "LESS_OR_EQ", + "EQUAL", + "GR_OR_EQ", + "GR_THAN", /* Conditional */ - "COND_IF", - "COND_ELSE", - "COND_END", + "COND_IF", + "COND_ELSE", + "COND_END", /* Misc */ - "NOT_GENERATED" + "NOT_GENERATED" }; char op; double lit_d; epicsInt32 lit_i; - + while ((op = *pinst) != END_EXPRESSION) { - switch (op) { - case LITERAL_DOUBLE: - memcpy(&lit_d, ++pinst, sizeof(double)); - printf("\tDouble %g\n", lit_d); - pinst += sizeof(double); - break; - case LITERAL_INT: - memcpy(&lit_i, ++pinst, sizeof(epicsInt32)); - printf("\tInteger %d (0x%x)\n", lit_i, lit_i); - pinst += sizeof(epicsInt32); - break; - case MIN: - case MAX: - case FINITE: - case ISNAN: - printf("\t%s, %d arg(s)\n", opcodes[(int) op], *++pinst); - pinst++; - break; - default: - printf("\t%s\n", opcodes[(int) op]); - pinst++; - } + switch (op) { + case LITERAL_DOUBLE: + memcpy(&lit_d, ++pinst, sizeof(double)); + printf("\tDouble %g\n", lit_d); + pinst += sizeof(double); + break; + case LITERAL_INT: + memcpy(&lit_i, ++pinst, sizeof(epicsInt32)); + printf("\tInteger %d (0x%x)\n", lit_i, lit_i); + pinst += sizeof(epicsInt32); + break; + case MIN: + case MAX: + case FINITE: + case ISNAN: + printf("\t%s, %d arg(s)\n", opcodes[(int) op], *++pinst); + pinst++; + break; + default: + printf("\t%s\n", opcodes[(int) op]); + pinst++; + } } } diff --git a/modules/libcom/src/calc/postfixPvt.h b/modules/libcom/src/calc/postfixPvt.h index 739cdbb78..b57c28330 100644 --- a/modules/libcom/src/calc/postfixPvt.h +++ b/modules/libcom/src/calc/postfixPvt.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* postfixPvt.h * Original Author: Bob Dalesio @@ -28,78 +28,78 @@ /* RPN opcodes */ typedef enum { - END_EXPRESSION = 0, + END_EXPRESSION = 0, /* Operands */ - LITERAL_DOUBLE, LITERAL_INT, FETCH_VAL, - FETCH_A, FETCH_B, FETCH_C, FETCH_D, FETCH_E, FETCH_F, - FETCH_G, FETCH_H, FETCH_I, FETCH_J, FETCH_K, FETCH_L, + LITERAL_DOUBLE, LITERAL_INT, FETCH_VAL, + FETCH_A, FETCH_B, FETCH_C, FETCH_D, FETCH_E, FETCH_F, + FETCH_G, FETCH_H, FETCH_I, FETCH_J, FETCH_K, FETCH_L, /* Assignment */ - STORE_A, STORE_B, STORE_C, STORE_D, STORE_E, STORE_F, - STORE_G, STORE_H, STORE_I, STORE_J, STORE_K, STORE_L, + STORE_A, STORE_B, STORE_C, STORE_D, STORE_E, STORE_F, + STORE_G, STORE_H, STORE_I, STORE_J, STORE_K, STORE_L, /* Trigonometry Constants */ - CONST_PI, - CONST_D2R, - CONST_R2D, + CONST_PI, + CONST_D2R, + CONST_R2D, /* Arithmetic */ - UNARY_NEG, - ADD, - SUB, - MULT, - DIV, - MODULO, - POWER, + UNARY_NEG, + ADD, + SUB, + MULT, + DIV, + MODULO, + POWER, /* Algebraic */ - ABS_VAL, - EXP, - LOG_10, - LOG_E, - MAX, - MIN, - SQU_RT, + ABS_VAL, + EXP, + LOG_10, + LOG_E, + MAX, + MIN, + SQU_RT, /* Trigonometric */ - ACOS, - ASIN, - ATAN, - ATAN2, - COS, - COSH, - SIN, - SINH, - TAN, - TANH, + ACOS, + ASIN, + ATAN, + ATAN2, + COS, + COSH, + SIN, + SINH, + TAN, + TANH, /* Numeric */ - CEIL, - FLOOR, - FINITE, - ISINF, - ISNAN, - NINT, - RANDOM, + CEIL, + FLOOR, + FINITE, + ISINF, + ISNAN, + NINT, + RANDOM, /* Boolean */ - REL_OR, - REL_AND, - REL_NOT, + REL_OR, + REL_AND, + REL_NOT, /* Bitwise */ - BIT_OR, - BIT_AND, - BIT_EXCL_OR, - BIT_NOT, - RIGHT_SHIFT_ARITH, - LEFT_SHIFT_ARITH, - RIGHT_SHIFT_LOGIC, + BIT_OR, + BIT_AND, + BIT_EXCL_OR, + BIT_NOT, + RIGHT_SHIFT_ARITH, + LEFT_SHIFT_ARITH, + RIGHT_SHIFT_LOGIC, /* Relationals */ - NOT_EQ, - LESS_THAN, - LESS_OR_EQ, - EQUAL, - GR_OR_EQ, - GR_THAN, + NOT_EQ, + LESS_THAN, + LESS_OR_EQ, + EQUAL, + GR_OR_EQ, + GR_THAN, /* Conditional */ - COND_IF, - COND_ELSE, - COND_END, + COND_IF, + COND_ELSE, + COND_END, /* Misc */ - NOT_GENERATED + NOT_GENERATED } rpn_opcode; #endif /* INCpostfixPvth */ diff --git a/modules/libcom/src/cvtFast/cvtFast.c b/modules/libcom/src/cvtFast/cvtFast.c index 887f0c8fa..90e030cdd 100644 --- a/modules/libcom/src/cvtFast/cvtFast.c +++ b/modules/libcom/src/cvtFast/cvtFast.c @@ -31,161 +31,161 @@ static epicsInt32 frac_multiplier[] = int cvtFloatToString(float flt_value, char *pdest, epicsUInt16 precision) { - int got_one, i; - epicsInt32 whole, iplace, number, fraction, fplace; - float ftemp; - char *startAddr; + int got_one, i; + epicsInt32 whole, iplace, number, fraction, fplace; + float ftemp; + char *startAddr; - /* can this routine handle this conversion */ - if (isnan(flt_value) || precision > 8 || - flt_value > 10000000.0 || flt_value < -10000000.0) { - if (precision > 8 || flt_value >= 1e8 || flt_value <= -1e8) { - if (precision > 12) precision = 12; /* FIXME */ - sprintf(pdest, "%*.*e", precision+6, precision, (double) flt_value); - } else { - if (precision > 3) precision = 3; /* FIXME */ - sprintf(pdest, "%.*f", precision, (double) flt_value); - } - return((int)strlen(pdest)); - } - startAddr = pdest; - - /* determine the sign */ - if (flt_value < 0){ - *pdest++ = '-'; - flt_value = -flt_value; - }; - - /* remove the whole number portion */ - whole = (epicsInt32)flt_value; - ftemp = flt_value - whole; - - /* multiplier to convert fractional portion to integer */ - fplace = frac_multiplier[precision]; - fraction = (epicsInt32)(ftemp * fplace * 10); - fraction = (fraction + 5) / 10; /* round up */ - - /* determine rounding into the whole number portion */ - if ((fraction / fplace) >= 1){ - whole++; - fraction -= fplace; - } - - /* whole numbers */ - got_one = 0; - for (iplace = 10000000; iplace >= 1; iplace /= 10){ - if (whole >= iplace){ - got_one = 1; - number = whole / iplace; - whole = whole - (number * iplace); - *pdest = number + '0'; - pdest++; - }else if (got_one){ - *pdest = '0'; - pdest++; - } - } - if (!got_one){ - *pdest = '0'; - pdest++; + /* can this routine handle this conversion */ + if (isnan(flt_value) || precision > 8 || + flt_value > 10000000.0 || flt_value < -10000000.0) { + if (precision > 8 || flt_value >= 1e8 || flt_value <= -1e8) { + if (precision > 12) precision = 12; /* FIXME */ + sprintf(pdest, "%*.*e", precision+6, precision, (double) flt_value); + } else { + if (precision > 3) precision = 3; /* FIXME */ + sprintf(pdest, "%.*f", precision, (double) flt_value); } + return((int)strlen(pdest)); + } + startAddr = pdest; - /* fraction */ - if (precision > 0){ - /* convert fractional portional to ASCII */ - *pdest = '.'; - pdest++; - for (fplace /= 10, i = precision; i > 0; fplace /= 10,i--){ - number = fraction / fplace; - fraction -= number * fplace; - *pdest = number + '0'; - pdest++; - } - } - *pdest = 0; + /* determine the sign */ + if (flt_value < 0){ + *pdest++ = '-'; + flt_value = -flt_value; + }; - return((int)(pdest - startAddr)); + /* remove the whole number portion */ + whole = (epicsInt32)flt_value; + ftemp = flt_value - whole; + + /* multiplier to convert fractional portion to integer */ + fplace = frac_multiplier[precision]; + fraction = (epicsInt32)(ftemp * fplace * 10); + fraction = (fraction + 5) / 10; /* round up */ + + /* determine rounding into the whole number portion */ + if ((fraction / fplace) >= 1){ + whole++; + fraction -= fplace; + } + + /* whole numbers */ + got_one = 0; + for (iplace = 10000000; iplace >= 1; iplace /= 10){ + if (whole >= iplace){ + got_one = 1; + number = whole / iplace; + whole = whole - (number * iplace); + *pdest = number + '0'; + pdest++; + }else if (got_one){ + *pdest = '0'; + pdest++; + } + } + if (!got_one){ + *pdest = '0'; + pdest++; + } + + /* fraction */ + if (precision > 0){ + /* convert fractional portional to ASCII */ + *pdest = '.'; + pdest++; + for (fplace /= 10, i = precision; i > 0; fplace /= 10,i--){ + number = fraction / fplace; + fraction -= number * fplace; + *pdest = number + '0'; + pdest++; + } + } + *pdest = 0; + + return((int)(pdest - startAddr)); } int cvtDoubleToString( - double flt_value, - char *pdest, - epicsUInt16 precision) + double flt_value, + char *pdest, + epicsUInt16 precision) { - epicsUInt16 got_one,i; - epicsInt32 whole,iplace,number,fraction,fplace; - double ftemp; - char *startAddr; + epicsUInt16 got_one,i; + epicsInt32 whole,iplace,number,fraction,fplace; + double ftemp; + char *startAddr; - /* can this routine handle this conversion */ - if (isnan(flt_value) || precision > 8 || flt_value > 10000000.0 || flt_value < -10000000.0) { - if (precision > 8 || flt_value > 1e16 || flt_value < -1e16) { - if(precision>17) precision=17; - sprintf(pdest,"%*.*e",precision+7,precision, - flt_value); - } else { - if(precision>3) precision=3; - sprintf(pdest,"%.*f",precision,flt_value); - } - return((int)strlen(pdest)); - } - startAddr = pdest; - - /* determine the sign */ - if (flt_value < 0){ - *pdest++ = '-'; - flt_value = -flt_value; - }; - - /* remove the whole number portion */ - whole = (epicsInt32)flt_value; - ftemp = flt_value - whole; - - /* multiplier to convert fractional portion to integer */ - fplace = frac_multiplier[precision]; - fraction = (epicsInt32)(ftemp * fplace * 10); - fraction = (fraction + 5) / 10; /* round up */ - - /* determine rounding into the whole number portion */ - if ((fraction / fplace) >= 1){ - whole++; - fraction -= fplace; - } - - /* whole numbers */ - got_one = 0; - for (iplace = 10000000; iplace >= 1; iplace /= 10){ - if (whole >= iplace){ - got_one = 1; - number = whole / iplace; - whole = whole - (number * iplace); - *pdest = number + '0'; - pdest++; - }else if (got_one){ - *pdest = '0'; - pdest++; - } - } - if (!got_one){ - *pdest = '0'; - pdest++; + /* can this routine handle this conversion */ + if (isnan(flt_value) || precision > 8 || flt_value > 10000000.0 || flt_value < -10000000.0) { + if (precision > 8 || flt_value > 1e16 || flt_value < -1e16) { + if(precision>17) precision=17; + sprintf(pdest,"%*.*e",precision+7,precision, + flt_value); + } else { + if(precision>3) precision=3; + sprintf(pdest,"%.*f",precision,flt_value); } + return((int)strlen(pdest)); + } + startAddr = pdest; - /* fraction */ - if (precision > 0){ - /* convert fractional portional to ASCII */ - *pdest = '.'; - pdest++; - for (fplace /= 10, i = precision; i > 0; fplace /= 10,i--){ - number = fraction / fplace; - fraction -= number * fplace; - *pdest = number + '0'; - pdest++; - } - } - *pdest = 0; + /* determine the sign */ + if (flt_value < 0){ + *pdest++ = '-'; + flt_value = -flt_value; + }; - return((int)(pdest - startAddr)); + /* remove the whole number portion */ + whole = (epicsInt32)flt_value; + ftemp = flt_value - whole; + + /* multiplier to convert fractional portion to integer */ + fplace = frac_multiplier[precision]; + fraction = (epicsInt32)(ftemp * fplace * 10); + fraction = (fraction + 5) / 10; /* round up */ + + /* determine rounding into the whole number portion */ + if ((fraction / fplace) >= 1){ + whole++; + fraction -= fplace; + } + + /* whole numbers */ + got_one = 0; + for (iplace = 10000000; iplace >= 1; iplace /= 10){ + if (whole >= iplace){ + got_one = 1; + number = whole / iplace; + whole = whole - (number * iplace); + *pdest = number + '0'; + pdest++; + }else if (got_one){ + *pdest = '0'; + pdest++; + } + } + if (!got_one){ + *pdest = '0'; + pdest++; + } + + /* fraction */ + if (precision > 0){ + /* convert fractional portional to ASCII */ + *pdest = '.'; + pdest++; + for (fplace /= 10, i = precision; i > 0; fplace /= 10,i--){ + number = fraction / fplace; + fraction -= number * fplace; + *pdest = number + '0'; + pdest++; + } + } + *pdest = 0; + + return((int)(pdest - startAddr)); } /* diff --git a/modules/libcom/src/cxxTemplates/epicsGuard.h b/modules/libcom/src/cxxTemplates/epicsGuard.h index f0aa401a5..d8acdfe99 100644 --- a/modules/libcom/src/cxxTemplates/epicsGuard.h +++ b/modules/libcom/src/cxxTemplates/epicsGuard.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef epicsGuardh @@ -22,7 +22,7 @@ template < class T > class epicsGuardRelease; // Automatically applies and releases the mutex. -// This class is also useful in situations where +// This class is also useful in situations where // C++ exceptions are possible. template < class T > class epicsGuard { @@ -33,13 +33,13 @@ public: ~epicsGuard (); private: T * _pTargetMutex; - epicsGuard ( const epicsGuard & ); - epicsGuard & operator = ( const epicsGuard & ); + epicsGuard ( const epicsGuard & ); + epicsGuard & operator = ( const epicsGuard & ); friend class epicsGuardRelease < T >; }; // Automatically releases and reapplies the mutex. -// This class is also useful in situations where +// This class is also useful in situations where // C++ exceptions are possible. template < class T > class epicsGuardRelease { @@ -50,8 +50,8 @@ public: private: epicsGuard < T > & _guard; T * _pTargetMutex; - epicsGuardRelease ( const epicsGuardRelease & ); - epicsGuardRelease & operator = ( const epicsGuardRelease & ); + epicsGuardRelease ( const epicsGuardRelease & ); + epicsGuardRelease & operator = ( const epicsGuardRelease & ); }; // same interface as epicsMutex @@ -77,23 +77,23 @@ inline epicsGuard < T > :: ~epicsGuard () } template < class T > -inline void epicsGuard < T > :: assertIdenticalMutex ( +inline void epicsGuard < T > :: assertIdenticalMutex ( const T & mutexToVerify ) const { assert ( _pTargetMutex == & mutexToVerify ); } template < class T > -inline epicsGuardRelease < T > :: +inline epicsGuardRelease < T > :: epicsGuardRelease ( epicsGuard & guardIn ) : - _guard ( guardIn ), + _guard ( guardIn ), _pTargetMutex ( guardIn._pTargetMutex ) { - // Setting the guard's _pTargetMutex to nill will - // allow assertIdenticalMutex to catch situations - // where a guard is being used and it has been - // released, and also situations where ~epicsGuard () - // runs and an epicsGuardRelease is still referencing + // Setting the guard's _pTargetMutex to nill will + // allow assertIdenticalMutex to catch situations + // where a guard is being used and it has been + // released, and also situations where ~epicsGuard () + // runs and an epicsGuardRelease is still referencing // the guard will be detected. _guard._pTargetMutex = 0; _pTargetMutex->unlock (); diff --git a/modules/libcom/src/cxxTemplates/epicsSingleton.h b/modules/libcom/src/cxxTemplates/epicsSingleton.h index 89c3ab903..ff8e594e8 100644 --- a/modules/libcom/src/cxxTemplates/epicsSingleton.h +++ b/modules/libcom/src/cxxTemplates/epicsSingleton.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -40,7 +40,7 @@ private: // This class exists for the purpose of avoiding file scope // object chicken and egg problems. It implements thread safe // lazy initialization. To avoid locking overhead retain a -// copy of the epicsSingleton :: reference for future use. +// copy of the epicsSingleton :: reference for future use. template < class TYPE > class epicsSingleton { public: @@ -49,11 +49,11 @@ public: reference ( epicsSingleton & ); reference ( const reference & ); ~reference (); - // this somewhat convoluted reference of the return - // type ref through the epicsSingleton template is - // required for the archaic Tornado gnu compiler - typename epicsSingleton < TYPE > :: reference & - operator = ( const reference & ); + // this somewhat convoluted reference of the return + // type ref through the epicsSingleton template is + // required for the archaic Tornado gnu compiler + typename epicsSingleton < TYPE > :: reference & + operator = ( const reference & ); TYPE * operator -> (); const TYPE * operator -> () const; TYPE & operator * (); @@ -76,16 +76,16 @@ private: }; template < class TYPE > -inline epicsSingleton < TYPE > :: reference :: +inline epicsSingleton < TYPE > :: reference :: reference ( epicsSingleton & es ): - _pSingleton ( & es ) + _pSingleton ( & es ) { es._singletonUntyped. incrRefCount ( & epicsSingleton < TYPE > :: _build ); } template < class TYPE > -inline epicsSingleton < TYPE > :: reference :: +inline epicsSingleton < TYPE > :: reference :: reference ( const reference & ref ) : _pSingleton ( ref._pSingleton ) { @@ -95,7 +95,7 @@ inline epicsSingleton < TYPE > :: reference :: } template < class TYPE > -inline epicsSingleton < TYPE > :: reference :: +inline epicsSingleton < TYPE > :: reference :: ~reference () { assert ( _pSingleton ); @@ -104,8 +104,8 @@ inline epicsSingleton < TYPE > :: reference :: } template < class TYPE > -typename epicsSingleton < TYPE > :: reference & - epicsSingleton < TYPE > :: reference :: +typename epicsSingleton < TYPE > :: reference & + epicsSingleton < TYPE > :: reference :: operator = ( const reference & ref ) { if ( _pSingleton != ref._pSingleton ) { @@ -115,48 +115,48 @@ typename epicsSingleton < TYPE > :: reference & _pSingleton = ref._pSingleton; assert ( _pSingleton ); _pSingleton->_singletonUntyped. - incrRefCount ( & epicsSingleton < TYPE > :: _build ); + incrRefCount ( & epicsSingleton < TYPE > :: _build ); } return *this; } template < class TYPE > -inline TYPE * - epicsSingleton < TYPE > :: reference :: +inline TYPE * + epicsSingleton < TYPE > :: reference :: operator -> () -{ - assert ( _pSingleton ); - return reinterpret_cast < TYPE * > - ( _pSingleton->_singletonUntyped.pInstance () ); -} - -template < class TYPE > -inline const TYPE * - epicsSingleton < TYPE > :: reference :: - operator -> () const { assert ( _pSingleton ); - return reinterpret_cast < const TYPE * > - ( _pSingleton->_singletonUntyped.pInstance () ); + return reinterpret_cast < TYPE * > + ( _pSingleton->_singletonUntyped.pInstance () ); } template < class TYPE > -inline TYPE & - epicsSingleton < TYPE > :: reference :: - operator * () +inline const TYPE * + epicsSingleton < TYPE > :: reference :: + operator -> () const +{ + assert ( _pSingleton ); + return reinterpret_cast < const TYPE * > + ( _pSingleton->_singletonUntyped.pInstance () ); +} + +template < class TYPE > +inline TYPE & + epicsSingleton < TYPE > :: reference :: + operator * () { return * this->operator -> (); } template < class TYPE > -inline const TYPE & - epicsSingleton < TYPE > :: reference :: - operator * () const +inline const TYPE & + epicsSingleton < TYPE > :: reference :: + operator * () const { return * this->operator -> (); } -inline SingletonUntyped :: SingletonUntyped () : +inline SingletonUntyped :: SingletonUntyped () : _pInstance ( 0 ), _refCount ( 0 ) { } @@ -170,10 +170,10 @@ inline SingletonUntyped :: ~SingletonUntyped () { // we dont assert fail on non-zero _refCount // and or non nill _pInstance here because this - // is designed to tolarate situations where - // file scope epicsSingleton objects (which - // theoretically dont have storage lifespan - // issues) are deleted in a non-determanistic + // is designed to tolarate situations where + // file scope epicsSingleton objects (which + // theoretically dont have storage lifespan + // issues) are deleted in a non-determanistic // order # if 0 assert ( _refCount == 0 ); @@ -188,26 +188,26 @@ void * epicsSingleton < TYPE > :: _build () } template < class TYPE > -void epicsSingleton < TYPE > :: +void epicsSingleton < TYPE > :: _destroy ( void * pDestroyTypeless ) { - TYPE * pDestroy = + TYPE * pDestroy = reinterpret_cast < TYPE * > ( pDestroyTypeless ); delete pDestroy; } template < class TYPE > -inline typename epicsSingleton < TYPE > :: reference +inline typename epicsSingleton < TYPE > :: reference epicsSingleton < TYPE > :: getReference () { return reference ( * this ); } template < class TYPE > -inline const typename epicsSingleton < TYPE > :: reference +inline const typename epicsSingleton < TYPE > :: reference epicsSingleton < TYPE > :: getReference () const { - epicsSingleton < TYPE > * pConstCastAway = + epicsSingleton < TYPE > * pConstCastAway = const_cast < epicsSingleton < TYPE > * > ( this ); return pConstCastAway->getReference (); } diff --git a/modules/libcom/src/cxxTemplates/epicsSingletonMutex.cpp b/modules/libcom/src/cxxTemplates/epicsSingletonMutex.cpp index b878e3dc2..e437e3c61 100644 --- a/modules/libcom/src/cxxTemplates/epicsSingletonMutex.cpp +++ b/modules/libcom/src/cxxTemplates/epicsSingletonMutex.cpp @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -29,7 +29,7 @@ static epicsMutex * pEPICSSigletonMutex = 0; extern "C" void SingletonMutexOnce ( void * /* pParm */ ) { // This class exists for the purpose of avoiding file scope - // object chicken and egg problems. Therefore, pEPICSSigletonMutex + // object chicken and egg problems. Therefore, pEPICSSigletonMutex // is never destroyed. pEPICSSigletonMutex = newEpicsMutex; } @@ -37,7 +37,7 @@ extern "C" void SingletonMutexOnce ( void * /* pParm */ ) void SingletonUntyped :: incrRefCount ( PBuild pBuild ) { epicsThreadOnce ( & epicsSigletonOnceFlag, SingletonMutexOnce, 0 ); - epicsGuard < epicsMutex > + epicsGuard < epicsMutex > guard ( *pEPICSSigletonMutex ); assert ( _refCount < SIZE_MAX ); if ( _refCount == 0 ) { @@ -48,7 +48,7 @@ void SingletonUntyped :: incrRefCount ( PBuild pBuild ) void SingletonUntyped :: decrRefCount ( PDestroy pDestroy ) { - epicsGuard < epicsMutex > + epicsGuard < epicsMutex > guard ( *pEPICSSigletonMutex ); assert ( _refCount > 0 ); _refCount--; diff --git a/modules/libcom/src/cxxTemplates/resourceLib.cpp b/modules/libcom/src/cxxTemplates/resourceLib.cpp index f3a9a9993..5aab8e8b6 100644 --- a/modules/libcom/src/cxxTemplates/resourceLib.cpp +++ b/modules/libcom/src/cxxTemplates/resourceLib.cpp @@ -4,10 +4,10 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* * Author: Jeff Hill */ diff --git a/modules/libcom/src/cxxTemplates/resourceLib.h b/modules/libcom/src/cxxTemplates/resourceLib.h index ff7ef997f..a5abb6bcc 100644 --- a/modules/libcom/src/cxxTemplates/resourceLib.h +++ b/modules/libcom/src/cxxTemplates/resourceLib.h @@ -4,20 +4,20 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * General hash table templates for fast indexing of resources - * of any base resource type and any resource identifier type. Fast - * indexing is implemented with a hash lookup. The identifier type - * implements the hash algorithm (or derives from one of the supplied - * identifier types which provide a hashing routine). The table expands - * dynamically depending on load, and without introducing non-determanistic + * of any base resource type and any resource identifier type. Fast + * indexing is implemented with a hash lookup. The identifier type + * implements the hash algorithm (or derives from one of the supplied + * identifier types which provide a hashing routine). The table expands + * dynamically depending on load, and without introducing non-determanistic * latency. * * Unsigned integer and string identifier classes are supplied here. * - * Authors Jeffrey O. Hill + * Authors Jeffrey O. Hill * Marty Kraimer (string hash algorithm) * influenced by papers by Peter K. Pearson and Per-Ake Larson * @@ -26,7 +26,7 @@ */ #ifndef INCresourceLibh -#define INCresourceLibh +#define INCresourceLibh #include #include @@ -50,13 +50,13 @@ template < class T, class ID > class resTableIterConst; // // class resTable // -// This class stores resource entries of type T which can be efficiently +// This class stores resource entries of type T which can be efficiently // located with a hash key of type ID. // -// NOTES: +// NOTES: // 1) class T must derive from class ID and also from class tsSLNode // -// 2) If the "resTable::show (unsigned level)" member function is called then +// 2) If the "resTable::show (unsigned level)" member function is called then // class T must also implement a "show (unsigned level)" member function which // dumps increasing diagnostics information with increasing "level" to // standard out. @@ -67,9 +67,9 @@ template < class T, class ID > class resTableIterConst; // bool operator == (const ID &); // // // ID to hash index convert (see examples below) -// resTableIndex hash (unsigned nBitsHashIndex) const; +// resTableIndex hash (unsigned nBitsHashIndex) const; // -// 4) Storage for identifier of type ID must persist until the item of type +// 4) Storage for identifier of type ID must persist until the item of type // T is deleted from the resTable // template @@ -131,8 +131,8 @@ public: resTableIter < T, ID > & operator = ( const resTableIter < T, ID > & ); T & operator * () const; T * operator -> () const; - resTableIter < T, ID > & operator ++ (); - resTableIter < T, ID > operator ++ ( int ); + resTableIter < T, ID > & operator ++ (); + resTableIter < T, ID > operator ++ ( int ); T * pointer (); private: tsSLIter < T > iter; @@ -158,8 +158,8 @@ public: resTableIterConst < T, ID > & operator = ( const resTableIterConst < T, ID > & ); const T & operator * () const; const T * operator -> () const; - resTableIterConst < T, ID > & operator ++ (); - resTableIterConst < T, ID > operator ++ ( int ); + resTableIterConst < T, ID > & operator ++ (); + resTableIterConst < T, ID > operator ++ ( int ); const T * pointer () const; private: tsSLIterConst < T > iter; @@ -184,18 +184,18 @@ private: // // 1<. -// Set this parameter to zero if unsure of the correct minimum +// Set this parameter to zero if unsure of the correct minimum // hash table size. // -// MAX_ID_WIDTH specifies the maximum number of ls bits in an -// integer identifier which might be set at any time. +// MAX_ID_WIDTH specifies the maximum number of ls bits in an +// integer identifier which might be set at any time. // // MIN_INDEX_WIDTH and MAX_ID_WIDTH are specified here at -// compile time so that the hash index can be produced -// efficiently. Hash indexes are produced more efficiently +// compile time so that the hash index can be produced +// efficiently. Hash indexes are produced more efficiently // when (MAX_ID_WIDTH - MIN_INDEX_WIDTH) is minimized. // -template class intId { public: @@ -212,10 +212,10 @@ protected: // // a specialized resTable which uses unsigned integer keys which are // allocated in chronological sequence -// +// // NOTE: ITEM must public inherit from chronIntIdRes // -class chronIntId : public intId +class chronIntId : public intId { public: chronIntId ( const unsigned &idIn ); @@ -229,8 +229,8 @@ public: void idAssignAdd ( ITEM & item ); private: unsigned allocId; - chronIntIdResTable ( const chronIntIdResTable & ); - chronIntIdResTable & operator = ( const chronIntIdResTable & ); + chronIntIdResTable ( const chronIntIdResTable & ); + chronIntIdResTable & operator = ( const chronIntIdResTable & ); }; // @@ -244,7 +244,7 @@ public: chronIntIdRes (); private: void setId (unsigned newId); - chronIntIdRes (const chronIntIdRes & ); + chronIntIdRes (const chronIntIdRes & ); friend class chronIntIdResTable; }; @@ -273,14 +273,14 @@ private: // resTable member functions ///////////////////////////////////////////////// -// +// // resTable::resTable () // template inline resTable::resTable () : - pTable ( 0 ), nextSplitIndex ( 0 ), hashIxMask ( 0 ), - hashIxSplitMask ( 0 ), nBitsHashIxSplitMask ( 0 ), - logBaseTwoTableSize ( 0 ), nInUse ( 0 ) {} + pTable ( 0 ), nextSplitIndex ( 0 ), hashIxMask ( 0 ), + hashIxSplitMask ( 0 ), nBitsHashIxSplitMask ( 0 ), + logBaseTwoTableSize ( 0 ), nInUse ( 0 ) {} template inline unsigned resTable::resTableBitMask ( const unsigned nBits ) @@ -369,10 +369,10 @@ inline resTableIndex resTable::hash ( const ID & idIn ) const // template void resTable::show ( unsigned level ) const -{ +{ const unsigned N = this->tableSize (); - printf ( "Hash table with %u buckets and %u items of type %s installed\n", + printf ( "Hash table with %u buckets and %u items of type %s installed\n", N, this->nInUse, typeid(T).name() ); if ( level >= 1u && N ) { @@ -417,7 +417,7 @@ void resTable::show ( unsigned level ) const double mean = X / N; double stdDev = sqrt( XX / N - mean * mean ); - printf ( + printf ( "entries per bucket: mean = %f std dev = %f max = %u\n", mean, stdDev, maxEntries ); printf("%u empty buckets\n", empty); @@ -439,7 +439,7 @@ void resTable::verify () const assert ( this->hashIxMask == ( this->hashIxSplitMask >> 1 ) ); assert ( this->hashIxSplitMask ); assert ( this->nBitsHashIxSplitMask ); - assert ( resTableBitMask ( this->nBitsHashIxSplitMask ) + assert ( resTableBitMask ( this->nBitsHashIxSplitMask ) == this->hashIxSplitMask ); assert ( this->logBaseTwoTableSize ); assert ( this->nBitsHashIxSplitMask <= this->logBaseTwoTableSize ); @@ -472,7 +472,7 @@ void resTable::verify () const // resTable::traverse // template -void resTable::traverse ( void (T::*pCB)() ) +void resTable::traverse ( void (T::*pCB)() ) { const unsigned N = this->tableSize (); for ( unsigned i = 0u; i < N; i++ ) { @@ -531,18 +531,18 @@ void resTable::setTableSize ( const unsigned newTableSize ) return; } - // - // count the number of bits in newTableSize and round up + // + // count the number of bits in newTableSize and round up // to the next power of two - // + // unsigned newMask = newTableSize - 1; - unsigned nbits; - for ( nbits = 0; nbits < sizeof (newTableSize) * CHAR_BIT; nbits++ ) { - unsigned nBitsMask = resTableBitMask ( nbits ); - if ( ( newMask & ~nBitsMask ) == 0){ - break; - } - } + unsigned nbits; + for ( nbits = 0; nbits < sizeof (newTableSize) * CHAR_BIT; nbits++ ) { + unsigned nBitsMask = resTableBitMask ( nbits ); + if ( ( newMask & ~nBitsMask ) == 0){ + break; + } + } setTableSizePrivate ( nbits ); } @@ -567,18 +567,18 @@ bool resTable::setTableSizePrivate ( unsigned logBaseTwoTableSizeIn ) tsSLList * pNewTable; try { - pNewTable = ( tsSLList * ) + pNewTable = ( tsSLList * ) ::operator new ( newTableSize * sizeof ( tsSLList ) ); } catch ( ... ){ if ( ! this->pTable ) { - throw; + throw; } return false; } // run the constructors using placement new - unsigned i; + unsigned i; for ( i = 0u; i < oldTableOccupiedSize; i++ ) { new ( &pNewTable[i] ) tsSLList ( this->pTable[i] ); } @@ -586,7 +586,7 @@ bool resTable::setTableSizePrivate ( unsigned logBaseTwoTableSizeIn ) new ( &pNewTable[i] ) tsSLList; } // Run the destructors explicitly. Currently this destructor is a noop. - // The Tornado II compiler and RedHat 6.2 will not compile ~tsSLList() but + // The Tornado II compiler and RedHat 6.2 will not compile ~tsSLList() but // since its a NOOP we can find an ugly workaround # if ! defined (__GNUC__) || __GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 92 ) for ( i = 0; i < oldTableSize; i++ ) { @@ -612,7 +612,7 @@ template void resTable::splitBucket () { // double the hash table when necessary - // (this results in only a memcpy overhead, but + // (this results in only a memcpy overhead, but // no hashing or entry redistribution) if ( this->nextSplitIndex > this->hashIxMask ) { bool success = this->setTableSizePrivate ( this->nBitsHashIxSplitMask + 1 ); @@ -687,7 +687,7 @@ T * resTable::find ( tsSLList &list, const ID &idIn ) const // ~resTable::resTable() // template -resTable::~resTable() +resTable::~resTable() { operator delete ( this->pTable ); } @@ -728,21 +728,21 @@ inline resTableIter < T, ID > resTable::firstIter () ////////////////////////////////////////////// template < class T, class ID > -inline resTableIter::resTableIter ( resTable < T,ID > & tableIn ) : - index ( 0 ), pResTable ( & tableIn ) +inline resTableIter::resTableIter ( resTable < T,ID > & tableIn ) : + index ( 0 ), pResTable ( & tableIn ) { this->findNextEntry (); -} +} template < class T, class ID > -inline resTableIter::resTableIter () : - iter ( tsSLList::invalidIter() ), - index ( 0 ), pResTable ( 0 ) +inline resTableIter::resTableIter () : + iter ( tsSLList::invalidIter() ), + index ( 0 ), pResTable ( 0 ) { -} +} template < class T, class ID > -inline void resTableIter::findNextEntry () +inline void resTableIter::findNextEntry () { if ( this->pResTable ) { while ( this->index < this->pResTable->tableSize() ) { @@ -752,7 +752,7 @@ inline void resTableIter::findNextEntry () } } } -} +} template < class T, class ID > inline bool resTableIter::valid () const @@ -781,7 +781,7 @@ inline resTableIter < T, ID > & resTableIter::operator = ( const resTableIter < T, ID > & rhs ) { this->pResTable = rhs.pResTable; - this->index = rhs.index; + this->index = rhs.index; this->iter = rhs.iter; return *this; } @@ -817,7 +817,7 @@ inline resTableIter resTableIter::operator ++ ( int ) } template < class T, class ID > -inline T * resTableIter::pointer () +inline T * resTableIter::pointer () { return this->iter.pointer (); } @@ -827,21 +827,21 @@ inline T * resTableIter::pointer () ////////////////////////////////////////////// template < class T, class ID > -inline resTableIterConst::resTableIterConst ( const resTable < T,ID > & tableIn ) : - index ( 0 ), pResTable ( & tableIn ) +inline resTableIterConst::resTableIterConst ( const resTable < T,ID > & tableIn ) : + index ( 0 ), pResTable ( & tableIn ) { this->findNextEntry (); -} +} template < class T, class ID > -inline resTableIterConst::resTableIterConst () : - iter ( tsSLList::invalidIter() ), - index ( 0 ), pResTable ( 0 ) +inline resTableIterConst::resTableIterConst () : + iter ( tsSLList::invalidIter() ), + index ( 0 ), pResTable ( 0 ) { -} +} template < class T, class ID > -inline void resTableIterConst::findNextEntry () +inline void resTableIterConst::findNextEntry () { if ( this->pResTable ) { while ( this->index < this->pResTable->tableSize() ) { @@ -852,7 +852,7 @@ inline void resTableIterConst::findNextEntry () } } } -} +} template < class T, class ID > inline bool resTableIterConst::valid () const @@ -881,7 +881,7 @@ inline resTableIterConst < T, ID > & resTableIterConst::operator = ( const resTableIterConst < T, ID > & rhs ) { this->pResTable = rhs.pResTable; - this->index = rhs.index; + this->index = rhs.index; this->iter = rhs.iter; return *this; } @@ -925,25 +925,25 @@ inline const T * resTableIterConst::pointer () const ////////////////////////////////////////////// // chronIntIdResTable member functions ////////////////////////////////////////////// -inline chronIntId::chronIntId ( const unsigned &idIn ) : +inline chronIntId::chronIntId ( const unsigned &idIn ) : intId ( idIn ) {} // // chronIntIdResTable::chronIntIdResTable() // template -inline chronIntIdResTable::chronIntIdResTable () : +inline chronIntIdResTable::chronIntIdResTable () : resTable (), allocId(1u) {} template inline chronIntIdResTable::chronIntIdResTable ( const chronIntIdResTable & ) : - resTable (), allocId(1u) {} + resTable (), allocId(1u) {} template inline chronIntIdResTable & chronIntIdResTable:: - operator = ( const chronIntIdResTable & ) + operator = ( const chronIntIdResTable & ) { - return *this; + return *this; } // @@ -956,8 +956,8 @@ chronIntIdResTable::~chronIntIdResTable() {} // // chronIntIdResTable::add() // -// NOTE: This detects (and avoids) the case where -// the PV id wraps around and we attempt to have two +// NOTE: This detects (and avoids) the case where +// the PV id wraps around and we attempt to have two // resources with the same id. // template @@ -987,7 +987,7 @@ inline chronIntIdRes::chronIntIdRes () : chronIntId (UINT_MAX) {} // workaround for bug in DEC compiler // template -inline void chronIntIdRes::setId (unsigned newId) +inline void chronIntIdRes::setId (unsigned newId) { this->id = newId; } @@ -1001,7 +1001,7 @@ inline void chronIntIdRes::setId (unsigned newId) // // (if this is inline SUN PRO botches the template instantiation) template -intId::intId (const T &idIn) +intId::intId (const T &idIn) : id (idIn) {} // @@ -1035,14 +1035,14 @@ inline resTableIndex integerHash ( unsigned MIN_INDEX_WIDTH, resTableIndex hashid = static_cast ( id ); // - // the intent here is to gurantee that all components of the + // the intent here is to gurantee that all components of the // integer contribute even if the resTableIndex returned might // index a small table. // // On most compilers the optimizer will unroll this loop so this // is actually a very small inline function // - // Experiments using the microsoft compiler show that this isnt + // Experiments using the microsoft compiler show that this isnt // slower than switching on the architecture size and unrolling the // loop explicitly (that solution has resulted in portability // problems in the past). @@ -1077,7 +1077,7 @@ inline resTableIndex intId::hash () const // // stringId::operator == () // -inline bool stringId::operator == +inline bool stringId::operator == (const stringId &idIn) const { if (this->pStr!=NULL && idIn.pStr!=NULL) { @@ -1133,19 +1133,19 @@ stringId::~stringId() if (this->allocType==copyString) { if (this->pStr!=NULL) { // - // the microsoft and solaris compilers will + // the microsoft and solaris compilers will // not allow a pointer to "const char" - // to be deleted + // to be deleted // // the HP-UX compiler gives us a warning on // each cast away of const, but in this case - // it cant be avoided. + // it cant be avoided. // - // The DEC compiler complains that const isnt + // The DEC compiler complains that const isnt // really significant in a cast if it is present. // // I hope that deleting a pointer to "char" - // is the same as deleting a pointer to + // is the same as deleting a pointer to // "const char" on all compilers // delete [] const_cast(this->pStr); diff --git a/modules/libcom/src/cxxTemplates/test/minmaxTest.cc b/modules/libcom/src/cxxTemplates/test/minmaxTest.cc index b5cf5b110..f1e8d38a0 100644 --- a/modules/libcom/src/cxxTemplates/test/minmaxTest.cc +++ b/modules/libcom/src/cxxTemplates/test/minmaxTest.cc @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include @@ -14,26 +14,26 @@ int main () { - float f1 = 3.3f; - float f2 = 3.4f; - float f3; - - f3 = tsMin(f1,f2); - assert(f3==f1); + float f1 = 3.3f; + float f2 = 3.4f; + float f3; - f3 = tsMax(f1,f2); - assert(f3==f2); + f3 = tsMin(f1,f2); + assert(f3==f1); - int i1 = 3; - int i2 = 4; - int i3; - - i3 = tsMin(i1,i2); - assert(i3==i1); + f3 = tsMax(f1,f2); + assert(f3==f2); - i3 = tsMax(i1,i2); - assert(i3==i2); + int i1 = 3; + int i2 = 4; + int i3; - return 0; + i3 = tsMin(i1,i2); + assert(i3==i1); + + i3 = tsMax(i1,i2); + assert(i3==i2); + + return 0; } diff --git a/modules/libcom/src/cxxTemplates/test/resourceLibTest.cc b/modules/libcom/src/cxxTemplates/test/resourceLibTest.cc index 1a6a2c1f9..8208573ef 100644 --- a/modules/libcom/src/cxxTemplates/test/resourceLibTest.cc +++ b/modules/libcom/src/cxxTemplates/test/resourceLibTest.cc @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ @@ -34,49 +34,49 @@ static void empty() class albert : public testIntId, public tsSLNode { public: - albert (resTable< albert, testIntId > &atIn, unsigned idIn) : - testIntId(idIn), at(atIn) + albert (resTable< albert, testIntId > &atIn, unsigned idIn) : + testIntId(idIn), at(atIn) { verify (at.add (*this)==0); } - void show (unsigned /* level */) - { - } - void destroy() - { - at.remove(*this); - delete this; - } + void show (unsigned /* level */) + { + } + void destroy() + { + at.remove(*this); + delete this; + } private: - resTable< albert, testIntId > &at; + resTable< albert, testIntId > &at; }; class fred : public testIntId, public tsSLNode { public: - fred (const char *pNameIn, unsigned idIn) : - testIntId(idIn), pName(pNameIn) {} - void show (unsigned) - { - printf("fred %s\n", pName); - } - void destroy() - { - // always on stack so noop - } + fred (const char *pNameIn, unsigned idIn) : + testIntId(idIn), pName(pNameIn) {} + void show (unsigned) + { + printf("fred %s\n", pName); + } + void destroy() + { + // always on stack so noop + } private: - const char * const pName; + const char * const pName; }; class jane : public stringId, public tsSLNode { public: - jane (const char *pNameIn) : stringId (pNameIn) {} + jane (const char *pNameIn) : stringId (pNameIn) {} - void testTraverse(); + void testTraverse(); - void destroy() - { - // always on stack so noop - } + void destroy() + { + // always on stack so noop + } }; // @@ -84,160 +84,160 @@ public: // void jane::testTraverse() { - printf("Traverse Test\n"); - this->show(10); + printf("Traverse Test\n"); + this->show(10); } int main() { - unsigned i; - clock_t start, finish; - double duration; - const unsigned LOOPS = 500000; - resTable < fred, testIntId > intTbl; - resTable < jane, stringId> strTbl; - fred fred0("fred0",0); - fred fred1("fred1",0x1000a432); - fred fred2("fred2",0x0000a432); - fred fred3("fred3",1); - fred fred4("fred4",2); - fred fred5("fred5",3); - fred fred6("fred6",4); - fred fred7("fred7",5); - fred fred8("fred8",6); - fred fred9("fred9",7); - jane jane1("rrrrrrrrrrrrrrrrrrrrrrrrrr1"); - jane jane2("rrrrrrrrrrrrrrrrrrrrrrrrrr2"); - fred *pFred; - jane *pJane; - testIntId intId0 (0); - testIntId intId1 (0x1000a432); - testIntId intId2 (0x0000a432); - testIntId intId3 (1); - testIntId intId4 (2); - testIntId intId5 (3); - testIntId intId6 (4); - testIntId intId7 (5); - testIntId intId8 (6); - testIntId intId9 (7); + unsigned i; + clock_t start, finish; + double duration; + const unsigned LOOPS = 500000; + resTable < fred, testIntId > intTbl; + resTable < jane, stringId> strTbl; + fred fred0("fred0",0); + fred fred1("fred1",0x1000a432); + fred fred2("fred2",0x0000a432); + fred fred3("fred3",1); + fred fred4("fred4",2); + fred fred5("fred5",3); + fred fred6("fred6",4); + fred fred7("fred7",5); + fred fred8("fred8",6); + fred fred9("fred9",7); + jane jane1("rrrrrrrrrrrrrrrrrrrrrrrrrr1"); + jane jane2("rrrrrrrrrrrrrrrrrrrrrrrrrr2"); + fred *pFred; + jane *pJane; + testIntId intId0 (0); + testIntId intId1 (0x1000a432); + testIntId intId2 (0x0000a432); + testIntId intId3 (1); + testIntId intId4 (2); + testIntId intId5 (3); + testIntId intId6 (4); + testIntId intId7 (5); + testIntId intId8 (6); + testIntId intId9 (7); - stringId strId1("rrrrrrrrrrrrrrrrrrrrrrrrrr1"); + stringId strId1("rrrrrrrrrrrrrrrrrrrrrrrrrr1"); strTbl.verify (); - stringId strId2("rrrrrrrrrrrrrrrrrrrrrrrrrr2"); + stringId strId2("rrrrrrrrrrrrrrrrrrrrrrrrrr2"); strTbl.verify (); - intTbl.setTableSize ( 100000 ); + intTbl.setTableSize ( 100000 ); - verify (intTbl.add(fred0)==0); + verify (intTbl.add(fred0)==0); intTbl.verify (); - verify (intTbl.add(fred1)==0); + verify (intTbl.add(fred1)==0); intTbl.verify (); - verify (intTbl.add(fred2)==0); + verify (intTbl.add(fred2)==0); intTbl.verify (); - verify (intTbl.add(fred3)==0); + verify (intTbl.add(fred3)==0); intTbl.verify (); - verify (intTbl.add(fred4)==0); + verify (intTbl.add(fred4)==0); intTbl.verify (); - intTbl.setTableSize ( 200000 ); + intTbl.setTableSize ( 200000 ); - verify (intTbl.add(fred5)==0); + verify (intTbl.add(fred5)==0); intTbl.verify (); - verify (intTbl.add(fred6)==0); + verify (intTbl.add(fred6)==0); intTbl.verify (); - verify (intTbl.add(fred7)==0); + verify (intTbl.add(fred7)==0); intTbl.verify (); - verify (intTbl.add(fred8)==0); + verify (intTbl.add(fred8)==0); intTbl.verify (); - verify (intTbl.add(fred9)==0); + verify (intTbl.add(fred9)==0); intTbl.verify (); - start = clock(); - for (i=0; i alTbl; + resTable< albert, testIntId > alTbl; - for (i=0; i alTblIter ( alTbl.firstIter() ); albert *pa; @@ -280,29 +280,29 @@ int main() alTblIter++; } verify ( i == elementCount ); - alTbl.verify (); + alTbl.verify (); - for ( i = 0; i < elementCount; i++ ) { - verify ( pAlbert[i] == alTbl.lookup( pAlbert[i]->getId() ) ); - } - alTbl.verify (); + for ( i = 0; i < elementCount; i++ ) { + verify ( pAlbert[i] == alTbl.lookup( pAlbert[i]->getId() ) ); + } + alTbl.verify (); for ( i = 0; i < elementCount; i += 2 ) { verify ( pAlbert[i] == alTbl.remove ( pAlbert[i]->getId() ) ); - } - alTbl.verify (); + } + alTbl.verify (); for ( i = 0; i < elementCount; i += 2 ) { verify ( 0 == alTbl.lookup ( pAlbert[i]->getId() ) ); - } - alTbl.verify (); + } + alTbl.verify (); for ( i = 1; i < elementCount; i += 2 ) { verify ( pAlbert[i] == alTbl.lookup ( pAlbert[i]->getId() ) ); - } - alTbl.verify (); + } + alTbl.verify (); - return 0; + return 0; } diff --git a/modules/libcom/src/cxxTemplates/test/tsDLListBench.cc b/modules/libcom/src/cxxTemplates/test/tsDLListBench.cc index 577a3829d..3bd75a1e9 100644 --- a/modules/libcom/src/cxxTemplates/test/tsDLListBench.cc +++ b/modules/libcom/src/cxxTemplates/test/tsDLListBench.cc @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include "tsDLList.h" @@ -15,15 +15,15 @@ class fred : public tsDLNode { public: - fred() : count(0) {} - void inc () {count++;} + fred() : count(0) {} + void inc () {count++;} private: - unsigned count; + unsigned count; }; class jane : public fred, public tsDLNode { public: - jane() {} + jane() {} private: }; @@ -31,41 +31,41 @@ private: int main () { - tsDLList list; - tsDLIter iter = list.firstIter(); - fred *pFred; - unsigned i; - clock_t clk; - clock_t diff; - double delay; + tsDLList list; + tsDLIter iter = list.firstIter(); + fred *pFred; + unsigned i; + clock_t clk; + clock_t diff; + double delay; - for (i=0; iinc(); + clk = clock(); + while ( iter.valid() ) { + iter->inc(); iter++; - } - diff = clock() - clk; - delay = diff; - delay = delay/CLOCKS_PER_SEC; - delay = delay/LOOPCOUNT; - printf("delay = %15.10f\n", delay); + } + diff = clock() - clk; + delay = diff; + delay = delay/CLOCKS_PER_SEC; + delay = delay/LOOPCOUNT; + printf("delay = %15.10f\n", delay); - pFred = new fred(); - clk = clock(); - for (i=0; iinc(); - } - diff = clock() - clk; - delay = diff; - delay = delay/CLOCKS_PER_SEC; - delay = delay/LOOPCOUNT; - printf("delay = %15.10f\n", delay); + pFred = new fred(); + clk = clock(); + for (i=0; iinc(); + } + diff = clock() - clk; + delay = diff; + delay = delay/CLOCKS_PER_SEC; + delay = delay/LOOPCOUNT; + printf("delay = %15.10f\n", delay); - return 0; + return 0; } diff --git a/modules/libcom/src/cxxTemplates/test/tsDLListTest.cc b/modules/libcom/src/cxxTemplates/test/tsDLListTest.cc index 02fe0dcd9..9d81bb330 100644 --- a/modules/libcom/src/cxxTemplates/test/tsDLListTest.cc +++ b/modules/libcom/src/cxxTemplates/test/tsDLListTest.cc @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ @@ -71,10 +71,10 @@ int main () } pJane = new jane("JA"); - janeList.add(*pJane); + janeList.add(*pJane); pJane = new jane("JB"); verify ( janeList.find ( *pJane ) == -1 ); - janeList.add(*pJane); + janeList.add(*pJane); verify ( janeList.find ( *pJane ) == 1 ); while ( janeFwdIter.valid() ) { @@ -116,9 +116,9 @@ int main () verify (janeList.count()==0); pJane = new jane("JA"); - janeList.add(*pJane); + janeList.add(*pJane); pJane = new jane("JB"); - janeList.add(*pJane); + janeList.add(*pJane); janeBwdIter = janeList.lastIter(); while ( janeBwdIter.valid() ) { janeList.remove( * janeBwdIter.pointer() ); diff --git a/modules/libcom/src/cxxTemplates/test/tsSLListBench.cc b/modules/libcom/src/cxxTemplates/test/tsSLListBench.cc index 0b786dfd3..fe5de962f 100644 --- a/modules/libcom/src/cxxTemplates/test/tsSLListBench.cc +++ b/modules/libcom/src/cxxTemplates/test/tsSLListBench.cc @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ @@ -19,20 +19,20 @@ * gnuc does not provide this under sunos4 */ #if !defined(CLOCKS_PER_SEC) && defined(SUNOS4) -# define CLOCKS_PER_SEC 1000000 +# define CLOCKS_PER_SEC 1000000 #endif class fred : public tsSLNode { public: - fred() : count(0) {} - void inc () {count++;} + fred() : count(0) {} + void inc () {count++;} private: - unsigned count; + unsigned count; }; class jane : public fred, public tsSLNode { public: - jane() {} + jane() {} private: }; @@ -40,46 +40,46 @@ private: int main () { - tsSLList list; - fred *pFred; - unsigned i; - clock_t clk; - clock_t diff; - double delay; + tsSLList list; + fred *pFred; + unsigned i; + clock_t clk; + clock_t diff; + double delay; - for (i=0; i iter ( list.firstIter () ); - while ( iter.valid () ) { - iter->inc (); + clk = clock(); + { + tsSLIter iter ( list.firstIter () ); + while ( iter.valid () ) { + iter->inc (); iter++; - } - } - diff = clock() - clk; - delay = diff; - delay = delay/CLOCKS_PER_SEC; - delay = delay/LOOPCOUNT; - printf("delay = %15.10f\n", delay); + } + } + diff = clock() - clk; + delay = diff; + delay = delay/CLOCKS_PER_SEC; + delay = delay/LOOPCOUNT; + printf("delay = %15.10f\n", delay); - pFred = new fred(); - clk = clock(); - { - tsSLIter iter ( list.firstIter () ); - for ( i=0; iinc(); - } - } - diff = clock() - clk; - delay = diff; - delay = delay/CLOCKS_PER_SEC; - delay = delay/LOOPCOUNT; - printf("delay = %15.10f\n", delay); + pFred = new fred(); + clk = clock(); + { + tsSLIter iter ( list.firstIter () ); + for ( i=0; iinc(); + } + } + diff = clock() - clk; + delay = diff; + delay = delay/CLOCKS_PER_SEC; + delay = delay/LOOPCOUNT; + printf("delay = %15.10f\n", delay); - return 0; + return 0; } diff --git a/modules/libcom/src/cxxTemplates/test/tsSLListTest.cc b/modules/libcom/src/cxxTemplates/test/tsSLListTest.cc index 32f96359d..aef355e3f 100644 --- a/modules/libcom/src/cxxTemplates/test/tsSLListTest.cc +++ b/modules/libcom/src/cxxTemplates/test/tsSLListTest.cc @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ @@ -16,91 +16,91 @@ class fred : public tsSLNode { public: - fred(const char * const pNameIn) : pName(pNameIn){} - void show () {printf("%s\n", pName);} + fred(const char * const pNameIn) : pName(pNameIn){} + void show () {printf("%s\n", pName);} private: - const char * const pName; + const char * const pName; }; class jane : public fred, public tsSLNode { public: - jane(const char * const pNameIn) : fred(pNameIn){} + jane(const char * const pNameIn) : fred(pNameIn){} private: }; int main () { - tsSLList list; - fred *pFred; - fred *pFredII; - fred *pFredBack; - tsSLList janeList; - jane *pJane; + tsSLList list; + fred *pFred; + fred *pFredII; + fred *pFredBack; + tsSLList janeList; + jane *pJane; - pFred = new fred("A"); - pFredII = new fred("B"); + pFred = new fred("A"); + pFredII = new fred("B"); - list.add(*pFred); - list.add(*pFredII); - { + list.add(*pFred); + list.add(*pFredII); + { tsSLIter iter1 = list.firstIter (); - tsSLIter iter2 = iter1; - tsSLIter iter3 = iter1; - assert ( iter1 == iter3++ ); - assert ( iter3 == ++iter2 ); + tsSLIter iter2 = iter1; + tsSLIter iter3 = iter1; + assert ( iter1 == iter3++ ); + assert ( iter3 == ++iter2 ); list.remove ( *pFredII ); // removes pFred - } - list.add ( *pFred ); - pFredBack = list.get(); - assert (pFredBack == pFred); - pFredBack = list.get(); - assert (pFredBack == pFredII); - list.add(*pFredII); - list.add(*pFred); + } + list.add ( *pFred ); + pFredBack = list.get(); + assert (pFredBack == pFred); + pFredBack = list.get(); + assert (pFredBack == pFredII); + list.add(*pFredII); + list.add(*pFred); while ( list.get () ); - pFredBack = list.get(); - assert (pFredBack == 0); - list.add(*pFred); - list.add(*pFredII); - list.add(* new fred("C")); - list.add(* new fred("D")); + pFredBack = list.get(); + assert (pFredBack == 0); + list.add(*pFred); + list.add(*pFredII); + list.add(* new fred("C")); + list.add(* new fred("D")); - { - tsSLIter < fred > iter = list.firstIter(); - while ( iter.valid () ) { - iter->show(); + { + tsSLIter < fred > iter = list.firstIter(); + while ( iter.valid () ) { + iter->show(); ++iter; - } - } + } + } - pJane = new jane("JA"); - janeList.add(*pJane); - pJane = new jane("JB"); - janeList.add(*pJane); + pJane = new jane("JA"); + janeList.add(*pJane); + pJane = new jane("JB"); + janeList.add(*pJane); - { - tsSLIter < jane > iter = janeList.firstIter (); - while ( iter.valid () ) { - iter->show(); + { + tsSLIter < jane > iter = janeList.firstIter (); + while ( iter.valid () ) { + iter->show(); ++iter; - } - } + } + } - { - tsSLIter < fred > iter = list.firstIter (); - while ( iter.valid () ) { - iter->show (); + { + tsSLIter < fred > iter = list.firstIter (); + while ( iter.valid () ) { + iter->show (); iter++; - } - } + } + } while ( list.get () ); - { - tsSLIter < fred > iter = list.firstIter (); + { + tsSLIter < fred > iter = list.firstIter (); assert ( ! iter.valid () ); - } + } - return 0; + return 0; } diff --git a/modules/libcom/src/cxxTemplates/tsDLList.h b/modules/libcom/src/cxxTemplates/tsDLList.h index a315ecaab..6a982b35a 100644 --- a/modules/libcom/src/cxxTemplates/tsDLList.h +++ b/modules/libcom/src/cxxTemplates/tsDLList.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * type safe doubly linked list templates @@ -76,7 +76,7 @@ private: T * pFirst; T * pLast; unsigned itemCount; - void clear (); + void clear (); tsDLList ( const tsDLList & ); // not allowed const tsDLList & operator = ( const tsDLList & ); // not allowed }; @@ -84,7 +84,7 @@ private: // // class tsDLIterConst // -// bi-directional iterator for a const doubly linked list +// bi-directional iterator for a const doubly linked list // template class tsDLIterConst { @@ -96,10 +96,10 @@ public: tsDLIterConst & operator = ( const tsDLIterConst & ); const T & operator * () const; const T * operator -> () const; - tsDLIterConst & operator ++ (); - tsDLIterConst operator ++ (int); - tsDLIterConst & operator -- (); - tsDLIterConst operator -- (int); + tsDLIterConst & operator ++ (); + tsDLIterConst operator ++ (int); + tsDLIterConst & operator -- (); + tsDLIterConst operator -- (int); const T * pointer () const; private: const T * pEntry; @@ -110,7 +110,7 @@ private: // // class tsDLIter // -// bi-directional iterator for a doubly linked list +// bi-directional iterator for a doubly linked list // template class tsDLIter { @@ -122,10 +122,10 @@ public: tsDLIter & operator = ( const tsDLIter & ); T & operator * () const; T * operator -> () const; - tsDLIter & operator ++ (); - tsDLIter operator ++ ( int ); - tsDLIter & operator -- (); - tsDLIter operator -- ( int ); + tsDLIter & operator ++ (); + tsDLIter operator ++ ( int ); + tsDLIter & operator -- (); + tsDLIter operator -- ( int ); T * pointer () const; private: T * pEntry; @@ -144,19 +144,19 @@ template inline tsDLNode::tsDLNode() : pNext(0), pPrev(0) {} template -inline tsDLNode::tsDLNode ( const tsDLNode & ) : +inline tsDLNode::tsDLNode ( const tsDLNode & ) : pNext (0), pPrev(0) {} // // tsDLNode::operator = () // -// when someone tries to copy another node into a node +// when someone tries to copy another node into a node // do _not_ change the node pointers // template -inline const tsDLNode & tsDLNode::operator = ( const tsDLNode & ) -{ - return * this; +inline const tsDLNode & tsDLNode::operator = ( const tsDLNode & ) +{ + return * this; } ////////////////////////////////////// @@ -167,7 +167,7 @@ inline const tsDLNode & tsDLNode::operator = ( const tsDLNode & ) // tsDLList::tsDLList () // template -inline tsDLList::tsDLList () +inline tsDLList::tsDLList () { this->clear (); } @@ -180,25 +180,25 @@ inline tsDLList::tsDLList () template inline unsigned tsDLList::count () const { - return this->itemCount; + return this->itemCount; } // // tsDLList::first () // template -inline T * tsDLList::first (void) const +inline T * tsDLList::first (void) const { - return this->pFirst; + return this->pFirst; } // // tsDLList::last () // template -inline T *tsDLList::last (void) const -{ - return this->pLast; +inline T *tsDLList::last (void) const +{ + return this->pLast; } // @@ -225,7 +225,7 @@ inline void tsDLList::remove ( T &item ) } else { tsDLNode &nextNode = *theNode.pNext; - nextNode.pPrev = theNode.pPrev; + nextNode.pPrev = theNode.pPrev; } if ( this->pFirst == &item ) { @@ -235,7 +235,7 @@ inline void tsDLList::remove ( T &item ) tsDLNode &prevNode = *theNode.pPrev; prevNode.pNext = theNode.pNext; } - + this->itemCount--; } @@ -243,7 +243,7 @@ inline void tsDLList::remove ( T &item ) // tsDLList::removeAll () // template -inline void tsDLList::removeAll ( +inline void tsDLList::removeAll ( tsDLList & destination ) { destination.pFirst = this->pFirst; @@ -265,7 +265,7 @@ inline T * tsDLList::get() if ( pItem ) { this->remove ( *pItem ); } - + return pItem; } @@ -281,7 +281,7 @@ inline T * tsDLList::pop () // // tsDLList::add () -// +// // adds addList to the end of the list // (and removes all items from addList) // @@ -384,7 +384,7 @@ inline void tsDLList::insertBefore (T &item, T &itemAfter) // // tsDLList::push () -// +// // adds pushList to the beginning of the list // (and removes all items from pushList) // @@ -433,7 +433,7 @@ inline void tsDLList::push (T &item) } // -// tsDLList::find () +// tsDLList::find () // returns -1 if the item isnt on the list // and the node number (beginning with zero if // it is) @@ -495,11 +495,11 @@ inline tsDLIter tsDLList < T > :: invalidIter () // tsDLIterConst member functions ////////////////////////////////////////// template -inline tsDLIterConst::tsDLIterConst ( const T *pInitialEntry ) : +inline tsDLIterConst::tsDLIterConst ( const T *pInitialEntry ) : pEntry ( pInitialEntry ) {} template -inline tsDLIterConst::tsDLIterConst () : +inline tsDLIterConst::tsDLIterConst () : pEntry ( 0 ) {} template @@ -543,7 +543,7 @@ inline const T * tsDLIterConst::operator -> () const // prefix ++ // template -inline tsDLIterConst & tsDLIterConst::operator ++ () +inline tsDLIterConst & tsDLIterConst::operator ++ () { const tsDLNode &node = *this->pEntry; this->pEntry = node.pNext; @@ -554,7 +554,7 @@ inline tsDLIterConst & tsDLIterConst::operator ++ () // postfix ++ // template -inline tsDLIterConst tsDLIterConst::operator ++ (int) +inline tsDLIterConst tsDLIterConst::operator ++ (int) { const tsDLIterConst tmp = *this; const tsDLNode &node = *this->pEntry; @@ -563,10 +563,10 @@ inline tsDLIterConst tsDLIterConst::operator ++ (int) } // -// prefix -- +// prefix -- // template -inline tsDLIterConst & tsDLIterConst::operator -- () +inline tsDLIterConst & tsDLIterConst::operator -- () { const tsDLNode &entryNode = *this->pEntry; this->pEntry = entryNode.pPrev; @@ -574,10 +574,10 @@ inline tsDLIterConst & tsDLIterConst::operator -- () } // -// postfix -- +// postfix -- // template -inline tsDLIterConst tsDLIterConst::operator -- (int) +inline tsDLIterConst tsDLIterConst::operator -- (int) { const tsDLIterConst tmp = *this; const tsDLNode &entryNode = *this->pEntry; @@ -596,11 +596,11 @@ inline const T * tsDLIterConst::pointer () const ////////////////////////////////////////// template -inline tsDLIter::tsDLIter ( T * pInitialEntry ) : +inline tsDLIter::tsDLIter ( T * pInitialEntry ) : pEntry ( pInitialEntry ) {} template -inline tsDLIter::tsDLIter () : +inline tsDLIter::tsDLIter () : pEntry ( 0 ) {} template @@ -666,7 +666,7 @@ inline tsDLIter & tsDLIter::operator -- () // prefix -- } template -inline tsDLIter tsDLIter::operator -- (int) // postfix -- +inline tsDLIter tsDLIter::operator -- (int) // postfix -- { const tsDLIter tmp = *this; const tsDLNode &entryNode = *this->pEntry; diff --git a/modules/libcom/src/cxxTemplates/tsFreeList.h b/modules/libcom/src/cxxTemplates/tsFreeList.h index 55787ac6b..2ca4de48f 100644 --- a/modules/libcom/src/cxxTemplates/tsFreeList.h +++ b/modules/libcom/src/cxxTemplates/tsFreeList.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef tsFreeList_h @@ -16,7 +16,7 @@ */ // -// TODO: this should allow free list chaining so that a free +// TODO: this should allow free list chaining so that a free // list (in a different lock domain) is used to provide the // tsFreeListChunk. // @@ -24,14 +24,14 @@ // // To allow your class to be allocated off of a free list // using the new operator: -// -// 1) add the following static, private free list data members +// +// 1) add the following static, private free list data members // to your class // // static tsFreeList < class classXYZ > freeList; // // 2) add the following member functions to your class -// +// // inline void * classXYZ::operator new ( size_t size ) // { // return freeList.allocate ( size ); @@ -46,7 +46,7 @@ // // 1) A NOOP mutex class may be specified if mutual exclusion isnt required // -// 2) If you wish to force use of the new operator, then declare your class's +// 2) If you wish to force use of the new operator, then declare your class's // destructor as a protected member function. // // 3) Setting N to zero causes the free list to be bypassed @@ -71,16 +71,16 @@ // ms visual studio 6.0 and before incorrectly // warn about a missing delete operator if only the -// newly preferred delete operator with a size argument -// is present -#if defined ( _MSC_VER ) && _MSC_VER <= 1200 -# pragma warning ( disable : 4291 ) +// newly preferred delete operator with a size argument +// is present +#if defined ( _MSC_VER ) && _MSC_VER <= 1200 +# pragma warning ( disable : 4291 ) #endif template < class T > union tsFreeListItem; template < class T, unsigned N> struct tsFreeListChunk; -template < class T, unsigned N = 0x400, +template < class T, unsigned N = 0x400, class MUTEX = epicsMutex > class tsFreeList { public: @@ -110,7 +110,7 @@ struct tsFreeListChunk { }; template < class T, unsigned N, class MUTEX > -inline tsFreeList < T, N, MUTEX > :: tsFreeList () : +inline tsFreeList < T, N, MUTEX > :: tsFreeList () : pFreeList ( 0 ), pChunkList ( 0 ) {} template < class T, unsigned N, class MUTEX > @@ -123,7 +123,7 @@ tsFreeList < T, N, MUTEX > :: ~tsFreeList () } template < class T, unsigned N, class MUTEX > -void * tsFreeList < T, N, MUTEX >::allocate ( size_t size ) +void * tsFreeList < T, N, MUTEX >::allocate ( size_t size ) { if ( size != sizeof ( T ) || N == 0u || tsFreeListDebugBypass ) { void * p = ::operator new ( size ); @@ -142,9 +142,9 @@ void * tsFreeList < T, N, MUTEX >::allocate ( size_t size ) } template < class T, unsigned N, class MUTEX > -void * tsFreeList < T, N, MUTEX >::allocateFromNewChunk () +void * tsFreeList < T, N, MUTEX >::allocateFromNewChunk () { - tsFreeListChunk < T, N > * pChunk = + tsFreeListChunk < T, N > * pChunk = new tsFreeListChunk < T, N >; for ( unsigned i=1u; i < N-1; i++ ) { @@ -161,7 +161,7 @@ void * tsFreeList < T, N, MUTEX >::allocateFromNewChunk () } template < class T, unsigned N, class MUTEX > -void tsFreeList < T, N, MUTEX >::release ( void * pCadaver, size_t size ) +void tsFreeList < T, N, MUTEX >::release ( void * pCadaver, size_t size ) { if ( size != sizeof ( T ) ) { tsFreeListMemSetDelete ( pCadaver, size ); @@ -181,7 +181,7 @@ void tsFreeList < T, N, MUTEX >::release ( void * pCadaver ) } else if ( pCadaver ) { epicsGuard < MUTEX > guard ( this->mutex ); - tsFreeListItem < T > * p = + tsFreeListItem < T > * p = static_cast < tsFreeListItem < T > * > ( pCadaver ); p->pNext = this->pFreeList; this->pFreeList = p; diff --git a/modules/libcom/src/cxxTemplates/tsMinMax.h b/modules/libcom/src/cxxTemplates/tsMinMax.h index 5adac3ef2..516e7c257 100644 --- a/modules/libcom/src/cxxTemplates/tsMinMax.h +++ b/modules/libcom/src/cxxTemplates/tsMinMax.h @@ -5,24 +5,24 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ // -// simple type safe inline template functions to replace +// simple type safe inline template functions to replace // the min() and max() macros // #ifndef tsMinMaxh #define tsMinMaxh -template +template inline const T & tsMax ( const T & a, const T & b ) { return ( a > b ) ? a : b; } - -template + +template inline const T & tsMin ( const T & a, const T & b ) { return ( a < b ) ? a : b; diff --git a/modules/libcom/src/cxxTemplates/tsSLList.h b/modules/libcom/src/cxxTemplates/tsSLList.h index ce29a6f5c..61aea62ad 100644 --- a/modules/libcom/src/cxxTemplates/tsSLList.h +++ b/modules/libcom/src/cxxTemplates/tsSLList.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * type safe singly linked list templates @@ -57,7 +57,7 @@ template < class T > class tsSLList : public tsSLNode < T > { public: tsSLList (); // creates an empty list - tsSLList ( tsSLList & ); + tsSLList ( tsSLList & ); void insert ( T &item, tsSLNode < T > &itemBefore ); // insert after item before void add ( T &item ); // add to the beginning of the list T * get (); // remove from the beginning of the list @@ -145,7 +145,7 @@ inline tsSLNode < T > :: tsSLNode ( const tsSLNode < T > & ) // do _not_ change the node pointers // template < class T > -inline tsSLNode < T > & tsSLNode < T >::operator = +inline tsSLNode < T > & tsSLNode < T >::operator = ( const tsSLNode < T > & ) { return *this; @@ -291,13 +291,13 @@ inline tsSLIter tsSLList < T > :: invalidIter () ////////////////////////////////////////// template < class T > -inline tsSLIterConst::tsSLIterConst ( const T *pInitialEntry ) : +inline tsSLIterConst::tsSLIterConst ( const T *pInitialEntry ) : pEntry ( pInitialEntry ) { } template < class T > -inline tsSLIterConst::tsSLIterConst () : +inline tsSLIterConst::tsSLIterConst () : pEntry ( 0 ) { } @@ -321,7 +321,7 @@ inline bool tsSLIterConst::operator != (const tsSLIterConst &rhs) const } template < class T > -inline tsSLIterConst & tsSLIterConst::operator = ( const tsSLIterConst & rhs ) +inline tsSLIterConst & tsSLIterConst::operator = ( const tsSLIterConst & rhs ) { this->pEntry = rhs.pEntry; return *this; @@ -369,13 +369,13 @@ inline const T * tsSLIterConst < T > :: pointer () const ////////////////////////////////////////// template < class T > -inline tsSLIter::tsSLIter ( T *pInitialEntry ) : +inline tsSLIter::tsSLIter ( T *pInitialEntry ) : pEntry ( pInitialEntry ) { } template < class T > -inline tsSLIter::tsSLIter () : +inline tsSLIter::tsSLIter () : pEntry ( 0 ) { } @@ -399,7 +399,7 @@ inline bool tsSLIter::operator != ( const tsSLIter &rhs ) const } template < class T > -inline tsSLIter & tsSLIter::operator = ( const tsSLIter & rhs ) +inline tsSLIter & tsSLIter::operator = ( const tsSLIter & rhs ) { this->pEntry = rhs.pEntry; return *this; diff --git a/modules/libcom/src/dbmf/dbmf.c b/modules/libcom/src/dbmf/dbmf.c index 035e75ace..acb7e1cca 100644 --- a/modules/libcom/src/dbmf/dbmf.c +++ b/modules/libcom/src/dbmf/dbmf.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Author: Jim Kowalkowski and Marty Kraimer @@ -38,8 +38,8 @@ #ifndef DBMF_FREELIST_DEBUG /*Default values for dblfInit */ -#define DBMF_SIZE 64 -#define DBMF_INITIAL_ITEMS 10 +#define DBMF_SIZE 64 +#define DBMF_INITIAL_ITEMS 10 typedef struct chunkNode {/*control block for each set of chunkItems*/ ELLNODE node; @@ -205,34 +205,34 @@ void dbmfFree(void* mem) int dbmfShow(int level) { if(pdbmfPvt==NULL) { - printf("Never initialized\n"); - return(0); + printf("Never initialized\n"); + return(0); } printf("size %lu allocSize %lu chunkItems %d ", - (unsigned long)pdbmfPvt->size, - (unsigned long)pdbmfPvt->allocSize,pdbmfPvt->chunkItems); + (unsigned long)pdbmfPvt->size, + (unsigned long)pdbmfPvt->allocSize,pdbmfPvt->chunkItems); printf("nAlloc %d nFree %d nChunks %d nGtSize %d\n", - pdbmfPvt->nAlloc,pdbmfPvt->nFree, - ellCount(&pdbmfPvt->chunkList),pdbmfPvt->nGtSize); + pdbmfPvt->nAlloc,pdbmfPvt->nFree, + ellCount(&pdbmfPvt->chunkList),pdbmfPvt->nGtSize); if(level>0) { chunkNode *pchunkNode; pchunkNode = (chunkNode *)ellFirst(&pdbmfPvt->chunkList); while(pchunkNode) { - printf("pchunkNode %p nNotFree %d\n", - (void*)pchunkNode,pchunkNode->nNotFree); - pchunkNode = (chunkNode *)ellNext(&pchunkNode->node); - } + printf("pchunkNode %p nNotFree %d\n", + (void*)pchunkNode,pchunkNode->nNotFree); + pchunkNode = (chunkNode *)ellNext(&pchunkNode->node); + } } if(level>1) { - void **pnextFree;; + void **pnextFree;; epicsMutexMustLock(pdbmfPvt->lock); - pnextFree = (void**)pdbmfPvt->freeList; - while(pnextFree) { - printf("%p\n",*pnextFree); - pnextFree = (void**)*pnextFree; - } + pnextFree = (void**)pdbmfPvt->freeList; + while(pnextFree) { + printf("%p\n",*pnextFree); + pnextFree = (void**)*pnextFree; + } epicsMutexUnlock(pdbmfPvt->lock); } return(0); @@ -288,11 +288,11 @@ void dbmfFreeChunks(void) {} char * dbmfStrcat3(const char *lhs, const char *mid, const char *rhs) { - size_t len = strlen(lhs) + strlen(mid) + strlen(rhs) + 1; - char *buf = dbmfMalloc(len); - strcpy(buf, lhs); - strcat(buf, mid); - strcat(buf, rhs); - return buf; + size_t len = strlen(lhs) + strlen(mid) + strlen(rhs) + 1; + char *buf = dbmfMalloc(len); + strcpy(buf, lhs); + strcat(buf, mid); + strcat(buf, rhs); + return buf; } diff --git a/modules/libcom/src/ellLib/ellLib.c b/modules/libcom/src/ellLib/ellLib.c index 184202fb3..ae970ee07 100644 --- a/modules/libcom/src/ellLib/ellLib.c +++ b/modules/libcom/src/ellLib/ellLib.c @@ -46,7 +46,7 @@ void ellAdd (ELLLIST *pList, ELLNODE *pNode) void ellConcat (ELLLIST *pDstList, ELLLIST *pAddList) { if (pAddList->count == 0) - return; /* Add list is empty, nothing to add. */ + return; /* Add list is empty, nothing to add. */ if (pDstList->count == 0) { /* Destination list is empty... just transfer the add list over. */ diff --git a/modules/libcom/src/env/envDefs.h b/modules/libcom/src/env/envDefs.h index adf9e68c5..9ddd66670 100644 --- a/modules/libcom/src/env/envDefs.h +++ b/modules/libcom/src/env/envDefs.h @@ -95,7 +95,7 @@ struct in_addr; * NULL if no parameter value and default value was empty. */ LIBCOM_API char * epicsStdCall - envGetConfigParam(const ENV_PARAM *pParam, int bufDim, char *pBuf); + envGetConfigParam(const ENV_PARAM *pParam, int bufDim, char *pBuf); /** * \brief Get a configuration parameter's value or default string. @@ -106,7 +106,7 @@ LIBCOM_API char * epicsStdCall * were empty or not set. */ LIBCOM_API const char * epicsStdCall - envGetConfigParamPtr(const ENV_PARAM *pParam); + envGetConfigParamPtr(const ENV_PARAM *pParam); /** * \brief Print the value of a configuration parameter. @@ -115,7 +115,7 @@ LIBCOM_API const char * epicsStdCall * \return 0 */ LIBCOM_API long epicsStdCall - envPrtConfigParam(const ENV_PARAM *pParam); + envPrtConfigParam(const ENV_PARAM *pParam); /** * \brief Get value of an inet addr config parameter. @@ -134,7 +134,7 @@ LIBCOM_API long epicsStdCall * \return 0, or -1 if an error is encountered */ LIBCOM_API long epicsStdCall - envGetInetAddrConfigParam(const ENV_PARAM *pParam, struct in_addr *pAddr); + envGetInetAddrConfigParam(const ENV_PARAM *pParam, struct in_addr *pAddr); /** * \brief Get value of a double configuration parameter. @@ -152,7 +152,7 @@ LIBCOM_API long epicsStdCall * \return 0, or -1 if an error is encountered */ LIBCOM_API long epicsStdCall - envGetDoubleConfigParam(const ENV_PARAM *pParam, double *pDouble); + envGetDoubleConfigParam(const ENV_PARAM *pParam, double *pDouble); /** * \brief Get value of a long configuration parameter. @@ -170,7 +170,7 @@ LIBCOM_API long epicsStdCall * \return 0, or -1 if an error is encountered */ LIBCOM_API long epicsStdCall - envGetLongConfigParam(const ENV_PARAM *pParam, long *pLong); + envGetLongConfigParam(const ENV_PARAM *pParam, long *pLong); /** * \brief Get value of a port number configuration parameter. @@ -187,7 +187,7 @@ LIBCOM_API long epicsStdCall * \return Port number. */ LIBCOM_API unsigned short epicsStdCall envGetInetPortConfigParam - (const ENV_PARAM *pEnv, unsigned short defaultPort); + (const ENV_PARAM *pEnv, unsigned short defaultPort); /** * \brief Get value of a boolean configuration parameter. * diff --git a/modules/libcom/src/env/envSubr.c b/modules/libcom/src/env/envSubr.c index d981ac376..7d69474dd 100644 --- a/modules/libcom/src/env/envSubr.c +++ b/modules/libcom/src/env/envSubr.c @@ -5,26 +5,26 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* - * Author: Roger A. Cole - * Date: 07-20-91 + * Author: Roger A. Cole + * Date: 07-20-91 */ /*+/mod*********************************************************************** -* TITLE envSubr.c - routines to get and set EPICS environment parameters +* TITLE envSubr.c - routines to get and set EPICS environment parameters * * DESCRIPTION -* These routines are oriented for use with EPICS environment -* parameters under UNIX and VxWorks. They may be used for other -* purposes, as well. +* These routines are oriented for use with EPICS environment +* parameters under UNIX and VxWorks. They may be used for other +* purposes, as well. * -* Many EPICS environment parameters are predefined in envDefs.h. +* Many EPICS environment parameters are predefined in envDefs.h. * * QUICK REFERENCE * #include "envDefs.h" -* ENV_PARAM param; -* char *envGetConfigParamPtr( pParam ) +* ENV_PARAM param; +* char *envGetConfigParamPtr( pParam ) * char *envGetConfigParam( pParam, bufDim, pBuf ) * long envGetLongConfigParam( pParam, pLong ) * long envGetDoubleConfigParam( pParam, pDouble ) @@ -32,7 +32,7 @@ * long envPrtConfigParam( pParam ) * * SEE ALSO -* $epics/share/bin/envSetupParams, envDefs.h +* $epics/share/bin/envSetupParams, envDefs.h * *-***************************************************************************/ @@ -51,49 +51,49 @@ /*+/subr********************************************************************** -* NAME envGetConfigParamPtr - returns a pointer to the configuration -* parameter value string +* NAME envGetConfigParamPtr - returns a pointer to the configuration +* parameter value string * * DESCRIPTION -* Returns a pointer to a configuration parameter value. -* If the configuration parameter isn't found in the environment, -* then a pointer to the default value for the parameter is copied. -* If no parameter is found and there is no default, then -* NULL is returned. +* Returns a pointer to a configuration parameter value. +* If the configuration parameter isn't found in the environment, +* then a pointer to the default value for the parameter is copied. +* If no parameter is found and there is no default, then +* NULL is returned. * * RETURNS -* pointer to the environment variable value string, or -* NULL if no parameter value and no default value was found +* pointer to the environment variable value string, or +* NULL if no parameter value and no default value was found * * EXAMPLES -* 1. Get the value for the EPICS-defined environment parameter -* EPICS_TS_NTP_INET. +* 1. Get the value for the EPICS-defined environment parameter +* EPICS_TS_NTP_INET. * -* #include "envDefs.h" -* const char *pStr; +* #include "envDefs.h" +* const char *pStr; * -* pStr = envGetConfigParamPtr(&EPICS_TS_NTP_INET); -* if (pStr) { -* printf("NTP time server is: %s\n", pStr); -* } +* pStr = envGetConfigParamPtr(&EPICS_TS_NTP_INET); +* if (pStr) { +* printf("NTP time server is: %s\n", pStr); +* } * *-*/ const char * epicsStdCall envGetConfigParamPtr( const ENV_PARAM *pParam /* I pointer to config param structure */ ) { - const char *pEnv; /* pointer to environment string */ + const char *pEnv; /* pointer to environment string */ pEnv = getenv(pParam->name); if (pEnv == NULL) { - pEnv = pParam->pdflt; + pEnv = pParam->pdflt; } if (pEnv) { - if (pEnv[0u] == '\0') { - pEnv = NULL; - } + if (pEnv[0u] == '\0') { + pEnv = NULL; + } } return pEnv; @@ -101,52 +101,52 @@ const ENV_PARAM *pParam /* I pointer to config param structure */ /*+/subr********************************************************************** -* NAME envGetConfigParam - get value of a configuration parameter +* NAME envGetConfigParam - get value of a configuration parameter * * DESCRIPTION -* Gets the value of a configuration parameter and copies it -* into the caller's buffer. If the configuration parameter -* isn't found in the environment, then the default value for -* the parameter is copied. If no parameter is found and there -* is no default, then '\0' is copied and NULL is returned. +* Gets the value of a configuration parameter and copies it +* into the caller's buffer. If the configuration parameter +* isn't found in the environment, then the default value for +* the parameter is copied. If no parameter is found and there +* is no default, then '\0' is copied and NULL is returned. * * RETURNS -* pointer to callers buffer, or -* NULL if no parameter value or default value was found +* pointer to callers buffer, or +* NULL if no parameter value or default value was found * * EXAMPLES -* 1. Get the value for the EPICS-defined environment parameter -* EPICS_TS_NTP_INET. +* 1. Get the value for the EPICS-defined environment parameter +* EPICS_TS_NTP_INET. * -* #include "envDefs.h" -* char temp[80]; +* #include "envDefs.h" +* char temp[80]; * -* printf("NTP time server is: %s\n", -* envGetConfigParam(&EPICS_TS_NTP_INET, sizeof(temp), temp)); +* printf("NTP time server is: %s\n", +* envGetConfigParam(&EPICS_TS_NTP_INET, sizeof(temp), temp)); * -* 2. Get the value for the DISPLAY environment parameter under UNIX. +* 2. Get the value for the DISPLAY environment parameter under UNIX. * -* #include "envDefs.h" -* char temp[80]; -* ENV_PARAM display={"DISPLAY",""} +* #include "envDefs.h" +* char temp[80]; +* ENV_PARAM display={"DISPLAY",""} * -* if (envGetConfigParam(&display, sizeof(temp), temp) == NULL) -* printf("DISPLAY isn't defined\n"); -* else -* printf("DISPLAY is %s\n", temp); +* if (envGetConfigParam(&display, sizeof(temp), temp) == NULL) +* printf("DISPLAY isn't defined\n"); +* else +* printf("DISPLAY is %s\n", temp); * *-*/ char * epicsStdCall envGetConfigParam( const ENV_PARAM *pParam,/* I pointer to config param structure */ -int bufDim, /* I dimension of parameter buffer */ -char *pBuf /* I pointer to parameter buffer */ +int bufDim, /* I dimension of parameter buffer */ +char *pBuf /* I pointer to parameter buffer */ ) { - const char *pEnv; /* pointer to environment string */ + const char *pEnv; /* pointer to environment string */ pEnv = envGetConfigParamPtr(pParam); if (!pEnv) { - return NULL; + return NULL; } strncpy(pBuf, pEnv, bufDim-1); @@ -156,166 +156,166 @@ char *pBuf /* I pointer to parameter buffer */ } /*+/subr********************************************************************** -* NAME envGetDoubleConfigParam - get value of a double configuration parameter +* NAME envGetDoubleConfigParam - get value of a double configuration parameter * * DESCRIPTION -* Gets the value of a configuration parameter and copies it into the -* caller's real (double) buffer. If the configuration parameter isn't -* found in the environment, then the default value for the parameter -* is copied. +* Gets the value of a configuration parameter and copies it into the +* caller's real (double) buffer. If the configuration parameter isn't +* found in the environment, then the default value for the parameter +* is copied. * -* If no parameter is found and there is no default, then -1 is -* returned and the caller's buffer is unmodified. +* If no parameter is found and there is no default, then -1 is +* returned and the caller's buffer is unmodified. * * RETURNS -* 0, or -* -1 if an error is encountered +* 0, or +* -1 if an error is encountered * * EXAMPLE -* 1. Get the value for the real environment parameter EPICS_THRESHOLD. +* 1. Get the value for the real environment parameter EPICS_THRESHOLD. * -* #include "envDefs.h" -* double threshold; -* long status; +* #include "envDefs.h" +* double threshold; +* long status; * -* status = envGetDoubleConfigParam(&EPICS_THRESHOLD, &threshold); -* if (status == 0) { -* printf("the threshold is: %lf\n", threshold); -* } -* else { -* printf("%s could not be found or was not a real number\n", -* EPICS_THRESHOLD.name); -* } +* status = envGetDoubleConfigParam(&EPICS_THRESHOLD, &threshold); +* if (status == 0) { +* printf("the threshold is: %lf\n", threshold); +* } +* else { +* printf("%s could not be found or was not a real number\n", +* EPICS_THRESHOLD.name); +* } * *-*/ long epicsStdCall envGetDoubleConfigParam( const ENV_PARAM *pParam,/* I pointer to config param structure */ -double *pDouble /* O pointer to place to store value */ +double *pDouble /* O pointer to place to store value */ ) { - char text[128]; - char *ptext; - int count; + char text[128]; + char *ptext; + int count; ptext = envGetConfigParam(pParam, sizeof text, text); if (ptext != NULL) { - count = epicsScanDouble(text, pDouble); - if (count == 1) { - return 0; - } - (void)fprintf(stderr,"Unable to find a real number in %s=%s\n", - pParam->name, text); + count = epicsScanDouble(text, pDouble); + if (count == 1) { + return 0; + } + (void)fprintf(stderr,"Unable to find a real number in %s=%s\n", + pParam->name, text); } return -1; } /*+/subr********************************************************************** -* NAME envGetInetAddrConfigParam - get value of an inet addr config parameter +* NAME envGetInetAddrConfigParam - get value of an inet addr config parameter * * DESCRIPTION -* Gets the value of a configuration parameter and copies it into -* the caller's (struct in_addr) buffer. If the configuration parameter -* isn't found in the environment, then the default value for -* the parameter is copied. +* Gets the value of a configuration parameter and copies it into +* the caller's (struct in_addr) buffer. If the configuration parameter +* isn't found in the environment, then the default value for +* the parameter is copied. * -* If no parameter is found and there is no default, then -1 is -* returned and the callers buffer is unmodified. +* If no parameter is found and there is no default, then -1 is +* returned and the callers buffer is unmodified. * * RETURNS -* 0, or -* -1 if an error is encountered +* 0, or +* -1 if an error is encountered * * EXAMPLE -* 1. Get the value for the inet address environment parameter EPICS_INET. +* 1. Get the value for the inet address environment parameter EPICS_INET. * -* #include "envDefs.h" -* struct in_addr addr; -* long status; +* #include "envDefs.h" +* struct in_addr addr; +* long status; * -* status = envGetInetAddrConfigParam(&EPICS_INET, &addr); -* if (status == 0) { -* printf("the s_addr is: %x\n", addr.s_addr); -* } -* else { -* printf("%s could not be found or was not an inet address\n", -* EPICS_INET.name); -* } +* status = envGetInetAddrConfigParam(&EPICS_INET, &addr); +* if (status == 0) { +* printf("the s_addr is: %x\n", addr.s_addr); +* } +* else { +* printf("%s could not be found or was not an inet address\n", +* EPICS_INET.name); +* } * *-*/ long epicsStdCall envGetInetAddrConfigParam( const ENV_PARAM *pParam,/* I pointer to config param structure */ -struct in_addr *pAddr /* O pointer to struct to receive inet addr */ +struct in_addr *pAddr /* O pointer to struct to receive inet addr */ ) { - char text[128]; - char *ptext; - long status; - struct sockaddr_in sin; + char text[128]; + char *ptext; + long status; + struct sockaddr_in sin; ptext = envGetConfigParam(pParam, sizeof text, text); if (ptext) { - status = aToIPAddr (text, 0u, &sin); - if (status == 0) { - *pAddr = sin.sin_addr; - return 0; - } - (void)fprintf(stderr,"Unable to find an IP address or valid host name in %s=%s\n", - pParam->name, text); + status = aToIPAddr (text, 0u, &sin); + if (status == 0) { + *pAddr = sin.sin_addr; + return 0; + } + (void)fprintf(stderr,"Unable to find an IP address or valid host name in %s=%s\n", + pParam->name, text); } return -1; } /*+/subr********************************************************************** -* NAME envGetLongConfigParam - get value of an integer config parameter +* NAME envGetLongConfigParam - get value of an integer config parameter * * DESCRIPTION -* Gets the value of a configuration parameter and copies it -* into the caller's integer (long) buffer. If the configuration -* parameter isn't found in the environment, then the default value for -* the parameter is copied. +* Gets the value of a configuration parameter and copies it +* into the caller's integer (long) buffer. If the configuration +* parameter isn't found in the environment, then the default value for +* the parameter is copied. * -* If no parameter is found and there is no default, then -1 is -* returned and the callers buffer is unmodified. +* If no parameter is found and there is no default, then -1 is +* returned and the callers buffer is unmodified. * * RETURNS -* 0, or -* -1 if an error is encountered +* 0, or +* -1 if an error is encountered * * EXAMPLE -* 1. Get the value as a long for the integer environment parameter -* EPICS_NUMBER_OF_ITEMS. +* 1. Get the value as a long for the integer environment parameter +* EPICS_NUMBER_OF_ITEMS. * -* #include "envDefs.h" -* long count; -* long status; +* #include "envDefs.h" +* long count; +* long status; * -* status = envGetLongConfigParam(&EPICS_NUMBER_OF_ITEMS, &count); -* if (status == 0) { -* printf("and the count is: %d\n", count); -* } -* else { -* printf("%s could not be found or was not an integer\n", -* EPICS_NUMBER_OF_ITEMS.name); -* } +* status = envGetLongConfigParam(&EPICS_NUMBER_OF_ITEMS, &count); +* if (status == 0) { +* printf("and the count is: %d\n", count); +* } +* else { +* printf("%s could not be found or was not an integer\n", +* EPICS_NUMBER_OF_ITEMS.name); +* } * *-*/ long epicsStdCall envGetLongConfigParam( const ENV_PARAM *pParam,/* I pointer to config param structure */ -long *pLong /* O pointer to place to store value */ +long *pLong /* O pointer to place to store value */ ) { - char text[128]; - char *ptext; - int count; + char text[128]; + char *ptext; + int count; ptext = envGetConfigParam(pParam, sizeof text, text); if (ptext) { - count = sscanf(text, "%ld", pLong); - if (count == 1) - return 0; - (void)fprintf(stderr,"Unable to find an integer in %s=%s\n", - pParam->name, text); + count = sscanf(text, "%ld", pLong); + if (count == 1) + return 0; + (void)fprintf(stderr,"Unable to find an integer in %s=%s\n", + pParam->name, text); } return -1; } @@ -333,33 +333,33 @@ envGetBoolConfigParam(const ENV_PARAM *pParam, int *pBool) } /*+/subr********************************************************************** -* NAME envPrtConfigParam - print value of a configuration parameter +* NAME envPrtConfigParam - print value of a configuration parameter * * DESCRIPTION -* Prints the value of a configuration parameter. +* Prints the value of a configuration parameter. * * RETURNS -* 0 +* 0 * * EXAMPLE -* 1. Print the value for the EPICS-defined environment parameter -* EPICS_TS_NTP_INET. +* 1. Print the value for the EPICS-defined environment parameter +* EPICS_TS_NTP_INET. * -* #include "envDefs.h" +* #include "envDefs.h" * -* envPrtConfigParam(&EPICS_TS_NTP_INET); +* envPrtConfigParam(&EPICS_TS_NTP_INET); * *-*/ long epicsStdCall envPrtConfigParam( -const ENV_PARAM *pParam) /* pointer to config param structure */ +const ENV_PARAM *pParam) /* pointer to config param structure */ { const char *pVal; pVal = envGetConfigParamPtr(pParam); if (pVal == NULL) - fprintf(stdout, "%s is undefined\n", pParam->name); + fprintf(stdout, "%s is undefined\n", pParam->name); else - fprintf(stdout,"%s: %s\n", pParam->name, pVal); + fprintf(stdout,"%s: %s\n", pParam->name, pVal); return 0; } @@ -384,9 +384,9 @@ long epicsStdCall epicsPrtEnvParams(void) { const ENV_PARAM **ppParam = env_param_list; - + while (*ppParam != NULL) - envPrtConfigParam(*(ppParam++)); + envPrtConfigParam(*(ppParam++)); return 0; } diff --git a/modules/libcom/src/error/epicsPrint.h b/modules/libcom/src/error/epicsPrint.h index db889794a..5a99d9b5b 100644 --- a/modules/libcom/src/error/epicsPrint.h +++ b/modules/libcom/src/error/epicsPrint.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /*epicsPrint.h */ diff --git a/modules/libcom/src/error/errSymTbl.h b/modules/libcom/src/error/errSymTbl.h index c3c0c49af..3412ddda2 100644 --- a/modules/libcom/src/error/errSymTbl.h +++ b/modules/libcom/src/error/errSymTbl.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef INC_errSymTbl_H diff --git a/modules/libcom/src/error/errlog.c b/modules/libcom/src/error/errlog.c index 702a15772..9aa5f2794 100644 --- a/modules/libcom/src/error/errlog.c +++ b/modules/libcom/src/error/errlog.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Original Author: Marty Kraimer diff --git a/modules/libcom/src/error/errlog.h b/modules/libcom/src/error/errlog.h index d70516353..c0d15ac80 100644 --- a/modules/libcom/src/error/errlog.h +++ b/modules/libcom/src/error/errlog.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef INC_errlog_H diff --git a/modules/libcom/src/error/makeStatTbl.pl b/modules/libcom/src/error/makeStatTbl.pl index e9ca10eda..cf43281f9 100644 --- a/modules/libcom/src/error/makeStatTbl.pl +++ b/modules/libcom/src/error/makeStatTbl.pl @@ -6,7 +6,7 @@ # Copyright (c) 2014 The Regents of the University of California, as # Operator of Los Alamos National Laboratory. # EPICS BASE is distributed subject to a Software License Agreement found -# in file LICENSE that is included with this distribution. +# in file LICENSE that is included with this distribution. #************************************************************************* # # makeStatTbl.pl - Create Error Symbol Table diff --git a/modules/libcom/src/fdmgr/fdManager.cpp b/modules/libcom/src/fdmgr/fdManager.cpp index 4be6a56ce..a25eeba4c 100644 --- a/modules/libcom/src/fdmgr/fdManager.cpp +++ b/modules/libcom/src/fdmgr/fdManager.cpp @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ // // File descriptor management C++ class library @@ -15,7 +15,7 @@ // johill@lanl.gov // 505 665 1831 // -// NOTES: +// NOTES: // 1) This library is not thread safe // @@ -38,19 +38,19 @@ const unsigned uSecPerSec = 1000u * mSecPerSec; // fdManager::fdManager() // // hopefully its a reasonable guess that select() and epicsThreadSleep() -// will have the same sleep quantum +// will have the same sleep quantum // LIBCOM_API fdManager::fdManager () : - sleepQuantum ( epicsThreadSleepQuantum () ), + sleepQuantum ( epicsThreadSleepQuantum () ), fdSetsPtr ( new fd_set [fdrNEnums] ), - pTimerQueue ( 0 ), maxFD ( 0 ), processInProg ( false ), + pTimerQueue ( 0 ), maxFD ( 0 ), processInProg ( false ), pCBReg ( 0 ) { int status = osiSockAttach (); assert (status); for ( size_t i = 0u; i < fdrNEnums; i++ ) { - FD_ZERO ( &fdSetsPtr[i] ); + FD_ZERO ( &fdSetsPtr[i] ); } } @@ -82,7 +82,7 @@ LIBCOM_API void fdManager::process (double delay) this->lazyInitTimerQueue (); // - // no recursion + // no recursion // if (this->processInProg) { return; @@ -105,7 +105,7 @@ LIBCOM_API void fdManager::process (double delay) bool ioPending = false; tsDLIter < fdReg > iter = this->regList.firstIter (); while ( iter.valid () ) { - FD_SET(iter->getFD(), &this->fdSetsPtr[iter->getType()]); + FD_SET(iter->getFD(), &this->fdSetsPtr[iter->getType()]); ioPending = true; ++iter; } @@ -151,7 +151,7 @@ LIBCOM_API void fdManager::process (double delay) // // Tag current fdReg so that we - // can detect if it was deleted + // can detect if it was deleted // during the call back // this->pCBReg = pReg; @@ -159,7 +159,7 @@ LIBCOM_API void fdManager::process (double delay) if (this->pCBReg != NULL) { // // check only after we see that it is non-null so - // that we dont trigger bounds-checker dangling pointer + // that we dont trigger bounds-checker dangling pointer // error // assert (this->pCBReg==pReg); @@ -176,8 +176,8 @@ LIBCOM_API void fdManager::process (double delay) } else if ( status < 0 ) { int errnoCpy = SOCKERRNO; - - // dont depend on flags being properly set if + + // dont depend on flags being properly set if // an error is retuned from select for ( size_t i = 0u; i < fdrNEnums; i++ ) { FD_ZERO ( &fdSetsPtr[i] ); @@ -188,9 +188,9 @@ LIBCOM_API void fdManager::process (double delay) // if ( errnoCpy != SOCK_EINTR ) { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - fprintf ( stderr, + fprintf ( stderr, "fdManager: select failed because \"%s\"\n", sockErrBuf ); } @@ -244,7 +244,7 @@ void fdReg::show(unsigned level) const // void fdRegId::show ( unsigned level ) const { - printf ( "fdRegId at %p\n", + printf ( "fdRegId at %p\n", static_cast ( this ) ); if ( level > 1u ) { printf ( "\tfd = %d, type = %d\n", @@ -258,7 +258,7 @@ void fdRegId::show ( unsigned level ) const void fdManager::installReg (fdReg ®) { this->maxFD = max ( this->maxFD, reg.getFD()+1 ); - // Most applications will find that its important to push here to + // Most applications will find that its important to push here to // the front of the list so that transient writes get executed // first allowing incoming read protocol to find that outgoing // buffer space is newly available. @@ -280,7 +280,7 @@ void fdManager::removeReg (fdReg ®In) pItemFound = this->fdTbl.remove (regIn); if (pItemFound!=®In) { - fprintf(stderr, + fprintf(stderr, "fdManager::removeReg() bad fd registration object\n"); return; } @@ -292,7 +292,7 @@ void fdManager::removeReg (fdReg ®In) if (this->pCBReg == ®In) { this->pCBReg = 0; } - + switch (regIn.state) { case fdReg::active: this->activeList.remove (regIn); @@ -336,19 +336,19 @@ LIBCOM_API fdReg *fdManager::lookUpFD (const SOCKET fd, const fdRegType type) return NULL; } fdRegId id (fd,type); - return this->fdTbl.lookup(id); + return this->fdTbl.lookup(id); } // // fdReg::fdReg() // -fdReg::fdReg (const SOCKET fdIn, const fdRegType typIn, - const bool onceOnlyIn, fdManager &managerIn) : - fdRegId (fdIn,typIn), state (limbo), +fdReg::fdReg (const SOCKET fdIn, const fdRegType typIn, + const bool onceOnlyIn, fdManager &managerIn) : + fdRegId (fdIn,typIn), state (limbo), onceOnly (onceOnlyIn), manager (managerIn) -{ +{ if (!FD_IN_FDSET(fdIn)) { - fprintf (stderr, "%s: fd > FD_SETSIZE ignored\n", + fprintf (stderr, "%s: fd > FD_SETSIZE ignored\n", __FILE__); return; } diff --git a/modules/libcom/src/fdmgr/fdManager.h b/modules/libcom/src/fdmgr/fdManager.h index 585c2ef71..0dd9d40d7 100644 --- a/modules/libcom/src/fdmgr/fdManager.h +++ b/modules/libcom/src/fdmgr/fdManager.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * File descriptor management C++ class library @@ -99,7 +99,7 @@ private: // Set to fdreg when in call back // and nill otherwise // - fdReg * pCBReg; + fdReg * pCBReg; void reschedule (); double quantum (); void installReg (fdReg ®); @@ -126,18 +126,18 @@ class LIBCOM_API fdReg : public: - fdReg (const SOCKET fdIn, const fdRegType type, + fdReg (const SOCKET fdIn, const fdRegType type, const bool onceOnly=false, fdManager &manager = fileDescriptorManager); virtual ~fdReg (); virtual void show (unsigned level) const; - + // // Called by the file descriptor manager: - // 1) If the fdManager is deleted and there are still + // 1) If the fdManager is deleted and there are still // fdReg objects attached // 2) Immediately after calling "callBack()" if - // the constructor specified "onceOnly" + // the constructor specified "onceOnly" // // fdReg::destroy() does a "delete this" // @@ -171,10 +171,10 @@ inline resTableIndex fdRegId::hash () const const unsigned fdManagerHashTableMinIndexBits = 8; const unsigned fdManagerHashTableMaxIndexBits = sizeof(SOCKET)*CHAR_BIT; resTableIndex hashid; - - hashid = integerHash ( fdManagerHashTableMinIndexBits, + + hashid = integerHash ( fdManagerHashTableMinIndexBits, fdManagerHashTableMaxIndexBits, this->fd ); - + // // also evenly distribute based on the type of fdRegType // @@ -187,18 +187,18 @@ inline resTableIndex fdRegId::hash () const return hashid; } -inline void fdManager::lazyInitTimerQueue () +inline void fdManager::lazyInitTimerQueue () { if ( ! this->pTimerQueue ) { this->pTimerQueue = & epicsTimerQueuePassive::create ( *this ); } } -inline epicsTimer & fdManager::createTimer () +inline epicsTimer & fdManager::createTimer () { this->lazyInitTimerQueue (); return this->pTimerQueue->createTimer (); } #endif // fdManagerH_included - + diff --git a/modules/libcom/src/fdmgr/fdmgr.cpp b/modules/libcom/src/fdmgr/fdmgr.cpp index a9d734896..67ad3a51f 100644 --- a/modules/libcom/src/fdmgr/fdmgr.cpp +++ b/modules/libcom/src/fdmgr/fdmgr.cpp @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ // // File descriptor management C++ class library @@ -15,7 +15,7 @@ // johill@lanl.gov // 505 665 1831 // -// NOTES: +// NOTES: // 1) the routines in this file provide backward compatibility with the original // "C" based file descriptor manager API // 2) This library is _not_ thread safe @@ -26,7 +26,7 @@ #include "epicsAssert.h" #include "fdManager.h" #include "fdmgr.h" - + static const fdRegType fdiToFdRegType[] = {fdrRead, fdrWrite, fdrException}; static const unsigned fdiToFdRegTypeNElements = sizeof (fdiToFdRegType) / sizeof (fdiToFdRegType[0]); const unsigned mSecPerSec = 1000u; @@ -41,15 +41,15 @@ public: class doubleDelete {}; LIBCOM_API fdRegForOldFdmgr (const SOCKET fdIn, const fdRegType type, - const bool onceOnly, fdManager &manager, pCallBackFDMgr pFunc, void *pParam); + const bool onceOnly, fdManager &manager, pCallBackFDMgr pFunc, void *pParam); LIBCOM_API ~fdRegForOldFdmgr (); private: pCallBackFDMgr pFunc; void *pParam; - LIBCOM_API virtual void callBack (); - fdRegForOldFdmgr ( const fdRegForOldFdmgr & ); - fdRegForOldFdmgr & operator = ( const fdRegForOldFdmgr & ); + LIBCOM_API virtual void callBack (); + fdRegForOldFdmgr ( const fdRegForOldFdmgr & ); + fdRegForOldFdmgr & operator = ( const fdRegForOldFdmgr & ); }; class oldFdmgr; @@ -59,8 +59,8 @@ class oldFdmgr; // class timerForOldFdmgr : public epicsTimerNotify, public chronIntIdRes { public: - LIBCOM_API timerForOldFdmgr (oldFdmgr &fdmgr, double delay, pCallBackFDMgr pFunc, void *pParam); - LIBCOM_API virtual ~timerForOldFdmgr (); + LIBCOM_API timerForOldFdmgr (oldFdmgr &fdmgr, double delay, pCallBackFDMgr pFunc, void *pParam); + LIBCOM_API virtual ~timerForOldFdmgr (); // // exceptions @@ -74,8 +74,8 @@ private: void *pParam; unsigned id; LIBCOM_API expireStatus expire ( const epicsTime & currentTime ); - timerForOldFdmgr ( const timerForOldFdmgr & ); - timerForOldFdmgr & operator = ( const timerForOldFdmgr & ); + timerForOldFdmgr ( const timerForOldFdmgr & ); + timerForOldFdmgr & operator = ( const timerForOldFdmgr & ); }; class oldFdmgr : public fdManager { @@ -87,8 +87,8 @@ public: private: chronIntIdResTable resTbl; - oldFdmgr ( const oldFdmgr & ); - oldFdmgr & operator = ( const oldFdmgr & ); + oldFdmgr ( const oldFdmgr & ); + oldFdmgr & operator = ( const oldFdmgr & ); }; #ifdef _MSC_VER @@ -104,10 +104,10 @@ template class resTable; #endif LIBCOM_API fdRegForOldFdmgr::fdRegForOldFdmgr - (const SOCKET fdIn, const fdRegType typeIn, - const bool onceOnlyIn, fdManager &managerIn, + (const SOCKET fdIn, const fdRegType typeIn, + const bool onceOnlyIn, fdManager &managerIn, pCallBackFDMgr pFuncIn, void *pParamIn) : - fdReg (fdIn, typeIn, onceOnlyIn, managerIn), + fdReg (fdIn, typeIn, onceOnlyIn, managerIn), pFunc (pFuncIn), pParam (pParamIn) { if (pFuncIn==NULL) { @@ -127,9 +127,9 @@ LIBCOM_API void fdRegForOldFdmgr::callBack () (*this->pFunc) (this->pParam); } -timerForOldFdmgr::timerForOldFdmgr ( oldFdmgr &fdmgrIn, +timerForOldFdmgr::timerForOldFdmgr ( oldFdmgr &fdmgrIn, double delayIn, pCallBackFDMgr pFuncIn, void * pParamIn ) : - timer ( fdmgrIn.createTimer() ), + timer ( fdmgrIn.createTimer() ), fdmgr ( fdmgrIn ), pFunc ( pFuncIn ), pParam( pParamIn ) { if ( pFuncIn == NULL ) { @@ -182,8 +182,8 @@ extern "C" LIBCOM_API fdmgrAlarmId epicsStdCall fdmgr_add_timeout ( while (true) { try { - pTimer = new timerForOldFdmgr - (*pfdm, delay, pFunc, pParam); + pTimer = new timerForOldFdmgr + (*pfdm, delay, pFunc, pParam); } catch (...) { @@ -267,9 +267,9 @@ extern "C" LIBCOM_API int epicsStdCall fdmgr_add_callback ( return 0; } } - + extern "C" LIBCOM_API int epicsStdCall fdmgr_clear_callback ( - fdctx *pfdctx, SOCKET fd, enum fdi_type fdi) + fdctx *pfdctx, SOCKET fd, enum fdi_type fdi) { oldFdmgr *pfdm = static_cast (pfdctx); fdReg *pFDR; @@ -322,7 +322,7 @@ extern "C" LIBCOM_API int epicsStdCall fdmgr_delete (fdctx *pfdctx) */ extern "C" LIBCOM_API int epicsStdCall fdmgr_clear_fd (fdctx *pfdctx, SOCKET fd) { - return fdmgr_clear_callback(pfdctx, fd, fdi_read); + return fdmgr_clear_callback(pfdctx, fd, fdi_read); } /* @@ -331,5 +331,5 @@ extern "C" LIBCOM_API int epicsStdCall fdmgr_clear_fd (fdctx *pfdctx, SOCKET fd) extern "C" LIBCOM_API int epicsStdCall fdmgr_add_fd ( fdctx *pfdctx, SOCKET fd, void (*pfunc)(void *pParam), void *param) { - return fdmgr_add_callback (pfdctx, fd, fdi_read, pfunc, param); + return fdmgr_add_callback (pfdctx, fd, fdi_read, pfunc, param); } diff --git a/modules/libcom/src/fdmgr/fdmgr.h b/modules/libcom/src/fdmgr/fdmgr.h index f19643f77..f919f570e 100644 --- a/modules/libcom/src/fdmgr/fdmgr.h +++ b/modules/libcom/src/fdmgr/fdmgr.h @@ -5,12 +5,12 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* fdmgr.h * - * Header file associated with a file descriptor manager - * for use with the UNIX system call select + * Header file associated with a file descriptor manager + * for use with the UNIX system call select * * Author Jeffrey O. Hill * hill@atdiv.lanl.gov @@ -48,7 +48,7 @@ typedef void (*pCallBackFDMgr)(void *); * all versions: * * #if defined (NEW_FDMGR_ALARMID) - * fdmgrAlarmId XXXX + * fdmgrAlarmId XXXX * #elif defined (NEW_FDMGR_ALARM) * fdmgrAlarm *XXXX; * #else @@ -75,10 +75,10 @@ LIBCOM_API fdctx * epicsStdCall fdmgr_init(void); */ #define fdmgrNoAlarm 0 LIBCOM_API fdmgrAlarmId epicsStdCall fdmgr_add_timeout( -fdctx *pfdctx, /* fd mgr ctx from fdmgr_init() */ -struct timeval *ptimeout, /* relative delay from current time */ -pCallBackFDMgr pfunc, /* function (handler) to call */ -void *param /* first parameter passed to the func */ +fdctx *pfdctx, /* fd mgr ctx from fdmgr_init() */ +struct timeval *ptimeout, /* relative delay from current time */ +pCallBackFDMgr pfunc, /* function (handler) to call */ +void *param /* first parameter passed to the func */ ); /* @@ -86,8 +86,8 @@ void *param /* first parameter passed to the func */ * yet. */ LIBCOM_API int epicsStdCall fdmgr_clear_timeout( -fdctx *pfdctx, /* fd mgr ctx from fdmgr_init() */ -fdmgrAlarmId id /* alarm to delete */ +fdctx *pfdctx, /* fd mgr ctx from fdmgr_init() */ +fdmgrAlarmId id /* alarm to delete */ ); /* @@ -105,39 +105,39 @@ fdmgrAlarmId id /* alarm to delete */ * * write callbacks are called only once after each call to * fdmgr_add_callback() - * + * */ LIBCOM_API int epicsStdCall fdmgr_add_callback( -fdctx *pfdctx, /* fd mgr ctx from fdmgr_init() */ -SOCKET fd, /* file descriptor */ -enum fdi_type fdi, /* file descriptor interest type */ -pCallBackFDMgr pfunc, /* function (handler) to call */ -void *param /* first parameter passed to the func */ +fdctx *pfdctx, /* fd mgr ctx from fdmgr_init() */ +SOCKET fd, /* file descriptor */ +enum fdi_type fdi, /* file descriptor interest type */ +pCallBackFDMgr pfunc, /* function (handler) to call */ +void *param /* first parameter passed to the func */ ); /* - * + * * Clear nterest in a type of file descriptor activity (IO). * - */ + */ LIBCOM_API int epicsStdCall fdmgr_clear_callback( -fdctx *pfdctx, /* fd mgr ctx from fdmgr_init() */ -SOCKET fd, /* file descriptor */ -enum fdi_type fdi /* file descriptor interest type */ +fdctx *pfdctx, /* fd mgr ctx from fdmgr_init() */ +SOCKET fd, /* file descriptor */ +enum fdi_type fdi /* file descriptor interest type */ ); /* * - * Wait a specified delay relative from the current time for file - * descriptor activity (IO) or timeouts (timer expiration). Application - * specified functions (handlers) will not be called unless the + * Wait a specified delay relative from the current time for file + * descriptor activity (IO) or timeouts (timer expiration). Application + * specified functions (handlers) will not be called unless the * application waits in this function or polls it frequently - * enough. + * enough. * */ LIBCOM_API int epicsStdCall fdmgr_pend_event( -fdctx *pfdctx, /* fd mgr ctx from fdmgr_init() */ -struct timeval *ptimeout +fdctx *pfdctx, /* fd mgr ctx from fdmgr_init() */ +struct timeval *ptimeout ); @@ -145,18 +145,18 @@ struct timeval *ptimeout * obsolete interface */ LIBCOM_API int epicsStdCall fdmgr_clear_fd( -fdctx *pfdctx, /* fd mgr ctx from fdmgr_init() */ -SOCKET fd +fdctx *pfdctx, /* fd mgr ctx from fdmgr_init() */ +SOCKET fd ); /* * obsolete interface */ LIBCOM_API int epicsStdCall fdmgr_add_fd( -fdctx *pfdctx, /* fd mgr ctx from fdmgr_init() */ -SOCKET fd, -pCallBackFDMgr pfunc, /* function (handler) to call */ -void *param +fdctx *pfdctx, /* fd mgr ctx from fdmgr_init() */ +SOCKET fd, +pCallBackFDMgr pfunc, /* function (handler) to call */ +void *param ); LIBCOM_API int epicsStdCall fdmgr_delete(fdctx *pfdctx); diff --git a/modules/libcom/src/flex/ccl.c b/modules/libcom/src/flex/ccl.c index 36841d9b1..9930245c5 100644 --- a/modules/libcom/src/flex/ccl.c +++ b/modules/libcom/src/flex/ccl.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* ccl - routines for character classes */ @@ -14,7 +14,7 @@ * * This code is derived from software contributed to Berkeley by * Vern Paxson. - * + * * The United States Government has rights in this work pursuant * to contract no. DE-AC03-76SF00098 between the United States * Department of Energy and the University of California. @@ -54,19 +54,19 @@ void ccladd(int cclp, int ch) /* check to see if the character is already in the ccl */ for ( i = 0; i < len; ++i ) - if ( ccltbl[ind + i] == ch ) - return; + if ( ccltbl[ind + i] == ch ) + return; newpos = ind + len; if ( newpos >= current_max_ccl_tbl_size ) - { - current_max_ccl_tbl_size += MAX_CCL_TBL_SIZE_INCREMENT; + { + current_max_ccl_tbl_size += MAX_CCL_TBL_SIZE_INCREMENT; - ++num_reallocs; + ++num_reallocs; - ccltbl = reallocate_character_array( ccltbl, current_max_ccl_tbl_size ); - } + ccltbl = reallocate_character_array( ccltbl, current_max_ccl_tbl_size ); + } ccllen[cclp] = len + 1; ccltbl[newpos] = ch; @@ -83,30 +83,30 @@ void ccladd(int cclp, int ch) int cclinit(void) { if ( ++lastccl >= current_maxccls ) - { - current_maxccls += MAX_CCLS_INCREMENT; + { + current_maxccls += MAX_CCLS_INCREMENT; - ++num_reallocs; + ++num_reallocs; - cclmap = reallocate_integer_array( cclmap, current_maxccls ); - ccllen = reallocate_integer_array( ccllen, current_maxccls ); - cclng = reallocate_integer_array( cclng, current_maxccls ); - } + cclmap = reallocate_integer_array( cclmap, current_maxccls ); + ccllen = reallocate_integer_array( ccllen, current_maxccls ); + cclng = reallocate_integer_array( cclng, current_maxccls ); + } if ( lastccl == 1 ) - /* we're making the first ccl */ - cclmap[lastccl] = 0; + /* we're making the first ccl */ + cclmap[lastccl] = 0; else - /* the new pointer is just past the end of the last ccl. Since - * the cclmap points to the \first/ character of a ccl, adding the - * length of the ccl to the cclmap pointer will produce a cursor - * to the first free space - */ - cclmap[lastccl] = cclmap[lastccl - 1] + ccllen[lastccl - 1]; + /* the new pointer is just past the end of the last ccl. Since + * the cclmap points to the \first/ character of a ccl, adding the + * length of the ccl to the cclmap pointer will produce a cursor + * to the first free space + */ + cclmap[lastccl] = cclmap[lastccl - 1] + ccllen[lastccl - 1]; ccllen[lastccl] = 0; - cclng[lastccl] = 0; /* ccl's start out life un-negated */ + cclng[lastccl] = 0; /* ccl's start out life un-negated */ return ( lastccl ); } @@ -145,25 +145,25 @@ void list_character_set(FILE *file, int cset[]) putc( '[', file ); for ( i = 0; i < csize; ++i ) - { - if ( cset[i] ) - { - int start_char = i; + { + if ( cset[i] ) + { + int start_char = i; - putc( ' ', file ); + putc( ' ', file ); - fputs( readable_form( i ), file ); + fputs( readable_form( i ), file ); - while ( ++i < csize && cset[i] ) - ; + while ( ++i < csize && cset[i] ) + ; - if ( i - 1 > start_char ) - /* this was a run */ - fprintf( file, "-%s", readable_form( i - 1 ) ); + if ( i - 1 > start_char ) + /* this was a run */ + fprintf( file, "-%s", readable_form( i - 1 ) ); - putc( ' ', file ); - } - } + putc( ' ', file ); + } + } putc( ']', file ); } diff --git a/modules/libcom/src/flex/dfa.c b/modules/libcom/src/flex/dfa.c index 559a12fd1..c8f7d3ab0 100644 --- a/modules/libcom/src/flex/dfa.c +++ b/modules/libcom/src/flex/dfa.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* dfa - DFA construction routines */ @@ -14,7 +14,7 @@ * * This code is derived from software contributed to Berkeley by * Vern Paxson. - * + * * The United States Government has rights in this work pursuant * to contract no. DE-AC03-76SF00098 between the United States * Department of Energy and the University of California. @@ -59,22 +59,22 @@ int symfollowset (int[], int, int, int[]); void check_for_backtracking(int ds, int state[]) { if ( (reject && ! dfaacc[ds].dfaacc_set) || ! dfaacc[ds].dfaacc_state ) - { /* state is non-accepting */ - ++num_backtracking; + { /* state is non-accepting */ + ++num_backtracking; - if ( backtrack_report ) - { - fprintf( backtrack_file, "State #%d is non-accepting -\n", ds ); + if ( backtrack_report ) + { + fprintf( backtrack_file, "State #%d is non-accepting -\n", ds ); - /* identify the state */ - dump_associated_rules( backtrack_file, ds ); + /* identify the state */ + dump_associated_rules( backtrack_file, ds ); - /* now identify it further using the out- and jam-transitions */ - dump_transitions( backtrack_file, state ); + /* now identify it further using the out- and jam-transitions */ + dump_transitions( backtrack_file, state ); - putc( '\n', backtrack_file ); - } - } + putc( '\n', backtrack_file ); + } + } } @@ -105,32 +105,32 @@ void check_trailing_context(int *nfa_states, int num_states, int *accset, int na int i, j; for ( i = 1; i <= num_states; ++i ) - { - int ns = nfa_states[i]; - int type = state_type[ns]; - int ar = assoc_rule[ns]; + { + int ns = nfa_states[i]; + int type = state_type[ns]; + int ar = assoc_rule[ns]; - if ( type == STATE_NORMAL || rule_type[ar] != RULE_VARIABLE ) - { /* do nothing */ - } + if ( type == STATE_NORMAL || rule_type[ar] != RULE_VARIABLE ) + { /* do nothing */ + } - else if ( type == STATE_TRAILING_CONTEXT ) - { - /* potential trouble. Scan set of accepting numbers for - * the one marking the end of the "head". We assume that - * this looping will be fairly cheap since it's rare that - * an accepting number set is large. - */ - for ( j = 1; j <= nacc; ++j ) - if ( accset[j] & YY_TRAILING_HEAD_MASK ) - { - fprintf( stderr, - "%s: Dangerous trailing context in rule at line %d\n", - program_name, rule_linenum[ar] ); - return; - } - } - } + else if ( type == STATE_TRAILING_CONTEXT ) + { + /* potential trouble. Scan set of accepting numbers for + * the one marking the end of the "head". We assume that + * this looping will be fairly cheap since it's rare that + * an accepting number set is large. + */ + for ( j = 1; j <= nacc; ++j ) + if ( accset[j] & YY_TRAILING_HEAD_MASK ) + { + fprintf( stderr, + "%s: Dangerous trailing context in rule at line %d\n", + program_name, rule_linenum[ar] ); + return; + } + } + } } @@ -153,34 +153,34 @@ void dump_associated_rules(FILE *file, int ds) int rule_set[MAX_ASSOC_RULES + 1]; int *dset = dss[ds]; int size = dfasiz[ds]; - + for ( i = 1; i <= size; ++i ) - { - int rule_num = rule_linenum[assoc_rule[dset[i]]]; + { + int rule_num = rule_linenum[assoc_rule[dset[i]]]; - for ( j = 1; j <= num_associated_rules; ++j ) - if ( rule_num == rule_set[j] ) - break; + for ( j = 1; j <= num_associated_rules; ++j ) + if ( rule_num == rule_set[j] ) + break; - if ( j > num_associated_rules ) - { /* new rule */ - if ( num_associated_rules < MAX_ASSOC_RULES ) - rule_set[++num_associated_rules] = rule_num; - } - } + if ( j > num_associated_rules ) + { /* new rule */ + if ( num_associated_rules < MAX_ASSOC_RULES ) + rule_set[++num_associated_rules] = rule_num; + } + } bubble( rule_set, num_associated_rules ); fprintf( file, " associated rule line numbers:" ); for ( i = 1; i <= num_associated_rules; ++i ) - { - if ( i % 8 == 1 ) - putc( '\n', file ); - - fprintf( file, "\t%d", rule_set[i] ); - } - + { + if ( i % 8 == 1 ) + putc( '\n', file ); + + fprintf( file, "\t%d", rule_set[i] ); + } + putc( '\n', file ); } @@ -204,18 +204,18 @@ void dump_transitions(FILE *file, int state[]) int out_char_set[CSIZE]; for ( i = 0; i < csize; ++i ) - { - ec = abs( ecgroup[i] ); - out_char_set[i] = state[ec]; - } - + { + ec = abs( ecgroup[i] ); + out_char_set[i] = state[ec]; + } + fprintf( file, " out-transitions: " ); list_character_set( file, out_char_set ); /* now invert the members of the set to get the jam transitions */ for ( i = 0; i < csize; ++i ) - out_char_set[i] = ! out_char_set[i]; + out_char_set[i] = ! out_char_set[i]; fprintf( file, "\n jam-transitions: EOF " ); @@ -251,111 +251,111 @@ int *epsclosure(int *t, int *ns_addr, int accset[], int *nacc_addr, int *hv_addr int stkpos, ns, tsp; int numstates = *ns_addr, nacc, hashval, transsym, nfaccnum; int stkend, nstate; - static int did_stk_init = false, *stk; + static int did_stk_init = false, *stk; #define MARK_STATE(state) \ - trans1[state] = trans1[state] - MARKER_DIFFERENCE; + trans1[state] = trans1[state] - MARKER_DIFFERENCE; #define IS_MARKED(state) (trans1[state] < 0) #define UNMARK_STATE(state) \ - trans1[state] = trans1[state] + MARKER_DIFFERENCE; + trans1[state] = trans1[state] + MARKER_DIFFERENCE; #define CHECK_ACCEPT(state) \ - { \ - nfaccnum = accptnum[state]; \ - if ( nfaccnum != NIL ) \ - accset[++nacc] = nfaccnum; \ - } + { \ + nfaccnum = accptnum[state]; \ + if ( nfaccnum != NIL ) \ + accset[++nacc] = nfaccnum; \ + } #define DO_REALLOCATION \ - { \ - current_max_dfa_size += MAX_DFA_SIZE_INCREMENT; \ - ++num_reallocs; \ - t = reallocate_integer_array( t, current_max_dfa_size ); \ - stk = reallocate_integer_array( stk, current_max_dfa_size ); \ - } \ + { \ + current_max_dfa_size += MAX_DFA_SIZE_INCREMENT; \ + ++num_reallocs; \ + t = reallocate_integer_array( t, current_max_dfa_size ); \ + stk = reallocate_integer_array( stk, current_max_dfa_size ); \ + } \ #define PUT_ON_STACK(state) \ - { \ - if ( ++stkend >= current_max_dfa_size ) \ - DO_REALLOCATION \ - stk[stkend] = state; \ - MARK_STATE(state) \ - } + { \ + if ( ++stkend >= current_max_dfa_size ) \ + DO_REALLOCATION \ + stk[stkend] = state; \ + MARK_STATE(state) \ + } #define ADD_STATE(state) \ - { \ - if ( ++numstates >= current_max_dfa_size ) \ - DO_REALLOCATION \ - t[numstates] = state; \ - hashval = hashval + state; \ - } + { \ + if ( ++numstates >= current_max_dfa_size ) \ + DO_REALLOCATION \ + t[numstates] = state; \ + hashval = hashval + state; \ + } #define STACK_STATE(state) \ - { \ - PUT_ON_STACK(state) \ - CHECK_ACCEPT(state) \ - if ( nfaccnum != NIL || transchar[state] != SYM_EPSILON ) \ - ADD_STATE(state) \ - } + { \ + PUT_ON_STACK(state) \ + CHECK_ACCEPT(state) \ + if ( nfaccnum != NIL || transchar[state] != SYM_EPSILON ) \ + ADD_STATE(state) \ + } if ( ! did_stk_init ) - { - stk = allocate_integer_array( current_max_dfa_size ); - did_stk_init = true; - } + { + stk = allocate_integer_array( current_max_dfa_size ); + did_stk_init = true; + } nacc = stkend = hashval = 0; for ( nstate = 1; nstate <= numstates; ++nstate ) - { - ns = t[nstate]; + { + ns = t[nstate]; - /* the state could be marked if we've already pushed it onto - * the stack - */ - if ( ! IS_MARKED(ns) ) - PUT_ON_STACK(ns) + /* the state could be marked if we've already pushed it onto + * the stack + */ + if ( ! IS_MARKED(ns) ) + PUT_ON_STACK(ns) - CHECK_ACCEPT(ns) - hashval = hashval + ns; - } + CHECK_ACCEPT(ns) + hashval = hashval + ns; + } for ( stkpos = 1; stkpos <= stkend; ++stkpos ) - { - ns = stk[stkpos]; - transsym = transchar[ns]; + { + ns = stk[stkpos]; + transsym = transchar[ns]; - if ( transsym == SYM_EPSILON ) - { - tsp = trans1[ns] + MARKER_DIFFERENCE; + if ( transsym == SYM_EPSILON ) + { + tsp = trans1[ns] + MARKER_DIFFERENCE; - if ( tsp != NO_TRANSITION ) - { - if ( ! IS_MARKED(tsp) ) - STACK_STATE(tsp) + if ( tsp != NO_TRANSITION ) + { + if ( ! IS_MARKED(tsp) ) + STACK_STATE(tsp) - tsp = trans2[ns]; + tsp = trans2[ns]; - if ( tsp != NO_TRANSITION ) - if ( ! IS_MARKED(tsp) ) - STACK_STATE(tsp) - } - } - } + if ( tsp != NO_TRANSITION ) + if ( ! IS_MARKED(tsp) ) + STACK_STATE(tsp) + } + } + } /* clear out "visit" markers */ for ( stkpos = 1; stkpos <= stkend; ++stkpos ) - { - if ( IS_MARKED(stk[stkpos]) ) - { - UNMARK_STATE(stk[stkpos]) - } - else - flexfatal( "consistency check failed in epsclosure()" ); - } + { + if ( IS_MARKED(stk[stkpos]) ) + { + UNMARK_STATE(stk[stkpos]) + } + else + flexfatal( "consistency check failed in epsclosure()" ); + } *ns_addr = numstates; *hv_addr = hashval; @@ -382,7 +382,7 @@ void increase_max_dfas(void) dfaacc = reallocate_dfaacc_union( dfaacc, current_max_dfas ); if ( nultrans ) - nultrans = reallocate_integer_array( nultrans, current_max_dfas ); + nultrans = reallocate_integer_array( nultrans, current_max_dfas ); } @@ -399,7 +399,7 @@ void ntod(void) { int *accset, ds, nacc, newds; int sym, hashval, numstates, dsize; - int num_full_table_rows = 0; /* used only for -f */ + int num_full_table_rows = 0; /* used only for -f */ int *nset, *dset; int targptr, totaltrans, i, comstate, comfreq, targ; int *epsclosure(int *t, int *ns_addr, int *accset, int *nacc_addr, int *hv_addr); @@ -422,7 +422,7 @@ void ntod(void) * chk/nxt for unused records for space to put in the state */ if ( fullspd ) - firstfree = 0; + firstfree = 0; accset = allocate_integer_array( num_rules + 1 ); nset = allocate_integer_array( current_max_dfa_size ); @@ -436,19 +436,19 @@ void ntod(void) todo_head = todo_next = 0; for ( i = 0; i <= csize; ++i ) - { - duplist[i] = NIL; - symlist[i] = false; - } + { + duplist[i] = NIL; + symlist[i] = false; + } for ( i = 0; i <= num_rules; ++i ) - accset[i] = NIL; + accset[i] = NIL; if ( trace ) - { - dumpnfa( scset[1] ); - fputs( "\n\nDFA Dump:\n\n", stderr ); - } + { + dumpnfa( scset[1] ); + fputs( "\n\nDFA Dump:\n\n", stderr ); + } inittbl(); @@ -482,271 +482,271 @@ void ntod(void) * both (1) and (2) above */ if ( ! fullspd && ecgroup[0] == numecs ) - { /* NUL is alone in its equivalence class, which is the last one */ - int use_NUL_table = (numecs == csize); + { /* NUL is alone in its equivalence class, which is the last one */ + int use_NUL_table = (numecs == csize); - if ( fulltbl && ! use_NUL_table ) - { /* we still may want to use the table if numecs is a power of 2 */ - int power_of_two; + if ( fulltbl && ! use_NUL_table ) + { /* we still may want to use the table if numecs is a power of 2 */ + int power_of_two; - for ( power_of_two = 1; power_of_two <= csize; power_of_two *= 2 ) - if ( numecs == power_of_two ) - { - use_NUL_table = true; - break; - } - } + for ( power_of_two = 1; power_of_two <= csize; power_of_two *= 2 ) + if ( numecs == power_of_two ) + { + use_NUL_table = true; + break; + } + } - if ( use_NUL_table ) - nultrans = allocate_integer_array( current_max_dfas ); - /* from now on, nultrans != nil indicates that we're - * saving null transitions for later, separate encoding - */ - } + if ( use_NUL_table ) + nultrans = allocate_integer_array( current_max_dfas ); + /* from now on, nultrans != nil indicates that we're + * saving null transitions for later, separate encoding + */ + } if ( fullspd ) - { - for ( i = 0; i <= numecs; ++i ) - state[i] = 0; - place_state( state, 0, 0 ); - } + { + for ( i = 0; i <= numecs; ++i ) + state[i] = 0; + place_state( state, 0, 0 ); + } else if ( fulltbl ) - { - if ( nultrans ) - /* we won't be including NUL's transitions in the table, - * so build it for entries from 0 .. numecs - 1 - */ - num_full_table_rows = numecs; + { + if ( nultrans ) + /* we won't be including NUL's transitions in the table, + * so build it for entries from 0 .. numecs - 1 + */ + num_full_table_rows = numecs; - else - /* take into account the fact that we'll be including - * the NUL entries in the transition table. Build it - * from 0 .. numecs. - */ - num_full_table_rows = numecs + 1; + else + /* take into account the fact that we'll be including + * the NUL entries in the transition table. Build it + * from 0 .. numecs. + */ + num_full_table_rows = numecs + 1; - /* declare it "short" because it's a real long-shot that that - * won't be large enough. - */ - printf( "static short int yy_nxt[][%d] =\n {\n", - /* '}' so vi doesn't get too confused */ - num_full_table_rows ); + /* declare it "short" because it's a real long-shot that that + * won't be large enough. + */ + printf( "static short int yy_nxt[][%d] =\n {\n", + /* '}' so vi doesn't get too confused */ + num_full_table_rows ); - /* generate 0 entries for state #0 */ - for ( i = 0; i < num_full_table_rows; ++i ) - mk2data( 0 ); + /* generate 0 entries for state #0 */ + for ( i = 0; i < num_full_table_rows; ++i ) + mk2data( 0 ); - /* force ',' and dataflush() next call to mk2data */ - datapos = NUMDATAITEMS; + /* force ',' and dataflush() next call to mk2data */ + datapos = NUMDATAITEMS; - /* force extra blank line next dataflush() */ - dataline = NUMDATALINES; - } + /* force extra blank line next dataflush() */ + dataline = NUMDATALINES; + } /* create the first states */ num_start_states = lastsc * 2; for ( i = 1; i <= num_start_states; ++i ) - { - numstates = 1; + { + numstates = 1; - /* for each start condition, make one state for the case when - * we're at the beginning of the line (the '%' operator) and - * one for the case when we're not - */ - if ( i % 2 == 1 ) - nset[numstates] = scset[(i / 2) + 1]; - else - nset[numstates] = mkbranch( scbol[i / 2], scset[i / 2] ); + /* for each start condition, make one state for the case when + * we're at the beginning of the line (the '%' operator) and + * one for the case when we're not + */ + if ( i % 2 == 1 ) + nset[numstates] = scset[(i / 2) + 1]; + else + nset[numstates] = mkbranch( scbol[i / 2], scset[i / 2] ); - nset = epsclosure( nset, &numstates, accset, &nacc, &hashval ); + nset = epsclosure( nset, &numstates, accset, &nacc, &hashval ); - if ( snstods( nset, numstates, accset, nacc, hashval, &ds ) ) - { - numas += nacc; - totnst += numstates; - ++todo_next; + if ( snstods( nset, numstates, accset, nacc, hashval, &ds ) ) + { + numas += nacc; + totnst += numstates; + ++todo_next; - if ( variable_trailing_context_rules && nacc > 0 ) - check_trailing_context( nset, numstates, accset, nacc ); - } - } + if ( variable_trailing_context_rules && nacc > 0 ) + check_trailing_context( nset, numstates, accset, nacc ); + } + } if ( ! fullspd ) - { - if ( ! snstods( nset, 0, accset, 0, 0, &end_of_buffer_state ) ) - flexfatal( "could not create unique end-of-buffer state" ); + { + if ( ! snstods( nset, 0, accset, 0, 0, &end_of_buffer_state ) ) + flexfatal( "could not create unique end-of-buffer state" ); - ++numas; - ++num_start_states; - ++todo_next; - } + ++numas; + ++num_start_states; + ++todo_next; + } while ( todo_head < todo_next ) - { - targptr = 0; - totaltrans = 0; + { + targptr = 0; + totaltrans = 0; - for ( i = 1; i <= numecs; ++i ) - state[i] = 0; + for ( i = 1; i <= numecs; ++i ) + state[i] = 0; - ds = ++todo_head; + ds = ++todo_head; - dset = dss[ds]; - dsize = dfasiz[ds]; + dset = dss[ds]; + dsize = dfasiz[ds]; - if ( trace ) - fprintf( stderr, "state # %d:\n", ds ); + if ( trace ) + fprintf( stderr, "state # %d:\n", ds ); - sympartition( dset, dsize, symlist, duplist ); + sympartition( dset, dsize, symlist, duplist ); - for ( sym = 1; sym <= numecs; ++sym ) - { - if ( symlist[sym] ) - { - symlist[sym] = 0; + for ( sym = 1; sym <= numecs; ++sym ) + { + if ( symlist[sym] ) + { + symlist[sym] = 0; - if ( duplist[sym] == NIL ) - { /* symbol has unique out-transitions */ - numstates = symfollowset( dset, dsize, sym, nset ); - nset = epsclosure( nset, &numstates, accset, - &nacc, &hashval ); + if ( duplist[sym] == NIL ) + { /* symbol has unique out-transitions */ + numstates = symfollowset( dset, dsize, sym, nset ); + nset = epsclosure( nset, &numstates, accset, + &nacc, &hashval ); - if ( snstods( nset, numstates, accset, - nacc, hashval, &newds ) ) - { - totnst = totnst + numstates; - ++todo_next; - numas += nacc; + if ( snstods( nset, numstates, accset, + nacc, hashval, &newds ) ) + { + totnst = totnst + numstates; + ++todo_next; + numas += nacc; - if ( variable_trailing_context_rules && nacc > 0 ) - check_trailing_context( nset, numstates, - accset, nacc ); - } + if ( variable_trailing_context_rules && nacc > 0 ) + check_trailing_context( nset, numstates, + accset, nacc ); + } - state[sym] = newds; + state[sym] = newds; - if ( trace ) - fprintf( stderr, "\t%d\t%d\n", sym, newds ); + if ( trace ) + fprintf( stderr, "\t%d\t%d\n", sym, newds ); - targfreq[++targptr] = 1; - targstate[targptr] = newds; - ++numuniq; - } + targfreq[++targptr] = 1; + targstate[targptr] = newds; + ++numuniq; + } - else - { - /* sym's equivalence class has the same transitions - * as duplist(sym)'s equivalence class - */ - targ = state[duplist[sym]]; - state[sym] = targ; + else + { + /* sym's equivalence class has the same transitions + * as duplist(sym)'s equivalence class + */ + targ = state[duplist[sym]]; + state[sym] = targ; - if ( trace ) - fprintf( stderr, "\t%d\t%d\n", sym, targ ); + if ( trace ) + fprintf( stderr, "\t%d\t%d\n", sym, targ ); - /* update frequency count for destination state */ + /* update frequency count for destination state */ - i = 0; - while ( targstate[++i] != targ ) - ; + i = 0; + while ( targstate[++i] != targ ) + ; - ++targfreq[i]; - ++numdup; - } + ++targfreq[i]; + ++numdup; + } - ++totaltrans; - duplist[sym] = NIL; - } - } + ++totaltrans; + duplist[sym] = NIL; + } + } - numsnpairs = numsnpairs + totaltrans; + numsnpairs = numsnpairs + totaltrans; - if ( caseins && ! useecs ) - { - int j; + if ( caseins && ! useecs ) + { + int j; - for ( i = 'A', j = 'a'; i <= 'Z'; ++i, ++j ) - state[i] = state[j]; - } + for ( i = 'A', j = 'a'; i <= 'Z'; ++i, ++j ) + state[i] = state[j]; + } - if ( ds > num_start_states ) - check_for_backtracking( ds, state ); + if ( ds > num_start_states ) + check_for_backtracking( ds, state ); - if ( nultrans ) - { - nultrans[ds] = state[NUL_ec]; - state[NUL_ec] = 0; /* remove transition */ - } + if ( nultrans ) + { + nultrans[ds] = state[NUL_ec]; + state[NUL_ec] = 0; /* remove transition */ + } - if ( fulltbl ) - { - /* supply array's 0-element */ - if ( ds == end_of_buffer_state ) - mk2data( -end_of_buffer_state ); - else - mk2data( end_of_buffer_state ); + if ( fulltbl ) + { + /* supply array's 0-element */ + if ( ds == end_of_buffer_state ) + mk2data( -end_of_buffer_state ); + else + mk2data( end_of_buffer_state ); - for ( i = 1; i < num_full_table_rows; ++i ) - /* jams are marked by negative of state number */ - mk2data( state[i] ? state[i] : -ds ); + for ( i = 1; i < num_full_table_rows; ++i ) + /* jams are marked by negative of state number */ + mk2data( state[i] ? state[i] : -ds ); - /* force ',' and dataflush() next call to mk2data */ - datapos = NUMDATAITEMS; + /* force ',' and dataflush() next call to mk2data */ + datapos = NUMDATAITEMS; - /* force extra blank line next dataflush() */ - dataline = NUMDATALINES; - } + /* force extra blank line next dataflush() */ + dataline = NUMDATALINES; + } else if ( fullspd ) - place_state( state, ds, totaltrans ); + place_state( state, ds, totaltrans ); - else if ( ds == end_of_buffer_state ) - /* special case this state to make sure it does what it's - * supposed to, i.e., jam on end-of-buffer - */ - stack1( ds, 0, 0, JAMSTATE ); + else if ( ds == end_of_buffer_state ) + /* special case this state to make sure it does what it's + * supposed to, i.e., jam on end-of-buffer + */ + stack1( ds, 0, 0, JAMSTATE ); - else /* normal, compressed state */ - { - /* determine which destination state is the most common, and - * how many transitions to it there are - */ + else /* normal, compressed state */ + { + /* determine which destination state is the most common, and + * how many transitions to it there are + */ - comfreq = 0; - comstate = 0; + comfreq = 0; + comstate = 0; - for ( i = 1; i <= targptr; ++i ) - if ( targfreq[i] > comfreq ) - { - comfreq = targfreq[i]; - comstate = targstate[i]; - } + for ( i = 1; i <= targptr; ++i ) + if ( targfreq[i] > comfreq ) + { + comfreq = targfreq[i]; + comstate = targstate[i]; + } - bldtbl( state, ds, totaltrans, comstate, comfreq ); - } - } + bldtbl( state, ds, totaltrans, comstate, comfreq ); + } + } if ( fulltbl ) - dataend(); + dataend(); else if ( ! fullspd ) - { - cmptmps(); /* create compressed template entries */ + { + cmptmps(); /* create compressed template entries */ - /* create tables for all the states with only one out-transition */ - while ( onesp > 0 ) - { - mk1tbl( onestate[onesp], onesym[onesp], onenext[onesp], - onedef[onesp] ); - --onesp; - } + /* create tables for all the states with only one out-transition */ + while ( onesp > 0 ) + { + mk1tbl( onestate[onesp], onesym[onesp], onenext[onesp], + onedef[onesp] ); + --onesp; + } - mkdeftbl(); - } + mkdeftbl(); + } } @@ -767,108 +767,108 @@ int snstods(int sns[], int numstates, int accset[], int nacc, int hashval, int * int newds, *oldsns; for ( i = 1; i <= lastdfa; ++i ) - if ( hashval == dhash[i] ) - { - if ( numstates == dfasiz[i] ) - { - oldsns = dss[i]; + if ( hashval == dhash[i] ) + { + if ( numstates == dfasiz[i] ) + { + oldsns = dss[i]; - if ( ! didsort ) - { - /* we sort the states in sns so we can compare it to - * oldsns quickly. we use bubble because there probably - * aren't very many states - */ - bubble( sns, numstates ); - didsort = 1; - } + if ( ! didsort ) + { + /* we sort the states in sns so we can compare it to + * oldsns quickly. we use bubble because there probably + * aren't very many states + */ + bubble( sns, numstates ); + didsort = 1; + } - for ( j = 1; j <= numstates; ++j ) - if ( sns[j] != oldsns[j] ) - break; + for ( j = 1; j <= numstates; ++j ) + if ( sns[j] != oldsns[j] ) + break; - if ( j > numstates ) - { - ++dfaeql; - *newds_addr = i; - return ( 0 ); - } + if ( j > numstates ) + { + ++dfaeql; + *newds_addr = i; + return ( 0 ); + } - ++hshcol; - } + ++hshcol; + } - else - ++hshsave; - } + else + ++hshsave; + } /* make a new dfa */ if ( ++lastdfa >= current_max_dfas ) - increase_max_dfas(); + increase_max_dfas(); newds = lastdfa; dss[newds] = (int *) malloc( (unsigned) ((numstates + 1) * sizeof( int )) ); if ( ! dss[newds] ) - flexfatal( "dynamic memory failure in snstods()" ); + flexfatal( "dynamic memory failure in snstods()" ); /* if we haven't already sorted the states in sns, we do so now, so that * future comparisons with it can be made quickly */ if ( ! didsort ) - bubble( sns, numstates ); + bubble( sns, numstates ); for ( i = 1; i <= numstates; ++i ) - dss[newds][i] = sns[i]; + dss[newds][i] = sns[i]; dfasiz[newds] = numstates; dhash[newds] = hashval; if ( nacc == 0 ) - { - if ( reject ) - dfaacc[newds].dfaacc_set = (int *) 0; - else - dfaacc[newds].dfaacc_state = 0; + { + if ( reject ) + dfaacc[newds].dfaacc_set = (int *) 0; + else + dfaacc[newds].dfaacc_state = 0; - accsiz[newds] = 0; - } + accsiz[newds] = 0; + } else if ( reject ) - { - /* we sort the accepting set in increasing order so the disambiguating - * rule that the first rule listed is considered match in the event of - * ties will work. We use a bubble sort since the list is probably - * quite small. - */ + { + /* we sort the accepting set in increasing order so the disambiguating + * rule that the first rule listed is considered match in the event of + * ties will work. We use a bubble sort since the list is probably + * quite small. + */ - bubble( accset, nacc ); + bubble( accset, nacc ); - dfaacc[newds].dfaacc_set = - (int *) malloc( (unsigned) ((nacc + 1) * sizeof( int )) ); + dfaacc[newds].dfaacc_set = + (int *) malloc( (unsigned) ((nacc + 1) * sizeof( int )) ); - if ( ! dfaacc[newds].dfaacc_set ) - flexfatal( "dynamic memory failure in snstods()" ); + if ( ! dfaacc[newds].dfaacc_set ) + flexfatal( "dynamic memory failure in snstods()" ); - /* save the accepting set for later */ - for ( i = 1; i <= nacc; ++i ) - dfaacc[newds].dfaacc_set[i] = accset[i]; + /* save the accepting set for later */ + for ( i = 1; i <= nacc; ++i ) + dfaacc[newds].dfaacc_set[i] = accset[i]; - accsiz[newds] = nacc; - } + accsiz[newds] = nacc; + } else - { /* find lowest numbered rule so the disambiguating rule will work */ - j = num_rules + 1; + { /* find lowest numbered rule so the disambiguating rule will work */ + j = num_rules + 1; - for ( i = 1; i <= nacc; ++i ) - if ( accset[i] < j ) - j = accset[i]; + for ( i = 1; i <= nacc; ++i ) + if ( accset[i] < j ) + j = accset[i]; - dfaacc[newds].dfaacc_state = j; - } + dfaacc[newds].dfaacc_state = j; + } *newds_addr = newds; @@ -892,69 +892,69 @@ int symfollowset(int ds[], int dsize, int transsym, int nset[]) numstates = 0; for ( i = 1; i <= dsize; ++i ) - { /* for each nfa state ns in the state set of ds */ - ns = ds[i]; - sym = transchar[ns]; - tsp = trans1[ns]; + { /* for each nfa state ns in the state set of ds */ + ns = ds[i]; + sym = transchar[ns]; + tsp = trans1[ns]; - if ( sym < 0 ) - { /* it's a character class */ - sym = -sym; - ccllist = cclmap[sym]; - lenccl = ccllen[sym]; + if ( sym < 0 ) + { /* it's a character class */ + sym = -sym; + ccllist = cclmap[sym]; + lenccl = ccllen[sym]; - if ( cclng[sym] ) - { - for ( j = 0; j < lenccl; ++j ) - { /* loop through negated character class */ - ch = ccltbl[ccllist + j]; + if ( cclng[sym] ) + { + for ( j = 0; j < lenccl; ++j ) + { /* loop through negated character class */ + ch = ccltbl[ccllist + j]; - if ( ch == 0 ) - ch = NUL_ec; + if ( ch == 0 ) + ch = NUL_ec; - if ( ch > transsym ) - break; /* transsym isn't in negated ccl */ + if ( ch > transsym ) + break; /* transsym isn't in negated ccl */ - else if ( ch == transsym ) - /* next 2 */ goto bottom; - } + else if ( ch == transsym ) + /* next 2 */ goto bottom; + } - /* didn't find transsym in ccl */ - nset[++numstates] = tsp; - } + /* didn't find transsym in ccl */ + nset[++numstates] = tsp; + } - else - for ( j = 0; j < lenccl; ++j ) - { - ch = ccltbl[ccllist + j]; + else + for ( j = 0; j < lenccl; ++j ) + { + ch = ccltbl[ccllist + j]; - if ( ch == 0 ) - ch = NUL_ec; + if ( ch == 0 ) + ch = NUL_ec; - if ( ch > transsym ) - break; + if ( ch > transsym ) + break; - else if ( ch == transsym ) - { - nset[++numstates] = tsp; - break; - } - } - } + else if ( ch == transsym ) + { + nset[++numstates] = tsp; + break; + } + } + } - else if ( sym >= 'A' && sym <= 'Z' && caseins ) - flexfatal( "consistency check failed in symfollowset" ); + else if ( sym >= 'A' && sym <= 'Z' && caseins ) + flexfatal( "consistency check failed in symfollowset" ); - else if ( sym == SYM_EPSILON ) - { /* do nothing */ - } + else if ( sym == SYM_EPSILON ) + { /* do nothing */ + } - else if ( abs( ecgroup[sym] ) == transsym ) - nset[++numstates] = tsp; + else if ( abs( ecgroup[sym] ) == transsym ) + nset[++numstates] = tsp; bottom: - ; - } + ; + } return ( numstates ); } @@ -978,79 +978,79 @@ void sympartition(int ds[], int numstates, int symlist[], int duplist[]) */ for ( i = 1; i <= numecs; ++i ) - { /* initialize equivalence class list */ - duplist[i] = i - 1; - dupfwd[i] = i + 1; - } + { /* initialize equivalence class list */ + duplist[i] = i - 1; + dupfwd[i] = i + 1; + } duplist[1] = NIL; dupfwd[numecs] = NIL; for ( i = 1; i <= numstates; ++i ) - { - ns = ds[i]; - tch = transchar[ns]; + { + ns = ds[i]; + tch = transchar[ns]; - if ( tch != SYM_EPSILON ) - { - if ( tch < -lastccl || tch > csize ) - { - if ( tch > csize && tch <= CSIZE ) - flexerror( "scanner requires -8 flag" ); + if ( tch != SYM_EPSILON ) + { + if ( tch < -lastccl || tch > csize ) + { + if ( tch > csize && tch <= CSIZE ) + flexerror( "scanner requires -8 flag" ); - else - flexfatal( - "bad transition character detected in sympartition()" ); - } + else + flexfatal( + "bad transition character detected in sympartition()" ); + } - if ( tch >= 0 ) - { /* character transition */ - /* abs() needed for fake %t ec's */ - int ec = abs( ecgroup[tch] ); + if ( tch >= 0 ) + { /* character transition */ + /* abs() needed for fake %t ec's */ + int ec = abs( ecgroup[tch] ); - mkechar( ec, dupfwd, duplist ); - symlist[ec] = 1; - } + mkechar( ec, dupfwd, duplist ); + symlist[ec] = 1; + } - else - { /* character class */ - tch = -tch; + else + { /* character class */ + tch = -tch; - lenccl = ccllen[tch]; - cclp = cclmap[tch]; - mkeccl( ccltbl + cclp, lenccl, dupfwd, duplist, numecs, - NUL_ec ); + lenccl = ccllen[tch]; + cclp = cclmap[tch]; + mkeccl( ccltbl + cclp, lenccl, dupfwd, duplist, numecs, + NUL_ec ); - if ( cclng[tch] ) - { - j = 0; + if ( cclng[tch] ) + { + j = 0; - for ( k = 0; k < lenccl; ++k ) - { - ich = ccltbl[cclp + k]; + for ( k = 0; k < lenccl; ++k ) + { + ich = ccltbl[cclp + k]; - if ( ich == 0 ) - ich = NUL_ec; + if ( ich == 0 ) + ich = NUL_ec; - for ( ++j; j < ich; ++j ) - symlist[j] = 1; - } + for ( ++j; j < ich; ++j ) + symlist[j] = 1; + } - for ( ++j; j <= numecs; ++j ) - symlist[j] = 1; - } + for ( ++j; j <= numecs; ++j ) + symlist[j] = 1; + } - else - for ( k = 0; k < lenccl; ++k ) - { - ich = ccltbl[cclp + k]; + else + for ( k = 0; k < lenccl; ++k ) + { + ich = ccltbl[cclp + k]; - if ( ich == 0 ) - ich = NUL_ec; + if ( ich == 0 ) + ich = NUL_ec; - symlist[ich] = 1; - } - } - } - } + symlist[ich] = 1; + } + } + } + } } diff --git a/modules/libcom/src/flex/ecs.c b/modules/libcom/src/flex/ecs.c index 416ea601a..d84bb3053 100644 --- a/modules/libcom/src/flex/ecs.c +++ b/modules/libcom/src/flex/ecs.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* ecs - equivalence class routines */ @@ -14,7 +14,7 @@ * * This code is derived from software contributed to Berkeley by * Vern Paxson. - * + * * The United States Government has rights in this work pursuant * to contract no. DE-AC03-76SF00098 between the United States * Department of Energy and the University of California. @@ -47,56 +47,56 @@ void ccl2ecl(void) int i, ich, newlen, cclp, ccls, cclmec; for ( i = 1; i <= lastccl; ++i ) - { - /* we loop through each character class, and for each character - * in the class, add the character's equivalence class to the - * new "character" class we are creating. Thus when we are all - * done, character classes will really consist of collections - * of equivalence classes - */ + { + /* we loop through each character class, and for each character + * in the class, add the character's equivalence class to the + * new "character" class we are creating. Thus when we are all + * done, character classes will really consist of collections + * of equivalence classes + */ - newlen = 0; - cclp = cclmap[i]; + newlen = 0; + cclp = cclmap[i]; - for ( ccls = 0; ccls < ccllen[i]; ++ccls ) - { - ich = ccltbl[cclp + ccls]; - cclmec = ecgroup[ich]; + for ( ccls = 0; ccls < ccllen[i]; ++ccls ) + { + ich = ccltbl[cclp + ccls]; + cclmec = ecgroup[ich]; - if ( xlation && cclmec < 0 ) - { - /* special hack--if we're doing %t tables then it's - * possible that no representative of this character's - * equivalence class is in the ccl. So waiting till - * we see the representative would be disastrous. Instead, - * we add this character's equivalence class anyway, if it's - * not already present. - */ - int j; + if ( xlation && cclmec < 0 ) + { + /* special hack--if we're doing %t tables then it's + * possible that no representative of this character's + * equivalence class is in the ccl. So waiting till + * we see the representative would be disastrous. Instead, + * we add this character's equivalence class anyway, if it's + * not already present. + */ + int j; - /* this loop makes this whole process n^2; but we don't - * really care about %t performance anyway - */ - for ( j = 0; j < newlen; ++j ) - if ( ccltbl[cclp + j] == -cclmec ) - break; + /* this loop makes this whole process n^2; but we don't + * really care about %t performance anyway + */ + for ( j = 0; j < newlen; ++j ) + if ( ccltbl[cclp + j] == -cclmec ) + break; - if ( j >= newlen ) - { /* no representative yet, add this one in */ - ccltbl[cclp + newlen] = -cclmec; - ++newlen; - } - } + if ( j >= newlen ) + { /* no representative yet, add this one in */ + ccltbl[cclp + newlen] = -cclmec; + ++newlen; + } + } - else if ( cclmec > 0 ) - { - ccltbl[cclp + newlen] = cclmec; - ++newlen; - } - } + else if ( cclmec > 0 ) + { + ccltbl[cclp + newlen] = cclmec; + ++newlen; + } + } - ccllen[i] = newlen; - } + ccllen[i] = newlen; + } } @@ -124,12 +124,12 @@ int cre8ecs(int fwd[], int bck[], int num) * class. */ for ( i = 1; i <= num; ++i ) - if ( bck[i] == NIL ) - { - bck[i] = ++numcl; - for ( j = fwd[i]; j != NIL; j = fwd[j] ) - bck[j] = -numcl; - } + if ( bck[i] == NIL ) + { + bck[i] = ++numcl; + for ( j = fwd[i]; j != NIL; j = fwd[j] ) + bck[j] = -numcl; + } return ( numcl ); } @@ -154,62 +154,62 @@ int ecs_from_xlation(int ecmap[]) int did_default_xlation_class = false; if ( xlation[0] != 0 ) - { - /* if NUL shares its translation with other characters, choose one - * of the other characters as the representative for the equivalence - * class. This allows a cheap test later to see whether we can - * do away with NUL's equivalence class. - */ - for ( i = 1; i < csize; ++i ) - if ( xlation[i] == -xlation[0] ) - { - xlation[i] = xlation[0]; - ecmap[0] = -xlation[0]; - break; - } + { + /* if NUL shares its translation with other characters, choose one + * of the other characters as the representative for the equivalence + * class. This allows a cheap test later to see whether we can + * do away with NUL's equivalence class. + */ + for ( i = 1; i < csize; ++i ) + if ( xlation[i] == -xlation[0] ) + { + xlation[i] = xlation[0]; + ecmap[0] = -xlation[0]; + break; + } - if ( i >= csize ) - /* didn't find a companion character--remember this fact */ - nul_is_alone = true; - } + if ( i >= csize ) + /* didn't find a companion character--remember this fact */ + nul_is_alone = true; + } for ( i = 1; i < csize; ++i ) - if ( xlation[i] == 0 ) - { - if ( did_default_xlation_class ) - ecmap[i] = -num_xlations; - - else - { - /* make an equivalence class for those characters not - * specified in the %t table - */ - ++num_xlations; - ecmap[i] = num_xlations; - did_default_xlation_class = true; - } - } + if ( xlation[i] == 0 ) + { + if ( did_default_xlation_class ) + ecmap[i] = -num_xlations; - else - ecmap[i] = xlation[i]; + else + { + /* make an equivalence class for those characters not + * specified in the %t table + */ + ++num_xlations; + ecmap[i] = num_xlations; + did_default_xlation_class = true; + } + } + + else + ecmap[i] = xlation[i]; if ( nul_is_alone ) - /* force NUL's equivalence class to be the last one */ - { - ++num_xlations; - ecmap[0] = num_xlations; + /* force NUL's equivalence class to be the last one */ + { + ++num_xlations; + ecmap[0] = num_xlations; - /* there's actually a bug here: if someone is fanatic enough to - * put every character in its own translation class, then right - * now we just promoted NUL's equivalence class to be csize + 1; - * we can handle NUL's class number being == csize (by instead - * putting it in its own table), but we can't handle some *other* - * character having to be put in its own table, too. So in - * this case we bail out. - */ - if ( num_xlations > csize ) - flexfatal( "too many %t classes!" ); - } + /* there's actually a bug here: if someone is fanatic enough to + * put every character in its own translation class, then right + * now we just promoted NUL's equivalence class to be csize + 1; + * we can handle NUL's class number being == csize (by instead + * putting it in its own table), but we can't handle some *other* + * character having to be put in its own table, too. So in + * this case we bail out. + */ + if ( num_xlations > csize ) + flexfatal( "too many %t classes!" ); + } return num_xlations; } @@ -233,7 +233,7 @@ void mkeccl(unsigned char ccls[], int lenccl, int fwd[], int bck[], int llsiz, i { int cclp, oldec, newec; int cclm, i, j; - static unsigned char cclflags[CSIZE]; /* initialized to all '\0' */ + static unsigned char cclflags[CSIZE]; /* initialized to all '\0' */ /* note that it doesn't matter whether or not the character class is * negated. The same results will be obtained in either case. @@ -242,79 +242,79 @@ void mkeccl(unsigned char ccls[], int lenccl, int fwd[], int bck[], int llsiz, i cclp = 0; while ( cclp < lenccl ) - { - cclm = ccls[cclp]; + { + cclm = ccls[cclp]; - if ( NUL_mapping && cclm == 0 ) - cclm = NUL_mapping; + if ( NUL_mapping && cclm == 0 ) + cclm = NUL_mapping; - oldec = bck[cclm]; - newec = cclm; + oldec = bck[cclm]; + newec = cclm; - j = cclp + 1; + j = cclp + 1; - for ( i = fwd[cclm]; i != NIL && i <= llsiz; i = fwd[i] ) - { /* look for the symbol in the character class */ - for ( ; j < lenccl; ++j ) - { - int ccl_char; + for ( i = fwd[cclm]; i != NIL && i <= llsiz; i = fwd[i] ) + { /* look for the symbol in the character class */ + for ( ; j < lenccl; ++j ) + { + int ccl_char; - if ( NUL_mapping && ccls[j] == 0 ) - ccl_char = NUL_mapping; - else - ccl_char = ccls[j]; + if ( NUL_mapping && ccls[j] == 0 ) + ccl_char = NUL_mapping; + else + ccl_char = ccls[j]; - if ( ccl_char > i ) - break; + if ( ccl_char > i ) + break; - if ( ccl_char == i && ! cclflags[j] ) - { - /* we found an old companion of cclm in the ccl. - * link it into the new equivalence class and flag it as - * having been processed - */ + if ( ccl_char == i && ! cclflags[j] ) + { + /* we found an old companion of cclm in the ccl. + * link it into the new equivalence class and flag it as + * having been processed + */ - bck[i] = newec; - fwd[newec] = i; - newec = i; - cclflags[j] = 1; /* set flag so we don't reprocess */ + bck[i] = newec; + fwd[newec] = i; + newec = i; + cclflags[j] = 1; /* set flag so we don't reprocess */ - /* get next equivalence class member */ - /* continue 2 */ - goto next_pt; - } - } + /* get next equivalence class member */ + /* continue 2 */ + goto next_pt; + } + } - /* symbol isn't in character class. Put it in the old equivalence - * class - */ + /* symbol isn't in character class. Put it in the old equivalence + * class + */ - bck[i] = oldec; + bck[i] = oldec; - if ( oldec != NIL ) - fwd[oldec] = i; + if ( oldec != NIL ) + fwd[oldec] = i; - oldec = i; + oldec = i; next_pt: - ; - } + ; + } - if ( bck[cclm] != NIL || oldec != bck[cclm] ) - { - bck[cclm] = NIL; - fwd[oldec] = NIL; - } + if ( bck[cclm] != NIL || oldec != bck[cclm] ) + { + bck[cclm] = NIL; + fwd[oldec] = NIL; + } - fwd[newec] = NIL; + fwd[newec] = NIL; - /* find next ccl member to process */ + /* find next ccl member to process */ - for ( ++cclp; cclflags[cclp] && cclp < lenccl; ++cclp ) - { - /* reset "doesn't need processing" flag */ - cclflags[cclp] = 0; - } - } + for ( ++cclp; cclflags[cclp] && cclp < lenccl; ++cclp ) + { + /* reset "doesn't need processing" flag */ + cclflags[cclp] = 0; + } + } } @@ -332,10 +332,10 @@ void mkechar(int tch, int fwd[], int bck[]) */ if ( fwd[tch] != NIL ) - bck[fwd[tch]] = bck[tch]; + bck[fwd[tch]] = bck[tch]; if ( bck[tch] != NIL ) - fwd[bck[tch]] = fwd[tch]; + fwd[bck[tch]] = fwd[tch]; fwd[tch] = NIL; bck[tch] = NIL; diff --git a/modules/libcom/src/flex/flex.c b/modules/libcom/src/flex/flex.c index 6abb9597f..f7e9dbf62 100644 --- a/modules/libcom/src/flex/flex.c +++ b/modules/libcom/src/flex/flex.c @@ -124,49 +124,49 @@ int main(int argc, char *argv[]) readin(); if ( syntaxerror ) - flexend( 1 ); + flexend( 1 ); if ( yymore_really_used == REALLY_USED ) - yymore_used = true; + yymore_used = true; else if ( yymore_really_used == REALLY_NOT_USED ) - yymore_used = false; + yymore_used = false; if ( reject_really_used == REALLY_USED ) - reject = true; + reject = true; else if ( reject_really_used == REALLY_NOT_USED ) - reject = false; + reject = false; if ( performance_report ) - { - if ( interactive ) - fprintf( stderr, - "-I (interactive) entails a minor performance penalty\n" ); + { + if ( interactive ) + fprintf( stderr, + "-I (interactive) entails a minor performance penalty\n" ); - if ( yymore_used ) - fprintf( stderr, "yymore() entails a minor performance penalty\n" ); + if ( yymore_used ) + fprintf( stderr, "yymore() entails a minor performance penalty\n" ); - if ( reject ) - fprintf( stderr, "REJECT entails a large performance penalty\n" ); + if ( reject ) + fprintf( stderr, "REJECT entails a large performance penalty\n" ); - if ( variable_trailing_context_rules ) - fprintf( stderr, + if ( variable_trailing_context_rules ) + fprintf( stderr, "Variable trailing context rules entail a large performance penalty\n" ); - } + } if ( reject ) - real_reject = true; + real_reject = true; if ( variable_trailing_context_rules ) - reject = true; + reject = true; if ( (fulltbl || fullspd) && reject ) - { - if ( real_reject ) - flexerror( "REJECT cannot be used with -f or -F" ); - else - flexerror( - "variable trailing context rules cannot be used with -f or -F" ); - } + { + if ( real_reject ) + flexerror( "REJECT cannot be used with -f or -F" ); + else + flexerror( + "variable trailing context rules cannot be used with -f or -F" ); + } ntod(); @@ -199,181 +199,181 @@ void flexend(int status) char *flex_gettime(); if ( skelfile != NULL ) - { - if ( ferror( skelfile ) ) - flexfatal( "error occurred when writing skeleton file" ); + { + if ( ferror( skelfile ) ) + flexfatal( "error occurred when writing skeleton file" ); - else if ( fclose( skelfile ) ) - flexfatal( "error occurred when closing skeleton file" ); - } + else if ( fclose( skelfile ) ) + flexfatal( "error occurred when closing skeleton file" ); + } if ( temp_action_file ) - { - if ( ferror( temp_action_file ) ) - flexfatal( "error occurred when writing temporary action file" ); + { + if ( ferror( temp_action_file ) ) + flexfatal( "error occurred when writing temporary action file" ); - else if ( fclose( temp_action_file ) ) - flexfatal( "error occurred when closing temporary action file" ); + else if ( fclose( temp_action_file ) ) + flexfatal( "error occurred when closing temporary action file" ); } if ( status != 0 && outfile_created ) - { - if ( ferror( stdout ) ) - flexfatal( "error occurred when writing output file" ); + { + if ( ferror( stdout ) ) + flexfatal( "error occurred when writing output file" ); - else if ( fclose( stdout ) ) - flexfatal( "error occurred when closing output file" ); + else if ( fclose( stdout ) ) + flexfatal( "error occurred when closing output file" ); - else if ( unlink( outfile ) ) - flexfatal( "error occurred when deleting output file" ); - } + else if ( unlink( outfile ) ) + flexfatal( "error occurred when deleting output file" ); + } if ( backtrack_report && backtrack_file ) - { - if ( num_backtracking == 0 ) - fprintf( backtrack_file, "No backtracking.\n" ); - else if ( fullspd || fulltbl ) - fprintf( backtrack_file, - "%d backtracking (non-accepting) states.\n", - num_backtracking ); - else - fprintf( backtrack_file, "Compressed tables always backtrack.\n" ); + { + if ( num_backtracking == 0 ) + fprintf( backtrack_file, "No backtracking.\n" ); + else if ( fullspd || fulltbl ) + fprintf( backtrack_file, + "%d backtracking (non-accepting) states.\n", + num_backtracking ); + else + fprintf( backtrack_file, "Compressed tables always backtrack.\n" ); - if ( ferror( backtrack_file ) ) - flexfatal( "error occurred when writing backtracking file" ); + if ( ferror( backtrack_file ) ) + flexfatal( "error occurred when writing backtracking file" ); - else if ( fclose( backtrack_file ) ) - flexfatal( "error occurred when closing backtracking file" ); - } + else if ( fclose( backtrack_file ) ) + flexfatal( "error occurred when closing backtracking file" ); + } if ( printstats ) - { - endtime = flex_gettime(); + { + endtime = flex_gettime(); - fprintf( stderr, "%s version %s usage statistics:\n", program_name, - flex_version ); - fprintf( stderr, " started at %s, finished at %s\n", - starttime, endtime ); + fprintf( stderr, "%s version %s usage statistics:\n", program_name, + flex_version ); + fprintf( stderr, " started at %s, finished at %s\n", + starttime, endtime ); - fprintf( stderr, " scanner options: -" ); + fprintf( stderr, " scanner options: -" ); - if ( backtrack_report ) - putc( 'b', stderr ); - if ( ddebug ) - putc( 'd', stderr ); - if ( interactive ) - putc( 'I', stderr ); - if ( caseins ) - putc( 'i', stderr ); - if ( ! gen_line_dirs ) - putc( 'L', stderr ); - if ( performance_report ) - putc( 'p', stderr ); - if ( spprdflt ) - putc( 's', stderr ); - if ( use_stdout ) - putc( 't', stderr ); - if ( trace ) - putc( 'T', stderr ); - if ( printstats ) - putc( 'v', stderr ); /* always true! */ - if ( csize == 256 ) - putc( '8', stderr ); + if ( backtrack_report ) + putc( 'b', stderr ); + if ( ddebug ) + putc( 'd', stderr ); + if ( interactive ) + putc( 'I', stderr ); + if ( caseins ) + putc( 'i', stderr ); + if ( ! gen_line_dirs ) + putc( 'L', stderr ); + if ( performance_report ) + putc( 'p', stderr ); + if ( spprdflt ) + putc( 's', stderr ); + if ( use_stdout ) + putc( 't', stderr ); + if ( trace ) + putc( 'T', stderr ); + if ( printstats ) + putc( 'v', stderr ); /* always true! */ + if ( csize == 256 ) + putc( '8', stderr ); - fprintf( stderr, " -C" ); + fprintf( stderr, " -C" ); - if ( fulltbl ) - putc( 'f', stderr ); - if ( fullspd ) - putc( 'F', stderr ); - if ( useecs ) - putc( 'e', stderr ); - if ( usemecs ) - putc( 'm', stderr ); + if ( fulltbl ) + putc( 'f', stderr ); + if ( fullspd ) + putc( 'F', stderr ); + if ( useecs ) + putc( 'e', stderr ); + if ( usemecs ) + putc( 'm', stderr ); - if ( strcmp( skelname, ENQUOTE(DEFAULT_SKELETON_FILE) ) ) - fprintf( stderr, " -S%s", skelname ); + if ( strcmp( skelname, ENQUOTE(DEFAULT_SKELETON_FILE) ) ) + fprintf( stderr, " -S%s", skelname ); - putc( '\n', stderr ); + putc( '\n', stderr ); - fprintf( stderr, " %d/%d NFA states\n", lastnfa, current_mns ); - fprintf( stderr, " %d/%d DFA states (%d words)\n", lastdfa, - current_max_dfas, totnst ); - fprintf( stderr, - " %d rules\n", num_rules - 1 /* - 1 for def. rule */ ); + fprintf( stderr, " %d/%d NFA states\n", lastnfa, current_mns ); + fprintf( stderr, " %d/%d DFA states (%d words)\n", lastdfa, + current_max_dfas, totnst ); + fprintf( stderr, + " %d rules\n", num_rules - 1 /* - 1 for def. rule */ ); - if ( num_backtracking == 0 ) - fprintf( stderr, " No backtracking\n" ); - else if ( fullspd || fulltbl ) - fprintf( stderr, " %d backtracking (non-accepting) states\n", - num_backtracking ); - else - fprintf( stderr, " compressed tables always backtrack\n" ); + if ( num_backtracking == 0 ) + fprintf( stderr, " No backtracking\n" ); + else if ( fullspd || fulltbl ) + fprintf( stderr, " %d backtracking (non-accepting) states\n", + num_backtracking ); + else + fprintf( stderr, " compressed tables always backtrack\n" ); - if ( bol_needed ) - fprintf( stderr, " Beginning-of-line patterns used\n" ); + if ( bol_needed ) + fprintf( stderr, " Beginning-of-line patterns used\n" ); - fprintf( stderr, " %d/%d start conditions\n", lastsc, - current_max_scs ); - fprintf( stderr, " %d epsilon states, %d double epsilon states\n", - numeps, eps2 ); + fprintf( stderr, " %d/%d start conditions\n", lastsc, + current_max_scs ); + fprintf( stderr, " %d epsilon states, %d double epsilon states\n", + numeps, eps2 ); - if ( lastccl == 0 ) - fprintf( stderr, " no character classes\n" ); - else - fprintf( stderr, - " %d/%d character classes needed %d/%d words of storage, %d reused\n", - lastccl, current_maxccls, - cclmap[lastccl] + ccllen[lastccl], - current_max_ccl_tbl_size, cclreuse ); + if ( lastccl == 0 ) + fprintf( stderr, " no character classes\n" ); + else + fprintf( stderr, + " %d/%d character classes needed %d/%d words of storage, %d reused\n", + lastccl, current_maxccls, + cclmap[lastccl] + ccllen[lastccl], + current_max_ccl_tbl_size, cclreuse ); - fprintf( stderr, " %d state/nextstate pairs created\n", numsnpairs ); - fprintf( stderr, " %d/%d unique/duplicate transitions\n", - numuniq, numdup ); + fprintf( stderr, " %d state/nextstate pairs created\n", numsnpairs ); + fprintf( stderr, " %d/%d unique/duplicate transitions\n", + numuniq, numdup ); - if ( fulltbl ) - { - tblsiz = lastdfa * numecs; - fprintf( stderr, " %d table entries\n", tblsiz ); - } + if ( fulltbl ) + { + tblsiz = lastdfa * numecs; + fprintf( stderr, " %d table entries\n", tblsiz ); + } - else - { - tblsiz = 2 * (lastdfa + numtemps) + 2 * tblend; + else + { + tblsiz = 2 * (lastdfa + numtemps) + 2 * tblend; - fprintf( stderr, " %d/%d base-def entries created\n", - lastdfa + numtemps, current_max_dfas ); - fprintf( stderr, " %d/%d (peak %d) nxt-chk entries created\n", - tblend, current_max_xpairs, peakpairs ); - fprintf( stderr, - " %d/%d (peak %d) template nxt-chk entries created\n", - numtemps * nummecs, current_max_template_xpairs, - numtemps * numecs ); - fprintf( stderr, " %d empty table entries\n", nummt ); - fprintf( stderr, " %d protos created\n", numprots ); - fprintf( stderr, " %d templates created, %d uses\n", - numtemps, tmpuses ); - } + fprintf( stderr, " %d/%d base-def entries created\n", + lastdfa + numtemps, current_max_dfas ); + fprintf( stderr, " %d/%d (peak %d) nxt-chk entries created\n", + tblend, current_max_xpairs, peakpairs ); + fprintf( stderr, + " %d/%d (peak %d) template nxt-chk entries created\n", + numtemps * nummecs, current_max_template_xpairs, + numtemps * numecs ); + fprintf( stderr, " %d empty table entries\n", nummt ); + fprintf( stderr, " %d protos created\n", numprots ); + fprintf( stderr, " %d templates created, %d uses\n", + numtemps, tmpuses ); + } - if ( useecs ) - { - tblsiz = tblsiz + csize; - fprintf( stderr, " %d/%d equivalence classes created\n", - numecs, csize ); - } + if ( useecs ) + { + tblsiz = tblsiz + csize; + fprintf( stderr, " %d/%d equivalence classes created\n", + numecs, csize ); + } - if ( usemecs ) - { - tblsiz = tblsiz + numecs; - fprintf( stderr, " %d/%d meta-equivalence classes created\n", - nummecs, csize ); - } + if ( usemecs ) + { + tblsiz = tblsiz + numecs; + fprintf( stderr, " %d/%d meta-equivalence classes created\n", + nummecs, csize ); + } - fprintf( stderr, " %d (%d saved) hash collisions, %d DFAs equal\n", - hshcol, hshsave, dfaeql ); - fprintf( stderr, " %d sets of reallocations needed\n", num_reallocs ); - fprintf( stderr, " %d total table entries needed\n", tblsiz ); - } + fprintf( stderr, " %d (%d saved) hash collisions, %d DFAs equal\n", + hshcol, hshsave, dfaeql ); + fprintf( stderr, " %d sets of reallocations needed\n", num_reallocs ); + fprintf( stderr, " %d total table entries needed\n", tblsiz ); + } exit( status ); } @@ -407,187 +407,187 @@ void flexinit(int argc, char **argv) /* read flags */ for ( --argc, ++argv; argc ; --argc, ++argv ) - { - if ( argv[0][0] != '-' || argv[0][1] == '\0' ) - break; + { + if ( argv[0][0] != '-' || argv[0][1] == '\0' ) + break; - arg = argv[0]; + arg = argv[0]; - for ( i = 1; arg[i] != '\0'; ++i ) - switch ( arg[i] ) - { - case 'b': - backtrack_report = true; - break; + for ( i = 1; arg[i] != '\0'; ++i ) + switch ( arg[i] ) + { + case 'b': + backtrack_report = true; + break; - case 'c': - fprintf( stderr, - "%s: Assuming use of deprecated -c flag is really intended to be -C\n", - program_name ); + case 'c': + fprintf( stderr, + "%s: Assuming use of deprecated -c flag is really intended to be -C\n", + program_name ); - /* fall through */ + /* fall through */ - case 'C': - if ( i != 1 ) - flexerror( "-C flag must be given separately" ); + case 'C': + if ( i != 1 ) + flexerror( "-C flag must be given separately" ); - if ( ! sawcmpflag ) - { - useecs = false; - usemecs = false; - fulltbl = false; - sawcmpflag = true; - } + if ( ! sawcmpflag ) + { + useecs = false; + usemecs = false; + fulltbl = false; + sawcmpflag = true; + } - for ( ++i; arg[i] != '\0'; ++i ) - switch ( arg[i] ) - { - case 'e': - useecs = true; - break; + for ( ++i; arg[i] != '\0'; ++i ) + switch ( arg[i] ) + { + case 'e': + useecs = true; + break; - case 'F': - fullspd = true; - break; + case 'F': + fullspd = true; + break; - case 'f': - fulltbl = true; - break; + case 'f': + fulltbl = true; + break; - case 'm': - usemecs = true; - break; + case 'm': + usemecs = true; + break; - default: - lerrif( "unknown -C option '%c'", - (int) arg[i] ); - break; - } + default: + lerrif( "unknown -C option '%c'", + (int) arg[i] ); + break; + } - goto get_next_arg; + goto get_next_arg; - case 'd': - ddebug = true; - break; + case 'd': + ddebug = true; + break; - case 'f': - useecs = usemecs = false; - fulltbl = true; - break; + case 'f': + useecs = usemecs = false; + fulltbl = true; + break; - case 'F': - useecs = usemecs = false; - fullspd = true; - break; + case 'F': + useecs = usemecs = false; + fullspd = true; + break; - case 'I': - interactive = true; - break; + case 'I': + interactive = true; + break; - case 'i': - caseins = true; - break; + case 'i': + caseins = true; + break; - case 'L': - gen_line_dirs = false; - break; + case 'L': + gen_line_dirs = false; + break; - case 'n': - /* stupid do-nothing deprecated option */ - break; + case 'n': + /* stupid do-nothing deprecated option */ + break; - case 'o': - if ( i != 1 ) - flexerror( "-o flag must be given separately" ); + case 'o': + if ( i != 1 ) + flexerror( "-o flag must be given separately" ); - outfile = arg + i + 1; - goto get_next_arg; + outfile = arg + i + 1; + goto get_next_arg; - case 'p': - performance_report = true; - break; + case 'p': + performance_report = true; + break; - case 'S': - if ( i != 1 ) - flexerror( "-S flag must be given separately" ); + case 'S': + if ( i != 1 ) + flexerror( "-S flag must be given separately" ); - skelname = arg + i + 1; - goto get_next_arg; + skelname = arg + i + 1; + goto get_next_arg; - case 's': - spprdflt = true; - break; + case 's': + spprdflt = true; + break; - case 't': - use_stdout = true; - break; + case 't': + use_stdout = true; + break; - case 'T': - trace = true; - break; + case 'T': + trace = true; + break; - case 'v': - printstats = true; - break; + case 'v': + printstats = true; + break; - case '8': - csize = CSIZE; - break; + case '8': + csize = CSIZE; + break; - default: - lerrif( "unknown flag '%c'", (int) arg[i] ); - break; - } + default: + lerrif( "unknown flag '%c'", (int) arg[i] ); + break; + } get_next_arg: /* used by -C and -S flags in lieu of a "continue 2" control */ - ; - } + ; + } if ( (fulltbl || fullspd) && usemecs ) - flexerror( "full table and -Cm don't make sense together" ); + flexerror( "full table and -Cm don't make sense together" ); if ( (fulltbl || fullspd) && interactive ) - flexerror( "full table and -I are (currently) incompatible" ); + flexerror( "full table and -I are (currently) incompatible" ); if ( fulltbl && fullspd ) - flexerror( "full table and -F are mutually exclusive" ); + flexerror( "full table and -F are mutually exclusive" ); if ( ! skelname ) - { - static char skeleton_name_storage[400]; + { + static char skeleton_name_storage[400]; - skelname = skeleton_name_storage; - (void) strcpy( skelname, ENQUOTE(DEFAULT_SKELETON_FILE) ); - } + skelname = skeleton_name_storage; + (void) strcpy( skelname, ENQUOTE(DEFAULT_SKELETON_FILE) ); + } if ( ! use_stdout ) - { - FILE *prev_stdout = freopen( outfile, "w", stdout ); + { + FILE *prev_stdout = freopen( outfile, "w", stdout ); - if ( prev_stdout == NULL ) - lerrsf( "could not create %s", outfile ); + if ( prev_stdout == NULL ) + lerrsf( "could not create %s", outfile ); - outfile_created = 1; - } + outfile_created = 1; + } num_input_files = argc; input_files = argv; set_input_file( num_input_files > 0 ? input_files[0] : NULL ); if ( backtrack_report ) - { + { #ifndef SHORT_FILE_NAMES - backtrack_file = fopen( "lex.backtrack", "w" ); + backtrack_file = fopen( "lex.backtrack", "w" ); #else - backtrack_file = fopen( "lex.bck", "w" ); + backtrack_file = fopen( "lex.bck", "w" ); #endif - if ( backtrack_file == NULL ) - flexerror( "could not create lex.backtrack" ); - } + if ( backtrack_file == NULL ) + flexerror( "could not create lex.backtrack" ); + } else - backtrack_file = NULL; + backtrack_file = NULL; lastccl = 0; @@ -597,7 +597,7 @@ get_next_arg: /* used by -C and -S flags in lieu of a "continue 2" control */ starttime = flex_gettime(); if ( (skelfile = fopen( skelname, "r" )) == NULL ) - lerrsf( "can't open skeleton file %s", skelname ); + lerrsf( "can't open skeleton file %s", skelname ); if ( ( temp_action_file = epicsTempFile () ) == NULL ) { @@ -619,29 +619,29 @@ get_next_arg: /* used by -C and -S flags in lieu of a "continue 2" control */ lastprot = 1; if ( useecs ) - { /* set up doubly-linked equivalence classes */ - /* We loop all the way up to csize, since ecgroup[csize] is the - * position used for NUL characters - */ - ecgroup[1] = NIL; + { /* set up doubly-linked equivalence classes */ + /* We loop all the way up to csize, since ecgroup[csize] is the + * position used for NUL characters + */ + ecgroup[1] = NIL; - for ( i = 2; i <= csize; ++i ) - { - ecgroup[i] = i - 1; - nextecm[i - 1] = i; - } + for ( i = 2; i <= csize; ++i ) + { + ecgroup[i] = i - 1; + nextecm[i - 1] = i; + } - nextecm[csize] = NIL; - } + nextecm[csize] = NIL; + } else - { /* put everything in its own equivalence class */ - for ( i = 1; i <= csize; ++i ) - { - ecgroup[i] = i; - nextecm[i] = BAD_SUBSCRIPT; /* to catch errors */ - } - } + { /* put everything in its own equivalence class */ + for ( i = 1; i <= csize; ++i ) + { + ecgroup[i] = i; + nextecm[i] = BAD_SUBSCRIPT; /* to catch errors */ + } + } set_up_initial_allocations(); } @@ -658,39 +658,39 @@ void readin(void) skelout(); if ( ddebug ) - puts( "#define FLEX_DEBUG" ); + puts( "#define FLEX_DEBUG" ); if ( csize == 256 ) - puts( "#define YY_CHAR unsigned char" ); + puts( "#define YY_CHAR unsigned char" ); else - puts( "#define YY_CHAR char" ); + puts( "#define YY_CHAR char" ); line_directive_out( stdout ); if ( yyparse() ) - { - pinpoint_message( "fatal parse error" ); - flexend( 1 ); - } + { + pinpoint_message( "fatal parse error" ); + flexend( 1 ); + } if ( xlation ) - { - numecs = ecs_from_xlation( ecgroup ); - useecs = true; - } + { + numecs = ecs_from_xlation( ecgroup ); + useecs = true; + } else if ( useecs ) - numecs = cre8ecs( nextecm, ecgroup, csize ); + numecs = cre8ecs( nextecm, ecgroup, csize ); else - numecs = csize; + numecs = csize; /* now map the equivalence class for NUL to its expected place */ ecgroup[0] = ecgroup[csize]; NUL_ec = abs( ecgroup[0] ); if ( useecs ) - ccl2ecl(); + ccl2ecl(); } diff --git a/modules/libcom/src/flex/flex.skel b/modules/libcom/src/flex/flex.skel index 6b9805b04..6861c4c91 100644 --- a/modules/libcom/src/flex/flex.skel +++ b/modules/libcom/src/flex/flex.skel @@ -20,7 +20,7 @@ #include #include -#else /* ! __cplusplus */ +#else /* ! __cplusplus */ #ifdef __GNUC__ #include @@ -28,9 +28,9 @@ void *malloc( size_t ); void free( void* ); #else #include -#endif /* __GNUC__ */ +#endif /* __GNUC__ */ -#endif /* ! __cplusplus */ +#endif /* ! __cplusplus */ /* amount of stuff to slurp up with each read */ @@ -53,8 +53,8 @@ void free( void* ); * is returned in "result". */ #define YY_INPUT(buf,result,max_size) \ - if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \ - YY_FATAL_ERROR( "read() in flex scanner failed" ); + if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \ + YY_FATAL_ERROR( "read() in flex scanner failed" ); #define YY_NULL 0 /* no semi-colon after return; correct usage is to write "yyterminate();" - @@ -69,10 +69,10 @@ void free( void* ); * a single C statement (which needs a semi-colon terminator). * This avoids problems with code like: * - * if ( something_happens ) - * YY_FATAL_ERROR( "oops, the something happened" ); - * else - * everything_okay(); + * if ( something_happens ) + * YY_FATAL_ERROR( "oops, the something happened" ); + * else + * everything_okay(); * * Prior to using the do-while the compiler would get upset at the * "else" because it interpreted the "if" statement as being all @@ -80,13 +80,13 @@ void free( void* ); */ #define YY_FATAL_ERROR(msg) \ - do \ - { \ - (void) fputs( msg, stderr ); \ - (void) putc( '\n', stderr ); \ - exit( 1 ); \ - } \ - while ( 0 ) + do \ + { \ + (void) fputs( msg, stderr ); \ + (void) putc( '\n', stderr ); \ + exit( 1 ); \ + } \ + while ( 0 ) /* default yywrap function - always treat EOF as an EOF */ #define yywrap() 1 @@ -102,17 +102,17 @@ void free( void* ); /* special action meaning "start processing a new file" */ #define YY_NEW_FILE \ - do \ - { \ - yy_init_buffer( yy_current_buffer, yyin ); \ - yy_load_buffer_state(); \ - } \ - while ( 0 ) + do \ + { \ + yy_init_buffer( yy_current_buffer, yyin ); \ + yy_load_buffer_state(); \ + } \ + while ( 0 ) /* default declaration of generated scanner - a define so the user can * easily add parameters */ -#define YY_DECL int yylex ( void ) +#define YY_DECL int yylex ( void ) /* code executed at the end of each rule */ #define YY_BREAK break; @@ -131,11 +131,11 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; * corresponding action - sets up yytext */ #define YY_DO_BEFORE_ACTION \ - yytext = yy_bp; \ + yytext = yy_bp; \ %% code to fiddle yytext and yyleng for yymore() goes here - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 @@ -143,14 +143,14 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; /* return all but the first 'n' matched characters back to the input stream */ #define yyless(n) \ - do \ - { \ - /* undo effects of setting up yytext */ \ - *yy_cp = yy_hold_char; \ - yy_c_buf_p = yy_cp = yy_bp + n; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) + do \ + { \ + /* undo effects of setting up yytext */ \ + *yy_cp = yy_hold_char; \ + yy_c_buf_p = yy_cp = yy_bp + n; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) #define unput(c) yyunput( c, yytext ) @@ -159,16 +159,16 @@ struct yy_buffer_state { FILE *yy_input_file; - YY_CHAR *yy_ch_buf; /* input buffer */ - YY_CHAR *yy_buf_pos; /* current position in input buffer */ + YY_CHAR *yy_ch_buf; /* input buffer */ + YY_CHAR *yy_buf_pos; /* current position in input buffer */ /* size of input buffer in bytes, not including room for EOB characters*/ - int yy_buf_size; + int yy_buf_size; /* number of characters read into yy_ch_buf, not including EOB characters */ int yy_n_chars; - int yy_eof_status; /* whether we've seen an EOF on this buffer */ + int yy_eof_status; /* whether we've seen an EOF on this buffer */ #define EOF_NOT_SEEN 0 /* "pending" happens when the EOF has been seen but there's still * some text process @@ -189,7 +189,7 @@ static YY_BUFFER_STATE yy_current_buffer; /* yy_hold_char holds the character lost when yytext is formed */ static YY_CHAR yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ +static int yy_n_chars; /* number of characters read into yy_ch_buf */ @@ -217,8 +217,8 @@ FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; */ /* points to current character in buffer */ static YY_CHAR *yy_c_buf_p = (YY_CHAR *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ /* flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... @@ -253,168 +253,168 @@ YY_DECL %% user's declarations go here if ( yy_init ) - { - YY_USER_INIT; + { + YY_USER_INIT; - if ( ! yy_start ) - yy_start = 1; /* first start state */ + if ( ! yy_start ) + yy_start = 1; /* first start state */ - if ( ! yyin ) - yyin = stdin; + if ( ! yyin ) + yyin = stdin; - if ( ! yyout ) - yyout = stdout; + if ( ! yyout ) + yyout = stdout; - if ( yy_current_buffer ) - yy_init_buffer( yy_current_buffer, yyin ); - else - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + if ( yy_current_buffer ) + yy_init_buffer( yy_current_buffer, yyin ); + else + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - yy_load_buffer_state(); + yy_load_buffer_state(); - yy_init = 0; - } + yy_init = 0; + } - while ( 1 ) /* loops until end-of-file is reached */ - { + while ( 1 ) /* loops until end-of-file is reached */ + { %% yymore()-related code goes here - yy_cp = yy_c_buf_p; + yy_cp = yy_c_buf_p; - /* support of yytext */ - *yy_cp = yy_hold_char; + /* support of yytext */ + *yy_cp = yy_hold_char; - /* yy_bp points to the position in yy_ch_buf of the start of the - * current run. - */ - yy_bp = yy_cp; + /* yy_bp points to the position in yy_ch_buf of the start of the + * current run. + */ + yy_bp = yy_cp; %% code to set up and find next match goes here yy_find_action: %% code to find the action number goes here - YY_DO_BEFORE_ACTION; - YY_USER_ACTION; + YY_DO_BEFORE_ACTION; + YY_USER_ACTION; -do_action: /* this label is used only to access EOF actions */ +do_action: /* this label is used only to access EOF actions */ %% debug code goes here - switch ( yy_act ) - { + switch ( yy_act ) + { %% actions go here - case YY_END_OF_BUFFER: - { - /* amount of text matched not including the EOB char */ - int yy_amount_of_matched_text = yy_cp - yytext - 1; + case YY_END_OF_BUFFER: + { + /* amount of text matched not including the EOB char */ + int yy_amount_of_matched_text = yy_cp - yytext - 1; - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yy_hold_char; - /* note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the end- - * of-buffer state). Contrast this with the test in yyinput(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* this was really a NUL */ - { - yy_state_type yy_next_state; + /* note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the end- + * of-buffer state). Contrast this with the test in yyinput(). + */ + if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* this was really a NUL */ + { + yy_state_type yy_next_state; - yy_c_buf_p = yytext + yy_amount_of_matched_text; + yy_c_buf_p = yytext + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state(); - /* okay, we're now positioned to make the - * NUL transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we - * don't want to build jamming into it because - * then it will run more slowly) - */ + /* okay, we're now positioned to make the + * NUL transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we + * don't want to build jamming into it because + * then it will run more slowly) + */ - yy_next_state = yy_try_NUL_trans( yy_current_state ); + yy_next_state = yy_try_NUL_trans( yy_current_state ); - yy_bp = yytext + YY_MORE_ADJ; + yy_bp = yytext + YY_MORE_ADJ; - if ( yy_next_state ) - { - /* consume the NUL */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } + if ( yy_next_state ) + { + /* consume the NUL */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } - else - { + else + { %% code to do backtracking for compressed tables and set up yy_cp goes here - goto yy_find_action; - } - } + goto yy_find_action; + } + } - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; - if ( yywrap() ) - { - /* note: because we've taken care in - * yy_get_next_buffer() to have set up yytext, - * we can now set up yy_c_buf_p so that if some - * total hoser (like flex itself) wants - * to call the scanner after we return the - * YY_NULL, it'll still work - another YY_NULL - * will get returned. - */ - yy_c_buf_p = yytext + YY_MORE_ADJ; + if ( yywrap() ) + { + /* note: because we've taken care in + * yy_get_next_buffer() to have set up yytext, + * we can now set up yy_c_buf_p so that if some + * total hoser (like flex itself) wants + * to call the scanner after we return the + * YY_NULL, it'll still work - another YY_NULL + * will get returned. + */ + yy_c_buf_p = yytext + YY_MORE_ADJ; - yy_act = YY_STATE_EOF((yy_start - 1) / 2); - goto do_action; - } + yy_act = YY_STATE_EOF((yy_start - 1) / 2); + goto do_action; + } - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - } - break; + else + { + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + } + break; - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext + yy_amount_of_matched_text; + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state(); - yy_cp = yy_c_buf_p; - yy_bp = yytext + YY_MORE_ADJ; - goto yy_match; + yy_cp = yy_c_buf_p; + yy_bp = yytext + YY_MORE_ADJ; + goto yy_match; - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state(); - yy_cp = yy_c_buf_p; - yy_bp = yytext + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } + yy_cp = yy_c_buf_p; + yy_bp = yytext + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } - default: + default: #ifdef FLEX_DEBUG - printf( "action # %d\n", yy_act ); + printf( "action # %d\n", yy_act ); #endif - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } - } + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } + } } @@ -422,9 +422,9 @@ do_action: /* this label is used only to access EOF actions */ * * synopsis * int yy_get_next_buffer(); - * + * * returns a code representing an action - * EOB_ACT_LAST_MATCH - + * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ @@ -438,8 +438,8 @@ static int yy_get_next_buffer() int ret_val; if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); /* try to read more data */ @@ -447,46 +447,46 @@ static int yy_get_next_buffer() number_to_move = yy_c_buf_p - yytext; for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); + *(dest++) = *(source++); if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_n_chars = 0; + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + yy_n_chars = 0; else - { - int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; + { + int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; - else if ( num_to_read <= 0 ) - YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); + else if ( num_to_read <= 0 ) + YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); - /* read in more data */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); - } + /* read in more data */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + } if ( yy_n_chars == 0 ) - { - if ( number_to_move == 1 ) - { - ret_val = EOB_ACT_END_OF_FILE; - yy_current_buffer->yy_eof_status = EOF_DONE; - } + { + if ( number_to_move == 1 ) + { + ret_val = EOB_ACT_END_OF_FILE; + yy_current_buffer->yy_eof_status = EOF_DONE; + } - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_eof_status = EOF_PENDING; - } - } + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_eof_status = EOF_PENDING; + } + } else - ret_val = EOB_ACT_CONTINUE_SCAN; + ret_val = EOB_ACT_CONTINUE_SCAN; yy_n_chars += number_to_move; yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; @@ -519,9 +519,9 @@ static yy_state_type yy_get_previous_state() %% code to get the start state into yy_current_state goes here for ( yy_cp = yytext + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { + { %% code to find the next state goes here - } + } return ( yy_current_state ); } @@ -550,26 +550,26 @@ static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp ) *yy_cp = yy_hold_char; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */ - register YY_CHAR *dest = - &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2]; - register YY_CHAR *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; + { /* need to shift things up to make room */ + register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */ + register YY_CHAR *dest = + &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2]; + register YY_CHAR *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; - yy_cp += dest - source; - yy_bp += dest - source; - yy_n_chars = yy_current_buffer->yy_buf_size; + yy_cp += dest - source; + yy_bp += dest - source; + yy_n_chars = yy_current_buffer->yy_buf_size; - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } if ( yy_cp > yy_bp && yy_cp[-1] == '\n' ) - yy_cp[-2] = '\n'; + yy_cp[-2] = '\n'; *--yy_cp = c; @@ -593,53 +593,53 @@ static int input(void) *yy_cp = yy_hold_char; if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* this was really a NUL */ - *yy_c_buf_p = '\0'; + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* this was really a NUL */ + *yy_c_buf_p = '\0'; - else - { /* need more input */ - yytext = yy_c_buf_p; - ++yy_c_buf_p; + else + { /* need more input */ + yytext = yy_c_buf_p; + ++yy_c_buf_p; - switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - { - yy_c_buf_p = yytext + YY_MORE_ADJ; - return ( EOF ); - } + switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + { + yy_c_buf_p = yytext + YY_MORE_ADJ; + return ( EOF ); + } - YY_NEW_FILE; + YY_NEW_FILE; #ifdef __cplusplus - return ( yyinput() ); + return ( yyinput() ); #else - return ( input() ); + return ( input() ); #endif - } - break; + } + break; - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext + YY_MORE_ADJ; - break; + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext + YY_MORE_ADJ; + break; - case EOB_ACT_LAST_MATCH: + case EOB_ACT_LAST_MATCH: #ifdef __cplusplus - YY_FATAL_ERROR( "unexpected last match in yyinput()" ); + YY_FATAL_ERROR( "unexpected last match in yyinput()" ); #else - YY_FATAL_ERROR( "unexpected last match in input()" ); + YY_FATAL_ERROR( "unexpected last match in input()" ); #endif - } - } - } + } + } + } c = *yy_c_buf_p; yy_hold_char = *++yy_c_buf_p; @@ -658,15 +658,15 @@ void yyrestart( FILE *input_file ) void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) { if ( yy_current_buffer == new_buffer ) - return; + return; if ( yy_current_buffer ) - { - /* flush out information for old buffer */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; - } + { + /* flush out information for old buffer */ + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } yy_current_buffer = new_buffer; yy_load_buffer_state(); @@ -696,7 +696,7 @@ YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) b = (YY_BUFFER_STATE) malloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; @@ -706,7 +706,7 @@ YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) b->yy_ch_buf = (YY_CHAR *) malloc( (unsigned) (b->yy_buf_size + 2) ); if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); yy_init_buffer( b, file ); @@ -717,7 +717,7 @@ YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) void yy_delete_buffer( YY_BUFFER_STATE b ) { if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; + yy_current_buffer = (YY_BUFFER_STATE) 0; free( (char *) b->yy_ch_buf ); free( (char *) b ); diff --git a/modules/libcom/src/flex/flex.skel.static b/modules/libcom/src/flex/flex.skel.static index 5e8bf2810..668dbcf26 100644 --- a/modules/libcom/src/flex/flex.skel.static +++ b/modules/libcom/src/flex/flex.skel.static @@ -29,8 +29,8 @@ * is returned in "result". */ #define YY_INPUT(buf,result,max_size) \ - if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \ - YY_FATAL_ERROR( "read() in flex scanner failed" ); + if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \ + YY_FATAL_ERROR( "read() in flex scanner failed" ); #define YY_NULL 0 /* no semi-colon after return; correct usage is to write "yyterminate();" - @@ -48,10 +48,10 @@ static int yyterminate_internal( void ); * a single C statement (which needs a semi-colon terminator). * This avoids problems with code like: * - * if ( something_happens ) - * YY_FATAL_ERROR( "oops, the something happened" ); - * else - * everything_okay(); + * if ( something_happens ) + * YY_FATAL_ERROR( "oops, the something happened" ); + * else + * everything_okay(); * * Prior to using the do-while the compiler would get upset at the * "else" because it interpreted the "if" statement as being all @@ -59,13 +59,13 @@ static int yyterminate_internal( void ); */ #define YY_FATAL_ERROR(msg) \ - do \ - { \ - (void) fputs( msg, stderr ); \ - (void) putc( '\n', stderr ); \ - exit( 1 ); \ - } \ - while ( 0 ) + do \ + { \ + (void) fputs( msg, stderr ); \ + (void) putc( '\n', stderr ); \ + exit( 1 ); \ + } \ + while ( 0 ) /* default yywrap function - always treat EOF as an EOF */ #define yywrap() 1 @@ -81,17 +81,17 @@ static int yyterminate_internal( void ); /* special action meaning "start processing a new file" */ #define YY_NEW_FILE \ - do \ - { \ - yy_init_buffer( yy_current_buffer, yyin ); \ - yy_load_buffer_state(); \ - } \ - while ( 0 ) + do \ + { \ + yy_init_buffer( yy_current_buffer, yyin ); \ + yy_load_buffer_state(); \ + } \ + while ( 0 ) /* default declaration of generated scanner - a define so the user can * easily add parameters - jbk added the static to YY_DECL */ -#define YY_DECL static int yylex ( void ) +#define YY_DECL static int yylex ( void ) /* code executed at the end of each rule */ #define YY_BREAK break; @@ -110,11 +110,11 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; * corresponding action - sets up yytext */ #define YY_DO_BEFORE_ACTION \ - yytext = yy_bp; \ + yytext = yy_bp; \ %% code to fiddle yytext and yyleng for yymore() goes here - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 @@ -122,14 +122,14 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; /* return all but the first 'n' matched characters back to the input stream */ #define yyless(n) \ - do \ - { \ - /* undo effects of setting up yytext */ \ - *yy_cp = yy_hold_char; \ - yy_c_buf_p = yy_cp = yy_bp + n; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) + do \ + { \ + /* undo effects of setting up yytext */ \ + *yy_cp = yy_hold_char; \ + yy_c_buf_p = yy_cp = yy_bp + n; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) #define unput(c) yyunput( c, yytext ) @@ -138,16 +138,16 @@ struct yy_buffer_state { FILE *yy_input_file; - YY_CHAR *yy_ch_buf; /* input buffer */ - YY_CHAR *yy_buf_pos; /* current position in input buffer */ + YY_CHAR *yy_ch_buf; /* input buffer */ + YY_CHAR *yy_buf_pos; /* current position in input buffer */ /* size of input buffer in bytes, not including room for EOB characters */ - int yy_buf_size; + int yy_buf_size; /* number of characters read into yy_ch_buf, not including EOB characters */ int yy_n_chars; - int yy_eof_status; /* whether we've seen an EOF on this buffer */ + int yy_eof_status; /* whether we've seen an EOF on this buffer */ #define EOF_NOT_SEEN 0 /* "pending" happens when the EOF has been seen but there's still * some text process @@ -168,7 +168,7 @@ static YY_BUFFER_STATE yy_current_buffer; /* yy_hold_char holds the character lost when yytext is formed */ static YY_CHAR yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ +static int yy_n_chars; /* number of characters read into yy_ch_buf */ @@ -198,8 +198,8 @@ static FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; /* jbk added static */ */ /* points to current character in buffer */ static YY_CHAR *yy_c_buf_p = (YY_CHAR *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ /* flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... @@ -238,168 +238,168 @@ YY_DECL %% user's declarations go here if ( yy_init ) - { - YY_USER_INIT; + { + YY_USER_INIT; - if ( ! yy_start ) - yy_start = 1; /* first start state */ + if ( ! yy_start ) + yy_start = 1; /* first start state */ - if ( ! yyin ) - yyin = stdin; + if ( ! yyin ) + yyin = stdin; - if ( ! yyout ) - yyout = stdout; + if ( ! yyout ) + yyout = stdout; - if ( yy_current_buffer ) - yy_init_buffer( yy_current_buffer, yyin ); - else - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + if ( yy_current_buffer ) + yy_init_buffer( yy_current_buffer, yyin ); + else + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - yy_load_buffer_state(); + yy_load_buffer_state(); - yy_init = 0; - } + yy_init = 0; + } - while ( 1 ) /* loops until end-of-file is reached */ - { + while ( 1 ) /* loops until end-of-file is reached */ + { %% yymore()-related code goes here - yy_cp = yy_c_buf_p; + yy_cp = yy_c_buf_p; - /* support of yytext */ - *yy_cp = yy_hold_char; + /* support of yytext */ + *yy_cp = yy_hold_char; - /* yy_bp points to the position in yy_ch_buf of the start of the - * current run. - */ - yy_bp = yy_cp; + /* yy_bp points to the position in yy_ch_buf of the start of the + * current run. + */ + yy_bp = yy_cp; %% code to set up and find next match goes here yy_find_action: %% code to find the action number goes here - YY_DO_BEFORE_ACTION; - YY_USER_ACTION; + YY_DO_BEFORE_ACTION; + YY_USER_ACTION; -do_action: /* this label is used only to access EOF actions */ +do_action: /* this label is used only to access EOF actions */ %% debug code goes here - switch ( yy_act ) - { + switch ( yy_act ) + { %% actions go here - case YY_END_OF_BUFFER: - { - /* amount of text matched not including the EOB char */ - int yy_amount_of_matched_text = yy_cp - yytext - 1; + case YY_END_OF_BUFFER: + { + /* amount of text matched not including the EOB char */ + int yy_amount_of_matched_text = yy_cp - yytext - 1; - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yy_hold_char; - /* note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the end- - * of-buffer state). Contrast this with the test in yyinput(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* this was really a NUL */ - { - yy_state_type yy_next_state; + /* note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the end- + * of-buffer state). Contrast this with the test in yyinput(). + */ + if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* this was really a NUL */ + { + yy_state_type yy_next_state; - yy_c_buf_p = yytext + yy_amount_of_matched_text; + yy_c_buf_p = yytext + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state(); - /* okay, we're now positioned to make the - * NUL transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we - * don't want to build jamming into it because - * then it will run more slowly) - */ + /* okay, we're now positioned to make the + * NUL transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we + * don't want to build jamming into it because + * then it will run more slowly) + */ - yy_next_state = yy_try_NUL_trans( yy_current_state ); + yy_next_state = yy_try_NUL_trans( yy_current_state ); - yy_bp = yytext + YY_MORE_ADJ; + yy_bp = yytext + YY_MORE_ADJ; - if ( yy_next_state ) - { - /* consume the NUL */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } + if ( yy_next_state ) + { + /* consume the NUL */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } - else - { + else + { %% code to do backtracking for compressed tables and set up yy_cp goes here - goto yy_find_action; - } - } + goto yy_find_action; + } + } - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; - if ( yywrap() ) - { - /* note: because we've taken care in - * yy_get_next_buffer() to have set up yytext, - * we can now set up yy_c_buf_p so that if some - * total hoser (like flex itself) wants - * to call the scanner after we return the - * YY_NULL, it'll still work - another YY_NULL - * will get returned. - */ - yy_c_buf_p = yytext + YY_MORE_ADJ; + if ( yywrap() ) + { + /* note: because we've taken care in + * yy_get_next_buffer() to have set up yytext, + * we can now set up yy_c_buf_p so that if some + * total hoser (like flex itself) wants + * to call the scanner after we return the + * YY_NULL, it'll still work - another YY_NULL + * will get returned. + */ + yy_c_buf_p = yytext + YY_MORE_ADJ; - yy_act = YY_STATE_EOF((yy_start - 1) / 2); - goto do_action; - } + yy_act = YY_STATE_EOF((yy_start - 1) / 2); + goto do_action; + } - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - } - break; + else + { + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + } + break; - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext + yy_amount_of_matched_text; + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state(); - yy_cp = yy_c_buf_p; - yy_bp = yytext + YY_MORE_ADJ; - goto yy_match; + yy_cp = yy_c_buf_p; + yy_bp = yytext + YY_MORE_ADJ; + goto yy_match; - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state(); - yy_cp = yy_c_buf_p; - yy_bp = yytext + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } + yy_cp = yy_c_buf_p; + yy_bp = yytext + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } - default: + default: #ifdef FLEX_DEBUG - printf( "action # %d\n", yy_act ); + printf( "action # %d\n", yy_act ); #endif - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } - } + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } + } } @@ -407,9 +407,9 @@ do_action: /* this label is used only to access EOF actions */ * * synopsis * int yy_get_next_buffer(); - * + * * returns a code representing an action - * EOB_ACT_LAST_MATCH - + * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ @@ -423,8 +423,8 @@ static int yy_get_next_buffer( void ) int ret_val; if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); /* try to read more data */ @@ -432,46 +432,46 @@ static int yy_get_next_buffer( void ) number_to_move = yy_c_buf_p - yytext; for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); + *(dest++) = *(source++); if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_n_chars = 0; + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + yy_n_chars = 0; else - { - int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; + { + int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; - else if ( num_to_read <= 0 ) - YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); + else if ( num_to_read <= 0 ) + YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); - /* read in more data */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); - } + /* read in more data */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + } if ( yy_n_chars == 0 ) - { - if ( number_to_move - YY_MORE_ADJ == 1 ) - { - ret_val = EOB_ACT_END_OF_FILE; - yy_current_buffer->yy_eof_status = EOF_DONE; - } + { + if ( number_to_move - YY_MORE_ADJ == 1 ) + { + ret_val = EOB_ACT_END_OF_FILE; + yy_current_buffer->yy_eof_status = EOF_DONE; + } - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_eof_status = EOF_PENDING; - } - } + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_eof_status = EOF_PENDING; + } + } else - ret_val = EOB_ACT_CONTINUE_SCAN; + ret_val = EOB_ACT_CONTINUE_SCAN; yy_n_chars += number_to_move; yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; @@ -504,9 +504,9 @@ static yy_state_type yy_get_previous_state( void ) %% code to get the start state into yy_current_state goes here for ( yy_cp = yytext + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { + { %% code to find the next state goes here - } + } return ( yy_current_state ); } @@ -535,26 +535,26 @@ static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp ) *yy_cp = yy_hold_char; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */ - register YY_CHAR *dest = - &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2]; - register YY_CHAR *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; + { /* need to shift things up to make room */ + register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */ + register YY_CHAR *dest = + &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2]; + register YY_CHAR *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; - yy_cp += dest - source; - yy_bp += dest - source; - yy_n_chars = yy_current_buffer->yy_buf_size; + yy_cp += dest - source; + yy_bp += dest - source; + yy_n_chars = yy_current_buffer->yy_buf_size; - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } if ( yy_cp > yy_bp && yy_cp[-1] == '\n' ) - yy_cp[-2] = '\n'; + yy_cp[-2] = '\n'; *--yy_cp = c; @@ -579,53 +579,53 @@ static int input( void ) *yy_cp = yy_hold_char; if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* this was really a NUL */ - *yy_c_buf_p = '\0'; + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* this was really a NUL */ + *yy_c_buf_p = '\0'; - else - { /* need more input */ - yytext = yy_c_buf_p; - ++yy_c_buf_p; + else + { /* need more input */ + yytext = yy_c_buf_p; + ++yy_c_buf_p; - switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - { - yy_c_buf_p = yytext + YY_MORE_ADJ; - return ( EOF ); - } + switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + { + yy_c_buf_p = yytext + YY_MORE_ADJ; + return ( EOF ); + } - YY_NEW_FILE; + YY_NEW_FILE; #ifdef __cplusplus - return ( yyinput() ); + return ( yyinput() ); #else - return ( input() ); + return ( input() ); #endif - } - break; + } + break; - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext + YY_MORE_ADJ; - break; + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext + YY_MORE_ADJ; + break; - case EOB_ACT_LAST_MATCH: + case EOB_ACT_LAST_MATCH: #ifdef __cplusplus - YY_FATAL_ERROR( "unexpected last match in yyinput()" ); + YY_FATAL_ERROR( "unexpected last match in yyinput()" ); #else - YY_FATAL_ERROR( "unexpected last match in input()" ); + YY_FATAL_ERROR( "unexpected last match in input()" ); #endif - } - } - } + } + } + } c = *yy_c_buf_p; yy_hold_char = *++yy_c_buf_p; @@ -639,9 +639,9 @@ static int input( void ) static void yyrestart( FILE *input_file ) { if ( yy_current_buffer ) - yy_init_buffer( yy_current_buffer, input_file ); + yy_init_buffer( yy_current_buffer, input_file ); else - yy_current_buffer = yy_create_buffer( input_file, YY_BUF_SIZE ); + yy_current_buffer = yy_create_buffer( input_file, YY_BUF_SIZE ); yy_load_buffer_state(); } @@ -651,15 +651,15 @@ static void yyrestart( FILE *input_file ) static void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) { if ( yy_current_buffer == new_buffer ) - return; + return; if ( yy_current_buffer ) - { - /* flush out information for old buffer */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; - } + { + /* flush out information for old buffer */ + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } yy_current_buffer = new_buffer; yy_load_buffer_state(); @@ -691,7 +691,7 @@ static YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) b = (YY_BUFFER_STATE) malloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; @@ -701,7 +701,7 @@ static YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) b->yy_ch_buf = (YY_CHAR *) malloc( (unsigned) (b->yy_buf_size + 2) ); if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); yy_init_buffer( b, file ); @@ -713,7 +713,7 @@ static YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) static void yy_delete_buffer( YY_BUFFER_STATE b ) { if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; + yy_current_buffer = (YY_BUFFER_STATE) 0; free( (char *) b->yy_ch_buf ); free( (char *) b ); @@ -746,9 +746,9 @@ static void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) static int yyterminate_internal( void ) { - /* jbk fix - buffer created by yy_create_buffer needs to be freed */ - yy_delete_buffer(yy_current_buffer); - yy_current_buffer=NULL; - return YY_NULL; + /* jbk fix - buffer created by yy_create_buffer needs to be freed */ + yy_delete_buffer(yy_current_buffer); + yy_current_buffer=NULL; + return YY_NULL; } diff --git a/modules/libcom/src/flex/flexdef.h b/modules/libcom/src/flex/flexdef.h index c14260ccb..932878899 100644 --- a/modules/libcom/src/flex/flexdef.h +++ b/modules/libcom/src/flex/flexdef.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* flexdef - definitions file for flex */ @@ -14,7 +14,7 @@ * * This code is derived from software contributed to Berkeley by * Vern Paxson. - * + * * The United States Government has rights in this work pursuant * to contract no. DE-AC03-76SF00098 between the United States * Department of Energy and the University of California. @@ -114,16 +114,16 @@ * that can be used. This definition is currently not used. */ #define FREE_EPSILON(state) \ - (transchar[state] == SYM_EPSILON && \ - trans2[state] == NO_TRANSITION && \ - finalst[state] != state) + (transchar[state] == SYM_EPSILON && \ + trans2[state] == NO_TRANSITION && \ + finalst[state] != state) /* returns true if an nfa state has an epsilon out-transition character * and both slots are free */ #define SUPER_FREE_EPSILON(state) \ - (transchar[state] == SYM_EPSILON && \ - trans1[state] == NO_TRANSITION) \ + (transchar[state] == SYM_EPSILON && \ + trans1[state] == NO_TRANSITION) \ /* maximum number of NFA states that can comprise a DFA state. It's real * big because if there's a lot of rules, the initial state will have a @@ -156,28 +156,28 @@ */ #define NIL 0 -#define JAM -1 /* to mark a missing DFA transition */ +#define JAM -1 /* to mark a missing DFA transition */ #define NO_TRANSITION NIL -#define UNIQUE -1 /* marks a symbol as an e.c. representative */ -#define INFINITY -1 /* for x{5,} constructions */ +#define UNIQUE -1 /* marks a symbol as an e.c. representative */ +#define INFINITY -1 /* for x{5,} constructions */ -#define INITIAL_MAX_CCLS 100 /* max number of unique character classes */ +#define INITIAL_MAX_CCLS 100 /* max number of unique character classes */ #define MAX_CCLS_INCREMENT 100 /* size of table holding members of character classes */ #define INITIAL_MAX_CCL_TBL_SIZE 500 #define MAX_CCL_TBL_SIZE_INCREMENT 250 -#define INITIAL_MAX_RULES 100 /* default maximum number of rules */ +#define INITIAL_MAX_RULES 100 /* default maximum number of rules */ #define MAX_RULES_INCREMENT 100 -#define INITIAL_MNS 2000 /* default maximum number of nfa states */ -#define MNS_INCREMENT 1000 /* amount to bump above by if it's not enough */ +#define INITIAL_MNS 2000 /* default maximum number of nfa states */ +#define MNS_INCREMENT 1000 /* amount to bump above by if it's not enough */ -#define INITIAL_MAX_DFAS 1000 /* default maximum number of dfa states */ +#define INITIAL_MAX_DFAS 1000 /* default maximum number of dfa states */ #define MAX_DFAS_INCREMENT 1000 -#define JAMSTATE -32766 /* marks a reference to the state that always jams */ +#define JAMSTATE -32766 /* marks a reference to the state that always jams */ /* enough so that if it's subtracted from an NFA state number, the result * is guaranteed to be negative @@ -193,13 +193,13 @@ #define INITIAL_MAX_TEMPLATE_XPAIRS 2500 #define MAX_TEMPLATE_XPAIRS_INCREMENT 2500 -#define SYM_EPSILON (CSIZE + 1) /* to mark transitions on the symbol epsilon */ +#define SYM_EPSILON (CSIZE + 1) /* to mark transitions on the symbol epsilon */ -#define INITIAL_MAX_SCS 40 /* maximum number of start conditions */ -#define MAX_SCS_INCREMENT 40 /* amount to bump by if it's not enough */ +#define INITIAL_MAX_SCS 40 /* maximum number of start conditions */ +#define MAX_SCS_INCREMENT 40 /* amount to bump by if it's not enough */ -#define ONE_STACK_SIZE 500 /* stack of states with only one out-transition */ -#define SAME_TRANS -1 /* transition is the same as "default" entry for state */ +#define ONE_STACK_SIZE 500 /* stack of states with only one out-transition */ +#define SAME_TRANS -1 /* transition is the same as "default" entry for state */ /* the following percentages are used to tune table compression: @@ -211,7 +211,7 @@ /* the percentage the number of homogeneous out-transitions of a state * must be of the number of total out-transitions of the state in order - * that the state's transition table is first compared with a potential + * that the state's transition table is first compared with a potential * template of the most common out-transition instead of with the first * proto in the proto queue */ @@ -253,7 +253,7 @@ */ #define PROT_SAVE_SIZE 2000 -#define MSP 50 /* maximum number of saved protos (protos on the proto queue) */ +#define MSP 50 /* maximum number of saved protos (protos on the proto queue) */ /* maximum number of out-transitions a state can have that we'll rummage * around through the interior of the internal fast table looking for a @@ -299,7 +299,7 @@ typedef struct hash_entry *hash_table[]; #define START_COND_HASH_SIZE 101 #define CCL_HASH_SIZE 101 -extern struct hash_entry *ndtbl[NAME_TABLE_HASH_SIZE]; +extern struct hash_entry *ndtbl[NAME_TABLE_HASH_SIZE]; extern struct hash_entry *sctbl[START_COND_HASH_SIZE]; extern struct hash_entry *ccltab[CCL_HASH_SIZE]; @@ -358,7 +358,7 @@ extern int yymore_really_used, reject_really_used; * infilename - name of input file * input_files - array holding names of input files * num_input_files - size of input_files array - * program_name - name with which program was invoked + * program_name - name with which program was invoked */ extern int datapos, dataline, linenum; @@ -543,7 +543,7 @@ extern int end_of_buffer_state; * cclng - true for a given ccl if the ccl is negated * cclreuse - counts how many times a ccl is re-used * current_max_ccl_tbl_size - current limit on number of characters needed - * to represent the unique ccl's + * to represent the unique ccl's * ccltbl - holds the characters in each ccl - indexed by cclmap */ @@ -563,7 +563,7 @@ extern Char *ccltbl; * numeps - number of epsilon NFA states created * eps2 - number of epsilon states which have 2 out-transitions * num_reallocs - number of times it was necessary to realloc() a group - * of arrays + * of arrays * tmpuses - number of DFA states that chain to templates * totnst - total number of NFA states used to make DFA states * peakpairs - peak number of transition pairs we had to store internally @@ -583,42 +583,42 @@ void *allocate_array(int size, int element_size); void *reallocate_array(void *array, int size, int element_size); #define allocate_integer_array(size) \ - (int *) allocate_array( size, sizeof( int ) ) + (int *) allocate_array( size, sizeof( int ) ) #define reallocate_integer_array(array,size) \ - (int *) reallocate_array( (void *) array, size, sizeof( int ) ) + (int *) reallocate_array( (void *) array, size, sizeof( int ) ) #define allocate_int_ptr_array(size) \ - (int **) allocate_array( size, sizeof( int * ) ) + (int **) allocate_array( size, sizeof( int * ) ) #define allocate_char_ptr_array(size) \ - (char **) allocate_array( size, sizeof( char * ) ) + (char **) allocate_array( size, sizeof( char * ) ) #define allocate_dfaacc_union(size) \ - (union dfaacc_union *) \ - allocate_array( size, sizeof( union dfaacc_union ) ) + (union dfaacc_union *) \ + allocate_array( size, sizeof( union dfaacc_union ) ) #define reallocate_int_ptr_array(array,size) \ - (int **) reallocate_array( (void *) array, size, sizeof( int * ) ) + (int **) reallocate_array( (void *) array, size, sizeof( int * ) ) #define reallocate_char_ptr_array(array,size) \ - (char **) reallocate_array( (void *) array, size, sizeof( char * ) ) + (char **) reallocate_array( (void *) array, size, sizeof( char * ) ) #define reallocate_dfaacc_union(array, size) \ - (union dfaacc_union *) \ - reallocate_array( (void *) array, size, sizeof( union dfaacc_union ) ) + (union dfaacc_union *) \ + reallocate_array( (void *) array, size, sizeof( union dfaacc_union ) ) #define allocate_character_array(size) \ - (Char *) allocate_array( size, sizeof( Char ) ) + (Char *) allocate_array( size, sizeof( Char ) ) #define reallocate_character_array(array,size) \ - (Char *) reallocate_array( (void *) array, size, sizeof( Char ) ) + (Char *) reallocate_array( (void *) array, size, sizeof( Char ) ) #if 0 /* JRW this might couse truuble... but not for IOC usage */ /* used to communicate between scanner and parser. The type should really * be YYSTYPE, but we can't easily get our hands on it. */ -#ifdef __alpha /* inconsistency with parse.y, line 57... on Alpha */ +#ifdef __alpha /* inconsistency with parse.y, line 57... on Alpha */ extern long yylval; #else extern int yylval; @@ -631,9 +631,9 @@ extern int yylval; /* from file ccl.c */ -extern void ccladd (int, int); /* Add a single character to a ccl */ -extern int cclinit (void); /* make an empty ccl */ -extern void cclnegate (int); /* negate a ccl */ +extern void ccladd (int, int); /* Add a single character to a ccl */ +extern int cclinit (void); /* make an empty ccl */ +extern void cclnegate (int); /* negate a ccl */ /* list the members of a set of characters in CCL form */ extern void list_character_set (FILE*, int[]); @@ -644,7 +644,7 @@ extern void list_character_set (FILE*, int[]); /* increase the maximum number of dfas */ extern void increase_max_dfas (void); -extern void ntod (void); /* convert a ndfa to a dfa */ +extern void ntod (void); /* convert a ndfa to a dfa */ /* from file ecs.c */ @@ -667,7 +667,7 @@ extern void mkechar (int, int[], int[]); /* from file gen.c */ -extern void make_tables (void); /* generate transition tables */ +extern void make_tables (void); /* generate transition tables */ /* from file main.c */ @@ -692,7 +692,7 @@ extern void bubble (int [], int); /* shell sort a character array */ extern void cshell (Char [], int, int); -extern void dataend (void); /* finish up a block of data declarations */ +extern void dataend (void); /* finish up a block of data declarations */ /* report an error message and terminate */ extern void flexerror (char[]) NORETURN; @@ -712,7 +712,7 @@ extern void line_directive_out (FILE*); /* generate a data statment for a two-dimensional array */ extern void mk2data (int); -extern void mkdata (int); /* generate a data statement */ +extern void mkdata (int); /* generate a data statement */ /* return the integer represented by a string of digits */ extern int myctoi (Char []); @@ -749,8 +749,8 @@ extern void mark_beginning_as_normal (int); /* make a machine that branches to two machines */ extern int mkbranch (int, int); -extern int mkclos (int); /* convert a machine into a closure */ -extern int mkopt (int); /* make a machine optional */ +extern int mkclos (int); /* convert a machine into a closure */ +extern int mkopt (int); /* make a machine optional */ /* make a machine that matches either one of two machines */ extern int mkor (int, int); @@ -758,12 +758,12 @@ extern int mkor (int, int); /* convert a machine into a positive closure */ extern int mkposcl (int); -extern int mkrep (int, int, int); /* make a replicated machine */ +extern int mkrep (int, int, int); /* make a replicated machine */ /* create a state with a transition on a given symbol */ extern int mkstate (int); -extern void new_rule (void); /* initialize for a new rule */ +extern void new_rule (void); /* initialize for a new rule */ /* from file parse.y */ @@ -774,18 +774,18 @@ extern void format_pinpoint_message (char[], char[]); /* write out a message, pinpointing its location */ extern void pinpoint_message (char[]); -extern void synerr (char []); /* report a syntax error */ -/* extern int yyparse ();*/ /* the YACC parser */ +extern void synerr (char []); /* report a syntax error */ +/* extern int yyparse ();*/ /* the YACC parser */ /* from file scan.l */ -extern int flexscan (); /* the Flex-generated scanner for flex */ +extern int flexscan (); /* the Flex-generated scanner for flex */ /* open the given file (if NULL, stdin) for scanning */ extern void set_input_file (char*); -extern int yywrap (); /* wrapup a file in the lexical analyzer */ +extern int yywrap (); /* wrapup a file in the lexical analyzer */ /* from file sym.c */ @@ -796,8 +796,8 @@ extern void cclinstal (Char [], int); /* lookup the number associated with character class */ extern int ccllookup (Char []); -extern void ndinstal (char[], Char[]); /* install a name definition */ -extern void scinstal (char[], int); /* make a start condition */ +extern void ndinstal (char[], Char[]); /* install a name definition */ +extern void scinstal (char[], int); /* make a start condition */ /* lookup the number associated with a start condition */ extern int sclookup (char[]); @@ -808,9 +808,9 @@ extern int sclookup (char[]); /* build table entries for dfa state */ extern void bldtbl (int[], int, int, int, int); -extern void cmptmps (void); /* compress template table entries */ -extern void inittbl (void); /* initialize transition tables */ -extern void mkdeftbl (void); /* make the default, "jam" table entries */ +extern void cmptmps (void); /* compress template table entries */ +extern void inittbl (void); /* initialize transition tables */ +extern void mkdeftbl (void); /* make the default, "jam" table entries */ /* create table entries for a state (or state fragment) which has * only one out-transition */ diff --git a/modules/libcom/src/flex/gen.c b/modules/libcom/src/flex/gen.c index d0219ec94..6f1940d70 100644 --- a/modules/libcom/src/flex/gen.c +++ b/modules/libcom/src/flex/gen.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* gen - actual generation (writing) of flex scanners */ @@ -14,7 +14,7 @@ * * This code is derived from software contributed to Berkeley by * Vern Paxson. - * + * * The United States Government has rights in this work pursuant * to contract no. DE-AC03-76SF00098 between the United States * Department of Energy and the University of California. @@ -57,7 +57,7 @@ static int indent_level = 0; /* each level is 4 spaces */ static char C_short_decl[] = "static const short int %s[%d] =\n { 0,\n"; static char C_long_decl[] = "static const long int %s[%d] =\n { 0,\n"; static char C_state_decl[] = - "static const yy_state_type %s[%d] =\n { 0,\n"; + "static const yy_state_type %s[%d] =\n { 0,\n"; /* indent to the current level */ @@ -67,16 +67,16 @@ void do_indent(void) int i = indent_level * 4; while ( i >= 8 ) - { - putchar( '\t' ); - i -= 8; - } - + { + putchar( '\t' ); + i -= 8; + } + while ( i > 0 ) - { - putchar( ' ' ); - --i; - } + { + putchar( ' ' ); + --i; + } } @@ -85,12 +85,12 @@ void do_indent(void) void gen_backtracking(void) { if ( reject || num_backtracking == 0 ) - return; + return; if ( fullspd ) - indent_puts( "if ( yy_current_state[-1].yy_nxt )" ); + indent_puts( "if ( yy_current_state[-1].yy_nxt )" ); else - indent_puts( "if ( yy_accept[yy_current_state] )" ); + indent_puts( "if ( yy_accept[yy_current_state] )" ); indent_up(); indent_puts( "{" ); @@ -106,7 +106,7 @@ void gen_backtracking(void) void gen_bt_action(void) { if ( reject || num_backtracking == 0 ) - return; + return; set_indent( 3 ); @@ -115,12 +115,12 @@ void gen_bt_action(void) indent_puts( "*yy_cp = yy_hold_char;" ); if ( fullspd || fulltbl ) - indent_puts( "yy_cp = yy_last_accepting_cpos + 1;" ); + indent_puts( "yy_cp = yy_last_accepting_cpos + 1;" ); else - /* backtracking info for compressed tables is taken \after/ - * yy_cp has been incremented for the next state - */ - indent_puts( "yy_cp = yy_last_accepting_cpos;" ); + /* backtracking info for compressed tables is taken \after/ + * yy_cp has been incremented for the next state + */ + indent_puts( "yy_cp = yy_last_accepting_cpos;" ); indent_puts( "yy_current_state = yy_last_accepting_state;" ); indent_puts( "goto yy_find_action;" ); @@ -143,9 +143,9 @@ void genctbl(void) /* table of verify for transition and offset to next state */ printf( "static const struct yy_trans_info yy_transition[%d] =\n", - tblend + numecs + 1 ); + tblend + numecs + 1 ); printf( " {\n" ); - + /* We want the transition to be represented as the offset to the * next state, not the actual state number, which is what it currently is. * The offset is base[nxt[i]] - base[chk[i]]. That's just the @@ -172,28 +172,28 @@ void genctbl(void) /* make sure every state has a end-of-buffer transition and an action # */ for ( i = 0; i <= lastdfa; ++i ) - { - int anum = dfaacc[i].dfaacc_state; + { + int anum = dfaacc[i].dfaacc_state; - chk[base[i]] = EOB_POSITION; - chk[base[i] - 1] = ACTION_POSITION; - nxt[base[i] - 1] = anum; /* action number */ - } + chk[base[i]] = EOB_POSITION; + chk[base[i] - 1] = ACTION_POSITION; + nxt[base[i] - 1] = anum; /* action number */ + } for ( i = 0; i <= tblend; ++i ) - { - if ( chk[i] == EOB_POSITION ) - transition_struct_out( 0, base[lastdfa + 1] - i ); + { + if ( chk[i] == EOB_POSITION ) + transition_struct_out( 0, base[lastdfa + 1] - i ); - else if ( chk[i] == ACTION_POSITION ) - transition_struct_out( 0, nxt[i] ); + else if ( chk[i] == ACTION_POSITION ) + transition_struct_out( 0, nxt[i] ); - else if ( chk[i] > numecs || chk[i] == 0 ) - transition_struct_out( 0, 0 ); /* unused slot */ + else if ( chk[i] > numecs || chk[i] == 0 ) + transition_struct_out( 0, 0 ); /* unused slot */ - else /* verify, transition */ - transition_struct_out( chk[i], base[nxt[i]] - (i - chk[i]) ); - } + else /* verify, transition */ + transition_struct_out( chk[i], base[nxt[i]] - (i - chk[i]) ); + } /* here's the final, end-of-buffer state */ @@ -205,16 +205,16 @@ void genctbl(void) /* table of pointers to start states */ printf( "static const struct yy_trans_info *yy_start_state_list[%d] =\n", - lastsc * 2 + 1 ); + lastsc * 2 + 1 ); printf( " {\n" ); for ( i = 0; i <= lastsc * 2; ++i ) - printf( " &yy_transition[%d],\n", base[i] ); + printf( " &yy_transition[%d],\n", base[i] ); dataend(); if ( useecs ) - genecs(); + genecs(); } @@ -228,41 +228,41 @@ void genecs(void) Char clower(); if ( numecs < csize ) - printf( C_char_decl, "YY_CHAR", "yy_ec", csize ); + printf( C_char_decl, "YY_CHAR", "yy_ec", csize ); else - printf( C_char_decl, "short", "yy_ec", csize ); + printf( C_char_decl, "short", "yy_ec", csize ); for ( i = 1; i < csize; ++i ) - { - if ( caseins && (i >= 'A') && (i <= 'Z') ) - ecgroup[i] = ecgroup[clower( i )]; + { + if ( caseins && (i >= 'A') && (i <= 'Z') ) + ecgroup[i] = ecgroup[clower( i )]; - ecgroup[i] = abs( ecgroup[i] ); - mkdata( ecgroup[i] ); - } + ecgroup[i] = abs( ecgroup[i] ); + mkdata( ecgroup[i] ); + } dataend(); if ( trace ) - { - char *readable_form(); + { + char *readable_form(); - fputs( "\n\nEquivalence Classes:\n\n", stderr ); + fputs( "\n\nEquivalence Classes:\n\n", stderr ); - numrows = csize / 8; + numrows = csize / 8; - for ( j = 0; j < numrows; ++j ) - { - for ( i = j; i < csize; i = i + numrows ) - { - fprintf( stderr, "%4s = %-2d", readable_form( i ), ecgroup[i] ); + for ( j = 0; j < numrows; ++j ) + { + for ( i = j; i < csize; i = i + numrows ) + { + fprintf( stderr, "%4s = %-2d", readable_form( i ), ecgroup[i] ); - putc( ' ', stderr ); - } + putc( ' ', stderr ); + } - putc( '\n', stderr ); - } - } + putc( '\n', stderr ); + } + } } @@ -271,114 +271,114 @@ void genecs(void) void gen_find_action(void) { if ( fullspd ) - indent_puts( "yy_act = yy_current_state[-1].yy_nxt;" ); + indent_puts( "yy_act = yy_current_state[-1].yy_nxt;" ); else if ( fulltbl ) - indent_puts( "yy_act = yy_accept[yy_current_state];" ); + indent_puts( "yy_act = yy_accept[yy_current_state];" ); else if ( reject ) - { - indent_puts( "yy_current_state = *--yy_state_ptr;" ); - indent_puts( "yy_lp = yy_accept[yy_current_state];" ); + { + indent_puts( "yy_current_state = *--yy_state_ptr;" ); + indent_puts( "yy_lp = yy_accept[yy_current_state];" ); - puts( "find_rule: /* we branch to this label when backtracking */" ); + puts( "find_rule: /* we branch to this label when backtracking */" ); - indent_puts( "for ( ; ; ) /* until we find what rule we matched */" ); + indent_puts( "for ( ; ; ) /* until we find what rule we matched */" ); - indent_up(); + indent_up(); - indent_puts( "{" ); + indent_puts( "{" ); - indent_puts( "if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] )" ); - indent_up(); - indent_puts( "{" ); - indent_puts( "yy_act = yy_acclist[yy_lp];" ); + indent_puts( "if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] )" ); + indent_up(); + indent_puts( "{" ); + indent_puts( "yy_act = yy_acclist[yy_lp];" ); - if ( variable_trailing_context_rules ) - { - indent_puts( "if ( yy_act & YY_TRAILING_HEAD_MASK ||" ); - indent_puts( " yy_looking_for_trail_begin )" ); - indent_up(); - indent_puts( "{" ); + if ( variable_trailing_context_rules ) + { + indent_puts( "if ( yy_act & YY_TRAILING_HEAD_MASK ||" ); + indent_puts( " yy_looking_for_trail_begin )" ); + indent_up(); + indent_puts( "{" ); - indent_puts( "if ( yy_act == yy_looking_for_trail_begin )" ); - indent_up(); - indent_puts( "{" ); - indent_puts( "yy_looking_for_trail_begin = 0;" ); - indent_puts( "yy_act &= ~YY_TRAILING_HEAD_MASK;" ); - indent_puts( "break;" ); - indent_puts( "}" ); - indent_down(); + indent_puts( "if ( yy_act == yy_looking_for_trail_begin )" ); + indent_up(); + indent_puts( "{" ); + indent_puts( "yy_looking_for_trail_begin = 0;" ); + indent_puts( "yy_act &= ~YY_TRAILING_HEAD_MASK;" ); + indent_puts( "break;" ); + indent_puts( "}" ); + indent_down(); - indent_puts( "}" ); - indent_down(); + indent_puts( "}" ); + indent_down(); - indent_puts( "else if ( yy_act & YY_TRAILING_MASK )" ); - indent_up(); - indent_puts( "{" ); - indent_puts( - "yy_looking_for_trail_begin = yy_act & ~YY_TRAILING_MASK;" ); - indent_puts( - "yy_looking_for_trail_begin |= YY_TRAILING_HEAD_MASK;" ); + indent_puts( "else if ( yy_act & YY_TRAILING_MASK )" ); + indent_up(); + indent_puts( "{" ); + indent_puts( + "yy_looking_for_trail_begin = yy_act & ~YY_TRAILING_MASK;" ); + indent_puts( + "yy_looking_for_trail_begin |= YY_TRAILING_HEAD_MASK;" ); - if ( real_reject ) - { - /* remember matched text in case we back up due to REJECT */ - indent_puts( "yy_full_match = yy_cp;" ); - indent_puts( "yy_full_state = yy_state_ptr;" ); - indent_puts( "yy_full_lp = yy_lp;" ); - } + if ( real_reject ) + { + /* remember matched text in case we back up due to REJECT */ + indent_puts( "yy_full_match = yy_cp;" ); + indent_puts( "yy_full_state = yy_state_ptr;" ); + indent_puts( "yy_full_lp = yy_lp;" ); + } - indent_puts( "}" ); - indent_down(); + indent_puts( "}" ); + indent_down(); - indent_puts( "else" ); - indent_up(); - indent_puts( "{" ); - indent_puts( "yy_full_match = yy_cp;" ); - indent_puts( "yy_full_state = yy_state_ptr;" ); - indent_puts( "yy_full_lp = yy_lp;" ); - indent_puts( "break;" ); - indent_puts( "}" ); - indent_down(); + indent_puts( "else" ); + indent_up(); + indent_puts( "{" ); + indent_puts( "yy_full_match = yy_cp;" ); + indent_puts( "yy_full_state = yy_state_ptr;" ); + indent_puts( "yy_full_lp = yy_lp;" ); + indent_puts( "break;" ); + indent_puts( "}" ); + indent_down(); - indent_puts( "++yy_lp;" ); - indent_puts( "goto find_rule;" ); - } + indent_puts( "++yy_lp;" ); + indent_puts( "goto find_rule;" ); + } - else - { - /* remember matched text in case we back up due to trailing context - * plus REJECT - */ - indent_up(); - indent_puts( "{" ); - indent_puts( "yy_full_match = yy_cp;" ); - indent_puts( "break;" ); - indent_puts( "}" ); - indent_down(); - } + else + { + /* remember matched text in case we back up due to trailing context + * plus REJECT + */ + indent_up(); + indent_puts( "{" ); + indent_puts( "yy_full_match = yy_cp;" ); + indent_puts( "break;" ); + indent_puts( "}" ); + indent_down(); + } - indent_puts( "}" ); - indent_down(); + indent_puts( "}" ); + indent_down(); - indent_puts( "--yy_cp;" ); + indent_puts( "--yy_cp;" ); - /* we could consolidate the following two lines with those at - * the beginning, but at the cost of complaints that we're - * branching inside a loop - */ - indent_puts( "yy_current_state = *--yy_state_ptr;" ); - indent_puts( "yy_lp = yy_accept[yy_current_state];" ); + /* we could consolidate the following two lines with those at + * the beginning, but at the cost of complaints that we're + * branching inside a loop + */ + indent_puts( "yy_current_state = *--yy_state_ptr;" ); + indent_puts( "yy_lp = yy_accept[yy_current_state];" ); - indent_puts( "}" ); + indent_puts( "}" ); - indent_down(); - } + indent_down(); + } else - /* compressed */ - indent_puts( "yy_act = yy_accept[yy_current_state];" ); + /* compressed */ + indent_puts( "yy_act = yy_accept[yy_current_state];" ); } @@ -399,19 +399,19 @@ void genftbl(void) dfaacc[end_of_buffer_state].dfaacc_state = end_of_buffer_action; for ( i = 1; i <= lastdfa; ++i ) - { - int anum = dfaacc[i].dfaacc_state; + { + int anum = dfaacc[i].dfaacc_state; - mkdata( anum ); + mkdata( anum ); - if ( trace && anum ) - fprintf( stderr, "state # %d accepts: [%d]\n", i, anum ); - } + if ( trace && anum ) + fprintf( stderr, "state # %d accepts: [%d]\n", i, anum ); + } dataend(); if ( useecs ) - genecs(); + genecs(); /* don't have to dump the actual full table entries - they were created * on-the-fly @@ -438,28 +438,28 @@ void gen_next_compressed_state(char *char_map) indent_puts( "yy_current_state = yy_def[yy_current_state];" ); if ( usemecs ) - { - /* we've arrange it so that templates are never chained - * to one another. This means we can afford make a - * very simple test to see if we need to convert to - * yy_c's meta-equivalence class without worrying - * about erroneously looking up the meta-equivalence - * class twice - */ - do_indent(); - /* lastdfa + 2 is the beginning of the templates */ - printf( "if ( yy_current_state >= %d )\n", lastdfa + 2 ); + { + /* we've arrange it so that templates are never chained + * to one another. This means we can afford make a + * very simple test to see if we need to convert to + * yy_c's meta-equivalence class without worrying + * about erroneously looking up the meta-equivalence + * class twice + */ + do_indent(); + /* lastdfa + 2 is the beginning of the templates */ + printf( "if ( yy_current_state >= %d )\n", lastdfa + 2 ); - indent_up(); - indent_puts( "yy_c = yy_meta[(int)yy_c];" ); - indent_down(); - } + indent_up(); + indent_puts( "yy_c = yy_meta[(int)yy_c];" ); + indent_down(); + } indent_puts( "}" ); indent_down(); indent_puts( - "yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];" ); + "yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];" ); } @@ -472,89 +472,89 @@ void gen_next_match(void) */ char *char_map = useecs ? "yy_ec[(int)*yy_cp]" : "*yy_cp"; char *char_map_2 = useecs ? "yy_ec[*++yy_cp]" : "*++yy_cp"; - + if ( fulltbl ) - { - indent_put2s( - "while ( (yy_current_state = yy_nxt[yy_current_state][%s]) > 0 )", - char_map ); + { + indent_put2s( + "while ( (yy_current_state = yy_nxt[yy_current_state][%s]) > 0 )", + char_map ); - indent_up(); + indent_up(); - if ( num_backtracking > 0 ) - { - indent_puts( "{" ); - gen_backtracking(); - putchar( '\n' ); - } + if ( num_backtracking > 0 ) + { + indent_puts( "{" ); + gen_backtracking(); + putchar( '\n' ); + } - indent_puts( "++yy_cp;" ); + indent_puts( "++yy_cp;" ); - if ( num_backtracking > 0 ) - indent_puts( "}" ); + if ( num_backtracking > 0 ) + indent_puts( "}" ); - indent_down(); + indent_down(); - putchar( '\n' ); - indent_puts( "yy_current_state = -yy_current_state;" ); - } + putchar( '\n' ); + indent_puts( "yy_current_state = -yy_current_state;" ); + } else if ( fullspd ) - { - indent_puts( "{" ); - indent_puts( "const struct yy_trans_info *yy_trans_info;\n" ); - indent_puts( "YY_CHAR yy_c;\n" ); - indent_put2s( "for ( yy_c = %s;", char_map ); - indent_puts( - " (yy_trans_info = &yy_current_state[yy_c])->yy_verify == yy_c;" ); - indent_put2s( " yy_c = %s )", char_map_2 ); + { + indent_puts( "{" ); + indent_puts( "const struct yy_trans_info *yy_trans_info;\n" ); + indent_puts( "YY_CHAR yy_c;\n" ); + indent_put2s( "for ( yy_c = %s;", char_map ); + indent_puts( + " (yy_trans_info = &yy_current_state[yy_c])->yy_verify == yy_c;" ); + indent_put2s( " yy_c = %s )", char_map_2 ); - indent_up(); + indent_up(); - if ( num_backtracking > 0 ) - indent_puts( "{" ); + if ( num_backtracking > 0 ) + indent_puts( "{" ); - indent_puts( "yy_current_state += yy_trans_info->yy_nxt;" ); + indent_puts( "yy_current_state += yy_trans_info->yy_nxt;" ); - if ( num_backtracking > 0 ) - { - putchar( '\n' ); - gen_backtracking(); - indent_puts( "}" ); - } + if ( num_backtracking > 0 ) + { + putchar( '\n' ); + gen_backtracking(); + indent_puts( "}" ); + } - indent_down(); - indent_puts( "}" ); - } + indent_down(); + indent_puts( "}" ); + } else - { /* compressed */ - indent_puts( "do" ); + { /* compressed */ + indent_puts( "do" ); - indent_up(); - indent_puts( "{" ); + indent_up(); + indent_puts( "{" ); - gen_next_state( false ); + gen_next_state( false ); - indent_puts( "++yy_cp;" ); + indent_puts( "++yy_cp;" ); - indent_puts( "}" ); - indent_down(); + indent_puts( "}" ); + indent_down(); - do_indent(); + do_indent(); - if ( interactive ) - printf( "while ( yy_base[yy_current_state] != %d );\n", jambase ); - else - printf( "while ( yy_current_state != %d );\n", jamstate ); + if ( interactive ) + printf( "while ( yy_base[yy_current_state] != %d );\n", jambase ); + else + printf( "while ( yy_current_state != %d );\n", jamstate ); - if ( ! reject && ! interactive ) - { - /* do the guaranteed-needed backtrack to figure out the match */ - indent_puts( "yy_cp = yy_last_accepting_cpos;" ); - indent_puts( "yy_current_state = yy_last_accepting_state;" ); - } - } + if ( ! reject && ! interactive ) + { + /* do the guaranteed-needed backtrack to figure out the match */ + indent_puts( "yy_cp = yy_last_accepting_cpos;" ); + indent_puts( "yy_current_state = yy_last_accepting_state;" ); + } + } } @@ -565,53 +565,53 @@ void gen_next_state(int worry_about_NULs) char char_map[256]; if ( worry_about_NULs && ! nultrans ) - { - if ( useecs ) - (void) sprintf( char_map, "(*yy_cp ? yy_ec[(int)*yy_cp] : %d)", NUL_ec ); - else - (void) sprintf( char_map, "(*yy_cp ? *yy_cp : %d)", NUL_ec ); - } + { + if ( useecs ) + (void) sprintf( char_map, "(*yy_cp ? yy_ec[(int)*yy_cp] : %d)", NUL_ec ); + else + (void) sprintf( char_map, "(*yy_cp ? *yy_cp : %d)", NUL_ec ); + } else - (void) strcpy( char_map, useecs ? "yy_ec[(int)*yy_cp]" : "*yy_cp" ); + (void) strcpy( char_map, useecs ? "yy_ec[(int)*yy_cp]" : "*yy_cp" ); if ( worry_about_NULs && nultrans ) - { - if ( ! fulltbl && ! fullspd ) - /* compressed tables backtrack *before* they match */ - gen_backtracking(); + { + if ( ! fulltbl && ! fullspd ) + /* compressed tables backtrack *before* they match */ + gen_backtracking(); + + indent_puts( "if ( *yy_cp )" ); + indent_up(); + indent_puts( "{" ); + } - indent_puts( "if ( *yy_cp )" ); - indent_up(); - indent_puts( "{" ); - } - if ( fulltbl ) - indent_put2s( "yy_current_state = yy_nxt[yy_current_state][%s];", - char_map ); - + indent_put2s( "yy_current_state = yy_nxt[yy_current_state][%s];", + char_map ); + else if ( fullspd ) - indent_put2s( "yy_current_state += yy_current_state[%s].yy_nxt;", - char_map ); + indent_put2s( "yy_current_state += yy_current_state[%s].yy_nxt;", + char_map ); else - gen_next_compressed_state( char_map ); + gen_next_compressed_state( char_map ); if ( worry_about_NULs && nultrans ) - { - indent_puts( "}" ); - indent_down(); - indent_puts( "else" ); - indent_up(); - indent_puts( "yy_current_state = yy_NUL_trans[yy_current_state];" ); - indent_down(); - } - + { + indent_puts( "}" ); + indent_down(); + indent_puts( "else" ); + indent_up(); + indent_puts( "yy_current_state = yy_NUL_trans[yy_current_state];" ); + indent_down(); + } + if ( fullspd || fulltbl ) - gen_backtracking(); + gen_backtracking(); if ( reject ) - indent_puts( "*yy_state_ptr++ = yy_current_state;" ); + indent_puts( "*yy_state_ptr++ = yy_current_state;" ); } @@ -622,71 +622,71 @@ void gen_NUL_trans(void) int need_backtracking = (num_backtracking > 0 && ! reject); if ( need_backtracking ) - /* we'll need yy_cp lying around for the gen_backtracking() */ - indent_puts( "YY_CHAR *yy_cp = yy_c_buf_p;" ); + /* we'll need yy_cp lying around for the gen_backtracking() */ + indent_puts( "YY_CHAR *yy_cp = yy_c_buf_p;" ); putchar( '\n' ); if ( nultrans ) - { - indent_puts( "yy_current_state = yy_NUL_trans[yy_current_state];" ); - indent_puts( "yy_is_jam = (yy_current_state == 0);" ); - } + { + indent_puts( "yy_current_state = yy_NUL_trans[yy_current_state];" ); + indent_puts( "yy_is_jam = (yy_current_state == 0);" ); + } else if ( fulltbl ) - { - do_indent(); - printf( "yy_current_state = yy_nxt[yy_current_state][%d];\n", - NUL_ec ); - indent_puts( "yy_is_jam = (yy_current_state <= 0);" ); - } + { + do_indent(); + printf( "yy_current_state = yy_nxt[yy_current_state][%d];\n", + NUL_ec ); + indent_puts( "yy_is_jam = (yy_current_state <= 0);" ); + } else if ( fullspd ) - { - do_indent(); - printf( "int yy_c = %d;\n", NUL_ec ); + { + do_indent(); + printf( "int yy_c = %d;\n", NUL_ec ); - indent_puts( - "const struct yy_trans_info *yy_trans_info;\n" ); - indent_puts( "yy_trans_info = &yy_current_state[yy_c];" ); - indent_puts( "yy_current_state += yy_trans_info->yy_nxt;" ); + indent_puts( + "const struct yy_trans_info *yy_trans_info;\n" ); + indent_puts( "yy_trans_info = &yy_current_state[yy_c];" ); + indent_puts( "yy_current_state += yy_trans_info->yy_nxt;" ); - indent_puts( "yy_is_jam = (yy_trans_info->yy_verify != yy_c);" ); - } + indent_puts( "yy_is_jam = (yy_trans_info->yy_verify != yy_c);" ); + } else - { - char NUL_ec_str[20]; + { + char NUL_ec_str[20]; - (void) sprintf( NUL_ec_str, "%d", NUL_ec ); - gen_next_compressed_state( NUL_ec_str ); + (void) sprintf( NUL_ec_str, "%d", NUL_ec ); + gen_next_compressed_state( NUL_ec_str ); - if ( reject ) - indent_puts( "*yy_state_ptr++ = yy_current_state;" ); + if ( reject ) + indent_puts( "*yy_state_ptr++ = yy_current_state;" ); - do_indent(); + do_indent(); - if ( interactive ) - printf( "yy_is_jam = (yy_base[yy_current_state] == %d);\n", - jambase ); - else - printf( "yy_is_jam = (yy_current_state == %d);\n", jamstate ); - } + if ( interactive ) + printf( "yy_is_jam = (yy_base[yy_current_state] == %d);\n", + jambase ); + else + printf( "yy_is_jam = (yy_current_state == %d);\n", jamstate ); + } /* if we've entered an accepting state, backtrack; note that * compressed tables have *already* done such backtracking, so * we needn't bother with it again */ if ( need_backtracking && (fullspd || fulltbl) ) - { - putchar( '\n' ); - indent_puts( "if ( ! yy_is_jam )" ); - indent_up(); - indent_puts( "{" ); - gen_backtracking(); - indent_puts( "}" ); - indent_down(); - } + { + putchar( '\n' ); + indent_puts( "if ( ! yy_is_jam )" ); + indent_up(); + indent_puts( "{" ); + gen_backtracking(); + indent_puts( "}" ); + indent_down(); + } } @@ -695,28 +695,28 @@ void gen_NUL_trans(void) void gen_start_state(void) { if ( fullspd ) - indent_put2s( "yy_current_state = yy_start_state_list[yy_start%s];", - bol_needed ? " + (yy_bp[-1] == '\\n' ? 1 : 0)" : "" ); + indent_put2s( "yy_current_state = yy_start_state_list[yy_start%s];", + bol_needed ? " + (yy_bp[-1] == '\\n' ? 1 : 0)" : "" ); else - { - indent_puts( "yy_current_state = yy_start;" ); + { + indent_puts( "yy_current_state = yy_start;" ); - if ( bol_needed ) - { - indent_puts( "if ( yy_bp[-1] == '\\n' )" ); - indent_up(); - indent_puts( "++yy_current_state;" ); - indent_down(); - } + if ( bol_needed ) + { + indent_puts( "if ( yy_bp[-1] == '\\n' )" ); + indent_up(); + indent_puts( "++yy_current_state;" ); + indent_down(); + } - if ( reject ) - { - /* set up for storing up states */ - indent_puts( "yy_state_ptr = yy_state_buf;" ); - indent_puts( "*yy_state_ptr++ = yy_current_state;" ); - } - } + if ( reject ) + { + /* set up for storing up states */ + indent_puts( "yy_state_ptr = yy_state_buf;" ); + indent_puts( "*yy_state_ptr++ = yy_current_state;" ); + } + } } @@ -735,7 +735,7 @@ void gentabs(void) * a null entry for the zero element of all C arrays */ static char C_char_decl[] = - "static const YY_CHAR %s[%d] =\n { 0,\n"; + "static const YY_CHAR %s[%d] =\n { 0,\n"; acc_array = allocate_integer_array( current_max_dfas ); nummt = 0; @@ -748,85 +748,85 @@ void gentabs(void) ++num_backtracking; if ( reject ) - { - /* write out accepting list and pointer list - * - * first we generate the "yy_acclist" array. In the process, we compute - * the indices that will go into the "yy_accept" array, and save the - * indices in the dfaacc array - */ - int EOB_accepting_list[2]; + { + /* write out accepting list and pointer list + * + * first we generate the "yy_acclist" array. In the process, we compute + * the indices that will go into the "yy_accept" array, and save the + * indices in the dfaacc array + */ + int EOB_accepting_list[2]; - /* set up accepting structures for the End Of Buffer state */ - EOB_accepting_list[0] = 0; - EOB_accepting_list[1] = end_of_buffer_action; - accsiz[end_of_buffer_state] = 1; - dfaacc[end_of_buffer_state].dfaacc_set = EOB_accepting_list; + /* set up accepting structures for the End Of Buffer state */ + EOB_accepting_list[0] = 0; + EOB_accepting_list[1] = end_of_buffer_action; + accsiz[end_of_buffer_state] = 1; + dfaacc[end_of_buffer_state].dfaacc_set = EOB_accepting_list; - printf( C_short_decl, "yy_acclist", max( numas, 1 ) + 1 ); + printf( C_short_decl, "yy_acclist", max( numas, 1 ) + 1 ); - j = 1; /* index into "yy_acclist" array */ + j = 1; /* index into "yy_acclist" array */ - for ( i = 1; i <= lastdfa; ++i ) - { - acc_array[i] = j; + for ( i = 1; i <= lastdfa; ++i ) + { + acc_array[i] = j; - if ( accsiz[i] != 0 ) - { - accset = dfaacc[i].dfaacc_set; - nacc = accsiz[i]; + if ( accsiz[i] != 0 ) + { + accset = dfaacc[i].dfaacc_set; + nacc = accsiz[i]; - if ( trace ) - fprintf( stderr, "state # %d accepts: ", i ); + if ( trace ) + fprintf( stderr, "state # %d accepts: ", i ); - for ( k = 1; k <= nacc; ++k ) - { - int accnum = accset[k]; + for ( k = 1; k <= nacc; ++k ) + { + int accnum = accset[k]; - ++j; + ++j; - if ( variable_trailing_context_rules && - ! (accnum & YY_TRAILING_HEAD_MASK) && - accnum > 0 && accnum <= num_rules && - rule_type[accnum] == RULE_VARIABLE ) - { - /* special hack to flag accepting number as part - * of trailing context rule - */ - accnum |= YY_TRAILING_MASK; - } + if ( variable_trailing_context_rules && + ! (accnum & YY_TRAILING_HEAD_MASK) && + accnum > 0 && accnum <= num_rules && + rule_type[accnum] == RULE_VARIABLE ) + { + /* special hack to flag accepting number as part + * of trailing context rule + */ + accnum |= YY_TRAILING_MASK; + } - mkdata( accnum ); + mkdata( accnum ); - if ( trace ) - { - fprintf( stderr, "[%d]", accset[k] ); + if ( trace ) + { + fprintf( stderr, "[%d]", accset[k] ); - if ( k < nacc ) - fputs( ", ", stderr ); - else - putc( '\n', stderr ); - } - } - } - } + if ( k < nacc ) + fputs( ", ", stderr ); + else + putc( '\n', stderr ); + } + } + } + } - /* add accepting number for the "jam" state */ - acc_array[i] = j; + /* add accepting number for the "jam" state */ + acc_array[i] = j; - dataend(); - } + dataend(); + } else - { - dfaacc[end_of_buffer_state].dfaacc_state = end_of_buffer_action; + { + dfaacc[end_of_buffer_state].dfaacc_state = end_of_buffer_action; - for ( i = 1; i <= lastdfa; ++i ) - acc_array[i] = dfaacc[i].dfaacc_state; + for ( i = 1; i <= lastdfa; ++i ) + acc_array[i] = dfaacc[i].dfaacc_state; - /* add accepting number for jam state */ - acc_array[i] = 0; - } + /* add accepting number for jam state */ + acc_array[i] = 0; + } /* spit out "yy_accept" array. If we're doing "reject", it'll be pointers * into the "yy_acclist" array. Otherwise it's actual accepting numbers. @@ -839,122 +839,122 @@ void gentabs(void) k = lastdfa + 2; if ( reject ) - /* we put a "cap" on the table associating lists of accepting - * numbers with state numbers. This is needed because we tell - * where the end of an accepting list is by looking at where - * the list for the next state starts. - */ - ++k; + /* we put a "cap" on the table associating lists of accepting + * numbers with state numbers. This is needed because we tell + * where the end of an accepting list is by looking at where + * the list for the next state starts. + */ + ++k; printf( C_short_decl, "yy_accept", k ); for ( i = 1; i <= lastdfa; ++i ) - { - mkdata( acc_array[i] ); + { + mkdata( acc_array[i] ); - if ( ! reject && trace && acc_array[i] ) - fprintf( stderr, "state # %d accepts: [%d]\n", i, acc_array[i] ); - } + if ( ! reject && trace && acc_array[i] ) + fprintf( stderr, "state # %d accepts: [%d]\n", i, acc_array[i] ); + } /* add entry for "jam" state */ mkdata( acc_array[i] ); if ( reject ) - /* add "cap" for the list */ - mkdata( acc_array[i] ); + /* add "cap" for the list */ + mkdata( acc_array[i] ); dataend(); if ( useecs ) - genecs(); + genecs(); if ( usemecs ) - { - /* write out meta-equivalence classes (used to index templates with) */ + { + /* write out meta-equivalence classes (used to index templates with) */ - if ( trace ) - fputs( "\n\nMeta-Equivalence Classes:\n", stderr ); + if ( trace ) + fputs( "\n\nMeta-Equivalence Classes:\n", stderr ); - printf( C_char_decl, "yy_meta", numecs + 1 ); + printf( C_char_decl, "yy_meta", numecs + 1 ); - for ( i = 1; i <= numecs; ++i ) - { - if ( trace ) - fprintf( stderr, "%d = %d\n", i, abs( tecbck[i] ) ); + for ( i = 1; i <= numecs; ++i ) + { + if ( trace ) + fprintf( stderr, "%d = %d\n", i, abs( tecbck[i] ) ); - mkdata( abs( tecbck[i] ) ); - } + mkdata( abs( tecbck[i] ) ); + } - dataend(); - } + dataend(); + } total_states = lastdfa + numtemps; printf( tblend > MAX_SHORT ? C_long_decl : C_short_decl, - "yy_base", total_states + 1 ); + "yy_base", total_states + 1 ); for ( i = 1; i <= lastdfa; ++i ) - { - int d = def[i]; + { + int d = def[i]; - if ( base[i] == JAMSTATE ) - base[i] = jambase; + if ( base[i] == JAMSTATE ) + base[i] = jambase; - if ( d == JAMSTATE ) - def[i] = jamstate; + if ( d == JAMSTATE ) + def[i] = jamstate; - else if ( d < 0 ) - { - /* template reference */ - ++tmpuses; - def[i] = lastdfa - d + 1; - } + else if ( d < 0 ) + { + /* template reference */ + ++tmpuses; + def[i] = lastdfa - d + 1; + } - mkdata( base[i] ); - } + mkdata( base[i] ); + } /* generate jam state's base index */ mkdata( base[i] ); for ( ++i /* skip jam state */; i <= total_states; ++i ) - { - mkdata( base[i] ); - def[i] = jamstate; - } + { + mkdata( base[i] ); + def[i] = jamstate; + } dataend(); printf( tblend > MAX_SHORT ? C_long_decl : C_short_decl, - "yy_def", total_states + 1 ); + "yy_def", total_states + 1 ); for ( i = 1; i <= total_states; ++i ) - mkdata( def[i] ); + mkdata( def[i] ); dataend(); printf( lastdfa > MAX_SHORT ? C_long_decl : C_short_decl, - "yy_nxt", tblend + 1 ); + "yy_nxt", tblend + 1 ); for ( i = 1; i <= tblend; ++i ) - { - if ( nxt[i] == 0 || chk[i] == 0 ) - nxt[i] = jamstate; /* new state is the JAM state */ + { + if ( nxt[i] == 0 || chk[i] == 0 ) + nxt[i] = jamstate; /* new state is the JAM state */ - mkdata( nxt[i] ); - } + mkdata( nxt[i] ); + } dataend(); printf( lastdfa > MAX_SHORT ? C_long_decl : C_short_decl, - "yy_chk", tblend + 1 ); + "yy_chk", tblend + 1 ); for ( i = 1; i <= tblend; ++i ) - { - if ( chk[i] == 0 ) - ++nummt; + { + if ( chk[i] == 0 ) + ++nummt; - mkdata( chk[i] ); - } + mkdata( chk[i] ); + } dataend(); } @@ -1002,170 +1002,170 @@ void make_tables(void) set_indent( 2 ); if ( yymore_used ) - { - indent_puts( "yytext -= yy_more_len; \\" ); - indent_puts( "yyleng = yy_cp - yytext; \\" ); - } + { + indent_puts( "yytext -= yy_more_len; \\" ); + indent_puts( "yyleng = yy_cp - yytext; \\" ); + } else - indent_puts( "yyleng = yy_cp - yy_bp; \\" ); + indent_puts( "yyleng = yy_cp - yy_bp; \\" ); set_indent( 0 ); - + skelout(); printf( "#define YY_END_OF_BUFFER %d\n", num_rules + 1 ); if ( fullspd ) - { /* need to define the transet type as a size large - * enough to hold the biggest offset - */ - int total_table_size = tblend + numecs + 1; - char *trans_offset_type = - total_table_size > MAX_SHORT ? "long" : "short"; + { /* need to define the transet type as a size large + * enough to hold the biggest offset + */ + int total_table_size = tblend + numecs + 1; + char *trans_offset_type = + total_table_size > MAX_SHORT ? "long" : "short"; - set_indent( 0 ); - indent_puts( "struct yy_trans_info" ); - indent_up(); + set_indent( 0 ); + indent_puts( "struct yy_trans_info" ); + indent_up(); indent_puts( "{" ); indent_puts( "short yy_verify;" ); /* in cases where its sister yy_verify *is* a "yes, there is a - * transition", yy_nxt is the offset (in records) to the next state. - * In most cases where there is no transition, the value of yy_nxt - * is irrelevant. If yy_nxt is the -1th record of a state, though, - * then yy_nxt is the action number for that state + * transition", yy_nxt is the offset (in records) to the next state. + * In most cases where there is no transition, the value of yy_nxt + * is irrelevant. If yy_nxt is the -1th record of a state, though, + * then yy_nxt is the action number for that state */ indent_put2s( "%s yy_nxt;", trans_offset_type ); indent_puts( "};" ); - indent_down(); + indent_down(); + + indent_puts( "typedef const struct yy_trans_info *yy_state_type;" ); + } - indent_puts( "typedef const struct yy_trans_info *yy_state_type;" ); - } - else - indent_puts( "typedef int yy_state_type;" ); + indent_puts( "typedef int yy_state_type;" ); if ( fullspd ) - genctbl(); + genctbl(); else if ( fulltbl ) - genftbl(); + genftbl(); else - gentabs(); + gentabs(); if ( num_backtracking > 0 ) - { - indent_puts( "static yy_state_type yy_last_accepting_state;" ); - indent_puts( "static YY_CHAR *yy_last_accepting_cpos;\n" ); - } + { + indent_puts( "static yy_state_type yy_last_accepting_state;" ); + indent_puts( "static YY_CHAR *yy_last_accepting_cpos;\n" ); + } if ( nultrans ) - { - printf( C_state_decl, "yy_NUL_trans", lastdfa + 1 ); + { + printf( C_state_decl, "yy_NUL_trans", lastdfa + 1 ); - for ( i = 1; i <= lastdfa; ++i ) - { - if ( fullspd ) - { - if ( nultrans ) - printf( " &yy_transition[%d],\n", base[i] ); - else - printf( " 0,\n" ); - } - - else - mkdata( nultrans[i] ); - } + for ( i = 1; i <= lastdfa; ++i ) + { + if ( fullspd ) + { + if ( nultrans ) + printf( " &yy_transition[%d],\n", base[i] ); + else + printf( " 0,\n" ); + } - dataend(); - } + else + mkdata( nultrans[i] ); + } + + dataend(); + } if ( ddebug ) - { /* spit out table mapping rules to line numbers */ - indent_puts( "extern int yy_flex_debug;" ); - indent_puts( "int yy_flex_debug = 1;\n" ); + { /* spit out table mapping rules to line numbers */ + indent_puts( "extern int yy_flex_debug;" ); + indent_puts( "int yy_flex_debug = 1;\n" ); - printf( C_short_decl, "yy_rule_linenum", num_rules ); - for ( i = 1; i < num_rules; ++i ) - mkdata( rule_linenum[i] ); - dataend(); - } + printf( C_short_decl, "yy_rule_linenum", num_rules ); + for ( i = 1; i < num_rules; ++i ) + mkdata( rule_linenum[i] ); + dataend(); + } if ( reject ) - { - /* declare state buffer variables */ - puts( - "static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr;" ); - puts( "static YY_CHAR *yy_full_match;" ); - puts( "static int yy_lp;" ); + { + /* declare state buffer variables */ + puts( + "static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr;" ); + puts( "static YY_CHAR *yy_full_match;" ); + puts( "static int yy_lp;" ); - if ( variable_trailing_context_rules ) - { - puts( "static int yy_looking_for_trail_begin = 0;" ); - puts( "static int yy_full_lp;" ); - puts( "static int *yy_full_state;" ); - printf( "#define YY_TRAILING_MASK 0x%x\n", YY_TRAILING_MASK ); - printf( "#define YY_TRAILING_HEAD_MASK 0x%x\n", - YY_TRAILING_HEAD_MASK ); - } + if ( variable_trailing_context_rules ) + { + puts( "static int yy_looking_for_trail_begin = 0;" ); + puts( "static int yy_full_lp;" ); + puts( "static int *yy_full_state;" ); + printf( "#define YY_TRAILING_MASK 0x%x\n", YY_TRAILING_MASK ); + printf( "#define YY_TRAILING_HEAD_MASK 0x%x\n", + YY_TRAILING_HEAD_MASK ); + } - puts( "#define REJECT \\" ); + puts( "#define REJECT \\" ); puts( "{ \\" ); puts( - "*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \\" ); + "*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \\" ); puts( - "yy_cp = yy_full_match; /* restore poss. backed-over text */ \\" ); + "yy_cp = yy_full_match; /* restore poss. backed-over text */ \\" ); - if ( variable_trailing_context_rules ) - { - puts( "yy_lp = yy_full_lp; /* restore orig. accepting pos. */ \\" ); - puts( - "yy_state_ptr = yy_full_state; /* restore orig. state */ \\" ); - puts( - "yy_current_state = *yy_state_ptr; /* restore curr. state */ \\" ); - } + if ( variable_trailing_context_rules ) + { + puts( "yy_lp = yy_full_lp; /* restore orig. accepting pos. */ \\" ); + puts( + "yy_state_ptr = yy_full_state; /* restore orig. state */ \\" ); + puts( + "yy_current_state = *yy_state_ptr; /* restore curr. state */ \\" ); + } puts( "++yy_lp; \\" ); puts( "goto find_rule; \\" ); puts( "}" ); - } - - else - { - puts( "/* the intent behind this definition is that it'll catch" ); - puts( " * any uses of REJECT which flex missed" ); - puts( " */" ); - puts( "#define REJECT reject_used_but_not_detected" ); - } - - if ( yymore_used ) - { - indent_puts( "static int yy_more_flag = 0;" ); - indent_puts( "static int yy_doing_yy_more = 0;" ); - indent_puts( "static int yy_more_len = 0;" ); - indent_puts( - "#define yymore() { yy_more_flag = 1; }" ); - indent_puts( - "#define YY_MORE_ADJ (yy_doing_yy_more ? yy_more_len : 0)" ); - } + } else - { - indent_puts( "#define yymore() yymore_used_but_not_detected" ); - indent_puts( "#define YY_MORE_ADJ 0" ); - } + { + puts( "/* the intent behind this definition is that it'll catch" ); + puts( " * any uses of REJECT which flex missed" ); + puts( " */" ); + puts( "#define REJECT reject_used_but_not_detected" ); + } + + if ( yymore_used ) + { + indent_puts( "static int yy_more_flag = 0;" ); + indent_puts( "static int yy_doing_yy_more = 0;" ); + indent_puts( "static int yy_more_len = 0;" ); + indent_puts( + "#define yymore() { yy_more_flag = 1; }" ); + indent_puts( + "#define YY_MORE_ADJ (yy_doing_yy_more ? yy_more_len : 0)" ); + } + + else + { + indent_puts( "#define yymore() yymore_used_but_not_detected" ); + indent_puts( "#define YY_MORE_ADJ 0" ); + } skelout(); if ( ferror( temp_action_file ) ) - flexfatal( "error occurred when writing temporary action file" ); + flexfatal( "error occurred when writing temporary action file" ); else if ( fseek( temp_action_file, 0L, SEEK_SET) != 0 ) - flexfatal( "error occurred when rewinding temporary action file" ); + flexfatal( "error occurred when rewinding temporary action file" ); /* copy prolog from action_file to output file */ action_out(); @@ -1175,17 +1175,17 @@ void make_tables(void) set_indent( 2 ); if ( yymore_used ) - { - indent_puts( "yy_more_len = 0;" ); - indent_puts( "yy_doing_yy_more = yy_more_flag;" ); - indent_puts( "if ( yy_doing_yy_more )" ); - indent_up(); - indent_puts( "{" ); - indent_puts( "yy_more_len = yyleng;" ); - indent_puts( "yy_more_flag = 0;" ); - indent_puts( "}" ); - indent_down(); - } + { + indent_puts( "yy_more_len = 0;" ); + indent_puts( "yy_doing_yy_more = yy_more_flag;" ); + indent_puts( "if ( yy_doing_yy_more )" ); + indent_up(); + indent_puts( "{" ); + indent_puts( "yy_more_len = yyleng;" ); + indent_puts( "yy_more_flag = 0;" ); + indent_puts( "}" ); + indent_down(); + } skelout(); @@ -1201,47 +1201,47 @@ void make_tables(void) skelout(); if ( ddebug ) - { - indent_puts( "if ( yy_flex_debug )" ); - indent_up(); + { + indent_puts( "if ( yy_flex_debug )" ); + indent_up(); - indent_puts( "{" ); - indent_puts( "if ( yy_act == 0 )" ); - indent_up(); - indent_puts( "fprintf( stderr, \"--scanner backtracking\\n\" );" ); - indent_down(); + indent_puts( "{" ); + indent_puts( "if ( yy_act == 0 )" ); + indent_up(); + indent_puts( "fprintf( stderr, \"--scanner backtracking\\n\" );" ); + indent_down(); - do_indent(); - printf( "else if ( yy_act < %d )\n", num_rules ); - indent_up(); - indent_puts( - "fprintf( stderr, \"--accepting rule at line %d (\\\"%s\\\")\\n\"," ); - indent_puts( " yy_rule_linenum[yy_act], yytext );" ); - indent_down(); + do_indent(); + printf( "else if ( yy_act < %d )\n", num_rules ); + indent_up(); + indent_puts( + "fprintf( stderr, \"--accepting rule at line %d (\\\"%s\\\")\\n\"," ); + indent_puts( " yy_rule_linenum[yy_act], yytext );" ); + indent_down(); - do_indent(); - printf( "else if ( yy_act == %d )\n", num_rules ); - indent_up(); - indent_puts( - "fprintf( stderr, \"--accepting default rule (\\\"%s\\\")\\n\"," ); - indent_puts( " yytext );" ); - indent_down(); + do_indent(); + printf( "else if ( yy_act == %d )\n", num_rules ); + indent_up(); + indent_puts( + "fprintf( stderr, \"--accepting default rule (\\\"%s\\\")\\n\"," ); + indent_puts( " yytext );" ); + indent_down(); - do_indent(); - printf( "else if ( yy_act == %d )\n", num_rules + 1 ); - indent_up(); - indent_puts( "fprintf( stderr, \"--(end of buffer or a NUL)\\n\" );" ); - indent_down(); + do_indent(); + printf( "else if ( yy_act == %d )\n", num_rules + 1 ); + indent_up(); + indent_puts( "fprintf( stderr, \"--(end of buffer or a NUL)\\n\" );" ); + indent_down(); - do_indent(); - printf( "else\n" ); - indent_up(); - indent_puts( "fprintf( stderr, \"--EOF\\n\" );" ); - indent_down(); + do_indent(); + printf( "else\n" ); + indent_up(); + indent_puts( "fprintf( stderr, \"--EOF\\n\" );" ); + indent_down(); - indent_puts( "}" ); - indent_down(); - } + indent_puts( "}" ); + indent_down(); + } /* copy actions from action_file to output file */ skelout(); @@ -1251,19 +1251,19 @@ void make_tables(void) /* generate cases for any missing EOF rules */ for ( i = 1; i <= lastsc; ++i ) - if ( ! sceof[i] ) - { - do_indent(); - printf( "case YY_STATE_EOF(%s):\n", scname[i] ); - did_eof_rule = true; - } - + if ( ! sceof[i] ) + { + do_indent(); + printf( "case YY_STATE_EOF(%s):\n", scname[i] ); + did_eof_rule = true; + } + if ( did_eof_rule ) - { - indent_up(); - indent_puts( "yyterminate();" ); - indent_down(); - } + { + indent_up(); + indent_puts( "yyterminate();" ); + indent_down(); + } /* generate code for handling NUL's, if needed */ @@ -1275,17 +1275,17 @@ void make_tables(void) set_indent( 7 ); if ( fullspd || fulltbl ) - indent_puts( "yy_cp = yy_c_buf_p;" ); - + indent_puts( "yy_cp = yy_c_buf_p;" ); + else - { /* compressed table */ - if ( ! reject && ! interactive ) - { - /* do the guaranteed-needed backtrack to figure out the match */ - indent_puts( "yy_cp = yy_last_accepting_cpos;" ); - indent_puts( "yy_current_state = yy_last_accepting_state;" ); - } - } + { /* compressed table */ + if ( ! reject && ! interactive ) + { + /* do the guaranteed-needed backtrack to figure out the match */ + indent_puts( "yy_cp = yy_last_accepting_cpos;" ); + indent_puts( "yy_current_state = yy_last_accepting_state;" ); + } + } /* generate code for yy_get_previous_state() */ @@ -1293,7 +1293,7 @@ void make_tables(void) skelout(); if ( bol_needed ) - indent_puts( "YY_CHAR *yy_bp = yytext;\n" ); + indent_puts( "YY_CHAR *yy_bp = yytext;\n" ); gen_start_state(); diff --git a/modules/libcom/src/flex/libmain.c b/modules/libcom/src/flex/libmain.c index 878aa21dc..c543117ad 100644 --- a/modules/libcom/src/flex/libmain.c +++ b/modules/libcom/src/flex/libmain.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* libmain - flex run-time support library "main" function */ diff --git a/modules/libcom/src/flex/misc.c b/modules/libcom/src/flex/misc.c index b8a7a0399..ffcc6de9a 100644 --- a/modules/libcom/src/flex/misc.c +++ b/modules/libcom/src/flex/misc.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* misc - miscellaneous flex routines */ @@ -14,7 +14,7 @@ * * This code is derived from software contributed to Berkeley by * Vern Paxson. - * + * * The United States Government has rights in this work pursuant * to contract no. DE-AC03-76SF00098 between the United States * Department of Energy and the University of California. @@ -64,10 +64,10 @@ void action_out(void) char buf[MAXLINE]; while ( fgets( buf, MAXLINE, temp_action_file ) != NULL ) - if ( buf[0] == '%' && buf[1] == '%' ) - break; - else - fputs( buf, stdout ); + if ( buf[0] == '%' && buf[1] == '%' ) + break; + else + fputs( buf, stdout ); } @@ -87,7 +87,7 @@ void *allocate_array(int size, int element_size) mem = (void *) malloc( (unsigned) (element_size * size) ); if ( mem == NULL ) - flexfatal( "memory allocation failed in allocate_array()" ); + flexfatal( "memory allocation failed in allocate_array()" ); return ( mem ); } @@ -104,11 +104,11 @@ void *allocate_array(int size, int element_size) int all_lower(Char *str) { while ( *str ) - { - if ( ! isascii( (int) *str ) || ! islower( (int) *str ) ) - return ( 0 ); - ++str; - } + { + if ( ! isascii( (int) *str ) || ! islower( (int) *str ) ) + return ( 0 ); + ++str; + } return ( 1 ); } @@ -125,11 +125,11 @@ int all_lower(Char *str) int all_upper(Char *str) { while ( *str ) - { - if ( ! isascii( (int) *str ) || ! isupper( (int) *str ) ) - return ( 0 ); - ++str; - } + { + if ( ! isascii( (int) *str ) || ! isupper( (int) *str ) ) + return ( 0 ); + ++str; + } return ( 1 ); } @@ -154,13 +154,13 @@ void bubble(int v[], int n) int i, j, k; for ( i = n; i > 1; --i ) - for ( j = 1; j < i; ++j ) - if ( v[j] > v[j + 1] ) /* compare */ - { - k = v[j]; /* exchange */ - v[j] = v[j + 1]; - v[j + 1] = k; - } + for ( j = 1; j < i; ++j ) + if ( v[j] > v[j + 1] ) /* compare */ + { + k = v[j]; /* exchange */ + v[j] = v[j + 1]; + v[j + 1] = k; + } } @@ -192,15 +192,15 @@ char *copy_string(char *str) /* find length */ for ( c = str; *c; ++c ) - ; + ; copy = malloc( (unsigned) ((c - str + 1) * sizeof( char )) ); if ( copy == NULL ) - flexfatal( "dynamic memory failure in copy_string()" ); + flexfatal( "dynamic memory failure in copy_string()" ); for ( c = copy; (*c++ = *str++); ) - ; + ; return ( copy ); } @@ -221,15 +221,15 @@ Char *copy_unsigned_string(Char *str) /* find length */ for ( c = str; *c; ++c ) - ; + ; copy = (Char *) malloc( (unsigned) ((c - str + 1) * sizeof( Char )) ); if ( copy == NULL ) - flexfatal( "dynamic memory failure in copy_unsigned_string()" ); + flexfatal( "dynamic memory failure in copy_unsigned_string()" ); for ( c = copy; (*c++ = *str++); ) - ; + ; return ( copy ); } @@ -259,27 +259,27 @@ void cshell(Char *v, int n, int special_case_0) Char k; for ( gap = n / 2; gap > 0; gap = gap / 2 ) - for ( i = gap; i < n; ++i ) - for ( j = i - gap; j >= 0; j = j - gap ) - { - jg = j + gap; + for ( i = gap; i < n; ++i ) + for ( j = i - gap; j >= 0; j = j - gap ) + { + jg = j + gap; - if ( special_case_0 ) - { - if ( v[jg] == 0 ) - break; + if ( special_case_0 ) + { + if ( v[jg] == 0 ) + break; - else if ( v[j] != 0 && v[j] <= v[jg] ) - break; - } + else if ( v[j] != 0 && v[j] <= v[jg] ) + break; + } - else if ( v[j] <= v[jg] ) - break; + else if ( v[j] <= v[jg] ) + break; - k = v[j]; - v[j] = v[jg]; - v[jg] = k; - } + k = v[j]; + v[j] = v[jg]; + v[jg] = k; + } } @@ -292,7 +292,7 @@ void cshell(Char *v, int n, int special_case_0) void dataend(void) { if ( datapos > 0 ) - dataflush(); + dataflush(); /* add terminator for initialization */ puts( " } ;\n" ); @@ -314,13 +314,13 @@ void dataflush(void) putchar( '\n' ); if ( ++dataline >= NUMDATALINES ) - { - /* put out a blank line so that the table is grouped into - * large blocks that enable the user to find elements easily - */ - putchar( '\n' ); - dataline = 0; - } + { + /* put out a blank line so that the table is grouped into + * large blocks that enable the user to find elements easily + */ + putchar( '\n' ); + dataline = 0; + } /* reset the number of characters written on the current line */ datapos = 0; @@ -445,7 +445,7 @@ int htoi(unsigned char *str) /* is_hex_digit - returns true if a character is a valid hex digit, false - * otherwise + * otherwise * * synopsis: * int true_or_false, is_hex_digit(); @@ -456,21 +456,21 @@ int htoi(unsigned char *str) int is_hex_digit(int ch) { if ( isdigit( ch ) ) - return ( 1 ); + return ( 1 ); switch ( clower( ch ) ) - { - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - return ( 1 ); + { + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + return ( 1 ); - default: - return ( 0 ); - } + default: + return ( 0 ); + } } @@ -494,17 +494,17 @@ void line_directive_out(FILE *output_file_name) void mk2data(int value) { if ( datapos >= NUMDATAITEMS ) - { - putchar( ',' ); - dataflush(); - } + { + putchar( ',' ); + dataflush(); + } if ( datapos == 0 ) - /* indent */ - fputs( " ", stdout ); + /* indent */ + fputs( " ", stdout ); else - putchar( ',' ); + putchar( ',' ); ++datapos; @@ -524,17 +524,17 @@ void mk2data(int value) void mkdata(int value) { if ( datapos >= NUMDATAITEMS ) - { - putchar( ',' ); - dataflush(); - } + { + putchar( ',' ); + dataflush(); + } if ( datapos == 0 ) - /* indent */ - fputs( " ", stdout ); + /* indent */ + fputs( " ", stdout ); else - putchar( ',' ); + putchar( ',' ); ++datapos; @@ -575,69 +575,69 @@ Char myesc(Char *array) int sptr; switch ( array[1] ) - { - case 'a': return ( '\a' ); - case 'b': return ( '\b' ); - case 'f': return ( '\f' ); - case 'n': return ( '\n' ); - case 'r': return ( '\r' ); - case 't': return ( '\t' ); - case 'v': return ( '\v' ); + { + case 'a': return ( '\a' ); + case 'b': return ( '\b' ); + case 'f': return ( '\f' ); + case 'n': return ( '\n' ); + case 'r': return ( '\r' ); + case 't': return ( '\t' ); + case 'v': return ( '\v' ); - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - { /* \ */ - sptr = 1; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + { /* \ */ + sptr = 1; - while ( isascii( array[sptr] ) && isdigit( array[sptr] ) ) - /* don't increment inside loop control because if - * isdigit() is a macro it might expand into multiple - * increments ... - */ - ++sptr; + while ( isascii( array[sptr] ) && isdigit( array[sptr] ) ) + /* don't increment inside loop control because if + * isdigit() is a macro it might expand into multiple + * increments ... + */ + ++sptr; - c = array[sptr]; - array[sptr] = '\0'; + c = array[sptr]; + array[sptr] = '\0'; - esc_char = otoi( array + 1 ); + esc_char = otoi( array + 1 ); - array[sptr] = c; + array[sptr] = c; - return ( esc_char ); - } + return ( esc_char ); + } - case 'x': - { /* \x */ - int sptr = 2; + case 'x': + { /* \x */ + int sptr = 2; - while ( isascii( array[sptr] ) && is_hex_digit( array[sptr] ) ) - /* don't increment inside loop control because if - * isdigit() is a macro it might expand into multiple - * increments ... - */ - ++sptr; + while ( isascii( array[sptr] ) && is_hex_digit( array[sptr] ) ) + /* don't increment inside loop control because if + * isdigit() is a macro it might expand into multiple + * increments ... + */ + ++sptr; - c = array[sptr]; - array[sptr] = '\0'; + c = array[sptr]; + array[sptr] = '\0'; - esc_char = htoi( array + 2 ); + esc_char = htoi( array + 2 ); - array[sptr] = c; + array[sptr] = c; - return ( esc_char ); - } + return ( esc_char ); + } - default: - return ( array[1] ); - } + default: + return ( array[1] ); + } } @@ -674,31 +674,31 @@ char *readable_form(int c) static char rform[10]; if ( (c >= 0 && c < 32) || c >= 127 ) - { - switch ( c ) - { - case '\n': return ( "\\n" ); - case '\t': return ( "\\t" ); - case '\f': return ( "\\f" ); - case '\r': return ( "\\r" ); - case '\b': return ( "\\b" ); + { + switch ( c ) + { + case '\n': return ( "\\n" ); + case '\t': return ( "\\t" ); + case '\f': return ( "\\f" ); + case '\r': return ( "\\r" ); + case '\b': return ( "\\b" ); - default: - (void) sprintf( rform, "\\%.3o", c ); - return ( rform ); - } - } + default: + (void) sprintf( rform, "\\%.3o", c ); + return ( rform ); + } + } else if ( c == ' ' ) - return ( "' '" ); + return ( "' '" ); else - { - rform[0] = c; - rform[1] = '\0'; + { + rform[0] = c; + rform[1] = '\0'; - return ( rform ); - } + return ( rform ); + } } @@ -713,10 +713,10 @@ void *reallocate_array(void *array, int size, int element_size) flexfatal( "attempt to increase array size by less than 1 byte" ); new_array = - (void *) realloc( (char *)array, (unsigned) (size * element_size )); + (void *) realloc( (char *)array, (unsigned) (size * element_size )); if ( new_array == NULL ) - flexfatal( "attempt to increase array size failed" ); + flexfatal( "attempt to increase array size failed" ); return ( new_array ); } @@ -736,10 +736,10 @@ void skelout(void) char buf[MAXLINE]; while ( fgets( buf, MAXLINE, skelfile ) != NULL ) - if ( buf[0] == '%' && buf[1] == '%' ) - break; - else - fputs( buf, stdout ); + if ( buf[0] == '%' && buf[1] == '%' ) + break; + else + fputs( buf, stdout ); } @@ -760,12 +760,12 @@ void transition_struct_out(int element_v, int element_n) datapos += TRANS_STRUCT_PRINT_LENGTH; if ( datapos >= 75 ) - { - putchar( '\n' ); + { + putchar( '\n' ); - if ( ++dataline % 10 == 0 ) - putchar( '\n' ); + if ( ++dataline % 10 == 0 ) + putchar( '\n' ); - datapos = 0; - } + datapos = 0; + } } diff --git a/modules/libcom/src/flex/nfa.c b/modules/libcom/src/flex/nfa.c index b57c6d646..5e6615c82 100644 --- a/modules/libcom/src/flex/nfa.c +++ b/modules/libcom/src/flex/nfa.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* nfa - NFA construction routines */ @@ -14,7 +14,7 @@ * * This code is derived from software contributed to Berkeley by * Vern Paxson. - * + * * The United States Government has rights in this work pursuant * to contract no. DE-AC03-76SF00098 between the United States * Department of Energy and the University of California. @@ -61,14 +61,14 @@ void add_accept(int mach, int accepting_number) */ if ( transchar[finalst[mach]] == SYM_EPSILON ) - accptnum[finalst[mach]] = accepting_number; + accptnum[finalst[mach]] = accepting_number; else - { - int astate = mkstate( SYM_EPSILON ); - accptnum[astate] = accepting_number; - mach = link_machines( mach, astate ); - } + { + int astate = mkstate( SYM_EPSILON ); + accptnum[astate] = accepting_number; + mach = link_machines( mach, astate ); + } } @@ -90,7 +90,7 @@ int copysingl(int singl, int num) copy = mkstate( SYM_EPSILON ); for ( i = 1; i <= num; ++i ) - copy = link_machines( copy, dupmachine( singl ) ); + copy = link_machines( copy, dupmachine( singl ) ); return ( copy ); } @@ -108,7 +108,7 @@ void dumpnfa(int state1) int sym, tsp1, tsp2, anum, ns; fprintf( stderr, "\n\n********** beginning dump of nfa with start state %d\n", - state1 ); + state1 ); /* we probably should loop starting at firstst[state1] and going to * lastst[state1], but they're not maintained properly when we "or" @@ -118,21 +118,21 @@ void dumpnfa(int state1) /* for ( ns = firstst[state1]; ns <= lastst[state1]; ++ns ) */ for ( ns = 1; ns <= lastnfa; ++ns ) - { - fprintf( stderr, "state # %4d\t", ns ); + { + fprintf( stderr, "state # %4d\t", ns ); - sym = transchar[ns]; - tsp1 = trans1[ns]; - tsp2 = trans2[ns]; - anum = accptnum[ns]; + sym = transchar[ns]; + tsp1 = trans1[ns]; + tsp2 = trans2[ns]; + anum = accptnum[ns]; - fprintf( stderr, "%3d: %4d, %4d", sym, tsp1, tsp2 ); + fprintf( stderr, "%3d: %4d, %4d", sym, tsp1, tsp2 ); - if ( anum != NIL ) - fprintf( stderr, " [%d]", anum ); + if ( anum != NIL ) + fprintf( stderr, " [%d]", anum ); - fprintf( stderr, "\n" ); - } + fprintf( stderr, "\n" ); + } fprintf( stderr, "********** end of dump\n" ); } @@ -162,22 +162,22 @@ int dupmachine(int mach) int last = lastst[mach]; for ( i = firstst[mach]; i <= last; ++i ) - { - state = mkstate( transchar[i] ); + { + state = mkstate( transchar[i] ); - if ( trans1[i] != NO_TRANSITION ) - { - mkxtion( finalst[state], trans1[i] + state - i ); + if ( trans1[i] != NO_TRANSITION ) + { + mkxtion( finalst[state], trans1[i] + state - i ); - if ( transchar[i] == SYM_EPSILON && trans2[i] != NO_TRANSITION ) - mkxtion( finalst[state], trans2[i] + state - i ); - } + if ( transchar[i] == SYM_EPSILON && trans2[i] != NO_TRANSITION ) + mkxtion( finalst[state], trans2[i] + state - i ); + } - accptnum[state] = accptnum[i]; - } + accptnum[state] = accptnum[i]; + } if ( state == 0 ) - flexfatal( "empty machine in dupmachine()" ); + flexfatal( "empty machine in dupmachine()" ); state_offset = state - i + 1; @@ -219,46 +219,46 @@ void finish_rule(int mach, int variable_trail_rule, int headcnt, int trailcnt) * already been updated, giving us the wrong number */ if ( continued_action ) - --rule_linenum[num_rules]; + --rule_linenum[num_rules]; fprintf( temp_action_file, "case %d:\n", num_rules ); if ( variable_trail_rule ) - { - rule_type[num_rules] = RULE_VARIABLE; + { + rule_type[num_rules] = RULE_VARIABLE; - if ( performance_report ) - fprintf( stderr, "Variable trailing context rule at line %d\n", - rule_linenum[num_rules] ); + if ( performance_report ) + fprintf( stderr, "Variable trailing context rule at line %d\n", + rule_linenum[num_rules] ); - variable_trailing_context_rules = true; - } + variable_trailing_context_rules = true; + } else - { - rule_type[num_rules] = RULE_NORMAL; + { + rule_type[num_rules] = RULE_NORMAL; - if ( headcnt > 0 || trailcnt > 0 ) - { - /* do trailing context magic to not match the trailing characters */ - char *scanner_cp = "yy_c_buf_p = yy_cp"; - char *scanner_bp = "yy_bp"; + if ( headcnt > 0 || trailcnt > 0 ) + { + /* do trailing context magic to not match the trailing characters */ + char *scanner_cp = "yy_c_buf_p = yy_cp"; + char *scanner_bp = "yy_bp"; - fprintf( temp_action_file, - "*yy_cp = yy_hold_char; /* undo effects of setting up yytext */\n" ); + fprintf( temp_action_file, + "*yy_cp = yy_hold_char; /* undo effects of setting up yytext */\n" ); - if ( headcnt > 0 ) - fprintf( temp_action_file, "%s = %s + %d;\n", - scanner_cp, scanner_bp, headcnt ); + if ( headcnt > 0 ) + fprintf( temp_action_file, "%s = %s + %d;\n", + scanner_cp, scanner_bp, headcnt ); - else - fprintf( temp_action_file, - "%s -= %d;\n", scanner_cp, trailcnt ); - - fprintf( temp_action_file, - "YY_DO_BEFORE_ACTION; /* set up yytext again */\n" ); - } - } + else + fprintf( temp_action_file, + "%s -= %d;\n", scanner_cp, trailcnt ); + + fprintf( temp_action_file, + "YY_DO_BEFORE_ACTION; /* set up yytext again */\n" ); + } + } line_directive_out( temp_action_file ); } @@ -283,20 +283,20 @@ void finish_rule(int mach, int variable_trail_rule, int headcnt, int trailcnt) int link_machines(int first, int last) { if ( first == NIL ) - return ( last ); + return ( last ); else if ( last == NIL ) - return ( first ); + return ( first ); else - { - mkxtion( finalst[first], last ); - finalst[first] = finalst[last]; - lastst[first] = max( lastst[first], lastst[last] ); - firstst[first] = min( firstst[first], firstst[last] ); + { + mkxtion( finalst[first], last ); + finalst[first] = finalst[last]; + lastst[first] = max( lastst[first], lastst[last] ); + firstst[first] = min( firstst[first], firstst[last] ); - return ( first ); - } + return ( first ); + } } @@ -316,28 +316,28 @@ int link_machines(int first, int last) void mark_beginning_as_normal(int mach) { switch ( state_type[mach] ) - { - case STATE_NORMAL: - /* oh, we've already visited here */ - return; + { + case STATE_NORMAL: + /* oh, we've already visited here */ + return; - case STATE_TRAILING_CONTEXT: - state_type[mach] = STATE_NORMAL; + case STATE_TRAILING_CONTEXT: + state_type[mach] = STATE_NORMAL; - if ( transchar[mach] == SYM_EPSILON ) - { - if ( trans1[mach] != NO_TRANSITION ) - mark_beginning_as_normal( trans1[mach] ); + if ( transchar[mach] == SYM_EPSILON ) + { + if ( trans1[mach] != NO_TRANSITION ) + mark_beginning_as_normal( trans1[mach] ); - if ( trans2[mach] != NO_TRANSITION ) - mark_beginning_as_normal( trans2[mach] ); - } - break; + if ( trans2[mach] != NO_TRANSITION ) + mark_beginning_as_normal( trans2[mach] ); + } + break; - default: - flexerror( "bad state type in mark_beginning_as_normal()" ); - break; - } + default: + flexerror( "bad state type in mark_beginning_as_normal()" ); + break; + } } @@ -360,10 +360,10 @@ int mkbranch(int first, int second) int eps; if ( first == NO_TRANSITION ) - return ( second ); + return ( second ); else if ( second == NO_TRANSITION ) - return ( first ); + return ( first ); eps = mkstate( SYM_EPSILON ); @@ -407,10 +407,10 @@ int mkopt(int mach) int eps; if ( ! SUPER_FREE_EPSILON(finalst[mach]) ) - { - eps = mkstate( SYM_EPSILON ); - mach = link_machines( mach, eps ); - } + { + eps = mkstate( SYM_EPSILON ); + mach = link_machines( mach, eps ); + } /* can't skimp on the following if FREE_EPSILON(mach) is true because * some state interior to "mach" might point back to the beginning @@ -444,46 +444,46 @@ int mkor(int first, int second) int eps, orend; if ( first == NIL ) - return ( second ); + return ( second ); else if ( second == NIL ) - return ( first ); + return ( first ); else - { - /* see comment in mkopt() about why we can't use the first state - * of "first" or "second" if they satisfy "FREE_EPSILON" - */ - eps = mkstate( SYM_EPSILON ); + { + /* see comment in mkopt() about why we can't use the first state + * of "first" or "second" if they satisfy "FREE_EPSILON" + */ + eps = mkstate( SYM_EPSILON ); - first = link_machines( eps, first ); + first = link_machines( eps, first ); - mkxtion( first, second ); + mkxtion( first, second ); - if ( SUPER_FREE_EPSILON(finalst[first]) && - accptnum[finalst[first]] == NIL ) - { - orend = finalst[first]; - mkxtion( finalst[second], orend ); - } + if ( SUPER_FREE_EPSILON(finalst[first]) && + accptnum[finalst[first]] == NIL ) + { + orend = finalst[first]; + mkxtion( finalst[second], orend ); + } - else if ( SUPER_FREE_EPSILON(finalst[second]) && - accptnum[finalst[second]] == NIL ) - { - orend = finalst[second]; - mkxtion( finalst[first], orend ); - } + else if ( SUPER_FREE_EPSILON(finalst[second]) && + accptnum[finalst[second]] == NIL ) + { + orend = finalst[second]; + mkxtion( finalst[first], orend ); + } - else - { - eps = mkstate( SYM_EPSILON ); + else + { + eps = mkstate( SYM_EPSILON ); - first = link_machines( first, eps ); - orend = finalst[first]; + first = link_machines( first, eps ); + orend = finalst[first]; - mkxtion( finalst[second], orend ); - } - } + mkxtion( finalst[second], orend ); + } + } finalst[first] = orend; return ( first ); @@ -503,17 +503,17 @@ int mkposcl(int state) int eps; if ( SUPER_FREE_EPSILON(finalst[state]) ) - { - mkxtion( finalst[state], state ); - return ( state ); - } + { + mkxtion( finalst[state], state ); + return ( state ); + } else - { - eps = mkstate( SYM_EPSILON ); - mkxtion( eps, state ); - return ( link_machines( state, eps ) ); - } + { + eps = mkstate( SYM_EPSILON ); + mkxtion( eps, state ); + return ( link_machines( state, eps ) ); + } } @@ -536,24 +536,24 @@ int mkrep(int mach, int lb, int ub) base_mach = copysingl( mach, lb - 1 ); if ( ub == INFINITY ) - { - copy = dupmachine( mach ); - mach = link_machines( mach, - link_machines( base_mach, mkclos( copy ) ) ); - } + { + copy = dupmachine( mach ); + mach = link_machines( mach, + link_machines( base_mach, mkclos( copy ) ) ); + } else - { - tail = mkstate( SYM_EPSILON ); + { + tail = mkstate( SYM_EPSILON ); - for ( i = lb; i < ub; ++i ) - { - copy = dupmachine( mach ); - tail = mkopt( link_machines( copy, tail ) ); - } + for ( i = lb; i < ub; ++i ) + { + copy = dupmachine( mach ); + tail = mkopt( link_machines( copy, tail ) ); + } - mach = link_machines( mach, link_machines( base_mach, tail ) ); - } + mach = link_machines( mach, link_machines( base_mach, tail ) ); + } return ( mach ); } @@ -578,23 +578,23 @@ int mkrep(int mach, int lb, int ub) int mkstate(int sym) { if ( ++lastnfa >= current_mns ) - { - if ( (current_mns += MNS_INCREMENT) >= MAXIMUM_MNS ) - lerrif( "input rules are too complicated (>= %d NFA states)", - current_mns ); - - ++num_reallocs; + { + if ( (current_mns += MNS_INCREMENT) >= MAXIMUM_MNS ) + lerrif( "input rules are too complicated (>= %d NFA states)", + current_mns ); - firstst = reallocate_integer_array( firstst, current_mns ); - lastst = reallocate_integer_array( lastst, current_mns ); - finalst = reallocate_integer_array( finalst, current_mns ); - transchar = reallocate_integer_array( transchar, current_mns ); - trans1 = reallocate_integer_array( trans1, current_mns ); - trans2 = reallocate_integer_array( trans2, current_mns ); - accptnum = reallocate_integer_array( accptnum, current_mns ); - assoc_rule = reallocate_integer_array( assoc_rule, current_mns ); - state_type = reallocate_integer_array( state_type, current_mns ); - } + ++num_reallocs; + + firstst = reallocate_integer_array( firstst, current_mns ); + lastst = reallocate_integer_array( lastst, current_mns ); + finalst = reallocate_integer_array( finalst, current_mns ); + transchar = reallocate_integer_array( transchar, current_mns ); + trans1 = reallocate_integer_array( trans1, current_mns ); + trans2 = reallocate_integer_array( trans2, current_mns ); + accptnum = reallocate_integer_array( accptnum, current_mns ); + assoc_rule = reallocate_integer_array( assoc_rule, current_mns ); + state_type = reallocate_integer_array( state_type, current_mns ); + } firstst[lastnfa] = lastnfa; finalst[lastnfa] = lastnfa; @@ -615,21 +615,21 @@ int mkstate(int sym) */ if ( sym < 0 ) - { - /* we don't have to update the equivalence classes since that was - * already done when the ccl was created for the first time - */ - } + { + /* we don't have to update the equivalence classes since that was + * already done when the ccl was created for the first time + */ + } else if ( sym == SYM_EPSILON ) - ++numeps; + ++numeps; else - { - if ( useecs ) - /* map NUL's to csize */ - mkechar( sym ? sym : csize, nextecm, ecgroup ); - } + { + if ( useecs ) + /* map NUL's to csize */ + mkechar( sym ? sym : csize, nextecm, ecgroup ); + } return ( lastnfa ); } @@ -648,17 +648,17 @@ int mkstate(int sym) void mkxtion(int statefrom, int stateto) { if ( trans1[statefrom] == NO_TRANSITION ) - trans1[statefrom] = stateto; + trans1[statefrom] = stateto; else if ( (transchar[statefrom] != SYM_EPSILON) || - (trans2[statefrom] != NO_TRANSITION) ) - flexfatal( "found too many transitions in mkxtion()" ); + (trans2[statefrom] != NO_TRANSITION) ) + flexfatal( "found too many transitions in mkxtion()" ); else - { /* second out-transition for an epsilon state */ - ++eps2; - trans2[statefrom] = stateto; - } + { /* second out-transition for an epsilon state */ + ++eps2; + trans2[statefrom] = stateto; + } } /* new_rule - initialize for a new rule @@ -674,16 +674,16 @@ void mkxtion(int statefrom, int stateto) void new_rule(void) { if ( ++num_rules >= current_max_rules ) - { - ++num_reallocs; - current_max_rules += MAX_RULES_INCREMENT; - rule_type = reallocate_integer_array( rule_type, current_max_rules ); - rule_linenum = - reallocate_integer_array( rule_linenum, current_max_rules ); - } + { + ++num_reallocs; + current_max_rules += MAX_RULES_INCREMENT; + rule_type = reallocate_integer_array( rule_type, current_max_rules ); + rule_linenum = + reallocate_integer_array( rule_linenum, current_max_rules ); + } if ( num_rules > MAX_RULE ) - lerrif( "too many rules (> %d)!", MAX_RULE ); + lerrif( "too many rules (> %d)!", MAX_RULE ); rule_linenum[num_rules] = linenum; } diff --git a/modules/libcom/src/flex/parse.y b/modules/libcom/src/flex/parse.y index dff931578..21ac91730 100644 --- a/modules/libcom/src/flex/parse.y +++ b/modules/libcom/src/flex/parse.y @@ -10,7 +10,7 @@ * * This code is derived from software contributed to Berkeley by * Vern Paxson. - * + * * The United States Government has rights in this work pursuant * to contract no. DE-AC03-76SF00098 between the United States * Department of Energy and the University of California. @@ -37,587 +37,587 @@ int trlcontxt, xcluflg, cclsorted, varlength, variable_trail_rule; Char clower(); static int madeany = false; /* whether we've made the '.' character class */ -int previous_continued_action; /* whether the previous rule's action was '|' */ +int previous_continued_action; /* whether the previous rule's action was '|' */ %} %% goal : initlex sect1 sect1end sect2 initforrule - { /* add default rule */ - int def_rule; + { /* add default rule */ + int def_rule; - pat = cclinit(); - cclnegate( pat ); + pat = cclinit(); + cclnegate( pat ); - def_rule = mkstate( -pat ); + def_rule = mkstate( -pat ); - finish_rule( def_rule, false, 0, 0 ); + finish_rule( def_rule, false, 0, 0 ); - for ( i = 1; i <= lastsc; ++i ) - scset[i] = mkbranch( scset[i], def_rule ); + for ( i = 1; i <= lastsc; ++i ) + scset[i] = mkbranch( scset[i], def_rule ); - if ( spprdflt ) - fputs( "YY_FATAL_ERROR( \"flex scanner jammed\" )", - temp_action_file ); - else - fputs( "ECHO", temp_action_file ); + if ( spprdflt ) + fputs( "YY_FATAL_ERROR( \"flex scanner jammed\" )", + temp_action_file ); + else + fputs( "ECHO", temp_action_file ); - fputs( ";\n\tYY_BREAK\n", temp_action_file ); - } - ; + fputs( ";\n\tYY_BREAK\n", temp_action_file ); + } + ; initlex : - { - /* initialize for processing rules */ + { + /* initialize for processing rules */ - /* create default DFA start condition */ - scinstal( "INITIAL", false ); - } - ; + /* create default DFA start condition */ + scinstal( "INITIAL", false ); + } + ; -sect1 : sect1 startconddecl WHITESPACE namelist1 '\n' - | - | error '\n' - { synerr( "unknown error processing section 1" ); } - ; +sect1 : sect1 startconddecl WHITESPACE namelist1 '\n' + | + | error '\n' + { synerr( "unknown error processing section 1" ); } + ; -sect1end : SECTEND - ; +sect1end : SECTEND + ; startconddecl : SCDECL - { - /* these productions are separate from the s1object - * rule because the semantics must be done before - * we parse the remainder of an s1object - */ + { + /* these productions are separate from the s1object + * rule because the semantics must be done before + * we parse the remainder of an s1object + */ - xcluflg = false; - } + xcluflg = false; + } - | XSCDECL - { xcluflg = true; } - ; + | XSCDECL + { xcluflg = true; } + ; -namelist1 : namelist1 WHITESPACE NAME - { scinstal( nmstr, xcluflg ); } +namelist1 : namelist1 WHITESPACE NAME + { scinstal( nmstr, xcluflg ); } - | NAME - { scinstal( nmstr, xcluflg ); } + | NAME + { scinstal( nmstr, xcluflg ); } - | error + | error { synerr( "bad start condition list" ); } - ; + ; sect2 : sect2 initforrule flexrule '\n' - | - ; + | + ; initforrule : - { - /* initialize for a parse of one rule */ - trlcontxt = variable_trail_rule = varlength = false; - trailcnt = headcnt = rulelen = 0; - current_state_type = STATE_NORMAL; - previous_continued_action = continued_action; - new_rule(); - } - ; + { + /* initialize for a parse of one rule */ + trlcontxt = variable_trail_rule = varlength = false; + trailcnt = headcnt = rulelen = 0; + current_state_type = STATE_NORMAL; + previous_continued_action = continued_action; + new_rule(); + } + ; flexrule : scon '^' rule { - pat = $3; - finish_rule( pat, variable_trail_rule, - headcnt, trailcnt ); + pat = $3; + finish_rule( pat, variable_trail_rule, + headcnt, trailcnt ); - for ( i = 1; i <= actvp; ++i ) - scbol[actvsc[i]] = - mkbranch( scbol[actvsc[i]], pat ); + for ( i = 1; i <= actvp; ++i ) + scbol[actvsc[i]] = + mkbranch( scbol[actvsc[i]], pat ); - if ( ! bol_needed ) - { - bol_needed = true; + if ( ! bol_needed ) + { + bol_needed = true; - if ( performance_report ) - pinpoint_message( - "'^' operator results in sub-optimal performance" ); - } - } + if ( performance_report ) + pinpoint_message( + "'^' operator results in sub-optimal performance" ); + } + } - | scon rule + | scon rule { - pat = $2; - finish_rule( pat, variable_trail_rule, - headcnt, trailcnt ); + pat = $2; + finish_rule( pat, variable_trail_rule, + headcnt, trailcnt ); - for ( i = 1; i <= actvp; ++i ) - scset[actvsc[i]] = - mkbranch( scset[actvsc[i]], pat ); - } + for ( i = 1; i <= actvp; ++i ) + scset[actvsc[i]] = + mkbranch( scset[actvsc[i]], pat ); + } | '^' rule - { - pat = $2; - finish_rule( pat, variable_trail_rule, - headcnt, trailcnt ); + { + pat = $2; + finish_rule( pat, variable_trail_rule, + headcnt, trailcnt ); - /* add to all non-exclusive start conditions, - * including the default (0) start condition - */ + /* add to all non-exclusive start conditions, + * including the default (0) start condition + */ - for ( i = 1; i <= lastsc; ++i ) - if ( ! scxclu[i] ) - scbol[i] = mkbranch( scbol[i], pat ); + for ( i = 1; i <= lastsc; ++i ) + if ( ! scxclu[i] ) + scbol[i] = mkbranch( scbol[i], pat ); - if ( ! bol_needed ) - { - bol_needed = true; + if ( ! bol_needed ) + { + bol_needed = true; - if ( performance_report ) - pinpoint_message( - "'^' operator results in sub-optimal performance" ); - } - } + if ( performance_report ) + pinpoint_message( + "'^' operator results in sub-optimal performance" ); + } + } | rule - { - pat = $1; - finish_rule( pat, variable_trail_rule, - headcnt, trailcnt ); + { + pat = $1; + finish_rule( pat, variable_trail_rule, + headcnt, trailcnt ); - for ( i = 1; i <= lastsc; ++i ) - if ( ! scxclu[i] ) - scset[i] = mkbranch( scset[i], pat ); - } + for ( i = 1; i <= lastsc; ++i ) + if ( ! scxclu[i] ) + scset[i] = mkbranch( scset[i], pat ); + } | scon EOF_OP - { build_eof_action(); } + { build_eof_action(); } | EOF_OP - { - /* this EOF applies to all start conditions - * which don't already have EOF actions - */ - actvp = 0; + { + /* this EOF applies to all start conditions + * which don't already have EOF actions + */ + actvp = 0; - for ( i = 1; i <= lastsc; ++i ) - if ( ! sceof[i] ) - actvsc[++actvp] = i; + for ( i = 1; i <= lastsc; ++i ) + if ( ! sceof[i] ) + actvsc[++actvp] = i; - if ( actvp == 0 ) - pinpoint_message( - "warning - all start conditions already have <> rules" ); + if ( actvp == 0 ) + pinpoint_message( + "warning - all start conditions already have <> rules" ); - else - build_eof_action(); - } + else + build_eof_action(); + } | error - { synerr( "unrecognized rule" ); } - ; + { synerr( "unrecognized rule" ); } + ; scon : '<' namelist2 '>' - ; + ; namelist2 : namelist2 ',' NAME { - if ( (scnum = sclookup( nmstr )) == 0 ) - format_pinpoint_message( - "undeclared start condition %s", nmstr ); + if ( (scnum = sclookup( nmstr )) == 0 ) + format_pinpoint_message( + "undeclared start condition %s", nmstr ); - else - actvsc[++actvp] = scnum; - } + else + actvsc[++actvp] = scnum; + } - | NAME - { - if ( (scnum = sclookup( nmstr )) == 0 ) - format_pinpoint_message( - "undeclared start condition %s", nmstr ); - else - actvsc[actvp = 1] = scnum; - } + | NAME + { + if ( (scnum = sclookup( nmstr )) == 0 ) + format_pinpoint_message( + "undeclared start condition %s", nmstr ); + else + actvsc[actvp = 1] = scnum; + } - | error - { synerr( "bad start condition list" ); } - ; + | error + { synerr( "bad start condition list" ); } + ; rule : re2 re - { - if ( transchar[lastst[$2]] != SYM_EPSILON ) - /* provide final transition \now/ so it - * will be marked as a trailing context - * state - */ - $2 = link_machines( $2, mkstate( SYM_EPSILON ) ); - - mark_beginning_as_normal( $2 ); - current_state_type = STATE_NORMAL; - - if ( previous_continued_action ) - { - /* we need to treat this as variable trailing - * context so that the backup does not happen - * in the action but before the action switch - * statement. If the backup happens in the - * action, then the rules "falling into" this - * one's action will *also* do the backup, - * erroneously. - */ - if ( ! varlength || headcnt != 0 ) - { - fprintf( stderr, - "%s: warning - trailing context rule at line %d made variable because\n", - program_name, linenum ); - fprintf( stderr, - " of preceding '|' action\n" ); - } - - /* mark as variable */ - varlength = true; - headcnt = 0; - } - - if ( varlength && headcnt == 0 ) - { /* variable trailing context rule */ - /* mark the first part of the rule as the accepting - * "head" part of a trailing context rule - */ - /* by the way, we didn't do this at the beginning - * of this production because back then - * current_state_type was set up for a trail - * rule, and add_accept() can create a new - * state ... - */ - add_accept( $1, num_rules | YY_TRAILING_HEAD_MASK ); - variable_trail_rule = true; - } - - else - trailcnt = rulelen; - - $$ = link_machines( $1, $2 ); - } - - | re2 re '$' - { synerr( "trailing context used twice" ); } - - | re '$' { - if ( trlcontxt ) - { - synerr( "trailing context used twice" ); - $$ = mkstate( SYM_EPSILON ); - } + if ( transchar[lastst[$2]] != SYM_EPSILON ) + /* provide final transition \now/ so it + * will be marked as a trailing context + * state + */ + $2 = link_machines( $2, mkstate( SYM_EPSILON ) ); - else if ( previous_continued_action ) - { - /* see the comment in the rule for "re2 re" - * above - */ - if ( ! varlength || headcnt != 0 ) - { - fprintf( stderr, + mark_beginning_as_normal( $2 ); + current_state_type = STATE_NORMAL; + + if ( previous_continued_action ) + { + /* we need to treat this as variable trailing + * context so that the backup does not happen + * in the action but before the action switch + * statement. If the backup happens in the + * action, then the rules "falling into" this + * one's action will *also* do the backup, + * erroneously. + */ + if ( ! varlength || headcnt != 0 ) + { + fprintf( stderr, "%s: warning - trailing context rule at line %d made variable because\n", - program_name, linenum ); - fprintf( stderr, - " of preceding '|' action\n" ); - } + program_name, linenum ); + fprintf( stderr, + " of preceding '|' action\n" ); + } - /* mark as variable */ - varlength = true; - headcnt = 0; - } + /* mark as variable */ + varlength = true; + headcnt = 0; + } - trlcontxt = true; + if ( varlength && headcnt == 0 ) + { /* variable trailing context rule */ + /* mark the first part of the rule as the accepting + * "head" part of a trailing context rule + */ + /* by the way, we didn't do this at the beginning + * of this production because back then + * current_state_type was set up for a trail + * rule, and add_accept() can create a new + * state ... + */ + add_accept( $1, num_rules | YY_TRAILING_HEAD_MASK ); + variable_trail_rule = true; + } - if ( ! varlength ) - headcnt = rulelen; + else + trailcnt = rulelen; - ++rulelen; - trailcnt = 1; + $$ = link_machines( $1, $2 ); + } - eps = mkstate( SYM_EPSILON ); - $$ = link_machines( $1, - link_machines( eps, mkstate( '\n' ) ) ); - } + | re2 re '$' + { synerr( "trailing context used twice" ); } - | re - { - $$ = $1; + | re '$' + { + if ( trlcontxt ) + { + synerr( "trailing context used twice" ); + $$ = mkstate( SYM_EPSILON ); + } - if ( trlcontxt ) - { - if ( varlength && headcnt == 0 ) - /* both head and trail are variable-length */ - variable_trail_rule = true; - else - trailcnt = rulelen; - } - } - ; + else if ( previous_continued_action ) + { + /* see the comment in the rule for "re2 re" + * above + */ + if ( ! varlength || headcnt != 0 ) + { + fprintf( stderr, + "%s: warning - trailing context rule at line %d made variable because\n", + program_name, linenum ); + fprintf( stderr, + " of preceding '|' action\n" ); + } + + /* mark as variable */ + varlength = true; + headcnt = 0; + } + + trlcontxt = true; + + if ( ! varlength ) + headcnt = rulelen; + + ++rulelen; + trailcnt = 1; + + eps = mkstate( SYM_EPSILON ); + $$ = link_machines( $1, + link_machines( eps, mkstate( '\n' ) ) ); + } + + | re + { + $$ = $1; + + if ( trlcontxt ) + { + if ( varlength && headcnt == 0 ) + /* both head and trail are variable-length */ + variable_trail_rule = true; + else + trailcnt = rulelen; + } + } + ; re : re '|' series { - varlength = true; - $$ = mkor( $1, $3 ); - } + varlength = true; + $$ = mkor( $1, $3 ); + } - | series - { $$ = $1; } - ; + | series + { $$ = $1; } + ; -re2 : re '/' - { - /* this rule is written separately so - * the reduction will occur before the trailing - * series is parsed - */ +re2 : re '/' + { + /* this rule is written separately so + * the reduction will occur before the trailing + * series is parsed + */ - if ( trlcontxt ) - synerr( "trailing context used twice" ); - else - trlcontxt = true; + if ( trlcontxt ) + synerr( "trailing context used twice" ); + else + trlcontxt = true; - if ( varlength ) - /* we hope the trailing context is fixed-length */ - varlength = false; - else - headcnt = rulelen; + if ( varlength ) + /* we hope the trailing context is fixed-length */ + varlength = false; + else + headcnt = rulelen; - rulelen = 0; + rulelen = 0; - current_state_type = STATE_TRAILING_CONTEXT; - $$ = $1; - } - ; + current_state_type = STATE_TRAILING_CONTEXT; + $$ = $1; + } + ; series : series singleton { - /* this is where concatenation of adjacent patterns - * gets done - */ - $$ = link_machines( $1, $2 ); - } + /* this is where concatenation of adjacent patterns + * gets done + */ + $$ = link_machines( $1, $2 ); + } - | singleton - { $$ = $1; } - ; + | singleton + { $$ = $1; } + ; singleton : singleton '*' { - varlength = true; + varlength = true; - $$ = mkclos( $1 ); - } + $$ = mkclos( $1 ); + } - | singleton '+' - { - varlength = true; + | singleton '+' + { + varlength = true; - $$ = mkposcl( $1 ); - } + $$ = mkposcl( $1 ); + } - | singleton '?' - { - varlength = true; + | singleton '?' + { + varlength = true; - $$ = mkopt( $1 ); - } + $$ = mkopt( $1 ); + } - | singleton '{' NUMBER ',' NUMBER '}' - { - varlength = true; + | singleton '{' NUMBER ',' NUMBER '}' + { + varlength = true; - if ( $3 > $5 || $3 < 0 ) - { - synerr( "bad iteration values" ); - $$ = $1; - } - else - { - if ( $3 == 0 ) - $$ = mkopt( mkrep( $1, $3, $5 ) ); - else - $$ = mkrep( $1, $3, $5 ); - } - } + if ( $3 > $5 || $3 < 0 ) + { + synerr( "bad iteration values" ); + $$ = $1; + } + else + { + if ( $3 == 0 ) + $$ = mkopt( mkrep( $1, $3, $5 ) ); + else + $$ = mkrep( $1, $3, $5 ); + } + } - | singleton '{' NUMBER ',' '}' - { - varlength = true; + | singleton '{' NUMBER ',' '}' + { + varlength = true; - if ( $3 <= 0 ) - { - synerr( "iteration value must be positive" ); - $$ = $1; - } + if ( $3 <= 0 ) + { + synerr( "iteration value must be positive" ); + $$ = $1; + } - else - $$ = mkrep( $1, $3, INFINITY ); - } + else + $$ = mkrep( $1, $3, INFINITY ); + } - | singleton '{' NUMBER '}' - { - /* the singleton could be something like "(foo)", - * in which case we have no idea what its length - * is, so we punt here. - */ - varlength = true; + | singleton '{' NUMBER '}' + { + /* the singleton could be something like "(foo)", + * in which case we have no idea what its length + * is, so we punt here. + */ + varlength = true; - if ( $3 <= 0 ) - { - synerr( "iteration value must be positive" ); - $$ = $1; - } + if ( $3 <= 0 ) + { + synerr( "iteration value must be positive" ); + $$ = $1; + } - else - $$ = link_machines( $1, copysingl( $1, $3 - 1 ) ); - } + else + $$ = link_machines( $1, copysingl( $1, $3 - 1 ) ); + } - | '.' - { - if ( ! madeany ) - { - /* create the '.' character class */ - anyccl = cclinit(); - ccladd( anyccl, '\n' ); - cclnegate( anyccl ); + | '.' + { + if ( ! madeany ) + { + /* create the '.' character class */ + anyccl = cclinit(); + ccladd( anyccl, '\n' ); + cclnegate( anyccl ); - if ( useecs ) - mkeccl( ccltbl + cclmap[anyccl], - ccllen[anyccl], nextecm, - ecgroup, csize, csize ); + if ( useecs ) + mkeccl( ccltbl + cclmap[anyccl], + ccllen[anyccl], nextecm, + ecgroup, csize, csize ); - madeany = true; - } + madeany = true; + } - ++rulelen; + ++rulelen; - $$ = mkstate( -anyccl ); - } + $$ = mkstate( -anyccl ); + } - | fullccl - { - if ( ! cclsorted ) - /* sort characters for fast searching. We use a - * shell sort since this list could be large. - */ - cshell( ccltbl + cclmap[$1], ccllen[$1], true ); + | fullccl + { + if ( ! cclsorted ) + /* sort characters for fast searching. We use a + * shell sort since this list could be large. + */ + cshell( ccltbl + cclmap[$1], ccllen[$1], true ); - if ( useecs ) - mkeccl( ccltbl + cclmap[$1], ccllen[$1], - nextecm, ecgroup, csize, csize ); + if ( useecs ) + mkeccl( ccltbl + cclmap[$1], ccllen[$1], + nextecm, ecgroup, csize, csize ); - ++rulelen; + ++rulelen; - $$ = mkstate( -$1 ); - } + $$ = mkstate( -$1 ); + } - | PREVCCL - { - ++rulelen; + | PREVCCL + { + ++rulelen; - $$ = mkstate( -$1 ); - } + $$ = mkstate( -$1 ); + } - | '"' string '"' - { $$ = $2; } + | '"' string '"' + { $$ = $2; } - | '(' re ')' - { $$ = $2; } + | '(' re ')' + { $$ = $2; } - | CHAR - { - ++rulelen; + | CHAR + { + ++rulelen; - if ( caseins && $1 >= 'A' && $1 <= 'Z' ) - $1 = clower( $1 ); + if ( caseins && $1 >= 'A' && $1 <= 'Z' ) + $1 = clower( $1 ); - $$ = mkstate( $1 ); - } - ; + $$ = mkstate( $1 ); + } + ; -fullccl : '[' ccl ']' - { $$ = $2; } +fullccl : '[' ccl ']' + { $$ = $2; } - | '[' '^' ccl ']' - { - /* *Sigh* - to be compatible Unix lex, negated ccls - * match newlines - */ + | '[' '^' ccl ']' + { + /* *Sigh* - to be compatible Unix lex, negated ccls + * match newlines + */ #ifdef NOTDEF - ccladd( $3, '\n' ); /* negated ccls don't match '\n' */ - cclsorted = false; /* because we added the newline */ + ccladd( $3, '\n' ); /* negated ccls don't match '\n' */ + cclsorted = false; /* because we added the newline */ #endif - cclnegate( $3 ); - $$ = $3; - } - ; + cclnegate( $3 ); + $$ = $3; + } + ; ccl : ccl CHAR '-' CHAR { - if ( $2 > $4 ) - synerr( "negative range in character class" ); + if ( $2 > $4 ) + synerr( "negative range in character class" ); - else - { - if ( caseins ) - { - if ( $2 >= 'A' && $2 <= 'Z' ) - $2 = clower( $2 ); - if ( $4 >= 'A' && $4 <= 'Z' ) - $4 = clower( $4 ); - } + else + { + if ( caseins ) + { + if ( $2 >= 'A' && $2 <= 'Z' ) + $2 = clower( $2 ); + if ( $4 >= 'A' && $4 <= 'Z' ) + $4 = clower( $4 ); + } - for ( i = $2; i <= $4; ++i ) - ccladd( $1, i ); + for ( i = $2; i <= $4; ++i ) + ccladd( $1, i ); - /* keep track if this ccl is staying in alphabetical - * order - */ - cclsorted = cclsorted && ($2 > lastchar); - lastchar = $4; - } + /* keep track if this ccl is staying in alphabetical + * order + */ + cclsorted = cclsorted && ($2 > lastchar); + lastchar = $4; + } - $$ = $1; - } + $$ = $1; + } - | ccl CHAR - { - if ( caseins ) - if ( $2 >= 'A' && $2 <= 'Z' ) - $2 = clower( $2 ); - - ccladd( $1, $2 ); - cclsorted = cclsorted && ($2 > lastchar); - lastchar = $2; - $$ = $1; - } - - | - { - cclsorted = true; - lastchar = 0; - $$ = cclinit(); - } - ; - -string : string CHAR + | ccl CHAR { - if ( caseins ) - if ( $2 >= 'A' && $2 <= 'Z' ) - $2 = clower( $2 ); + if ( caseins ) + if ( $2 >= 'A' && $2 <= 'Z' ) + $2 = clower( $2 ); - ++rulelen; + ccladd( $1, $2 ); + cclsorted = cclsorted && ($2 > lastchar); + lastchar = $2; + $$ = $1; + } - $$ = link_machines( $1, mkstate( $2 ) ); - } + | + { + cclsorted = true; + lastchar = 0; + $$ = cclinit(); + } + ; - | - { $$ = mkstate( SYM_EPSILON ); } - ; +string : string CHAR + { + if ( caseins ) + if ( $2 >= 'A' && $2 <= 'Z' ) + $2 = clower( $2 ); + + ++rulelen; + + $$ = link_machines( $1, mkstate( $2 ) ); + } + + | + { $$ = mkstate( SYM_EPSILON ); } + ; %% @@ -632,19 +632,19 @@ void build_eof_action() int i; for ( i = 1; i <= actvp; ++i ) - { - if ( sceof[actvsc[i]] ) - format_pinpoint_message( - "multiple <> rules for start condition %s", - scname[actvsc[i]] ); + { + if ( sceof[actvsc[i]] ) + format_pinpoint_message( + "multiple <> rules for start condition %s", + scname[actvsc[i]] ); - else - { - sceof[actvsc[i]] = true; - fprintf( temp_action_file, "case YY_STATE_EOF(%s):\n", - scname[actvsc[i]] ); - } - } + else + { + sceof[actvsc[i]] = true; + fprintf( temp_action_file, "case YY_STATE_EOF(%s):\n", + scname[actvsc[i]] ); + } + } line_directive_out( temp_action_file ); } @@ -662,7 +662,7 @@ char str[]; /* format_pinpoint_message - write out a message formatted with one string, - * pinpointing its location + * pinpointing its location */ void format_pinpoint_message( msg, arg ) @@ -687,7 +687,7 @@ char str[]; /* yyerror - eat up an error message from the parser; - * currently, messages are ignore + * currently, messages are ignore */ void yyerror( msg ) diff --git a/modules/libcom/src/flex/scan.c b/modules/libcom/src/flex/scan.c index a12c020bf..67c6be38c 100644 --- a/modules/libcom/src/flex/scan.c +++ b/modules/libcom/src/flex/scan.c @@ -20,16 +20,16 @@ #include #include -#else /* ! __cplusplus */ +#else /* ! __cplusplus */ #ifdef __GNUC__ #include void *malloc( size_t ); void free( void* ); #else #include -#endif /* __GNUC__ */ +#endif /* __GNUC__ */ -#endif /* ! __cplusplus */ +#endif /* ! __cplusplus */ /* amount of stuff to slurp up with each read */ @@ -52,8 +52,8 @@ void free( void* ); * is returned in "result". */ #define YY_INPUT(buf,result,max_size) \ - if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \ - YY_FATAL_ERROR( "read() in flex scanner failed" ); + if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \ + YY_FATAL_ERROR( "read() in flex scanner failed" ); #define YY_NULL 0 /* no semi-colon after return; correct usage is to write "yyterminate();" - @@ -68,10 +68,10 @@ void free( void* ); * a single C statement (which needs a semi-colon terminator). * This avoids problems with code like: * - * if ( something_happens ) - * YY_FATAL_ERROR( "oops, the something happened" ); - * else - * everything_okay(); + * if ( something_happens ) + * YY_FATAL_ERROR( "oops, the something happened" ); + * else + * everything_okay(); * * Prior to using the do-while the compiler would get upset at the * "else" because it interpreted the "if" statement as being all @@ -79,13 +79,13 @@ void free( void* ); */ #define YY_FATAL_ERROR(msg) \ - do \ - { \ - (void) fputs( msg, stderr ); \ - (void) putc( '\n', stderr ); \ - exit( 1 ); \ - } \ - while ( 0 ) + do \ + { \ + (void) fputs( msg, stderr ); \ + (void) putc( '\n', stderr ); \ + exit( 1 ); \ + } \ + while ( 0 ) /* default yywrap function - always treat EOF as an EOF */ #define yywrap() 1 @@ -101,17 +101,17 @@ void free( void* ); /* special action meaning "start processing a new file" */ #define YY_NEW_FILE \ - do \ - { \ - yy_init_buffer( yy_current_buffer, yyin ); \ - yy_load_buffer_state(); \ - } \ - while ( 0 ) + do \ + { \ + yy_init_buffer( yy_current_buffer, yyin ); \ + yy_load_buffer_state(); \ + } \ + while ( 0 ) /* default declaration of generated scanner - a define so the user can * easily add parameters */ -#define YY_DECL int yylex ( void ) +#define YY_DECL int yylex ( void ) /* code executed at the end of each rule */ #define YY_BREAK break; @@ -135,7 +135,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; * * This code is derived from software contributed to Berkeley by * Vern Paxson. - * + * * The United States Government has rights in this work pursuant * to contract no. DE-AC03-76SF00098 between the United States * Department of Energy and the University of California. @@ -162,27 +162,27 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; #undef YY_DECL #define YY_DECL \ - int flexscan() + int flexscan() #define RETURNCHAR \ - yylval = yytext[0]; \ - return ( CHAR ); + yylval = yytext[0]; \ + return ( CHAR ); #define RETURNNAME \ - (void) strcpy( nmstr, (char *) yytext ); \ - return ( NAME ); + (void) strcpy( nmstr, (char *) yytext ); \ + return ( NAME ); #define PUT_BACK_STRING(str, start) \ - for ( i = strlen( (char *) (str) ) - 1; i >= start; --i ) \ - unput((str)[i]) + for ( i = strlen( (char *) (str) ) - 1; i >= start; --i ) \ + unput((str)[i]) #define CHECK_REJECT(str) \ - if ( all_upper( str ) ) \ - reject = true; + if ( all_upper( str ) ) \ + reject = true; #define CHECK_YYMORE(str) \ - if ( all_lower( str ) ) \ - yymore_used = true; + if ( all_lower( str ) ) \ + yymore_used = true; #define SECT2 1 #define SECT2PROLOG 2 #define SECT3 3 @@ -210,11 +210,11 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; * corresponding action - sets up yytext */ #define YY_DO_BEFORE_ACTION \ - yytext = yy_bp; \ - yyleng = yy_cp - yy_bp; \ - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; + yytext = yy_bp; \ + yyleng = yy_cp - yy_bp; \ + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 @@ -222,14 +222,14 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; /* return all but the first 'n' matched characters back to the input stream */ #define yyless(n) \ - do \ - { \ - /* undo effects of setting up yytext */ \ - *yy_cp = yy_hold_char; \ - yy_c_buf_p = yy_cp = yy_bp + n; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) + do \ + { \ + /* undo effects of setting up yytext */ \ + *yy_cp = yy_hold_char; \ + yy_c_buf_p = yy_cp = yy_bp + n; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) #define unput(c) yyunput( c, yytext ) @@ -238,16 +238,16 @@ struct yy_buffer_state { FILE *yy_input_file; - YY_CHAR *yy_ch_buf; /* input buffer */ - YY_CHAR *yy_buf_pos; /* current position in input buffer */ + YY_CHAR *yy_ch_buf; /* input buffer */ + YY_CHAR *yy_buf_pos; /* current position in input buffer */ /* size of input buffer in bytes, not including room for EOB characters*/ - int yy_buf_size; + int yy_buf_size; /* number of characters read into yy_ch_buf, not including EOB characters */ int yy_n_chars; - int yy_eof_status; /* whether we've seen an EOF on this buffer */ + int yy_eof_status; /* whether we've seen an EOF on this buffer */ #define EOF_NOT_SEEN 0 /* "pending" happens when the EOF has been seen but there's still * some text process @@ -268,7 +268,7 @@ static YY_BUFFER_STATE yy_current_buffer; /* yy_hold_char holds the character lost when yytext is formed */ static YY_CHAR yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ +static int yy_n_chars; /* number of characters read into yy_ch_buf */ @@ -935,8 +935,8 @@ goto find_rule; \ */ /* points to current character in buffer */ static YY_CHAR *yy_c_buf_p = (YY_CHAR *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ /* flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... @@ -970,959 +970,959 @@ YY_DECL if ( yy_init ) - { - YY_USER_INIT; + { + YY_USER_INIT; - if ( ! yy_start ) - yy_start = 1; /* first start state */ + if ( ! yy_start ) + yy_start = 1; /* first start state */ - if ( ! yyin ) - yyin = stdin; + if ( ! yyin ) + yyin = stdin; - if ( ! yyout ) - yyout = stdout; + if ( ! yyout ) + yyout = stdout; - if ( yy_current_buffer ) - yy_init_buffer( yy_current_buffer, yyin ); - else - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + if ( yy_current_buffer ) + yy_init_buffer( yy_current_buffer, yyin ); + else + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - yy_load_buffer_state(); + yy_load_buffer_state(); - yy_init = 0; - } + yy_init = 0; + } - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = yy_c_buf_p; + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yy_c_buf_p; - /* support of yytext */ - *yy_cp = yy_hold_char; + /* support of yytext */ + *yy_cp = yy_hold_char; - /* yy_bp points to the position in yy_ch_buf of the start of the - * current run. - */ - yy_bp = yy_cp; + /* yy_bp points to the position in yy_ch_buf of the start of the + * current run. + */ + yy_bp = yy_cp; - yy_current_state = yy_start; - if ( yy_bp[-1] == '\n' ) - ++yy_current_state; - yy_state_ptr = yy_state_buf; - *yy_state_ptr++ = yy_current_state; + yy_current_state = yy_start; + if ( yy_bp[-1] == '\n' ) + ++yy_current_state; + yy_state_ptr = yy_state_buf; + *yy_state_ptr++ = yy_current_state; yy_match: - do - { - YY_CHAR yy_c = yy_ec[(int)*yy_cp]; - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = yy_def[yy_current_state]; - if ( yy_current_state >= 391 ) - yy_c = yy_meta[(int)yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - *yy_state_ptr++ = yy_current_state; - ++yy_cp; - } - while ( yy_current_state != 390 ); + do + { + YY_CHAR yy_c = yy_ec[(int)*yy_cp]; + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = yy_def[yy_current_state]; + if ( yy_current_state >= 391 ) + yy_c = yy_meta[(int)yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + *yy_state_ptr++ = yy_current_state; + ++yy_cp; + } + while ( yy_current_state != 390 ); yy_find_action: - yy_current_state = *--yy_state_ptr; - yy_lp = yy_accept[yy_current_state]; + yy_current_state = *--yy_state_ptr; + yy_lp = yy_accept[yy_current_state]; find_rule: /* we branch to this label when backtracking */ - for ( ; ; ) /* until we find what rule we matched */ - { - if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] ) - { - yy_act = yy_acclist[yy_lp]; - if ( yy_act & YY_TRAILING_HEAD_MASK || - yy_looking_for_trail_begin ) - { - if ( yy_act == yy_looking_for_trail_begin ) - { - yy_looking_for_trail_begin = 0; - yy_act &= ~YY_TRAILING_HEAD_MASK; - break; - } - } - else if ( yy_act & YY_TRAILING_MASK ) - { - yy_looking_for_trail_begin = yy_act & ~YY_TRAILING_MASK; - yy_looking_for_trail_begin |= YY_TRAILING_HEAD_MASK; - } - else - { - yy_full_match = yy_cp; - yy_full_state = yy_state_ptr; - yy_full_lp = yy_lp; - break; - } - ++yy_lp; - goto find_rule; - } - --yy_cp; - yy_current_state = *--yy_state_ptr; - yy_lp = yy_accept[yy_current_state]; - } + for ( ; ; ) /* until we find what rule we matched */ + { + if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] ) + { + yy_act = yy_acclist[yy_lp]; + if ( yy_act & YY_TRAILING_HEAD_MASK || + yy_looking_for_trail_begin ) + { + if ( yy_act == yy_looking_for_trail_begin ) + { + yy_looking_for_trail_begin = 0; + yy_act &= ~YY_TRAILING_HEAD_MASK; + break; + } + } + else if ( yy_act & YY_TRAILING_MASK ) + { + yy_looking_for_trail_begin = yy_act & ~YY_TRAILING_MASK; + yy_looking_for_trail_begin |= YY_TRAILING_HEAD_MASK; + } + else + { + yy_full_match = yy_cp; + yy_full_state = yy_state_ptr; + yy_full_lp = yy_lp; + break; + } + ++yy_lp; + goto find_rule; + } + --yy_cp; + yy_current_state = *--yy_state_ptr; + yy_lp = yy_accept[yy_current_state]; + } - YY_DO_BEFORE_ACTION; - YY_USER_ACTION; + YY_DO_BEFORE_ACTION; + YY_USER_ACTION; -do_action: /* this label is used only to access EOF actions */ +do_action: /* this label is used only to access EOF actions */ - switch ( yy_act ) - { + switch ( yy_act ) + { case 1: # line 82 "scan.l" indented_code = true; BEGIN(CODEBLOCK); - YY_BREAK + YY_BREAK case 2: # line 83 "scan.l" ++linenum; /* treat as a comment */ - YY_BREAK + YY_BREAK case 3: # line 84 "scan.l" ECHO; BEGIN(C_COMMENT); - YY_BREAK + YY_BREAK case 4: # line 85 "scan.l" return ( SCDECL ); - YY_BREAK + YY_BREAK case 5: # line 86 "scan.l" return ( XSCDECL ); - YY_BREAK + YY_BREAK case 6: # line 87 "scan.l" { - ++linenum; - line_directive_out( stdout ); - indented_code = false; - BEGIN(CODEBLOCK); - } - YY_BREAK + ++linenum; + line_directive_out( stdout ); + indented_code = false; + BEGIN(CODEBLOCK); + } + YY_BREAK case 7: # line 94 "scan.l" return ( WHITESPACE ); - YY_BREAK + YY_BREAK case 8: # line 96 "scan.l" { - sectnum = 2; - line_directive_out( stdout ); - BEGIN(SECT2PROLOG); - return ( SECTEND ); - } - YY_BREAK + sectnum = 2; + line_directive_out( stdout ); + BEGIN(SECT2PROLOG); + return ( SECTEND ); + } + YY_BREAK case 9: # line 103 "scan.l" { - pinpoint_message( "warning - %%used/%%unused have been deprecated" ); - checking_used = REALLY_USED; BEGIN(USED_LIST); - } - YY_BREAK + pinpoint_message( "warning - %%used/%%unused have been deprecated" ); + checking_used = REALLY_USED; BEGIN(USED_LIST); + } + YY_BREAK case 10: # line 107 "scan.l" { - checking_used = REALLY_NOT_USED; BEGIN(USED_LIST); - pinpoint_message( "warning - %%used/%%unused have been deprecated" ); - checking_used = REALLY_NOT_USED; BEGIN(USED_LIST); - } - YY_BREAK + checking_used = REALLY_NOT_USED; BEGIN(USED_LIST); + pinpoint_message( "warning - %%used/%%unused have been deprecated" ); + checking_used = REALLY_NOT_USED; BEGIN(USED_LIST); + } + YY_BREAK case 11: # line 114 "scan.l" { #ifdef NOTDEF - fprintf( stderr, - "old-style lex command at line %d ignored:\n\t%s", - linenum, yytext ); + fprintf( stderr, + "old-style lex command at line %d ignored:\n\t%s", + linenum, yytext ); #endif - ++linenum; - } - YY_BREAK + ++linenum; + } + YY_BREAK case 12: # line 123 "scan.l" /* ignore old lex directive */ - YY_BREAK + YY_BREAK case 13: # line 125 "scan.l" { - ++linenum; - xlation = - (int *) malloc( sizeof( int ) * (unsigned) csize ); + ++linenum; + xlation = + (int *) malloc( sizeof( int ) * (unsigned) csize ); - if ( ! xlation ) - flexfatal( - "dynamic memory failure building %t table" ); + if ( ! xlation ) + flexfatal( + "dynamic memory failure building %t table" ); - for ( i = 0; i < csize; ++i ) - xlation[i] = 0; + for ( i = 0; i < csize; ++i ) + xlation[i] = 0; - num_xlations = 0; + num_xlations = 0; - BEGIN(XLATION); - } - YY_BREAK + BEGIN(XLATION); + } + YY_BREAK case 14: # line 142 "scan.l" synerr( "unrecognized '%' directive" ); - YY_BREAK + YY_BREAK case 15: # line 144 "scan.l" { - (void) strcpy( nmstr, (char *) yytext ); - didadef = false; - BEGIN(PICKUPDEF); - } - YY_BREAK + (void) strcpy( nmstr, (char *) yytext ); + didadef = false; + BEGIN(PICKUPDEF); + } + YY_BREAK case 16: # line 150 "scan.l" RETURNNAME; - YY_BREAK + YY_BREAK case 17: # line 151 "scan.l" ++linenum; /* allows blank lines in section 1 */ - YY_BREAK + YY_BREAK case 18: # line 152 "scan.l" ++linenum; return ( '\n' ); - YY_BREAK + YY_BREAK case 19: # line 153 "scan.l" synerr( "illegal character" ); BEGIN(RECOVER); - YY_BREAK + YY_BREAK case 20: # line 156 "scan.l" ECHO; BEGIN(INITIAL); - YY_BREAK + YY_BREAK case 21: # line 157 "scan.l" ++linenum; ECHO; BEGIN(INITIAL); - YY_BREAK + YY_BREAK case 22: # line 158 "scan.l" ECHO; - YY_BREAK + YY_BREAK case 23: # line 159 "scan.l" ECHO; - YY_BREAK + YY_BREAK case 24: # line 160 "scan.l" ++linenum; ECHO; - YY_BREAK + YY_BREAK case 25: # line 163 "scan.l" ++linenum; BEGIN(INITIAL); - YY_BREAK + YY_BREAK case 26: # line 164 "scan.l" ECHO; CHECK_REJECT(yytext); - YY_BREAK + YY_BREAK case 27: # line 165 "scan.l" ECHO; CHECK_YYMORE(yytext); - YY_BREAK + YY_BREAK case 28: # line 166 "scan.l" ECHO; - YY_BREAK + YY_BREAK case 29: # line 167 "scan.l" { - ++linenum; - ECHO; - if ( indented_code ) - BEGIN(INITIAL); - } - YY_BREAK + ++linenum; + ECHO; + if ( indented_code ) + BEGIN(INITIAL); + } + YY_BREAK case 30: # line 175 "scan.l" /* separates name and definition */ - YY_BREAK + YY_BREAK case 31: # line 177 "scan.l" { - (void) strcpy( (char *) nmdef, (char *) yytext ); + (void) strcpy( (char *) nmdef, (char *) yytext ); - for ( i = strlen( (char *) nmdef ) - 1; - i >= 0 && - (nmdef[i] == ' ' || nmdef[i] == '\t'); - --i ) - ; + for ( i = strlen( (char *) nmdef ) - 1; + i >= 0 && + (nmdef[i] == ' ' || nmdef[i] == '\t'); + --i ) + ; - nmdef[i + 1] = '\0'; + nmdef[i + 1] = '\0'; ndinstal( nmstr, nmdef ); - didadef = true; - } - YY_BREAK + didadef = true; + } + YY_BREAK case 32: # line 192 "scan.l" { - if ( ! didadef ) - synerr( "incomplete name definition" ); - BEGIN(INITIAL); - ++linenum; - } - YY_BREAK + if ( ! didadef ) + synerr( "incomplete name definition" ); + BEGIN(INITIAL); + ++linenum; + } + YY_BREAK case 33: # line 199 "scan.l" ++linenum; BEGIN(INITIAL); RETURNNAME; - YY_BREAK + YY_BREAK case 34: # line 202 "scan.l" ++linenum; BEGIN(INITIAL); - YY_BREAK + YY_BREAK case 35: # line 203 "scan.l" - YY_BREAK + YY_BREAK case 36: # line 204 "scan.l" { - if ( all_upper( yytext ) ) - reject_really_used = checking_used; - else - synerr( "unrecognized %used/%unused construct" ); - } - YY_BREAK + if ( all_upper( yytext ) ) + reject_really_used = checking_used; + else + synerr( "unrecognized %used/%unused construct" ); + } + YY_BREAK case 37: # line 210 "scan.l" { - if ( all_lower( yytext ) ) - yymore_really_used = checking_used; - else - synerr( "unrecognized %used/%unused construct" ); - } - YY_BREAK + if ( all_lower( yytext ) ) + yymore_really_used = checking_used; + else + synerr( "unrecognized %used/%unused construct" ); + } + YY_BREAK case 38: # line 216 "scan.l" synerr( "unrecognized %used/%unused construct" ); - YY_BREAK + YY_BREAK case 39: # line 219 "scan.l" ++linenum; BEGIN(INITIAL); - YY_BREAK + YY_BREAK case 40: # line 220 "scan.l" ++num_xlations; new_xlation = true; - YY_BREAK + YY_BREAK case 41: # line 221 "scan.l" synerr( "bad row in translation table" ); - YY_BREAK + YY_BREAK case 42: # line 222 "scan.l" /* ignore whitespace */ - YY_BREAK + YY_BREAK case 43: # line 224 "scan.l" { - xlation[myesc( yytext )] = - (new_xlation ? num_xlations : -num_xlations); - new_xlation = false; - } - YY_BREAK + xlation[myesc( yytext )] = + (new_xlation ? num_xlations : -num_xlations); + new_xlation = false; + } + YY_BREAK case 44: # line 229 "scan.l" { - xlation[yytext[0]] = - (new_xlation ? num_xlations : -num_xlations); - new_xlation = false; - } - YY_BREAK + xlation[yytext[0]] = + (new_xlation ? num_xlations : -num_xlations); + new_xlation = false; + } + YY_BREAK case 45: # line 235 "scan.l" ++linenum; - YY_BREAK + YY_BREAK case 46: *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ # line 238 "scan.l" { - ++linenum; - ACTION_ECHO; - MARK_END_OF_PROLOG; - BEGIN(SECT2); - } - YY_BREAK + ++linenum; + ACTION_ECHO; + MARK_END_OF_PROLOG; + BEGIN(SECT2); + } + YY_BREAK case 47: # line 245 "scan.l" ++linenum; ACTION_ECHO; - YY_BREAK + YY_BREAK case YY_STATE_EOF(SECT2PROLOG): # line 247 "scan.l" MARK_END_OF_PROLOG; yyterminate(); - YY_BREAK + YY_BREAK case 49: # line 249 "scan.l" ++linenum; /* allow blank lines in section 2 */ - YY_BREAK + YY_BREAK case 50: # line 251 "scan.l" { - indented_code = (yytext[0] != '%'); - doing_codeblock = true; - bracelevel = 1; + indented_code = (yytext[0] != '%'); + doing_codeblock = true; + bracelevel = 1; - if ( indented_code ) - ACTION_ECHO; + if ( indented_code ) + ACTION_ECHO; - BEGIN(CODEBLOCK_2); - } - YY_BREAK + BEGIN(CODEBLOCK_2); + } + YY_BREAK case 51: # line 262 "scan.l" BEGIN(SC); return ( '<' ); - YY_BREAK + YY_BREAK case 52: # line 263 "scan.l" return ( '^' ); - YY_BREAK + YY_BREAK case 53: # line 264 "scan.l" BEGIN(QUOTE); return ( '"' ); - YY_BREAK + YY_BREAK case 54: *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ yy_c_buf_p = yy_cp = yy_bp + 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ # line 265 "scan.l" BEGIN(NUM); return ( '{' ); - YY_BREAK + YY_BREAK case 55: # line 266 "scan.l" BEGIN(BRACEERROR); - YY_BREAK + YY_BREAK case 56: *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ yy_c_buf_p = yy_cp = yy_bp + 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ # line 267 "scan.l" return ( '$' ); - YY_BREAK + YY_BREAK case 57: # line 269 "scan.l" { - bracelevel = 1; - BEGIN(PERCENT_BRACE_ACTION); - return ( '\n' ); - } - YY_BREAK + bracelevel = 1; + BEGIN(PERCENT_BRACE_ACTION); + return ( '\n' ); + } + YY_BREAK case 58: # line 274 "scan.l" continued_action = true; ++linenum; return ( '\n' ); - YY_BREAK + YY_BREAK case 59: # line 276 "scan.l" { - /* this rule is separate from the one below because - * otherwise we get variable trailing context, so - * we can't build the scanner using -{f,F} - */ - bracelevel = 0; - continued_action = false; - BEGIN(ACTION); - return ( '\n' ); - } - YY_BREAK + /* this rule is separate from the one below because + * otherwise we get variable trailing context, so + * we can't build the scanner using -{f,F} + */ + bracelevel = 0; + continued_action = false; + BEGIN(ACTION); + return ( '\n' ); + } + YY_BREAK case 60: # line 287 "scan.l" { - bracelevel = 0; - continued_action = false; - BEGIN(ACTION); - return ( '\n' ); - } - YY_BREAK + bracelevel = 0; + continued_action = false; + BEGIN(ACTION); + return ( '\n' ); + } + YY_BREAK case 61: # line 294 "scan.l" ++linenum; return ( '\n' ); - YY_BREAK + YY_BREAK case 62: # line 296 "scan.l" return ( EOF_OP ); - YY_BREAK + YY_BREAK case 63: # line 298 "scan.l" { - sectnum = 3; - BEGIN(SECT3); - return ( EOF ); /* to stop the parser */ - } - YY_BREAK + sectnum = 3; + BEGIN(SECT3); + return ( EOF ); /* to stop the parser */ + } + YY_BREAK case 64: # line 304 "scan.l" { - int cclval; + int cclval; - (void) strcpy( nmstr, (char *) yytext ); + (void) strcpy( nmstr, (char *) yytext ); - /* check to see if we've already encountered this ccl */ - if ( (cclval = ccllookup( (Char *) nmstr )) ) - { - yylval = cclval; - ++cclreuse; - return ( PREVCCL ); - } - else - { - /* we fudge a bit. We know that this ccl will - * soon be numbered as lastccl + 1 by cclinit - */ - cclinstal( (Char *) nmstr, lastccl + 1 ); + /* check to see if we've already encountered this ccl */ + if ( (cclval = ccllookup( (Char *) nmstr )) ) + { + yylval = cclval; + ++cclreuse; + return ( PREVCCL ); + } + else + { + /* we fudge a bit. We know that this ccl will + * soon be numbered as lastccl + 1 by cclinit + */ + cclinstal( (Char *) nmstr, lastccl + 1 ); - /* push back everything but the leading bracket - * so the ccl can be rescanned - */ - PUT_BACK_STRING((Char *) nmstr, 1); + /* push back everything but the leading bracket + * so the ccl can be rescanned + */ + PUT_BACK_STRING((Char *) nmstr, 1); - BEGIN(FIRSTCCL); - return ( '[' ); - } - } - YY_BREAK + BEGIN(FIRSTCCL); + return ( '[' ); + } + } + YY_BREAK case 65: # line 333 "scan.l" { - Char *nmdefptr; - Char *ndlookup(); + Char *nmdefptr; + Char *ndlookup(); - (void) strcpy( nmstr, (char *) yytext ); - nmstr[yyleng - 1] = '\0'; /* chop trailing brace */ + (void) strcpy( nmstr, (char *) yytext ); + nmstr[yyleng - 1] = '\0'; /* chop trailing brace */ - /* lookup from "nmstr + 1" to chop leading brace */ - if ( ! (nmdefptr = ndlookup( nmstr + 1 )) ) - synerr( "undefined {name}" ); + /* lookup from "nmstr + 1" to chop leading brace */ + if ( ! (nmdefptr = ndlookup( nmstr + 1 )) ) + synerr( "undefined {name}" ); - else - { /* push back name surrounded by ()'s */ - unput(')'); - PUT_BACK_STRING(nmdefptr, 0); - unput('('); - } - } - YY_BREAK + else + { /* push back name surrounded by ()'s */ + unput(')'); + PUT_BACK_STRING(nmdefptr, 0); + unput('('); + } + } + YY_BREAK case 66: # line 352 "scan.l" return ( yytext[0] ); - YY_BREAK + YY_BREAK case 67: # line 353 "scan.l" RETURNCHAR; - YY_BREAK + YY_BREAK case 68: # line 354 "scan.l" ++linenum; return ( '\n' ); - YY_BREAK + YY_BREAK case 69: # line 357 "scan.l" return ( ',' ); - YY_BREAK + YY_BREAK case 70: # line 358 "scan.l" BEGIN(SECT2); return ( '>' ); - YY_BREAK + YY_BREAK case 71: *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ yy_c_buf_p = yy_cp = yy_bp + 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ # line 359 "scan.l" BEGIN(CARETISBOL); return ( '>' ); - YY_BREAK + YY_BREAK case 72: # line 360 "scan.l" RETURNNAME; - YY_BREAK + YY_BREAK case 73: # line 361 "scan.l" synerr( "bad start condition name" ); - YY_BREAK + YY_BREAK case 74: # line 363 "scan.l" BEGIN(SECT2); return ( '^' ); - YY_BREAK + YY_BREAK case 75: # line 366 "scan.l" RETURNCHAR; - YY_BREAK + YY_BREAK case 76: # line 367 "scan.l" BEGIN(SECT2); return ( '"' ); - YY_BREAK + YY_BREAK case 77: # line 369 "scan.l" { - synerr( "missing quote" ); - BEGIN(SECT2); - ++linenum; - return ( '"' ); - } - YY_BREAK + synerr( "missing quote" ); + BEGIN(SECT2); + ++linenum; + return ( '"' ); + } + YY_BREAK case 78: *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ yy_c_buf_p = yy_cp = yy_bp + 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ # line 377 "scan.l" BEGIN(CCL); return ( '^' ); - YY_BREAK + YY_BREAK case 79: *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ yy_c_buf_p = yy_cp = yy_bp + 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ # line 378 "scan.l" return ( '^' ); - YY_BREAK + YY_BREAK case 80: # line 379 "scan.l" BEGIN(CCL); yylval = '-'; return ( CHAR ); - YY_BREAK + YY_BREAK case 81: # line 380 "scan.l" BEGIN(CCL); RETURNCHAR; - YY_BREAK + YY_BREAK case 82: *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ yy_c_buf_p = yy_cp = yy_bp + 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ # line 382 "scan.l" return ( '-' ); - YY_BREAK + YY_BREAK case 83: # line 383 "scan.l" RETURNCHAR; - YY_BREAK + YY_BREAK case 84: # line 384 "scan.l" BEGIN(SECT2); return ( ']' ); - YY_BREAK + YY_BREAK case 85: # line 387 "scan.l" { - yylval = myctoi( yytext ); - return ( NUMBER ); - } - YY_BREAK + yylval = myctoi( yytext ); + return ( NUMBER ); + } + YY_BREAK case 86: # line 392 "scan.l" return ( ',' ); - YY_BREAK + YY_BREAK case 87: # line 393 "scan.l" BEGIN(SECT2); return ( '}' ); - YY_BREAK + YY_BREAK case 88: # line 395 "scan.l" { - synerr( "bad character inside {}'s" ); - BEGIN(SECT2); - return ( '}' ); - } - YY_BREAK + synerr( "bad character inside {}'s" ); + BEGIN(SECT2); + return ( '}' ); + } + YY_BREAK case 89: # line 401 "scan.l" { - synerr( "missing }" ); - BEGIN(SECT2); - ++linenum; - return ( '}' ); - } - YY_BREAK + synerr( "missing }" ); + BEGIN(SECT2); + ++linenum; + return ( '}' ); + } + YY_BREAK case 90: # line 409 "scan.l" synerr( "bad name in {}'s" ); BEGIN(SECT2); - YY_BREAK + YY_BREAK case 91: # line 410 "scan.l" synerr( "missing }" ); ++linenum; BEGIN(SECT2); - YY_BREAK + YY_BREAK case 92: # line 413 "scan.l" bracelevel = 0; - YY_BREAK + YY_BREAK case 93: # line 414 "scan.l" { - ACTION_ECHO; - CHECK_REJECT(yytext); - } - YY_BREAK + ACTION_ECHO; + CHECK_REJECT(yytext); + } + YY_BREAK case 94: # line 418 "scan.l" { - ACTION_ECHO; - CHECK_YYMORE(yytext); - } - YY_BREAK + ACTION_ECHO; + CHECK_YYMORE(yytext); + } + YY_BREAK case 95: # line 422 "scan.l" ACTION_ECHO; - YY_BREAK + YY_BREAK case 96: # line 423 "scan.l" { - ++linenum; - ACTION_ECHO; - if ( bracelevel == 0 || - (doing_codeblock && indented_code) ) - { - if ( ! doing_codeblock ) - fputs( "\tYY_BREAK\n", temp_action_file ); - - doing_codeblock = false; - BEGIN(SECT2); - } - } - YY_BREAK - /* Reject and YYmore() are checked for above, in PERCENT_BRACE_ACTION */ + ++linenum; + ACTION_ECHO; + if ( bracelevel == 0 || + (doing_codeblock && indented_code) ) + { + if ( ! doing_codeblock ) + fputs( "\tYY_BREAK\n", temp_action_file ); + + doing_codeblock = false; + BEGIN(SECT2); + } + } + YY_BREAK + /* Reject and YYmore() are checked for above, in PERCENT_BRACE_ACTION */ case 97: # line 439 "scan.l" ACTION_ECHO; ++bracelevel; - YY_BREAK + YY_BREAK case 98: # line 440 "scan.l" ACTION_ECHO; --bracelevel; - YY_BREAK + YY_BREAK case 99: # line 441 "scan.l" ACTION_ECHO; - YY_BREAK + YY_BREAK case 100: # line 442 "scan.l" ACTION_ECHO; - YY_BREAK + YY_BREAK case 101: # line 443 "scan.l" ACTION_ECHO; BEGIN(ACTION_COMMENT); - YY_BREAK + YY_BREAK case 102: # line 444 "scan.l" ACTION_ECHO; /* character constant */ - YY_BREAK + YY_BREAK case 103: # line 445 "scan.l" ACTION_ECHO; BEGIN(ACTION_STRING); - YY_BREAK + YY_BREAK case 104: # line 446 "scan.l" { - ++linenum; - ACTION_ECHO; - if ( bracelevel == 0 ) - { - fputs( "\tYY_BREAK\n", temp_action_file ); - BEGIN(SECT2); - } - } - YY_BREAK + ++linenum; + ACTION_ECHO; + if ( bracelevel == 0 ) + { + fputs( "\tYY_BREAK\n", temp_action_file ); + BEGIN(SECT2); + } + } + YY_BREAK case 105: # line 455 "scan.l" ACTION_ECHO; - YY_BREAK + YY_BREAK case 106: # line 457 "scan.l" ACTION_ECHO; BEGIN(ACTION); - YY_BREAK + YY_BREAK case 107: # line 458 "scan.l" ACTION_ECHO; - YY_BREAK + YY_BREAK case 108: # line 459 "scan.l" ACTION_ECHO; - YY_BREAK + YY_BREAK case 109: # line 460 "scan.l" ++linenum; ACTION_ECHO; - YY_BREAK + YY_BREAK case 110: # line 461 "scan.l" ACTION_ECHO; - YY_BREAK + YY_BREAK case 111: # line 463 "scan.l" ACTION_ECHO; - YY_BREAK + YY_BREAK case 112: # line 464 "scan.l" ACTION_ECHO; - YY_BREAK + YY_BREAK case 113: # line 465 "scan.l" ++linenum; ACTION_ECHO; - YY_BREAK + YY_BREAK case 114: # line 466 "scan.l" ACTION_ECHO; BEGIN(ACTION); - YY_BREAK + YY_BREAK case 115: # line 467 "scan.l" ACTION_ECHO; - YY_BREAK + YY_BREAK case YY_STATE_EOF(ACTION): case YY_STATE_EOF(ACTION_COMMENT): case YY_STATE_EOF(ACTION_STRING): # line 469 "scan.l" { - synerr( "EOF encountered inside an action" ); - yyterminate(); - } - YY_BREAK + synerr( "EOF encountered inside an action" ); + yyterminate(); + } + YY_BREAK case 117: # line 475 "scan.l" { - yylval = myesc( yytext ); - return ( CHAR ); - } - YY_BREAK + yylval = myesc( yytext ); + return ( CHAR ); + } + YY_BREAK case 118: # line 480 "scan.l" { - yylval = myesc( yytext ); - BEGIN(CCL); - return ( CHAR ); - } - YY_BREAK + yylval = myesc( yytext ); + BEGIN(CCL); + return ( CHAR ); + } + YY_BREAK case 119: # line 487 "scan.l" ECHO; - YY_BREAK + YY_BREAK case 120: # line 488 "scan.l" ECHO; - YY_BREAK - case YY_STATE_EOF(INITIAL): - case YY_STATE_EOF(SECT2): - case YY_STATE_EOF(SECT3): - case YY_STATE_EOF(CODEBLOCK): - case YY_STATE_EOF(PICKUPDEF): - case YY_STATE_EOF(SC): - case YY_STATE_EOF(CARETISBOL): - case YY_STATE_EOF(NUM): - case YY_STATE_EOF(QUOTE): - case YY_STATE_EOF(FIRSTCCL): - case YY_STATE_EOF(CCL): - case YY_STATE_EOF(RECOVER): - case YY_STATE_EOF(BRACEERROR): - case YY_STATE_EOF(C_COMMENT): - case YY_STATE_EOF(PERCENT_BRACE_ACTION): - case YY_STATE_EOF(USED_LIST): - case YY_STATE_EOF(CODEBLOCK_2): - case YY_STATE_EOF(XLATION): - yyterminate(); + YY_BREAK + case YY_STATE_EOF(INITIAL): + case YY_STATE_EOF(SECT2): + case YY_STATE_EOF(SECT3): + case YY_STATE_EOF(CODEBLOCK): + case YY_STATE_EOF(PICKUPDEF): + case YY_STATE_EOF(SC): + case YY_STATE_EOF(CARETISBOL): + case YY_STATE_EOF(NUM): + case YY_STATE_EOF(QUOTE): + case YY_STATE_EOF(FIRSTCCL): + case YY_STATE_EOF(CCL): + case YY_STATE_EOF(RECOVER): + case YY_STATE_EOF(BRACEERROR): + case YY_STATE_EOF(C_COMMENT): + case YY_STATE_EOF(PERCENT_BRACE_ACTION): + case YY_STATE_EOF(USED_LIST): + case YY_STATE_EOF(CODEBLOCK_2): + case YY_STATE_EOF(XLATION): + yyterminate(); - case YY_END_OF_BUFFER: - { - /* amount of text matched not including the EOB char */ - int yy_amount_of_matched_text = yy_cp - yytext - 1; + case YY_END_OF_BUFFER: + { + /* amount of text matched not including the EOB char */ + int yy_amount_of_matched_text = yy_cp - yytext - 1; - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yy_hold_char; - /* note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the end- - * of-buffer state). Contrast this with the test in yyinput(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* this was really a NUL */ - { - yy_state_type yy_next_state; + /* note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the end- + * of-buffer state). Contrast this with the test in yyinput(). + */ + if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* this was really a NUL */ + { + yy_state_type yy_next_state; - yy_c_buf_p = yytext + yy_amount_of_matched_text; + yy_c_buf_p = yytext + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state(); - /* okay, we're now positioned to make the - * NUL transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we - * don't want to build jamming into it because - * then it will run more slowly) - */ + /* okay, we're now positioned to make the + * NUL transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we + * don't want to build jamming into it because + * then it will run more slowly) + */ - yy_next_state = yy_try_NUL_trans( yy_current_state ); + yy_next_state = yy_try_NUL_trans( yy_current_state ); - yy_bp = yytext + YY_MORE_ADJ; + yy_bp = yytext + YY_MORE_ADJ; - if ( yy_next_state ) - { - /* consume the NUL */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } + if ( yy_next_state ) + { + /* consume the NUL */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } - else - { - goto yy_find_action; - } - } + else + { + goto yy_find_action; + } + } - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; - if ( yywrap() ) - { - /* note: because we've taken care in - * yy_get_next_buffer() to have set up yytext, - * we can now set up yy_c_buf_p so that if some - * total hoser (like flex itself) wants - * to call the scanner after we return the - * YY_NULL, it'll still work - another YY_NULL - * will get returned. - */ - yy_c_buf_p = yytext + YY_MORE_ADJ; + if ( yywrap() ) + { + /* note: because we've taken care in + * yy_get_next_buffer() to have set up yytext, + * we can now set up yy_c_buf_p so that if some + * total hoser (like flex itself) wants + * to call the scanner after we return the + * YY_NULL, it'll still work - another YY_NULL + * will get returned. + */ + yy_c_buf_p = yytext + YY_MORE_ADJ; - yy_act = YY_STATE_EOF((yy_start - 1) / 2); - goto do_action; - } + yy_act = YY_STATE_EOF((yy_start - 1) / 2); + goto do_action; + } - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - } - break; + else + { + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + } + break; - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext + yy_amount_of_matched_text; + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state(); - yy_cp = yy_c_buf_p; - yy_bp = yytext + YY_MORE_ADJ; - goto yy_match; + yy_cp = yy_c_buf_p; + yy_bp = yytext + YY_MORE_ADJ; + goto yy_match; - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state(); - yy_cp = yy_c_buf_p; - yy_bp = yytext + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } + yy_cp = yy_c_buf_p; + yy_bp = yytext + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } - default: + default: #ifdef FLEX_DEBUG - printf( "action # %d\n", yy_act ); + printf( "action # %d\n", yy_act ); #endif - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } - } + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } + } } @@ -1930,9 +1930,9 @@ ECHO; * * synopsis * int yy_get_next_buffer(); - * + * * returns a code representing an action - * EOB_ACT_LAST_MATCH - + * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ @@ -1946,8 +1946,8 @@ static int yy_get_next_buffer() int ret_val; if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); /* try to read more data */ @@ -1955,46 +1955,46 @@ static int yy_get_next_buffer() number_to_move = yy_c_buf_p - yytext; for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); + *(dest++) = *(source++); if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_n_chars = 0; + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + yy_n_chars = 0; else - { - int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; + { + int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; - else if ( num_to_read <= 0 ) - YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); + else if ( num_to_read <= 0 ) + YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); - /* read in more data */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); - } + /* read in more data */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + } if ( yy_n_chars == 0 ) - { - if ( number_to_move == 1 ) - { - ret_val = EOB_ACT_END_OF_FILE; - yy_current_buffer->yy_eof_status = EOF_DONE; - } + { + if ( number_to_move == 1 ) + { + ret_val = EOB_ACT_END_OF_FILE; + yy_current_buffer->yy_eof_status = EOF_DONE; + } - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_eof_status = EOF_PENDING; - } - } + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_eof_status = EOF_PENDING; + } + } else - ret_val = EOB_ACT_CONTINUE_SCAN; + ret_val = EOB_ACT_CONTINUE_SCAN; yy_n_chars += number_to_move; yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; @@ -2028,22 +2028,22 @@ static yy_state_type yy_get_previous_state() yy_current_state = yy_start; if ( yy_bp[-1] == '\n' ) - ++yy_current_state; + ++yy_current_state; yy_state_ptr = yy_state_buf; *yy_state_ptr++ = yy_current_state; for ( yy_cp = yytext + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { - YY_CHAR yy_c = (*yy_cp ? yy_ec[(int)*yy_cp] : 1); - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = yy_def[yy_current_state]; - if ( yy_current_state >= 391 ) - yy_c = yy_meta[(int)yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - *yy_state_ptr++ = yy_current_state; - } + { + YY_CHAR yy_c = (*yy_cp ? yy_ec[(int)*yy_cp] : 1); + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = yy_def[yy_current_state]; + if ( yy_current_state >= 391 ) + yy_c = yy_meta[(int)yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + *yy_state_ptr++ = yy_current_state; + } return ( yy_current_state ); } @@ -2061,11 +2061,11 @@ static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) YY_CHAR yy_c = 1; while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = yy_def[yy_current_state]; - if ( yy_current_state >= 391 ) - yy_c = yy_meta[(int)yy_c]; - } + { + yy_current_state = yy_def[yy_current_state]; + if ( yy_current_state >= 391 ) + yy_c = yy_meta[(int)yy_c]; + } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; *yy_state_ptr++ = yy_current_state; yy_is_jam = (yy_current_state == 390); @@ -2082,26 +2082,26 @@ static void yyunput( YY_CHAR c, YY_CHAR *yy_bp ) *yy_cp = yy_hold_char; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */ - YY_CHAR *dest = - &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2]; - YY_CHAR *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; + { /* need to shift things up to make room */ + int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */ + YY_CHAR *dest = + &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2]; + YY_CHAR *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; - yy_cp += dest - source; - yy_bp += dest - source; - yy_n_chars = yy_current_buffer->yy_buf_size; + yy_cp += dest - source; + yy_bp += dest - source; + yy_n_chars = yy_current_buffer->yy_buf_size; - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } if ( yy_cp > yy_bp && yy_cp[-1] == '\n' ) - yy_cp[-2] = '\n'; + yy_cp[-2] = '\n'; *--yy_cp = c; @@ -2122,15 +2122,15 @@ void yyrestart( FILE *input_file ) void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) { if ( yy_current_buffer == new_buffer ) - return; + return; if ( yy_current_buffer ) - { - /* flush out information for old buffer */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; - } + { + /* flush out information for old buffer */ + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } yy_current_buffer = new_buffer; yy_load_buffer_state(); @@ -2160,7 +2160,7 @@ YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) b = (YY_BUFFER_STATE) malloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; @@ -2170,7 +2170,7 @@ YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) b->yy_ch_buf = (YY_CHAR *) malloc( (unsigned) (b->yy_buf_size + 2) ); if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); yy_init_buffer( b, file ); @@ -2181,7 +2181,7 @@ YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) void yy_delete_buffer( YY_BUFFER_STATE b ) { if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; + yy_current_buffer = (YY_BUFFER_STATE) 0; free( (char *) b->yy_ch_buf ); free( (char *) b ); @@ -2218,13 +2218,13 @@ int yywrap() { if ( --num_input_files > 0 ) - { - set_input_file( *++input_files ); - return ( 0 ); - } + { + set_input_file( *++input_files ); + return ( 0 ); + } else - return ( 1 ); + return ( 1 ); } @@ -2235,17 +2235,17 @@ char *file; { if ( file ) - { - infilename = file; - yyin = fopen( infilename, "r" ); + { + infilename = file; + yyin = fopen( infilename, "r" ); - if ( yyin == NULL ) - lerrsf( "can't open %s", file ); - } + if ( yyin == NULL ) + lerrsf( "can't open %s", file ); + } else - { - yyin = stdin; - infilename = ""; - } + { + yyin = stdin; + infilename = ""; + } } diff --git a/modules/libcom/src/flex/sym.c b/modules/libcom/src/flex/sym.c index 45e1c5409..8a4e26516 100644 --- a/modules/libcom/src/flex/sym.c +++ b/modules/libcom/src/flex/sym.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* sym - symbol table routines */ @@ -14,7 +14,7 @@ * * This code is derived from software contributed to Berkeley by * Vern Paxson. - * + * * The United States Government has rights in this work pursuant * to contract no. DE-AC03-76SF00098 between the United States * Department of Energy and the University of California. @@ -69,28 +69,28 @@ int addsym(char *sym, char *str_def, int int_def, struct hash_entry **table, int struct hash_entry *successor; while ( sym_entry ) - { - if ( ! strcmp( sym, sym_entry->name ) ) - { /* entry already exists */ - return ( -1 ); - } - - sym_entry = sym_entry->next; - } + { + if ( ! strcmp( sym, sym_entry->name ) ) + { /* entry already exists */ + return ( -1 ); + } + + sym_entry = sym_entry->next; + } /* create new entry */ new_entry = (struct hash_entry *) malloc( sizeof( struct hash_entry ) ); if ( new_entry == NULL ) - flexfatal( "symbol table memory allocation failed" ); + flexfatal( "symbol table memory allocation failed" ); if ( (successor = table[hash_val]) ) - { - new_entry->next = successor; - successor->prev = new_entry; - } + { + new_entry->next = successor; + successor->prev = new_entry; + } else - new_entry->next = NULL; + new_entry->next = NULL; new_entry->prev = NULL; new_entry->name = sym; @@ -119,7 +119,7 @@ void cclinstal(Char *ccltxt, int cclnum) Char *copy_unsigned_string(); (void) addsym( (char *) copy_unsigned_string( ccltxt ), (char *) 0, cclnum, - ccltab, CCL_HASH_SIZE ); + ccltab, CCL_HASH_SIZE ); } @@ -151,21 +151,21 @@ struct hash_entry *findsym(char *sym, struct hash_entry **table, int table_size) { struct hash_entry *sym_entry = table[hashfunct( sym, table_size )]; static struct hash_entry empty_entry = - { - (struct hash_entry *) 0, (struct hash_entry *) 0, NULL, NULL, 0, - } ; + { + (struct hash_entry *) 0, (struct hash_entry *) 0, NULL, NULL, 0, + } ; while ( sym_entry ) - { - if ( ! strcmp( sym, sym_entry->name ) ) - return ( sym_entry ); - sym_entry = sym_entry->next; - } + { + if ( ! strcmp( sym, sym_entry->name ) ) + return ( sym_entry ); + sym_entry = sym_entry->next; + } return ( &empty_entry ); } - + /* hashfunct - compute the hash value for "str" and hash size "hash_size" * * synopsis @@ -183,7 +183,7 @@ int hashfunct(char *str, int hash_size) locstr = 0; while ( str[locstr] ) - hashval = ((hashval << 1) + str[locstr++]) % hash_size; + hashval = ((hashval << 1) + str[locstr++]) % hash_size; return ( hashval ); } @@ -203,8 +203,8 @@ void ndinstal(char *nd, Char *def) Char *copy_unsigned_string(); if ( addsym( copy_string( nd ), (char *) copy_unsigned_string( def ), 0, - ndtbl, NAME_TABLE_HASH_SIZE ) ) - synerr( "name defined twice" ); + ndtbl, NAME_TABLE_HASH_SIZE ) ) + synerr( "name defined twice" ); } @@ -247,27 +247,27 @@ void scinstal(char *str, int xcluflg) */ if ( strcmp( str, "0" ) ) - printf( "#define %s %d\n", str, lastsc ); + printf( "#define %s %d\n", str, lastsc ); if ( ++lastsc >= current_max_scs ) - { - current_max_scs += MAX_SCS_INCREMENT; + { + current_max_scs += MAX_SCS_INCREMENT; - ++num_reallocs; + ++num_reallocs; - scset = reallocate_integer_array( scset, current_max_scs ); - scbol = reallocate_integer_array( scbol, current_max_scs ); - scxclu = reallocate_integer_array( scxclu, current_max_scs ); - sceof = reallocate_integer_array( sceof, current_max_scs ); - scname = reallocate_char_ptr_array( scname, current_max_scs ); - actvsc = reallocate_integer_array( actvsc, current_max_scs ); - } + scset = reallocate_integer_array( scset, current_max_scs ); + scbol = reallocate_integer_array( scbol, current_max_scs ); + scxclu = reallocate_integer_array( scxclu, current_max_scs ); + sceof = reallocate_integer_array( sceof, current_max_scs ); + scname = reallocate_char_ptr_array( scname, current_max_scs ); + actvsc = reallocate_integer_array( actvsc, current_max_scs ); + } scname[lastsc] = copy_string( str ); if ( addsym( scname[lastsc], (char *) 0, lastsc, - sctbl, START_COND_HASH_SIZE ) ) - format_pinpoint_message( "start condition %s declared twice", str ); + sctbl, START_COND_HASH_SIZE ) ) + format_pinpoint_message( "start condition %s declared twice", str ); scset[lastsc] = mkstate( SYM_EPSILON ); scbol[lastsc] = mkstate( SYM_EPSILON ); diff --git a/modules/libcom/src/flex/tblcmp.c b/modules/libcom/src/flex/tblcmp.c index 3e4c4744b..d0961c0c5 100644 --- a/modules/libcom/src/flex/tblcmp.c +++ b/modules/libcom/src/flex/tblcmp.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* tblcmp - table compression routines */ @@ -14,7 +14,7 @@ * * This code is derived from software contributed to Berkeley by * Vern Paxson. - * + * * The United States Government has rights in this work pursuant * to contract no. DE-AC03-76SF00098 between the United States * Department of Energy and the University of California. @@ -104,111 +104,111 @@ void bldtbl(int *state, int statenum, int totaltrans, int comstate, int comfreq) */ if ( (totaltrans * 100) < (numecs * PROTO_SIZE_PERCENTAGE) ) - mkentry( state, numecs, statenum, JAMSTATE, totaltrans ); + mkentry( state, numecs, statenum, JAMSTATE, totaltrans ); else - { - /* checkcom is true if we should only check "state" against - * protos which have the same "comstate" value - */ + { + /* checkcom is true if we should only check "state" against + * protos which have the same "comstate" value + */ - checkcom = comfreq * 100 > totaltrans * CHECK_COM_PERCENTAGE; + checkcom = comfreq * 100 > totaltrans * CHECK_COM_PERCENTAGE; - minprot = firstprot; - mindiff = totaltrans; + minprot = firstprot; + mindiff = totaltrans; - if ( checkcom ) - { - /* find first proto which has the same "comstate" */ - for ( i = firstprot; i != NIL; i = protnext[i] ) - if ( protcomst[i] == comstate ) - { - minprot = i; - mindiff = tbldiff( state, minprot, extrct[extptr] ); - break; - } - } + if ( checkcom ) + { + /* find first proto which has the same "comstate" */ + for ( i = firstprot; i != NIL; i = protnext[i] ) + if ( protcomst[i] == comstate ) + { + minprot = i; + mindiff = tbldiff( state, minprot, extrct[extptr] ); + break; + } + } - else - { - /* since we've decided that the most common destination out - * of "state" does not occur with a high enough frequency, - * we set the "comstate" to zero, assuring that if this state - * is entered into the proto list, it will not be considered - * a template. - */ - comstate = 0; + else + { + /* since we've decided that the most common destination out + * of "state" does not occur with a high enough frequency, + * we set the "comstate" to zero, assuring that if this state + * is entered into the proto list, it will not be considered + * a template. + */ + comstate = 0; - if ( firstprot != NIL ) - { - minprot = firstprot; - mindiff = tbldiff( state, minprot, extrct[extptr] ); - } - } + if ( firstprot != NIL ) + { + minprot = firstprot; + mindiff = tbldiff( state, minprot, extrct[extptr] ); + } + } - /* we now have the first interesting proto in "minprot". If - * it matches within the tolerances set for the first proto, - * we don't want to bother scanning the rest of the proto list - * to see if we have any other reasonable matches. - */ + /* we now have the first interesting proto in "minprot". If + * it matches within the tolerances set for the first proto, + * we don't want to bother scanning the rest of the proto list + * to see if we have any other reasonable matches. + */ - if ( mindiff * 100 > totaltrans * FIRST_MATCH_DIFF_PERCENTAGE ) - { /* not a good enough match. Scan the rest of the protos */ - for ( i = minprot; i != NIL; i = protnext[i] ) - { - d = tbldiff( state, i, extrct[1 - extptr] ); - if ( d < mindiff ) - { - extptr = 1 - extptr; - mindiff = d; - minprot = i; - } - } - } + if ( mindiff * 100 > totaltrans * FIRST_MATCH_DIFF_PERCENTAGE ) + { /* not a good enough match. Scan the rest of the protos */ + for ( i = minprot; i != NIL; i = protnext[i] ) + { + d = tbldiff( state, i, extrct[1 - extptr] ); + if ( d < mindiff ) + { + extptr = 1 - extptr; + mindiff = d; + minprot = i; + } + } + } - /* check if the proto we've decided on as our best bet is close - * enough to the state we want to match to be usable - */ + /* check if the proto we've decided on as our best bet is close + * enough to the state we want to match to be usable + */ - if ( mindiff * 100 > totaltrans * ACCEPTABLE_DIFF_PERCENTAGE ) - { - /* no good. If the state is homogeneous enough, we make a - * template out of it. Otherwise, we make a proto. - */ + if ( mindiff * 100 > totaltrans * ACCEPTABLE_DIFF_PERCENTAGE ) + { + /* no good. If the state is homogeneous enough, we make a + * template out of it. Otherwise, we make a proto. + */ - if ( comfreq * 100 >= totaltrans * TEMPLATE_SAME_PERCENTAGE ) - mktemplate( state, statenum, comstate ); + if ( comfreq * 100 >= totaltrans * TEMPLATE_SAME_PERCENTAGE ) + mktemplate( state, statenum, comstate ); - else - { - mkprot( state, statenum, comstate ); - mkentry( state, numecs, statenum, JAMSTATE, totaltrans ); - } - } + else + { + mkprot( state, statenum, comstate ); + mkentry( state, numecs, statenum, JAMSTATE, totaltrans ); + } + } - else - { /* use the proto */ - mkentry( extrct[extptr], numecs, statenum, - prottbl[minprot], mindiff ); + else + { /* use the proto */ + mkentry( extrct[extptr], numecs, statenum, + prottbl[minprot], mindiff ); - /* if this state was sufficiently different from the proto - * we built it from, make it, too, a proto - */ + /* if this state was sufficiently different from the proto + * we built it from, make it, too, a proto + */ - if ( mindiff * 100 >= totaltrans * NEW_PROTO_DIFF_PERCENTAGE ) - mkprot( state, statenum, comstate ); + if ( mindiff * 100 >= totaltrans * NEW_PROTO_DIFF_PERCENTAGE ) + mkprot( state, statenum, comstate ); - /* since mkprot added a new proto to the proto queue, it's possible - * that "minprot" is no longer on the proto queue (if it happened - * to have been the last entry, it would have been bumped off). - * If it's not there, then the new proto took its physical place - * (though logically the new proto is at the beginning of the - * queue), so in that case the following call will do nothing. - */ + /* since mkprot added a new proto to the proto queue, it's possible + * that "minprot" is no longer on the proto queue (if it happened + * to have been the last entry, it would have been bumped off). + * If it's not there, then the new proto took its physical place + * (though logically the new proto is at the beginning of the + * queue), so in that case the following call will do nothing. + */ - mv2front( minprot ); - } - } + mv2front( minprot ); + } + } } @@ -234,62 +234,62 @@ void cmptmps(void) peakpairs = numtemps * numecs + tblend; if ( usemecs ) - { - /* create equivalence classes base on data gathered on template - * transitions - */ + { + /* create equivalence classes base on data gathered on template + * transitions + */ + + nummecs = cre8ecs( tecfwd, tecbck, numecs ); + } - nummecs = cre8ecs( tecfwd, tecbck, numecs ); - } - else - nummecs = numecs; + nummecs = numecs; if ( lastdfa + numtemps + 1 >= current_max_dfas ) - increase_max_dfas(); + increase_max_dfas(); /* loop through each template */ for ( i = 1; i <= numtemps; ++i ) - { - totaltrans = 0; /* number of non-jam transitions out of this template */ + { + totaltrans = 0; /* number of non-jam transitions out of this template */ - for ( j = 1; j <= numecs; ++j ) - { - trans = tnxt[numecs * i + j]; + for ( j = 1; j <= numecs; ++j ) + { + trans = tnxt[numecs * i + j]; - if ( usemecs ) - { - /* the absolute value of tecbck is the meta-equivalence class - * of a given equivalence class, as set up by cre8ecs - */ - if ( tecbck[j] > 0 ) - { - tmp[tecbck[j]] = trans; + if ( usemecs ) + { + /* the absolute value of tecbck is the meta-equivalence class + * of a given equivalence class, as set up by cre8ecs + */ + if ( tecbck[j] > 0 ) + { + tmp[tecbck[j]] = trans; - if ( trans > 0 ) - ++totaltrans; - } - } + if ( trans > 0 ) + ++totaltrans; + } + } - else - { - tmp[j] = trans; + else + { + tmp[j] = trans; - if ( trans > 0 ) - ++totaltrans; - } - } + if ( trans > 0 ) + ++totaltrans; + } + } - /* it is assumed (in a rather subtle way) in the skeleton that - * if we're using meta-equivalence classes, the def[] entry for - * all templates is the jam template, i.e., templates never default - * to other non-jam table entries (e.g., another template) - */ + /* it is assumed (in a rather subtle way) in the skeleton that + * if we're using meta-equivalence classes, the def[] entry for + * all templates is the jam template, i.e., templates never default + * to other non-jam table entries (e.g., another template) + */ - /* leave room for the jam-state after the last real state */ - mkentry( tmp, nummecs, lastdfa + i + 1, JAMSTATE, totaltrans ); - } + /* leave room for the jam-state after the last real state */ + mkentry( tmp, nummecs, lastdfa + i + 1, JAMSTATE, totaltrans ); + } } @@ -308,7 +308,7 @@ void expand_nxt_chk(void) chk = reallocate_integer_array( chk, current_max_xpairs ); memset( (char *) (chk + old_max), 0, - MAX_XPAIRS_INCREMENT * sizeof( int ) / sizeof( char ) ); + MAX_XPAIRS_INCREMENT * sizeof( int ) / sizeof( char ) ); } @@ -344,76 +344,76 @@ int find_table_space(int *state, int numtrans) * nxt and chk */ if ( numtrans > MAX_XTIONS_FULL_INTERIOR_FIT ) - { - /* if table is empty, return the first available spot in chk/nxt, - * which should be 1 - */ - if ( tblend < 2 ) - return ( 1 ); + { + /* if table is empty, return the first available spot in chk/nxt, + * which should be 1 + */ + if ( tblend < 2 ) + return ( 1 ); - i = tblend - numecs; /* start searching for table space near the - * end of chk/nxt arrays - */ - } + i = tblend - numecs; /* start searching for table space near the + * end of chk/nxt arrays + */ + } else - i = firstfree; /* start searching for table space from the - * beginning (skipping only the elements - * which will definitely not hold the new - * state) - */ + i = firstfree; /* start searching for table space from the + * beginning (skipping only the elements + * which will definitely not hold the new + * state) + */ - while ( 1 ) /* loops until a space is found */ - { - if ( i + numecs > current_max_xpairs ) - expand_nxt_chk(); + while ( 1 ) /* loops until a space is found */ + { + if ( i + numecs > current_max_xpairs ) + expand_nxt_chk(); - /* loops until space for end-of-buffer and action number are found */ - while ( 1 ) - { - if ( chk[i - 1] == 0 ) /* check for action number space */ - { - if ( chk[i] == 0 ) /* check for end-of-buffer space */ - break; + /* loops until space for end-of-buffer and action number are found */ + while ( 1 ) + { + if ( chk[i - 1] == 0 ) /* check for action number space */ + { + if ( chk[i] == 0 ) /* check for end-of-buffer space */ + break; - else - i += 2; /* since i != 0, there is no use checking to - * see if (++i) - 1 == 0, because that's the - * same as i == 0, so we skip a space - */ - } + else + i += 2; /* since i != 0, there is no use checking to + * see if (++i) - 1 == 0, because that's the + * same as i == 0, so we skip a space + */ + } - else - ++i; + else + ++i; - if ( i + numecs > current_max_xpairs ) - expand_nxt_chk(); - } + if ( i + numecs > current_max_xpairs ) + expand_nxt_chk(); + } - /* if we started search from the beginning, store the new firstfree for - * the next call of find_table_space() - */ - if ( numtrans <= MAX_XTIONS_FULL_INTERIOR_FIT ) - firstfree = i + 1; + /* if we started search from the beginning, store the new firstfree for + * the next call of find_table_space() + */ + if ( numtrans <= MAX_XTIONS_FULL_INTERIOR_FIT ) + firstfree = i + 1; - /* check to see if all elements in chk (and therefore nxt) that are - * needed for the new state have not yet been taken - */ + /* check to see if all elements in chk (and therefore nxt) that are + * needed for the new state have not yet been taken + */ - state_ptr = &state[1]; - ptr_to_last_entry_in_state = &chk[i + numecs + 1]; + state_ptr = &state[1]; + ptr_to_last_entry_in_state = &chk[i + numecs + 1]; - for ( chk_ptr = &chk[i + 1]; chk_ptr != ptr_to_last_entry_in_state; - ++chk_ptr ) - if ( *(state_ptr++) != 0 && *chk_ptr != 0 ) - break; + for ( chk_ptr = &chk[i + 1]; chk_ptr != ptr_to_last_entry_in_state; + ++chk_ptr ) + if ( *(state_ptr++) != 0 && *chk_ptr != 0 ) + break; - if ( chk_ptr == ptr_to_last_entry_in_state ) - return ( i ); + if ( chk_ptr == ptr_to_last_entry_in_state ) + return ( i ); - else - ++i; - } + else + ++i; + } } @@ -439,22 +439,22 @@ void inittbl(void) numtemps = 0; if ( usemecs ) - { - /* set up doubly-linked meta-equivalence classes - * these are sets of equivalence classes which all have identical - * transitions out of TEMPLATES - */ + { + /* set up doubly-linked meta-equivalence classes + * these are sets of equivalence classes which all have identical + * transitions out of TEMPLATES + */ - tecbck[1] = NIL; + tecbck[1] = NIL; - for ( i = 2; i <= numecs; ++i ) - { - tecbck[i] = i - 1; - tecfwd[i - 1] = i; - } + for ( i = 2; i <= numecs; ++i ) + { + tecbck[i] = i - 1; + tecfwd[i - 1] = i; + } - tecfwd[numecs] = NIL; - } + tecfwd[numecs] = NIL; + } } @@ -473,17 +473,17 @@ void mkdeftbl(void) ++tblend; /* room for transition on end-of-buffer character */ if ( tblend + numecs > current_max_xpairs ) - expand_nxt_chk(); + expand_nxt_chk(); /* add in default end-of-buffer transition */ nxt[tblend] = end_of_buffer_state; chk[tblend] = jamstate; for ( i = 1; i <= numecs; ++i ) - { - nxt[tblend + i] = 0; - chk[tblend + i] = jamstate; - } + { + nxt[tblend + i] = 0; + chk[tblend + i] = jamstate; + } jambase = tblend; @@ -520,38 +520,38 @@ void mkentry(int *state, int numchars, int statenum, int deflink, int totaltrans int tblbase, tbllast; if ( totaltrans == 0 ) - { /* there are no out-transitions */ - if ( deflink == JAMSTATE ) - base[statenum] = JAMSTATE; - else - base[statenum] = 0; + { /* there are no out-transitions */ + if ( deflink == JAMSTATE ) + base[statenum] = JAMSTATE; + else + base[statenum] = 0; - def[statenum] = deflink; - return; - } + def[statenum] = deflink; + return; + } for ( minec = 1; minec <= numchars; ++minec ) - { - if ( state[minec] != SAME_TRANS ) - if ( state[minec] != 0 || deflink != JAMSTATE ) - break; - } + { + if ( state[minec] != SAME_TRANS ) + if ( state[minec] != 0 || deflink != JAMSTATE ) + break; + } if ( totaltrans == 1 ) - { - /* there's only one out-transition. Save it for later to fill - * in holes in the tables. - */ - stack1( statenum, minec, state[minec], deflink ); - return; - } + { + /* there's only one out-transition. Save it for later to fill + * in holes in the tables. + */ + stack1( statenum, minec, state[minec], deflink ); + return; + } for ( maxec = numchars; maxec > 0; --maxec ) - { - if ( state[maxec] != SAME_TRANS ) - if ( state[maxec] != 0 || deflink != JAMSTATE ) - break; - } + { + if ( state[maxec] != SAME_TRANS ) + if ( state[maxec] != 0 || deflink != JAMSTATE ) + break; + } /* Whether we try to fit the state table in the middle of the table * entries we have already generated, or if we just take the state @@ -565,72 +565,72 @@ void mkentry(int *state, int numchars, int statenum, int deflink, int totaltrans /* find the first transition of state that we need to worry about. */ if ( totaltrans * 100 <= numchars * INTERIOR_FIT_PERCENTAGE ) - { /* attempt to squeeze it into the middle of the tabls */ - baseaddr = firstfree; + { /* attempt to squeeze it into the middle of the tabls */ + baseaddr = firstfree; - while ( baseaddr < minec ) - { - /* using baseaddr would result in a negative base address below - * find the next free slot - */ - for ( ++baseaddr; chk[baseaddr] != 0; ++baseaddr ) - ; - } + while ( baseaddr < minec ) + { + /* using baseaddr would result in a negative base address below + * find the next free slot + */ + for ( ++baseaddr; chk[baseaddr] != 0; ++baseaddr ) + ; + } - if ( baseaddr + maxec - minec >= current_max_xpairs ) - expand_nxt_chk(); + if ( baseaddr + maxec - minec >= current_max_xpairs ) + expand_nxt_chk(); - for ( i = minec; i <= maxec; ++i ) - if ( state[i] != SAME_TRANS ) - if ( state[i] != 0 || deflink != JAMSTATE ) - if ( chk[baseaddr + i - minec] != 0 ) - { /* baseaddr unsuitable - find another */ - for ( ++baseaddr; - baseaddr < current_max_xpairs && - chk[baseaddr] != 0; - ++baseaddr ) - ; + for ( i = minec; i <= maxec; ++i ) + if ( state[i] != SAME_TRANS ) + if ( state[i] != 0 || deflink != JAMSTATE ) + if ( chk[baseaddr + i - minec] != 0 ) + { /* baseaddr unsuitable - find another */ + for ( ++baseaddr; + baseaddr < current_max_xpairs && + chk[baseaddr] != 0; + ++baseaddr ) + ; - if ( baseaddr + maxec - minec >= current_max_xpairs ) - expand_nxt_chk(); + if ( baseaddr + maxec - minec >= current_max_xpairs ) + expand_nxt_chk(); - /* reset the loop counter so we'll start all - * over again next time it's incremented - */ + /* reset the loop counter so we'll start all + * over again next time it's incremented + */ - i = minec - 1; - } - } + i = minec - 1; + } + } else - { - /* ensure that the base address we eventually generate is - * non-negative - */ - baseaddr = max( tblend + 1, minec ); - } + { + /* ensure that the base address we eventually generate is + * non-negative + */ + baseaddr = max( tblend + 1, minec ); + } tblbase = baseaddr - minec; tbllast = tblbase + maxec; if ( tbllast >= current_max_xpairs ) - expand_nxt_chk(); + expand_nxt_chk(); base[statenum] = tblbase; def[statenum] = deflink; for ( i = minec; i <= maxec; ++i ) - if ( state[i] != SAME_TRANS ) - if ( state[i] != 0 || deflink != JAMSTATE ) - { - nxt[tblbase + i] = state[i]; - chk[tblbase + i] = statenum; - } + if ( state[i] != SAME_TRANS ) + if ( state[i] != 0 || deflink != JAMSTATE ) + { + nxt[tblbase + i] = state[i]; + chk[tblbase + i] = statenum; + } if ( baseaddr == firstfree ) - /* find next free slot in tables */ - for ( ++firstfree; chk[firstfree] != 0; ++firstfree ) - ; + /* find next free slot in tables */ + for ( ++firstfree; chk[firstfree] != 0; ++firstfree ) + ; tblend = max( tblend, tbllast ); } @@ -647,11 +647,11 @@ void mkentry(int *state, int numchars, int statenum, int deflink, int totaltrans void mk1tbl(int state, int sym, int onenxt, int onedef) { if ( firstfree < sym ) - firstfree = sym; + firstfree = sym; while ( chk[firstfree] != 0 ) - if ( ++firstfree >= current_max_xpairs ) - expand_nxt_chk(); + if ( ++firstfree >= current_max_xpairs ) + expand_nxt_chk(); base[state] = firstfree - sym; def[state] = onedef; @@ -659,12 +659,12 @@ void mk1tbl(int state, int sym, int onenxt, int onedef) nxt[firstfree] = onenxt; if ( firstfree > tblend ) - { - tblend = firstfree++; + { + tblend = firstfree++; - if ( firstfree >= current_max_xpairs ) - expand_nxt_chk(); - } + if ( firstfree >= current_max_xpairs ) + expand_nxt_chk(); + } } @@ -680,22 +680,22 @@ void mkprot(int *state, int statenum, int comstate) int i, slot, tblbase; if ( ++numprots >= MSP || numecs * numprots >= PROT_SAVE_SIZE ) - { - /* gotta make room for the new proto by dropping last entry in - * the queue - */ - slot = lastprot; - lastprot = protprev[lastprot]; - protnext[lastprot] = NIL; - } + { + /* gotta make room for the new proto by dropping last entry in + * the queue + */ + slot = lastprot; + lastprot = protprev[lastprot]; + protnext[lastprot] = NIL; + } else - slot = numprots; + slot = numprots; protnext[slot] = firstprot; if ( firstprot != NIL ) - protprev[firstprot] = slot; + protprev[firstprot] = slot; firstprot = slot; prottbl[slot] = statenum; @@ -705,7 +705,7 @@ void mkprot(int *state, int statenum, int comstate) tblbase = numecs * (slot - 1); for ( i = 1; i <= numecs; ++i ) - protsave[tblbase + i] = state[i]; + protsave[tblbase + i] = state[i]; } @@ -735,25 +735,25 @@ void mktemplate(int *state, int statenum, int comstate) tmpbase = numtemps * numecs; if ( tmpbase + numecs >= current_max_template_xpairs ) - { - current_max_template_xpairs += MAX_TEMPLATE_XPAIRS_INCREMENT; + { + current_max_template_xpairs += MAX_TEMPLATE_XPAIRS_INCREMENT; - ++num_reallocs; + ++num_reallocs; - tnxt = reallocate_integer_array( tnxt, current_max_template_xpairs ); - } + tnxt = reallocate_integer_array( tnxt, current_max_template_xpairs ); + } for ( i = 1; i <= numecs; ++i ) - if ( state[i] == 0 ) - tnxt[tmpbase + i] = 0; - else - { - transset[tsptr++] = i; - tnxt[tmpbase + i] = comstate; - } + if ( state[i] == 0 ) + tnxt[tmpbase + i] = 0; + else + { + transset[tsptr++] = i; + tnxt[tmpbase + i] = comstate; + } if ( usemecs ) - mkeccl( transset, tsptr, tecfwd, tecbck, numecs, 0 ); + mkeccl( transset, tsptr, tecfwd, tecbck, numecs, 0 ); mkprot( tnxt + tmpbase, -numtemps, comstate ); @@ -776,20 +776,20 @@ void mktemplate(int *state, int statenum, int comstate) void mv2front(int qelm) { if ( firstprot != qelm ) - { - if ( qelm == lastprot ) - lastprot = protprev[lastprot]; + { + if ( qelm == lastprot ) + lastprot = protprev[lastprot]; - protnext[protprev[qelm]] = protnext[qelm]; + protnext[protprev[qelm]] = protnext[qelm]; - if ( protnext[qelm] != NIL ) - protprev[protnext[qelm]] = protprev[qelm]; + if ( protnext[qelm] != NIL ) + protprev[protnext[qelm]] = protprev[qelm]; - protprev[qelm] = NIL; - protnext[qelm] = firstprot; - protprev[firstprot] = qelm; - firstprot = qelm; - } + protprev[qelm] = NIL; + protnext[qelm] = firstprot; + protprev[firstprot] = qelm; + firstprot = qelm; + } } @@ -826,14 +826,14 @@ void place_state(int *state, int statenum, int transnum) state_ptr = &state[1]; for ( i = 1; i <= numecs; ++i, ++state_ptr ) - if ( *state_ptr != 0 ) - { - chk[position + i] = i; - nxt[position + i] = *state_ptr; - } + if ( *state_ptr != 0 ) + { + chk[position + i] = i; + nxt[position + i] = *state_ptr; + } if ( position + numecs > tblend ) - tblend = position + numecs; + tblend = position + numecs; } @@ -851,16 +851,16 @@ void place_state(int *state, int statenum, int transnum) void stack1(int statenum, int sym, int nextstate, int deflink) { if ( onesp >= ONE_STACK_SIZE - 1 ) - mk1tbl( statenum, sym, nextstate, deflink ); + mk1tbl( statenum, sym, nextstate, deflink ); else - { - ++onesp; - onestate[onesp] = statenum; - onesym[onesp] = sym; - onenext[onesp] = nextstate; - onedef[onesp] = deflink; - } + { + ++onesp; + onestate[onesp] = statenum; + onesym[onesp] = sym; + onenext[onesp] = nextstate; + onedef[onesp] = deflink; + } } @@ -890,15 +890,15 @@ int tbldiff(int *state, int pr, int *ext) protp = &protsave[numecs * (pr - 1)]; for ( i = numecs; i > 0; --i ) - { - if ( *++protp == *++sp ) - *++ep = SAME_TRANS; - else - { - *++ep = *sp; - ++numdiff; - } - } + { + if ( *++protp == *++sp ) + *++ep = SAME_TRANS; + else + { + *++ep = *sp; + ++numdiff; + } + } return ( numdiff ); } diff --git a/modules/libcom/src/flex/yylex.c b/modules/libcom/src/flex/yylex.c index 28f487d6b..546d60eb1 100644 --- a/modules/libcom/src/flex/yylex.c +++ b/modules/libcom/src/flex/yylex.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* yylex - scanner front-end for flex */ @@ -14,7 +14,7 @@ * * This code is derived from software contributed to Berkeley by * Vern Paxson. - * + * * The United States Government has rights in this work pursuant * to contract no. DE-AC03-76SF00098 between the United States * Department of Energy and the University of California. @@ -59,159 +59,159 @@ int yylex(void) static int beglin = false; if ( eofseen ) - toktype = EOF; + toktype = EOF; else - toktype = flexscan(); + toktype = flexscan(); if ( toktype == EOF || toktype == 0 ) - { - eofseen = 1; + { + eofseen = 1; - if ( sectnum == 1 ) - { - synerr( "premature EOF" ); - sectnum = 2; - toktype = SECTEND; - } + if ( sectnum == 1 ) + { + synerr( "premature EOF" ); + sectnum = 2; + toktype = SECTEND; + } - else if ( sectnum == 2 ) - { - sectnum = 3; - toktype = 0; - } + else if ( sectnum == 2 ) + { + sectnum = 3; + toktype = 0; + } - else - toktype = 0; - } + else + toktype = 0; + } if ( trace ) - { - if ( beglin ) - { - fprintf( stderr, "%d\t", num_rules + 1 ); - beglin = 0; - } + { + if ( beglin ) + { + fprintf( stderr, "%d\t", num_rules + 1 ); + beglin = 0; + } - switch ( toktype ) - { - case '<': - case '>': - case '^': - case '$': - case '"': - case '[': - case ']': - case '{': - case '}': - case '|': - case '(': - case ')': - case '-': - case '/': - case '\\': - case '?': - case '.': - case '*': - case '+': - case ',': - (void) putc( toktype, stderr ); - break; + switch ( toktype ) + { + case '<': + case '>': + case '^': + case '$': + case '"': + case '[': + case ']': + case '{': + case '}': + case '|': + case '(': + case ')': + case '-': + case '/': + case '\\': + case '?': + case '.': + case '*': + case '+': + case ',': + (void) putc( toktype, stderr ); + break; - case '\n': - (void) putc( '\n', stderr ); + case '\n': + (void) putc( '\n', stderr ); - if ( sectnum == 2 ) - beglin = 1; + if ( sectnum == 2 ) + beglin = 1; - break; + break; - case SCDECL: - fputs( "%s", stderr ); - break; + case SCDECL: + fputs( "%s", stderr ); + break; - case XSCDECL: - fputs( "%x", stderr ); - break; + case XSCDECL: + fputs( "%x", stderr ); + break; - case WHITESPACE: - (void) putc( ' ', stderr ); - break; + case WHITESPACE: + (void) putc( ' ', stderr ); + break; - case SECTEND: - fputs( "%%\n", stderr ); + case SECTEND: + fputs( "%%\n", stderr ); - /* we set beglin to be true so we'll start - * writing out numbers as we echo rules. flexscan() has - * already assigned sectnum - */ + /* we set beglin to be true so we'll start + * writing out numbers as we echo rules. flexscan() has + * already assigned sectnum + */ - if ( sectnum == 2 ) - beglin = 1; + if ( sectnum == 2 ) + beglin = 1; - break; + break; - case NAME: - fprintf( stderr, "'%s'", nmstr ); - break; + case NAME: + fprintf( stderr, "'%s'", nmstr ); + break; - case CHAR: - switch ( yylval ) - { - case '<': - case '>': - case '^': - case '$': - case '"': - case '[': - case ']': - case '{': - case '}': - case '|': - case '(': - case ')': - case '-': - case '/': - case '\\': - case '?': - case '.': - case '*': - case '+': - case ',': - fprintf( stderr, "\\%c", yylval ); - break; + case CHAR: + switch ( yylval ) + { + case '<': + case '>': + case '^': + case '$': + case '"': + case '[': + case ']': + case '{': + case '}': + case '|': + case '(': + case ')': + case '-': + case '/': + case '\\': + case '?': + case '.': + case '*': + case '+': + case ',': + fprintf( stderr, "\\%c", yylval ); + break; - default: - if ( ! isascii( yylval ) || ! isprint( yylval ) ) - fprintf( stderr, "\\%.3o", yylval ); - else - (void) putc( yylval, stderr ); - break; - } - - break; + default: + if ( ! isascii( yylval ) || ! isprint( yylval ) ) + fprintf( stderr, "\\%.3o", yylval ); + else + (void) putc( yylval, stderr ); + break; + } - case NUMBER: - fprintf( stderr, "%d", yylval ); - break; + break; - case PREVCCL: - fprintf( stderr, "[%d]", yylval ); - break; + case NUMBER: + fprintf( stderr, "%d", yylval ); + break; - case EOF_OP: - fprintf( stderr, "<>" ); - break; + case PREVCCL: + fprintf( stderr, "[%d]", yylval ); + break; - case 0: - fprintf( stderr, "End Marker" ); - break; + case EOF_OP: + fprintf( stderr, "<>" ); + break; - default: - fprintf( stderr, "*Something Weird* - tok: %d val: %d\n", - toktype, yylval ); - break; - } - } + case 0: + fprintf( stderr, "End Marker" ); + break; + + default: + fprintf( stderr, "*Something Weird* - tok: %d val: %d\n", + toktype, yylval ); + break; + } + } return ( toktype ); } diff --git a/modules/libcom/src/freeList/freeList.h b/modules/libcom/src/freeList/freeList.h index 9c9d2866c..73f334df7 100644 --- a/modules/libcom/src/freeList/freeList.h +++ b/modules/libcom/src/freeList/freeList.h @@ -5,9 +5,9 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* Author: Marty Kraimer Date: 04-19-94 */ +/* Author: Marty Kraimer Date: 04-19-94 */ #ifndef INCfreeListh #define INCfreeListh diff --git a/modules/libcom/src/freeList/freeListLib.c b/modules/libcom/src/freeList/freeListLib.c index f5396e831..d7bb3fec1 100755 --- a/modules/libcom/src/freeList/freeListLib.c +++ b/modules/libcom/src/freeList/freeListLib.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* Author: Marty Kraimer Date: 04-19-94 */ @@ -28,22 +28,22 @@ #include "adjustment.h" typedef struct allocMem { - struct allocMem *next; - void *memory; + struct allocMem *next; + void *memory; }allocMem; typedef struct { - int size; - int nmalloc; - void *head; - allocMem *mallochead; - size_t nBlocksAvailable; + int size; + int nmalloc; + void *head; + allocMem *mallochead; + size_t nBlocksAvailable; epicsMutexId lock; }FREELISTPVT; LIBCOM_API void epicsStdCall - freeListInitPvt(void **ppvt,int size,int nmalloc) + freeListInitPvt(void **ppvt,int size,int nmalloc) { - FREELISTPVT *pfl; + FREELISTPVT *pfl; pfl = callocMustSucceed(1,sizeof(FREELISTPVT), "freeListInitPvt"); pfl->size = adjustToWorstCaseAlignment(size); @@ -63,7 +63,7 @@ LIBCOM_API void * epicsStdCall freeListCalloc(void *pvt) # ifdef EPICS_FREELIST_DEBUG return callocMustSucceed(1,pfl->size,"freeList Debug Calloc"); # else - void *ptemp; + void *ptemp; ptemp = freeListMalloc(pvt); if(ptemp) memset((char *)ptemp,0,pfl->size); @@ -77,10 +77,10 @@ LIBCOM_API void * epicsStdCall freeListMalloc(void *pvt) # ifdef EPICS_FREELIST_DEBUG return callocMustSucceed(1,pfl->size,"freeList Debug Malloc"); # else - void *ptemp; - void **ppnext; - allocMem *pallocmem; - int i; + void *ptemp; + void **ppnext; + allocMem *pallocmem; + int i; epicsMutexMustLock(pfl->lock); ptemp = pfl->head; @@ -130,12 +130,12 @@ LIBCOM_API void * epicsStdCall freeListMalloc(void *pvt) LIBCOM_API void epicsStdCall freeListFree(void *pvt,void*pmem) { - FREELISTPVT *pfl = pvt; + FREELISTPVT *pfl = pvt; # ifdef EPICS_FREELIST_DEBUG memset ( pmem, 0xdd, pfl->size ); free(pmem); # else - void **ppnext; + void **ppnext; VALGRIND_MEMPOOL_FREE(pvt, pmem); VALGRIND_MEMPOOL_ALLOC(pvt, pmem, sizeof(void*)); @@ -152,8 +152,8 @@ LIBCOM_API void epicsStdCall freeListFree(void *pvt,void*pmem) LIBCOM_API void epicsStdCall freeListCleanup(void *pvt) { FREELISTPVT *pfl = pvt; - allocMem *phead; - allocMem *pnext; + allocMem *phead; + allocMem *pnext; VALGRIND_DESTROY_MEMPOOL(pvt); diff --git a/modules/libcom/src/gpHash/gpHash.h b/modules/libcom/src/gpHash/gpHash.h index 6d8a3eeca..dca265293 100644 --- a/modules/libcom/src/gpHash/gpHash.h +++ b/modules/libcom/src/gpHash/gpHash.h @@ -19,10 +19,10 @@ #include "ellLib.h" typedef struct{ - ELLNODE node; - const char *name; /*address of name placed in directory*/ - void *pvtid; /*private name for subsystem user*/ - void *userPvt; /*private for user*/ + ELLNODE node; + const char *name; /*address of name placed in directory*/ + void *pvtid; /*private name for subsystem user*/ + void *userPvt; /*private for user*/ } GPHENTRY; struct gphPvt; diff --git a/modules/libcom/src/iocsh/initHooks.c b/modules/libcom/src/iocsh/initHooks.c index 4c955afad..4c833f40c 100644 --- a/modules/libcom/src/iocsh/initHooks.c +++ b/modules/libcom/src/iocsh/initHooks.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Authors: Benjamin Franksen (BESY) and Marty Kraimer diff --git a/modules/libcom/src/iocsh/initHooks.h b/modules/libcom/src/iocsh/initHooks.h index 070f15cbc..05d9e015b 100644 --- a/modules/libcom/src/iocsh/initHooks.h +++ b/modules/libcom/src/iocsh/initHooks.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Authors: Benjamin Franksen (BESY) and Marty Kraimer diff --git a/modules/libcom/src/iocsh/iocsh.cpp b/modules/libcom/src/iocsh/iocsh.cpp index 4a2b3b7e8..40be45532 100644 --- a/modules/libcom/src/iocsh/iocsh.cpp +++ b/modules/libcom/src/iocsh/iocsh.cpp @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* iocsh.cpp */ /* Author: Marty Kraimer Date: 27APR2000 */ @@ -576,7 +576,7 @@ iocshBody (const char *pathname, const char *commandLine, const char *macros) iocshContext *context; char ** defines = NULL; int ret = 0; - + iocshInit(); /* @@ -626,19 +626,19 @@ iocshBody (const char *pathname, const char *commandLine, const char *macros) fprintf(epicsGetStderr(), "Out of memory!\n"); return -1; } - + /* * Parse macro definitions, this check occurs before creating the * macro handle to simplify cleanup. */ - + if (macros) { if (macParseDefns(NULL, macros, &defines) < 0) { free(redirects); return -1; } } - + // Check for existing context or construct a new one. context = (iocshContext *) epicsThreadPrivateGet(iocshContextId); @@ -650,7 +650,7 @@ iocshBody (const char *pathname, const char *commandLine, const char *macros) free(context); return -1; } - + epicsThreadPrivateSet(iocshContextId, (void *) context); } MAC_HANDLE *handle = context->handle; @@ -660,7 +660,7 @@ iocshBody (const char *pathname, const char *commandLine, const char *macros) macPushScope(handle); macInstallMacros(handle, defines); - + wasOkToBlock = epicsThreadIsOkToBlock(); epicsThreadSetOkToBlock(1); @@ -980,7 +980,7 @@ iocshBody (const char *pathname, const char *commandLine, const char *macros) stopRedirect(filename, lineno, redirects); } macPopScope(handle); - + if (!scope.outer) { macDeleteHandle(handle); free(context); @@ -1039,11 +1039,11 @@ iocshRun(const char *cmd, const char *macros) * Needed to work around the necessary limitations of macLib and * environment variables. In every other case of macro expansion * it is the expected outcome that defined macros override any - * environment variables. + * environment variables. * - * iocshLoad/Run turn this on its head as it is very likely that - * an epicsEnvSet command may be run within the context of their - * calls. Thus, it would be expected that the new value would be + * iocshLoad/Run turn this on its head as it is very likely that + * an epicsEnvSet command may be run within the context of their + * calls. Thus, it would be expected that the new value would be * returned in any future macro expansion. * * To do so, the epicsEnvSet command needs to be able to access @@ -1054,10 +1054,10 @@ void epicsStdCall iocshEnvClear(const char *name) { iocshContext *context; - + if (iocshContextId) { context = (iocshContext *) epicsThreadPrivateGet(iocshContextId); - + if (context != NULL) { macPutValue(context->handle, name, NULL); } diff --git a/modules/libcom/src/iocsh/iocsh.h b/modules/libcom/src/iocsh/iocsh.h index 407b15314..c8a7245bd 100644 --- a/modules/libcom/src/iocsh/iocsh.h +++ b/modules/libcom/src/iocsh/iocsh.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* iocsh.h ioc: call registered function*/ /* Author: Marty Kraimer Date: 27APR2000 */ diff --git a/modules/libcom/src/iocsh/libComRegister.c b/modules/libcom/src/iocsh/libComRegister.c index 4cd1f73c0..4113742a5 100644 --- a/modules/libcom/src/iocsh/libComRegister.c +++ b/modules/libcom/src/iocsh/libComRegister.c @@ -5,7 +5,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include @@ -215,7 +215,7 @@ static void errlogInitCallFunc(const iocshArgBuf *args) /* errlogInit2 */ static const iocshArg errlogInit2Arg0 = { "bufSize",iocshArgInt}; static const iocshArg errlogInit2Arg1 = { "maxMsgSize",iocshArgInt}; -static const iocshArg * const errlogInit2Args[] = +static const iocshArg * const errlogInit2Args[] = {&errlogInit2Arg0, &errlogInit2Arg1}; static const iocshFuncDef errlogInit2FuncDef = {"errlogInit2", 2, errlogInit2Args}; @@ -424,7 +424,7 @@ void epicsStdCall libComRegister(void) iocshRegister(&epicsMutexShowAllFuncDef,epicsMutexShowAllCallFunc); iocshRegister(&epicsThreadSleepFuncDef,epicsThreadSleepCallFunc); iocshRegister(&epicsThreadResumeFuncDef,epicsThreadResumeCallFunc); - + iocshRegister(&generalTimeReportFuncDef,generalTimeReportCallFunc); iocshRegister(&installLastResortEventProviderFuncDef, installLastResortEventProviderCallFunc); diff --git a/modules/libcom/src/iocsh/libComRegister.h b/modules/libcom/src/iocsh/libComRegister.h index a437b6d70..51c130033 100644 --- a/modules/libcom/src/iocsh/libComRegister.h +++ b/modules/libcom/src/iocsh/libComRegister.h @@ -2,7 +2,7 @@ * Copyright (c) 2007 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef INC_libComRegister_H diff --git a/modules/libcom/src/iocsh/registry.c b/modules/libcom/src/iocsh/registry.c index 1c8ccbb91..c7379cdd7 100644 --- a/modules/libcom/src/iocsh/registry.c +++ b/modules/libcom/src/iocsh/registry.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /*registry.c */ @@ -30,7 +30,7 @@ static void registryInit(int tableSize) gphInitPvt(&gphPvt,tableSize); if(!gphPvt) cantProceed("registry why did gphInitPvt fail\n"); } - + LIBCOM_API int epicsStdCall registrySetTableSize(int size) { if(gphPvt) { @@ -40,7 +40,7 @@ LIBCOM_API int epicsStdCall registrySetTableSize(int size) registryInit(size); return(0); } - + LIBCOM_API int epicsStdCall registryAdd( void *registryID,const char *name,void *data) diff --git a/modules/libcom/src/iocsh/registry.h b/modules/libcom/src/iocsh/registry.h index 03d7fb517..82e07553b 100644 --- a/modules/libcom/src/iocsh/registry.h +++ b/modules/libcom/src/iocsh/registry.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef INCregistryh #define INCregistryh diff --git a/modules/libcom/src/log/iocLog.c b/modules/libcom/src/log/iocLog.c index 39f47593d..9ce5b693b 100644 --- a/modules/libcom/src/log/iocLog.c +++ b/modules/libcom/src/log/iocLog.c @@ -5,12 +5,12 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* logClient.c,v 1.25.2.6 2004/10/07 13:37:34 mrk Exp */ /* - * Author: Jeffrey O. Hill - * Date: 080791 + * Author: Jeffrey O. Hill + * Date: 080791 */ #include diff --git a/modules/libcom/src/log/iocLog.h b/modules/libcom/src/log/iocLog.h index 18a42ee99..3709d78b4 100644 --- a/modules/libcom/src/log/iocLog.h +++ b/modules/libcom/src/log/iocLog.h @@ -5,14 +5,14 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* logClient.h,v 1.5.2.1 2003/07/08 00:08:06 jhill Exp */ /* * - * Author: Jeffrey O. Hill - * Date: 080791 + * Author: Jeffrey O. Hill + * Date: 080791 */ #ifndef INCiocLogh diff --git a/modules/libcom/src/log/iocLogServer.c b/modules/libcom/src/log/iocLogServer.c index e707185ae..796f520c2 100644 --- a/modules/libcom/src/log/iocLogServer.c +++ b/modules/libcom/src/log/iocLogServer.c @@ -4,36 +4,36 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* iocLogServer.c */ /* - * archive logMsg() from several IOC's to a common rotating file + * archive logMsg() from several IOC's to a common rotating file * * - * Author: Jeffrey O. Hill - * Date: 080791 + * Author: Jeffrey O. Hill + * Date: 080791 */ -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #ifdef UNIX -#include -#include +#include +#include #endif -#include "dbDefs.h" -#include "epicsAssert.h" -#include "fdmgr.h" -#include "envDefs.h" -#include "osiSock.h" -#include "epicsStdio.h" +#include "dbDefs.h" +#include "epicsAssert.h" +#include "fdmgr.h" +#include "envDefs.h" +#include "osiSock.h" +#include "epicsStdio.h" static unsigned short ioc_log_port; static long ioc_log_file_limit; @@ -42,21 +42,21 @@ static char ioc_log_file_command[256]; struct iocLogClient { - int insock; - struct ioc_log_server *pserver; - size_t nChar; - char recvbuf[1024]; - char name[32]; - char ascii_time[32]; + int insock; + struct ioc_log_server *pserver; + size_t nChar; + char recvbuf[1024]; + char name[32]; + char ascii_time[32]; }; struct ioc_log_server { - char outfile[256]; - long filePos; - FILE *poutfile; - void *pfdctx; - SOCKET sock; - long max_file_size; + char outfile[256]; + long filePos; + FILE *poutfile; + void *pfdctx; + SOCKET sock; + long max_file_size; }; #define IOCLS_ERROR (-1) @@ -103,7 +103,7 @@ int main(void) return IOCLS_ERROR; } - pserver = (struct ioc_log_server *) + pserver = (struct ioc_log_server *) calloc(1, sizeof *pserver); if (!pserver) { fprintf(stderr, "iocLogServer: %s\n", strerror(errno)); @@ -128,7 +128,7 @@ int main(void) free(pserver); return IOCLS_ERROR; } - + epicsSocketEnableAddressReuseDuringTimeWaitState ( pserver->sock ); /* Zero the sock_addr structure */ @@ -137,15 +137,15 @@ int main(void) serverAddr.sin_port = htons(ioc_log_port); /* get server's Internet address */ - status = bind ( pserver->sock, - (struct sockaddr *)&serverAddr, + status = bind ( pserver->sock, + (struct sockaddr *)&serverAddr, sizeof (serverAddr) ); if (status < 0) { char sockErrBuf[64]; epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); fprintf(stderr, "iocLogServer: bind err: %s\n", sockErrBuf ); fprintf (stderr, - "iocLogServer: a server is already installed on port %u?\n", + "iocLogServer: a server is already installed on port %u?\n", (unsigned)ioc_log_port); return IOCLS_ERROR; } @@ -185,15 +185,15 @@ int main(void) status = openLogFile(pserver); if (status < 0) { fprintf(stderr, - "File access problems to `%s' because `%s'\n", + "File access problems to `%s' because `%s'\n", ioc_log_file_name, strerror(errno)); return IOCLS_ERROR; } status = fdmgr_add_callback( - pserver->pfdctx, - pserver->sock, + pserver->pfdctx, + pserver->sock, fdi_read, acceptNewClient, pserver); @@ -240,7 +240,7 @@ static int seekLatestLine (struct ioc_log_server *pserver) */ convertStatus = fscanf ( pserver->poutfile, " %*s %*s %15s %d %d:%d:%d %d %*[^\n] ", - month, &theDate.tm_mday, &theDate.tm_hour, + month, &theDate.tm_mday, &theDate.tm_hour, &theDate.tm_min, &theDate.tm_sec, &theDate.tm_year); if (convertStatus==6) { static const char *pMonths[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", @@ -262,7 +262,7 @@ static int seekLatestLine (struct ioc_log_server *pserver) theDate.tm_isdst = -1; /* dont know */ lineTime = mktime (&theDate); if ( lineTime != invalidTime ) { - if (theLatestTime == invalidTime || + if (theLatestTime == invalidTime || difftime(lineTime, theLatestTime)>=0) { latestFilePos = ftell (pserver->poutfile); theLatestTime = lineTime; @@ -290,7 +290,7 @@ static int seekLatestLine (struct ioc_log_server *pserver) } else { int c = fgetc (pserver->poutfile); - + /* * bypass the line if it does not match the expected format */ @@ -308,20 +308,20 @@ static int seekLatestLine (struct ioc_log_server *pserver) * move to the proper location in the file */ if (latestFilePos != -1) { - status = fseek (pserver->poutfile, latestFilePos, SEEK_SET); - if (status!=IOCLS_OK) { - fclose (pserver->poutfile); - pserver->poutfile = stderr; - return IOCLS_ERROR; - } + status = fseek (pserver->poutfile, latestFilePos, SEEK_SET); + if (status!=IOCLS_OK) { + fclose (pserver->poutfile); + pserver->poutfile = stderr; + return IOCLS_ERROR; + } } else { - status = fseek (pserver->poutfile, 0L, SEEK_END); - if (status!=IOCLS_OK) { - fclose (pserver->poutfile); - pserver->poutfile = stderr; - return IOCLS_ERROR; - } + status = fseek (pserver->poutfile, 0L, SEEK_END); + if (status!=IOCLS_OK) { + fclose (pserver->poutfile); + pserver->poutfile = stderr; + return IOCLS_ERROR; + } } pserver->filePos = ftell (pserver->poutfile); @@ -329,97 +329,97 @@ static int seekLatestLine (struct ioc_log_server *pserver) if (theLatestTime==invalidTime) { if (pserver->filePos!=0) { fprintf (stderr, "iocLogServer: **** Warning ****\n"); - fprintf (stderr, "iocLogServer: no recognizable dates in \"%s\"\n", + fprintf (stderr, "iocLogServer: no recognizable dates in \"%s\"\n", ioc_log_file_name); fprintf (stderr, "iocLogServer: logging at end of file\n"); } } - return IOCLS_OK; + return IOCLS_OK; } /* - * openLogFile() + * openLogFile() * */ static int openLogFile (struct ioc_log_server *pserver) { - enum TF_RETURN ret; + enum TF_RETURN ret; - if (pserver->poutfile && pserver->poutfile != stderr){ - fclose (pserver->poutfile); - pserver->poutfile = NULL; - } + if (pserver->poutfile && pserver->poutfile != stderr){ + fclose (pserver->poutfile); + pserver->poutfile = NULL; + } - pserver->poutfile = fopen(ioc_log_file_name, "r+"); - if (pserver->poutfile) { - fclose (pserver->poutfile); - pserver->poutfile = NULL; - ret = truncateFile (ioc_log_file_name, ioc_log_file_limit); - if (ret==TF_ERROR) { - return IOCLS_ERROR; - } - pserver->poutfile = fopen(ioc_log_file_name, "r+"); - } - else { - pserver->poutfile = fopen(ioc_log_file_name, "w"); - } + pserver->poutfile = fopen(ioc_log_file_name, "r+"); + if (pserver->poutfile) { + fclose (pserver->poutfile); + pserver->poutfile = NULL; + ret = truncateFile (ioc_log_file_name, ioc_log_file_limit); + if (ret==TF_ERROR) { + return IOCLS_ERROR; + } + pserver->poutfile = fopen(ioc_log_file_name, "r+"); + } + else { + pserver->poutfile = fopen(ioc_log_file_name, "w"); + } - if (!pserver->poutfile) { - pserver->poutfile = stderr; - return IOCLS_ERROR; - } - strcpy (pserver->outfile, ioc_log_file_name); - pserver->max_file_size = ioc_log_file_limit; + if (!pserver->poutfile) { + pserver->poutfile = stderr; + return IOCLS_ERROR; + } + strcpy (pserver->outfile, ioc_log_file_name); + pserver->max_file_size = ioc_log_file_limit; return seekLatestLine (pserver); } /* - * handleLogFileError() + * handleLogFileError() * */ static void handleLogFileError(void) { - fprintf(stderr, - "iocLogServer: log file access problem (errno=%s)\n", - strerror(errno)); - exit(IOCLS_ERROR); + fprintf(stderr, + "iocLogServer: log file access problem (errno=%s)\n", + strerror(errno)); + exit(IOCLS_ERROR); } - + /* - * acceptNewClient() + * acceptNewClient() * */ static void acceptNewClient ( void *pParam ) { - struct ioc_log_server *pserver = (struct ioc_log_server *) pParam; - struct iocLogClient *pclient; - osiSocklen_t addrSize; - struct sockaddr_in addr; - int status; - osiSockIoctl_t optval; + struct ioc_log_server *pserver = (struct ioc_log_server *) pParam; + struct iocLogClient *pclient; + osiSocklen_t addrSize; + struct sockaddr_in addr; + int status; + osiSockIoctl_t optval; - pclient = ( struct iocLogClient * ) malloc ( sizeof ( *pclient ) ); - if ( ! pclient ) { - return; - } + pclient = ( struct iocLogClient * ) malloc ( sizeof ( *pclient ) ); + if ( ! pclient ) { + return; + } - addrSize = sizeof ( addr ); - pclient->insock = epicsSocketAccept ( pserver->sock, (struct sockaddr *)&addr, &addrSize ); - if ( pclient->insock==INVALID_SOCKET || addrSize < sizeof (addr) ) { + addrSize = sizeof ( addr ); + pclient->insock = epicsSocketAccept ( pserver->sock, (struct sockaddr *)&addr, &addrSize ); + if ( pclient->insock==INVALID_SOCKET || addrSize < sizeof (addr) ) { static unsigned acceptErrCount; static int lastErrno; int thisErrno; - free ( pclient ); - if ( SOCKERRNO == SOCK_EWOULDBLOCK || SOCKERRNO == SOCK_EINTR ) { + free ( pclient ); + if ( SOCKERRNO == SOCK_EWOULDBLOCK || SOCKERRNO == SOCK_EINTR ) { return; - } + } thisErrno = SOCKERRNO; if ( acceptErrCount % 1000 || lastErrno != thisErrno ) { @@ -428,141 +428,141 @@ static void acceptNewClient ( void *pParam ) acceptErrCount++; lastErrno = thisErrno; - return; - } + return; + } - /* - * Set non blocking IO - * to prevent dead locks - */ - optval = TRUE; - status = socket_ioctl( - pclient->insock, - FIONBIO, - &optval); - if(status<0){ + /* + * Set non blocking IO + * to prevent dead locks + */ + optval = TRUE; + status = socket_ioctl( + pclient->insock, + FIONBIO, + &optval); + if(status<0){ char sockErrBuf[64]; epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - fprintf(stderr, "%s:%d ioctl FBIO client er %s\n", - __FILE__, __LINE__, sockErrBuf); - epicsSocketDestroy ( pclient->insock ); - free(pclient); - return; - } + fprintf(stderr, "%s:%d ioctl FBIO client er %s\n", + __FILE__, __LINE__, sockErrBuf); + epicsSocketDestroy ( pclient->insock ); + free(pclient); + return; + } - pclient->pserver = pserver; - pclient->nChar = 0u; + pclient->pserver = pserver; + pclient->nChar = 0u; - ipAddrToA (&addr, pclient->name, sizeof(pclient->name)); + ipAddrToA (&addr, pclient->name, sizeof(pclient->name)); + + logTime(pclient); - logTime(pclient); - #if 0 - status = fprintf( - pclient->pserver->poutfile, - "%s %s ----- Client Connect -----\n", - pclient->name, - pclient->ascii_time); - if(status<0){ - handleLogFileError(); - } + status = fprintf( + pclient->pserver->poutfile, + "%s %s ----- Client Connect -----\n", + pclient->name, + pclient->ascii_time); + if(status<0){ + handleLogFileError(); + } #endif - /* - * turn on KEEPALIVE so if the client crashes - * this task will find out and exit - */ - { - long true = 1; + /* + * turn on KEEPALIVE so if the client crashes + * this task will find out and exit + */ + { + long true = 1; - status = setsockopt( - pclient->insock, - SOL_SOCKET, - SO_KEEPALIVE, - (char *)&true, - sizeof(true) ); - if(status<0){ - fprintf(stderr, "Keepalive option set failed\n"); - } - } + status = setsockopt( + pclient->insock, + SOL_SOCKET, + SO_KEEPALIVE, + (char *)&true, + sizeof(true) ); + if(status<0){ + fprintf(stderr, "Keepalive option set failed\n"); + } + } - status = shutdown(pclient->insock, SHUT_WR); - if(status<0){ + status = shutdown(pclient->insock, SHUT_WR); + if(status<0){ char sockErrBuf[64]; epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - fprintf (stderr, "%s:%d shutdown err %s\n", __FILE__, __LINE__, - sockErrBuf); + fprintf (stderr, "%s:%d shutdown err %s\n", __FILE__, __LINE__, + sockErrBuf); epicsSocketDestroy ( pclient->insock ); - free(pclient); + free(pclient); - return; - } + return; + } - status = fdmgr_add_callback( - pserver->pfdctx, - pclient->insock, - fdi_read, - readFromClient, - pclient); - if (status<0) { - epicsSocketDestroy ( pclient->insock ); - free(pclient); - fprintf(stderr, "%s:%d client fdmgr_add_callback() failed\n", - __FILE__, __LINE__); - return; - } + status = fdmgr_add_callback( + pserver->pfdctx, + pclient->insock, + fdi_read, + readFromClient, + pclient); + if (status<0) { + epicsSocketDestroy ( pclient->insock ); + free(pclient); + fprintf(stderr, "%s:%d client fdmgr_add_callback() failed\n", + __FILE__, __LINE__); + return; + } } /* * readFromClient() - * + * */ #define NITEMS 1 static void readFromClient(void *pParam) { - struct iocLogClient *pclient = (struct iocLogClient *)pParam; - int recvLength; - int size; + struct iocLogClient *pclient = (struct iocLogClient *)pParam; + int recvLength; + int size; - logTime(pclient); + logTime(pclient); - size = (int) (sizeof(pclient->recvbuf) - pclient->nChar); - recvLength = recv(pclient->insock, - &pclient->recvbuf[pclient->nChar], - size, - 0); - if (recvLength <= 0) { - if (recvLength<0) { + size = (int) (sizeof(pclient->recvbuf) - pclient->nChar); + recvLength = recv(pclient->insock, + &pclient->recvbuf[pclient->nChar], + size, + 0); + if (recvLength <= 0) { + if (recvLength<0) { int errnoCpy = SOCKERRNO; - if (errnoCpy==SOCK_EWOULDBLOCK || errnoCpy==SOCK_EINTR) { - return; - } - if (errnoCpy != SOCK_ECONNRESET && - errnoCpy != SOCK_ECONNABORTED && - errnoCpy != SOCK_EPIPE && - errnoCpy != SOCK_ETIMEDOUT - ) { + if (errnoCpy==SOCK_EWOULDBLOCK || errnoCpy==SOCK_EINTR) { + return; + } + if (errnoCpy != SOCK_ECONNRESET && + errnoCpy != SOCK_ECONNABORTED && + errnoCpy != SOCK_EPIPE && + errnoCpy != SOCK_ETIMEDOUT + ) { char sockErrBuf[64]; epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - fprintf(stderr, - "%s:%d socket=%d size=%d read error=%s\n", - __FILE__, __LINE__, pclient->insock, - size, sockErrBuf); - } - } - /* - * disconnect - */ - freeLogClient (pclient); - return; - } + fprintf(stderr, + "%s:%d socket=%d size=%d read error=%s\n", + __FILE__, __LINE__, pclient->insock, + size, sockErrBuf); + } + } + /* + * disconnect + */ + freeLogClient (pclient); + return; + } - pclient->nChar += (size_t) recvLength; + pclient->nChar += (size_t) recvLength; - writeMessagesToLog (pclient); + writeMessagesToLog (pclient); } /* @@ -570,105 +570,105 @@ static void readFromClient(void *pParam) */ static void writeMessagesToLog (struct iocLogClient *pclient) { - int status; + int status; size_t lineIndex = 0; - - while (TRUE) { - size_t nchar; - size_t nTotChar; + + while (TRUE) { + size_t nchar; + size_t nTotChar; size_t crIndex; - int ntci; + int ntci; - if ( lineIndex >= pclient->nChar ) { - pclient->nChar = 0u; - break; - } + if ( lineIndex >= pclient->nChar ) { + pclient->nChar = 0u; + break; + } - /* - * find the first carrage return and create - * an entry in the log for the message associated - * with it. If a carrage return does not exist and - * the buffer isnt full then move the partial message - * to the front of the buffer and wait for a carrage - * return to arrive. If the buffer is full and there - * is no carrage return then force the message out and - * insert an artificial carrage return. - */ - nchar = pclient->nChar - lineIndex; + /* + * find the first carrage return and create + * an entry in the log for the message associated + * with it. If a carrage return does not exist and + * the buffer isnt full then move the partial message + * to the front of the buffer and wait for a carrage + * return to arrive. If the buffer is full and there + * is no carrage return then force the message out and + * insert an artificial carrage return. + */ + nchar = pclient->nChar - lineIndex; for ( crIndex = lineIndex; crIndex < pclient->nChar; crIndex++ ) { if ( pclient->recvbuf[crIndex] == '\n' ) { break; } } - if ( crIndex < pclient->nChar ) { - nchar = crIndex - lineIndex; + if ( crIndex < pclient->nChar ) { + nchar = crIndex - lineIndex; } else { - nchar = pclient->nChar - lineIndex; - if ( nchar < sizeof ( pclient->recvbuf ) ) { - if ( lineIndex != 0 ) { - pclient->nChar = nchar; - memmove ( pclient->recvbuf, + nchar = pclient->nChar - lineIndex; + if ( nchar < sizeof ( pclient->recvbuf ) ) { + if ( lineIndex != 0 ) { + pclient->nChar = nchar; + memmove ( pclient->recvbuf, & pclient->recvbuf[lineIndex], nchar); - } - break; - } - } - - /* - * reset the file pointer if we hit the end of the file - */ - nTotChar = strlen(pclient->name) + - strlen(pclient->ascii_time) + nchar + 3u; - assert (nTotChar <= INT_MAX); - ntci = (int) nTotChar; - if ( pclient->pserver->max_file_size && pclient->pserver->filePos+ntci >= pclient->pserver->max_file_size ) { - if ( pclient->pserver->max_file_size >= pclient->pserver->filePos ) { - unsigned nPadChar; - /* - * this gets rid of leftover junk at the end of the file - */ - nPadChar = pclient->pserver->max_file_size - pclient->pserver->filePos; - while (nPadChar--) { - status = putc ( ' ', pclient->pserver->poutfile ); - if ( status == EOF ) { - handleLogFileError(); - } - } - } - -# ifdef DEBUG - fprintf ( stderr, - "ioc log server: resetting the file pointer\n" ); -# endif - fflush ( pclient->pserver->poutfile ); - rewind ( pclient->pserver->poutfile ); - pclient->pserver->filePos = ftell ( pclient->pserver->poutfile ); - } - - /* - * NOTE: !! change format string here then must - * change nTotChar calc above !! - */ - assert (ncharpserver->poutfile, - "%s %s %.*s\n", - pclient->name, - pclient->ascii_time, - (int) nchar, - &pclient->recvbuf[lineIndex]); - if (status<0) { - handleLogFileError(); - } - else { - if (status != ntci) { - fprintf(stderr, "iocLogServer: didnt calculate number of characters correctly?\n"); - } - pclient->pserver->filePos += status; + } + break; + } } - lineIndex += nchar+1u; - } + + /* + * reset the file pointer if we hit the end of the file + */ + nTotChar = strlen(pclient->name) + + strlen(pclient->ascii_time) + nchar + 3u; + assert (nTotChar <= INT_MAX); + ntci = (int) nTotChar; + if ( pclient->pserver->max_file_size && pclient->pserver->filePos+ntci >= pclient->pserver->max_file_size ) { + if ( pclient->pserver->max_file_size >= pclient->pserver->filePos ) { + unsigned nPadChar; + /* + * this gets rid of leftover junk at the end of the file + */ + nPadChar = pclient->pserver->max_file_size - pclient->pserver->filePos; + while (nPadChar--) { + status = putc ( ' ', pclient->pserver->poutfile ); + if ( status == EOF ) { + handleLogFileError(); + } + } + } + +# ifdef DEBUG + fprintf ( stderr, + "ioc log server: resetting the file pointer\n" ); +# endif + fflush ( pclient->pserver->poutfile ); + rewind ( pclient->pserver->poutfile ); + pclient->pserver->filePos = ftell ( pclient->pserver->poutfile ); + } + + /* + * NOTE: !! change format string here then must + * change nTotChar calc above !! + */ + assert (ncharpserver->poutfile, + "%s %s %.*s\n", + pclient->name, + pclient->ascii_time, + (int) nchar, + &pclient->recvbuf[lineIndex]); + if (status<0) { + handleLogFileError(); + } + else { + if (status != ntci) { + fprintf(stderr, "iocLogServer: didnt calculate number of characters correctly?\n"); + } + pclient->pserver->filePos += status; + } + lineIndex += nchar+1u; + } } @@ -677,136 +677,136 @@ static void writeMessagesToLog (struct iocLogClient *pclient) */ static void freeLogClient(struct iocLogClient *pclient) { - int status; + int status; -# ifdef DEBUG - if(length == 0){ - fprintf(stderr, "iocLogServer: nil message disconnect\n"); - } -# endif +# ifdef DEBUG + if(length == 0){ + fprintf(stderr, "iocLogServer: nil message disconnect\n"); + } +# endif - /* - * flush any left overs - */ - if (pclient->nChar) { - /* - * this forces a flush - */ - if (pclient->nCharrecvbuf)) { - pclient->recvbuf[pclient->nChar] = '\n'; - } - writeMessagesToLog (pclient); - } + /* + * flush any left overs + */ + if (pclient->nChar) { + /* + * this forces a flush + */ + if (pclient->nCharrecvbuf)) { + pclient->recvbuf[pclient->nChar] = '\n'; + } + writeMessagesToLog (pclient); + } - status = fdmgr_clear_callback( - pclient->pserver->pfdctx, - pclient->insock, - fdi_read); - if (status!=IOCLS_OK) { - fprintf(stderr, "%s:%d fdmgr_clear_callback() failed\n", - __FILE__, __LINE__); - } + status = fdmgr_clear_callback( + pclient->pserver->pfdctx, + pclient->insock, + fdi_read); + if (status!=IOCLS_OK) { + fprintf(stderr, "%s:%d fdmgr_clear_callback() failed\n", + __FILE__, __LINE__); + } - epicsSocketDestroy ( pclient->insock ); + epicsSocketDestroy ( pclient->insock ); - free (pclient); + free (pclient); - return; + return; } /* * - * logTime() + * logTime() * */ static void logTime(struct iocLogClient *pclient) { - time_t sec; - char *pcr; - char *pTimeString; + time_t sec; + char *pcr; + char *pTimeString; - sec = time (NULL); - pTimeString = ctime (&sec); - strncpy (pclient->ascii_time, - pTimeString, - sizeof (pclient->ascii_time) ); - pclient->ascii_time[sizeof(pclient->ascii_time)-1] = '\0'; - pcr = strchr(pclient->ascii_time, '\n'); - if (pcr) { - *pcr = '\0'; - } + sec = time (NULL); + pTimeString = ctime (&sec); + strncpy (pclient->ascii_time, + pTimeString, + sizeof (pclient->ascii_time) ); + pclient->ascii_time[sizeof(pclient->ascii_time)-1] = '\0'; + pcr = strchr(pclient->ascii_time, '\n'); + if (pcr) { + *pcr = '\0'; + } } /* * - * getConfig() - * Get Server Configuration + * getConfig() + * Get Server Configuration * * */ static int getConfig(void) { - int status; - char *pstring; - long param; + int status; + char *pstring; + long param; - status = envGetLongConfigParam( - &EPICS_IOC_LOG_PORT, - ¶m); - if(status>=0){ - ioc_log_port = (unsigned short) param; - } - else { - ioc_log_port = 7004U; - } + status = envGetLongConfigParam( + &EPICS_IOC_LOG_PORT, + ¶m); + if(status>=0){ + ioc_log_port = (unsigned short) param; + } + else { + ioc_log_port = 7004U; + } - status = envGetLongConfigParam( - &EPICS_IOC_LOG_FILE_LIMIT, - &ioc_log_file_limit); - if(status>=0){ - if (ioc_log_file_limit < 0) { - envFailureNotify (&EPICS_IOC_LOG_FILE_LIMIT); - return IOCLS_ERROR; - } - } - else { - ioc_log_file_limit = 10000; - } + status = envGetLongConfigParam( + &EPICS_IOC_LOG_FILE_LIMIT, + &ioc_log_file_limit); + if(status>=0){ + if (ioc_log_file_limit < 0) { + envFailureNotify (&EPICS_IOC_LOG_FILE_LIMIT); + return IOCLS_ERROR; + } + } + else { + ioc_log_file_limit = 10000; + } - pstring = envGetConfigParam( - &EPICS_IOC_LOG_FILE_NAME, - sizeof ioc_log_file_name, - ioc_log_file_name); - if(pstring == NULL){ - envFailureNotify(&EPICS_IOC_LOG_FILE_NAME); - return IOCLS_ERROR; - } + pstring = envGetConfigParam( + &EPICS_IOC_LOG_FILE_NAME, + sizeof ioc_log_file_name, + ioc_log_file_name); + if(pstring == NULL){ + envFailureNotify(&EPICS_IOC_LOG_FILE_NAME); + return IOCLS_ERROR; + } - /* - * its ok to not specify the IOC_LOG_FILE_COMMAND - */ - pstring = envGetConfigParam( - &EPICS_IOC_LOG_FILE_COMMAND, - sizeof ioc_log_file_command, - ioc_log_file_command); - return IOCLS_OK; + /* + * its ok to not specify the IOC_LOG_FILE_COMMAND + */ + pstring = envGetConfigParam( + &EPICS_IOC_LOG_FILE_COMMAND, + sizeof ioc_log_file_command, + ioc_log_file_command); + return IOCLS_OK; } /* * - * failureNotify() + * failureNotify() * * */ static void envFailureNotify(const ENV_PARAM *pparam) { - fprintf(stderr, - "iocLogServer: EPICS environment variable `%s' undefined\n", - pparam->name); + fprintf(stderr, + "iocLogServer: EPICS environment variable `%s' undefined\n", + pparam->name); } @@ -814,53 +814,53 @@ static void envFailureNotify(const ENV_PARAM *pparam) #ifdef UNIX static int setupSIGHUP(struct ioc_log_server *pserver) { - int status; - struct sigaction sigact; + int status; + struct sigaction sigact; - status = getDirectory(); - if (status<0){ - fprintf(stderr, "iocLogServer: failed to determine log file " - "directory\n"); - return IOCLS_ERROR; - } + status = getDirectory(); + if (status<0){ + fprintf(stderr, "iocLogServer: failed to determine log file " + "directory\n"); + return IOCLS_ERROR; + } - /* - * Set up SIGHUP handler. SIGHUP will cause the log file to be - * closed and re-opened, possibly with a different name. - */ - sigact.sa_handler = sighupHandler; - sigemptyset (&sigact.sa_mask); - sigact.sa_flags = 0; - if (sigaction(SIGHUP, &sigact, NULL)){ - fprintf(stderr, "iocLogServer: %s\n", strerror(errno)); - return IOCLS_ERROR; - } - - status = pipe(sighupPipe); - if(status<0){ + /* + * Set up SIGHUP handler. SIGHUP will cause the log file to be + * closed and re-opened, possibly with a different name. + */ + sigact.sa_handler = sighupHandler; + sigemptyset (&sigact.sa_mask); + sigact.sa_flags = 0; + if (sigaction(SIGHUP, &sigact, NULL)){ + fprintf(stderr, "iocLogServer: %s\n", strerror(errno)); + return IOCLS_ERROR; + } + + status = pipe(sighupPipe); + if(status<0){ fprintf(stderr, "iocLogServer: failed to create pipe because `%s'\n", strerror(errno)); return IOCLS_ERROR; } - status = fdmgr_add_callback( - pserver->pfdctx, - sighupPipe[0], - fdi_read, - serviceSighupRequest, - pserver); - if(status<0){ - fprintf(stderr, - "iocLogServer: failed to add SIGHUP callback\n"); - return IOCLS_ERROR; - } - return IOCLS_OK; + status = fdmgr_add_callback( + pserver->pfdctx, + sighupPipe[0], + fdi_read, + serviceSighupRequest, + pserver); + if(status<0){ + fprintf(stderr, + "iocLogServer: failed to add SIGHUP callback\n"); + return IOCLS_ERROR; + } + return IOCLS_OK; } /* * - * sighupHandler() + * sighupHandler() * * */ @@ -877,126 +877,126 @@ static void sighupHandler(int signo) /* - * serviceSighupRequest() + * serviceSighupRequest() * */ static void serviceSighupRequest(void *pParam) { - struct ioc_log_server *pserver = (struct ioc_log_server *)pParam; - char buff[256]; - int status; + struct ioc_log_server *pserver = (struct ioc_log_server *)pParam; + char buff[256]; + int status; - /* - * Read and discard message from pipe. - */ - if (read(sighupPipe[0], buff, sizeof buff) <= 0) { + /* + * Read and discard message from pipe. + */ + if (read(sighupPipe[0], buff, sizeof buff) <= 0) { fprintf(stderr, "iocLogServer: failed to read from SIGHUP pipe because " "`%s'\n", strerror(errno)); }; - /* - * Determine new log file name. - */ - status = getDirectory(); - if (status<0){ - fprintf(stderr, "iocLogServer: failed to determine new log " - "file name\n"); - return; - } + /* + * Determine new log file name. + */ + status = getDirectory(); + if (status<0){ + fprintf(stderr, "iocLogServer: failed to determine new log " + "file name\n"); + return; + } - /* - * Try (re)opening the file. - */ - status = openLogFile(pserver); - if(status<0){ - fprintf(stderr, - "File access problems to `%s' because `%s'\n", - ioc_log_file_name, - strerror(errno)); - /* Revert to old filename */ - strcpy(ioc_log_file_name, pserver->outfile); - status = openLogFile(pserver); - if(status<0){ - fprintf(stderr, - "File access problems to `%s' because `%s'\n", - ioc_log_file_name, - strerror(errno)); - return; - } - else { - fprintf(stderr, - "iocLogServer: re-opened old log file %s\n", - ioc_log_file_name); - } - } - else { - fprintf(stderr, - "iocLogServer: opened new log file %s\n", - ioc_log_file_name); - } + /* + * Try (re)opening the file. + */ + status = openLogFile(pserver); + if(status<0){ + fprintf(stderr, + "File access problems to `%s' because `%s'\n", + ioc_log_file_name, + strerror(errno)); + /* Revert to old filename */ + strcpy(ioc_log_file_name, pserver->outfile); + status = openLogFile(pserver); + if(status<0){ + fprintf(stderr, + "File access problems to `%s' because `%s'\n", + ioc_log_file_name, + strerror(errno)); + return; + } + else { + fprintf(stderr, + "iocLogServer: re-opened old log file %s\n", + ioc_log_file_name); + } + } + else { + fprintf(stderr, + "iocLogServer: opened new log file %s\n", + ioc_log_file_name); + } } /* * - * getDirectory() + * getDirectory() * * */ static int getDirectory(void) { - FILE *pipe; - char dir[256]; - int i; + FILE *pipe; + char dir[256]; + int i; - if (ioc_log_file_command[0] != '\0') { + if (ioc_log_file_command[0] != '\0') { - /* - * Use popen() to execute command and grab output. - */ - pipe = popen(ioc_log_file_command, "r"); - if (pipe == NULL) { - fprintf(stderr, - "Problem executing `%s' because `%s'\n", - ioc_log_file_command, - strerror(errno)); - return IOCLS_ERROR; - } - if (fgets(dir, sizeof(dir), pipe) == NULL) { - fprintf(stderr, - "Problem reading o/p from `%s' because `%s'\n", - ioc_log_file_command, - strerror(errno)); - (void) pclose(pipe); - return IOCLS_ERROR; - } - (void) pclose(pipe); + /* + * Use popen() to execute command and grab output. + */ + pipe = popen(ioc_log_file_command, "r"); + if (pipe == NULL) { + fprintf(stderr, + "Problem executing `%s' because `%s'\n", + ioc_log_file_command, + strerror(errno)); + return IOCLS_ERROR; + } + if (fgets(dir, sizeof(dir), pipe) == NULL) { + fprintf(stderr, + "Problem reading o/p from `%s' because `%s'\n", + ioc_log_file_command, + strerror(errno)); + (void) pclose(pipe); + return IOCLS_ERROR; + } + (void) pclose(pipe); - /* - * Terminate output at first newline and discard trailing - * slash character if present.. - */ - for (i=0; dir[i] != '\n' && dir[i] != '\0'; i++) - ; - dir[i] = '\0'; + /* + * Terminate output at first newline and discard trailing + * slash character if present.. + */ + for (i=0; dir[i] != '\n' && dir[i] != '\0'; i++) + ; + dir[i] = '\0'; - i = strlen(dir); - if (i > 1 && dir[i-1] == '/') dir[i-1] = '\0'; + i = strlen(dir); + if (i > 1 && dir[i-1] == '/') dir[i-1] = '\0'; - /* - * Use output as directory part of file name. - */ - if (dir[0] != '\0') { - char *name = ioc_log_file_name; - char *slash = strrchr(ioc_log_file_name, '/'); - char temp[256]; + /* + * Use output as directory part of file name. + */ + if (dir[0] != '\0') { + char *name = ioc_log_file_name; + char *slash = strrchr(ioc_log_file_name, '/'); + char temp[256]; - if (slash != NULL) name = slash + 1; - strcpy(temp,name); - sprintf(ioc_log_file_name,"%s/%s",dir,temp); - } - } - return IOCLS_OK; + if (slash != NULL) name = slash + 1; + strcpy(temp,name); + sprintf(ioc_log_file_name,"%s/%s",dir,temp); + } + } + return IOCLS_OK; } #endif diff --git a/modules/libcom/src/log/logClient.h b/modules/libcom/src/log/logClient.h index 66e4e4393..2cf2fca11 100644 --- a/modules/libcom/src/log/logClient.h +++ b/modules/libcom/src/log/logClient.h @@ -5,14 +5,14 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* logClient.h,v 1.5.2.1 2003/07/08 00:08:06 jhill Exp */ /* * - * Author: Jeffrey O. Hill - * Date: 080791 + * Author: Jeffrey O. Hill + * Date: 080791 */ #ifndef INClogClienth diff --git a/modules/libcom/src/macLib/macCore.c b/modules/libcom/src/macLib/macCore.c index e9d80f475..857ee65d7 100644 --- a/modules/libcom/src/macLib/macCore.c +++ b/modules/libcom/src/macLib/macCore.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Implementation of core macro substitution library (macLib) @@ -251,7 +251,7 @@ epicsStdCall macPutValue( /* handle NULL value case: if name was found, delete entry (may be several entries at different scoping levels) */ if ( value == NULL ) { - /* + /* * FIXME: shouldn't be able to delete entries from lower scopes * NOTE: when this is changed, this functionality of removing * a macro from all scopes will still be needed by iocshEnvClear @@ -259,11 +259,11 @@ epicsStdCall macPutValue( while ( ( entry = lookup( handle, name, FALSE ) ) != NULL ) { int done = strcmp(entry->type, "environment variable") == 0; delete( handle, entry ); - + if (done) break; } - + return 0; } @@ -658,7 +658,7 @@ static long expand( MAC_HANDLE *handle ) entry->rawval ? entry->rawval : "" ); if ( entry->value == NULL ) { - if ( ( entry->value = malloc( MAC_SIZE + 1 ) ) == NULL ) { + if ( ( entry->value = malloc( MAC_SIZE + 1 ) ) == NULL ) { return -1; } } diff --git a/modules/libcom/src/macLib/macEnv.c b/modules/libcom/src/macLib/macEnv.c index 9186c67e9..d173c7191 100644 --- a/modules/libcom/src/macLib/macEnv.c +++ b/modules/libcom/src/macLib/macEnv.c @@ -2,7 +2,7 @@ * Copyright (c) 2009 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Macro expansion of environment variables @@ -30,7 +30,7 @@ macDefExpand(const char *str, MAC_HANDLE *macros) long destCapacity = 128; char *dest = NULL; int n; - + if (macros) { handle = macros; } else { diff --git a/modules/libcom/src/macLib/macUtil.c b/modules/libcom/src/macLib/macUtil.c index 9171aa6ba..e7bd63f0e 100644 --- a/modules/libcom/src/macLib/macUtil.c +++ b/modules/libcom/src/macLib/macUtil.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Implementation of utility macro substitution library (macLib) @@ -28,18 +28,18 @@ * and escapes are honored but only removed from macro names (not * values) */ -long /* #defns encountered; <0 = ERROR */ +long /* #defns encountered; <0 = ERROR */ epicsStdCall macParseDefns( - MAC_HANDLE *handle, /* opaque handle; can be NULL if default */ - /* special characters are to be used */ + MAC_HANDLE *handle, /* opaque handle; can be NULL if default */ + /* special characters are to be used */ - const char *defns, /* macro definitions in "a=xxx,b=yyy" */ - /* format */ + const char *defns, /* macro definitions in "a=xxx,b=yyy" */ + /* format */ - char **pairs[] ) /* address of variable to receive pointer */ - /* to NULL-terminated array of {name, */ - /* value} pair strings; all storage is */ - /* allocated contiguously */ + char **pairs[] ) /* address of variable to receive pointer */ + /* to NULL-terminated array of {name, */ + /* value} pair strings; all storage is */ + /* allocated contiguously */ { static const size_t altNumMax = 4; size_t numMax; @@ -58,7 +58,7 @@ epicsStdCall macParseDefns( /* debug output */ if ( handle && (handle->debug & 1) ) - printf( "macParseDefns( %s )\n", defns ); + printf( "macParseDefns( %s )\n", defns ); /* allocate temporary pointer arrays; in worst case they need to have as many entries as the length of the defns string */ @@ -79,91 +79,91 @@ epicsStdCall macParseDefns( state = preName; for ( c = (const char *) defns; *c != '\0'; c++ ) { - /* handle quotes */ - if ( quote ) - quote = ( *c == quote ) ? 0 : quote; - else if ( *c == '\'' || *c == '"' ) - quote = *c; + /* handle quotes */ + if ( quote ) + quote = ( *c == quote ) ? 0 : quote; + else if ( *c == '\'' || *c == '"' ) + quote = *c; - /* handle escapes (pointer incremented below) */ - escape = ( *c == '\\' && *( c + 1 ) != '\0' ); + /* handle escapes (pointer incremented below) */ + escape = ( *c == '\\' && *( c + 1 ) != '\0' ); - switch ( state ) { - case preName: - if ( !quote && !escape && ( isspace( (int) *c ) || *c == ',' ) ) break; - ptr[num] = c; - state = inName; - /* fall through (may be empty name) */ + switch ( state ) { + case preName: + if ( !quote && !escape && ( isspace( (int) *c ) || *c == ',' ) ) break; + ptr[num] = c; + state = inName; + /* fall through (may be empty name) */ - case inName: - if ( quote || escape || ( *c != '=' && *c != ',' ) ) break; - end[num] = c; - while ( end[num] > ptr[num] && isspace( (int) *( end[num] - 1 ) ) ) - end[num]--; - num++; - del[num] = FALSE; - state = preValue; - if ( *c != ',' ) break; - del[num] = TRUE; - /* fall through (','; will delete) */ + case inName: + if ( quote || escape || ( *c != '=' && *c != ',' ) ) break; + end[num] = c; + while ( end[num] > ptr[num] && isspace( (int) *( end[num] - 1 ) ) ) + end[num]--; + num++; + del[num] = FALSE; + state = preValue; + if ( *c != ',' ) break; + del[num] = TRUE; + /* fall through (','; will delete) */ - case preValue: - if ( !quote && !escape && isspace( (int) *c ) ) break; - ptr[num] = c; - state = inValue; - /* fall through (may be empty value) */ + case preValue: + if ( !quote && !escape && isspace( (int) *c ) ) break; + ptr[num] = c; + state = inValue; + /* fall through (may be empty value) */ - case inValue: - if ( quote || escape || *c != ',' ) break; - end[num] = c; - while ( end[num] > ptr[num] && isspace( (int) *( end[num] - 1 ) ) ) - end[num]--; - num++; - del[num] = FALSE; - state = preName; - break; - } + case inValue: + if ( quote || escape || *c != ',' ) break; + end[num] = c; + while ( end[num] > ptr[num] && isspace( (int) *( end[num] - 1 ) ) ) + end[num]--; + num++; + del[num] = FALSE; + state = preName; + break; + } - /* if this was escape, increment pointer now (couldn't do - before because could have ignored escape at start of name - or value) */ - if ( escape ) c++; + /* if this was escape, increment pointer now (couldn't do + before because could have ignored escape at start of name + or value) */ + if ( escape ) c++; } /* tidy up from state at end of string */ switch ( state ) { case preName: - break; + break; case inName: - end[num] = c; - while ( end[num] > ptr[num] && isspace( (int) *( end[num] - 1 ) ) ) - end[num]--; - num++; - del[num] = TRUE; + end[num] = c; + while ( end[num] > ptr[num] && isspace( (int) *( end[num] - 1 ) ) ) + end[num]--; + num++; + del[num] = TRUE; case preValue: - ptr[num] = c; + ptr[num] = c; case inValue: - end[num] = c; - while ( end[num] > ptr[num] && isspace( (int) *( end[num] - 1 ) ) ) - end[num]--; - num++; - del[num] = FALSE; + end[num] = c; + while ( end[num] > ptr[num] && isspace( (int) *( end[num] - 1 ) ) ) + end[num]--; + num++; + del[num] = FALSE; } /* debug output */ if ( handle != NULL && handle->debug & 4 ) - for ( i = 0; i < num; i += 2 ) - printf( "[%ld] %.*s = [%ld] %.*s (%s) (%s)\n", - (long) (end[i+0] - ptr[i+0]), (int) (end[i+0] - ptr[i+0]), ptr[i+0], - (long) (end[i+1] - ptr[i+1]), (int) (end[i+1] - ptr[i+1]), ptr[i+1], - del[i+0] ? "del" : "nodel", - del[i+1] ? "del" : "nodel" ); + for ( i = 0; i < num; i += 2 ) + printf( "[%ld] %.*s = [%ld] %.*s (%s) (%s)\n", + (long) (end[i+0] - ptr[i+0]), (int) (end[i+0] - ptr[i+0]), ptr[i+0], + (long) (end[i+1] - ptr[i+1]), (int) (end[i+1] - ptr[i+1]), ptr[i+1], + del[i+0] ? "del" : "nodel", + del[i+1] ? "del" : "nodel" ); /* calculate how much memory to allocate: pointers followed by strings */ nbytes = ( num + 2 ) * sizeof( char * ); for ( i = 0; i < num; i++ ) - nbytes += end[i] - ptr[i] + 1; + nbytes += end[i] - ptr[i] + 1; /* allocate memory and set returned pairs pointer */ memCp = malloc( nbytes ); @@ -176,16 +176,16 @@ epicsStdCall macParseDefns( memCp += ( num + 2 ) * sizeof( char * ); for ( i = 0; i < num; i++ ) { - /* if no '=' followed the name, macro will be deleted */ - if ( del[i] ) - *memCpp++ = NULL; - else - *memCpp++ = memCp; + /* if no '=' followed the name, macro will be deleted */ + if ( del[i] ) + *memCpp++ = NULL; + else + *memCpp++ = memCp; - /* copy value regardless of the above */ - strncpy( memCp, (const char *) ptr[i], end[i] - ptr[i] ); - memCp += end[i] - ptr[i]; - *memCp++ = '\0'; + /* copy value regardless of the above */ + strncpy( memCp, (const char *) ptr[i], end[i] - ptr[i] ); + memCp += end[i] - ptr[i]; + *memCp++ = '\0'; } /* add two NULL pointers */ @@ -195,31 +195,31 @@ epicsStdCall macParseDefns( /* remove quotes and escapes from names in place (unlike values, they will not be re-parsed) */ for ( p = *pairs; *p != NULL; p += 2 ) { - quote = 0; - for ( s = d = *p; *s != '\0'; s++ ) { + quote = 0; + for ( s = d = *p; *s != '\0'; s++ ) { - /* quotes are not copied */ - if ( quote ) { - if ( *s == quote ) { - quote = 0; - continue; - } - } - else if ( *s == '\'' || *s == '"' ) { - quote = *s; - continue; - } + /* quotes are not copied */ + if ( quote ) { + if ( *s == quote ) { + quote = 0; + continue; + } + } + else if ( *s == '\'' || *s == '"' ) { + quote = *s; + continue; + } - /* escapes are not copied but next character is */ - if ( *s == '\\' && *( s + 1 ) != '\0' ) - s++; + /* escapes are not copied but next character is */ + if ( *s == '\\' && *( s + 1 ) != '\0' ) + s++; - /* others are copied */ - *d++ = *s; - } + /* others are copied */ + *d++ = *s; + } - /* need to terminate destination */ - *d++ = '\0'; + /* need to terminate destination */ + *d++ = '\0'; } /* free workspace */ @@ -229,7 +229,7 @@ epicsStdCall macParseDefns( /* debug output */ if ( handle != NULL && handle->debug & 1 ) - printf( "macParseDefns() -> %d\n", num / 2 ); + printf( "macParseDefns() -> %d\n", num / 2 ); /* success exit; return number of definitions */ return num / 2; @@ -247,35 +247,35 @@ error: /* * Install an array of name / value pairs as macro definitions. The * array should have an even number of elements followed by at least - * one (preferably two) NULL pointers + * one (preferably two) NULL pointers */ -long /* #macros defined; <0 = ERROR */ +long /* #macros defined; <0 = ERROR */ epicsStdCall macInstallMacros( - MAC_HANDLE *handle, /* opaque handle */ + MAC_HANDLE *handle, /* opaque handle */ - char *pairs[] ) /* pointer to NULL-terminated array of */ - /* {name,value} pair strings; a NULL */ - /* value implies undefined; a NULL */ - /* argument implies no macros */ + char *pairs[] ) /* pointer to NULL-terminated array of */ + /* {name,value} pair strings; a NULL */ + /* value implies undefined; a NULL */ + /* argument implies no macros */ { int n; char **p; /* debug output */ if ( handle->debug & 1 ) - printf( "macInstallMacros( %s, %s, ... )\n", - pairs && pairs[0] ? pairs[0] : "NULL", - pairs && pairs[1] ? pairs[1] : "NULL" ); + printf( "macInstallMacros( %s, %s, ... )\n", + pairs && pairs[0] ? pairs[0] : "NULL", + pairs && pairs[1] ? pairs[1] : "NULL" ); /* go through array defining macros */ for ( n = 0, p = pairs; p != NULL && p[0] != NULL; n++, p += 2 ) { - if ( macPutValue( handle, p[0], p[1] ) < 0 ) - return -1; + if ( macPutValue( handle, p[0], p[1] ) < 0 ) + return -1; } /* debug output */ if ( handle->debug & 1 ) - printf( "macInstallMacros() -> %d\n", n ); + printf( "macInstallMacros() -> %d\n", n ); /* return number of macros defined */ return n; diff --git a/modules/libcom/src/misc/aToIPAddr.c b/modules/libcom/src/misc/aToIPAddr.c index 3a05a3e94..868320f65 100644 --- a/modules/libcom/src/misc/aToIPAddr.c +++ b/modules/libcom/src/misc/aToIPAddr.c @@ -8,7 +8,7 @@ \*************************************************************************/ /* * rational replacement for inet_addr() - * + * * author: Jeff Hill */ #include @@ -24,7 +24,7 @@ /* * addrArrayToUL () */ -static int addrArrayToUL ( const unsigned *pAddr, +static int addrArrayToUL ( const unsigned *pAddr, unsigned nElements, struct in_addr *pIpAddr ) { unsigned i; @@ -38,7 +38,7 @@ static int addrArrayToUL ( const unsigned *pAddr, addr |= ( epicsUInt32 ) pAddr[i]; } pIpAddr->s_addr = htonl ( addr ); - + return 0; } @@ -47,7 +47,7 @@ static int addrArrayToUL ( const unsigned *pAddr, * !! ipAddr should be passed in in network byte order !! * !! port is passed in in host byte order !! */ -static int initIPAddr ( struct in_addr ipAddr, unsigned port, +static int initIPAddr ( struct in_addr ipAddr, unsigned port, struct sockaddr_in *pIP ) { if ( port > 0xffff ) { @@ -70,29 +70,29 @@ static int initIPAddr ( struct in_addr ipAddr, unsigned port, * to specify a port number, and allows also a * named host to be specified. * - * Sets the port number to "defaultPort" only if + * Sets the port number to "defaultPort" only if * "pAddrString" does not contain an address of the form * "n.n.n.n:p or host:p" */ LIBCOM_API int epicsStdCall -aToIPAddr( const char *pAddrString, unsigned short defaultPort, +aToIPAddr( const char *pAddrString, unsigned short defaultPort, struct sockaddr_in *pIP ) { int status; unsigned addr[4]; unsigned long rawAddr; - /* - * !! change n elements here requires change in format below !! + /* + * !! change n elements here requires change in format below !! */ - char hostName[512]; - char dummy[8]; + char hostName[512]; + char dummy[8]; unsigned port; struct in_addr ina; /* * dotted ip addresses */ - status = sscanf ( pAddrString, " %u . %u . %u . %u %7s ", + status = sscanf ( pAddrString, " %u . %u . %u . %u %7s ", addr, addr+1u, addr+2u, addr+3u, dummy ); if ( status == 4 ) { if ( addrArrayToUL ( addr, NELEMENTS ( addr ), & ina ) < 0 ) { @@ -101,11 +101,11 @@ aToIPAddr( const char *pAddrString, unsigned short defaultPort, port = defaultPort; return initIPAddr ( ina, port, pIP ); } - + /* * dotted ip addresses and port */ - status = sscanf ( pAddrString, " %u . %u . %u . %u : %u %7s", + status = sscanf ( pAddrString, " %u . %u . %u . %u : %u %7s", addr, addr+1u, addr+2u, addr+3u, &port, dummy ); if ( status >= 5 ) { if ( status > 5 ) { @@ -135,7 +135,7 @@ aToIPAddr( const char *pAddrString, unsigned short defaultPort, return initIPAddr ( ina, port, pIP ); } } - + /* * IP address as a raw number, and port */ @@ -159,7 +159,7 @@ aToIPAddr( const char *pAddrString, unsigned short defaultPort, /* - * host name string + * host name string */ status = sscanf ( pAddrString, " %511[^:] %s ", hostName, dummy ); if ( status == 1 ) { @@ -169,11 +169,11 @@ aToIPAddr( const char *pAddrString, unsigned short defaultPort, return initIPAddr ( ina, port, pIP ); } } - + /* * host name string, and port */ - status = sscanf ( pAddrString, " %511[^:] : %u %s ", hostName, + status = sscanf ( pAddrString, " %511[^:] : %u %s ", hostName, &port, dummy ); if ( status >= 2 ) { if ( status > 2 ) { diff --git a/modules/libcom/src/misc/adjustment.c b/modules/libcom/src/misc/adjustment.c index ec24881f7..79522da28 100644 --- a/modules/libcom/src/misc/adjustment.c +++ b/modules/libcom/src/misc/adjustment.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* src/libCom/adjustment.c */ @@ -32,23 +32,23 @@ LIBCOM_API size_t adjustToWorstCaseAlignment(size_t size) int test_double_size = sizeof(struct test_double) - sizeof(double); int test_ptr_size = sizeof(struct test_ptr) - sizeof(void *); size_t adjusted_size = size; - + /* * Use Jeff's alignment tests to determine worst case of long, * double or pointer alignment requirements. */ align_size = test_long_size > test_ptr_size ? test_long_size : test_ptr_size; - + align_size = align_size > test_double_size ? align_size : test_double_size; - + /* * Increase the size to fit worst case alignment if not already * properly aligned. - */ + */ adjust = align_size - size%align_size; if (adjust != align_size) adjusted_size += adjust; - + return (adjusted_size); } diff --git a/modules/libcom/src/misc/alarmString.c b/modules/libcom/src/misc/alarmString.c index b09f74b87..b85d5dbd9 100644 --- a/modules/libcom/src/misc/alarmString.c +++ b/modules/libcom/src/misc/alarmString.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* String names for alarm status and severity values */ diff --git a/modules/libcom/src/misc/cantProceed.c b/modules/libcom/src/misc/cantProceed.c index d5ac257ef..301f85f10 100644 --- a/modules/libcom/src/misc/cantProceed.c +++ b/modules/libcom/src/misc/cantProceed.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* Author: Marty Kraimer Date: 04JAN99 */ @@ -58,14 +58,14 @@ LIBCOM_API void cantProceed(const char *msg, ...) if (msg) errlogVprintf(msg, pvar); va_end(pvar); - + errlogPrintf("Thread %s (%p) can't proceed, suspending.\n", epicsThreadGetNameSelf(), (void *)epicsThreadGetIdSelf()); epicsStackTrace(); errlogFlush(); - + epicsThreadSleep(1.0); while (1) epicsThreadSuspendSelf(); diff --git a/modules/libcom/src/misc/epicsConvert.c b/modules/libcom/src/misc/epicsConvert.c index bbc29aa0e..9ce2eeeeb 100644 --- a/modules/libcom/src/misc/epicsConvert.c +++ b/modules/libcom/src/misc/epicsConvert.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /*epicsConvert.c*/ diff --git a/modules/libcom/src/misc/epicsExit.c b/modules/libcom/src/misc/epicsExit.c index af36bce5b..796b32187 100644 --- a/modules/libcom/src/misc/epicsExit.c +++ b/modules/libcom/src/misc/epicsExit.c @@ -4,19 +4,19 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /*epicsExit.c*/ -/* - * Author: Marty Kraimer +/* + * Author: Marty Kraimer * Date: 23AUG2004 * Thread exit revisions: Jeff Hill * Date: 06Dec2006 * - * Note that epicsExitCallAtThreadExits is currently called directly from the - * thread entry wrapper in OS dependent code. That approach might not work + * Note that epicsExitCallAtThreadExits is currently called directly from the + * thread entry wrapper in OS dependent code. That approach might not work * correctly if the thread exits indirectly instead of just returning from - * the function specified to epicsThreadCreate. For example the thread might + * the function specified to epicsThreadCreate. For example the thread might * exit via the exit() call. There might be OS dependent solutions for that * weakness. * diff --git a/modules/libcom/src/misc/epicsStdlib.c b/modules/libcom/src/misc/epicsStdlib.c index 328f519c8..5b22503b7 100644 --- a/modules/libcom/src/misc/epicsStdlib.c +++ b/modules/libcom/src/misc/epicsStdlib.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* Authors: Eric Norum & Andrew Johnson */ diff --git a/modules/libcom/src/misc/epicsString.c b/modules/libcom/src/misc/epicsString.c index 3f537b4bd..5eb2a5dba 100644 --- a/modules/libcom/src/misc/epicsString.c +++ b/modules/libcom/src/misc/epicsString.c @@ -5,7 +5,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* Authors: Jun-ichi Odagiri, Marty Kraimer, Eric Norum, diff --git a/modules/libcom/src/misc/epicsString.h b/modules/libcom/src/misc/epicsString.h index 79e5f4931..36fb6b7e3 100644 --- a/modules/libcom/src/misc/epicsString.h +++ b/modules/libcom/src/misc/epicsString.h @@ -5,7 +5,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* Authors: Jun-ichi Odagiri, Marty Kraimer, Eric Norum, diff --git a/modules/libcom/src/misc/epicsUnitTest.c b/modules/libcom/src/misc/epicsUnitTest.c index c2178e4b6..21a09aa9e 100644 --- a/modules/libcom/src/misc/epicsUnitTest.c +++ b/modules/libcom/src/misc/epicsUnitTest.c @@ -114,20 +114,20 @@ int testOkV(int pass, const char *fmt, va_list pvar) { epicsMutexMustLock(testLock); tested++; if (pass) { - result += 4; /* skip "not " */ - passed++; - if (todo) - bonus++; + result += 4; /* skip "not " */ + passed++; + if (todo) + bonus++; } else { - if (todo) - passed++; - else - failed++; + if (todo) + passed++; + else + failed++; } printf("%s %2d - ", result, tested); vprintf(fmt, pvar); if (todo) - printf(" # TODO %s", todo); + printf(" # TODO %s", todo); putchar('\n'); fflush(stdout); epicsMutexUnlock(testLock); @@ -159,10 +159,10 @@ void testFail(const char *fmt, ...) { void testSkip(int skip, const char *why) { epicsMutexMustLock(testLock); while (skip-- > 0) { - tested++; - passed++; - skipped++; - printf("ok %2d # SKIP %s\n", tested, why); + tested++; + passed++; + skipped++; + printf("ok %2d # SKIP %s\n", tested, why); } fflush(stdout); epicsMutexUnlock(testLock); @@ -208,28 +208,28 @@ static void testResult(const char *result, int count) { int testDone(void) { int status = 0; - + epicsMutexMustLock(testLock); if (perlHarness) { - if (!planned) printf("1..%d\n", tested); + if (!planned) printf("1..%d\n", tested); } else { - if (planned && tested > planned) { - printf("\nRan %d tests but only planned for %d!\n", tested, planned); - status = 2; - } else if (planned && tested < planned) { - printf("\nPlanned %d tests but only ran %d\n", planned, tested); - status = 2; - } - printf("\n Results\n =======\n Tests: %-3d\n", tested); - if (tested) { - testResult("Passed", passed); - if (bonus) testResult("Todo Passes", bonus); - if (failed) { - testResult("Failed", failed); - status = 1; - } - if (skipped) testResult("Skipped", skipped); - } + if (planned && tested > planned) { + printf("\nRan %d tests but only planned for %d!\n", tested, planned); + status = 2; + } else if (planned && tested < planned) { + printf("\nPlanned %d tests but only ran %d\n", planned, tested); + status = 2; + } + printf("\n Results\n =======\n Tests: %-3d\n", tested); + if (tested) { + testResult("Passed", passed); + if (bonus) testResult("Todo Passes", bonus); + if (failed) { + testResult("Failed", failed); + status = 1; + } + if (skipped) testResult("Skipped", skipped); + } } if (Harness) { if (failed) { diff --git a/modules/libcom/src/misc/ipAddrToAsciiAsynchronous.cpp b/modules/libcom/src/misc/ipAddrToAsciiAsynchronous.cpp index 4698a7af7..4764eb286 100644 --- a/modules/libcom/src/misc/ipAddrToAsciiAsynchronous.cpp +++ b/modules/libcom/src/misc/ipAddrToAsciiAsynchronous.cpp @@ -5,12 +5,12 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* - * Author Jeffrey O. Hill - * johill@lanl.gov +/* + * Author Jeffrey O. Hill + * johill@lanl.gov */ #include @@ -32,27 +32,27 @@ #include "errlog.h" // - this class implements the asynchronous DNS query -// - it completes early with the host name in dotted IP address form +// - it completes early with the host name in dotted IP address form // if the ipAddrToAsciiEngine is destroyed before IO completion // or if there are too many items already in the engine's queue. -class ipAddrToAsciiTransactionPrivate : +class ipAddrToAsciiTransactionPrivate : public ipAddrToAsciiTransaction, public tsDLNode < ipAddrToAsciiTransactionPrivate > { public: ipAddrToAsciiTransactionPrivate ( class ipAddrToAsciiEnginePrivate & engineIn ); virtual ~ipAddrToAsciiTransactionPrivate (); osiSockAddr address () const; - void show ( unsigned level ) const; - void * operator new ( size_t size, tsFreeList + void show ( unsigned level ) const; + void * operator new ( size_t size, tsFreeList < ipAddrToAsciiTransactionPrivate, 0x80 > & ); - epicsPlacementDeleteOperator (( void *, tsFreeList + epicsPlacementDeleteOperator (( void *, tsFreeList < ipAddrToAsciiTransactionPrivate, 0x80 > & )) osiSockAddr addr; ipAddrToAsciiEnginePrivate & engine; ipAddrToAsciiCallBack * pCB; bool pending; void ipAddrToAscii ( const osiSockAddr &, ipAddrToAsciiCallBack & ); - void release (); + void release (); void operator delete ( void * ); private: ipAddrToAsciiTransactionPrivate & operator = ( const ipAddrToAsciiTransactionPrivate & ); @@ -64,7 +64,7 @@ private: # pragma warning ( disable:4660 ) #endif -template class tsFreeList +template class tsFreeList < ipAddrToAsciiTransactionPrivate, 0x80 >; #ifdef _MSC_VER @@ -103,12 +103,12 @@ struct ipAddrToAsciiGlobal : public epicsThreadRunable { // - this class executes the synchronous DNS query // - it creates one thread -class ipAddrToAsciiEnginePrivate : +class ipAddrToAsciiEnginePrivate : public ipAddrToAsciiEngine { public: ipAddrToAsciiEnginePrivate() :refcount(1u), released(false) {} virtual ~ipAddrToAsciiEnginePrivate () {} - void show ( unsigned level ) const; + void show ( unsigned level ) const; unsigned refcount; bool released; @@ -119,7 +119,7 @@ public: private: ipAddrToAsciiEnginePrivate ( const ipAddrToAsciiEngine & ); - ipAddrToAsciiEnginePrivate & operator = ( const ipAddrToAsciiEngine & ); + ipAddrToAsciiEnginePrivate & operator = ( const ipAddrToAsciiEngine & ); }; ipAddrToAsciiGlobal * ipAddrToAsciiEnginePrivate :: pEngine = 0; @@ -155,9 +155,9 @@ void ipAddrToAsciiEngine::cleanup() ipAddrToAsciiEnginePrivate::pEngine = 0; } -// for now its probably sufficent to allocate one +// for now its probably sufficent to allocate one // DNS transaction thread for all codes sharing -// the same process that need DNS services but we +// the same process that need DNS services but we // leave our options open for the future ipAddrToAsciiEngine & ipAddrToAsciiEngine::allocate () { @@ -234,7 +234,7 @@ void ipAddrToAsciiEnginePrivate::release () void ipAddrToAsciiEnginePrivate::show ( unsigned level ) const { epicsGuard < epicsMutex > guard ( this->pEngine->mutex ); - printf ( "ipAddrToAsciiEngine at %p with %u requests pending\n", + printf ( "ipAddrToAsciiEngine at %p with %u requests pending\n", static_cast (this), this->pEngine->labor.count () ); if ( level > 0u ) { tsDLIter < ipAddrToAsciiTransactionPrivate > @@ -254,14 +254,14 @@ void ipAddrToAsciiEnginePrivate::show ( unsigned level ) const } } -inline void * ipAddrToAsciiTransactionPrivate::operator new ( size_t size, tsFreeList +inline void * ipAddrToAsciiTransactionPrivate::operator new ( size_t size, tsFreeList < ipAddrToAsciiTransactionPrivate, 0x80 > & freeList ) { return freeList.allocate ( size ); } #ifdef CXX_PLACEMENT_DELETE -inline void ipAddrToAsciiTransactionPrivate::operator delete ( void * pTrans, tsFreeList +inline void ipAddrToAsciiTransactionPrivate::operator delete ( void * pTrans, tsFreeList < ipAddrToAsciiTransactionPrivate, 0x80 > & freeList ) { freeList.release ( pTrans ); @@ -310,10 +310,10 @@ void ipAddrToAsciiGlobal::run () } osiSockAddr addr = pItem->addr; this->pCurrent = pItem; - + if ( this->exitFlag ) { - sockAddrToDottedIP ( & addr.sa, this->nameTmp, + sockAddrToDottedIP ( & addr.sa, this->nameTmp, sizeof ( this->nameTmp ) ); } else { @@ -324,7 +324,7 @@ void ipAddrToAsciiGlobal::run () } // the ipAddrToAsciiTransactionPrivate destructor is allowed to - // set pCurrent to nill and avoid blocking on a slow DNS + // set pCurrent to nill and avoid blocking on a slow DNS // operation if ( ! this->pCurrent ) { continue; @@ -356,7 +356,7 @@ void ipAddrToAsciiGlobal::run () } } -ipAddrToAsciiTransactionPrivate::ipAddrToAsciiTransactionPrivate +ipAddrToAsciiTransactionPrivate::ipAddrToAsciiTransactionPrivate ( ipAddrToAsciiEnginePrivate & engineIn ) : engine ( engineIn ), pCB ( 0 ), pending ( false ) { @@ -417,7 +417,7 @@ ipAddrToAsciiTransactionPrivate::~ipAddrToAsciiTransactionPrivate () } } -void ipAddrToAsciiTransactionPrivate::ipAddrToAscii ( +void ipAddrToAsciiTransactionPrivate::ipAddrToAscii ( const osiSockAddr & addrIn, ipAddrToAsciiCallBack & cbIn ) { bool success; @@ -448,7 +448,7 @@ void ipAddrToAsciiTransactionPrivate::ipAddrToAscii ( } else { char autoNameTmp[256]; - sockAddrToDottedIP ( & addrIn.sa, autoNameTmp, + sockAddrToDottedIP ( & addrIn.sa, autoNameTmp, sizeof ( autoNameTmp ) ); cbIn.transactionComplete ( autoNameTmp ); } diff --git a/modules/libcom/src/misc/ipAddrToAsciiAsynchronous.h b/modules/libcom/src/misc/ipAddrToAsciiAsynchronous.h index 64a0efa73..bfbff0afc 100644 --- a/modules/libcom/src/misc/ipAddrToAsciiAsynchronous.h +++ b/modules/libcom/src/misc/ipAddrToAsciiAsynchronous.h @@ -5,12 +5,12 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* - * Author Jeffrey O. Hill - * johill@lanl.gov +/* + * Author Jeffrey O. Hill + * johill@lanl.gov */ #ifndef ipAddrToAsciiAsynchronous_h @@ -22,25 +22,25 @@ class LIBCOM_API ipAddrToAsciiCallBack { public: virtual void transactionComplete ( const char * pHostName ) = 0; - virtual void show ( unsigned level ) const; + virtual void show ( unsigned level ) const; virtual ~ipAddrToAsciiCallBack () = 0; }; class LIBCOM_API ipAddrToAsciiTransaction { public: - virtual void release () = 0; + virtual void release () = 0; virtual void ipAddrToAscii ( const osiSockAddr &, ipAddrToAsciiCallBack & ) = 0; virtual osiSockAddr address () const = 0; - virtual void show ( unsigned level ) const = 0; + virtual void show ( unsigned level ) const = 0; protected: virtual ~ipAddrToAsciiTransaction () = 0; }; class LIBCOM_API ipAddrToAsciiEngine { public: - virtual void release () = 0; + virtual void release () = 0; virtual ipAddrToAsciiTransaction & createTransaction () = 0; - virtual void show ( unsigned level ) const = 0; + virtual void show ( unsigned level ) const = 0; static ipAddrToAsciiEngine & allocate (); protected: virtual ~ipAddrToAsciiEngine () = 0; diff --git a/modules/libcom/src/misc/locationException.h b/modules/libcom/src/misc/locationException.h index 30b187208..ee5cc883d 100644 --- a/modules/libcom/src/misc/locationException.h +++ b/modules/libcom/src/misc/locationException.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ // diff --git a/modules/libcom/src/misc/makeEpicsVersion.pl b/modules/libcom/src/misc/makeEpicsVersion.pl index 42fe37449..b42190064 100644 --- a/modules/libcom/src/misc/makeEpicsVersion.pl +++ b/modules/libcom/src/misc/makeEpicsVersion.pl @@ -6,7 +6,7 @@ # Copyright (c) 2002 The Regents of the University of California, as # Operator of Los Alamos National Laboratory. # EPICS BASE is distributed subject to a Software License Agreement found -# in file LICENSE that is included with this distribution. +# in file LICENSE that is included with this distribution. #************************************************************************* use strict; diff --git a/modules/libcom/src/misc/testMain.h b/modules/libcom/src/misc/testMain.h index 7c4d9b29b..3af3be19f 100644 --- a/modules/libcom/src/misc/testMain.h +++ b/modules/libcom/src/misc/testMain.h @@ -19,7 +19,7 @@ * * #include "testMain.h" * #include "epicsUnitTest.h" - * + * * MAIN(myProgTest) { * testPlan(...); * testOk(...) diff --git a/modules/libcom/src/misc/truncateFile.c b/modules/libcom/src/misc/truncateFile.c index 4271867d5..904c28513 100644 --- a/modules/libcom/src/misc/truncateFile.c +++ b/modules/libcom/src/misc/truncateFile.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include @@ -26,112 +26,112 @@ */ LIBCOM_API enum TF_RETURN truncateFile (const char *pFileName, unsigned long size) { - long filePos; - FILE *pFile; - FILE *ptmp; - int status; - int c; - unsigned charNo; + long filePos; + FILE *pFile; + FILE *ptmp; + int status; + int c; + unsigned charNo; - /* - * see cast of size to long below - */ - if (size>LONG_MAX) { - return TF_ERROR; - } - - pFile = fopen(pFileName, "r"); - if (!pFile) { - fprintf (stderr, - "File access problems to `%s' because `%s'\n", - pFileName, - strerror(errno)); - return TF_ERROR; - } + /* + * see cast of size to long below + */ + if (size>LONG_MAX) { + return TF_ERROR; + } - /* - * This is not required under UNIX but does appear - * to be required under WIN32. - */ - status = fseek (pFile, 0L, SEEK_END); - if (status!=TF_OK) { - fclose (pFile); - return TF_ERROR; - } + pFile = fopen(pFileName, "r"); + if (!pFile) { + fprintf (stderr, + "File access problems to `%s' because `%s'\n", + pFileName, + strerror(errno)); + return TF_ERROR; + } - filePos = ftell(pFile); - if (filePos <= (long) size) { - fclose (pFile); - return TF_OK; - } + /* + * This is not required under UNIX but does appear + * to be required under WIN32. + */ + status = fseek (pFile, 0L, SEEK_END); + if (status!=TF_OK) { + fclose (pFile); + return TF_ERROR; + } - ptmp = epicsTempFile(); - if (!ptmp) { - fprintf (stderr, - "File access problems to temp file because `%s'\n", - strerror(errno)); - fclose (pFile); - return TF_ERROR; - } - rewind (pFile); - charNo = 0u; - while (charNo= 401 ) @@ -50,13 +50,13 @@ extern "C" { #endif -/* +/* * We are optimistic that __sync_synchronize is implemented - * in all version four gcc invariant of target. The gnu doc + * in all version four gcc invariant of target. The gnu doc * seems to say that when not supported by architecture a call * to an external function is generated but in practice - * this isn`t the case for some of the atomic intrinsics, and - * so there is an undefined symbol. So far we have not seen + * this isn`t the case for some of the atomic intrinsics, and + * so there is an undefined symbol. So far we have not seen * that with __sync_synchronize, but we can only guess based * on experimental evidence. * @@ -108,7 +108,7 @@ EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void) #endif /* if GCC_ATOMIC_INTRINSICS_GCC4_OR_BETTER */ #if GCC_ATOMIC_INTRINSICS_AVAIL_INT_T \ - || GCC_ATOMIC_INTRINSICS_AVAIL_EARLIER + || GCC_ATOMIC_INTRINSICS_AVAIL_EARLIER #define EPICS_ATOMIC_INCR_INTT EPICS_ATOMIC_INLINE int epicsAtomicIncrIntT ( int * pTarget ) @@ -125,11 +125,11 @@ EPICS_ATOMIC_INLINE int epicsAtomicDecrIntT ( int * pTarget ) #define EPICS_ATOMIC_ADD_INTT EPICS_ATOMIC_INLINE int epicsAtomicAddIntT ( int * pTarget, int delta ) { - return __sync_add_and_fetch ( pTarget, delta ); + return __sync_add_and_fetch ( pTarget, delta ); } #define EPICS_ATOMIC_CAS_INTT -EPICS_ATOMIC_INLINE int epicsAtomicCmpAndSwapIntT ( int * pTarget, +EPICS_ATOMIC_INLINE int epicsAtomicCmpAndSwapIntT ( int * pTarget, int oldVal, int newVal ) { return __sync_val_compare_and_swap ( pTarget, oldVal, newVal); @@ -138,7 +138,7 @@ EPICS_ATOMIC_INLINE int epicsAtomicCmpAndSwapIntT ( int * pTarget, #endif /* if GCC_ATOMIC_INTRINSICS_AVAIL_INT_T */ #if GCC_ATOMIC_INTRINSICS_AVAIL_SIZE_T \ - || GCC_ATOMIC_INTRINSICS_AVAIL_EARLIER + || GCC_ATOMIC_INTRINSICS_AVAIL_EARLIER #define EPICS_ATOMIC_INCR_SIZET EPICS_ATOMIC_INLINE size_t epicsAtomicIncrSizeT ( size_t * pTarget ) @@ -155,25 +155,25 @@ EPICS_ATOMIC_INLINE size_t epicsAtomicDecrSizeT ( size_t * pTarget ) #define EPICS_ATOMIC_ADD_SIZET EPICS_ATOMIC_INLINE size_t epicsAtomicAddSizeT ( size_t * pTarget, size_t delta ) { - return __sync_add_and_fetch ( pTarget, delta ); + return __sync_add_and_fetch ( pTarget, delta ); } #define EPICS_ATOMIC_SUB_SIZET EPICS_ATOMIC_INLINE size_t epicsAtomicSubSizeT ( size_t * pTarget, size_t delta ) { - return __sync_sub_and_fetch ( pTarget, delta ); + return __sync_sub_and_fetch ( pTarget, delta ); } #define EPICS_ATOMIC_CAS_SIZET -EPICS_ATOMIC_INLINE size_t epicsAtomicCmpAndSwapSizeT ( size_t * pTarget, +EPICS_ATOMIC_INLINE size_t epicsAtomicCmpAndSwapSizeT ( size_t * pTarget, size_t oldVal, size_t newVal ) { return __sync_val_compare_and_swap ( pTarget, oldVal, newVal); } #define EPICS_ATOMIC_CAS_PTRT -EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT ( - EpicsAtomicPtrT * pTarget, +EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT ( + EpicsAtomicPtrT * pTarget, EpicsAtomicPtrT oldVal, EpicsAtomicPtrT newVal ) { return __sync_val_compare_and_swap ( pTarget, oldVal, newVal); diff --git a/modules/libcom/src/osi/compiler/msvc/compilerSpecific.h b/modules/libcom/src/osi/compiler/msvc/compilerSpecific.h index 4e282db4b..6178445ce 100644 --- a/modules/libcom/src/osi/compiler/msvc/compilerSpecific.h +++ b/modules/libcom/src/osi/compiler/msvc/compilerSpecific.h @@ -4,18 +4,18 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* - * Author: + * Author: * Jeffrey O. Hill * johill@lanl.gov */ #ifndef compilerSpecific_h #define compilerSpecific_h - + #ifndef _MSC_VER # error compiler/msvc/compilerSpecific.h is only for use with the Microsoft compiler #endif @@ -29,11 +29,11 @@ /* * in general we dont like ifdefs but they do allow us to check the - * compiler version and make the optimistic assumption that - * standards incompliance issues will be fixed by future compiler + * compiler version and make the optimistic assumption that + * standards incompliance issues will be fixed by future compiler * releases */ - + /* * CXX_PLACEMENT_DELETE - defined if compiler supports placement delete * CXX_THROW_SPECIFICATION - defined if compiler supports throw specification diff --git a/modules/libcom/src/osi/compiler/msvc/epicsAtomicCD.h b/modules/libcom/src/osi/compiler/msvc/epicsAtomicCD.h index e7d1c4b77..8843f6bbf 100644 --- a/modules/libcom/src/osi/compiler/msvc/epicsAtomicCD.h +++ b/modules/libcom/src/osi/compiler/msvc/epicsAtomicCD.h @@ -5,7 +5,7 @@ * Copyright (c) 2011 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -41,15 +41,15 @@ # define MS_ATOMIC_64 # pragma intrinsic ( __faststorefence ) EPICS_ATOMIC_INLINE void epicsAtomicMemoryBarrier (void) - { + { __faststorefence (); } #elif defined ( _M_IA64 ) # define MS_ATOMIC_64 # pragma intrinsic ( __mf ) EPICS_ATOMIC_INLINE void epicsAtomicMemoryBarrier (void) - { - __mf (); + { + __mf (); } #else # error unexpected target architecture, msvc version of epicsAtomicCD.h @@ -59,23 +59,23 @@ * The windows doc appears to recommend defining InterlockedExchange * to be _InterlockedExchange to cause it to be an intrinsic, but that * creates issues when later, in a windows os specific header, we include - * windows.h. Therefore, we except some code duplication between the msvc - * csAtomic.h and win32 osdAtomic.h to avoid problems, and to keep the + * windows.h. Therefore, we except some code duplication between the msvc + * csAtomic.h and win32 osdAtomic.h to avoid problems, and to keep the * os specific windows.h header file out of the msvc cdAtomic.h */ #define MS_LONG long #define MS_InterlockedExchange _InterlockedExchange #define MS_InterlockedCompareExchange _InterlockedCompareExchange -#define MS_InterlockedIncrement _InterlockedIncrement -#define MS_InterlockedDecrement _InterlockedDecrement +#define MS_InterlockedIncrement _InterlockedIncrement +#define MS_InterlockedDecrement _InterlockedDecrement #define MS_InterlockedExchange _InterlockedExchange #define MS_InterlockedExchangeAdd _InterlockedExchangeAdd -#if defined ( MS_ATOMIC_64 ) +#if defined ( MS_ATOMIC_64 ) # define MS_LONGLONG long long # define MS_InterlockedIncrement64 _InterlockedIncrement64 -# define MS_InterlockedDecrement64 _InterlockedDecrement64 -# define MS_InterlockedExchange64 _InterlockedExchange64 -# define MS_InterlockedExchangeAdd64 _InterlockedExchangeAdd64 +# define MS_InterlockedDecrement64 _InterlockedDecrement64 +# define MS_InterlockedExchange64 _InterlockedExchange64 +# define MS_InterlockedExchangeAdd64 _InterlockedExchangeAdd64 # define MS_InterlockedCompareExchange64 _InterlockedCompareExchange64 #endif @@ -106,7 +106,7 @@ EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void) #define EPICS_ATOMIC_CMPLR_NAME "MSVC-DIRECT" -/* +/* * if unavailable as an intrinsic we will try * for os specific inline solution */ diff --git a/modules/libcom/src/osi/compiler/solStudio/compilerSpecific.h b/modules/libcom/src/osi/compiler/solStudio/compilerSpecific.h index a9d59a5bf..9b87a9ccf 100644 --- a/modules/libcom/src/osi/compiler/solStudio/compilerSpecific.h +++ b/modules/libcom/src/osi/compiler/solStudio/compilerSpecific.h @@ -4,11 +4,11 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* - * Author: + * Author: * Jeffrey O. Hill * johill@lanl.gov */ diff --git a/modules/libcom/src/osi/compiler/solStudio/epicsAtomicCD.h b/modules/libcom/src/osi/compiler/solStudio/epicsAtomicCD.h index 8a733a558..970f33a9f 100644 --- a/modules/libcom/src/osi/compiler/solStudio/epicsAtomicCD.h +++ b/modules/libcom/src/osi/compiler/solStudio/epicsAtomicCD.h @@ -5,7 +5,7 @@ * Copyright (c) 2011 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/libcom/src/osi/compilerDependencies.h b/modules/libcom/src/osi/compilerDependencies.h index 82c89322b..70120e5a8 100644 --- a/modules/libcom/src/osi/compilerDependencies.h +++ b/modules/libcom/src/osi/compilerDependencies.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /** diff --git a/modules/libcom/src/osi/devLib.h b/modules/libcom/src/osi/devLib.h index 0f263bd90..c162130e1 100644 --- a/modules/libcom/src/osi/devLib.h +++ b/modules/libcom/src/osi/devLib.h @@ -25,13 +25,13 @@ * @{ */ /** \brief Create a bit mask for a given number of bits */ -#define devCreateMask(NBITS) ((1<<(NBITS))-1) +#define devCreateMask(NBITS) ((1<<(NBITS))-1) /** \brief Normalize a raw integer value and convert it to type double */ #define devDigToNml(DIGITAL,NBITS) \ - (((double)(DIGITAL))/devCreateMask(NBITS)) + (((double)(DIGITAL))/devCreateMask(NBITS)) /** \brief Convert a normalized value to a raw integer */ #define devNmlToDig(NORMAL,NBITS) \ - (((long)(NORMAL)) * devCreateMask(NBITS)) + (((long)(NORMAL)) * devCreateMask(NBITS)) /** @} */ /** diff --git a/modules/libcom/src/osi/devLibVME.c b/modules/libcom/src/osi/devLibVME.c index 72e29d601..998b615d2 100644 --- a/modules/libcom/src/osi/devLibVME.c +++ b/modules/libcom/src/osi/devLibVME.c @@ -6,14 +6,14 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* devLib.c - support for allocation of common device resources */ /* * Original Author: Marty Kraimer - * Author: Jeff Hill - * Date: 03-10-93 + * Author: Jeff Hill + * Date: 03-10-93 * * NOTES: * .01 06-14-93 joh needs devAllocInterruptVector() routine @@ -91,7 +91,7 @@ typedef struct{ static long devLibInit(void); static long addrVerify( - epicsAddressType addrType, + epicsAddressType addrType, size_t base, size_t size); @@ -112,7 +112,7 @@ static void report_conflict( const char *pOwnerName); static void report_conflict_device( - epicsAddressType addrType, + epicsAddressType addrType, const rangeItem *pRange); static void devInsertAddress( @@ -215,7 +215,7 @@ long devRegisterAddress( if (size == 0) { return S_dev_lowValue; } - + #ifdef DEBUG printf ("Req Addr 0X%X Size 0X%X\n", base, size); #endif @@ -233,7 +233,7 @@ long devRegisterAddress( } else if (base + (size - 1) <= pRange->end) { # ifdef DEBUG - printf ("Found free block Begin 0X%X End 0X%X\n", + printf ("Found free block Begin 0X%X End 0X%X\n", pRange->begin, pRange->end); # endif break; @@ -262,7 +262,7 @@ long devRegisterAddress( /* * devReadProbe() * - * a bus error safe "wordSize" read at the specified address which returns + * a bus error safe "wordSize" read at the specified address which returns * unsuccessful status if the device isnt present */ long devReadProbe (unsigned wordSize, volatile const void *ptr, void *pValue) @@ -282,7 +282,7 @@ long devReadProbe (unsigned wordSize, volatile const void *ptr, void *pValue) /* * devWriteProbe * - * a bus error safe "wordSize" write at the specified address which returns + * a bus error safe "wordSize" write at the specified address which returns * unsuccessful status if the device isnt present */ long devWriteProbe (unsigned wordSize, volatile void *ptr, const void *pValue) @@ -333,7 +333,7 @@ static long devInstallAddr ( * always map through the virtual os in case the memory * management is set up there */ - status = (*pdevLibVME->pDevMapAddr) (addrType, 0, base, + status = (*pdevLibVME->pDevMapAddr) (addrType, 0, base, size, &pPhysicalAddress); if (status) { errPrintf (status, __FILE__, __LINE__, "%s base=0X%X size = 0X%X", @@ -436,7 +436,7 @@ static void report_conflict ( pRange = (rangeItem *) ellFirst(&addrAlloc[addrType]); while (pRange) { - + if (pRange->begin <= base + (size-1) && pRange->end >= base) { report_conflict_device (addrType, pRange); } @@ -497,7 +497,7 @@ long devUnregisterAddress( pRange = (rangeItem *) ellNext(&pRange->node); } epicsMutexUnlock(addrListLock); - + if (!pRange) { return S_dev_addressNotFound; } @@ -505,7 +505,7 @@ long devUnregisterAddress( if (strcmp(pOwnerName,pRange->pOwnerName)) { s = S_dev_addressOverlap; errPrintf ( - s, + s, __FILE__, __LINE__, "unregister address for %s at 0X%X failed because %s owns it", @@ -513,7 +513,7 @@ long devUnregisterAddress( (unsigned int)baseAddress, pRange->pOwnerName); return s; - } + } epicsMutexMustLock(addrListLock); ellDelete (&addrAlloc[addrType], &pRange->node); @@ -694,7 +694,7 @@ static long addrVerify(epicsAddressType addrType, size_t base, size_t size) static long devLibInit (void) { rangeItem *pRange; - int i; + int i; if(devLibInitFlag) return(SUCCESS); @@ -819,7 +819,7 @@ static long blockFind ( * align size of block */ newSize = requestSize; - if (mask & newSize) { + if (mask & newSize) { newSize |= mask; newSize++; } @@ -887,7 +887,7 @@ long devNoResponseProbe (epicsAddressType addrType, } /* - * every byte in the block must + * every byte in the block must * map to a physical address */ s = (*pdevLibVME->pDevMapAddr) (addrType, 0, probe, wordSize, &pPhysical); @@ -909,9 +909,9 @@ long devNoResponseProbe (epicsAddressType addrType, } long devConnectInterruptVME( -unsigned vectorNumber, -void (*pFunction)(void *), -void *parameter ) +unsigned vectorNumber, +void (*pFunction)(void *), +void *parameter ) { long status; @@ -922,13 +922,13 @@ void *parameter ) } } - return (*pdevLibVME->pDevConnectInterruptVME) (vectorNumber, + return (*pdevLibVME->pDevConnectInterruptVME) (vectorNumber, pFunction, parameter); } long devDisconnectInterruptVME( -unsigned vectorNumber, -void (*pFunction)(void *) ) +unsigned vectorNumber, +void (*pFunction)(void *) ) { long status; @@ -1007,7 +1007,7 @@ void *parameter) switch(intType){ case intVME: case intVXI: - return (*pdevLibVME->pDevConnectInterruptVME) (vectorNumber, + return (*pdevLibVME->pDevConnectInterruptVME) (vectorNumber, pFunction, parameter); default: return S_dev_uknIntType; @@ -1023,7 +1023,7 @@ void *parameter) long devDisconnectInterrupt( epicsInterruptType intType, unsigned vectorNumber, -void (*pFunction)(void *) +void (*pFunction)(void *) ) { long status; @@ -1038,7 +1038,7 @@ void (*pFunction)(void *) switch(intType){ case intVME: case intVXI: - return (*pdevLibVME->pDevDisconnectInterruptVME) (vectorNumber, + return (*pdevLibVME->pDevDisconnectInterruptVME) (vectorNumber, pFunction); default: return S_dev_uknIntType; @@ -1138,10 +1138,10 @@ void *devLibA24Calloc(size_t size) void *devLibA24Malloc(size_t size) { void *ret; - + if (devLibA24Debug) epicsPrintf ("devLibA24Malloc(%u) entered\n", (unsigned int)size); - + ret = pdevLibVME->pDevA24Malloc(size); return(ret); } @@ -1150,6 +1150,6 @@ void devLibA24Free(void *pBlock) { if (devLibA24Debug) epicsPrintf("devLibA24Free(%p) entered\n", pBlock); - + pdevLibVME->pDevA24Free(pBlock); } diff --git a/modules/libcom/src/osi/devLibVME.h b/modules/libcom/src/osi/devLibVME.h index 0fe0669a6..c64c8da6a 100644 --- a/modules/libcom/src/osi/devLibVME.h +++ b/modules/libcom/src/osi/devLibVME.h @@ -82,9 +82,9 @@ LIBCOM_API long devAddressMap(void); * \return 0, or an error status value. */ LIBCOM_API long devBusToLocalAddr ( - epicsAddressType addrType, - size_t busAddr, - volatile void **ppLocalAddr); + epicsAddressType addrType, + size_t busAddr, + volatile void **ppLocalAddr); /** \brief Probe the bus for reading from a specific address. * @@ -114,9 +114,9 @@ LIBCOM_API long devReadProbe ( * \return 0 if no devices respond, or an error status value. */ LIBCOM_API long devNoResponseProbe( - epicsAddressType addrType, - size_t base, - size_t size + epicsAddressType addrType, + size_t base, + size_t size ); /** \brief Probe the bus for writing to a specific address. @@ -147,11 +147,11 @@ LIBCOM_API long devWriteProbe ( * \return 0, or an error status. */ LIBCOM_API long devRegisterAddress( - const char *pOwnerName, - epicsAddressType addrType, - size_t logicalBaseAddress, - size_t size, - volatile void **pPhysicalAddress); + const char *pOwnerName, + epicsAddressType addrType, + size_t logicalBaseAddress, + size_t size, + volatile void **pPhysicalAddress); /** \brief Release a bus address range previously registered. * @@ -163,9 +163,9 @@ LIBCOM_API long devRegisterAddress( * \return 0, or an error status. */ LIBCOM_API long devUnregisterAddress( - epicsAddressType addrType, - size_t logicalBaseAddress, - const char *pOwnerName); + epicsAddressType addrType, + size_t logicalBaseAddress, + const char *pOwnerName); /** \brief Allocate and register an unoccupied address block. * @@ -186,11 +186,11 @@ LIBCOM_API long devUnregisterAddress( * \return 0, or an error status value. */ LIBCOM_API long devAllocAddress( - const char *pOwnerName, - epicsAddressType addrType, - size_t size, - unsigned alignment, /*n ls bits zero in addr*/ - volatile void **pLocalAddress); + const char *pOwnerName, + epicsAddressType addrType, + size_t size, + unsigned alignment, /*n ls bits zero in addr*/ + volatile void **pLocalAddress); /** \name VME Interrupt Management * Routines to manage VME interrupts. @@ -212,9 +212,9 @@ LIBCOM_API long devAllocAddress( * \return 0, or an error status value. */ LIBCOM_API long devConnectInterruptVME( - unsigned vectorNumber, - void (*pFunction)(void *), - void *parameter); + unsigned vectorNumber, + void (*pFunction)(void *), + void *parameter); /** \brief Disconnect an ISR from its VME interrupt vector. * @@ -230,8 +230,8 @@ LIBCOM_API long devConnectInterruptVME( * \return 0, or an error status value. */ LIBCOM_API long devDisconnectInterruptVME( - unsigned vectorNumber, - void (*pFunction)(void *)); + unsigned vectorNumber, + void (*pFunction)(void *)); /** \brief Determine if a VME interrupt vector is in use. * @@ -320,9 +320,9 @@ LIBCOM_API void devLibA24Free(void *pBlock); * \return Returns success or error. */ LIBCOM_API long devConnectInterruptISA( - unsigned interruptLevel, - void (*pFunction)(void *), - void *parameter); + unsigned interruptLevel, + void (*pFunction)(void *), + void *parameter); /** * Disconnect ISR from a ISA interrupt level. @@ -332,8 +332,8 @@ LIBCOM_API long devConnectInterruptISA( * \return returns success or error. */ LIBCOM_API long devDisconnectInterruptISA( - unsigned interruptLevel, - void (*pFunction)(void *)); + unsigned interruptLevel, + void (*pFunction)(void *)); /** * Determine if an ISA interrupt level is in use @@ -374,10 +374,10 @@ typedef enum {intVME, intVXI, intISA} epicsInterruptType; * in a future release. */ LIBCOM_API long devConnectInterrupt( - epicsInterruptType intType, - unsigned vectorNumber, - void (*pFunction)(void *), - void *parameter); + epicsInterruptType intType, + unsigned vectorNumber, + void (*pFunction)(void *), + void *parameter); /** * \note This routine has been deprecated. It exists @@ -387,9 +387,9 @@ LIBCOM_API long devConnectInterrupt( * be removed in a future release. */ LIBCOM_API long devDisconnectInterrupt( - epicsInterruptType intType, - unsigned vectorNumber, - void (*pFunction)(void *)); + epicsInterruptType intType, + unsigned vectorNumber, + void (*pFunction)(void *)); /** * \note This routine has been deprecated. It exists diff --git a/modules/libcom/src/osi/epicsAtomic.h b/modules/libcom/src/osi/epicsAtomic.h index b3aad5c9c..41d2401aa 100644 --- a/modules/libcom/src/osi/epicsAtomic.h +++ b/modules/libcom/src/osi/epicsAtomic.h @@ -4,7 +4,7 @@ * Copyright (c) 2011 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -35,7 +35,7 @@ EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void); /* * lock out other smp processors from accessing the target, - * load target into cache, add one to target, flush cache + * load target into cache, add one to target, flush cache * to target, allow other smp processors to access the target, * return new value of target as modified by this operation */ @@ -44,7 +44,7 @@ EPICS_ATOMIC_INLINE int epicsAtomicIncrIntT ( int * pTarget ); /* * lock out other smp processors from accessing the target, - * load target into cache, subtract one from target, flush cache + * load target into cache, subtract one from target, flush cache * to target, allow out other smp processors to access the target, * return new value of target as modified by this operation */ @@ -53,7 +53,7 @@ EPICS_ATOMIC_INLINE int epicsAtomicDecrIntT ( int * pTarget ); /* * lock out other smp processors from accessing the target, - * load target into cache, add/sub delta to/from target, flush cache + * load target into cache, add/sub delta to/from target, flush cache * to target, allow other smp processors to access the target, * return new value of target as modified by this operation */ @@ -62,7 +62,7 @@ EPICS_ATOMIC_INLINE size_t epicsAtomicSubSizeT ( size_t * pTarget, size_t delta EPICS_ATOMIC_INLINE int epicsAtomicAddIntT ( int * pTarget, int delta ); /* - * set cache version of target, flush cache to target + * set cache version of target, flush cache to target */ EPICS_ATOMIC_INLINE void epicsAtomicSetSizeT ( size_t * pTarget, size_t newValue ); EPICS_ATOMIC_INLINE void epicsAtomicSetIntT ( int * pTarget, int newValue ); @@ -77,8 +77,8 @@ EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicGetPtrT ( const EpicsAtomicPtrT * /* * lock out other smp processors from accessing the target, - * load target into cache, if target is equal to oldVal set target - * to newVal, flush cache to target, allow other smp processors + * load target into cache, if target is equal to oldVal set target + * to newVal, flush cache to target, allow other smp processors * to access the target, return the original value stored in the * target */ @@ -87,8 +87,8 @@ EPICS_ATOMIC_INLINE size_t epicsAtomicCmpAndSwapSizeT ( size_t * pTarget, EPICS_ATOMIC_INLINE int epicsAtomicCmpAndSwapIntT ( int * pTarget, int oldVal, int newVal ); EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT ( - EpicsAtomicPtrT * pTarget, - EpicsAtomicPtrT oldVal, + EpicsAtomicPtrT * pTarget, + EpicsAtomicPtrT oldVal, EpicsAtomicPtrT newVal ); #ifdef __cplusplus @@ -96,11 +96,11 @@ EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT ( #endif /* - * options for in-line compiler intrinsic or OS specific + * options for in-line compiler intrinsic or OS specific * implementations of the above function prototypes * * for some of the compilers we must define the - * in-line functions before they get used in the c++ + * in-line functions before they get used in the c++ * in-line functions below */ #include "epicsAtomicCD.h" @@ -110,8 +110,8 @@ EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT ( namespace epics { namespace atomic { -/* - * overloaded c++ interface +/* + * overloaded c++ interface */ /************* incr ***************/ @@ -160,8 +160,8 @@ EPICS_ATOMIC_INLINE int subtract ( int & v, int delta ) /************* set ***************/ EPICS_ATOMIC_INLINE void set ( size_t & v , size_t newValue ) -{ - epicsAtomicSetSizeT ( & v, newValue ); +{ + epicsAtomicSetSizeT ( & v, newValue ); } EPICS_ATOMIC_INLINE void set ( int & v, int newValue ) @@ -210,7 +210,7 @@ EPICS_ATOMIC_INLINE EpicsAtomicPtrT compareAndSwap ( EpicsAtomicPtrT & v, } } /* end of name space atomic */ -} /* end of name space epics */ +} /* end of name space epics */ #endif /* ifdef __cplusplus */ diff --git a/modules/libcom/src/osi/epicsAtomicDefault.h b/modules/libcom/src/osi/epicsAtomicDefault.h index 9ae98efbf..4ff44f804 100644 --- a/modules/libcom/src/osi/epicsAtomicDefault.h +++ b/modules/libcom/src/osi/epicsAtomicDefault.h @@ -5,14 +5,14 @@ * Copyright (c) 2011 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Author Jeffrey O. Hill * johill@lanl.gov */ - + #ifndef epicsAtomicDefault_h #define epicsAtomicDefault_h @@ -29,7 +29,7 @@ extern "C" { */ /* - * incr + * incr */ #ifndef EPICS_ATOMIC_INCR_INTT EPICS_ATOMIC_INLINE int epicsAtomicIncrIntT ( int * pTarget ) @@ -58,7 +58,7 @@ EPICS_ATOMIC_INLINE size_t epicsAtomicIncrSizeT ( size_t * pTarget ) #endif /* - * decr + * decr */ #ifndef EPICS_ATOMIC_DECR_INTT EPICS_ATOMIC_INLINE int epicsAtomicDecrIntT ( int * pTarget ) @@ -87,7 +87,7 @@ EPICS_ATOMIC_INLINE size_t epicsAtomicDecrSizeT ( size_t * pTarget ) #endif /* - * add/sub + * add/sub */ #ifndef EPICS_ATOMIC_ADD_INTT EPICS_ATOMIC_INLINE int epicsAtomicAddIntT ( int * pTarget, int delta ) @@ -148,8 +148,8 @@ EPICS_ATOMIC_INLINE void epicsAtomicSetSizeT ( size_t * pTarget, size_t newVal ) #endif #ifndef EPICS_ATOMIC_SET_PTRT -EPICS_ATOMIC_INLINE void epicsAtomicSetPtrT ( EpicsAtomicPtrT * pTarget, - EpicsAtomicPtrT newVal ) +EPICS_ATOMIC_INLINE void epicsAtomicSetPtrT ( EpicsAtomicPtrT * pTarget, + EpicsAtomicPtrT newVal ) { *pTarget = newVal; epicsAtomicWriteMemoryBarrier (); @@ -157,7 +157,7 @@ EPICS_ATOMIC_INLINE void epicsAtomicSetPtrT ( EpicsAtomicPtrT * pTarget, #endif /* - * get + * get */ #ifndef EPICS_ATOMIC_GET_INTT EPICS_ATOMIC_INLINE int epicsAtomicGetIntT ( const int * pTarget ) @@ -176,7 +176,7 @@ EPICS_ATOMIC_INLINE size_t epicsAtomicGetSizeT ( const size_t * pTarget ) #endif #ifndef EPICS_ATOMIC_GET_PTRT -EPICS_ATOMIC_INLINE EpicsAtomicPtrT +EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicGetPtrT ( const EpicsAtomicPtrT * pTarget ) { epicsAtomicReadMemoryBarrier (); @@ -185,7 +185,7 @@ EPICS_ATOMIC_INLINE EpicsAtomicPtrT #endif /* - * cmp and swap + * cmp and swap */ #ifndef EPICS_ATOMIC_CAS_INTT EPICS_ATOMIC_INLINE int epicsAtomicCmpAndSwapIntT ( int * pTarget, int oldval, int newval ) @@ -204,8 +204,8 @@ EPICS_ATOMIC_INLINE int epicsAtomicCmpAndSwapIntT ( int * pTarget, int oldval, i #endif #ifndef EPICS_ATOMIC_CAS_SIZET -EPICS_ATOMIC_INLINE size_t epicsAtomicCmpAndSwapSizeT ( size_t * pTarget, - size_t oldval, size_t newval ) +EPICS_ATOMIC_INLINE size_t epicsAtomicCmpAndSwapSizeT ( size_t * pTarget, + size_t oldval, size_t newval ) { EpicsAtomicLockKey key; size_t cur; @@ -221,8 +221,8 @@ EPICS_ATOMIC_INLINE size_t epicsAtomicCmpAndSwapSizeT ( size_t * pTarget, #endif #ifndef EPICS_ATOMIC_CAS_PTRT -EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT ( - EpicsAtomicPtrT * pTarget, +EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT ( + EpicsAtomicPtrT * pTarget, EpicsAtomicPtrT oldval, EpicsAtomicPtrT newval ) { EpicsAtomicLockKey key; diff --git a/modules/libcom/src/osi/epicsEndian.h b/modules/libcom/src/osi/epicsEndian.h index fd662822f..e207219b5 100644 --- a/modules/libcom/src/osi/epicsEndian.h +++ b/modules/libcom/src/osi/epicsEndian.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef INC_epicsEndian_H diff --git a/modules/libcom/src/osi/epicsEvent.cpp b/modules/libcom/src/osi/epicsEvent.cpp index 7baec772b..6d75bc701 100644 --- a/modules/libcom/src/osi/epicsEvent.cpp +++ b/modules/libcom/src/osi/epicsEvent.cpp @@ -4,11 +4,11 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* epicsMutex.c */ -/* Author: Jeff Hill */ +/* Author: Jeff Hill */ #include #include @@ -24,17 +24,17 @@ using namespace std; class epicsEvent::invalidSemaphore : public exception { const char * what () const throw (); -}; +}; -const char * epicsEvent::invalidSemaphore::what () const throw () +const char * epicsEvent::invalidSemaphore::what () const throw () { return "epicsEvent::invalidSemaphore()"; } // -// Its probably preferable to not make these inline because they are in +// Its probably preferable to not make these inline because they are in // the sharable library interface. The use of inline or not here is probably -// not an issue because all of this ends up in the operating system in system +// not an issue because all of this ends up in the operating system in system // calls // diff --git a/modules/libcom/src/osi/epicsFindSymbol.h b/modules/libcom/src/osi/epicsFindSymbol.h index 152a092ee..800cb0d99 100644 --- a/modules/libcom/src/osi/epicsFindSymbol.h +++ b/modules/libcom/src/osi/epicsFindSymbol.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef epicsFindSymbolh #define epicsFindSymbolh diff --git a/modules/libcom/src/osi/epicsGeneralTime.c b/modules/libcom/src/osi/epicsGeneralTime.c index ccab5e7be..ebe75e659 100644 --- a/modules/libcom/src/osi/epicsGeneralTime.c +++ b/modules/libcom/src/osi/epicsGeneralTime.c @@ -500,14 +500,14 @@ int generalTimeAddIntCurrentProvider(const char *name, int priority, return epicsTimeOK; } -/* +/* * Provide an optional "last resort" provider for Event Time. - * + * * This is deliberately optional, as it represents site policy. * It is intended to be installed as an EventTime provider at the lowest * priority, to return the current time for an event if there is no * better time provider for event times. - * + * * Typically, this will only be used during startup, or a time-provider * resynchronisation, where events are being generated by the event system * but the time provided by the system is not yet valid. diff --git a/modules/libcom/src/osi/epicsInterrupt.h b/modules/libcom/src/osi/epicsInterrupt.h index b536f0a3b..c4ccd339c 100644 --- a/modules/libcom/src/osi/epicsInterrupt.h +++ b/modules/libcom/src/osi/epicsInterrupt.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef epicsInterrupth #define epicsInterrupth diff --git a/modules/libcom/src/osi/epicsMath.cpp b/modules/libcom/src/osi/epicsMath.cpp index 3cfca0a6c..c26aafb40 100644 --- a/modules/libcom/src/osi/epicsMath.cpp +++ b/modules/libcom/src/osi/epicsMath.cpp @@ -2,7 +2,7 @@ * Copyright (c) 2010 UChicago Argonna LLC, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* epicsMath.cpp */ diff --git a/modules/libcom/src/osi/epicsMessageQueue.cpp b/modules/libcom/src/osi/epicsMessageQueue.cpp index b5c1ad91c..8d20dcae2 100644 --- a/modules/libcom/src/osi/epicsMessageQueue.cpp +++ b/modules/libcom/src/osi/epicsMessageQueue.cpp @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Author W. Eric Norum @@ -19,7 +19,7 @@ #include "epicsStdio.h" epicsMessageQueue::epicsMessageQueue(unsigned int aCapacity, - unsigned int aMaxMessageSize) + unsigned int aMaxMessageSize) : id ( epicsMessageQueueCreate(aCapacity, aMaxMessageSize) ) { if (id == NULL) diff --git a/modules/libcom/src/osi/epicsMutex.cpp b/modules/libcom/src/osi/epicsMutex.cpp index a937f5b4e..555492fff 100644 --- a/modules/libcom/src/osi/epicsMutex.cpp +++ b/modules/libcom/src/osi/epicsMutex.cpp @@ -5,15 +5,15 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* epicsMutex.cpp */ -/* Author: Marty Kraimer and Jeff Hill Date: 03APR01 */ +/* Author: Marty Kraimer and Jeff Hill Date: 03APR01 */ /* * NOTES: - * 1) LOG_LAST_OWNER feature is normally commented out because - * it slows down the system at run time, anfd because its not + * 1) LOG_LAST_OWNER feature is normally commented out because + * it slows down the system at run time, anfd because its not * currently safe to convert a thread id to a thread name because * the thread may have exited making the thread id invalid. */ @@ -96,7 +96,7 @@ epicsMutexId epicsStdCall epicsMutexOsiCreate( epicsMutexLockStatus lockStat = epicsMutexOsdLock(epicsMutexGlobalLock); assert ( lockStat == epicsMutexLockOK ); - epicsMutexParm *pmutexNode = + epicsMutexParm *pmutexNode = reinterpret_cast < epicsMutexParm * > ( ellFirst(&freeList) ); if(pmutexNode) { ellDelete(&freeList,&pmutexNode->node); @@ -145,7 +145,7 @@ void epicsStdCall epicsMutexUnlock(epicsMutexId pmutexNode) epicsMutexLockStatus epicsStdCall epicsMutexLock( epicsMutexId pmutexNode) { - epicsMutexLockStatus status = + epicsMutexLockStatus status = epicsMutexOsdLock(pmutexNode->id); # ifdef LOG_LAST_OWNER if ( status == epicsMutexLockOK ) { @@ -158,7 +158,7 @@ epicsMutexLockStatus epicsStdCall epicsMutexLock( epicsMutexLockStatus epicsStdCall epicsMutexTryLock( epicsMutexId pmutexNode) { - epicsMutexLockStatus status = + epicsMutexLockStatus status = epicsMutexOsdTryLock(pmutexNode->id); # ifdef LOG_LAST_OWNER if ( status == epicsMutexLockOK ) { @@ -194,7 +194,7 @@ void epicsStdCall epicsMutexShow( # ifdef LOG_LAST_OWNER char threadName [255]; if ( pmutexNode->lastOwner ) { -# error currently not safe to fetch name for stale thread +# error currently not safe to fetch name for stale thread epicsThreadGetName ( pmutexNode->lastOwner, threadName, sizeof ( threadName ) ); } @@ -206,7 +206,7 @@ void epicsStdCall epicsMutexShow( pmutexNode->pFileName, pmutexNode->lineno); # else printf("epicsMutexId %p source %s line %d\n", - (void *)pmutexNode, pmutexNode->pFileName, + (void *)pmutexNode, pmutexNode->pFileName, pmutexNode->lineno); # endif if ( level > 0 ) { @@ -234,7 +234,7 @@ void epicsStdCall epicsMutexShowAll(int onlyLocked,unsigned int level) if(status==epicsMutexLockOK) { epicsMutexOsdUnlock(pmutexNode->id); pmutexNode = - reinterpret_cast < epicsMutexParm * > + reinterpret_cast < epicsMutexParm * > ( ellNext(&pmutexNode->node) ); continue; } @@ -264,7 +264,7 @@ epicsMutex :: epicsMutex ( const char *pFileName, int lineno ) : } } -epicsMutex ::~epicsMutex () +epicsMutex ::~epicsMutex () { epicsMutexDestroy ( this->id ); } @@ -282,7 +282,7 @@ bool epicsMutex::tryLock () epicsMutexLockStatus status = epicsMutexTryLock ( this->id ); if ( status == epicsMutexLockOK ) { return true; - } + } else if ( status != epicsMutexLockTimeout ) { throw invalidMutex (); } @@ -294,27 +294,27 @@ void epicsMutex::unlock () epicsMutexUnlock ( this->id ); } -void epicsMutex :: show ( unsigned level ) const +void epicsMutex :: show ( unsigned level ) const { epicsMutexShow ( this->id, level ); } -static epicsThreadPrivate < epicsDeadlockDetectMutex > +static epicsThreadPrivate < epicsDeadlockDetectMutex > * pCurrentMutexLevel = 0; static epicsThreadOnceId epicsDeadlockDetectMutexInit = EPICS_THREAD_ONCE_INIT; extern "C" -void epicsDeadlockDetectMutexInitFunc ( void * ) +void epicsDeadlockDetectMutexInitFunc ( void * ) { pCurrentMutexLevel = new epicsThreadPrivate < epicsDeadlockDetectMutex > (); } epicsDeadlockDetectMutex:: - epicsDeadlockDetectMutex ( hierarchyLevel_t level ) : + epicsDeadlockDetectMutex ( hierarchyLevel_t level ) : hierarchyLevel ( level ), pPreviousLevel ( 0 ) { - epicsThreadOnce ( & epicsDeadlockDetectMutexInit, + epicsThreadOnce ( & epicsDeadlockDetectMutexInit, epicsDeadlockDetectMutexInitFunc, 0 ); } diff --git a/modules/libcom/src/osi/epicsSignal.h b/modules/libcom/src/osi/epicsSignal.h index 186822f34..0efc4f57c 100644 --- a/modules/libcom/src/osi/epicsSignal.h +++ b/modules/libcom/src/osi/epicsSignal.h @@ -20,7 +20,7 @@ extern "C" { * \brief OS-independent routines for ignoring Posix signals * * The requests in this interface are typically ignored on OS that do not implement - * POSIX signals. + * POSIX signals. */ struct epicsThreadOSD; @@ -32,7 +32,7 @@ struct epicsThreadOSD; LIBCOM_API void epicsStdCall epicsSignalInstallSigHupIgnore ( void ); /** Ignore the SIGPIPE signal. - * Required to avoid terminating a process which is blocking in a + * Required to avoid terminating a process which is blocking in a * socket send() call when the SIGPIPE signal is generated by the OS. */ LIBCOM_API void epicsStdCall epicsSignalInstallSigPipeIgnore ( void ); diff --git a/modules/libcom/src/osi/epicsStackTrace.c b/modules/libcom/src/osi/epicsStackTrace.c index e3054efd0..363ce33a9 100644 --- a/modules/libcom/src/osi/epicsStackTrace.c +++ b/modules/libcom/src/osi/epicsStackTrace.c @@ -1,11 +1,11 @@ -/* +/* * Copyright: Stanford University / SLAC National Laboratory. * * EPICS BASE is distributed subject to a Software License Agreement found - * in file LICENSE that is included with this distribution. + * in file LICENSE that is included with this distribution. * * Author: Till Straumann , 2011, 2014 - */ + */ #include @@ -42,19 +42,19 @@ dumpInfo(void *addr, epicsSymbol *sym_p) { int rval = 0; - rval += errlogPrintf("[%*p]", (int)(sizeof(addr)*2 + 2), addr); - if ( sym_p ) { - if ( sym_p->f_nam ) { - rval += errlogPrintf(": %s", sym_p->f_nam); - } - if ( sym_p->s_nam ) { - rval += errlogPrintf("(%s+0x%lx)", sym_p->s_nam, (unsigned long)((char*)addr - (char*)sym_p->s_val)); - } else { - rval += errlogPrintf("()"); - } - } - rval += errlogPrintf("\n"); - errlogFlush(); + rval += errlogPrintf("[%*p]", (int)(sizeof(addr)*2 + 2), addr); + if ( sym_p ) { + if ( sym_p->f_nam ) { + rval += errlogPrintf(": %s", sym_p->f_nam); + } + if ( sym_p->s_nam ) { + rval += errlogPrintf("(%s+0x%lx)", sym_p->s_nam, (unsigned long)((char*)addr - (char*)sym_p->s_val)); + } else { + rval += errlogPrintf("()"); + } + } + rval += errlogPrintf("\n"); + errlogFlush(); return rval; } @@ -65,10 +65,10 @@ void **buf; int i,n; epicsSymbol sym; - if ( 0 == epicsStackTraceGetFeatures() ) { - /* unsupported on this platform */ - return; - } + if ( 0 == epicsStackTraceGetFeatures() ) { + /* unsupported on this platform */ + return; + } if ( ! (buf = malloc(sizeof(*buf) * MAXDEPTH))) { free(buf); @@ -78,26 +78,26 @@ epicsSymbol sym; n = epicsBackTrace(buf, MAXDEPTH); - if ( n > 0 ) { + if ( n > 0 ) { - stackTraceLock(); + stackTraceLock(); - errlogPrintf("Dumping a stack trace of thread '%s':\n", epicsThreadGetNameSelf()); + errlogPrintf("Dumping a stack trace of thread '%s':\n", epicsThreadGetNameSelf()); - errlogFlush(); + errlogFlush(); - for ( i=0; i, 2011, 2014 - */ + */ #ifndef INC_epicsStackTrace_H #define INC_epicsStackTrace_H diff --git a/modules/libcom/src/osi/epicsStackTracePvt.h b/modules/libcom/src/osi/epicsStackTracePvt.h index 00b013d91..93b9493b2 100644 --- a/modules/libcom/src/osi/epicsStackTracePvt.h +++ b/modules/libcom/src/osi/epicsStackTracePvt.h @@ -1,11 +1,11 @@ -/* +/* * Copyright: Stanford University / SLAC National Laboratory. * * EPICS BASE is distributed subject to a Software License Agreement found - * in file LICENSE that is included with this distribution. + * in file LICENSE that is included with this distribution. * * Author: Till Straumann , 2011, 2014 - */ + */ #ifndef INC_epicsStackTracePvt_H #define INC_epicsStackTracePvt_H @@ -13,9 +13,9 @@ #include "libComAPI.h" typedef struct epicsSymbol { - const char *f_nam; /* file where the symbol is defined */ - const char *s_nam; /* symbol name */ - void *s_val; /* symbol value */ + const char *f_nam; /* file where the symbol is defined */ + const char *s_nam; /* symbol name */ + void *s_val; /* symbol value */ } epicsSymbol; #ifdef __cplusplus @@ -28,7 +28,7 @@ extern "C" { LIBCOM_API int epicsBackTrace(void **buf, int buf_sz); /* Find symbol closest to 'addr'. - * + * * If successful the routine fills in the members of *sym_p but * note that 'f_nam' and/or 's_nam' may be NULL if the address * cannot be resolved. diff --git a/modules/libcom/src/osi/epicsStdio.c b/modules/libcom/src/osi/epicsStdio.c index db4919039..bfb953402 100644 --- a/modules/libcom/src/osi/epicsStdio.c +++ b/modules/libcom/src/osi/epicsStdio.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* epicsStdio.c */ diff --git a/modules/libcom/src/osi/epicsStdio.h b/modules/libcom/src/osi/epicsStdio.h index 205842bde..324be5548 100644 --- a/modules/libcom/src/osi/epicsStdio.h +++ b/modules/libcom/src/osi/epicsStdio.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* epicsStdio.h */ @@ -62,7 +62,7 @@ LIBCOM_API int epicsStdCall epicsVsnprintf( * * pFileName - name (and optionally path) of file * size - the new file size (if file is curretly larger) - * + * * returns TF_OK if the file is less than size bytes * or if it was successfully truncated. Returns * TF_ERROR if the file could not be truncated. diff --git a/modules/libcom/src/osi/epicsStdioRedirect.h b/modules/libcom/src/osi/epicsStdioRedirect.h index 6f99cc9a5..339c49238 100644 --- a/modules/libcom/src/osi/epicsStdioRedirect.h +++ b/modules/libcom/src/osi/epicsStdioRedirect.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* epicsStdioRedirect.h */ diff --git a/modules/libcom/src/osi/epicsThread.h b/modules/libcom/src/osi/epicsThread.h index 806b40e85..1eef8502e 100644 --- a/modules/libcom/src/osi/epicsThread.h +++ b/modules/libcom/src/osi/epicsThread.h @@ -384,7 +384,7 @@ public: //! Wait for the thread epicsRunnable::run() to return. //! \param delay Wait up to this many seconds. //! \return true if run() returned. false on timeout. - bool exitWait ( const double delay ) throw (); + bool exitWait ( const double delay ) throw (); //! @throws A special exitException which will be caught and ignored. //! \note This exitException doesn't not derive from std::exception static void exit (); diff --git a/modules/libcom/src/osi/epicsTime.h b/modules/libcom/src/osi/epicsTime.h index 4ebd43986..a1ccf382d 100644 --- a/modules/libcom/src/osi/epicsTime.h +++ b/modules/libcom/src/osi/epicsTime.h @@ -549,7 +549,7 @@ inline epicsTime epicsTime::operator -= ( const double & rhs ) inline bool epicsTime::operator == ( const epicsTime & rhs ) const { if ( this->secPastEpoch == rhs.secPastEpoch && this->nSec == rhs.nSec ) { - return true; + return true; } return false; } diff --git a/modules/libcom/src/osi/os/Darwin/epicsMath.h b/modules/libcom/src/osi/os/Darwin/epicsMath.h index 330ccb6e6..fd118976a 100644 --- a/modules/libcom/src/osi/os/Darwin/epicsMath.h +++ b/modules/libcom/src/osi/os/Darwin/epicsMath.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef epicsMathh diff --git a/modules/libcom/src/osi/os/Darwin/osdBackTrace.cpp b/modules/libcom/src/osi/os/Darwin/osdBackTrace.cpp index 4595fee3a..8b5e83a37 100644 --- a/modules/libcom/src/osi/os/Darwin/osdBackTrace.cpp +++ b/modules/libcom/src/osi/os/Darwin/osdBackTrace.cpp @@ -1,10 +1,10 @@ -/* +/* * Copyright: Stanford University / SLAC National Laboratory. * * EPICS BASE is distributed subject to a Software License Agreement found - * in file LICENSE that is included with this distribution. + * in file LICENSE that is included with this distribution. * * Author: Till Straumann , 2011, 2014 - */ + */ #include "osdExecinfoBackTrace.cpp" diff --git a/modules/libcom/src/osi/os/Darwin/osdEnv.c b/modules/libcom/src/osi/os/Darwin/osdEnv.c index 878dc5125..a4d6845b5 100644 --- a/modules/libcom/src/osi/os/Darwin/osdEnv.c +++ b/modules/libcom/src/osi/os/Darwin/osdEnv.c @@ -1,7 +1,7 @@ /*************************************************************************\ * Copyright (c) 2002 The University of Saskatchewan * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* osdEnv.c */ /* diff --git a/modules/libcom/src/osi/os/Darwin/osdFindAddr.c b/modules/libcom/src/osi/os/Darwin/osdFindAddr.c index e3c6750c7..dd6c37ce2 100644 --- a/modules/libcom/src/osi/os/Darwin/osdFindAddr.c +++ b/modules/libcom/src/osi/os/Darwin/osdFindAddr.c @@ -1,11 +1,11 @@ -/* +/* * Copyright: Stanford University / SLAC National Laboratory. * * EPICS BASE is distributed subject to a Software License Agreement found - * in file LICENSE that is included with this distribution. + * in file LICENSE that is included with this distribution. * * Author: Till Straumann , 2011, 2014 - */ + */ /* Make sure dladdr() is visible */ #define _DARWIN_C_SOURCE diff --git a/modules/libcom/src/osi/os/Darwin/osdTime.h b/modules/libcom/src/osi/os/Darwin/osdTime.h index 2fe57fdac..8fe6ccbaf 100644 --- a/modules/libcom/src/osi/os/Darwin/osdTime.h +++ b/modules/libcom/src/osi/os/Darwin/osdTime.h @@ -1,7 +1,7 @@ /*************************************************************************\ * Copyright (c) 2002 The University of Saskatchewan * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Author: Eric Norum diff --git a/modules/libcom/src/osi/os/Darwin/osiFileName.h b/modules/libcom/src/osi/os/Darwin/osiFileName.h index a78118679..0704fdf31 100644 --- a/modules/libcom/src/osi/os/Darwin/osiFileName.h +++ b/modules/libcom/src/osi/os/Darwin/osiFileName.h @@ -2,7 +2,7 @@ * Copyright (c) 2002 The University of Saskatchewan * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Author: Eric Norum diff --git a/modules/libcom/src/osi/os/Linux/osdBackTrace.cpp b/modules/libcom/src/osi/os/Linux/osdBackTrace.cpp index 4595fee3a..8b5e83a37 100644 --- a/modules/libcom/src/osi/os/Linux/osdBackTrace.cpp +++ b/modules/libcom/src/osi/os/Linux/osdBackTrace.cpp @@ -1,10 +1,10 @@ -/* +/* * Copyright: Stanford University / SLAC National Laboratory. * * EPICS BASE is distributed subject to a Software License Agreement found - * in file LICENSE that is included with this distribution. + * in file LICENSE that is included with this distribution. * * Author: Till Straumann , 2011, 2014 - */ + */ #include "osdExecinfoBackTrace.cpp" diff --git a/modules/libcom/src/osi/os/Linux/osdFindAddr.c b/modules/libcom/src/osi/os/Linux/osdFindAddr.c index 84d17d96f..71a83b894 100644 --- a/modules/libcom/src/osi/os/Linux/osdFindAddr.c +++ b/modules/libcom/src/osi/os/Linux/osdFindAddr.c @@ -1,10 +1,10 @@ -/* +/* * Copyright: Stanford University / SLAC National Laboratory. * * EPICS BASE is distributed subject to a Software License Agreement found - * in file LICENSE that is included with this distribution. + * in file LICENSE that is included with this distribution. * * Author: Till Straumann , 2011, 2014 - */ + */ #include "osdElfFindAddr.c" diff --git a/modules/libcom/src/osi/os/Linux/osdTime.h b/modules/libcom/src/osi/os/Linux/osdTime.h index 221a7d085..58882c847 100644 --- a/modules/libcom/src/osi/os/Linux/osdTime.h +++ b/modules/libcom/src/osi/os/Linux/osdTime.h @@ -2,7 +2,7 @@ * Copyright (c) 2002 The University of Saskatchewan * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/libcom/src/osi/os/Linux/osiFileName.h b/modules/libcom/src/osi/os/Linux/osiFileName.h index 3a6448d54..a38980230 100644 --- a/modules/libcom/src/osi/os/Linux/osiFileName.h +++ b/modules/libcom/src/osi/os/Linux/osiFileName.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * osiFileName.h diff --git a/modules/libcom/src/osi/os/Linux/osiUnistd.h b/modules/libcom/src/osi/os/Linux/osiUnistd.h index 336a9a802..e8e387fa2 100644 --- a/modules/libcom/src/osi/os/Linux/osiUnistd.h +++ b/modules/libcom/src/osi/os/Linux/osiUnistd.h @@ -5,12 +5,12 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 +/* + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #include diff --git a/modules/libcom/src/osi/os/RTEMS/devLibVMEOSD.c b/modules/libcom/src/osi/os/RTEMS/devLibVMEOSD.c index b8f79e706..406629348 100644 --- a/modules/libcom/src/osi/os/RTEMS/devLibVMEOSD.c +++ b/modules/libcom/src/osi/os/RTEMS/devLibVMEOSD.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* RTEMS port by Till Straumann, @@ -58,7 +58,7 @@ static myISR *defaultHandlerAddr[]={ * address modes by default */ #define EPICSAddrTypeNoConvert -1 -int EPICStovxWorksAddrType[] +int EPICStovxWorksAddrType[] = { VME_AM_SUP_SHORT_IO, VME_AM_STD_SUP_DATA, @@ -75,13 +75,13 @@ static long rtemsDevMapAddr (epicsAddressType addrType, unsigned options, size_t logicalAddress, size_t size, volatile void **ppPhysicalAddress); /* - * a bus error safe "wordSize" read at the specified address which returns + * a bus error safe "wordSize" read at the specified address which returns * unsuccessful status if the device isnt present */ static long rtemsDevReadProbe (unsigned wordSize, volatile const void *ptr, void *pValue); /* - * a bus error safe "wordSize" write at the specified address which returns + * a bus error safe "wordSize" write at the specified address which returns * unsuccessful status if the device isnt present */ static long rtemsDevWriteProbe (unsigned wordSize, volatile void *ptr, const void *pValue); @@ -93,7 +93,7 @@ static long rtemsDevConnectInterruptVME ( static long rtemsDevDisconnectInterruptVME ( unsigned vectorNumber, - void (*pFunction)() + void (*pFunction)() ); static long rtemsDevEnableInterruptLevelVME (unsigned level); @@ -113,7 +113,7 @@ static long rtemsDevInit(void); * used by bind in devLib.c */ static devLibVME rtemsVirtualOS = { - rtemsDevMapAddr, rtemsDevReadProbe, rtemsDevWriteProbe, + rtemsDevMapAddr, rtemsDevReadProbe, rtemsDevWriteProbe, rtemsDevConnectInterruptVME, rtemsDevDisconnectInterruptVME, rtemsDevEnableInterruptLevelVME, rtemsDevDisableInterruptLevelVME, devA24Malloc,devA24Free,rtemsDevInit,rtemsDevInterruptInUseVME @@ -143,12 +143,12 @@ static long rtemsDevConnectInterruptVME ( if (devInterruptInUseVME(vectorNumber)) { - return S_dev_vectorInUse; + return S_dev_vectorInUse; } status = BSP_installVME_isr( vectorNumber, pFunction, - parameter); + parameter); if (status) { return S_dev_vecInstlFail; } @@ -162,14 +162,14 @@ static long rtemsDevConnectInterruptVME ( * * wrapper to minimize driver dependency on OS * - * The parameter pFunction should be set to the C function pointer that - * was connected. It is used as a key to prevent a driver from removing + * The parameter pFunction should be set to the C function pointer that + * was connected. It is used as a key to prevent a driver from removing * an interrupt handler that was installed by another driver * */ static long rtemsDevDisconnectInterruptVME ( unsigned vectorNumber, - void (*pFunction)() + void (*pFunction)() ) { void (*psub)(); @@ -192,7 +192,7 @@ static long rtemsDevDisconnectInterruptVME ( BSP_installVME_isr( vectorNumber, (BSP_VME_ISR_t)unsolicitedHandlerEPICS, - (void*)vectorNumber); + (void*)vectorNumber); if(status){ return S_dev_vecInstlFail; } @@ -245,7 +245,7 @@ static long rtemsDevMapAddr (epicsAddressType addrType, unsigned options, } /* - * a bus error safe "wordSize" read at the specified address which returns + * a bus error safe "wordSize" read at the specified address which returns * unsuccessful status if the device isnt present */ rtems_status_code bspExtMemProbe(void *addr, int write, int size, void *pval); @@ -265,7 +265,7 @@ static long rtemsDevReadProbe (unsigned wordSize, volatile const void *ptr, void } /* - * a bus error safe "wordSize" write at the specified address which returns + * a bus error safe "wordSize" write at the specified address which returns * unsuccessful status if the device isnt present */ static long rtemsDevWriteProbe (unsigned wordSize, volatile void *ptr, const void *pValue) diff --git a/modules/libcom/src/osi/os/RTEMS/epicsAtomicOSD.h b/modules/libcom/src/osi/os/RTEMS/epicsAtomicOSD.h index 5e7b6697c..12d9b04e9 100644 --- a/modules/libcom/src/osi/os/RTEMS/epicsAtomicOSD.h +++ b/modules/libcom/src/osi/os/RTEMS/epicsAtomicOSD.h @@ -5,7 +5,7 @@ * Copyright (c) 2011 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/libcom/src/osi/os/RTEMS/epicsMath.h b/modules/libcom/src/osi/os/RTEMS/epicsMath.h index b5897929e..138d17c08 100644 --- a/modules/libcom/src/osi/os/RTEMS/epicsMath.h +++ b/modules/libcom/src/osi/os/RTEMS/epicsMath.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef epicsMathh diff --git a/modules/libcom/src/osi/os/RTEMS/osdEnv.c b/modules/libcom/src/osi/os/RTEMS/osdEnv.c index 2cc80daee..b61c7c479 100644 --- a/modules/libcom/src/osi/os/RTEMS/osdEnv.c +++ b/modules/libcom/src/osi/os/RTEMS/osdEnv.c @@ -1,7 +1,7 @@ /*************************************************************************\ * Copyright (c) 2002 The University of Saskatchewan * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* osdEnv.c */ /* diff --git a/modules/libcom/src/osi/os/RTEMS/osdEvent.c b/modules/libcom/src/osi/os/RTEMS/osdEvent.c index 455413870..bfd8a233a 100644 --- a/modules/libcom/src/osi/os/RTEMS/osdEvent.c +++ b/modules/libcom/src/osi/os/RTEMS/osdEvent.c @@ -3,7 +3,7 @@ * Copyright (c) 2011 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * RTEMS osdEvent.c @@ -34,14 +34,14 @@ unsigned long semEstat[4]; #define SEMSTAT(i) semEstat[i]++; #else -#define SEMSTAT(i) +#define SEMSTAT(i) #endif /* * Create a simple binary semaphore */ epicsEventId -epicsEventCreate(epicsEventInitialState initialState) +epicsEventCreate(epicsEventInitialState initialState) { rtems_status_code sc; rtems_id sid; @@ -49,11 +49,11 @@ epicsEventCreate(epicsEventInitialState initialState) static char c1 = 'a'; static char c2 = 'a'; static char c3 = 'a'; - + sc = rtems_semaphore_create (rtems_build_name ('B', c3, c2, c1), initialState, - RTEMS_FIFO | RTEMS_SIMPLE_BINARY_SEMAPHORE | - RTEMS_NO_INHERIT_PRIORITY | RTEMS_NO_PRIORITY_CEILING | RTEMS_LOCAL, + RTEMS_FIFO | RTEMS_SIMPLE_BINARY_SEMAPHORE | + RTEMS_NO_INHERIT_PRIORITY | RTEMS_NO_PRIORITY_CEILING | RTEMS_LOCAL, 0, &sid); if (sc != RTEMS_SUCCESSFUL) { @@ -88,7 +88,7 @@ epicsEventDestroy(epicsEventId id) { rtems_id sid = (rtems_id)id; rtems_status_code sc; - + sc = rtems_semaphore_delete (sid); if (sc != RTEMS_SUCCESSFUL) errlogPrintf ("Can't destroy semaphore: %s\n", rtems_status_text (sc)); @@ -99,7 +99,7 @@ epicsEventTrigger(epicsEventId id) { rtems_id sid = (rtems_id)id; rtems_status_code sc; - + sc = rtems_semaphore_release (sid); if (sc == RTEMS_SUCCESSFUL) return epicsEventOK; @@ -112,7 +112,7 @@ epicsEventWait(epicsEventId id) { rtems_id sid = (rtems_id)id; rtems_status_code sc; - + SEMSTAT(0) sc = rtems_semaphore_obtain (sid, RTEMS_WAIT, RTEMS_NO_TIMEOUT); if (sc != RTEMS_SUCCESSFUL) @@ -127,7 +127,7 @@ epicsEventWaitWithTimeout(epicsEventId id, double timeOut) rtems_status_code sc; rtems_interval delay; extern double rtemsTicksPerSecond_double; - + if (timeOut <= 0.0) return epicsEventTryWait(id); SEMSTAT(1) @@ -148,7 +148,7 @@ epicsEventTryWait(epicsEventId id) { rtems_id sid = (rtems_id)id; rtems_status_code sc; - + SEMSTAT(2) sc = rtems_semaphore_obtain (sid, RTEMS_NO_WAIT, RTEMS_NO_TIMEOUT); if (sc == RTEMS_SUCCESSFUL) diff --git a/modules/libcom/src/osi/os/RTEMS/osdEvent.h b/modules/libcom/src/osi/os/RTEMS/osdEvent.h index 6c53aada7..0b562c2d7 100644 --- a/modules/libcom/src/osi/os/RTEMS/osdEvent.h +++ b/modules/libcom/src/osi/os/RTEMS/osdEvent.h @@ -2,7 +2,7 @@ * Copyright (c) 2002 The University of Saskatchewan * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * RTEMS osdEvent.h diff --git a/modules/libcom/src/osi/os/RTEMS/osdFindSymbol.c b/modules/libcom/src/osi/os/RTEMS/osdFindSymbol.c index 2dae7ab80..2ebd83fb3 100644 --- a/modules/libcom/src/osi/os/RTEMS/osdFindSymbol.c +++ b/modules/libcom/src/osi/os/RTEMS/osdFindSymbol.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* osi/os/RTEMS/osdFindSymbol.c */ diff --git a/modules/libcom/src/osi/os/RTEMS/osdInterrupt.c b/modules/libcom/src/osi/os/RTEMS/osdInterrupt.c index 88ce664e5..a8128fad0 100644 --- a/modules/libcom/src/osi/os/RTEMS/osdInterrupt.c +++ b/modules/libcom/src/osi/os/RTEMS/osdInterrupt.c @@ -2,7 +2,7 @@ * Copyright (c) 2002 The University of Saskatchewan * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * RTEMS osdInterrupt.c @@ -42,7 +42,7 @@ epicsInterruptUnlock (int key) int epicsInterruptIsInterruptContext (void) { - return rtems_interrupt_is_in_progress (); + return rtems_interrupt_is_in_progress (); } /* @@ -84,11 +84,11 @@ InterruptContextMessageDaemon (void *unused) RTEMS_NO_TIMEOUT); if (sc != RTEMS_SUCCESSFUL) { errlogPrintf ("Can't receive message from interrupt context: %s\n", rtems_status_text (sc)); - epicsThreadSuspendSelf (); + epicsThreadSuspendSelf (); } if (size == sizeof message) syslog (LOG_ERR, "%s", message); - else + else errlogPrintf ("Received %u-byte message from interrupt context", (unsigned int)size); } } diff --git a/modules/libcom/src/osi/os/RTEMS/osdInterrupt.h b/modules/libcom/src/osi/os/RTEMS/osdInterrupt.h index 2f3a2c596..49f4bd1f4 100644 --- a/modules/libcom/src/osi/os/RTEMS/osdInterrupt.h +++ b/modules/libcom/src/osi/os/RTEMS/osdInterrupt.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Daemon to soak up and report messages from interrupt contexts diff --git a/modules/libcom/src/osi/os/RTEMS/osdMessageQueue.c b/modules/libcom/src/osi/os/RTEMS/osdMessageQueue.c index 52eb8742b..29398e205 100644 --- a/modules/libcom/src/osi/os/RTEMS/osdMessageQueue.c +++ b/modules/libcom/src/osi/os/RTEMS/osdMessageQueue.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Author W. Eric Norum @@ -40,7 +40,7 @@ epicsMessageQueueCreate(unsigned int capacity, unsigned int maximumMessageSize) if(!id) return NULL; - + sc = rtems_message_queue_create (rtems_build_name ('Q', c3, c2, c1), capacity, maximumMessageSize, @@ -85,7 +85,7 @@ static rtems_status_code rtems_message_queue_send_timeout( Message_queue_Control *the_message_queue; Objects_Locations location; CORE_message_queue_Status msg_status; - + the_message_queue = _Message_queue_Get( id, &location ); switch ( location ) { @@ -108,7 +108,7 @@ static rtems_status_code rtems_message_queue_send_timeout( /* * If we had to block, then this is where the task returns * after it wakes up. The returned status is correct for - * non-blocking operations but if we blocked, then we need + * non-blocking operations but if we blocked, then we need * to look at the status in our TCB. */ @@ -138,7 +138,7 @@ LIBCOM_API int epicsStdCall epicsMessageQueueSendWithTimeout( { rtems_interval delay; extern double rtemsTicksPerSecond_double; - + /* * Convert time to ticks */ @@ -162,7 +162,7 @@ static int receiveMessage( { size_t rsize; rtems_status_code sc; - + if (size < id->maxSize) { if (id->localBuf == NULL) { id->localBuf = malloc(id->maxSize); @@ -207,7 +207,7 @@ LIBCOM_API int epicsStdCall epicsMessageQueueReceiveWithTimeout( rtems_interval delay; uint32_t wait; extern double rtemsTicksPerSecond_double; - + /* * Convert time to ticks */ @@ -229,7 +229,7 @@ LIBCOM_API int epicsStdCall epicsMessageQueuePending( { uint32_t count; rtems_status_code sc; - + sc = rtems_message_queue_get_number_pending(id->id, &count); if (sc != RTEMS_SUCCESSFUL) { errlogPrintf("Message queue %x get number pending failed: %s\n", diff --git a/modules/libcom/src/osi/os/RTEMS/osdMessageQueue.h b/modules/libcom/src/osi/os/RTEMS/osdMessageQueue.h index 0244a1f0b..b3c4e8897 100644 --- a/modules/libcom/src/osi/os/RTEMS/osdMessageQueue.h +++ b/modules/libcom/src/osi/os/RTEMS/osdMessageQueue.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Author W. Eric Norum diff --git a/modules/libcom/src/osi/os/RTEMS/osdMutex.c b/modules/libcom/src/osi/os/RTEMS/osdMutex.c index da76c5eaf..b62c0cd79 100644 --- a/modules/libcom/src/osi/os/RTEMS/osdMutex.c +++ b/modules/libcom/src/osi/os/RTEMS/osdMutex.c @@ -2,7 +2,7 @@ * Copyright (c) 2002 The University of Saskatchewan * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * RTEMS osdMutex.c @@ -36,7 +36,7 @@ unsigned long semMstat[4]; #define SEMSTAT(i) semMstat[i]++; #else -#define SEMSTAT(i) +#define SEMSTAT(i) #endif struct epicsMutexOSD * @@ -48,7 +48,7 @@ epicsMutexOsdCreate(void) static char c1 = 'a'; static char c2 = 'a'; static char c3 = 'a'; - + sc = rtems_semaphore_create (rtems_build_name ('M', c3, c2, c1), 1, RTEMS_PRIORITY|RTEMS_BINARY_SEMAPHORE|RTEMS_INHERIT_PRIORITY|RTEMS_NO_PRIORITY_CEILING|RTEMS_LOCAL, @@ -84,7 +84,7 @@ epicsMutexOsdCreate(void) Objects_Locations location; the_semaphore = _Semaphore_Get( sid, &location ); - _Thread_Enable_dispatch(); + _Thread_Enable_dispatch(); return (struct epicsMutexOSD *)the_semaphore; } @@ -116,7 +116,7 @@ void epicsMutexOsdUnlock(struct epicsMutexOSD * id) #ifdef RTEMS_FAST_MUTEX Semaphore_Control *the_semaphore = (Semaphore_Control *)id; _Thread_Disable_dispatch(); - _CORE_mutex_Surrender ( + _CORE_mutex_Surrender ( &the_semaphore->Core_control.mutex, the_semaphore->Object.id, NULL @@ -191,5 +191,5 @@ LIBCOM_API void epicsMutexOsdShow(struct epicsMutexOSD * id,unsigned int level) Semaphore_Control *the_semaphore = (Semaphore_Control *)id; id = (struct epicsMutexOSD *)the_semaphore->Object.id; #endif - epicsEventShow ((epicsEventId)id,level); + epicsEventShow ((epicsEventId)id,level); } diff --git a/modules/libcom/src/osi/os/RTEMS/osdMutex.h b/modules/libcom/src/osi/os/RTEMS/osdMutex.h index 7e2ecc77d..fc7ce1104 100644 --- a/modules/libcom/src/osi/os/RTEMS/osdMutex.h +++ b/modules/libcom/src/osi/os/RTEMS/osdMutex.h @@ -2,7 +2,7 @@ * Copyright (c) 2002 The University of Saskatchewan * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * RTEMS osdMutex.h diff --git a/modules/libcom/src/osi/os/RTEMS/osdPoolStatus.c b/modules/libcom/src/osi/os/RTEMS/osdPoolStatus.c index 71171eaa1..e64925be3 100644 --- a/modules/libcom/src/osi/os/RTEMS/osdPoolStatus.c +++ b/modules/libcom/src/osi/os/RTEMS/osdPoolStatus.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include diff --git a/modules/libcom/src/osi/os/RTEMS/osdProcess.c b/modules/libcom/src/osi/os/RTEMS/osdProcess.c index 379e8b869..21869b1ce 100644 --- a/modules/libcom/src/osi/os/RTEMS/osdProcess.c +++ b/modules/libcom/src/osi/os/RTEMS/osdProcess.c @@ -5,10 +5,10 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* * Operating System Dependent Implementation of osiProcess.h * * Author: Jeff Hill diff --git a/modules/libcom/src/osi/os/RTEMS/osdSignal.cpp b/modules/libcom/src/osi/os/RTEMS/osdSignal.cpp index cf234da0e..82cbc1668 100644 --- a/modules/libcom/src/osi/os/RTEMS/osdSignal.cpp +++ b/modules/libcom/src/osi/os/RTEMS/osdSignal.cpp @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found - * in file LICENSE that is included with this distribution. + * in file LICENSE that is included with this distribution. \*************************************************************************/ #include "epicsSignal.h" diff --git a/modules/libcom/src/osi/os/RTEMS/osdStrtod.h b/modules/libcom/src/osi/os/RTEMS/osdStrtod.h index 39fda698d..4b319aae0 100644 --- a/modules/libcom/src/osi/os/RTEMS/osdStrtod.h +++ b/modules/libcom/src/osi/os/RTEMS/osdStrtod.h @@ -2,7 +2,7 @@ * Copyright (c) 2002 The University of Saskatchewan * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/libcom/src/osi/os/RTEMS/osdThread.c b/modules/libcom/src/osi/os/RTEMS/osdThread.c index 011229198..265fbb765 100644 --- a/modules/libcom/src/osi/os/RTEMS/osdThread.c +++ b/modules/libcom/src/osi/os/RTEMS/osdThread.c @@ -589,7 +589,7 @@ epicsThreadId epicsThreadGetId (const char *name) if (strcmp (name, v->name) == 0) { tid = v->id; break; - } + } } taskVarUnlock (); return (epicsThreadId)tid; diff --git a/modules/libcom/src/osi/os/RTEMS/osdVME.h b/modules/libcom/src/osi/os/RTEMS/osdVME.h index a04cafe6f..158b95472 100644 --- a/modules/libcom/src/osi/os/RTEMS/osdVME.h +++ b/modules/libcom/src/osi/os/RTEMS/osdVME.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/libcom/src/osi/os/RTEMS/osiFileName.h b/modules/libcom/src/osi/os/RTEMS/osiFileName.h index 8c9226898..13e0df34d 100644 --- a/modules/libcom/src/osi/os/RTEMS/osiFileName.h +++ b/modules/libcom/src/osi/os/RTEMS/osiFileName.h @@ -2,7 +2,7 @@ * Copyright (c) 2002 The University of Saskatchewan * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * RTEMS osiFileName.h diff --git a/modules/libcom/src/osi/os/RTEMS/osiUnistd.h b/modules/libcom/src/osi/os/RTEMS/osiUnistd.h index c0a6e222d..1d465823a 100644 --- a/modules/libcom/src/osi/os/RTEMS/osiUnistd.h +++ b/modules/libcom/src/osi/os/RTEMS/osiUnistd.h @@ -5,12 +5,12 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 +/* + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #include diff --git a/modules/libcom/src/osi/os/WIN32/epicsAtomicMS.h b/modules/libcom/src/osi/os/WIN32/epicsAtomicMS.h index 14d2c9bac..1c4d182e3 100644 --- a/modules/libcom/src/osi/os/WIN32/epicsAtomicMS.h +++ b/modules/libcom/src/osi/os/WIN32/epicsAtomicMS.h @@ -5,7 +5,7 @@ * Copyright (c) 2011 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -49,19 +49,19 @@ EPICS_ATOMIC_INLINE int epicsAtomicAddIntT ( int * pTarget, int delta ) STATIC_ASSERT ( sizeof ( MS_LONG ) == sizeof ( int ) ); MS_LONG * const pTarg = ( MS_LONG * ) ( pTarget ); /* we dont use InterlockedAdd because only latest windows is supported */ - return delta + ( int ) MS_InterlockedExchangeAdd ( pTarg, + return delta + ( int ) MS_InterlockedExchangeAdd ( pTarg, ( MS_LONG ) delta ); } #endif #ifndef EPICS_ATOMIC_CAS_INTT #define EPICS_ATOMIC_CAS_INTT -EPICS_ATOMIC_INLINE int epicsAtomicCmpAndSwapIntT ( int * pTarget, +EPICS_ATOMIC_INLINE int epicsAtomicCmpAndSwapIntT ( int * pTarget, int oldVal, int newVal ) { STATIC_ASSERT ( sizeof ( MS_LONG ) == sizeof ( int ) ); MS_LONG * const pTarg = ( MS_LONG * ) ( pTarget ); - return (int) MS_InterlockedCompareExchange ( pTarg, + return (int) MS_InterlockedCompareExchange ( pTarg, (MS_LONG) newVal, (MS_LONG) oldVal ); } #endif @@ -69,7 +69,7 @@ EPICS_ATOMIC_INLINE int epicsAtomicCmpAndSwapIntT ( int * pTarget, #if ! defined ( MS_ATOMIC_64 ) /* - * necessary for next three functions + * necessary for next three functions * * looking at the MS documentation it appears that they will * keep type long the same size as an int on 64 bit builds @@ -96,12 +96,12 @@ EPICS_ATOMIC_INLINE size_t epicsAtomicDecrSizeT ( size_t * pTarget ) #ifndef EPICS_ATOMIC_ADD_SIZET #define EPICS_ATOMIC_ADD_SIZET -EPICS_ATOMIC_INLINE size_t epicsAtomicAddSizeT ( size_t * pTarget, +EPICS_ATOMIC_INLINE size_t epicsAtomicAddSizeT ( size_t * pTarget, size_t delta ) { MS_LONG * const pTarg = ( MS_LONG * ) ( pTarget ); /* we dont use InterlockedAdd because only latest windows is supported */ - return delta + ( size_t ) MS_InterlockedExchangeAdd ( pTarg, + return delta + ( size_t ) MS_InterlockedExchangeAdd ( pTarg, ( MS_LONG ) delta ); } #endif @@ -119,24 +119,24 @@ EPICS_ATOMIC_INLINE size_t epicsAtomicSubSizeT ( size_t * pTarget, size_t delta #ifndef EPICS_ATOMIC_CAS_SIZET #define EPICS_ATOMIC_CAS_SIZET -EPICS_ATOMIC_INLINE size_t epicsAtomicCmpAndSwapSizeT ( - size_t * pTarget, +EPICS_ATOMIC_INLINE size_t epicsAtomicCmpAndSwapSizeT ( + size_t * pTarget, size_t oldVal, size_t newVal ) { MS_LONG * const pTarg = ( MS_LONG * ) ( pTarget ); - return (size_t) MS_InterlockedCompareExchange ( pTarg, + return (size_t) MS_InterlockedCompareExchange ( pTarg, (MS_LONG) newVal, (MS_LONG) oldVal ); } #endif #ifndef EPICS_ATOMIC_CAS_PTRT #define EPICS_ATOMIC_CAS_PTRT -EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT ( - EpicsAtomicPtrT * pTarget, +EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT ( + EpicsAtomicPtrT * pTarget, EpicsAtomicPtrT oldVal, EpicsAtomicPtrT newVal ) { MS_LONG * const pTarg = ( MS_LONG * ) ( pTarget ); - return (EpicsAtomicPtrT) MS_InterlockedCompareExchange ( pTarg, + return (EpicsAtomicPtrT) MS_InterlockedCompareExchange ( pTarg, (MS_LONG) newVal, (MS_LONG) oldVal ); } #endif @@ -144,7 +144,7 @@ EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT ( #else /* ! MS_ATOMIC_64 */ /* - * necessary for next three functions + * necessary for next three functions */ STATIC_ASSERT ( sizeof ( MS_LONGLONG ) == sizeof ( size_t ) ); @@ -172,7 +172,7 @@ EPICS_ATOMIC_INLINE size_t epicsAtomicAddSizeT ( size_t * pTarget, size_t delta { MS_LONGLONG * const pTarg = ( MS_LONGLONG * ) ( pTarget ); /* we dont use InterlockedAdd64 because only latest windows is supported */ - return delta + ( size_t ) MS_InterlockedExchangeAdd64 ( pTarg, + return delta + ( size_t ) MS_InterlockedExchangeAdd64 ( pTarg, ( MS_LONGLONG ) delta ); } #endif @@ -190,24 +190,24 @@ EPICS_ATOMIC_INLINE size_t epicsAtomicSubSizeT ( size_t * pTarget, size_t delta #ifndef EPICS_ATOMIC_CAS_SIZET #define EPICS_ATOMIC_CAS_SIZET -EPICS_ATOMIC_INLINE size_t epicsAtomicCmpAndSwapSizeT ( size_t * pTarget, +EPICS_ATOMIC_INLINE size_t epicsAtomicCmpAndSwapSizeT ( size_t * pTarget, size_t oldVal, size_t newVal ) { MS_LONGLONG * const pTarg = ( MS_LONGLONG * ) ( pTarget ); - return (size_t) MS_InterlockedCompareExchange64 ( pTarg, - (MS_LONGLONG) newVal, + return (size_t) MS_InterlockedCompareExchange64 ( pTarg, + (MS_LONGLONG) newVal, (MS_LONGLONG) oldVal ); } #endif #ifndef EPICS_ATOMIC_CAS_PTRT #define EPICS_ATOMIC_CAS_PTRT -EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT ( - EpicsAtomicPtrT * pTarget, +EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT ( + EpicsAtomicPtrT * pTarget, EpicsAtomicPtrT oldVal, EpicsAtomicPtrT newVal ) { MS_LONGLONG * const pTarg = ( MS_LONGLONG * ) ( pTarget ); - return (EpicsAtomicPtrT) MS_InterlockedCompareExchange64 ( pTarg, + return (EpicsAtomicPtrT) MS_InterlockedCompareExchange64 ( pTarg, (MS_LONGLONG) newVal, (MS_LONGLONG) oldVal ); } #endif diff --git a/modules/libcom/src/osi/os/WIN32/epicsAtomicOSD.h b/modules/libcom/src/osi/os/WIN32/epicsAtomicOSD.h index 2170fceff..49487f7c8 100644 --- a/modules/libcom/src/osi/os/WIN32/epicsAtomicOSD.h +++ b/modules/libcom/src/osi/os/WIN32/epicsAtomicOSD.h @@ -5,7 +5,7 @@ * Copyright (c) 2011 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -44,19 +44,19 @@ # define MS_ATOMIC_64 #endif -#define MS_LONG LONG +#define MS_LONG LONG #define MS_InterlockedExchange InterlockedExchange #define MS_InterlockedCompareExchange InterlockedCompareExchange -#define MS_InterlockedIncrement InterlockedIncrement -#define MS_InterlockedDecrement InterlockedDecrement +#define MS_InterlockedIncrement InterlockedIncrement +#define MS_InterlockedDecrement InterlockedDecrement #define MS_InterlockedExchange InterlockedExchange #define MS_InterlockedExchangeAdd InterlockedExchangeAdd #if defined ( MS_ATOMIC_64 ) -# define MS_LONGLONG LONGLONG +# define MS_LONGLONG LONGLONG # define MS_InterlockedIncrement64 InterlockedIncrement64 -# define MS_InterlockedDecrement64 InterlockedDecrement64 -# define MS_InterlockedExchange64 InterlockedExchange64 -# define MS_InterlockedExchangeAdd64 InterlockedExchangeAdd64 +# define MS_InterlockedDecrement64 InterlockedDecrement64 +# define MS_InterlockedExchange64 InterlockedExchange64 +# define MS_InterlockedExchangeAdd64 InterlockedExchangeAdd64 # define MS_InterlockedCompareExchange64 InterlockedCompareExchange64 #endif diff --git a/modules/libcom/src/osi/os/WIN32/epicsGetopt.c b/modules/libcom/src/osi/os/WIN32/epicsGetopt.c index a364c256d..b566090bd 100644 --- a/modules/libcom/src/osi/os/WIN32/epicsGetopt.c +++ b/modules/libcom/src/osi/os/WIN32/epicsGetopt.c @@ -2,7 +2,7 @@ /* * Copyright (c) 1987, 1993, 1994 - * The Regents of the University of California. All rights reserved. + * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -14,8 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. + * This product includes software developed by the University of + * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. @@ -34,7 +34,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95"; +static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95"; #endif /* LIBC_SCCS and not lint */ #include @@ -46,81 +46,81 @@ static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95"; #define _getprogname() nargv[0] -int opterr = 1, /* if error message should be printed */ - optind = 1, /* index into parent argv vector */ - optopt; /* character checked for validity */ -int optreset; /* reset getopt */ +int opterr = 1, /* if error message should be printed */ + optind = 1, /* index into parent argv vector */ + optopt; /* character checked for validity */ +int optreset; /* reset getopt */ -char *optarg; /* argument associated with option */ +char *optarg; /* argument associated with option */ -#define BADCH (int)'?' -#define BADARG (int)':' -#define EMSG "" +#define BADCH (int)'?' +#define BADARG (int)':' +#define EMSG "" /* * getopt -- - * Parse argc/argv argument vector. + * Parse argc/argv argument vector. */ int getopt(nargc, nargv, ostr) - int nargc; - char * const *nargv; - const char *ostr; + int nargc; + char * const *nargv; + const char *ostr; { - static char *place = EMSG; /* option letter processing */ - char *oli; /* option letter list index */ + static char *place = EMSG; /* option letter processing */ + char *oli; /* option letter list index */ - if (optreset || !*place) { /* update scanning pointer */ - optreset = 0; - if (optind >= nargc || *(place = nargv[optind]) != '-') { - place = EMSG; - return (-1); - } - if (place[1] && *++place == '-') { /* found "--" */ - ++optind; - place = EMSG; - return (-1); - } - } /* option letter okay? */ - if ((optopt = (int)*place++) == (int)':' || - !(oli = strchr(ostr, optopt))) { - /* - * if the user didn't specify '-' as an option, - * assume it means -1. - */ - if (optopt == (int)'-') - return (-1); - if (!*place) - ++optind; - if (opterr && *ostr != ':' && optopt != BADCH) - (void)fprintf(stderr, "%s: illegal option -- %c\n", - _getprogname(), optopt); - return (BADCH); - } - if (*++oli != ':') { /* don't need argument */ - optarg = NULL; - if (!*place) - ++optind; - } - else { /* need an argument */ - if (*place) /* no white space */ - optarg = place; - else if (nargc <= ++optind) { /* no arg */ - place = EMSG; - if (*ostr == ':') - return (BADARG); - if (opterr) - (void)fprintf(stderr, - "%s: option requires an argument -- %c\n", - _getprogname(), optopt); - return (BADCH); - } - else /* white space */ - optarg = nargv[optind]; - place = EMSG; - ++optind; - } - return (optopt); /* dump back option letter */ + if (optreset || !*place) { /* update scanning pointer */ + optreset = 0; + if (optind >= nargc || *(place = nargv[optind]) != '-') { + place = EMSG; + return (-1); + } + if (place[1] && *++place == '-') { /* found "--" */ + ++optind; + place = EMSG; + return (-1); + } + } /* option letter okay? */ + if ((optopt = (int)*place++) == (int)':' || + !(oli = strchr(ostr, optopt))) { + /* + * if the user didn't specify '-' as an option, + * assume it means -1. + */ + if (optopt == (int)'-') + return (-1); + if (!*place) + ++optind; + if (opterr && *ostr != ':' && optopt != BADCH) + (void)fprintf(stderr, "%s: illegal option -- %c\n", + _getprogname(), optopt); + return (BADCH); + } + if (*++oli != ':') { /* don't need argument */ + optarg = NULL; + if (!*place) + ++optind; + } + else { /* need an argument */ + if (*place) /* no white space */ + optarg = place; + else if (nargc <= ++optind) { /* no arg */ + place = EMSG; + if (*ostr == ':') + return (BADARG); + if (opterr) + (void)fprintf(stderr, + "%s: option requires an argument -- %c\n", + _getprogname(), optopt); + return (BADCH); + } + else /* white space */ + optarg = nargv[optind]; + place = EMSG; + ++optind; + } + return (optopt); /* dump back option letter */ } #endif /* !_MINGW */ diff --git a/modules/libcom/src/osi/os/WIN32/epicsGetopt.h b/modules/libcom/src/osi/os/WIN32/epicsGetopt.h index 780734e1a..aabd5b30e 100644 --- a/modules/libcom/src/osi/os/WIN32/epicsGetopt.h +++ b/modules/libcom/src/osi/os/WIN32/epicsGetopt.h @@ -7,7 +7,7 @@ * Synchrotronstrahlung. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef _EPICS_GETOPT_H #define _EPICS_GETOPT_H diff --git a/modules/libcom/src/osi/os/WIN32/epicsMath.h b/modules/libcom/src/osi/os/WIN32/epicsMath.h index 65e7c7b77..e26517493 100644 --- a/modules/libcom/src/osi/os/WIN32/epicsMath.h +++ b/modules/libcom/src/osi/os/WIN32/epicsMath.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef epicsMathh @@ -23,7 +23,7 @@ #endif #ifndef isinf -#define isinf(D) ( !_finite(D) && !_isnan(D) ) +#define isinf(D) ( !_finite(D) && !_isnan(D) ) #endif #ifdef __cplusplus diff --git a/modules/libcom/src/osi/os/WIN32/epicsSocketConvertErrnoToString.cpp b/modules/libcom/src/osi/os/WIN32/epicsSocketConvertErrnoToString.cpp index 2621ce256..001ca238f 100644 --- a/modules/libcom/src/osi/os/WIN32/epicsSocketConvertErrnoToString.cpp +++ b/modules/libcom/src/osi/os/WIN32/epicsSocketConvertErrnoToString.cpp @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include @@ -22,7 +22,7 @@ void epicsSocketConvertErrorToString ( /* * this does not work on systems prior to W2K */ - DWORD success = FormatMessage ( + DWORD success = FormatMessage ( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_MAX_WIDTH_MASK, NULL, theSockError, MAKELANGID ( LANG_NEUTRAL, SUBLANG_DEFAULT ), /* Default language */ diff --git a/modules/libcom/src/osi/os/WIN32/forceBadAllocException.cpp b/modules/libcom/src/osi/os/WIN32/forceBadAllocException.cpp index 985ec988e..5f160a24a 100644 --- a/modules/libcom/src/osi/os/WIN32/forceBadAllocException.cpp +++ b/modules/libcom/src/osi/os/WIN32/forceBadAllocException.cpp @@ -5,21 +5,21 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ // -// On older version of ms visual c++ operator new +// On older version of ms visual c++ operator new // does not throw a bad_alloc exception // when it fails. It simply returns a null pointer. -// This behavior is not in conformance with the +// This behavior is not in conformance with the // ANSI / ISO C++. -// +// #if _MSC_VER > 1000 && _MSC_VER < 1400 #include #include -// instruct loader to call this gllobal object +// instruct loader to call this gllobal object // constructor before user global object constructors #pragma warning (disable: 4073) #pragma init_seg(lib) diff --git a/modules/libcom/src/osi/os/WIN32/osdBackTrace.cpp b/modules/libcom/src/osi/os/WIN32/osdBackTrace.cpp index e143ebd57..2d377debb 100644 --- a/modules/libcom/src/osi/os/WIN32/osdBackTrace.cpp +++ b/modules/libcom/src/osi/os/WIN32/osdBackTrace.cpp @@ -1,11 +1,11 @@ -/* +/* * Copyright: Stanford University / SLAC National Laboratory. * * EPICS BASE is distributed subject to a Software License Agreement found - * in file LICENSE that is included with this distribution. + * in file LICENSE that is included with this distribution. * * Author: Till Straumann , 2014 - */ + */ #include diff --git a/modules/libcom/src/osi/os/WIN32/osdEnv.c b/modules/libcom/src/osi/os/WIN32/osdEnv.c index c1b88819a..fc446f2f4 100644 --- a/modules/libcom/src/osi/os/WIN32/osdEnv.c +++ b/modules/libcom/src/osi/os/WIN32/osdEnv.c @@ -1,7 +1,7 @@ /*************************************************************************\ * Copyright (c) 2002 The University of Saskatchewan * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* osdEnv.c */ /* @@ -36,13 +36,13 @@ LIBCOM_API void epicsStdCall epicsEnvSet (const char *name, const char *value) char *cp; iocshEnvClear(name); - - cp = mallocMustSucceed (strlen (name) + strlen (value) + 2, "epicsEnvSet"); - strcpy (cp, name); - strcat (cp, "="); - strcat (cp, value); - if (putenv (cp) < 0) { - errPrintf( + + cp = mallocMustSucceed (strlen (name) + strlen (value) + 2, "epicsEnvSet"); + strcpy (cp, name); + strcat (cp, "="); + strcat (cp, value); + if (putenv (cp) < 0) { + errPrintf( -1L, __FILE__, __LINE__, @@ -51,7 +51,7 @@ LIBCOM_API void epicsStdCall epicsEnvSet (const char *name, const char *value) value, strerror (errno)); free (cp); - } + } } /* diff --git a/modules/libcom/src/osi/os/WIN32/osdEvent.c b/modules/libcom/src/osi/os/WIN32/osdEvent.c index 1339d8a88..b75016b47 100644 --- a/modules/libcom/src/osi/os/WIN32/osdEvent.c +++ b/modules/libcom/src/osi/os/WIN32/osdEvent.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* osdEvent.c */ /* @@ -33,7 +33,7 @@ typedef struct epicsEventOSD { * epicsEventCreate () */ LIBCOM_API epicsEventId epicsEventCreate ( - epicsEventInitialState initialState ) + epicsEventInitialState initialState ) { epicsEventOSD *pSem; @@ -72,7 +72,7 @@ LIBCOM_API epicsEventStatus epicsEventTrigger ( epicsEventId pSem ) * epicsEventWait () */ LIBCOM_API epicsEventStatus epicsEventWait ( epicsEventId pSem ) -{ +{ DWORD status; status = WaitForSingleObject (pSem->handle, INFINITE); if ( status == WAIT_OBJECT_0 ) { @@ -88,7 +88,7 @@ LIBCOM_API epicsEventStatus epicsEventWait ( epicsEventId pSem ) */ LIBCOM_API epicsEventStatus epicsEventWaitWithTimeout ( epicsEventId pSem, double timeOut ) -{ +{ static const unsigned mSecPerSec = 1000; DWORD status; DWORD tmo; @@ -121,7 +121,7 @@ LIBCOM_API epicsEventStatus epicsEventWaitWithTimeout ( * epicsEventTryWait () */ LIBCOM_API epicsEventStatus epicsEventTryWait ( epicsEventId pSem ) -{ +{ DWORD status; status = WaitForSingleObject ( pSem->handle, 0 ); @@ -140,5 +140,5 @@ LIBCOM_API epicsEventStatus epicsEventTryWait ( epicsEventId pSem ) * epicsEventShow () */ LIBCOM_API void epicsEventShow ( epicsEventId id, unsigned level ) -{ +{ } diff --git a/modules/libcom/src/osi/os/WIN32/osdEvent.h b/modules/libcom/src/osi/os/WIN32/osdEvent.h index f57f2cc49..7585a7170 100644 --- a/modules/libcom/src/osi/os/WIN32/osdEvent.h +++ b/modules/libcom/src/osi/os/WIN32/osdEvent.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* osdEvent.c */ /* diff --git a/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c b/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c index 4e8fc59ea..c40168977 100644 --- a/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c +++ b/modules/libcom/src/osi/os/WIN32/osdFindSymbol.c @@ -1,7 +1,7 @@ /*************************************************************************\ * Copyright (c) 2013 Dirk Zimoch, PSI * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* osi/os/WIN32/osdFindSymbol.c */ diff --git a/modules/libcom/src/osi/os/WIN32/osdMutex.c b/modules/libcom/src/osi/os/WIN32/osdMutex.c index 6bcf1e608..792149fd2 100644 --- a/modules/libcom/src/osi/os/WIN32/osdMutex.c +++ b/modules/libcom/src/osi/os/WIN32/osdMutex.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* osdMutex.c */ /* @@ -22,23 +22,23 @@ #define VC_EXTRALEAN #define STRICT -/* +/* * Defining this allows the *much* faster critical * section mutex primitive to be used. Unfortunately, - * using certain of these functions drops support for W95\W98\WME - * unless we specify "delay loading" when we link with the - * DLL so that DLL entry points are not resolved until they + * using certain of these functions drops support for W95\W98\WME + * unless we specify "delay loading" when we link with the + * DLL so that DLL entry points are not resolved until they * are used. The code does have run time switches so - * that the more advanced calls are not called unless + * that the more advanced calls are not called unless * they are available in the windows OS, but this feature - * isnt going to be very useful unless we specify "delay + * isnt going to be very useful unless we specify "delay * loading" when we link with the DLL. * * It appears that the only entry point used here that causes * portability problems with W95\W98\WME is TryEnterCriticalSection. */ #ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x0400 +# define _WIN32_WINNT 0x0400 #endif #include @@ -47,7 +47,7 @@ #include "epicsAssert.h" #include "epicsStdio.h" -typedef struct epicsMutexOSD { +typedef struct epicsMutexOSD { union { HANDLE mutex; CRITICAL_SECTION criticalSection; @@ -60,7 +60,7 @@ static LONG weHaveInitialized = 0; /* * epicsMutexCreate () */ -epicsMutexOSD * epicsMutexOsdCreate ( void ) +epicsMutexOSD * epicsMutexOsdCreate ( void ) { epicsMutexOSD * pSem; @@ -72,7 +72,7 @@ epicsMutexOSD * epicsMutexOsdCreate ( void ) thisIsNT = status && ( osInfo.dwPlatformId == VER_PLATFORM_WIN32_NT ); weHaveInitialized = 1; } - + pSem = malloc ( sizeof (*pSem) ); if ( pSem ) { if ( thisIsNT ) { @@ -85,15 +85,15 @@ epicsMutexOSD * epicsMutexOsdCreate ( void ) pSem = 0; } } - } + } return pSem; } /* * epicsMutexOsdDestroy () */ -void epicsMutexOsdDestroy ( epicsMutexOSD * pSem ) -{ +void epicsMutexOsdDestroy ( epicsMutexOSD * pSem ) +{ if ( thisIsNT ) { DeleteCriticalSection ( &pSem->os.criticalSection ); } @@ -106,7 +106,7 @@ void epicsMutexOsdDestroy ( epicsMutexOSD * pSem ) /* * epicsMutexOsdUnlock () */ -void epicsMutexOsdUnlock ( epicsMutexOSD * pSem ) +void epicsMutexOsdUnlock ( epicsMutexOSD * pSem ) { if ( thisIsNT ) { LeaveCriticalSection ( &pSem->os.criticalSection ); @@ -120,7 +120,7 @@ void epicsMutexOsdUnlock ( epicsMutexOSD * pSem ) /* * epicsMutexOsdLock () */ -epicsMutexLockStatus epicsMutexOsdLock ( epicsMutexOSD * pSem ) +epicsMutexLockStatus epicsMutexOsdLock ( epicsMutexOSD * pSem ) { if ( thisIsNT ) { EnterCriticalSection ( &pSem->os.criticalSection ); @@ -137,8 +137,8 @@ epicsMutexLockStatus epicsMutexOsdLock ( epicsMutexOSD * pSem ) /* * epicsMutexOsdTryLock () */ -epicsMutexLockStatus epicsMutexOsdTryLock ( epicsMutexOSD * pSem ) -{ +epicsMutexLockStatus epicsMutexOsdTryLock ( epicsMutexOSD * pSem ) +{ if ( thisIsNT ) { if ( TryEnterCriticalSection ( &pSem->os.criticalSection ) ) { return epicsMutexLockOK; @@ -164,14 +164,14 @@ epicsMutexLockStatus epicsMutexOsdTryLock ( epicsMutexOSD * pSem ) /* * epicsMutexOsdShow () */ -void epicsMutexOsdShow ( epicsMutexOSD * pSem, unsigned level ) -{ +void epicsMutexOsdShow ( epicsMutexOSD * pSem, unsigned level ) +{ if ( thisIsNT ) { printf ("epicsMutex: win32 critical section at %p\n", (void * ) & pSem->os.criticalSection ); } else { - printf ( "epicsMutex: win32 mutex at %p\n", + printf ( "epicsMutex: win32 mutex at %p\n", ( void * ) pSem->os.mutex ); } } diff --git a/modules/libcom/src/osi/os/WIN32/osdMutex.h b/modules/libcom/src/osi/os/WIN32/osdMutex.h index d8f3f78bd..973c17781 100644 --- a/modules/libcom/src/osi/os/WIN32/osdMutex.h +++ b/modules/libcom/src/osi/os/WIN32/osdMutex.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* osdMutex.h */ diff --git a/modules/libcom/src/osi/os/WIN32/osdPoolStatus.c b/modules/libcom/src/osi/os/WIN32/osdPoolStatus.c index d4e756486..811a6ef5f 100644 --- a/modules/libcom/src/osi/os/WIN32/osdPoolStatus.c +++ b/modules/libcom/src/osi/os/WIN32/osdPoolStatus.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include "osiPoolStatus.h" diff --git a/modules/libcom/src/osi/os/WIN32/osdPoolStatus.h b/modules/libcom/src/osi/os/WIN32/osdPoolStatus.h index 178434b11..9e09cd42e 100644 --- a/modules/libcom/src/osi/os/WIN32/osdPoolStatus.h +++ b/modules/libcom/src/osi/os/WIN32/osdPoolStatus.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifdef osdPoolStatush diff --git a/modules/libcom/src/osi/os/WIN32/osdProcess.c b/modules/libcom/src/osi/os/WIN32/osdProcess.c index 92902315f..408df2ab0 100644 --- a/modules/libcom/src/osi/os/WIN32/osdProcess.c +++ b/modules/libcom/src/osi/os/WIN32/osdProcess.c @@ -5,9 +5,9 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* * Operating System Dependent Implementation of osiProcess.h * * Author: Jeff Hill @@ -50,17 +50,17 @@ LIBCOM_API osiGetUserNameReturn epicsStdCall osiGetUserName (char *pBuf, unsigne LIBCOM_API osiSpawnDetachedProcessReturn epicsStdCall osiSpawnDetachedProcess ( const char *pProcessName, const char *pBaseExecutableName ) { - BOOL status; - STARTUPINFO startupInfo; - PROCESS_INFORMATION processInfo; + BOOL status; + STARTUPINFO startupInfo; + PROCESS_INFORMATION processInfo; - GetStartupInfo ( &startupInfo ); - startupInfo.lpReserved = NULL; - startupInfo.lpTitle = (char *) pProcessName; - startupInfo.dwFlags = STARTF_USESHOWWINDOW; - startupInfo.wShowWindow = SW_SHOWMINNOACTIVE; - - status = CreateProcess ( + GetStartupInfo ( &startupInfo ); + startupInfo.lpReserved = NULL; + startupInfo.lpTitle = (char *) pProcessName; + startupInfo.dwFlags = STARTF_USESHOWWINDOW; + startupInfo.wShowWindow = SW_SHOWMINNOACTIVE; + + status = CreateProcess ( NULL, /* pointer to name of executable module (not required if command line is specified) */ (char *) pBaseExecutableName, /* pointer to command line string */ NULL, /* pointer to process security attributes */ @@ -71,20 +71,20 @@ LIBCOM_API osiSpawnDetachedProcessReturn epicsStdCall osiSpawnDetachedProcess NULL, /* pointer to current directory name (defaults to caller's current directory) */ &startupInfo, /* pointer to STARTUPINFO */ &processInfo /* pointer to PROCESS_INFORMATION */ - ); + ); if ( status == 0 ) { DWORD W32status; LPVOID errStrMsgBuf; LPVOID complteMsgBuf; - - W32status = FormatMessage ( + + W32status = FormatMessage ( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError (), MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */ - (LPTSTR) &errStrMsgBuf, + (LPTSTR) &errStrMsgBuf, 0, - NULL + NULL ); if ( W32status ) { @@ -93,16 +93,16 @@ LIBCOM_API osiSpawnDetachedProcessReturn epicsStdCall osiSpawnDetachedProcess pFmtArgs[1] = (char *) pBaseExecutableName; pFmtArgs[2] = errStrMsgBuf; pFmtArgs[3] = "Changes may be required in your \"path\" environment variable."; - - W32status = FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING | + + W32status = FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY | 80, "%1 \"%2\". %3 %4", 0, MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */ (LPTSTR) &complteMsgBuf, 0, - pFmtArgs + pFmtArgs ); if (W32status) { fprintf (stderr, "%s\n", (char *) complteMsgBuf); @@ -111,7 +111,7 @@ LIBCOM_API osiSpawnDetachedProcessReturn epicsStdCall osiSpawnDetachedProcess else { fprintf (stderr, "%s\n", (char *) errStrMsgBuf); } - + /* Free the buffer. */ LocalFree (errStrMsgBuf); } diff --git a/modules/libcom/src/osi/os/WIN32/osdSignal.cpp b/modules/libcom/src/osi/os/WIN32/osdSignal.cpp index 06251118f..f3666555c 100644 --- a/modules/libcom/src/osi/os/WIN32/osdSignal.cpp +++ b/modules/libcom/src/osi/os/WIN32/osdSignal.cpp @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found - * in file LICENSE that is included with this distribution. + * in file LICENSE that is included with this distribution. \*************************************************************************/ #include "epicsSignal.h" diff --git a/modules/libcom/src/osi/os/WIN32/osdSock.c b/modules/libcom/src/osi/os/WIN32/osdSock.c index fd17ea1d1..89fa33de0 100644 --- a/modules/libcom/src/osi/os/WIN32/osdSock.c +++ b/modules/libcom/src/osi/os/WIN32/osdSock.c @@ -5,14 +5,14 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* - * WIN32 specific initialisation for bsd sockets, - * based on Chris Timossi's base/src/ca/windows_depend.c, + * WIN32 specific initialisation for bsd sockets, + * based on Chris Timossi's base/src/ca/windows_depend.c, * and also further additions by Kay Kasemir when this was in - * dllmain.cc + * dllmain.cc * * 7-1-97 -joh- * @@ -40,61 +40,61 @@ static WSADATA WsaData; /* version of winsock */ LIBCOM_API unsigned epicsStdCall wsaMajorVersion () { - return (unsigned) LOBYTE( WsaData.wVersion ); + return (unsigned) LOBYTE( WsaData.wVersion ); } - + /* * osiSockAttach() */ LIBCOM_API int epicsStdCall osiSockAttach() { - int status; + int status; - if (nAttached) { - nAttached++; - return TRUE; - } + if (nAttached) { + nAttached++; + return TRUE; + } #if _DEBUG - /* for gui applications, setup console for error messages */ - if (AllocConsole()) - { - char title[256]; - DWORD titleLength = GetConsoleTitle(title, sizeof(title)); - if (titleLength) { - titleLength = strlen (title); - strncat (title, " " EPICS_VERSION_STRING, sizeof(title)); - } - else { - strncpy(title, EPICS_VERSION_STRING, sizeof(title)); - } - title[sizeof(title)-1]= '\0'; - SetConsoleTitle(title); - freopen( "CONOUT$", "a", stderr ); - } + /* for gui applications, setup console for error messages */ + if (AllocConsole()) + { + char title[256]; + DWORD titleLength = GetConsoleTitle(title, sizeof(title)); + if (titleLength) { + titleLength = strlen (title); + strncat (title, " " EPICS_VERSION_STRING, sizeof(title)); + } + else { + strncpy(title, EPICS_VERSION_STRING, sizeof(title)); + } + title[sizeof(title)-1]= '\0'; + SetConsoleTitle(title); + freopen( "CONOUT$", "a", stderr ); + } #endif - /* - * attach to win sock - */ - status = WSAStartup(MAKEWORD(/*major*/2,/*minor*/2), &WsaData); - if (status != 0) { - fprintf(stderr, - "Unable to attach to windows sockets version 2. error=%d\n", status); - fprintf(stderr, - "A Windows Sockets II update for windows 95 is available at\n"); - fprintf(stderr, - "http://www.microsoft.com/windows95/info/ws2.htm"); - return FALSE; - } + /* + * attach to win sock + */ + status = WSAStartup(MAKEWORD(/*major*/2,/*minor*/2), &WsaData); + if (status != 0) { + fprintf(stderr, + "Unable to attach to windows sockets version 2. error=%d\n", status); + fprintf(stderr, + "A Windows Sockets II update for windows 95 is available at\n"); + fprintf(stderr, + "http://www.microsoft.com/windows95/info/ws2.htm"); + return FALSE; + } -# if defined ( _DEBUG ) && 0 - fprintf(stderr, "EPICS attached to winsock version %s\n", WsaData.szDescription); -# endif - - nAttached = 1u; +# if defined ( _DEBUG ) && 0 + fprintf(stderr, "EPICS attached to winsock version %s\n", WsaData.szDescription); +# endif - return TRUE; + nAttached = 1u; + + return TRUE; } /* @@ -102,15 +102,15 @@ LIBCOM_API int epicsStdCall osiSockAttach() */ LIBCOM_API void epicsStdCall osiSockRelease() { - if (nAttached) { - if (--nAttached==0u) { - WSACleanup(); -# if defined ( _DEBUG ) && 0 - fprintf(stderr, "EPICS released winsock version %s\n", WsaData.szDescription); -# endif - memset (&WsaData, '\0', sizeof(WsaData)); - } - } + if (nAttached) { + if (--nAttached==0u) { + WSACleanup(); +# if defined ( _DEBUG ) && 0 + fprintf(stderr, "EPICS released winsock version %s\n", WsaData.szDescription); +# endif + memset (&WsaData, '\0', sizeof(WsaData)); + } + } } LIBCOM_API SOCKET epicsStdCall epicsSocketCreate ( @@ -131,7 +131,7 @@ LIBCOM_API void epicsStdCall epicsSocketDestroy ( SOCKET s ) if ( status < 0 ) { char buf [ 64 ]; epicsSocketConvertErrnoToString ( buf, sizeof ( buf ) ); - errlogPrintf ( + errlogPrintf ( "epicsSocketDestroy: failed to " "close a socket because \"%s\"\n", buf ); } @@ -143,18 +143,18 @@ LIBCOM_API void epicsStdCall epicsSocketDestroy ( SOCKET s ) LIBCOM_API unsigned epicsStdCall ipAddrToHostName (const struct in_addr *pAddr, char *pBuf, unsigned bufSize) { - struct hostent *ent; + struct hostent *ent; - if (bufSize<1) { - return 0; - } + if (bufSize<1) { + return 0; + } - ent = gethostbyaddr((char *) pAddr, sizeof (*pAddr), AF_INET); - if (ent) { + ent = gethostbyaddr((char *) pAddr, sizeof (*pAddr), AF_INET); + if (ent) { strncpy (pBuf, ent->h_name, bufSize); pBuf[bufSize-1] = '\0'; return strlen (pBuf); - } + } return 0; } @@ -162,28 +162,28 @@ LIBCOM_API unsigned epicsStdCall ipAddrToHostName * hostToIPAddr () */ LIBCOM_API int epicsStdCall hostToIPAddr - (const char *pHostName, struct in_addr *pIPA) + (const char *pHostName, struct in_addr *pIPA) { - struct hostent *phe; + struct hostent *phe; - phe = gethostbyname (pHostName); - if (phe && phe->h_addr_list[0]) { - if (phe->h_addrtype==AF_INET && phe->h_length<=sizeof(struct in_addr)) { - struct in_addr *pInAddrIn = (struct in_addr *) phe->h_addr_list[0]; - - *pIPA = *pInAddrIn; + phe = gethostbyname (pHostName); + if (phe && phe->h_addr_list[0]) { + if (phe->h_addrtype==AF_INET && phe->h_length<=sizeof(struct in_addr)) { + struct in_addr *pInAddrIn = (struct in_addr *) phe->h_addr_list[0]; - /* - * success - */ - return 0; - } - } + *pIPA = *pInAddrIn; - /* - * return indicating an error - */ - return -1; + /* + * success + */ + return 0; + } + } + + /* + * return indicating an error + */ + return -1; } diff --git a/modules/libcom/src/osi/os/WIN32/osdSock.h b/modules/libcom/src/osi/os/WIN32/osdSock.h index f00c39e69..c509dbab1 100644 --- a/modules/libcom/src/osi/os/WIN32/osdSock.h +++ b/modules/libcom/src/osi/os/WIN32/osdSock.h @@ -25,7 +25,7 @@ #define SOCKERRNO WSAGetLastError() -#define socket_ioctl(A,B,C) ioctlsocket(A,B,C) +#define socket_ioctl(A,B,C) ioctlsocket(A,B,C) typedef u_long FAR osiSockIoctl_t; typedef int osiSocklen_t; typedef BOOL osiSockOptMcastLoop_t; @@ -43,8 +43,8 @@ typedef DWORD osiSockOptMcastTTL_t; # define SHUT_RDWR SD_BOTH #endif -#define MAXHOSTNAMELEN 75 -#define IPPORT_USERRESERVED 5000U +#define MAXHOSTNAMELEN 75 +#define IPPORT_USERRESERVED 5000U #define SOCK_EWOULDBLOCK WSAEWOULDBLOCK #define SOCK_ENOBUFS WSAENOBUFS @@ -67,11 +67,11 @@ typedef DWORD osiSockOptMcastTTL_t; #define SOCK_EBADF WSAENOTSOCK /* - * Under WIN32, FD_SETSIZE is the max. number of sockets, - * not the max. fd value that you use in select(). + * Under WIN32, FD_SETSIZE is the max. number of sockets, + * not the max. fd value that you use in select(). * - * Therefore, it is difficult to detemine if any given - * fd can be used with FD_SET(), FD_CLR(), and FD_ISSET(). + * Therefore, it is difficult to detemine if any given + * fd can be used with FD_SET(), FD_CLR(), and FD_ISSET(). */ #define FD_IN_FDSET(FD) (1) diff --git a/modules/libcom/src/osi/os/WIN32/osdStdio.c b/modules/libcom/src/osi/os/WIN32/osdStdio.c index 90bbc3459..d812d690b 100644 --- a/modules/libcom/src/osi/os/WIN32/osdStdio.c +++ b/modules/libcom/src/osi/os/WIN32/osdStdio.c @@ -5,7 +5,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include diff --git a/modules/libcom/src/osi/os/WIN32/osdStrtod.h b/modules/libcom/src/osi/os/WIN32/osdStrtod.h index 48f8f4a04..ab42b3474 100644 --- a/modules/libcom/src/osi/os/WIN32/osdStrtod.h +++ b/modules/libcom/src/osi/os/WIN32/osdStrtod.h @@ -2,7 +2,7 @@ * Copyright (c) 2002 The University of Saskatchewan * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/libcom/src/osi/os/WIN32/osdThread.c b/modules/libcom/src/osi/os/WIN32/osdThread.c index be59a45a8..2e22273e5 100644 --- a/modules/libcom/src/osi/os/WIN32/osdThread.c +++ b/modules/libcom/src/osi/os/WIN32/osdThread.c @@ -65,7 +65,7 @@ typedef struct epicsThreadPrivateOSD { #endif #define osdOrdinaryPriorityStateCount 5u -static const int osdOrdinaryPriorityList [osdOrdinaryPriorityStateCount] = +static const int osdOrdinaryPriorityList [osdOrdinaryPriorityStateCount] = { THREAD_PRIORITY_LOWEST, /* -2 on >= W2K ??? on W95 */ THREAD_PRIORITY_BELOW_NORMAL, /* -1 on >= W2K ??? on W95 */ @@ -75,7 +75,7 @@ static const int osdOrdinaryPriorityList [osdOrdinaryPriorityStateCount] = }; # define osdRealtimePriorityStateCount 14u -static const int osdRealtimePriorityList [osdRealtimePriorityStateCount] = +static const int osdRealtimePriorityList [osdRealtimePriorityStateCount] = { -7, /* allowed on >= W2k, but no #define supplied */ -6, /* allowed on >= W2k, but no #define supplied */ @@ -101,36 +101,36 @@ BOOL WINAPI DllMain ( HMODULE dllHandle = 0; BOOL success = TRUE; - switch ( dwReason ) - { - case DLL_PROCESS_ATTACH: + switch ( dwReason ) + { + case DLL_PROCESS_ATTACH: dllHandleIndex = TlsAlloc (); if ( dllHandleIndex == TLS_OUT_OF_INDEXES ) { success = FALSE; } - break; + break; - case DLL_PROCESS_DETACH: + case DLL_PROCESS_DETACH: success = TlsFree ( dllHandleIndex ); - break; + break; - case DLL_THREAD_ATTACH: + case DLL_THREAD_ATTACH: /* - * Dont allow user's explicitly calling FreeLibrary for Com.dll to yank + * Dont allow user's explicitly calling FreeLibrary for Com.dll to yank * the carpet out from under EPICS threads that are still using Com.dll */ -#if _WIN32_WINNT >= 0x0501 - /* - * Only in WXP +#if _WIN32_WINNT >= 0x0501 + /* + * Only in WXP * Thats a shame because this is probably much faster */ success = GetModuleHandleEx ( GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, ( LPCTSTR ) DllMain, & dllHandle ); #else - { + { char name[256]; - DWORD nChar = GetModuleFileName ( + DWORD nChar = GetModuleFileName ( hModule, name, sizeof ( name ) ); if ( nChar && nChar < sizeof ( name ) ) { dllHandle = LoadLibrary ( name ); @@ -146,8 +146,8 @@ BOOL WINAPI DllMain ( if ( success ) { success = TlsSetValue ( dllHandleIndex, dllHandle ); } - break; - case DLL_THREAD_DETACH: + break; + case DLL_THREAD_DETACH: /* * Thread is exiting, release Com.dll. I am assuming that windows is * smart enough to postpone the unload until this function returns. @@ -156,10 +156,10 @@ BOOL WINAPI DllMain ( if ( dllHandle ) { success = FreeLibrary ( dllHandle ); } - break; - } + break; + } - return success; + return success; } #endif @@ -187,7 +187,7 @@ static win32ThreadGlobal * fetchWin32ThreadGlobal ( void ) while ( ! InterlockedCompareExchange ( & initCompleted, 0, 0 ) ) { /* * I am not fond of busy loops, but since this will - * collide very infrequently and this is the lowest + * collide very infrequently and this is the lowest * level init then perhaps this is ok */ Sleep ( 1 ); @@ -198,7 +198,7 @@ static win32ThreadGlobal * fetchWin32ThreadGlobal ( void ) return pWin32ThreadGlobal; } - pWin32ThreadGlobal = ( win32ThreadGlobal * ) + pWin32ThreadGlobal = ( win32ThreadGlobal * ) calloc ( 1, sizeof ( * pWin32ThreadGlobal ) ); if ( ! pWin32ThreadGlobal ) { InterlockedExchange ( & initStarted, 0 ); @@ -254,7 +254,7 @@ LIBCOM_API void epicsStdCall epicsThreadExitMain ( void ) /* * osdPriorityMagFromPriorityOSI () */ -static unsigned osdPriorityMagFromPriorityOSI ( unsigned osiPriority, unsigned priorityStateCount ) +static unsigned osdPriorityMagFromPriorityOSI ( unsigned osiPriority, unsigned priorityStateCount ) { unsigned magnitude; @@ -281,7 +281,7 @@ void epicsThreadRealtimeLock(void) /* * epicsThreadGetOsdPriorityValue () */ -static int epicsThreadGetOsdPriorityValue ( unsigned osiPriority ) +static int epicsThreadGetOsdPriorityValue ( unsigned osiPriority ) { const DWORD priorityClass = GetPriorityClass ( GetCurrentProcess () ); const int * pStateList; @@ -304,7 +304,7 @@ static int epicsThreadGetOsdPriorityValue ( unsigned osiPriority ) /* * osiPriorityMagFromMagnitueOSD () */ -static unsigned osiPriorityMagFromMagnitueOSD ( unsigned magnitude, unsigned osdPriorityStateCount ) +static unsigned osiPriorityMagFromMagnitueOSD ( unsigned magnitude, unsigned osdPriorityStateCount ) { unsigned osiPriority; @@ -316,10 +316,10 @@ static unsigned osiPriorityMagFromMagnitueOSD ( unsigned magnitude, unsigned osd } -/* +/* * epicsThreadGetOsiPriorityValue () */ -static unsigned epicsThreadGetOsiPriorityValue ( int osdPriority ) +static unsigned epicsThreadGetOsiPriorityValue ( int osdPriority ) { const DWORD priorityClass = GetPriorityClass ( GetCurrentProcess () ); const int * pStateList; @@ -343,7 +343,7 @@ static unsigned epicsThreadGetOsiPriorityValue ( int osdPriority ) if ( magnitude >= stateCount ) { fprintf ( stderr, - "Unrecognized WIN32 thread priority level %d.\n", + "Unrecognized WIN32 thread priority level %d.\n", osdPriority ); fprintf ( stderr, "Mapping to EPICS thread priority level epicsThreadPriorityMin.\n" ); @@ -417,7 +417,7 @@ LIBCOM_API epicsThreadBooleanStatus epicsStdCall epicsThreadHighestPriorityLevel * epicsThreadGetStackSize () */ LIBCOM_API unsigned int epicsStdCall - epicsThreadGetStackSize ( epicsThreadStackSizeClass stackSizeClass ) + epicsThreadGetStackSize ( epicsThreadStackSizeClass stackSizeClass ) { #define STACK_SIZE(f) (f * 0x10000 * sizeof(void *)) static const unsigned stackSizeTable[epicsThreadStackBig+1] = { @@ -472,7 +472,7 @@ static unsigned WINAPI epicsWin32ThreadEntry ( LPVOID lpParameter ) /* * CAUTION: !!!! the thread id might continue to be used after this thread exits !!!! */ - + if ( pGbl ) { TlsSetValue ( pGbl->tlsIndexThreadLibraryEPICS, (void*)0xdeadbeef ); } @@ -583,10 +583,10 @@ epicsThreadId epicsThreadCreateOpt ( { unsigned threadId; - pParmWIN32->handle = (HANDLE) _beginthreadex ( + pParmWIN32->handle = (HANDLE) _beginthreadex ( 0, stackSize, epicsWin32ThreadEntry, - pParmWIN32, - CREATE_SUSPENDED | STACK_SIZE_PARAM_IS_A_RESERVATION, + pParmWIN32, + CREATE_SUSPENDED | STACK_SIZE_PARAM_IS_A_RESERVATION, & threadId ); if ( pParmWIN32->handle == 0 ) { free ( pParmWIN32 ); @@ -599,21 +599,21 @@ epicsThreadId epicsThreadCreateOpt ( osdPriority = epicsThreadGetOsdPriorityValue (opts->priority); bstat = SetThreadPriority ( pParmWIN32->handle, osdPriority ); if (!bstat) { - CloseHandle ( pParmWIN32->handle ); + CloseHandle ( pParmWIN32->handle ); free ( pParmWIN32 ); return NULL; } - + EnterCriticalSection ( & pGbl->mutex ); ellAdd ( & pGbl->threadList, & pParmWIN32->node ); LeaveCriticalSection ( & pGbl->mutex ); wstat = ResumeThread ( pParmWIN32->handle ); if (wstat==0xFFFFFFFF) { - EnterCriticalSection ( & pGbl->mutex ); - ellDelete ( & pGbl->threadList, & pParmWIN32->node ); - LeaveCriticalSection ( & pGbl->mutex ); - CloseHandle ( pParmWIN32->handle ); + EnterCriticalSection ( & pGbl->mutex ); + ellDelete ( & pGbl->threadList, & pParmWIN32->node ); + LeaveCriticalSection ( & pGbl->mutex ); + CloseHandle ( pParmWIN32->handle ); free ( pParmWIN32 ); return NULL; } @@ -663,7 +663,7 @@ LIBCOM_API void epicsStdCall epicsThreadSuspendSelf () assert ( pGbl ); - pParm = ( win32ThreadParam * ) + pParm = ( win32ThreadParam * ) TlsGetValue ( pGbl->tlsIndexThreadLibraryEPICS ); if ( ! pParm ) { pParm = epicsThreadImplicitCreate (); @@ -702,7 +702,7 @@ LIBCOM_API void epicsStdCall epicsThreadResume ( epicsThreadId id ) * epicsThreadGetPriority () */ LIBCOM_API unsigned epicsStdCall epicsThreadGetPriority (epicsThreadId id) -{ +{ win32ThreadParam * pParm = ( win32ThreadParam * ) id; return pParm->epicsPriority; } @@ -711,13 +711,13 @@ LIBCOM_API unsigned epicsStdCall epicsThreadGetPriority (epicsThreadId id) * epicsThreadGetPrioritySelf () */ LIBCOM_API unsigned epicsStdCall epicsThreadGetPrioritySelf () -{ +{ win32ThreadGlobal * pGbl = fetchWin32ThreadGlobal (); win32ThreadParam * pParm; assert ( pGbl ); - pParm = ( win32ThreadParam * ) + pParm = ( win32ThreadParam * ) TlsGetValue ( pGbl->tlsIndexThreadLibraryEPICS ); if ( ! pParm ) { pParm = epicsThreadImplicitCreate (); @@ -726,7 +726,7 @@ LIBCOM_API unsigned epicsStdCall epicsThreadGetPrioritySelf () return pParm->epicsPriority; } else { - int win32ThreadPriority = + int win32ThreadPriority = GetThreadPriority ( GetCurrentThread () ); assert ( win32ThreadPriority != THREAD_PRIORITY_ERROR_RETURN ); return epicsThreadGetOsiPriorityValue ( win32ThreadPriority ); @@ -754,14 +754,14 @@ LIBCOM_API int epicsStdCall epicsThreadIsEqual ( epicsThreadId id1, epicsThreadI } /* - * epicsThreadIsSuspended () + * epicsThreadIsSuspended () */ LIBCOM_API int epicsStdCall epicsThreadIsSuspended ( epicsThreadId id ) { win32ThreadParam *pParm = ( win32ThreadParam * ) id; DWORD exitCode; BOOL stat; - + stat = GetExitCodeThread ( pParm->handle, & exitCode ); if ( stat ) { if ( exitCode != STILL_ACTIVE ) { @@ -800,16 +800,16 @@ LIBCOM_API void epicsStdCall epicsThreadSleep ( double seconds ) * epicsThreadSleepQuantum () */ double epicsStdCall epicsThreadSleepQuantum () -{ +{ /* * Its worth noting here that the sleep quantum on windows can - * mysteriously get better. I eventually tracked this down to + * mysteriously get better. I eventually tracked this down to * codes that call timeBeginPeriod(1). Calling timeBeginPeriod() * specifying a better timer resolution also increases the interrupt * load. This appears to be related to java applet activity. * The function timeGetDevCaps can tell us the range of periods * that can be specified to timeBeginPeriod, but alas there - * appears to be no way to find out what the value of the global + * appears to be no way to find out what the value of the global * minimum of all timeBeginPeriod calls for all processes is. */ static const double secPerTick = 100e-9; @@ -838,7 +838,7 @@ LIBCOM_API epicsThreadId epicsStdCall epicsThreadGetIdSelf (void) assert ( pGbl ); - pParm = ( win32ThreadParam * ) TlsGetValue ( + pParm = ( win32ThreadParam * ) TlsGetValue ( pGbl->tlsIndexThreadLibraryEPICS ); if ( ! pParm ) { pParm = epicsThreadImplicitCreate (); @@ -858,7 +858,7 @@ LIBCOM_API epicsThreadId epicsStdCall epicsThreadGetId ( const char * pName ) EnterCriticalSection ( & pGbl->mutex ); - for ( pParm = ( win32ThreadParam * ) ellFirst ( & pGbl->threadList ); + for ( pParm = ( win32ThreadParam * ) ellFirst ( & pGbl->threadList ); pParm; pParm = ( win32ThreadParam * ) ellNext ( & pParm->node ) ) { if ( pParm->pName ) { if ( strcmp ( pParm->pName, pName ) == 0 ) { @@ -887,7 +887,7 @@ LIBCOM_API const char * epicsStdCall epicsThreadGetNameSelf (void) return "thread library not initialized"; } - pParm = ( win32ThreadParam * ) + pParm = ( win32ThreadParam * ) TlsGetValue ( pGbl->tlsIndexThreadLibraryEPICS ); if ( ! pParm ) { pParm = epicsThreadImplicitCreate (); @@ -957,7 +957,7 @@ static void epicsThreadShowInfo ( epicsThreadId id, unsigned level ) if ( pParm ) { unsigned long idForFormat = pParm->id; - fprintf ( epicsGetStdout(), "%-15s %-8p %-8lx %-9u %-9s %-7s", pParm->pName, + fprintf ( epicsGetStdout(), "%-15s %-8p %-8lx %-9u %-9s %-7s", pParm->pName, (void *) pParm, idForFormat, pParm->epicsPriority, epics_GetThreadPriorityAsString ( pParm->handle ), epicsThreadIsSuspended ( id ) ? "suspend" : "ok" ); @@ -967,7 +967,7 @@ static void epicsThreadShowInfo ( epicsThreadId id, unsigned level ) } } else { - fprintf (epicsGetStdout(), + fprintf (epicsGetStdout(), "NAME EPICS-ID WIN32-ID EPICS-PRI WIN32-PRI STATE " ); if ( level ) { fprintf (epicsGetStdout(), " HANDLE FUNCTION PARAMETER" ); @@ -1041,7 +1041,7 @@ LIBCOM_API void epicsStdCall epicsThreadOnce ( win32ThreadGlobal * pGbl = fetchWin32ThreadGlobal (); assert ( pGbl ); - + EnterCriticalSection ( & pGbl->mutex ); if ( *id != EPICS_THREAD_ONCE_DONE ) { diff --git a/modules/libcom/src/osi/os/WIN32/osdTime.cpp b/modules/libcom/src/osi/os/WIN32/osdTime.cpp index 518b90b82..ce3d9d8bf 100644 --- a/modules/libcom/src/osi/os/WIN32/osdTime.cpp +++ b/modules/libcom/src/osi/os/WIN32/osdTime.cpp @@ -85,7 +85,7 @@ private: bool threadHasExited; void updatePLL (); static const int pllDelay; /* integer seconds */ - // cant be static because of diff btw __stdcall and __cdecl + // cant be static because of diff btw __stdcall and __cdecl friend unsigned __stdcall _pllThreadEntry ( void * pCurrentTimeIn ); }; @@ -96,7 +96,7 @@ static const LONGLONG FILE_TIME_TICKS_PER_SEC = 10000000; static const LONGLONG EPICS_TIME_TICKS_PER_SEC = 1000000000; static const LONGLONG ET_TICKS_PER_FT_TICK = EPICS_TIME_TICKS_PER_SEC / FILE_TIME_TICKS_PER_SEC; - + // // Start and register time provider // @@ -209,13 +209,13 @@ void currentTime :: startPLL () { // create frequency estimation thread when needed if ( this->perfCtrPresent && ! this->threadHandle ) { - this->threadHandle = (HANDLE) + this->threadHandle = (HANDLE) _beginthreadex ( 0, 4096, _pllThreadEntry, this, - CREATE_SUSPENDED | STACK_SIZE_PARAM_IS_A_RESERVATION, + CREATE_SUSPENDED | STACK_SIZE_PARAM_IS_A_RESERVATION, & this->threadId ); assert ( this->threadHandle ); - BOOL bstat = SetThreadPriority ( - this->threadHandle, THREAD_PRIORITY_HIGHEST ); + BOOL bstat = SetThreadPriority ( + this->threadHandle, THREAD_PRIORITY_HIGHEST ); assert ( bstat ); DWORD wstat = ResumeThread ( this->threadHandle ); assert ( wstat != 0xFFFFFFFF ); @@ -387,15 +387,15 @@ void currentTime :: updatePLL () ( MAXLONGLONG - this->lastPerfCounter ) + ( curPerfCounter.QuadPart - MINLONGLONG ) + 1; } - + // discard performance counter delay measurement glitches { const LONGLONG expectedDly = this->perfCounterFreq * pllDelay; const LONGLONG bnd = expectedDly / 4; - if ( perfCounterDiffSinceLastFetch <= 0 || + if ( perfCounterDiffSinceLastFetch <= 0 || perfCounterDiffSinceLastFetch >= expectedDly + bnd ) { LeaveCriticalSection( & this->mutex ); - debugPrintf ( ( "perf ctr measured delay out of bounds m=%d max=%d\n", + debugPrintf ( ( "perf ctr measured delay out of bounds m=%d max=%d\n", static_cast < int > ( perfCounterDiffSinceLastFetch ), static_cast < int > ( expectedDly + bnd ) ) ); return; @@ -409,7 +409,7 @@ void currentTime :: updatePLL () this->lastPerfCounter = curPerfCounter.QuadPart; LONGLONG epicsTimeFromCurrentFileTime; - + { static bool firstMessageWasSent = false; if ( curFileTime.QuadPart >= epicsEpochInFileTime ) { @@ -437,9 +437,9 @@ void currentTime :: updatePLL () delta = epicsTimeFromCurrentFileTime - this->epicsTimeLast; if ( delta > EPICS_TIME_TICKS_PER_SEC || delta < -EPICS_TIME_TICKS_PER_SEC ) { - // When there is an abrupt shift in the current computed time vs - // the time derived from the current file time then someone has - // probably adjusted the real time clock and the best reaction + // When there is an abrupt shift in the current computed time vs + // the time derived from the current file time then someone has + // probably adjusted the real time clock and the best reaction // is to just assume the new time base this->epicsTimeLast = epicsTimeFromCurrentFileTime; this->perfCounterFreq = this->perfCounterFreqPLL; @@ -480,10 +480,10 @@ void currentTime :: updatePLL () freqEstDiff /= sysFreq.QuadPart; freqEstDiff *= 100.0; debugPrintf ( ( "currentTime: freq delta %f %% freq est " - "delta %f %% time delta %f sec\n", - freqDiff, - freqEstDiff, - static_cast < double > ( delta ) / + "delta %f %% time delta %f sec\n", + freqDiff, + freqEstDiff, + static_cast < double > ( delta ) / EPICS_TIME_TICKS_PER_SEC ) ); # endif } @@ -493,7 +493,7 @@ void currentTime :: updatePLL () static unsigned __stdcall _pllThreadEntry ( void * pCurrentTimeIn ) { - currentTime * pCT = + currentTime * pCT = reinterpret_cast < currentTime * > ( pCurrentTimeIn ); setThreadName ( pCT->threadId, "EPICS Time PLL" ); while ( ! pCT->threadShutdownCmd ) { diff --git a/modules/libcom/src/osi/os/WIN32/osiFileName.h b/modules/libcom/src/osi/os/WIN32/osiFileName.h index 02e99cc9f..4f47638e2 100644 --- a/modules/libcom/src/osi/os/WIN32/osiFileName.h +++ b/modules/libcom/src/osi/os/WIN32/osiFileName.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * osiFileName.h diff --git a/modules/libcom/src/osi/os/WIN32/osiUnistd.h b/modules/libcom/src/osi/os/WIN32/osiUnistd.h index 3f34e74cc..a83c49be4 100644 --- a/modules/libcom/src/osi/os/WIN32/osiUnistd.h +++ b/modules/libcom/src/osi/os/WIN32/osiUnistd.h @@ -5,12 +5,12 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 +/* + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #include diff --git a/modules/libcom/src/osi/os/WIN32/setThreadName.cpp b/modules/libcom/src/osi/os/WIN32/setThreadName.cpp index 49663c8af..6f1abdeab 100644 --- a/modules/libcom/src/osi/os/WIN32/setThreadName.cpp +++ b/modules/libcom/src/osi/os/WIN32/setThreadName.cpp @@ -6,7 +6,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #define VC_EXTRALEAN @@ -41,7 +41,7 @@ extern "C" void setThreadName ( DWORD dwThreadID, LPCSTR szThreadName ) __try { - RaiseException( 0x406D1388, 0, + RaiseException( 0x406D1388, 0, sizeof(info)/sizeof(DWORD), (const ULONG_PTR*)&info ); } __except(EXCEPTION_CONTINUE_EXECUTION) diff --git a/modules/libcom/src/osi/os/WIN32/systemCallIntMech.cpp b/modules/libcom/src/osi/os/WIN32/systemCallIntMech.cpp index 7da39164b..06eb26172 100644 --- a/modules/libcom/src/osi/os/WIN32/systemCallIntMech.cpp +++ b/modules/libcom/src/osi/os/WIN32/systemCallIntMech.cpp @@ -6,15 +6,15 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* - * Author: Jeff Hill + * Author: Jeff Hill */ #include "osiSock.h" -enum epicsSocketSystemCallInterruptMechanismQueryInfo +enum epicsSocketSystemCallInterruptMechanismQueryInfo epicsSocketSystemCallInterruptMechanismQuery () { return esscimqi_socketCloseRequired; diff --git a/modules/libcom/src/osi/os/cygwin32/osdStrtod.h b/modules/libcom/src/osi/os/cygwin32/osdStrtod.h index 395cacdc2..055a885df 100644 --- a/modules/libcom/src/osi/os/cygwin32/osdStrtod.h +++ b/modules/libcom/src/osi/os/cygwin32/osdStrtod.h @@ -2,7 +2,7 @@ * Copyright (c) 2002 The University of Saskatchewan * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/libcom/src/osi/os/cygwin32/osiFileName.h b/modules/libcom/src/osi/os/cygwin32/osiFileName.h index 88b3cddbd..3a7580136 100644 --- a/modules/libcom/src/osi/os/cygwin32/osiFileName.h +++ b/modules/libcom/src/osi/os/cygwin32/osiFileName.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * osiFileName.h diff --git a/modules/libcom/src/osi/os/cygwin32/systemCallIntMech.cpp b/modules/libcom/src/osi/os/cygwin32/systemCallIntMech.cpp index dbcb14dbb..e6e1f9069 100644 --- a/modules/libcom/src/osi/os/cygwin32/systemCallIntMech.cpp +++ b/modules/libcom/src/osi/os/cygwin32/systemCallIntMech.cpp @@ -7,14 +7,14 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ /* - * Author: Jeff Hill + * Author: Jeff Hill */ #include #include "osiSock.h" -enum epicsSocketSystemCallInterruptMechanismQueryInfo +enum epicsSocketSystemCallInterruptMechanismQueryInfo epicsSocketSystemCallInterruptMechanismQuery () { #if (CYGWIN_VERSION_DLL_MAJOR == 1007) && (CYGWIN_VERSION_DLL_MINOR < 15) diff --git a/modules/libcom/src/osi/os/default/epicsGetopt.h b/modules/libcom/src/osi/os/default/epicsGetopt.h index 4bcc962cb..fa36ea5df 100644 --- a/modules/libcom/src/osi/os/default/epicsGetopt.h +++ b/modules/libcom/src/osi/os/default/epicsGetopt.h @@ -7,7 +7,7 @@ * Synchrotronstrahlung. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef _EPICS_GETOPT_H #define _EPICS_GETOPT_H diff --git a/modules/libcom/src/osi/os/default/epicsSocketConvertErrnoToString.cpp b/modules/libcom/src/osi/os/default/epicsSocketConvertErrnoToString.cpp index 062560f59..2fa6c7c7b 100644 --- a/modules/libcom/src/osi/os/default/epicsSocketConvertErrnoToString.cpp +++ b/modules/libcom/src/osi/os/default/epicsSocketConvertErrnoToString.cpp @@ -4,12 +4,12 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* osdSock.c */ /* - * Author: Jeff Hill - * Date: 04-05-94 + * Author: Jeff Hill + * Date: 04-05-94 * */ diff --git a/modules/libcom/src/osi/os/default/gnuReadline.c b/modules/libcom/src/osi/os/default/gnuReadline.c index ae646a53e..d8588c82d 100644 --- a/modules/libcom/src/osi/os/default/gnuReadline.c +++ b/modules/libcom/src/osi/os/default/gnuReadline.c @@ -89,7 +89,7 @@ osdReadline (const char *prompt, struct readlineContext *context) } if ((linelen + 1) >= linesize) { char *cp; - + linesize += 50; cp = (char *)realloc(line, linesize); if (cp == NULL) { diff --git a/modules/libcom/src/osi/os/default/osdAssert.c b/modules/libcom/src/osi/os/default/osdAssert.c index 109ec983d..58ce460af 100644 --- a/modules/libcom/src/osi/os/default/osdAssert.c +++ b/modules/libcom/src/osi/os/default/osdAssert.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Author: Jeffrey Hill diff --git a/modules/libcom/src/osi/os/default/osdBackTrace.cpp b/modules/libcom/src/osi/os/default/osdBackTrace.cpp index 0a2fdfcfe..ee2276526 100644 --- a/modules/libcom/src/osi/os/default/osdBackTrace.cpp +++ b/modules/libcom/src/osi/os/default/osdBackTrace.cpp @@ -1,15 +1,15 @@ -/* +/* * Copyright: Stanford University / SLAC National Laboratory. * * EPICS BASE is distributed subject to a Software License Agreement found - * in file LICENSE that is included with this distribution. + * in file LICENSE that is included with this distribution. * * Author: Till Straumann , 2011, 2014 - */ + */ #include "epicsStackTracePvt.h" int epicsBackTrace(void **buf, int buf_sz) { - return -1; + return -1; } diff --git a/modules/libcom/src/osi/os/default/osdEnv.c b/modules/libcom/src/osi/os/default/osdEnv.c index e4495dbd1..ddc96c423 100644 --- a/modules/libcom/src/osi/os/default/osdEnv.c +++ b/modules/libcom/src/osi/os/default/osdEnv.c @@ -1,7 +1,7 @@ /*************************************************************************\ * Copyright (c) 2002 The University of Saskatchewan * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* osdEnv.c */ /* @@ -37,13 +37,13 @@ LIBCOM_API void epicsStdCall epicsEnvSet (const char *name, const char *value) if (!name) return; iocshEnvClear(name); - - cp = mallocMustSucceed (strlen (name) + strlen (value) + 2, "epicsEnvSet"); - strcpy (cp, name); - strcat (cp, "="); - strcat (cp, value); - if (putenv (cp) < 0) { - errPrintf( + + cp = mallocMustSucceed (strlen (name) + strlen (value) + 2, "epicsEnvSet"); + strcpy (cp, name); + strcat (cp, "="); + strcat (cp, value); + if (putenv (cp) < 0) { + errPrintf( -1L, __FILE__, __LINE__, @@ -52,7 +52,7 @@ LIBCOM_API void epicsStdCall epicsEnvSet (const char *name, const char *value) value, strerror (errno)); free (cp); - } + } } /* diff --git a/modules/libcom/src/osi/os/default/osdFindAddr.c b/modules/libcom/src/osi/os/default/osdFindAddr.c index 9f3089ee3..49fc23996 100644 --- a/modules/libcom/src/osi/os/default/osdFindAddr.c +++ b/modules/libcom/src/osi/os/default/osdFindAddr.c @@ -1,11 +1,11 @@ -/* +/* * Copyright: Stanford University / SLAC National Laboratory. * * EPICS BASE is distributed subject to a Software License Agreement found - * in file LICENSE that is included with this distribution. + * in file LICENSE that is included with this distribution. * * Author: Till Straumann , 2011, 2014 - */ + */ #include "epicsStackTracePvt.h" #include "epicsStackTrace.h" diff --git a/modules/libcom/src/osi/os/default/osdFindSymbol.c b/modules/libcom/src/osi/os/default/osdFindSymbol.c index 81dcacb52..5016c66d5 100644 --- a/modules/libcom/src/osi/os/default/osdFindSymbol.c +++ b/modules/libcom/src/osi/os/default/osdFindSymbol.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* osi/os/default/osdFindSymbol.c */ diff --git a/modules/libcom/src/osi/os/default/osdInterrupt.c b/modules/libcom/src/osi/os/default/osdInterrupt.c index 2aec723dd..6d0637ce5 100644 --- a/modules/libcom/src/osi/os/default/osdInterrupt.c +++ b/modules/libcom/src/osi/os/default/osdInterrupt.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* osi/default/osdInterrupt.c */ diff --git a/modules/libcom/src/osi/os/default/osdInterrupt.h b/modules/libcom/src/osi/os/default/osdInterrupt.h index 5559d6280..6a7255513 100644 --- a/modules/libcom/src/osi/os/default/osdInterrupt.h +++ b/modules/libcom/src/osi/os/default/osdInterrupt.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef osdInterrupth diff --git a/modules/libcom/src/osi/os/default/osdNetIntf.c b/modules/libcom/src/osi/os/default/osdNetIntf.c index 3ba3c0b47..25bc64db7 100644 --- a/modules/libcom/src/osi/os/default/osdNetIntf.c +++ b/modules/libcom/src/osi/os/default/osdNetIntf.c @@ -5,12 +5,12 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* - * Author: Jeff Hill - * Date: 04-05-94 + * Author: Jeff Hill + * Date: 04-05-94 */ #include @@ -43,7 +43,7 @@ static size_t ifreqSize ( struct ifreq *pifreq ) size = ifreq_size ( pifreq ); if ( size < sizeof ( *pifreq ) ) { - size = sizeof ( *pifreq ); + size = sizeof ( *pifreq ); } return size; } @@ -90,11 +90,11 @@ LIBCOM_API void epicsStdCall osiSockDiscoverBroadcastAddresses return; } } - + /* * use pool so that we avoid using too much stack space * - * nelem is set to the maximum interfaces + * nelem is set to the maximum interfaces * on one machine here */ pIfreqList = (struct ifreq *) calloc ( nelem, sizeof(*pifreq) ); @@ -102,7 +102,7 @@ LIBCOM_API void epicsStdCall osiSockDiscoverBroadcastAddresses errlogPrintf ("osiSockDiscoverBroadcastAddresses(): no memory to complete request\n"); return; } - + ifconf.ifc_len = nelem * sizeof(*pifreq); ifconf.ifc_req = pIfreqList; status = socket_ioctl (socket, SIOCGIFCONF, &ifconf); @@ -111,7 +111,7 @@ LIBCOM_API void epicsStdCall osiSockDiscoverBroadcastAddresses free (pIfreqList); return; } - + pIfreqListEnd = (struct ifreq *) (ifconf.ifc_len + (char *) pIfreqList); pIfreqListEnd--; @@ -122,7 +122,7 @@ LIBCOM_API void epicsStdCall osiSockDiscoverBroadcastAddresses * find the next ifreq */ pnextifreq = ifreqNext (pifreq); - + /* determine ifreq size */ current_ifreqsize = ifreqSize ( pifreq ); /* copy current ifreq to aligned bufferspace (to start of pIfreqList buffer) */ @@ -134,7 +134,7 @@ LIBCOM_API void epicsStdCall osiSockDiscoverBroadcastAddresses (unsigned)current_ifreqsize)); /* - * If its not an internet interface then dont use it + * If its not an internet interface then dont use it */ if ( pIfreqList->ifr_addr.sa_family != AF_INET ) { ifDepenDebugPrintf ( ("osiSockDiscoverBroadcastAddresses(): interface \"%s\" was not AF_INET\n", pIfreqList->ifr_name) ); @@ -174,7 +174,7 @@ LIBCOM_API void epicsStdCall osiSockDiscoverBroadcastAddresses } /* - * dont use the loop back interface + * dont use the loop back interface */ if ( pIfreqList->ifr_flags & IFF_LOOPBACK ) { ifDepenDebugPrintf ( ("osiSockDiscoverBroadcastAddresses(): ignoring loopback interface: \"%s\"\n", pIfreqList->ifr_name) ); @@ -192,10 +192,10 @@ LIBCOM_API void epicsStdCall osiSockDiscoverBroadcastAddresses * If this is an interface that supports * broadcast fetch the broadcast address. * - * Otherwise if this is a point to point + * Otherwise if this is a point to point * interface then use the destination address. * - * Otherwise CA will not query through the + * Otherwise CA will not query through the * interface. */ if ( pIfreqList->ifr_flags & IFF_BROADCAST ) { @@ -243,7 +243,7 @@ LIBCOM_API void epicsStdCall osiSockDiscoverBroadcastAddresses free ( pIfreqList ); } - + /* * osiLocalAddr () */ @@ -261,26 +261,26 @@ static void osiLocalAddrOnce (void *raw) memset ( (void *) &addr, '\0', sizeof ( addr ) ); addr.sa.sa_family = AF_UNSPEC; - + pIfreqList = (struct ifreq *) calloc ( nelem, sizeof(*pIfreqList) ); if ( ! pIfreqList ) { errlogPrintf ( "osiLocalAddr(): no memory to complete request\n" ); goto fail; } - + ifconf.ifc_len = nelem * sizeof ( *pIfreqList ); ifconf.ifc_req = pIfreqList; status = socket_ioctl ( *psocket, SIOCGIFCONF, &ifconf ); if ( status < 0 || ifconf.ifc_len == 0 ) { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); errlogPrintf ( "osiLocalAddr(): SIOCGIFCONF ioctl failed because \"%s\"\n", sockErrBuf ); goto fail; } - + pIfreqListEnd = (struct ifreq *) ( ifconf.ifc_len + (char *) ifconf.ifc_req ); pIfreqListEnd--; diff --git a/modules/libcom/src/osi/os/default/osdPoolStatus.c b/modules/libcom/src/osi/os/default/osdPoolStatus.c index d4e756486..811a6ef5f 100644 --- a/modules/libcom/src/osi/os/default/osdPoolStatus.c +++ b/modules/libcom/src/osi/os/default/osdPoolStatus.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include "osiPoolStatus.h" diff --git a/modules/libcom/src/osi/os/default/osdPoolStatus.h b/modules/libcom/src/osi/os/default/osdPoolStatus.h index efb2cfab8..ce3f928a7 100644 --- a/modules/libcom/src/osi/os/default/osdPoolStatus.h +++ b/modules/libcom/src/osi/os/default/osdPoolStatus.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef osdPoolStatush diff --git a/modules/libcom/src/osi/os/default/osdSignal.cpp b/modules/libcom/src/osi/os/default/osdSignal.cpp index cf234da0e..82cbc1668 100644 --- a/modules/libcom/src/osi/os/default/osdSignal.cpp +++ b/modules/libcom/src/osi/os/default/osdSignal.cpp @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found - * in file LICENSE that is included with this distribution. + * in file LICENSE that is included with this distribution. \*************************************************************************/ #include "epicsSignal.h" diff --git a/modules/libcom/src/osi/os/default/osdSockAddrReuse.cpp b/modules/libcom/src/osi/os/default/osdSockAddrReuse.cpp index 8a39a5a3c..5b04a06ce 100644 --- a/modules/libcom/src/osi/os/default/osdSockAddrReuse.cpp +++ b/modules/libcom/src/osi/os/default/osdSockAddrReuse.cpp @@ -6,7 +6,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/libcom/src/osi/os/default/osdSpin.c b/modules/libcom/src/osi/os/default/osdSpin.c index eb9cc1f91..9e5089c96 100644 --- a/modules/libcom/src/osi/os/default/osdSpin.c +++ b/modules/libcom/src/osi/os/default/osdSpin.c @@ -61,7 +61,7 @@ void epicsSpinLock(epicsSpinId spin) { status = epicsMutexLock(spin->lock); if (status != epicsMutexLockOK) { - errlogPrintf("epicsSpinLock(%p): epicsMutexLock returned %s\n", spin, + errlogPrintf("epicsSpinLock(%p): epicsMutexLock returned %s\n", spin, status == epicsMutexLockTimeout ? "epicsMutexLockTimeout" : "epicsMutexLockError"); } diff --git a/modules/libcom/src/osi/os/default/osdVME.h b/modules/libcom/src/osi/os/default/osdVME.h index 1b65b3184..c08baee30 100644 --- a/modules/libcom/src/osi/os/default/osdVME.h +++ b/modules/libcom/src/osi/os/default/osdVME.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/libcom/src/osi/os/default/osdWireConfig.h b/modules/libcom/src/osi/os/default/osdWireConfig.h index e8def865e..1284ce9c0 100644 --- a/modules/libcom/src/osi/os/default/osdWireConfig.h +++ b/modules/libcom/src/osi/os/default/osdWireConfig.h @@ -11,7 +11,7 @@ /* This file must be usable from both C and C++ */ -/* if compilation fails because this wasnt found then you may need to define an OS +/* if compilation fails because this wasnt found then you may need to define an OS specific osdWireConfig.h */ #include @@ -21,7 +21,7 @@ # elif __BYTE_ORDER == __BIG_ENDIAN # define EPICS_BYTE_ORDER EPICS_ENDIAN_BIG # else -# error EPICS hasnt been ported to run on the specified __BYTE_ORDER +# error EPICS hasnt been ported to run on the specified __BYTE_ORDER # endif #else # ifdef BYTE_ORDER @@ -30,7 +30,7 @@ # elif BYTE_ORDER == BIG_ENDIAN # define EPICS_BYTE_ORDER EPICS_ENDIAN_BIG # else -# error EPICS hasnt been ported to run on the specified BYTE_ORDER +# error EPICS hasnt been ported to run on the specified BYTE_ORDER # endif # else # error doesnt specify __BYTE_ORDER or BYTE_ORDER - is an OS specific osdWireConfig.h needed? diff --git a/modules/libcom/src/osi/os/default/osdWireFormat.h b/modules/libcom/src/osi/os/default/osdWireFormat.h index 385c9bd69..42a9698d6 100644 --- a/modules/libcom/src/osi/os/default/osdWireFormat.h +++ b/modules/libcom/src/osi/os/default/osdWireFormat.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -26,7 +26,7 @@ // // The default assumption is that the local floating point format is // IEEE and that these routines only need to perform byte swapping -// as a side effect of copying an aligned operand into an unaligned +// as a side effect of copying an aligned operand into an unaligned // network byte stream. OS specific code can provide a alternative // for this file if that assumption is wrong. // @@ -34,8 +34,8 @@ // // EPICS_CONVERSION_REQUIRED is set if either the byte order // or the floating point word order are not exactly big endian. -// This can be set by hand above for a specific architecture -// should there be an architecture that is a weird middle endian +// This can be set by hand above for a specific architecture +// should there be an architecture that is a weird middle endian // ieee floating point format that is also big endian integer. // #if EPICS_BYTE_ORDER != EPICS_ENDIAN_BIG || EPICS_FLOAT_WORD_ORDER != EPICS_BYTE_ORDER @@ -45,15 +45,15 @@ #endif // -// We still use a big endian wire format for CA consistent with the internet, +// We still use a big endian wire format for CA consistent with the internet, // but inconsistent with the vast majority of CPUs // template <> -inline void WireGet < epicsFloat64 > ( +inline void WireGet < epicsFloat64 > ( const epicsUInt8 * pWireSrc, epicsFloat64 & dst ) { - // copy through union here + // copy through union here // a) prevents over-aggressive optimization under strict aliasing rules // b) doesnt preclude extra copy operation being optimized away union { @@ -74,13 +74,13 @@ inline void WireGet < epicsFloat64 > ( #if defined ( __GNUC__ ) && ( __GNUC__ == 4 && __GNUC_MINOR__ <= 0 ) template <> -inline void WireGet < epicsOldString > ( +inline void WireGet < epicsOldString > ( const epicsUInt8 * pWireSrc, epicsOldString & dst ) { memcpy ( dst, pWireSrc, sizeof ( dst ) ); } #else -inline void WireGet ( +inline void WireGet ( const epicsUInt8 * pWireSrc, epicsOldString & dst ) { memcpy ( dst, pWireSrc, sizeof ( dst ) ); @@ -88,10 +88,10 @@ inline void WireGet ( #endif template <> -inline void WireSet < epicsFloat64 > ( +inline void WireSet < epicsFloat64 > ( const epicsFloat64 & src, epicsUInt8 * pWireDst ) { - // copy through union here + // copy through union here // a) prevents over-aggressive optimization under strict aliasing rules // b) doesnt preclude extra copy operation being optimized away union { @@ -112,13 +112,13 @@ inline void WireSet < epicsFloat64 > ( #if defined ( __GNUC__ ) && ( __GNUC__ == 4 && __GNUC_MINOR__ <= 0 ) template <> -inline void WireSet < epicsOldString > ( +inline void WireSet < epicsOldString > ( const epicsOldString & src, epicsUInt8 * pWireDst ) { memcpy ( pWireDst, src, sizeof ( src ) ); } #else -inline void WireSet ( +inline void WireSet ( const epicsOldString & src, epicsUInt8 * pWireDst ) { memcpy ( pWireDst, src, sizeof ( src ) ); @@ -126,7 +126,7 @@ inline void WireSet ( #endif template <> -inline void AlignedWireGet < epicsUInt16 > ( +inline void AlignedWireGet < epicsUInt16 > ( const epicsUInt16 & src, epicsUInt16 & dst ) { # if EPICS_BYTE_ORDER == EPICS_ENDIAN_LITTLE @@ -139,12 +139,12 @@ inline void AlignedWireGet < epicsUInt16 > ( } template <> -inline void AlignedWireGet < epicsUInt32 > ( +inline void AlignedWireGet < epicsUInt32 > ( const epicsUInt32 & src, epicsUInt32 & dst ) { # if EPICS_BYTE_ORDER == EPICS_ENDIAN_LITTLE dst = byteSwap ( src ); -# elif EPICS_BYTE_ORDER == EPICS_ENDIAN_BIG +# elif EPICS_BYTE_ORDER == EPICS_ENDIAN_BIG dst = src; # else # error unsupported endian type @@ -152,10 +152,10 @@ inline void AlignedWireGet < epicsUInt32 > ( } template <> -inline void AlignedWireGet < epicsFloat64 > ( +inline void AlignedWireGet < epicsFloat64 > ( const epicsFloat64 & src, epicsFloat64 & dst ) { - // copy through union here + // copy through union here // a) prevents over-aggressive optimization under strict aliasing rules // b) doesnt preclude extra copy operation being optimized away union Swapper { @@ -187,7 +187,7 @@ inline void AlignedWireSet < epicsUInt16 > { # if EPICS_BYTE_ORDER == EPICS_ENDIAN_LITTLE dst = byteSwap ( src ); -# elif EPICS_BYTE_ORDER == EPICS_ENDIAN_BIG +# elif EPICS_BYTE_ORDER == EPICS_ENDIAN_BIG dst = src; # else # error undefined endian type @@ -195,12 +195,12 @@ inline void AlignedWireSet < epicsUInt16 > } template <> -inline void AlignedWireSet < epicsUInt32 > ( +inline void AlignedWireSet < epicsUInt32 > ( const epicsUInt32 & src, epicsUInt32 & dst ) { # if EPICS_BYTE_ORDER == EPICS_ENDIAN_LITTLE dst = byteSwap ( src ); -# elif EPICS_BYTE_ORDER == EPICS_ENDIAN_BIG +# elif EPICS_BYTE_ORDER == EPICS_ENDIAN_BIG dst = src; # else # error undefined endian type @@ -208,10 +208,10 @@ inline void AlignedWireSet < epicsUInt32 > ( } template <> -inline void AlignedWireSet < epicsFloat64 > ( +inline void AlignedWireSet < epicsFloat64 > ( const epicsFloat64 & src, epicsFloat64 & dst ) { - // copy through union here + // copy through union here // a) prevents over-aggressive optimization under strict aliasing rules // b) doesnt preclude extra copy operation being optimized away union Swapper { diff --git a/modules/libcom/src/osi/os/freebsd/osdTime.h b/modules/libcom/src/osi/os/freebsd/osdTime.h index c05ffa3af..9b2eb59bf 100644 --- a/modules/libcom/src/osi/os/freebsd/osdTime.h +++ b/modules/libcom/src/osi/os/freebsd/osdTime.h @@ -1,7 +1,7 @@ /*************************************************************************\ * Copyright (c) 2002 The University of Saskatchewan * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/libcom/src/osi/os/freebsd/osiFileName.h b/modules/libcom/src/osi/os/freebsd/osiFileName.h index 83204c70f..a0611fdb9 100644 --- a/modules/libcom/src/osi/os/freebsd/osiFileName.h +++ b/modules/libcom/src/osi/os/freebsd/osiFileName.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * osiFileName.h diff --git a/modules/libcom/src/osi/os/freebsd/osiUnistd.h b/modules/libcom/src/osi/os/freebsd/osiUnistd.h index c64e57a6c..40b017a57 100644 --- a/modules/libcom/src/osi/os/freebsd/osiUnistd.h +++ b/modules/libcom/src/osi/os/freebsd/osiUnistd.h @@ -4,12 +4,12 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 +/* + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #include diff --git a/modules/libcom/src/osi/os/iOS/epicsMath.h b/modules/libcom/src/osi/os/iOS/epicsMath.h index 07360588d..f24f2dca2 100644 --- a/modules/libcom/src/osi/os/iOS/epicsMath.h +++ b/modules/libcom/src/osi/os/iOS/epicsMath.h @@ -2,7 +2,7 @@ * Copyright (c) 2010 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef epicsMathh diff --git a/modules/libcom/src/osi/os/iOS/osdEnv.c b/modules/libcom/src/osi/os/iOS/osdEnv.c index 65ce0de3a..420f4d36f 100644 --- a/modules/libcom/src/osi/os/iOS/osdEnv.c +++ b/modules/libcom/src/osi/os/iOS/osdEnv.c @@ -1,7 +1,7 @@ /*************************************************************************\ * Copyright (c) 2002 The University of Saskatchewan * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* osdEnv.c */ diff --git a/modules/libcom/src/osi/os/posix/epicsAtomicOSD.cpp b/modules/libcom/src/osi/os/posix/epicsAtomicOSD.cpp index 55578b90e..e80a6f85f 100644 --- a/modules/libcom/src/osi/os/posix/epicsAtomicOSD.cpp +++ b/modules/libcom/src/osi/os/posix/epicsAtomicOSD.cpp @@ -1,9 +1,9 @@ /*************************************************************************\ -* Copyright (c) 2011 LANS LLC, as Operator of +* Copyright (c) 2011 LANS LLC, as Operator of * Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -20,18 +20,18 @@ /* * Slow, but probably correct on all systems. - * Useful only if something more efficient isn`t - * provided based on knowledge of the compiler - * or OS + * Useful only if something more efficient isn`t + * provided based on knowledge of the compiler + * or OS + * + * A statically initialized pthread mutex doesn`t + * need to be destroyed * - * A statically initialized pthread mutex doesn`t - * need to be destroyed - * * !!!!! - * !!!!! WARNING + * !!!!! WARNING * !!!!! * !!!!! Do not use this implementation on systems where - * !!!!! code runs at interrupt context. If so, then + * !!!!! code runs at interrupt context. If so, then * !!!!! an implementation must be provided that is based * !!!!! on a compiler intrinsic or an interrupt lock and or * !!!!! a spin lock primitive @@ -64,9 +64,9 @@ void epicsAtomicUnlock ( EpicsAtomicLockKey * ) // Slow, but probably correct on all systems. -// Useful only if something more efficient isn`t -// provided based on knowledge of the compiler -// or OS +// Useful only if something more efficient isn`t +// provided based on knowledge of the compiler +// or OS void epicsAtomicMemoryBarrierFallback (void) { EpicsAtomicLockKey key; diff --git a/modules/libcom/src/osi/os/posix/epicsAtomicOSD.h b/modules/libcom/src/osi/os/posix/epicsAtomicOSD.h index 06e8c42ea..d0af86e08 100644 --- a/modules/libcom/src/osi/os/posix/epicsAtomicOSD.h +++ b/modules/libcom/src/osi/os/posix/epicsAtomicOSD.h @@ -5,7 +5,7 @@ * Copyright (c) 2011 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/libcom/src/osi/os/posix/epicsMath.h b/modules/libcom/src/osi/os/posix/epicsMath.h index 517a795f0..7b79c2e11 100644 --- a/modules/libcom/src/osi/os/posix/epicsMath.h +++ b/modules/libcom/src/osi/os/posix/epicsMath.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef epicsMathh diff --git a/modules/libcom/src/osi/os/posix/epicsTempFile.c b/modules/libcom/src/osi/os/posix/epicsTempFile.c index f5057a2b6..75189489c 100644 --- a/modules/libcom/src/osi/os/posix/epicsTempFile.c +++ b/modules/libcom/src/osi/os/posix/epicsTempFile.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include diff --git a/modules/libcom/src/osi/os/posix/osdElfFindAddr.c b/modules/libcom/src/osi/os/posix/osdElfFindAddr.c index 964f1d89a..7243cab86 100644 --- a/modules/libcom/src/osi/os/posix/osdElfFindAddr.c +++ b/modules/libcom/src/osi/os/posix/osdElfFindAddr.c @@ -1,11 +1,11 @@ -/* +/* * Copyright: Stanford University / SLAC National Laboratory. * * EPICS BASE is distributed subject to a Software License Agreement found - * in file LICENSE that is included with this distribution. + * in file LICENSE that is included with this distribution. * * Author: Till Straumann , 2011, 2014 - */ + */ #include #include @@ -35,7 +35,7 @@ LIBCOM_API extern void ClockTime_GetProgramStart(epicsTimeStamp *pDest); #define FIND_ADDR_DEBUG 0 -/* +/* * On some systems (linux, solaris) dladdr doesn't find local symbols * or symbols in the main executable. * Hence, we want to use dladdr() to find the file name @@ -82,7 +82,7 @@ typedef struct MMap_ { /* Structure describing symbol information * contained in a file. - * We keep these around (so that the file + * We keep these around (so that the file * doesn't have to be opened + parsed every * time we do a lookup). */ @@ -203,7 +203,7 @@ bail: #else static MMap getscn_mmap(int fd, uint8_t c, Shrd *shdr_p) { - return 0; + return 0; } #endif @@ -417,7 +417,7 @@ elfRead(const char *fname, uintptr_t fbase) es->nsyms = n / (ELFCLASS32==c ? sizeof(Elf32_Sym) : sizeof(Elf64_Sym)); /* find and read string table */ - + n = ELFCLASS32 == c ? sizeof(shdr.e32) : sizeof(shdr.e64); /* seek to section header table */ @@ -457,7 +457,7 @@ elfRead(const char *fname, uintptr_t fbase) errlogPrintf("dlLookupAddr(): Unexpected ELF object file type %u\n", FLD(c,ehdr,e_type)); goto bail; } - + return es; bail: @@ -491,13 +491,13 @@ ESyms es; elfsLockWrite(); while ( (es = elfs) ) { - elfs = es->next; + elfs = es->next; es->next = 0; - elfsUnlockWrite(); + elfsUnlockWrite(); elfSymsDestroy(es); - elfsLockWrite(); + elfsLockWrite(); } - elfsUnlockWrite(); + elfsUnlockWrite(); } */ @@ -510,7 +510,7 @@ elfSymsFind(const char *fname) ESyms es; for ( es=elfs; es && strcmp(fname, es->fname); es = es->next ) - /* nothing else to do */; + /* nothing else to do */; return es; } @@ -589,7 +589,7 @@ epicsFindAddr(void *addr, epicsSymbol *sym_p) sym.raw = (char*)es->symMap->addr + es->symMap->off; strtab = (char*)es->strMap->addr + es->strMap->off; - /* Do a brute-force search through the symbol table; if this is executed + /* Do a brute-force search through the symbol table; if this is executed * very often then it would be worthwhile constructing a sorted list of * symbol addresses but for the stack trace we don't care... */ diff --git a/modules/libcom/src/osi/os/posix/osdEvent.c b/modules/libcom/src/osi/os/posix/osdEvent.c index 9a6a4f5e8..fa87b6b78 100644 --- a/modules/libcom/src/osi/os/posix/osdEvent.c +++ b/modules/libcom/src/osi/os/posix/osdEvent.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* osi/os/posix/osdEvent.c */ diff --git a/modules/libcom/src/osi/os/posix/osdEvent.h b/modules/libcom/src/osi/os/posix/osdEvent.h index e2f8b9af9..f53827e07 100644 --- a/modules/libcom/src/osi/os/posix/osdEvent.h +++ b/modules/libcom/src/osi/os/posix/osdEvent.h @@ -5,6 +5,6 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* for a pure posix implementation no osdEvent.h definitions are needed*/ diff --git a/modules/libcom/src/osi/os/posix/osdExecinfoBackTrace.cpp b/modules/libcom/src/osi/os/posix/osdExecinfoBackTrace.cpp index ae32d61fe..f123575cd 100644 --- a/modules/libcom/src/osi/os/posix/osdExecinfoBackTrace.cpp +++ b/modules/libcom/src/osi/os/posix/osdExecinfoBackTrace.cpp @@ -1,11 +1,11 @@ -/* +/* * Copyright: Stanford University / SLAC National Laboratory. * * EPICS BASE is distributed subject to a Software License Agreement found - * in file LICENSE that is included with this distribution. + * in file LICENSE that is included with this distribution. * * Author: Till Straumann , 2011, 2014 - */ + */ // pull in libc feature test macros #include @@ -28,8 +28,8 @@ int epicsBackTrace(void **buf, int buf_sz) { #if HAS_EXECINFO - return backtrace(buf, buf_sz); + return backtrace(buf, buf_sz); #else - return -1; + return -1; #endif } diff --git a/modules/libcom/src/osi/os/posix/osdFindSymbol.c b/modules/libcom/src/osi/os/posix/osdFindSymbol.c index 7a86f15b9..80e9406e2 100644 --- a/modules/libcom/src/osi/os/posix/osdFindSymbol.c +++ b/modules/libcom/src/osi/os/posix/osdFindSymbol.c @@ -2,7 +2,7 @@ * Copyright (c) 2009 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* osi/os/posix/osdFindSymbol.c */ diff --git a/modules/libcom/src/osi/os/posix/osdMutex.c b/modules/libcom/src/osi/os/posix/osdMutex.c index 43d3eac10..cb313a705 100644 --- a/modules/libcom/src/osi/os/posix/osdMutex.c +++ b/modules/libcom/src/osi/os/posix/osdMutex.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* osi/os/posix/osdMutex.c */ @@ -161,15 +161,15 @@ void epicsMutexOsdShow(struct epicsMutexOSD * pmutex, unsigned int level) #else /*defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE)>=500 */ typedef struct epicsMutexOSD { - pthread_mutex_t lock; + pthread_mutex_t lock; pthread_mutexattr_t mutexAttr; - pthread_cond_t waitToBeOwner; + pthread_cond_t waitToBeOwner; #if defined(_POSIX_THREAD_PROCESS_SHARED) && _POSIX_THREAD_PROCESS_SHARED > 0 pthread_condattr_t condAttr; #endif /*_POSIX_THREAD_PROCESS_SHARED*/ - int count; - int owned; /* TRUE | FALSE */ - pthread_t ownerTid; + int count; + int owned; /* TRUE | FALSE */ + pthread_t ownerTid; } epicsMutexOSD; epicsMutexOSD * epicsMutexOsdCreate(void) { diff --git a/modules/libcom/src/osi/os/posix/osdMutex.h b/modules/libcom/src/osi/os/posix/osdMutex.h index cc416384a..5f1475c94 100644 --- a/modules/libcom/src/osi/os/posix/osdMutex.h +++ b/modules/libcom/src/osi/os/posix/osdMutex.h @@ -5,6 +5,6 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* for a pure posix implementation no osdMutex.h definitions are needed*/ diff --git a/modules/libcom/src/osi/os/posix/osdProcess.c b/modules/libcom/src/osi/os/posix/osdProcess.c index 8517e8ecc..53cb3c95d 100644 --- a/modules/libcom/src/osi/os/posix/osdProcess.c +++ b/modules/libcom/src/osi/os/posix/osdProcess.c @@ -5,10 +5,10 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* * Operating System Dependent Implementation of osiProcess.h * * Author: Jeff Hill @@ -109,7 +109,7 @@ LIBCOM_API osiSpawnDetachedProcessReturn epicsStdCall osiSpawnDetachedProcess * Run the specified executable */ status = execlp (pBaseExecutableName, pBaseExecutableName, (char *)NULL); - if ( status < 0 ) { + if ( status < 0 ) { fprintf ( stderr, "**** The executable \"%s\" couldn't be located\n", pBaseExecutableName ); fprintf ( stderr, "**** because of errno = \"%s\".\n", strerror (errno) ); fprintf ( stderr, "**** You may need to modify your PATH environment variable.\n" ); diff --git a/modules/libcom/src/osi/os/posix/osdSignal.cpp b/modules/libcom/src/osi/os/posix/osdSignal.cpp index 5fe04366a..d299e7f56 100644 --- a/modules/libcom/src/osi/os/posix/osdSignal.cpp +++ b/modules/libcom/src/osi/os/posix/osdSignal.cpp @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found - * in file LICENSE that is included with this distribution. + * in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/libcom/src/osi/os/posix/osdSock.c b/modules/libcom/src/osi/os/posix/osdSock.c index 5d966b560..c9e9d23ec 100644 --- a/modules/libcom/src/osi/os/posix/osdSock.c +++ b/modules/libcom/src/osi/os/posix/osdSock.c @@ -5,12 +5,12 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* osdSock.c */ /* - * Author: Jeff Hill - * Date: 04-05-94 + * Author: Jeff Hill + * Date: 04-05-94 * */ @@ -34,18 +34,18 @@ static epicsMutexId infoMutex; static void createInfoMutex (void *unused) { - infoMutex = epicsMutexMustCreate (); + infoMutex = epicsMutexMustCreate (); } static void lockInfo (void) { static epicsThreadOnceId infoMutexOnceFlag = EPICS_THREAD_ONCE_INIT; epicsThreadOnce (&infoMutexOnceFlag, createInfoMutex, NULL); - epicsMutexMustLock (infoMutex); + epicsMutexMustLock (infoMutex); } static void unlockInfo (void) { - epicsMutexUnlock (infoMutex); + epicsMutexUnlock (infoMutex); } /* @@ -53,7 +53,7 @@ static void unlockInfo (void) */ int osiSockAttach() { - return 1; + return 1; } /* @@ -80,7 +80,7 @@ LIBCOM_API SOCKET epicsStdCall epicsSocketCreate ( if ( status < 0 ) { char buf [ 64 ]; epicsSocketConvertErrnoToString ( buf, sizeof ( buf ) ); - errlogPrintf ( + errlogPrintf ( "epicsSocketCreate: failed to " "fcntl FD_CLOEXEC because \"%s\"\n", buf ); @@ -103,7 +103,7 @@ LIBCOM_API int epicsStdCall epicsSocketAccept ( if ( status < 0 ) { char buf [ 64 ]; epicsSocketConvertErrnoToString ( buf, sizeof ( buf ) ); - errlogPrintf ( + errlogPrintf ( "epicsSocketCreate: failed to " "fcntl FD_CLOEXEC because \"%s\"\n", buf ); @@ -120,7 +120,7 @@ LIBCOM_API void epicsStdCall epicsSocketDestroy ( SOCKET s ) if ( status < 0 ) { char buf [ 64 ]; epicsSocketConvertErrnoToString ( buf, sizeof ( buf ) ); - errlogPrintf ( + errlogPrintf ( "epicsSocketDestroy: failed to " "close a socket because \"%s\"\n", buf ); @@ -135,21 +135,21 @@ LIBCOM_API void epicsStdCall epicsSocketDestroy ( SOCKET s ) LIBCOM_API unsigned epicsStdCall ipAddrToHostName (const struct in_addr *pAddr, char *pBuf, unsigned bufSize) { - struct hostent *ent; - int ret = 0; + struct hostent *ent; + int ret = 0; - if (bufSize<1) { - return 0; - } + if (bufSize<1) { + return 0; + } - lockInfo (); - ent = gethostbyaddr((const char *) pAddr, sizeof (*pAddr), AF_INET); - if (ent) { + lockInfo (); + ent = gethostbyaddr((const char *) pAddr, sizeof (*pAddr), AF_INET); + if (ent) { strncpy (pBuf, ent->h_name, bufSize); pBuf[bufSize-1] = '\0'; ret = strlen (pBuf); - } - unlockInfo (); + } + unlockInfo (); return ret; } @@ -159,23 +159,23 @@ LIBCOM_API unsigned epicsStdCall ipAddrToHostName * mutex since the routine is not thread-safe. */ LIBCOM_API int epicsStdCall hostToIPAddr - (const char *pHostName, struct in_addr *pIPA) + (const char *pHostName, struct in_addr *pIPA) { - struct hostent *phe; - int ret = -1; + struct hostent *phe; + int ret = -1; - lockInfo (); - phe = gethostbyname (pHostName); - if (phe && phe->h_addr_list[0]) { - if (phe->h_addrtype==AF_INET && phe->h_length<=sizeof(struct in_addr)) { - struct in_addr *pInAddrIn = (struct in_addr *) phe->h_addr_list[0]; - - *pIPA = *pInAddrIn; - ret = 0; - } - } - unlockInfo (); - return ret; + lockInfo (); + phe = gethostbyname (pHostName); + if (phe && phe->h_addr_list[0]) { + if (phe->h_addrtype==AF_INET && phe->h_length<=sizeof(struct in_addr)) { + struct in_addr *pInAddrIn = (struct in_addr *) phe->h_addr_list[0]; + + *pIPA = *pInAddrIn; + ret = 0; + } + } + unlockInfo (); + return ret; } diff --git a/modules/libcom/src/osi/os/posix/osdStdio.c b/modules/libcom/src/osi/os/posix/osdStdio.c index 0f9378cc5..28700b6ff 100644 --- a/modules/libcom/src/osi/os/posix/osdStdio.c +++ b/modules/libcom/src/osi/os/posix/osdStdio.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include diff --git a/modules/libcom/src/osi/os/posix/osdStrtod.h b/modules/libcom/src/osi/os/posix/osdStrtod.h index 502889a9d..82fbc107e 100644 --- a/modules/libcom/src/osi/os/posix/osdStrtod.h +++ b/modules/libcom/src/osi/os/posix/osdStrtod.h @@ -2,7 +2,7 @@ * Copyright (c) 2002 The University of Saskatchewan * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/libcom/src/osi/os/posix/osdThread.c b/modules/libcom/src/osi/os/posix/osdThread.c index de8d208bb..0c95c48f8 100644 --- a/modules/libcom/src/osi/os/posix/osdThread.c +++ b/modules/libcom/src/osi/os/posix/osdThread.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * Copyright (c) 2013 ITER Organization. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* Author: Marty Kraimer Date: 18JAN2000 */ @@ -617,7 +617,7 @@ static epicsThreadOSD *createImplicit(void) (pthreadInfo->schedParam.sched_priority - pcommonAttr->minPriority) * 100.0 / (pcommonAttr->maxPriority - pcommonAttr->minPriority + 1); } - } + } #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ status = pthread_setspecific(getpthreadInfo,(void *)pthreadInfo); diff --git a/modules/libcom/src/osi/os/posix/osdTime.h b/modules/libcom/src/osi/os/posix/osdTime.h index b0c8cd947..31a4f0c40 100644 --- a/modules/libcom/src/osi/os/posix/osdTime.h +++ b/modules/libcom/src/osi/os/posix/osdTime.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -18,10 +18,10 @@ #include #if !defined(_POSIX_TIMERS) || _POSIX_TIMERS < 0 - struct timespec { - time_t tv_sec; /* seconds since some epoch */ - long tv_nsec; /* nanoseconds within the second */ - }; + struct timespec { + time_t tv_sec; /* seconds since some epoch */ + long tv_nsec; /* nanoseconds within the second */ + }; #endif /* !_POSIX_TIMERS */ #ifdef __cplusplus diff --git a/modules/libcom/src/osi/os/posix/osiUnistd.h b/modules/libcom/src/osi/os/posix/osiUnistd.h index 5121261b6..534b72e9c 100644 --- a/modules/libcom/src/osi/os/posix/osiUnistd.h +++ b/modules/libcom/src/osi/os/posix/osiUnistd.h @@ -5,12 +5,12 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 +/* + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 */ #include diff --git a/modules/libcom/src/osi/os/posix/systemCallIntMech.cpp b/modules/libcom/src/osi/os/posix/systemCallIntMech.cpp index ea0a3411d..bc44d4dd2 100644 --- a/modules/libcom/src/osi/os/posix/systemCallIntMech.cpp +++ b/modules/libcom/src/osi/os/posix/systemCallIntMech.cpp @@ -6,15 +6,15 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* - * Author: Jeff Hill + * Author: Jeff Hill */ #include "osiSock.h" -enum epicsSocketSystemCallInterruptMechanismQueryInfo +enum epicsSocketSystemCallInterruptMechanismQueryInfo epicsSocketSystemCallInterruptMechanismQuery () { return esscimqi_socketBothShutdownRequired; diff --git a/modules/libcom/src/osi/os/solaris/epicsAtomicOSD.h b/modules/libcom/src/osi/os/solaris/epicsAtomicOSD.h index c6ecfa8d8..448d1fae3 100644 --- a/modules/libcom/src/osi/os/solaris/epicsAtomicOSD.h +++ b/modules/libcom/src/osi/os/solaris/epicsAtomicOSD.h @@ -5,7 +5,7 @@ * Copyright (c) 2011 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -22,7 +22,7 @@ #if defined ( __SunOS_5_10 ) -/* +/* * atomic.h exists only in Solaris 10 or higher */ #include @@ -56,7 +56,7 @@ EPICS_ATOMIC_INLINE int epicsAtomicCmpAndSwapIntT ( int * pTarget, { STATIC_ASSERT ( sizeof ( int ) == sizeof ( unsigned ) ); unsigned * const pTarg = ( unsigned * ) pTarget; - return ( int ) atomic_cas_uint ( pTarg, ( unsigned ) oldVal, + return ( int ) atomic_cas_uint ( pTarg, ( unsigned ) oldVal, ( unsigned ) newVal ); } #endif @@ -76,8 +76,8 @@ EPICS_ATOMIC_INLINE size_t epicsAtomicCmpAndSwapSizeT ( #ifndef EPICS_ATOMIC_CAS_PTRT #define EPICS_ATOMIC_CAS_PTRT EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT ( - EpicsAtomicPtrT * pTarget, - EpicsAtomicPtrT oldVal, + EpicsAtomicPtrT * pTarget, + EpicsAtomicPtrT oldVal, EpicsAtomicPtrT newVal ) { return atomic_cas_ptr ( pTarget, oldVal, newVal ); diff --git a/modules/libcom/src/osi/os/solaris/epicsMath.h b/modules/libcom/src/osi/os/solaris/epicsMath.h index c27484daa..4c944b976 100644 --- a/modules/libcom/src/osi/os/solaris/epicsMath.h +++ b/modules/libcom/src/osi/os/solaris/epicsMath.h @@ -2,7 +2,7 @@ * Copyright (c) 2008 UChicago Argonne, LLC as Operator of Argonne * National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef INC_epicsMath_H diff --git a/modules/libcom/src/osi/os/solaris/osdBackTrace.cpp b/modules/libcom/src/osi/os/solaris/osdBackTrace.cpp index 46c4784b3..a8bdc5905 100644 --- a/modules/libcom/src/osi/os/solaris/osdBackTrace.cpp +++ b/modules/libcom/src/osi/os/solaris/osdBackTrace.cpp @@ -1,20 +1,20 @@ -/* +/* * Copyright: Stanford University / SLAC National Laboratory. * * EPICS BASE is distributed subject to a Software License Agreement found - * in file LICENSE that is included with this distribution. + * in file LICENSE that is included with this distribution. * * Author: Till Straumann , 2014 - */ + */ #include #include "epicsStackTracePvt.h" struct wlk { - void **buf; - int max; - int cur; + void **buf; + int max; + int cur; }; @@ -24,9 +24,9 @@ static int walker(uintptr_t addr, int sig, void *arg) { struct wlk *w_p = (struct wlk *)arg; - if ( w_p->cur < w_p->max ) - w_p->buf[w_p->cur++] = (void*)addr; - return 0; + if ( w_p->cur < w_p->max ) + w_p->buf[w_p->cur++] = (void*)addr; + return 0; } } @@ -35,11 +35,11 @@ int epicsBackTrace(void **buf, int buf_sz) { ucontext_t u; struct wlk d; - d.buf = buf; - d.max = buf_sz; - d.cur = 0; - if ( getcontext(&u) ) - return -1; - walkcontext( &u, walker, &d ); - return d.cur; + d.buf = buf; + d.max = buf_sz; + d.cur = 0; + if ( getcontext(&u) ) + return -1; + walkcontext( &u, walker, &d ); + return d.cur; } diff --git a/modules/libcom/src/osi/os/solaris/osdEnv.c b/modules/libcom/src/osi/os/solaris/osdEnv.c index 2cc80daee..b61c7c479 100644 --- a/modules/libcom/src/osi/os/solaris/osdEnv.c +++ b/modules/libcom/src/osi/os/solaris/osdEnv.c @@ -1,7 +1,7 @@ /*************************************************************************\ * Copyright (c) 2002 The University of Saskatchewan * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* osdEnv.c */ /* diff --git a/modules/libcom/src/osi/os/solaris/osdFindAddr.c b/modules/libcom/src/osi/os/solaris/osdFindAddr.c index 84d17d96f..71a83b894 100644 --- a/modules/libcom/src/osi/os/solaris/osdFindAddr.c +++ b/modules/libcom/src/osi/os/solaris/osdFindAddr.c @@ -1,10 +1,10 @@ -/* +/* * Copyright: Stanford University / SLAC National Laboratory. * * EPICS BASE is distributed subject to a Software License Agreement found - * in file LICENSE that is included with this distribution. + * in file LICENSE that is included with this distribution. * * Author: Till Straumann , 2011, 2014 - */ + */ #include "osdElfFindAddr.c" diff --git a/modules/libcom/src/osi/os/solaris/osdStrtod.h b/modules/libcom/src/osi/os/solaris/osdStrtod.h index 395cacdc2..055a885df 100644 --- a/modules/libcom/src/osi/os/solaris/osdStrtod.h +++ b/modules/libcom/src/osi/os/solaris/osdStrtod.h @@ -2,7 +2,7 @@ * Copyright (c) 2002 The University of Saskatchewan * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/libcom/src/osi/os/solaris/osiFileName.h b/modules/libcom/src/osi/os/solaris/osiFileName.h index b79203992..f4d9e38af 100644 --- a/modules/libcom/src/osi/os/solaris/osiFileName.h +++ b/modules/libcom/src/osi/os/solaris/osiFileName.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * osiFileName.h diff --git a/modules/libcom/src/osi/os/vxWorks/atReboot.cpp b/modules/libcom/src/osi/os/vxWorks/atReboot.cpp index 2f755c581..fc472917b 100644 --- a/modules/libcom/src/osi/os/vxWorks/atReboot.cpp +++ b/modules/libcom/src/osi/os/vxWorks/atReboot.cpp @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* atReboot.cpp */ diff --git a/modules/libcom/src/osi/os/vxWorks/camacLib.h b/modules/libcom/src/osi/os/vxWorks/camacLib.h index 49357f934..ef878bdbb 100644 --- a/modules/libcom/src/osi/os/vxWorks/camacLib.h +++ b/modules/libcom/src/osi/os/vxWorks/camacLib.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* camacLib.h -- Prototypes for camacLib.o * @@ -15,48 +15,48 @@ */ /********************************/ -/* GLOBAL DATA */ +/* GLOBAL DATA */ /********************************/ -extern int debug_hook; +extern int debug_hook; -extern struct glob_dat { - int total; - int read_error[5]; - int write_error[5]; - int cmd_error[5]; - int total_err; - int lam_count[12]; +extern struct glob_dat { + int total; + int read_error[5]; + int write_error[5]; + int cmd_error[5]; + int total_err; + int lam_count[12]; } debug_dat; /********************************/ -/* FUNCTION PROTOTYPES */ +/* FUNCTION PROTOTYPES */ /********************************/ #ifdef __cplusplus extern "C" { #endif -void cdreg(int *ext, int b, int c, int n, int a); -void cfsa(int f, int ext, int *dat, int *q); -void cssa(int f, int ext, short *dat, int *q); -void ccci(int ext, int l); -void cccz(int ext); -void cccc(int ext); -void ccinit(int b); -void ctci(int ext, int *l); -void cgreg(int ext, int *b, int *c, int *n, int *a); -void cfmad(int f, int extb[2], int *intc, int cb[4]); -void cfubc(int f, int ext, int *intc, int cb[4]); -void cfubc(int f, int ext, int *intc, int cb[4]); -void csmad(int f, int extb[2], short *intc, int cb[4]); -void ctcd(int ext, int *l); -void cccd(int ext, int l); -void csga(int fa[], int exta[], unsigned short intc[], int qa[], int cb[4]); -void cfga(int fa[], int exta[], int intc[], int qa[], int cb[4]); -void cfubr(int f, int ext, int intc[], int cb[4]); -void csubc(int f, int ext, unsigned short *intc, int cb[4]); -void csubr(int f, int ext, int intc[], int cb[4]); -void print_reg(int ext); +void cdreg(int *ext, int b, int c, int n, int a); +void cfsa(int f, int ext, int *dat, int *q); +void cssa(int f, int ext, short *dat, int *q); +void ccci(int ext, int l); +void cccz(int ext); +void cccc(int ext); +void ccinit(int b); +void ctci(int ext, int *l); +void cgreg(int ext, int *b, int *c, int *n, int *a); +void cfmad(int f, int extb[2], int *intc, int cb[4]); +void cfubc(int f, int ext, int *intc, int cb[4]); +void cfubc(int f, int ext, int *intc, int cb[4]); +void csmad(int f, int extb[2], short *intc, int cb[4]); +void ctcd(int ext, int *l); +void cccd(int ext, int l); +void csga(int fa[], int exta[], unsigned short intc[], int qa[], int cb[4]); +void cfga(int fa[], int exta[], int intc[], int qa[], int cb[4]); +void cfubr(int f, int ext, int intc[], int cb[4]); +void csubc(int f, int ext, unsigned short *intc, int cb[4]); +void csubr(int f, int ext, int intc[], int cb[4]); +void print_reg(int ext); #ifdef __cplusplus } diff --git a/modules/libcom/src/osi/os/vxWorks/devLibVMEOSD.c b/modules/libcom/src/osi/os/vxWorks/devLibVMEOSD.c index 93d30fc38..9f9f35611 100644 --- a/modules/libcom/src/osi/os/vxWorks/devLibVMEOSD.c +++ b/modules/libcom/src/osi/os/vxWorks/devLibVMEOSD.c @@ -4,13 +4,13 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* - * Archictecture dependent support for common device driver resources +/* + * Archictecture dependent support for common device driver resources * - * Author: Jeff Hill - * Date: 10-30-98 + * Author: Jeff Hill + * Date: 10-30-98 */ #include @@ -76,7 +76,7 @@ int cISRTest(void (*)(), void (**)(), void **); #define EPICSAddrTypeNoConvert -1 -int EPICStovxWorksAddrType[] +int EPICStovxWorksAddrType[] = { VME_AM_SUP_SHORT_IO, VME_AM_STD_SUP_DATA, @@ -97,13 +97,13 @@ static long vxDevMapAddr (epicsAddressType addrType, unsigned options, size_t logicalAddress, size_t size, volatile void **ppPhysicalAddress); /* - * a bus error safe "wordSize" read at the specified address which returns + * a bus error safe "wordSize" read at the specified address which returns * unsuccessful status if the device isnt present */ static long vxDevReadProbe (unsigned wordSize, volatile const void *ptr, void *pValue); /* - * a bus error safe "wordSize" write at the specified address which returns + * a bus error safe "wordSize" write at the specified address which returns * unsuccessful status if the device isnt present */ static long vxDevWriteProbe (unsigned wordSize, volatile void *ptr, const void *pValue); @@ -133,7 +133,7 @@ static long vxDevConnectInterruptVME ( static long vxDevDisconnectInterruptVME ( unsigned vectorNumber, - void (*pFunction)() + void (*pFunction)() ); static long vxDevEnableInterruptLevelVME (unsigned level); @@ -146,7 +146,7 @@ static int vxDevInterruptInUseVME (unsigned vectorNumber); * used by dynamic bind in devLib.c */ static devLibVME vxVirtualOS = { - vxDevMapAddr, vxDevReadProbe, vxDevWriteProbe, + vxDevMapAddr, vxDevReadProbe, vxDevWriteProbe, vxDevConnectInterruptVME, vxDevDisconnectInterruptVME, vxDevEnableInterruptLevelVME, vxDevDisableInterruptLevelVME, devA24Malloc,devA24Free,devInit,vxDevInterruptInUseVME @@ -167,12 +167,12 @@ static long vxDevConnectInterruptVME ( if (devInterruptInUseVME(vectorNumber)) { - return S_dev_vectorInUse; + return S_dev_vectorInUse; } status = intConnect( (void *)INUM_TO_IVEC(vectorNumber), pFunction, - (int) parameter); + (int) parameter); if (status<0) { return S_dev_vecInstlFail; } @@ -186,14 +186,14 @@ static long vxDevConnectInterruptVME ( * * wrapper to minimize driver dependency on vxWorks * - * The parameter pFunction should be set to the C function pointer that - * was connected. It is used as a key to prevent a driver from removing + * The parameter pFunction should be set to the C function pointer that + * was connected. It is used as a key to prevent a driver from removing * an interrupt handler that was installed by another driver * */ static long vxDevDisconnectInterruptVME ( unsigned vectorNumber, - void (*pFunction)() + void (*pFunction)() ) { void (*psub)(); @@ -215,7 +215,7 @@ static long vxDevDisconnectInterruptVME ( status = intConnect( (void *)INUM_TO_IVEC(vectorNumber), unsolicitedHandlerEPICS, - (int) vectorNumber); + (int) vectorNumber); if(status<0){ return S_dev_vecInstlFail; } @@ -321,7 +321,7 @@ static long vxDevMapAddr (epicsAddressType addrType, unsigned options, } /* - * a bus error safe "wordSize" read at the specified address which returns + * a bus error safe "wordSize" read at the specified address which returns * unsuccessful status if the device isn't present */ static long vxDevReadProbe (unsigned wordSize, volatile const void *ptr, void *pValue) @@ -337,7 +337,7 @@ static long vxDevReadProbe (unsigned wordSize, volatile const void *ptr, void *p } /* - * a bus error safe "wordSize" write at the specified address which returns + * a bus error safe "wordSize" write at the specified address which returns * unsuccessful status if the device isn't present */ static long vxDevWriteProbe (unsigned wordSize, volatile void *ptr, const void *pValue) @@ -401,7 +401,7 @@ static int vxDevInterruptInUseVME (unsigned vectorNumber) initHandlerAddrList(); init = TRUE; } - + psub = isrFetch (vectorNumber); /* @@ -451,7 +451,7 @@ void unsolicitedHandlerEPICS(int vectorNumber) * init list of interrupt handlers to ignore * */ -static +static void initHandlerAddrList(void) { int i; @@ -483,7 +483,7 @@ static void *devA24Malloc(size_t size) { static int UsingBSP = 0; void *ret; - + if (A24MallocFunc == NULL) { /* See if the sysA24Malloc() function is present. */ @@ -503,10 +503,10 @@ static void *devA24Malloc(size_t size) } } ret = A24MallocFunc(size); - + if ((ret == NULL) && (UsingBSP)) errMessage(S_dev_noMemory, "devLibA24Malloc ran out of A24 memory, try sysA24MapRam(size)"); - + return(ret); } diff --git a/modules/libcom/src/osi/os/vxWorks/epicsAtomicOSD.h b/modules/libcom/src/osi/os/vxWorks/epicsAtomicOSD.h index e7bdde0c3..81bfb3179 100644 --- a/modules/libcom/src/osi/os/vxWorks/epicsAtomicOSD.h +++ b/modules/libcom/src/osi/os/vxWorks/epicsAtomicOSD.h @@ -1,10 +1,10 @@ /*************************************************************************\ * Copyright (c) 2011 LANS LLC, as Operator of * Los Alamos National Laboratory. -* Copyright (c) 2011 UChicago Argonne, LLC, as Operator of +* Copyright (c) 2011 UChicago Argonne, LLC, as Operator of * Argonne National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -55,13 +55,13 @@ EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void) #endif /* - * we make the probably correct guess that if ULONG_MAX + * we make the probably correct guess that if ULONG_MAX * is the same as UINT_MAX then sizeof ( atomic_t ) * will be the same as sizeof ( size_t ) * * if ULONG_MAX != UINT_MAX then its 64 bit vxWorks and - * WRS doesnt not supply at this time the atomic interface - * for 8 byte integers that is needed - so that architecture + * WRS doesnt not supply at this time the atomic interface + * for 8 byte integers that is needed - so that architecture * receives the lock synchronized version */ #if ULONG_MAX == UINT_MAX @@ -94,8 +94,8 @@ EPICS_ATOMIC_INLINE size_t epicsAtomicDecrSizeT ( size_t * pTarget ) #define EPICS_ATOMIC_ADD_SIZET EPICS_ATOMIC_INLINE size_t epicsAtomicAddSizeT ( size_t * pTarget, size_t delta ) { - /* - * vxAtomicLib doc indicates that vxAtomicAdd is + /* + * vxAtomicLib doc indicates that vxAtomicAdd is * implemented using signed arithmetic, but it * does not change the end result because twos * complement addition is used in either case @@ -103,15 +103,15 @@ EPICS_ATOMIC_INLINE size_t epicsAtomicAddSizeT ( size_t * pTarget, size_t delta atomic_t * const pTarg = ( atomic_t * ) ( pTarget ); const atomic_t oldVal = vxAtomicAdd ( pTarg, (atomic_t) delta ); return delta + ( size_t ) oldVal; -} -#endif +} +#endif #ifndef EPICS_ATOMIC_SUB_SIZET #define EPICS_ATOMIC_SUB_SIZET EPICS_ATOMIC_INLINE size_t epicsAtomicSubSizeT ( size_t * pTarget, size_t delta ) { - /* - * vxAtomicLib doc indicates that vxAtomicSub is + /* + * vxAtomicLib doc indicates that vxAtomicSub is * implemented using signed arithmetic, but it * does not change the end result because twos * complement subtraction is used in either case @@ -124,7 +124,7 @@ EPICS_ATOMIC_INLINE size_t epicsAtomicSubSizeT ( size_t * pTarget, size_t delta #ifndef EPICS_ATOMIC_CAS_SIZET #define EPICS_ATOMIC_CAS_SIZET -EPICS_ATOMIC_INLINE size_t epicsAtomicCmpAndSwapSizeT ( size_t * pTarget, +EPICS_ATOMIC_INLINE size_t epicsAtomicCmpAndSwapSizeT ( size_t * pTarget, size_t oldVal, size_t newVal ) { atomic_t * const pTarg = ( atomic_t * ) ( pTarget ); @@ -134,7 +134,7 @@ EPICS_ATOMIC_INLINE size_t epicsAtomicCmpAndSwapSizeT ( size_t * pTarget, #ifndef EPICS_ATOMIC_CAS_PTRT #define EPICS_ATOMIC_CAS_PTRT -EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT ( EpicsAtomicPtrT * pTarget, +EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT ( EpicsAtomicPtrT * pTarget, EpicsAtomicPtrT oldVal, EpicsAtomicPtrT newVal ) { atomic_t * const pTarg = ( atomic_t * ) ( pTarget ); @@ -146,11 +146,11 @@ EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT ( EpicsAtomicPtrT /* * if its 64 bit SMP vxWorks and the compiler doesnt - * have an intrinsic then maybe there isnt any way to - * implement these without using a global lock because + * have an intrinsic then maybe there isnt any way to + * implement these without using a global lock because * size_t is maybe bigger than atomic_t * - * I dont yet have access to vxWorks manuals for + * I dont yet have access to vxWorks manuals for * 64 bit systems so this is still undecided, but is * defaulting now to a global lock */ @@ -191,7 +191,7 @@ EPICS_ATOMIC_INLINE int epicsAtomicAddIntT ( int * pTarget, int delta ) #ifndef EPICS_ATOMIC_CAS_INTT #define EPICS_ATOMIC_CAS_INTT -EPICS_ATOMIC_INLINE int epicsAtomicCmpAndSwapIntT ( int * pTarget, +EPICS_ATOMIC_INLINE int epicsAtomicCmpAndSwapIntT ( int * pTarget, int oldVal, int newVal ) { atomic_t * const pTarg = ( atomic_t * ) ( pTarget ); @@ -232,8 +232,8 @@ EPICS_ATOMIC_INLINE void epicsAtomicUnlock ( EpicsAtomicLockKey * pKey ) #ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER #define EPICS_ATOMIC_READ_MEMORY_BARRIER -/* - * no need for memory barrior since prior to vxWorks 6.6 it is a single cpu system +/* + * no need for memory barrior since prior to vxWorks 6.6 it is a single cpu system * (we are not protecting against multiple access to memory mapped IO) */ EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void) {} @@ -241,8 +241,8 @@ EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void) {} #ifndef EPICS_ATOMIC_WRITE_MEMORY_BARRIER #define EPICS_ATOMIC_WRITE_MEMORY_BARRIER -/* - * no need for memory barrior since prior to vxWorks 6.6 it is a single cpu system +/* + * no need for memory barrior since prior to vxWorks 6.6 it is a single cpu system * (we are not protecting against multiple access to memory mapped IO) */ EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void) {} diff --git a/modules/libcom/src/osi/os/vxWorks/epicsMath.h b/modules/libcom/src/osi/os/vxWorks/epicsMath.h index 0939f3d5c..4c6aea927 100644 --- a/modules/libcom/src/osi/os/vxWorks/epicsMath.h +++ b/modules/libcom/src/osi/os/vxWorks/epicsMath.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #ifndef epicsMathh diff --git a/modules/libcom/src/osi/os/vxWorks/logMsgToErrlog.cpp b/modules/libcom/src/osi/os/vxWorks/logMsgToErrlog.cpp index b44881cd0..4938cf6fa 100644 --- a/modules/libcom/src/osi/os/vxWorks/logMsgToErrlog.cpp +++ b/modules/libcom/src/osi/os/vxWorks/logMsgToErrlog.cpp @@ -5,10 +5,10 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* * route vxWorks logMsg messages into the EPICS logging system * * Author: Jeff Hill @@ -31,8 +31,8 @@ extern "C" { int logMsgToErrlog() { return 0;} -static class errlogDevTimeInit -{ +static class errlogDevTimeInit +{ public: errlogDevTimeInit (); } errlogDevInstance; @@ -48,19 +48,19 @@ static int errlogWrite ( DEV_HDR *, const char * pInBuf, int nbytes ) return nbytes; } -errlogDevTimeInit::errlogDevTimeInit () +errlogDevTimeInit::errlogDevTimeInit () { - int errlogNo = iosDrvInstall ( + int errlogNo = iosDrvInstall ( 0, // create not supported 0, // remove not supported reinterpret_cast < FUNCPTR > ( errlogOpen ), 0, // close is a noop 0, // read not supported reinterpret_cast < FUNCPTR > ( errlogWrite ), - 0 // ioctl not supported + 0 // ioctl not supported ); if ( errlogNo == ERROR ) { - errlogPrintf ( + errlogPrintf ( "Unable to install driver routing the vxWorks " "logging system to the EPICS logging system because \"%s\"\n", strerror ( errno ) ); @@ -68,7 +68,7 @@ errlogDevTimeInit::errlogDevTimeInit () } DEV_HDR * pDev = static_cast < DEV_HDR * > ( calloc ( 1, sizeof ( *pDev ) ) ); if ( ! pDev ) { - errlogPrintf ( + errlogPrintf ( "Unable to create driver data structure for routing the vxWorks " "logging system to the EPICS logging system because \"%s\"\n", strerror ( errno ) ); @@ -76,7 +76,7 @@ errlogDevTimeInit::errlogDevTimeInit () } int status = iosDevAdd ( pDev, "/errlog/", errlogNo ); if ( status < 0 ) { - errlogPrintf ( + errlogPrintf ( "Unable to install device routing the vxWorks " "logging system to the EPICS logging system because \"%s\"\n", strerror ( errno ) ); @@ -85,7 +85,7 @@ errlogDevTimeInit::errlogDevTimeInit () } int fd = open ( "/errlog/any", O_WRONLY, 0 ); if ( fd < 0 ) { - errlogPrintf ( + errlogPrintf ( "Unable to open fd routing the vxWorks " "logging system to the EPICS logging system because \"%s\"\n", strerror ( errno ) ); @@ -93,7 +93,7 @@ errlogDevTimeInit::errlogDevTimeInit () } status = logFdAdd ( fd ); if ( status != OK) { - errlogPrintf ( + errlogPrintf ( "Unable to install fd routing the vxWorks " "logging system to the EPICS logging system because \"%s\"\n", strerror ( errno ) ); diff --git a/modules/libcom/src/osi/os/vxWorks/module_types.h b/modules/libcom/src/osi/os/vxWorks/module_types.h index 07372c37a..a17612359 100644 --- a/modules/libcom/src/osi/os/vxWorks/module_types.h +++ b/modules/libcom/src/osi/os/vxWorks/module_types.h @@ -5,12 +5,12 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* module_types.h */ /* - * Author: Bob Dalesio - * Date: 12-07-88 + * Author: Bob Dalesio + * Date: 12-07-88 */ #ifndef INCLmodule_typesh @@ -27,8 +27,8 @@ /* !! never been tested */ /* - * @# If any changes are made to this file, check the procedures - * ab_card, and vme_card in signallist.c, and get_address in sigmenu.c. + * @# If any changes are made to this file, check the procedures + * ab_card, and vme_card in signallist.c, and get_address in sigmenu.c. */ #ifdef MODULE_TYPES_INIT @@ -41,14 +41,14 @@ #define IOR_MAX_COLS 4 /* I/O types */ -#define IO_AI 0 -#define IO_AO 1 -#define IO_BI 2 -#define IO_BO 3 -#define IO_SM 4 -#define IO_WF 5 -#define IO_TIMER 6 -#define MAX_IO_TYPE IO_TIMER +#define IO_AI 0 +#define IO_AO 1 +#define IO_BI 2 +#define IO_BO 3 +#define IO_SM 4 +#define IO_WF 5 +#define IO_TIMER 6 +#define MAX_IO_TYPE IO_TIMER /* bus types */ /* must correspond to the values in link types */ @@ -56,7 +56,7 @@ /* equates for the Allen-Bradley cards. */ -#define AB_BASE_ADDR 0xc00000 /* base addr of first AB6008SV */ +#define AB_BASE_ADDR 0xc00000 /* base addr of first AB6008SV */ #define AB_MAX_LINKS 2 /* number of serial links from VME */ #define AB_MAX_ADAPTERS 8 /* number of physical adapters on a link */ #define AB_MAX_CARDS 16 /* max number of IO cards per adapter */ @@ -64,52 +64,52 @@ #define AB_CHAN_CARD 16 /* max channels per card */ /* analog inputs */ -#define AB1771IL 0 /* &% Allen-Bradley low level analog input */ -#define AB1771IFE 1 /* &% Allen-Bradley low level analog input */ -#define AB1771IXE 2 /* &% Allen-Bradley millivolt input */ -#define XY566SE 3 /* & Xycom 12-bit Single Ended Scanned*/ -#define XY566DI 4 /* &% Xycom 12-bit Differential Scanned */ -#define XY566DIL 5 /* &% Xycom 12-bit Differential Latched */ -#define VXI_AT5_AI 6 /* % AT-5 VXI module's Analog Inputs */ -#define AB1771IFE_SE 7 /* % A-B IFE in 16 single-ended input mode */ -#define AB1771IFE_4to20MA 8 /* % A-B IFE in 8 double-ended 4to20Ma */ -#define DVX2502 9 /* &% DVX_2502 128 chan 16 bit differential */ -#define AB1771IFE_0to5V 10 /* % A-B IFE in 8 double-ended 4to20Ma */ -#define KSCV215 11 /* % KSC V215 VXI 16 bit differential */ -#define AB1771IrPlatinum 12 /* % A-B RTD Platinum */ -#define AB1771IrCopper 13 /* % A-B RTD Copper */ -#define MAX_AI_TYPES AB1771IrCopper +#define AB1771IL 0 /* &% Allen-Bradley low level analog input */ +#define AB1771IFE 1 /* &% Allen-Bradley low level analog input */ +#define AB1771IXE 2 /* &% Allen-Bradley millivolt input */ +#define XY566SE 3 /* & Xycom 12-bit Single Ended Scanned*/ +#define XY566DI 4 /* &% Xycom 12-bit Differential Scanned */ +#define XY566DIL 5 /* &% Xycom 12-bit Differential Latched */ +#define VXI_AT5_AI 6 /* % AT-5 VXI module's Analog Inputs */ +#define AB1771IFE_SE 7 /* % A-B IFE in 16 single-ended input mode */ +#define AB1771IFE_4to20MA 8 /* % A-B IFE in 8 double-ended 4to20Ma */ +#define DVX2502 9 /* &% DVX_2502 128 chan 16 bit differential */ +#define AB1771IFE_0to5V 10 /* % A-B IFE in 8 double-ended 4to20Ma */ +#define KSCV215 11 /* % KSC V215 VXI 16 bit differential */ +#define AB1771IrPlatinum 12 /* % A-B RTD Platinum */ +#define AB1771IrCopper 13 /* % A-B RTD Copper */ +#define MAX_AI_TYPES AB1771IrCopper MODULE_TYPES_DEF(short ai_num_cards[MAX_AI_TYPES+1]) #ifdef MODULE_TYPES_INIT - ={12,12,12, 4, 4, 6,32,12,12, 1, 12, 32, 12,12}; + ={12,12,12, 4, 4, 6,32,12,12, 1, 12, 32, 12,12}; #endif MODULE_TYPES_DEF(short ai_num_channels[MAX_AI_TYPES+1]) #ifdef MODULE_TYPES_INIT - ={ 8, 8, 8,32,16,16, 8,16, 8, 127, 8, 32,6,6}; + ={ 8, 8, 8,32,16,16, 8,16, 8, 127, 8, 32,6,6}; #endif MODULE_TYPES_DEF(short ai_interruptable[MAX_AI_TYPES+1]) #ifdef MODULE_TYPES_INIT - ={0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0,0,0}; + ={0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0,0,0}; #endif MODULE_TYPES_DEF(short ai_bus[MAX_AI_TYPES+1]) #ifdef MODULE_TYPES_INIT - ={ 4, 4, 4, 2, 2, 2, 2, 4, 4, 2, 4, 2,4,4}; + ={ 4, 4, 4, 2, 2, 2, 2, 4, 4, 2, 4, 2,4,4}; #endif MODULE_TYPES_DEF(unsigned short ai_addrs[MAX_AI_TYPES+1]) #ifdef MODULE_TYPES_INIT - ={ 0,0,0,0x6000,0x7000,0xe000, 0xc014,0,0, 0xff00, 0, 0,0,0}; + ={ 0,0,0,0x6000,0x7000,0xe000, 0xc014,0,0, 0xff00, 0, 0,0,0}; #endif MODULE_TYPES_DEF(long ai_memaddrs[MAX_AI_TYPES+1]) #ifdef MODULE_TYPES_INIT - ={0,0,0,0x000000,0x040000,0x0c0000, 0,0,0, 0x100000, 0, 0,0,0}; + ={0,0,0,0x000000,0x040000,0x0c0000, 0,0,0, 0x100000, 0, 0,0,0}; #endif /* analog outputs */ -#define AB1771OFE 0 /* &% Allen-Bradley 12 bit Analog Output */ -#define VMI4100 1 /* & VMIC VMIVME 4100 */ -#define ZIO085 2 /* & Ziomek 085 */ -#define VXI_AT5_AO 3 /* !! AT-5 VXI modules analog outputs */ -#define MAX_AO_TYPES VXI_AT5_AO +#define AB1771OFE 0 /* &% Allen-Bradley 12 bit Analog Output */ +#define VMI4100 1 /* & VMIC VMIVME 4100 */ +#define ZIO085 2 /* & Ziomek 085 */ +#define VXI_AT5_AO 3 /* !! AT-5 VXI modules analog outputs */ +#define MAX_AO_TYPES VXI_AT5_AO MODULE_TYPES_DEF(short ao_num_cards[MAX_AO_TYPES+1]) #ifdef MODULE_TYPES_INIT = {12, 4, 1, 32}; @@ -132,71 +132,71 @@ MODULE_TYPES_DEF(unsigned short ao_addrs[MAX_AO_TYPES+1]) #endif /* binary inputs */ -#define ABBI_08_BIT 0 /* &% Allen-Bradley generic Binary In 8 bit */ -#define ABBI_16_BIT 1 /* &% Allen-Bradley generic Binary In 16 bit */ -#define BB910 2 /* & BURR BROWN MPV 910 (relay) */ -#define XY210 3 /* &% XYcom 32 bit binary in */ -#define VXI_AT5_BI 4 /* !! AT-5 VXI modules binary inputs */ -#define HPE1368A_BI 5 /* !! HP E1368A video switch */ -#define AT8_FP10S_BI 6 /* !! AT8 FP10 slave fast protect */ -#define XY240_BI 7 /* !! Xycom 32 bit binary in / 32 bit binary out */ -#define MAX_BI_TYPES XY240_BI +#define ABBI_08_BIT 0 /* &% Allen-Bradley generic Binary In 8 bit */ +#define ABBI_16_BIT 1 /* &% Allen-Bradley generic Binary In 16 bit */ +#define BB910 2 /* & BURR BROWN MPV 910 (relay) */ +#define XY210 3 /* &% XYcom 32 bit binary in */ +#define VXI_AT5_BI 4 /* !! AT-5 VXI modules binary inputs */ +#define HPE1368A_BI 5 /* !! HP E1368A video switch */ +#define AT8_FP10S_BI 6 /* !! AT8 FP10 slave fast protect */ +#define XY240_BI 7 /* !! Xycom 32 bit binary in / 32 bit binary out */ +#define MAX_BI_TYPES XY240_BI MODULE_TYPES_DEF(short bi_num_cards[MAX_BI_TYPES+1] ) #ifdef MODULE_TYPES_INIT - ={ 12, 12, 4, 4, 32, 32, 8, 2}; + ={ 12, 12, 4, 4, 32, 32, 8, 2}; #endif MODULE_TYPES_DEF(short bi_num_channels[MAX_BI_TYPES+1] ) #ifdef MODULE_TYPES_INIT - ={ 8, 16, 32, 32, 32, 16, 32, 32}; + ={ 8, 16, 32, 32, 32, 16, 32, 32}; #endif MODULE_TYPES_DEF(short bi_interruptable[MAX_BI_TYPES+1] ) #ifdef MODULE_TYPES_INIT - ={ 1, 1, 0, 0, 1, 1, 1, 1}; + ={ 1, 1, 0, 0, 1, 1, 1, 1}; #endif MODULE_TYPES_DEF(short bi_bus[MAX_BI_TYPES+1]) #ifdef MODULE_TYPES_INIT - ={ 4, 4, 2, 2, 2, 2, 2, 2}; + ={ 4, 4, 2, 2, 2, 2, 2, 2}; #endif MODULE_TYPES_DEF(unsigned short bi_addrs[MAX_BI_TYPES+1]) #ifdef MODULE_TYPES_INIT - ={ 0,0,0xb800,0xa000, 0xc000, 0xc000, 0x0e00, 0xd000}; + ={ 0,0,0xb800,0xa000, 0xc000, 0xc000, 0x0e00, 0xd000}; #endif /* binary outputs */ -#define ABBO_08_BIT 0 /* &% Allen-Bradley 8 bit binary out */ -#define ABBO_16_BIT 1 /* &% Allen-Bradley 16 bit binary out */ -#define BB902 2 /* &% BURR BROWN MPV 902 (relay) */ -#define XY220 3 /* &% XYcom 32 bit binary out */ -#define VXI_AT5_BO 4 /* !! AT-5 VXI modules binary outputs */ -#define HPE1368A_BO 5 /* !! HP E1368A video switch */ -#define AT8_FP10M_BO 6 /* !! AT8 FP10 master fast protect */ -#define XY240_BO 7 /* !! Xycom 32 bit binary in / 32 bit binary out */ -#define MAX_BO_TYPES XY240_BO +#define ABBO_08_BIT 0 /* &% Allen-Bradley 8 bit binary out */ +#define ABBO_16_BIT 1 /* &% Allen-Bradley 16 bit binary out */ +#define BB902 2 /* &% BURR BROWN MPV 902 (relay) */ +#define XY220 3 /* &% XYcom 32 bit binary out */ +#define VXI_AT5_BO 4 /* !! AT-5 VXI modules binary outputs */ +#define HPE1368A_BO 5 /* !! HP E1368A video switch */ +#define AT8_FP10M_BO 6 /* !! AT8 FP10 master fast protect */ +#define XY240_BO 7 /* !! Xycom 32 bit binary in / 32 bit binary out */ +#define MAX_BO_TYPES XY240_BO MODULE_TYPES_DEF(short bo_num_cards[MAX_BO_TYPES+1] ) #ifdef MODULE_TYPES_INIT - ={12, 12, 4, 1, 32, 32, 2, 2}; + ={12, 12, 4, 1, 32, 32, 2, 2}; #endif MODULE_TYPES_DEF(short bo_num_channels[MAX_BO_TYPES+1] ) #ifdef MODULE_TYPES_INIT - ={ 8, 16, 32, 32, 32, 16, 32, 32}; + ={ 8, 16, 32, 32, 32, 16, 32, 32}; #endif MODULE_TYPES_DEF(short bo_interruptable[MAX_BO_TYPES+1] ) #ifdef MODULE_TYPES_INIT - ={ 0, 0, 0, 0, 1, 0, 0, 1 }; + ={ 0, 0, 0, 0, 1, 0, 0, 1 }; #endif MODULE_TYPES_DEF(short bo_bus[MAX_BO_TYPES+1]) #ifdef MODULE_TYPES_INIT - ={ 4, 4, 2, 2, 2, 2, 2, 2 }; + ={ 4, 4, 2, 2, 2, 2, 2, 2 }; #endif MODULE_TYPES_DEF(unsigned short bo_addrs[MAX_BO_TYPES+1]) #ifdef MODULE_TYPES_INIT - ={ 0,0,0xd800,0xc800, 0xc000, 0xc000, 0x0c00, 0xd000}; + ={ 0,0,0xd800,0xc800, 0xc000, 0xc000, 0x0c00, 0xd000}; #endif /* stepper motor drivers */ -#define CM57_83E 0 /* & Compumotor 57-83E motor controller */ -#define OMS_6AXIS 1 /* & OMS six axis motor controller */ -#define MAX_SM_TYPES OMS_6AXIS +#define CM57_83E 0 /* & Compumotor 57-83E motor controller */ +#define OMS_6AXIS 1 /* & OMS six axis motor controller */ +#define MAX_SM_TYPES OMS_6AXIS MODULE_TYPES_DEF(short sm_num_cards[MAX_SM_TYPES+1] ) #ifdef MODULE_TYPES_INIT ={ 8, 8 }; @@ -219,11 +219,11 @@ MODULE_TYPES_DEF(unsigned short sm_addrs[MAX_SM_TYPES+1]) #endif /* waveforms */ -#define XY566WF 0 /* & Xycom 566 as a waveform */ -#define CAMAC_THING 1 /* !! CAMAC waveform digitizer */ -#define JGVTR1 2 /* & Joerger transient recorder */ -#define COMET 3 /* !! COMET transient recorder */ -#define MAX_WF_TYPES COMET +#define XY566WF 0 /* & Xycom 566 as a waveform */ +#define CAMAC_THING 1 /* !! CAMAC waveform digitizer */ +#define JGVTR1 2 /* & Joerger transient recorder */ +#define COMET 3 /* !! COMET transient recorder */ +#define MAX_WF_TYPES COMET MODULE_TYPES_DEF(short wf_num_cards[MAX_WF_TYPES+1] ) #ifdef MODULE_TYPES_INIT ={4, 4, 8, 4}; @@ -255,10 +255,10 @@ MODULE_TYPES_DEF(long wf_memaddrs[MAX_WF_TYPES+1]) /* timing cards */ -#define MZ8310 0 /* &% Mizar Timing Module */ -#define DG535 1 /* !! GPIB timing instrument */ -#define VXI_AT5_TIME 2 /* !! AT-5 VXI modules timing channels */ -#define MAX_TM_TYPES VXI_AT5_TIME +#define MZ8310 0 /* &% Mizar Timing Module */ +#define DG535 1 /* !! GPIB timing instrument */ +#define VXI_AT5_TIME 2 /* !! AT-5 VXI modules timing channels */ +#define MAX_TM_TYPES VXI_AT5_TIME MODULE_TYPES_DEF(short tm_num_cards[MAX_TM_TYPES+1] ) #ifdef MODULE_TYPES_INIT ={ 4, 1, 32 }; @@ -298,71 +298,71 @@ MODULE_TYPES_DEF(short AT830X_num_cards ) = 2; #endif -/* - * system controller cards. +/* + * system controller cards. * (driver looks for only one card) */ MODULE_TYPES_DEF(long xy010ScA16Base) #ifdef MODULE_TYPES_INIT = 0x0000; #endif -/* - * limit the size of the VXI logical address space +/* + * limit the size of the VXI logical address space * - * = + 0xc000 - * - * LA VME address - * 0 - * EPICS_VXI_LA_COUNT + (EPICS_VXI_LA_COUNT-1)*64 + * = + 0xc000 + * + * LA VME address + * 0 + * EPICS_VXI_LA_COUNT + (EPICS_VXI_LA_COUNT-1)*64 */ MODULE_TYPES_DEF(unsigned char EPICS_VXI_LA_COUNT) #ifdef MODULE_TYPES_INIT - = 32; + = 32; #endif /* * - * address ranges for VXI A24 and A32 devices + * address ranges for VXI A24 and A32 devices * */ MODULE_TYPES_DEF(char *EPICS_VXI_A24_BASE) #ifdef MODULE_TYPES_INIT - = (char *) 0x900000; + = (char *) 0x900000; #endif MODULE_TYPES_DEF(unsigned long EPICS_VXI_A24_SIZE) #ifdef MODULE_TYPES_INIT - = 0x100000; + = 0x100000; #endif MODULE_TYPES_DEF(char *EPICS_VXI_A32_BASE) #ifdef MODULE_TYPES_INIT - = (char *) 0x90000000; + = (char *) 0x90000000; #endif MODULE_TYPES_DEF(unsigned long EPICS_VXI_A32_SIZE) #ifdef MODULE_TYPES_INIT - = 0x10000000; + = 0x10000000; #endif /****************************************************************************** * - * Interrupt vector locations used by the MV167 CPU board. + * Interrupt vector locations used by the MV167 CPU board. * These are defined in mv167.h * - * PCC2_INT_VEC_BASE 0x40 PCC interrupt vector base number - * any multiple of 0x10 - * UTIL_INT_VEC_BASE0 0x50 VMEchip2 utility interrupt - * vector base number - * any multiple of 0x10 - * UTIL_INT_VEC_BASE1 0x60 VMEchip2 utility interrupt - * vector base number - * any multiple of 0x10 + * PCC2_INT_VEC_BASE 0x40 PCC interrupt vector base number + * any multiple of 0x10 + * UTIL_INT_VEC_BASE0 0x50 VMEchip2 utility interrupt + * vector base number + * any multiple of 0x10 + * UTIL_INT_VEC_BASE1 0x60 VMEchip2 utility interrupt + * vector base number + * any multiple of 0x10 * - * INT_VEC_CD2400_A 0x90 int vec for channel A - * INT_VEC_CD2400_B 0x94 int vec for channel B - * INT_VEC_CD2400_C 0x98 int vec for channel C - * INT_VEC_CD2400_D 0x9c int vec for channel D - * - * LANC_IRQ_LEVEL 3 LNANC IRQ level + * INT_VEC_CD2400_A 0x90 int vec for channel A + * INT_VEC_CD2400_B 0x94 int vec for channel B + * INT_VEC_CD2400_C 0x98 int vec for channel C + * INT_VEC_CD2400_D 0x9c int vec for channel D + * + * LANC_IRQ_LEVEL 3 LNANC IRQ level * MPCC_IRQ_LEVEL 4 serial comm IRQ level * SYS_CLK_LEVEL 6 interrupt level for sysClk * AUX_CLK_LEVEL 5 interrupt level for auxClk @@ -373,61 +373,61 @@ MODULE_TYPES_DEF(unsigned long EPICS_VXI_A32_SIZE) /* interrupt vector allocation - one for each XY566 DIL card */ MODULE_TYPES_DEF(int AI566_VNUM) #ifdef MODULE_TYPES_INIT - =0xf8; /* Xycom 566 Differential Latched */ + =0xf8; /* Xycom 566 Differential Latched */ #endif /* interrupt vector allocation - one for each DVX card */ MODULE_TYPES_DEF(int DVX_IVEC0) #ifdef MODULE_TYPES_INIT - =0xd0; + =0xd0; #endif /* stepper motor interrupt vector - one for each motor */ MODULE_TYPES_DEF(int MD_INT_BASE) #ifdef MODULE_TYPES_INIT - =0xf0; /* base of the motor int vector */ + =0xf0; /* base of the motor int vector */ #endif /* I reserve from here up to num_cards * 4 interrupting chans/card - joh */ MODULE_TYPES_DEF(int MZ8310_INT_VEC_BASE) #ifdef MODULE_TYPES_INIT - =0xe8; + =0xe8; #endif /* Allen-Bradley Serial Driver - MAX_AB_LINKS number of vectors */ -MODULE_TYPES_DEF(int AB_VEC_BASE) +MODULE_TYPES_DEF(int AB_VEC_BASE) #ifdef MODULE_TYPES_INIT - =0x60; + =0x60; #endif /* only one interrupt vector allocated for all Joerger VTR1 boards joh */ MODULE_TYPES_DEF(int JGVTR1_INT_VEC) #ifdef MODULE_TYPES_INIT - =0xe0; + =0xe0; #endif /* AT830X_1 cards have 1 intr vector for each AT830X_1_num_cards (presently 2) */ -MODULE_TYPES_DEF(int AT830X_1_IVEC0) +MODULE_TYPES_DEF(int AT830X_1_IVEC0) #ifdef MODULE_TYPES_INIT - =0xd4; + =0xd4; #endif /* AT830X cards have 1 intr vector for each AT830X_num_cards (presently 2) */ -MODULE_TYPES_DEF(int AT830X_IVEC0) +MODULE_TYPES_DEF(int AT830X_IVEC0) #ifdef MODULE_TYPES_INIT - =0xd6; + =0xd6; #endif /* AT8 fast protect interrupt vector base */ -MODULE_TYPES_DEF(int AT8FP_IVEC_BASE) +MODULE_TYPES_DEF(int AT8FP_IVEC_BASE) #ifdef MODULE_TYPES_INIT - =0xa2; + =0xa2; #endif -MODULE_TYPES_DEF(int AT8FPM_IVEC_BASE ) +MODULE_TYPES_DEF(int AT8FPM_IVEC_BASE ) #ifdef MODULE_TYPES_INIT - =0xaa; + =0xaa; #endif @@ -438,16 +438,16 @@ MODULE_TYPES_DEF(int AT8FPM_IVEC_BASE ) ******************************************************************************/ MODULE_TYPES_DEF(unsigned short BB_SHORT_OFF ) #ifdef MODULE_TYPES_INIT - = 0x1800; /* the first address of link 0's region */ + = 0x1800; /* the first address of link 0's region */ #endif #define BB_NUM_LINKS 4 /* max number of BB ports allowed */ MODULE_TYPES_DEF(int BB_IVEC_BASE ) #ifdef MODULE_TYPES_INIT - = 0xa0; /* vectored interrupts (2 used for each link) */ + = 0xa0; /* vectored interrupts (2 used for each link) */ #endif MODULE_TYPES_DEF(int BB_IRQ_LEVEL ) #ifdef MODULE_TYPES_INIT - = 5; /* IRQ level */ + = 5; /* IRQ level */ #endif /****************************************************************************** @@ -457,11 +457,11 @@ MODULE_TYPES_DEF(int BB_IRQ_LEVEL ) ******************************************************************************/ MODULE_TYPES_DEF(unsigned short PEP_BB_SHORT_OFF ) #ifdef MODULE_TYPES_INIT - = 0x1c00; + = 0x1c00; #endif MODULE_TYPES_DEF(int PEP_BB_IVEC_BASE ) #ifdef MODULE_TYPES_INIT - = 0xe8; + = 0xe8; #endif /****************************************************************************** @@ -471,20 +471,20 @@ MODULE_TYPES_DEF(int PEP_BB_IVEC_BASE ) ******************************************************************************/ MODULE_TYPES_DEF(unsigned short NIGPIB_SHORT_OFF) #ifdef MODULE_TYPES_INIT - = 0x5000;/* First address of link 0's region */ + = 0x5000;/* First address of link 0's region */ #endif /* Each link uses 0x0200 bytes */ #define NIGPIB_NUM_LINKS 4 /* Max number of NI GPIB ports allowed */ MODULE_TYPES_DEF(int NIGPIB_IVEC_BASE ) #ifdef MODULE_TYPES_INIT - = 100; /* Vectored interrupts (2 used for each link) */ + = 100; /* Vectored interrupts (2 used for each link) */ #endif MODULE_TYPES_DEF(int NIGPIB_IRQ_LEVEL ) #ifdef MODULE_TYPES_INIT - =5; /* IRQ level */ + =5; /* IRQ level */ #endif -#if 0 /* JRW */ +#if 0 /* JRW */ #define NI1014_LINK_NUM_BASE 0 #endif diff --git a/modules/libcom/src/osi/os/vxWorks/osdEnv.c b/modules/libcom/src/osi/os/vxWorks/osdEnv.c index 47662bc72..4cb2b7d8f 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdEnv.c +++ b/modules/libcom/src/osi/os/vxWorks/osdEnv.c @@ -1,7 +1,7 @@ /*************************************************************************\ * Copyright (c) 2002 The University of Saskatchewan * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* osdEnv.c */ /* @@ -42,7 +42,7 @@ LIBCOM_API void epicsStdCall epicsEnvSet (const char *name, const char *value) } iocshEnvClear(name); - + cp = mallocMustSucceed (strlen (name) + strlen (value) + 2, "epicsEnvSet"); strcpy (cp, name); strcat (cp, "="); diff --git a/modules/libcom/src/osi/os/vxWorks/osdEvent.c b/modules/libcom/src/osi/os/vxWorks/osdEvent.c index 875d4e6f6..3314f26a9 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdEvent.c +++ b/modules/libcom/src/osi/os/vxWorks/osdEvent.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* os/vxWorks/osdEvent.c */ diff --git a/modules/libcom/src/osi/os/vxWorks/osdEvent.h b/modules/libcom/src/osi/os/vxWorks/osdEvent.h index b08b4d98f..93b6d96a9 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdEvent.h +++ b/modules/libcom/src/osi/os/vxWorks/osdEvent.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* os/vxWorks/osdEvent.h */ diff --git a/modules/libcom/src/osi/os/vxWorks/osdFindSymbol.c b/modules/libcom/src/osi/os/vxWorks/osdFindSymbol.c index 2923743c8..624ea220c 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdFindSymbol.c +++ b/modules/libcom/src/osi/os/vxWorks/osdFindSymbol.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* osi/os/vxWorks/osdFindSymbol */ diff --git a/modules/libcom/src/osi/os/vxWorks/osdInterrupt.c b/modules/libcom/src/osi/os/vxWorks/osdInterrupt.c index 3ac9e9e83..6d9ccf1a7 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdInterrupt.c +++ b/modules/libcom/src/osi/os/vxWorks/osdInterrupt.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* osi/os/vxWorks/osdInterrupt.c */ diff --git a/modules/libcom/src/osi/os/vxWorks/osdInterrupt.h b/modules/libcom/src/osi/os/vxWorks/osdInterrupt.h index ad99926de..210e0aea7 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdInterrupt.h +++ b/modules/libcom/src/osi/os/vxWorks/osdInterrupt.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* osi/os/vxWorks/osdInterrupt.h */ diff --git a/modules/libcom/src/osi/os/vxWorks/osdMessageQueue.cpp b/modules/libcom/src/osi/os/vxWorks/osdMessageQueue.cpp index caabc292d..34e82f021 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdMessageQueue.cpp +++ b/modules/libcom/src/osi/os/vxWorks/osdMessageQueue.cpp @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Author W. Eric Norum diff --git a/modules/libcom/src/osi/os/vxWorks/osdMessageQueue.h b/modules/libcom/src/osi/os/vxWorks/osdMessageQueue.h index 87b35bd38..d5aabc59c 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdMessageQueue.h +++ b/modules/libcom/src/osi/os/vxWorks/osdMessageQueue.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Author W. Eric Norum diff --git a/modules/libcom/src/osi/os/vxWorks/osdMutex.c b/modules/libcom/src/osi/os/vxWorks/osdMutex.c index 38db2ab83..27f591907 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdMutex.c +++ b/modules/libcom/src/osi/os/vxWorks/osdMutex.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* os/vxWorks/osdMutex.c */ diff --git a/modules/libcom/src/osi/os/vxWorks/osdMutex.h b/modules/libcom/src/osi/os/vxWorks/osdMutex.h index 3ea951a8f..9af13075f 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdMutex.h +++ b/modules/libcom/src/osi/os/vxWorks/osdMutex.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* os/vxWorks/osdMutex.h */ diff --git a/modules/libcom/src/osi/os/vxWorks/osdPoolStatus.c b/modules/libcom/src/osi/os/vxWorks/osdPoolStatus.c index 969a03c1c..6064a5ad8 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdPoolStatus.c +++ b/modules/libcom/src/osi/os/vxWorks/osdPoolStatus.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include @@ -13,9 +13,9 @@ #include "epicsThread.h" #include "osiPoolStatus.h" -/* +/* * It turns out that memPartInfoGet() and memFindMax() are very CPU intensive on vxWorks - * so we must spawn off a thread that periodically polls. Although this isnt 100% safe, I + * so we must spawn off a thread that periodically polls. Although this isnt 100% safe, I * dont see what else to do. * * It takes about 30 uS to call memPartInfoGet() on a pcPentium I vxWorks system. @@ -52,7 +52,7 @@ static void osdSufficentSpaceInPoolInit ( void *pArgIn ) } /* - * osiSufficentSpaceInPool () + * osiSufficentSpaceInPool () */ LIBCOM_API int epicsStdCall osiSufficentSpaceInPool ( size_t contiguousBlockSize ) { diff --git a/modules/libcom/src/osi/os/vxWorks/osdProcess.c b/modules/libcom/src/osi/os/vxWorks/osdProcess.c index 6058bfae2..ae8348987 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdProcess.c +++ b/modules/libcom/src/osi/os/vxWorks/osdProcess.c @@ -4,10 +4,10 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* +/* * Operating System Dependent Implementation of osiProcess.h * * Author: Jeff Hill @@ -27,11 +27,11 @@ LIBCOM_API osiGetUserNameReturn epicsStdCall osiGetUserName (char *pBuf, unsigned bufSizeIn) { - char pName[MAX_IDENTITY_LEN]; + char pName[MAX_IDENTITY_LEN]; unsigned uiLength; size_t len; - remCurIdGet ( pName, NULL ); + remCurIdGet ( pName, NULL ); len = strlen ( pName ); if (len>UINT_MAX || len<=0) { diff --git a/modules/libcom/src/osi/os/vxWorks/osdReadline.c b/modules/libcom/src/osi/os/vxWorks/osdReadline.c index dee24fd64..e7cd6242c 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdReadline.c +++ b/modules/libcom/src/osi/os/vxWorks/osdReadline.c @@ -69,7 +69,7 @@ osdReadline (const char *prompt, struct readlineContext *context) fflush(stdout); } if (osd->ledId != (LED_ID) ERROR) { - i = ledRead(osd->ledId, osd->line, LEDLIB_LINESIZE-1); + i = ledRead(osd->ledId, osd->line, LEDLIB_LINESIZE-1); if (i < 0) return NULL; } diff --git a/modules/libcom/src/osi/os/vxWorks/osdSignal.cpp b/modules/libcom/src/osi/os/vxWorks/osdSignal.cpp index b06192175..f7594faf1 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdSignal.cpp +++ b/modules/libcom/src/osi/os/vxWorks/osdSignal.cpp @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found - * in file LICENSE that is included with this distribution. + * in file LICENSE that is included with this distribution. \*************************************************************************/ #include "epicsSignal.h" diff --git a/modules/libcom/src/osi/os/vxWorks/osdSock.c b/modules/libcom/src/osi/os/vxWorks/osdSock.c index 2de74453b..72f6b87c8 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdSock.c +++ b/modules/libcom/src/osi/os/vxWorks/osdSock.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* This is needed for vxWorks 6.8 to prevent an obnoxious compiler warning */ @@ -59,7 +59,7 @@ LIBCOM_API void epicsStdCall epicsSocketDestroy ( SOCKET s ) if ( status < 0 ) { char buf [ 64 ]; epicsSocketConvertErrnoToString ( buf, sizeof ( buf ) ); - errlogPrintf ( + errlogPrintf ( "epicsSocketDestroy: failed to " "close a socket because \"%s\"\n", buf ); @@ -72,17 +72,17 @@ LIBCOM_API void epicsStdCall epicsSocketDestroy ( SOCKET s ) LIBCOM_API unsigned epicsStdCall ipAddrToHostName (const struct in_addr *pAddr, char *pBuf, unsigned bufSize) { - int status; - int errnoCopy = errno; + int status; + int errnoCopy = errno; unsigned len; - if (bufSize<1) { - return 0; - } + if (bufSize<1) { + return 0; + } if (bufSize>MAXHOSTNAMELEN) { - status = hostGetByAddr ((int)pAddr->s_addr, pBuf); - if (status==OK) { + status = hostGetByAddr ((int)pAddr->s_addr, pBuf); + if (status==OK) { pBuf[MAXHOSTNAMELEN] = '\0'; len = strlen (pBuf); } @@ -91,19 +91,19 @@ LIBCOM_API unsigned epicsStdCall ipAddrToHostName } } else { - char name[MAXHOSTNAMELEN+1]; - status = hostGetByAddr (pAddr->s_addr, name); - if (status==OK) { + char name[MAXHOSTNAMELEN+1]; + status = hostGetByAddr (pAddr->s_addr, name); + if (status==OK) { strncpy (pBuf, name, bufSize); pBuf[bufSize-1] = '\0'; len = strlen (pBuf); - } + } else { len = 0; } } - errno = errnoCopy; + errno = errnoCopy; return len; } diff --git a/modules/libcom/src/osi/os/vxWorks/osdSock.h b/modules/libcom/src/osi/os/vxWorks/osdSock.h index 4e5e94ea4..871884339 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdSock.h +++ b/modules/libcom/src/osi/os/vxWorks/osdSock.h @@ -46,7 +46,7 @@ int sysClkRateGet(void); #endif typedef int SOCKET; -#define INVALID_SOCKET (-1) +#define INVALID_SOCKET (-1) #define SOCKERRNO errno #ifndef SHUT_RD # define SHUT_RD 0 diff --git a/modules/libcom/src/osi/os/vxWorks/osdStdio.c b/modules/libcom/src/osi/os/vxWorks/osdStdio.c index 20664a1a4..63df82b2e 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdStdio.c +++ b/modules/libcom/src/osi/os/vxWorks/osdStdio.c @@ -23,7 +23,7 @@ static STATUS outRoutine(char *buffer, size_t nchars, int outarg) { struct outStr_s *poutStr = (struct outStr_s *) outarg; size_t free = poutStr->free; size_t len; - + if (free < 1) { /*let fioFormatV continue to count length*/ return OK; } else if (free > 1) { @@ -39,7 +39,7 @@ static STATUS outRoutine(char *buffer, size_t nchars, int outarg) { int epicsVsnprintf(char *str, size_t size, const char *format, va_list ap) { struct outStr_s outStr; - + outStr.str = str; outStr.free = size; return fioFormatV(format, ap, outRoutine, (int) &outStr); diff --git a/modules/libcom/src/osi/os/vxWorks/osdThread.c b/modules/libcom/src/osi/os/vxWorks/osdThread.c index 32208fb3f..f97b2d840 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdThread.c +++ b/modules/libcom/src/osi/os/vxWorks/osdThread.c @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * Copyright (c) 2012 ITER Organization * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* osi/os/vxWorks/epicsThread.c */ @@ -59,7 +59,7 @@ LIBCOM_API void osdThreadHooksRun(epicsThreadId id); #else #define ARCH_STACK_FACTOR 2 #endif -static const unsigned stackSizeTable[epicsThreadStackBig+1] = +static const unsigned stackSizeTable[epicsThreadStackBig+1] = {4000*ARCH_STACK_FACTOR, 6000*ARCH_STACK_FACTOR, 11000*ARCH_STACK_FACTOR}; /* Table and lock for epicsThreadMap() */ @@ -83,7 +83,7 @@ static SEM_ID epicsThreadOnceMutex = 0; /* osi = 199 - vx */ static unsigned int getOsiPriorityValue(int ossPriority) -{ +{ if ( ossPriority < 100 ) { return epicsThreadPriorityMax; } @@ -134,7 +134,7 @@ static void epicsThreadInit(void) void epicsThreadRealtimeLock(void) {} -unsigned int epicsThreadGetStackSize (epicsThreadStackSizeClass stackSizeClass) +unsigned int epicsThreadGetStackSize (epicsThreadStackSizeClass stackSizeClass) { if (stackSizeClass diff --git a/modules/libcom/src/osi/os/vxWorks/osdVME.h b/modules/libcom/src/osi/os/vxWorks/osdVME.h index b9d031a04..f3bebd06e 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdVME.h +++ b/modules/libcom/src/osi/os/vxWorks/osdVME.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* diff --git a/modules/libcom/src/osi/os/vxWorks/osiFileName.h b/modules/libcom/src/osi/os/vxWorks/osiFileName.h index 3a6448d54..a38980230 100644 --- a/modules/libcom/src/osi/os/vxWorks/osiFileName.h +++ b/modules/libcom/src/osi/os/vxWorks/osiFileName.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * osiFileName.h diff --git a/modules/libcom/src/osi/os/vxWorks/strtoll.c b/modules/libcom/src/osi/os/vxWorks/strtoll.c index 54e0a9522..a851512c4 100644 --- a/modules/libcom/src/osi/os/vxWorks/strtoll.c +++ b/modules/libcom/src/osi/os/vxWorks/strtoll.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. + * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -46,94 +46,94 @@ long long strtoll(const char * __restrict nptr, char ** __restrict endptr, int base) { - const char *s; - unsigned long long acc; - char c; - unsigned long long cutoff; - int neg, any, cutlim; + const char *s; + unsigned long long acc; + char c; + unsigned long long cutoff; + int neg, any, cutlim; - /* - * Skip white space and pick up leading +/- sign if any. - * If base is 0, allow 0x for hex and 0 for octal, else - * assume decimal; if base is already 16, allow 0x. - */ - s = nptr; - do { - c = *s++; - } while (isspace((unsigned char)c)); - if (c == '-') { - neg = 1; - c = *s++; - } else { - neg = 0; - if (c == '+') - c = *s++; - } - if ((base == 0 || base == 16) && - c == '0' && (*s == 'x' || *s == 'X') && - ((s[1] >= '0' && s[1] <= '9') || - (s[1] >= 'A' && s[1] <= 'F') || - (s[1] >= 'a' && s[1] <= 'f'))) { - c = s[1]; - s += 2; - base = 16; - } - if (base == 0) - base = c == '0' ? 8 : 10; - acc = any = 0; - if (base < 2 || base > 36) - goto noconv; + /* + * Skip white space and pick up leading +/- sign if any. + * If base is 0, allow 0x for hex and 0 for octal, else + * assume decimal; if base is already 16, allow 0x. + */ + s = nptr; + do { + c = *s++; + } while (isspace((unsigned char)c)); + if (c == '-') { + neg = 1; + c = *s++; + } else { + neg = 0; + if (c == '+') + c = *s++; + } + if ((base == 0 || base == 16) && + c == '0' && (*s == 'x' || *s == 'X') && + ((s[1] >= '0' && s[1] <= '9') || + (s[1] >= 'A' && s[1] <= 'F') || + (s[1] >= 'a' && s[1] <= 'f'))) { + c = s[1]; + s += 2; + base = 16; + } + if (base == 0) + base = c == '0' ? 8 : 10; + acc = any = 0; + if (base < 2 || base > 36) + goto noconv; - /* - * Compute the cutoff value between legal numbers and illegal - * numbers. That is the largest legal value, divided by the - * base. An input number that is greater than this value, if - * followed by a legal input character, is too big. One that - * is equal to this value may be valid or not; the limit - * between valid and invalid numbers is then based on the last - * digit. For instance, if the range for quads is - * [-9223372036854775808..9223372036854775807] and the input base - * is 10, cutoff will be set to 922337203685477580 and cutlim to - * either 7 (neg==0) or 8 (neg==1), meaning that if we have - * accumulated a value > 922337203685477580, or equal but the - * next digit is > 7 (or 8), the number is too big, and we will - * return a range error. - * - * Set 'any' if any `digits' consumed; make it negative to indicate - * overflow. - */ - cutoff = neg ? (unsigned long long)-(LLONG_MIN + LLONG_MAX) + LLONG_MAX - : LLONG_MAX; - cutlim = cutoff % base; - cutoff /= base; - for ( ; ; c = *s++) { - if (c >= '0' && c <= '9') - c -= '0'; - else if (c >= 'A' && c <= 'Z') - c -= 'A' - 10; - else if (c >= 'a' && c <= 'z') - c -= 'a' - 10; - else - break; - if (c >= base) - break; - if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) - any = -1; - else { - any = 1; - acc *= base; - acc += c; - } - } - if (any < 0) { - acc = neg ? LLONG_MIN : LLONG_MAX; - errno = ERANGE; - } else if (!any) { + /* + * Compute the cutoff value between legal numbers and illegal + * numbers. That is the largest legal value, divided by the + * base. An input number that is greater than this value, if + * followed by a legal input character, is too big. One that + * is equal to this value may be valid or not; the limit + * between valid and invalid numbers is then based on the last + * digit. For instance, if the range for quads is + * [-9223372036854775808..9223372036854775807] and the input base + * is 10, cutoff will be set to 922337203685477580 and cutlim to + * either 7 (neg==0) or 8 (neg==1), meaning that if we have + * accumulated a value > 922337203685477580, or equal but the + * next digit is > 7 (or 8), the number is too big, and we will + * return a range error. + * + * Set 'any' if any `digits' consumed; make it negative to indicate + * overflow. + */ + cutoff = neg ? (unsigned long long)-(LLONG_MIN + LLONG_MAX) + LLONG_MAX + : LLONG_MAX; + cutlim = cutoff % base; + cutoff /= base; + for ( ; ; c = *s++) { + if (c >= '0' && c <= '9') + c -= '0'; + else if (c >= 'A' && c <= 'Z') + c -= 'A' - 10; + else if (c >= 'a' && c <= 'z') + c -= 'a' - 10; + else + break; + if (c >= base) + break; + if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) + any = -1; + else { + any = 1; + acc *= base; + acc += c; + } + } + if (any < 0) { + acc = neg ? LLONG_MIN : LLONG_MAX; + errno = ERANGE; + } else if (!any) { noconv: - errno = EINVAL; - } else if (neg) - acc = -acc; - if (endptr != NULL) - *endptr = (char *)(any ? s - 1 : nptr); - return (acc); + errno = EINVAL; + } else if (neg) + acc = -acc; + if (endptr != NULL) + *endptr = (char *)(any ? s - 1 : nptr); + return (acc); } diff --git a/modules/libcom/src/osi/os/vxWorks/strtoull.c b/modules/libcom/src/osi/os/vxWorks/strtoull.c index 197a45bcf..949772f18 100644 --- a/modules/libcom/src/osi/os/vxWorks/strtoull.c +++ b/modules/libcom/src/osi/os/vxWorks/strtoull.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. + * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -45,72 +45,72 @@ unsigned long long strtoull(const char * __restrict nptr, char ** __restrict endptr, int base) { - const char *s; - unsigned long long acc; - char c; - unsigned long long cutoff; - int neg, any, cutlim; + const char *s; + unsigned long long acc; + char c; + unsigned long long cutoff; + int neg, any, cutlim; - /* - * See strtoq for comments as to the logic used. - */ - s = nptr; - do { - c = *s++; - } while (isspace((unsigned char)c)); - if (c == '-') { - neg = 1; - c = *s++; - } else { - neg = 0; - if (c == '+') - c = *s++; - } - if ((base == 0 || base == 16) && - c == '0' && (*s == 'x' || *s == 'X') && - ((s[1] >= '0' && s[1] <= '9') || - (s[1] >= 'A' && s[1] <= 'F') || - (s[1] >= 'a' && s[1] <= 'f'))) { - c = s[1]; - s += 2; - base = 16; - } - if (base == 0) - base = c == '0' ? 8 : 10; - acc = any = 0; - if (base < 2 || base > 36) - goto noconv; + /* + * See strtoq for comments as to the logic used. + */ + s = nptr; + do { + c = *s++; + } while (isspace((unsigned char)c)); + if (c == '-') { + neg = 1; + c = *s++; + } else { + neg = 0; + if (c == '+') + c = *s++; + } + if ((base == 0 || base == 16) && + c == '0' && (*s == 'x' || *s == 'X') && + ((s[1] >= '0' && s[1] <= '9') || + (s[1] >= 'A' && s[1] <= 'F') || + (s[1] >= 'a' && s[1] <= 'f'))) { + c = s[1]; + s += 2; + base = 16; + } + if (base == 0) + base = c == '0' ? 8 : 10; + acc = any = 0; + if (base < 2 || base > 36) + goto noconv; - cutoff = ULLONG_MAX / base; - cutlim = ULLONG_MAX % base; - for ( ; ; c = *s++) { - if (c >= '0' && c <= '9') - c -= '0'; - else if (c >= 'A' && c <= 'Z') - c -= 'A' - 10; - else if (c >= 'a' && c <= 'z') - c -= 'a' - 10; - else - break; - if (c >= base) - break; - if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) - any = -1; - else { - any = 1; - acc *= base; - acc += c; - } - } - if (any < 0) { - acc = ULLONG_MAX; - errno = ERANGE; - } else if (!any) { + cutoff = ULLONG_MAX / base; + cutlim = ULLONG_MAX % base; + for ( ; ; c = *s++) { + if (c >= '0' && c <= '9') + c -= '0'; + else if (c >= 'A' && c <= 'Z') + c -= 'A' - 10; + else if (c >= 'a' && c <= 'z') + c -= 'a' - 10; + else + break; + if (c >= base) + break; + if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) + any = -1; + else { + any = 1; + acc *= base; + acc += c; + } + } + if (any < 0) { + acc = ULLONG_MAX; + errno = ERANGE; + } else if (!any) { noconv: - errno = EINVAL; - } else if (neg) - acc = -acc; - if (endptr != NULL) - *endptr = (char *)(any ? s - 1 : nptr); - return (acc); + errno = EINVAL; + } else if (neg) + acc = -acc; + if (endptr != NULL) + *endptr = (char *)(any ? s - 1 : nptr); + return (acc); } diff --git a/modules/libcom/src/osi/os/vxWorks/task_params.h b/modules/libcom/src/osi/os/vxWorks/task_params.h index 7b2055157..c8c7cc8bd 100644 --- a/modules/libcom/src/osi/os/vxWorks/task_params.h +++ b/modules/libcom/src/osi/os/vxWorks/task_params.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* Parameters for tasks on IOC */ @@ -14,132 +14,132 @@ * Date: 2-24-89 */ -#ifndef INCtaskLibh -#include +#ifndef INCtaskLibh +#include #endif #define VXTASKIDSELF 0 /* Task Names */ -#define EVENTSCAN_NAME "scanEvent" -#define SCANONCE_NAME "scanOnce" -#define SMCMD_NAME "smCommand" -#define SMRESP_NAME "smResponse" -#define ABDONE_NAME "abDone" -#define ABSCAN_NAME "abScan" +#define EVENTSCAN_NAME "scanEvent" +#define SCANONCE_NAME "scanOnce" +#define SMCMD_NAME "smCommand" +#define SMRESP_NAME "smResponse" +#define ABDONE_NAME "abDone" +#define ABSCAN_NAME "abScan" #define ABCOS_NAME "abBiCosScanner" -#define MOMENTARY_NAME "momentary" -#define WFDONE_NAME "wfDone" -#define SEQUENCER_NAME "sequencer" +#define MOMENTARY_NAME "momentary" +#define WFDONE_NAME "wfDone" +#define SEQUENCER_NAME "sequencer" #define BKPT_CONT_NAME "bkptCont" -#define SCANNER_NAME "scanner" -#define REQ_SRVR_NAME "CA_TCP" -#define CA_CLIENT_NAME "CA_client" -#define CA_EVENT_NAME "CA_event" -#define CAST_SRVR_NAME "CA_UDP" -#define CA_REPEATER_NAME "CA_repeater" -#define CA_ONLINE_NAME "CA_online" -#define TASKWD_NAME "taskwd" -#define SMIOTEST_NAME "smInout" -#define SMROTTEST_NAME "smRotate" -#define EVENT_PEND_NAME "event_task" +#define SCANNER_NAME "scanner" +#define REQ_SRVR_NAME "CA_TCP" +#define CA_CLIENT_NAME "CA_client" +#define CA_EVENT_NAME "CA_event" +#define CAST_SRVR_NAME "CA_UDP" +#define CA_REPEATER_NAME "CA_repeater" +#define CA_ONLINE_NAME "CA_online" +#define TASKWD_NAME "taskwd" +#define SMIOTEST_NAME "smInout" +#define SMROTTEST_NAME "smRotate" +#define EVENT_PEND_NAME "event_task" #define XY240_NAME "xy_240_scan" -#define GPIBLINK_NAME "gpibLink" -#define BBLINK_NAME "bbLinkTask" -#define BBTXLINK_NAME "bbTx" -#define BBRXLINK_NAME "bbRx" -#define BBWDTASK_NAME "bbwd" -#define ERRLOG_NAME "errlog" -#define LOG_RESTART_NAME "logRestart" +#define GPIBLINK_NAME "gpibLink" +#define BBLINK_NAME "bbLinkTask" +#define BBTXLINK_NAME "bbTx" +#define BBRXLINK_NAME "bbRx" +#define BBWDTASK_NAME "bbwd" +#define ERRLOG_NAME "errlog" +#define LOG_RESTART_NAME "logRestart" /* Task priorities */ -#define SCANONCE_PRI 129 /* scan one time */ +#define SCANONCE_PRI 129 /* scan one time */ /*DO NOT RUN ANY RECORD PROCESSING TASKS AT HIGHER PRIORITY THAN _netTask=50*/ -#define CALLBACK_PRI_LOW 140 /* callback task - generall callback task */ -#define CALLBACK_PRI_MEDIUM 135 /* callback task - generall callback task */ -#define CALLBACK_PRI_HIGH 128 /* callback task - generall callback task */ +#define CALLBACK_PRI_LOW 140 /* callback task - generall callback task */ +#define CALLBACK_PRI_MEDIUM 135 /* callback task - generall callback task */ +#define CALLBACK_PRI_HIGH 128 /* callback task - generall callback task */ #define EVENTSCAN_PRI 129 /* Event Scanner - Runs on a global event */ -#define SMCMD_PRI 120 /* Stepper Motor Command Task - Waits for cmds */ +#define SMCMD_PRI 120 /* Stepper Motor Command Task - Waits for cmds */ #define SMRESP_PRI 121 /* Stepper Motor Resp Task - Waits for resps */ #define ABCOS_PRI 121 /* Allen-Bradley Binary Input COS io_event wakeup */ #define ABDONE_PRI 122 /* Allen-Bradley Resp Task - Interrupt Driven */ #define ABSCAN_PRI 123 /* Allen-Bradley Scan Task - Base Rate .1 secs */ -#define BBLINK_PRI 124 -#define BBWDTASK_PRI 123 /* BitBus watchdog task */ -#define BBRXLINK_PRI 124 /* BitBus link task */ -#define BBTXLINK_PRI 125 /* BitBus link task */ -#define GPIBLINK_PRI 125 /* GPIB link task */ +#define BBLINK_PRI 124 +#define BBWDTASK_PRI 123 /* BitBus watchdog task */ +#define BBRXLINK_PRI 124 /* BitBus link task */ +#define BBTXLINK_PRI 125 /* BitBus link task */ +#define GPIBLINK_PRI 125 /* GPIB link task */ #define MOMENTARY_PRI 126 /* Momentary output - posted from watchdog */ #define WFDONE_PRI 127 /* Waveform Task - Base Rate of .1 second */ -#define PERIODSCAN_PRI 139 /* Periodic Scanners - Slowest rate */ -#define DB_CA_PRI 149 /*database to channel access*/ -#define SEQUENCER_PRI 151 +#define PERIODSCAN_PRI 139 /* Periodic Scanners - Slowest rate */ +#define DB_CA_PRI 149 /*database to channel access*/ +#define SEQUENCER_PRI 151 #define XY240_PRI 160 /* xy 240 dio scanner */ -#define SCANNER_PRI 170 -#define REQ_SRVR_PRI 181 /* Channel Access TCP request server*/ -#define CA_CLIENT_PRI 180 /* Channel Access clients */ -#define CA_REPEATER_PRI 181 /* Channel Access repeater */ -#define ERRLOG_PRI CA_REPEATER_PRI /*error logger task*/ -#define CAST_SRVR_PRI 182 /* Channel Access broadcast server */ -#define CA_ONLINE_PRI 183 /* Channel Access server online notify */ +#define SCANNER_PRI 170 +#define REQ_SRVR_PRI 181 /* Channel Access TCP request server*/ +#define CA_CLIENT_PRI 180 /* Channel Access clients */ +#define CA_REPEATER_PRI 181 /* Channel Access repeater */ +#define ERRLOG_PRI CA_REPEATER_PRI /*error logger task*/ +#define CAST_SRVR_PRI 182 /* Channel Access broadcast server */ +#define CA_ONLINE_PRI 183 /* Channel Access server online notify */ #define TASKWD_PRI 200 /* Watchdog Scan Task - runs every 6 seconds */ #define SMIOTEST_PRI 205 /* Stepper Mtr in/out test - runs every .1 sec */ #define SMROTTEST_PRI 205 /* Stepper Mtr rotate test - runs every .1 sec */ -#define LOG_RESTART_PRI 200 /* Log server connection watch dog */ +#define LOG_RESTART_PRI 200 /* Log server connection watch dog */ /* Task delay times (seconds) */ #define TASKWD_DELAY 6 /* Task delay times (tics) */ #define ABSCAN_RATE (sysClkRateGet()/6) -#define SEQUENCER_DELAY (sysClkRateGet()/5) -#define SCANNER_DELAY (sysClkRateGet()/5) -#define CA_ONLINE_DELAY (sysClkRateGet()*15) -#define LOG_RESTART_DELAY (sysClkRateGet()*30) +#define SEQUENCER_DELAY (sysClkRateGet()/5) +#define SCANNER_DELAY (sysClkRateGet()/5) +#define CA_ONLINE_DELAY (sysClkRateGet()*15) +#define LOG_RESTART_DELAY (sysClkRateGet()*30) /* Task creation options */ -#define ERRLOG_OPT VX_FP_TASK -#define EVENTSCAN_OPT VX_FP_TASK -#define SCANONCE_OPT VX_FP_TASK -#define CALLBACK_OPT VX_FP_TASK -#define SMCMD_OPT VX_FP_TASK -#define SMRESP_OPT VX_FP_TASK -#define ABDONE_OPT VX_FP_TASK +#define ERRLOG_OPT VX_FP_TASK +#define EVENTSCAN_OPT VX_FP_TASK +#define SCANONCE_OPT VX_FP_TASK +#define CALLBACK_OPT VX_FP_TASK +#define SMCMD_OPT VX_FP_TASK +#define SMRESP_OPT VX_FP_TASK +#define ABDONE_OPT VX_FP_TASK #define ABCOS_OPT VX_FP_TASK -#define ABSCAN_OPT VX_FP_TASK -#define MOMENTARY_OPT VX_FP_TASK +#define ABSCAN_OPT VX_FP_TASK +#define MOMENTARY_OPT VX_FP_TASK #define PERIODSCAN_OPT VX_FP_TASK #define WFDONE_OPT VX_FP_TASK -#define SEQUENCER_OPT VX_FP_TASK | VX_STDIO +#define SEQUENCER_OPT VX_FP_TASK | VX_STDIO #define BKPT_CONT_OPT VX_FP_TASK -#define SCANNER_OPT VX_FP_TASK -#define REQ_SRVR_OPT VX_FP_TASK -#define CAST_SRVR_OPT VX_FP_TASK -#define CA_CLIENT_OPT VX_FP_TASK -#define CA_REPEATER_OPT VX_FP_TASK -#define CA_ONLINE_OPT VX_FP_TASK -#define TASKWD_OPT VX_FP_TASK -#define SMIOTEST_OPT VX_FP_TASK -#define SMROTTEST_OPT VX_FP_TASK -#define EVENT_PEND_OPT VX_FP_TASK -#define GPIBLINK_OPT VX_FP_TASK|VX_STDIO -#define BBLINK_OPT VX_FP_TASK|VX_STDIO -#define BBTXLINK_OPT VX_FP_TASK|VX_STDIO -#define BBRXLINK_OPT VX_FP_TASK|VX_STDIO -#define BBWDTASK_OPT VX_FP_TASK|VX_STDIO +#define SCANNER_OPT VX_FP_TASK +#define REQ_SRVR_OPT VX_FP_TASK +#define CAST_SRVR_OPT VX_FP_TASK +#define CA_CLIENT_OPT VX_FP_TASK +#define CA_REPEATER_OPT VX_FP_TASK +#define CA_ONLINE_OPT VX_FP_TASK +#define TASKWD_OPT VX_FP_TASK +#define SMIOTEST_OPT VX_FP_TASK +#define SMROTTEST_OPT VX_FP_TASK +#define EVENT_PEND_OPT VX_FP_TASK +#define GPIBLINK_OPT VX_FP_TASK|VX_STDIO +#define BBLINK_OPT VX_FP_TASK|VX_STDIO +#define BBTXLINK_OPT VX_FP_TASK|VX_STDIO +#define BBRXLINK_OPT VX_FP_TASK|VX_STDIO +#define BBWDTASK_OPT VX_FP_TASK|VX_STDIO #define DB_CA_OPT (VX_FP_TASK | VX_STDIO) #define XY_240_OPT (0) /* none */ -#define LOG_RESTART_OPT (VX_FP_TASK) +#define LOG_RESTART_OPT (VX_FP_TASK) -/* - * Task stack sizes +/* + * Task stack sizes * * (original stack sizes are appropriate for the 68k) * ARCH_STACK_FACTOR allows scaling the stacks on particular - * processor architectures + * processor architectures */ -#if CPU_FAMILY == MC680X0 +#if CPU_FAMILY == MC680X0 #define ARCH_STACK_FACTOR 1 #elif CPU_FAMILY == SPARC #define ARCH_STACK_FACTOR 2 @@ -147,38 +147,38 @@ #define ARCH_STACK_FACTOR 2 #endif -#define ERRLOG_STACK (4000*ARCH_STACK_FACTOR) -#define EVENTSCAN_STACK (11000*ARCH_STACK_FACTOR) -#define SCANONCE_STACK (11000*ARCH_STACK_FACTOR) -#define CALLBACK_STACK (11000*ARCH_STACK_FACTOR) -#define SMCMD_STACK (3000*ARCH_STACK_FACTOR) -#define SMRESP_STACK (3000*ARCH_STACK_FACTOR) -#define ABCOS_STACK (3000*ARCH_STACK_FACTOR) -#define ABDONE_STACK (3000*ARCH_STACK_FACTOR) -#define ABSCAN_STACK (3000*ARCH_STACK_FACTOR) -#define MOMENTARY_STACK (2000*ARCH_STACK_FACTOR) -#define PERIODSCAN_STACK (11000*ARCH_STACK_FACTOR) -#define WFDONE_STACK (9000*ARCH_STACK_FACTOR) -#define SEQUENCER_STACK (5500*ARCH_STACK_FACTOR) +#define ERRLOG_STACK (4000*ARCH_STACK_FACTOR) +#define EVENTSCAN_STACK (11000*ARCH_STACK_FACTOR) +#define SCANONCE_STACK (11000*ARCH_STACK_FACTOR) +#define CALLBACK_STACK (11000*ARCH_STACK_FACTOR) +#define SMCMD_STACK (3000*ARCH_STACK_FACTOR) +#define SMRESP_STACK (3000*ARCH_STACK_FACTOR) +#define ABCOS_STACK (3000*ARCH_STACK_FACTOR) +#define ABDONE_STACK (3000*ARCH_STACK_FACTOR) +#define ABSCAN_STACK (3000*ARCH_STACK_FACTOR) +#define MOMENTARY_STACK (2000*ARCH_STACK_FACTOR) +#define PERIODSCAN_STACK (11000*ARCH_STACK_FACTOR) +#define WFDONE_STACK (9000*ARCH_STACK_FACTOR) +#define SEQUENCER_STACK (5500*ARCH_STACK_FACTOR) #define BKPT_CONT_STACK (11000*ARCH_STACK_FACTOR) -#define SCANNER_STACK (3048*ARCH_STACK_FACTOR) -#define RSP_SRVR_STACK (5096*ARCH_STACK_FACTOR) -#define REQ_SRVR_STACK (5096*ARCH_STACK_FACTOR) -#define CAST_SRVR_STACK (5096*ARCH_STACK_FACTOR) -#define CA_CLIENT_STACK (11000*ARCH_STACK_FACTOR) -#define CA_REPEATER_STACK (5096*ARCH_STACK_FACTOR) -#define CA_ONLINE_STACK (3048*ARCH_STACK_FACTOR) -#define TASKWD_STACK (2000*ARCH_STACK_FACTOR) -#define SMIOTEST_STACK (2000*ARCH_STACK_FACTOR) -#define SMROTTEST_STACK (2000*ARCH_STACK_FACTOR) -#define EVENT_PEND_STACK (5096*ARCH_STACK_FACTOR) -#define TIMESTAMP_STACK (4000*ARCH_STACK_FACTOR) -#define GPIBLINK_STACK (5000*ARCH_STACK_FACTOR) -#define BBLINK_STACK (5000*ARCH_STACK_FACTOR) -#define BBRXLINK_STACK (5000*ARCH_STACK_FACTOR) -#define BBTXLINK_STACK (5000*ARCH_STACK_FACTOR) -#define BBWDTASK_STACK (5000*ARCH_STACK_FACTOR) -#define DB_CA_STACK (11000*ARCH_STACK_FACTOR) +#define SCANNER_STACK (3048*ARCH_STACK_FACTOR) +#define RSP_SRVR_STACK (5096*ARCH_STACK_FACTOR) +#define REQ_SRVR_STACK (5096*ARCH_STACK_FACTOR) +#define CAST_SRVR_STACK (5096*ARCH_STACK_FACTOR) +#define CA_CLIENT_STACK (11000*ARCH_STACK_FACTOR) +#define CA_REPEATER_STACK (5096*ARCH_STACK_FACTOR) +#define CA_ONLINE_STACK (3048*ARCH_STACK_FACTOR) +#define TASKWD_STACK (2000*ARCH_STACK_FACTOR) +#define SMIOTEST_STACK (2000*ARCH_STACK_FACTOR) +#define SMROTTEST_STACK (2000*ARCH_STACK_FACTOR) +#define EVENT_PEND_STACK (5096*ARCH_STACK_FACTOR) +#define TIMESTAMP_STACK (4000*ARCH_STACK_FACTOR) +#define GPIBLINK_STACK (5000*ARCH_STACK_FACTOR) +#define BBLINK_STACK (5000*ARCH_STACK_FACTOR) +#define BBRXLINK_STACK (5000*ARCH_STACK_FACTOR) +#define BBTXLINK_STACK (5000*ARCH_STACK_FACTOR) +#define BBWDTASK_STACK (5000*ARCH_STACK_FACTOR) +#define DB_CA_STACK (11000*ARCH_STACK_FACTOR) #define XY_240_STACK (4096*ARCH_STACK_FACTOR) -#define LOG_RESTART_STACK (0x1000*ARCH_STACK_FACTOR) +#define LOG_RESTART_STACK (0x1000*ARCH_STACK_FACTOR) diff --git a/modules/libcom/src/osi/os/vxWorks/veclist.c b/modules/libcom/src/osi/os/vxWorks/veclist.c index 2a4e617ef..21c615710 100644 --- a/modules/libcom/src/osi/os/vxWorks/veclist.c +++ b/modules/libcom/src/osi/os/vxWorks/veclist.c @@ -5,14 +5,14 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* - * list fuctions attached to the interrupt vector table + * list fuctions attached to the interrupt vector table * - * Created 28Mar89 Jeffrey O. Hill - * johill@lanl.gov - * (505) 665 1831 + * Created 28Mar89 Jeffrey O. Hill + * johill@lanl.gov + * (505) 665 1831 * */ @@ -34,9 +34,9 @@ static char *ignore_list[] = {"_excStub","_excIntStub"}; -int veclist(int); -int cISRTest(FUNCPTR proutine, FUNCPTR *ppisr, void **pparam); -static void *fetch_pointer(unsigned char *); +int veclist(int); +int cISRTest(FUNCPTR proutine, FUNCPTR *ppisr, void **pparam); +static void *fetch_pointer(unsigned char *); /* @@ -46,66 +46,66 @@ static void *fetch_pointer(unsigned char *); */ int veclist(int all) { - int vec; - int value; - SYM_TYPE type; - char name[MAX_SYS_SYM_LEN]; - char function_type[10]; - FUNCPTR proutine; - FUNCPTR pCISR; - int cRoutine; - void *pparam; - int status; - unsigned i; + int vec; + int value; + SYM_TYPE type; + char name[MAX_SYS_SYM_LEN]; + char function_type[10]; + FUNCPTR proutine; + FUNCPTR pCISR; + int cRoutine; + void *pparam; + int status; + unsigned i; - for(vec=0; vecia.sin_addr.s_addr != prhs->ia.sin_addr.s_addr ) { match = 0; } - else if ( plhs->ia.sin_port != prhs->ia.sin_port ) { + else if ( plhs->ia.sin_port != prhs->ia.sin_port ) { match = 0; } else { @@ -55,17 +55,17 @@ int epicsStdCall sockAddrAreIdentical } /* - * sockAddrToA() + * sockAddrToA() * (convert socket address to ASCII host name) */ unsigned epicsStdCall sockAddrToA ( const struct sockaddr * paddr, char * pBuf, unsigned bufSize ) { - if ( bufSize < 1 ) { - return 0; - } + if ( bufSize < 1 ) { + return 0; + } - if ( paddr->sa_family != AF_INET ) { + if ( paddr->sa_family != AF_INET ) { static const char * pErrStr = ""; unsigned len = strlen ( pErrStr ); if ( len < bufSize ) { @@ -73,34 +73,34 @@ unsigned epicsStdCall sockAddrToA ( return len; } else { - strncpy ( pBuf, "", bufSize-1 ); - pBuf[bufSize-1] = '\0'; + strncpy ( pBuf, "", bufSize-1 ); + pBuf[bufSize-1] = '\0'; return bufSize-1; } - } - else { - const struct sockaddr_in * paddr_in = + } + else { + const struct sockaddr_in * paddr_in = (const struct sockaddr_in *) paddr; return ipAddrToA ( paddr_in, pBuf, bufSize ); - } + } } /* - * ipAddrToA() + * ipAddrToA() * (convert IP address to ASCII host name) */ unsigned epicsStdCall ipAddrToA ( const struct sockaddr_in * paddr, char * pBuf, unsigned bufSize ) { - unsigned len = ipAddrToHostName ( + unsigned len = ipAddrToHostName ( & paddr->sin_addr, pBuf, bufSize ); - if ( len == 0 ) { + if ( len == 0 ) { len = ipAddrToDottedIP ( paddr, pBuf, bufSize ); - } + } else { unsigned reducedSize = bufSize - len; - int status = epicsSnprintf ( - &pBuf[len], reducedSize, ":%hu", + int status = epicsSnprintf ( + &pBuf[len], reducedSize, ":%hu", ntohs (paddr->sin_port) ); if ( status > 0 ) { unsigned portSize = (unsigned) status; @@ -113,12 +113,12 @@ unsigned epicsStdCall ipAddrToA ( } /* - * sockAddrToDottedIP () + * sockAddrToDottedIP () */ unsigned epicsStdCall sockAddrToDottedIP ( const struct sockaddr * paddr, char * pBuf, unsigned bufSize ) { - if ( paddr->sa_family != AF_INET ) { + if ( paddr->sa_family != AF_INET ) { const char * pErrStr = ""; unsigned errStrLen = strlen ( pErrStr ); if ( errStrLen < bufSize ) { @@ -128,18 +128,18 @@ unsigned epicsStdCall sockAddrToDottedIP ( else { unsigned reducedSize = bufSize - 1u; strncpy ( pBuf, pErrStr, reducedSize ); - pBuf[reducedSize] = '\0'; + pBuf[reducedSize] = '\0'; return reducedSize; } - } - else { + } + else { const struct sockaddr_in *paddr_in = ( const struct sockaddr_in * ) paddr; return ipAddrToDottedIP ( paddr_in, pBuf, bufSize ); } } /* - * ipAddrToDottedIP () + * ipAddrToDottedIP () */ unsigned epicsStdCall ipAddrToDottedIP ( const struct sockaddr_in *paddr, char *pBuf, unsigned bufSize ) @@ -164,9 +164,9 @@ unsigned epicsStdCall ipAddrToDottedIP ( * inet_ntoa() isnt used because it isnt thread safe * (and the replacements are not standardized) */ - status = epicsSnprintf ( - pBuf, bufSize, "%u.%u.%u.%u:%hu", - chunk[3], chunk[2], chunk[1], chunk[0], + status = epicsSnprintf ( + pBuf, bufSize, "%u.%u.%u.%u:%hu", + chunk[3], chunk[2], chunk[1], chunk[0], ntohs ( paddr->sin_port ) ); if ( status > 0 ) { strLen = ( unsigned ) status; @@ -181,7 +181,7 @@ unsigned epicsStdCall ipAddrToDottedIP ( } else { strncpy ( pBuf, pErrStr, bufSize ); - pBuf[bufSize-1] = '\0'; + pBuf[bufSize-1] = '\0'; return bufSize - 1u; } } diff --git a/modules/libcom/src/osi/osiSock.h b/modules/libcom/src/osi/osiSock.h index 2a8589c33..01852a354 100644 --- a/modules/libcom/src/osi/osiSock.h +++ b/modules/libcom/src/osi/osiSock.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -44,8 +44,8 @@ LIBCOM_API void epicsStdCall * receive, or connect call. For odd ball systems this is stubbed out in the * osi area. */ -enum epicsSocketSystemCallInterruptMechanismQueryInfo { - esscimqi_socketCloseRequired, +enum epicsSocketSystemCallInterruptMechanismQueryInfo { + esscimqi_socketCloseRequired, esscimqi_socketBothShutdownRequired, esscimqi_socketSigAlarmRequired /* NO LONGER USED/SUPPORTED */ }; @@ -64,11 +64,11 @@ LIBCOM_API int epicsSocketUnsentCount(SOCKET sock); /* * convert socket address to ASCII in this order * 1) look for matching host name and typically add trailing IP port - * 2) failing that, convert to raw ascii address (typically this is a + * 2) failing that, convert to raw ascii address (typically this is a * dotted IP address with trailing port) * 3) failing that, writes "" into pBuf * - * returns the number of character elements stored in buffer not + * returns the number of character elements stored in buffer not * including the null termination, but always writes at least a * null ternminater in the string (if bufSize >= 1) */ @@ -80,7 +80,7 @@ LIBCOM_API unsigned epicsStdCall sockAddrToA ( * 1) look for matching host name and add trailing port * 2) convert to raw dotted IP address with trailing port * - * returns the number of character elements stored in buffer not + * returns the number of character elements stored in buffer not * including the null termination, but always writes at least a * null ternminater in the string (if bufSize >= 1) */ @@ -88,10 +88,10 @@ LIBCOM_API unsigned epicsStdCall ipAddrToA ( const struct sockaddr_in * pInetAddr, char * pBuf, unsigned bufSize ); /* - * sockAddrToDottedIP () + * sockAddrToDottedIP () * typically convert to raw dotted IP address with trailing port * - * returns the number of character elements stored in buffer not + * returns the number of character elements stored in buffer not * including the null termination, but always writes at least a * null ternminater in the string (if bufSize >= 1) */ @@ -99,10 +99,10 @@ LIBCOM_API unsigned epicsStdCall sockAddrToDottedIP ( const struct sockaddr * paddr, char * pBuf, unsigned bufSize ); /* - * ipAddrToDottedIP () + * ipAddrToDottedIP () * convert to raw dotted IP address with trailing port * - * returns the number of character elements stored in buffer not + * returns the number of character elements stored in buffer not * including the null termination, but always writes at least a * null ternminater in the string (if bufSize >= 1) */ @@ -112,7 +112,7 @@ LIBCOM_API unsigned epicsStdCall ipAddrToDottedIP ( /* * convert inet address to a host name string * - * returns the number of character elements stored in buffer not + * returns the number of character elements stored in buffer not * including the null termination. This will be zero if a matching * host name cant be found. * @@ -128,13 +128,13 @@ LIBCOM_API unsigned epicsStdCall ipAddrToHostName ( * 3) look for valid host name with optional port */ LIBCOM_API int epicsStdCall aToIPAddr - ( const char * pAddrString, unsigned short defaultPort, struct sockaddr_in * pIP); + ( const char * pAddrString, unsigned short defaultPort, struct sockaddr_in * pIP); /* * attempt to convert ASCII host name string with optional port to an IP address */ LIBCOM_API int epicsStdCall hostToIPAddr - (const char *pHostName, struct in_addr *pIPA); + (const char *pHostName, struct in_addr *pIPA); /* * attach to BSD socket library */ @@ -164,28 +164,28 @@ typedef struct osiSockAddrNode { } osiSockAddrNode; /* - * sockAddrAreIdentical() + * sockAddrAreIdentical() * (returns true if addresses are identical) */ LIBCOM_API int epicsStdCall sockAddrAreIdentical - ( const osiSockAddr * plhs, const osiSockAddr * prhs ); + ( const osiSockAddr * plhs, const osiSockAddr * prhs ); /* * osiSockDiscoverBroadcastAddresses () * Returns the broadcast addresses of each network interface found. * - * This routine is provided with the address of an ELLLIST, a socket, - * a destination port number, and a match address. When the - * routine returns there will be one additional entry - * (an osiSockAddrNode) in the list for each network interface found that - * is up and isnt a loop back interface (match addr is INADDR_ANY), - * or only the interfaces that match the specified addresses (match addr - * is other than INADDR_ANY). If the interface supports broadcasting - * then add its broadcast address to the list. If the interface is a + * This routine is provided with the address of an ELLLIST, a socket, + * a destination port number, and a match address. When the + * routine returns there will be one additional entry + * (an osiSockAddrNode) in the list for each network interface found that + * is up and isnt a loop back interface (match addr is INADDR_ANY), + * or only the interfaces that match the specified addresses (match addr + * is other than INADDR_ANY). If the interface supports broadcasting + * then add its broadcast address to the list. If the interface is a * point to point link then add the destination address of the point to - * point link to the list. + * point link to the list. * - * Any mutex locking required to protect pList is applied externally. + * Any mutex locking required to protect pList is applied externally. * */ LIBCOM_API void epicsStdCall osiSockDiscoverBroadcastAddresses @@ -194,17 +194,17 @@ LIBCOM_API void epicsStdCall osiSockDiscoverBroadcastAddresses /* * osiLocalAddr () * Returns the osiSockAddr of the first non-loopback interface found - * that is operational (up flag is set). If no valid address can be - * located then return an osiSockAddr with the address family set to + * that is operational (up flag is set). If no valid address can be + * located then return an osiSockAddr with the address family set to * unspecified (AF_UNSPEC). * * Unfortunately in EPICS 3.13 beta 11 and before the CA * repeater would not always allow the loopback address * as a local client address so current clients alternate * between the address of the first non-loopback interface - * found and the loopback addresss when subscribing with + * found and the loopback addresss when subscribing with * the CA repeater until all CA repeaters have been updated - * to current code. After all CA repeaters have been restarted + * to current code. After all CA repeaters have been restarted * this osi interface can be eliminated. */ LIBCOM_API osiSockAddr epicsStdCall osiLocalAddr (SOCKET socket); diff --git a/modules/libcom/src/osi/osiWireFormat.h b/modules/libcom/src/osi/osiWireFormat.h index 4d7e6717f..9f328d020 100644 --- a/modules/libcom/src/osi/osiWireFormat.h +++ b/modules/libcom/src/osi/osiWireFormat.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -21,16 +21,16 @@ // With future CA protocols user defined payload composition will be // supported and we will need to move away from a naturally aligned // protocol (because pad byte overhead will probably be excessive when -// maintaining 8 byte natural alignment if the user isnt thinking about +// maintaining 8 byte natural alignment if the user isnt thinking about // placing like sized elements together). // // Nevertheless, the R3.14 protocol continues to be naturally aligned, // and all of the fields within the DBR_XXXX types are naturally aligned. -// Therefore we support here two wire transfer interfaces (naturally -// aligned and otherwise) because there are important optimizations +// Therefore we support here two wire transfer interfaces (naturally +// aligned and otherwise) because there are important optimizations // specific to each of them. // -// At some point in the future the naturally aligned interfaces might +// At some point in the future the naturally aligned interfaces might // be eliminated (or unbundled from base) should they be no-longer needed. // @@ -70,8 +70,8 @@ private: }; template < class T > -inline AlignedWireRef < T > :: AlignedWireRef ( T & ref ) : - _ref ( ref ) +inline AlignedWireRef < T > :: AlignedWireRef ( T & ref ) : + _ref ( ref ) { } @@ -91,8 +91,8 @@ inline AlignedWireRef < T > & AlignedWireRef < T > :: operator = ( const T & src } template < class T > -inline AlignedWireRef < const T > :: AlignedWireRef ( const T & ref ) : - _ref ( ref ) +inline AlignedWireRef < const T > :: AlignedWireRef ( const T & ref ) : + _ref ( ref ) { } @@ -107,16 +107,16 @@ inline AlignedWireRef < const T > :: operator T () const // may be useful when creating support for little endian inline epicsUInt16 byteSwap ( const epicsUInt16 & src ) { - return static_cast < epicsUInt16 > + return static_cast < epicsUInt16 > ( ( src << 8u ) | ( src >> 8u ) ); } // may be useful when creating support for little endian inline epicsUInt32 byteSwap ( const epicsUInt32 & src ) { - epicsUInt32 tmp0 = byteSwap ( + epicsUInt32 tmp0 = byteSwap ( static_cast < epicsUInt16 > ( src >> 16u ) ); - epicsUInt32 tmp1 = byteSwap ( + epicsUInt32 tmp1 = byteSwap ( static_cast < epicsUInt16 > ( src ) ); return static_cast < epicsUInt32 > ( ( tmp1 << 16u ) | tmp0 ); @@ -149,7 +149,7 @@ union WireAlias < epicsFloat32 > { }; // -// Missaligned unsigned wire format get/set can be implemented generically +// Missaligned unsigned wire format get/set can be implemented generically // w/o performance penalty. Attempts to improve this on architectures that // dont have alignement requirements will probably get into trouble with // over-aggressive optimization under strict aliasing rules. @@ -158,7 +158,7 @@ union WireAlias < epicsFloat32 > { template < class T > inline void WireGet ( const epicsUInt8 * pWireSrc, T & dst ) { - // copy through union here + // copy through union here // a) prevents over-aggressive optimization under strict aliasing rules // b) doesnt preclude extra copy operation being optimized away WireAlias < T > tmp; @@ -167,14 +167,14 @@ inline void WireGet ( const epicsUInt8 * pWireSrc, T & dst ) } template <> -inline void WireGet < epicsUInt8 > ( +inline void WireGet < epicsUInt8 > ( const epicsUInt8 * pWireSrc, epicsUInt8 & dst ) { dst = pWireSrc[0]; } template <> -inline void WireGet < epicsUInt16 > ( +inline void WireGet < epicsUInt16 > ( const epicsUInt8 * pWireSrc, epicsUInt16 & dst ) { dst = static_cast < epicsUInt16 > ( @@ -182,11 +182,11 @@ inline void WireGet < epicsUInt16 > ( } template <> -inline void WireGet < epicsUInt32 > ( +inline void WireGet < epicsUInt32 > ( const epicsUInt8 * pWireSrc, epicsUInt32 & dst ) { dst = static_cast < epicsUInt32 > ( - ( pWireSrc[0] << 24u ) | + ( pWireSrc[0] << 24u ) | ( pWireSrc[1] << 16u ) | ( pWireSrc[2] << 8u ) | pWireSrc[3] ); @@ -195,7 +195,7 @@ inline void WireGet < epicsUInt32 > ( template < class T > inline void WireSet ( const T & src, epicsUInt8 * pWireDst ) { - // copy through union here + // copy through union here // a) prevents over-aggressive optimization under strict aliasing rules // b) doesnt preclude extra copy operation being optimized away WireAlias < T > tmp; @@ -204,14 +204,14 @@ inline void WireSet ( const T & src, epicsUInt8 * pWireDst ) } template <> -inline void WireSet < epicsUInt8 > ( +inline void WireSet < epicsUInt8 > ( const epicsUInt8 & src, epicsUInt8 * pWireDst ) { pWireDst[0] = src; } template <> -inline void WireSet < epicsUInt16 > ( +inline void WireSet < epicsUInt16 > ( const epicsUInt16 & src, epicsUInt8 * pWireDst ) { pWireDst[0] = static_cast < epicsUInt8 > ( src >> 8u ); @@ -219,7 +219,7 @@ inline void WireSet < epicsUInt16 > ( } template <> -inline void WireSet < epicsUInt32 > ( +inline void WireSet < epicsUInt32 > ( const epicsUInt32 & src, epicsUInt8 * pWireDst ) { pWireDst[0] = static_cast < epicsUInt8 > ( src >> 24u ); @@ -231,7 +231,7 @@ inline void WireSet < epicsUInt32 > ( template < class T > inline void AlignedWireGet ( const T & src, T & dst ) { - // copy through union here + // copy through union here // a) prevents over-aggressive optimization under strict aliasing rules // b) doesnt preclude extra copy operation being optimized away WireAlias < T > srcu, dstu; @@ -243,7 +243,7 @@ inline void AlignedWireGet ( const T & src, T & dst ) template < class T > inline void AlignedWireSet ( const T & src, T & dst ) { - // copy through union here + // copy through union here // a) prevents over-aggressive optimization under strict aliasing rules // b) doesnt preclude extra copy operation being optimized away WireAlias < T > srcu, dstu; diff --git a/modules/libcom/src/taskwd/taskwd.c b/modules/libcom/src/taskwd/taskwd.c index c1d123876..3c7647065 100644 --- a/modules/libcom/src/taskwd/taskwd.c +++ b/modules/libcom/src/taskwd/taskwd.c @@ -4,14 +4,14 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* taskwd.c */ /* tasks and subroutines for a general purpose task watchdog */ /* * Original Author: Marty Kraimer - * Date: 07-18-91 + * Date: 07-18-91 */ #include diff --git a/modules/libcom/src/taskwd/taskwd.h b/modules/libcom/src/taskwd/taskwd.h index 172995e1e..02d8f73fc 100644 --- a/modules/libcom/src/taskwd/taskwd.h +++ b/modules/libcom/src/taskwd/taskwd.h @@ -4,13 +4,13 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* General purpose task watchdog */ /* * Original Author: Marty Kraimer - * Date: 07-18-91 + * Date: 07-18-91 */ #ifndef INC_taskwd_H diff --git a/modules/libcom/src/timer/epicsTimer.cpp b/modules/libcom/src/timer/epicsTimer.cpp index 44b9a30d5..7d59af4e8 100644 --- a/modules/libcom/src/timer/epicsTimer.cpp +++ b/modules/libcom/src/timer/epicsTimer.cpp @@ -62,7 +62,7 @@ epicsTimerNotify::expireStatus epicsTimerForC::expire ( const epicsTime & ) } epicsTimerQueueActiveForC :: - epicsTimerQueueActiveForC ( RefMgr & refMgr, + epicsTimerQueueActiveForC ( RefMgr & refMgr, bool okToShare, unsigned priority ) : timerQueueActive ( refMgr, okToShare, priority ) { @@ -78,18 +78,18 @@ void epicsTimerQueueActiveForC::release () _refMgr->release ( *this ); } -epicsTimerQueuePassiveForC::epicsTimerQueuePassiveForC ( - epicsTimerQueueNotifyReschedule pRescheduleCallbackIn, +epicsTimerQueuePassiveForC::epicsTimerQueuePassiveForC ( + epicsTimerQueueNotifyReschedule pRescheduleCallbackIn, epicsTimerQueueNotifyQuantum pSleepQuantumCallbackIn, void * pPrivateIn ) : - timerQueuePassive ( * static_cast < epicsTimerQueueNotify * > ( this ) ), - pRescheduleCallback ( pRescheduleCallbackIn ), + timerQueuePassive ( * static_cast < epicsTimerQueueNotify * > ( this ) ), + pRescheduleCallback ( pRescheduleCallbackIn ), pSleepQuantumCallback ( pSleepQuantumCallbackIn ), pPrivate ( pPrivateIn ) { } -epicsTimerQueuePassiveForC::~epicsTimerQueuePassiveForC () +epicsTimerQueuePassiveForC::~epicsTimerQueuePassiveForC () { } @@ -112,7 +112,7 @@ LIBCOM_API epicsTimerNotify::expireStatus::expireStatus ( restart_t restart ) : delay ( - DBL_MAX ) { if ( restart != noRestart ) { - throw std::logic_error + throw std::logic_error ( "timer restart was requested without specifying a delay?" ); } } @@ -122,11 +122,11 @@ LIBCOM_API epicsTimerNotify::expireStatus::expireStatus delay ( expireDelaySec ) { if ( restartIn != epicsTimerNotify::restart ) { - throw std::logic_error + throw std::logic_error ( "no timer restart was requested, but a delay was specified?" ); } if ( this->delay < 0.0 || !finite(this->delay) ) { - throw std::logic_error + throw std::logic_error ( "timer restart was requested, but a negative delay was specified?" ); } } @@ -139,21 +139,21 @@ LIBCOM_API bool epicsTimerNotify::expireStatus::restart () const LIBCOM_API double epicsTimerNotify::expireStatus::expirationDelay () const { if ( this->delay < 0.0 || !finite(this->delay) ) { - throw std::logic_error + throw std::logic_error ( "no timer restart was requested, but you are asking for a restart delay?" ); } return this->delay; } extern "C" epicsTimerQueuePassiveId epicsStdCall - epicsTimerQueuePassiveCreate ( - epicsTimerQueueNotifyReschedule pRescheduleCallbackIn, + epicsTimerQueuePassiveCreate ( + epicsTimerQueueNotifyReschedule pRescheduleCallbackIn, epicsTimerQueueNotifyQuantum pSleepQuantumCallbackIn, void * pPrivateIn ) { try { - return new epicsTimerQueuePassiveForC ( - pRescheduleCallbackIn, + return new epicsTimerQueuePassiveForC ( + pRescheduleCallbackIn, pSleepQuantumCallbackIn, pPrivateIn ); } @@ -206,9 +206,9 @@ extern "C" epicsTimerQueueId epicsStdCall epicsTimerQueueAllocate ( int okToShare, unsigned int threadPriority ) { try { - epicsSingleton < timerQueueActiveMgr > :: reference ref = + epicsSingleton < timerQueueActiveMgr > :: reference ref = timerQueueMgrEPICS.getReference (); - epicsTimerQueueActiveForC & tmr = + epicsTimerQueueActiveForC & tmr = ref->allocate ( ref, okToShare ? true : false, threadPriority ); return &tmr; } diff --git a/modules/libcom/src/timer/epicsTimer.h b/modules/libcom/src/timer/epicsTimer.h index 02eebbbfb..9f99d39c4 100644 --- a/modules/libcom/src/timer/epicsTimer.h +++ b/modules/libcom/src/timer/epicsTimer.h @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* epicsTimer.h */ @@ -54,7 +54,7 @@ public: virtual void start ( epicsTimerNotify &, const epicsTime & ) = 0; virtual void start ( epicsTimerNotify &, double delaySeconds ) = 0; /* WARNING: A deadlock will occur if you hold a lock while - * calling this function that you also take within the timer + * calling this function that you also take within the timer * expiration callback. */ virtual void cancel () = 0; @@ -83,7 +83,7 @@ class epicsTimerQueueActive public: static LIBCOM_API epicsTimerQueueActive & allocate ( bool okToShare, unsigned threadPriority = epicsThreadPriorityMin + 10 ); - virtual void release () = 0; + virtual void release () = 0; protected: LIBCOM_API virtual ~epicsTimerQueueActive () = 0; }; @@ -108,9 +108,9 @@ public: virtual double process ( const epicsTime & currentTime ) = 0; /* returns delay to next expire */ }; -inline epicsTimer::expireInfo::expireInfo ( bool activeIn, +inline epicsTimer::expireInfo::expireInfo ( bool activeIn, const epicsTime & expireTimeIn ) : - active ( activeIn ), expireTime ( expireTimeIn ) + active ( activeIn ), expireTime ( expireTimeIn ) { } @@ -140,7 +140,7 @@ LIBCOM_API epicsTimerQueueId epicsStdCall LIBCOM_API void epicsStdCall epicsTimerQueueRelease ( epicsTimerQueueId ); LIBCOM_API epicsTimerId epicsStdCall - epicsTimerQueueCreateTimer ( epicsTimerQueueId queueid, + epicsTimerQueueCreateTimer ( epicsTimerQueueId queueid, epicsTimerCallback callback, void *arg ); LIBCOM_API void epicsStdCall epicsTimerQueueDestroyTimer ( epicsTimerQueueId queueid, epicsTimerId id ); @@ -152,7 +152,7 @@ typedef struct epicsTimerQueuePassiveForC * epicsTimerQueuePassiveId; typedef void ( * epicsTimerQueueNotifyReschedule ) ( void * pPrivate ); typedef double ( * epicsTimerQueueNotifyQuantum ) ( void * pPrivate ); LIBCOM_API epicsTimerQueuePassiveId epicsStdCall - epicsTimerQueuePassiveCreate ( epicsTimerQueueNotifyReschedule, + epicsTimerQueuePassiveCreate ( epicsTimerQueueNotifyReschedule, epicsTimerQueueNotifyQuantum, void *pPrivate ); LIBCOM_API void epicsStdCall epicsTimerQueuePassiveDestroy ( epicsTimerQueuePassiveId ); diff --git a/modules/libcom/src/timer/timer.cpp b/modules/libcom/src/timer/timer.cpp index fed400761..0a44834e7 100644 --- a/modules/libcom/src/timer/timer.cpp +++ b/modules/libcom/src/timer/timer.cpp @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -35,7 +35,7 @@ template class tsFreeList < timer, 0x20 >; #endif timer::timer ( timerQueue & queueIn ) : - queue ( queueIn ), curState ( stateLimbo ), pNotify ( 0 ) + queue ( queueIn ), curState ( stateLimbo ), pNotify ( 0 ) { } @@ -44,7 +44,7 @@ timer::~timer () this->cancel (); } -void timer::destroy () +void timer::destroy () { timerQueue & queueTmp = this->queue; this->~timer (); @@ -75,7 +75,7 @@ void timer::privateStart ( epicsTimerNotify & notify, const epicsTime & expire ) } else if ( this->curState == statePending ) { this->queue.timerList.remove ( *this ); - if ( this->queue.timerList.first() == this && + if ( this->queue.timerList.first() == this && this->queue.timerList.count() > 0 ) { reschedualNeeded = true; } @@ -120,14 +120,14 @@ void timer::privateStart ( epicsTimerNotify & notify, const epicsTime & expire ) if ( reschedualNeeded ) { this->queue.notify.reschedule (); } - + # if defined(DEBUG) && 0 this->show ( 10u ); this->queue.show ( 10u ); # endif - debugPrintf ( ("Start of \"%s\" with delay %f at %p preempting %u\n", - typeid ( this->notify ).name (), + debugPrintf ( ("Start of \"%s\" with delay %f at %p preempting %u\n", + typeid ( this->notify ).name (), expire - epicsTime::getCurrent (), this, preemptCount ) ); } @@ -142,7 +142,7 @@ void timer::cancel () if ( this->curState == statePending ) { this->queue.timerList.remove ( *this ); this->curState = stateLimbo; - if ( this->queue.timerList.first() == this && + if ( this->queue.timerList.first() == this && this->queue.timerList.count() > 0 ) { reschedual = true; } @@ -153,7 +153,7 @@ void timer::cancel () if ( this->queue.processThread != epicsThreadGetIdSelf() ) { // make certain timer expire() does not run after cancel () returns, // but dont require that lock is applied while calling expire() - while ( this->queue.cancelPending && + while ( this->queue.cancelPending && this->queue.pExpireTmr == this ) { epicsGuardRelease < epicsMutex > autoRelease ( locker ); this->queue.cancelBlockingEvent.wait (); @@ -173,7 +173,7 @@ void timer::cancel () epicsTimer::expireInfo timer::getExpireInfo () const { - // taking a lock here guarantees that users will not + // taking a lock here guarantees that users will not // see brief intervals when a timer isnt active because // it is is canceled when start is called epicsGuard < epicsMutex > locker ( this->queue.mutex ); diff --git a/modules/libcom/src/timer/timerPrivate.h b/modules/libcom/src/timer/timerPrivate.h index 259afaee6..7b963f391 100644 --- a/modules/libcom/src/timer/timerPrivate.h +++ b/modules/libcom/src/timer/timerPrivate.h @@ -43,12 +43,12 @@ public: epicsPlacementDeleteOperator (( void *, tsFreeList < timer, 0x20 > & )) protected: timer ( class timerQueue & ); - ~timer (); + ~timer (); timerQueue & queue; private: enum state { statePending = 45, stateActive = 56, stateLimbo = 78 }; - epicsTime exp; // experation time - state curState; // current state + epicsTime exp; // experation time + state curState; // current state epicsTimerNotify * pNotify; // callback void privateStart ( epicsTimerNotify & notify, const epicsTime & ); timer & operator = ( const timer & ); @@ -57,7 +57,7 @@ private: // because if I declare placement new and delete, but // comment out the placement delete definition there are // no undefined symbols. - void operator delete ( void * ); + void operator delete ( void * ); friend class timerQueue; }; @@ -66,7 +66,7 @@ public: void destroy (); protected: epicsTimerForC ( timerQueue &, epicsTimerCallback, void *pPrivateIn ); - ~epicsTimerForC (); + ~epicsTimerForC (); void * operator new ( size_t size, tsFreeList < epicsTimerForC, 0x20 > & ); epicsPlacementDeleteOperator (( void *, tsFreeList < epicsTimerForC, 0x20 > & )) private: @@ -79,7 +79,7 @@ private: // because if I declare placement new and delete, but // comment out the placement delete definition there are // no undefined symbols. - void operator delete ( void * ); + void operator delete ( void * ); friend class timerQueue; }; @@ -107,7 +107,7 @@ private: static const double exceptMsgMinPeriod; void printExceptMsg ( const char * pName, const type_info & type ); - timerQueue ( const timerQueue & ); + timerQueue ( const timerQueue & ); timerQueue & operator = ( const timerQueue & ); friend class timer; friend struct epicsTimerForC; @@ -125,7 +125,7 @@ private: class timerQueueActiveMgr; -class timerQueueActive : public epicsTimerQueueActive, +class timerQueueActive : public epicsTimerQueueActive, public epicsThreadRunable, public epicsTimerQueueNotify, public timerQueueActiveMgrPrivate { public: @@ -152,26 +152,26 @@ private: void run (); void reschedule (); double quantum (); - void _printLastChanceExceptionMessage ( + void _printLastChanceExceptionMessage ( const char * pExceptionTypeName, const char * pExceptionContext ); epicsTimerQueue & getEpicsTimerQueue (); - timerQueueActive ( const timerQueueActive & ); + timerQueueActive ( const timerQueueActive & ); timerQueueActive & operator = ( const timerQueueActive & ); }; class timerQueueActiveMgr { public: typedef epicsSingleton < timerQueueActiveMgr > :: reference RefThis; - timerQueueActiveMgr (); + timerQueueActiveMgr (); ~timerQueueActiveMgr (); - epicsTimerQueueActiveForC & allocate ( RefThis &, bool okToShare, + epicsTimerQueueActiveForC & allocate ( RefThis &, bool okToShare, unsigned threadPriority = epicsThreadPriorityMin + 10 ); void release ( epicsTimerQueueActiveForC & ); private: epicsMutex mutex; tsDLList < epicsTimerQueueActiveForC > sharedQueueList; - timerQueueActiveMgr ( const timerQueueActiveMgr & ); + timerQueueActiveMgr ( const timerQueueActiveMgr & ); timerQueueActiveMgr & operator = ( const timerQueueActiveMgr & ); }; @@ -188,15 +188,15 @@ protected: timerQueue queue; ~timerQueuePassive (); epicsTimerQueue & getEpicsTimerQueue (); - timerQueuePassive ( const timerQueuePassive & ); + timerQueuePassive ( const timerQueuePassive & ); timerQueuePassive & operator = ( const timerQueuePassive & ); }; -struct epicsTimerQueuePassiveForC : +struct epicsTimerQueuePassiveForC : public epicsTimerQueueNotify, public timerQueuePassive { public: - epicsTimerQueuePassiveForC ( - epicsTimerQueueNotifyReschedule, + epicsTimerQueuePassiveForC ( + epicsTimerQueueNotifyReschedule, epicsTimerQueueNotifyQuantum, void * pPrivate ); void destroy (); @@ -211,7 +211,7 @@ private: double quantum (); }; -struct epicsTimerQueueActiveForC : public timerQueueActive, +struct epicsTimerQueueActiveForC : public timerQueueActive, public tsDLNode < epicsTimerQueueActiveForC > { public: epicsTimerQueueActiveForC ( RefMgr &, bool okToShare, unsigned priority ); @@ -221,7 +221,7 @@ public: protected: virtual ~epicsTimerQueueActiveForC (); private: - epicsTimerQueueActiveForC ( const epicsTimerQueueActiveForC & ); + epicsTimerQueueActiveForC ( const epicsTimerQueueActiveForC & ); epicsTimerQueueActiveForC & operator = ( const epicsTimerQueueActiveForC & ); }; @@ -235,29 +235,29 @@ inline unsigned timerQueueActive::threadPriority () const return thread.getPriority (); } -inline void * timer::operator new ( size_t size, - tsFreeList < timer, 0x20 > & freeList ) +inline void * timer::operator new ( size_t size, + tsFreeList < timer, 0x20 > & freeList ) { return freeList.allocate ( size ); } #ifdef CXX_PLACEMENT_DELETE -inline void timer::operator delete ( void * pCadaver, - tsFreeList < timer, 0x20 > & freeList ) +inline void timer::operator delete ( void * pCadaver, + tsFreeList < timer, 0x20 > & freeList ) { freeList.release ( pCadaver ); } #endif inline void * epicsTimerForC::operator new ( size_t size, - tsFreeList < epicsTimerForC, 0x20 > & freeList ) + tsFreeList < epicsTimerForC, 0x20 > & freeList ) { return freeList.allocate ( size ); } #ifdef CXX_PLACEMENT_DELETE -inline void epicsTimerForC::operator delete ( void * pCadaver, - tsFreeList < epicsTimerForC, 0x20 > & freeList ) +inline void epicsTimerForC::operator delete ( void * pCadaver, + tsFreeList < epicsTimerForC, 0x20 > & freeList ) { freeList.release ( pCadaver ); } diff --git a/modules/libcom/src/timer/timerQueue.cpp b/modules/libcom/src/timer/timerQueue.cpp index f4e3555a8..7f5196045 100644 --- a/modules/libcom/src/timer/timerQueue.cpp +++ b/modules/libcom/src/timer/timerQueue.cpp @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Author Jeffrey O. Hill @@ -25,10 +25,10 @@ epicsTimerQueue::~epicsTimerQueue () {} timerQueue::timerQueue ( epicsTimerQueueNotify & notifyIn ) : mutex(__FILE__, __LINE__), - notify ( notifyIn ), - pExpireTmr ( 0 ), - processThread ( 0 ), - exceptMsgTimeStamp ( + notify ( notifyIn ), + pExpireTmr ( 0 ), + processThread ( 0 ), + exceptMsgTimeStamp ( epicsTime :: getCurrent () - exceptMsgMinPeriod ), cancelPending ( false ) { @@ -37,7 +37,7 @@ timerQueue::timerQueue ( epicsTimerQueueNotify & notifyIn ) : timerQueue::~timerQueue () { timer *pTmr; - while ( ( pTmr = this->timerList.get () ) ) { + while ( ( pTmr = this->timerList.get () ) ) { pTmr->curState = timer::stateLimbo; } } @@ -50,7 +50,7 @@ void timerQueue :: try { epicsTime cur = epicsTime :: getCurrent (); delay = cur - this->exceptMsgTimeStamp; - cur.strftime ( date, sizeof ( date ), + cur.strftime ( date, sizeof ( date ), "%a %b %d %Y %H:%M:%S.%f" ); if ( delay >= exceptMsgMinPeriod ) { this->exceptMsgTimeStamp = cur; @@ -62,21 +62,21 @@ void timerQueue :: } if ( delay >= exceptMsgMinPeriod ) { // we dont touch the typeid for the timer expiration - // notify interface here because they might have + // notify interface here because they might have // destroyed the timer during its callback - errlogPrintf ( + errlogPrintf ( "timerQueue: Unexpected C++ exception \"%s\" " "with type \"%s\" during timer expiration " "callback at %s\n", - pName, - type.name (), + pName, + type.name (), date ); errlogFlush (); } } double timerQueue::process ( const epicsTime & currentTime ) -{ +{ epicsGuard < epicsMutex > guard ( this->mutex ); if ( this->pExpireTmr ) { @@ -102,12 +102,12 @@ double timerQueue::process ( const epicsTime & currentTime ) if ( this->timerList.first () ) { if ( currentTime >= this->timerList.first ()->exp ) { this->pExpireTmr = this->timerList.first (); - this->timerList.remove ( *this->pExpireTmr ); + this->timerList.remove ( *this->pExpireTmr ); this->pExpireTmr->curState = timer::stateActive; this->processThread = epicsThreadGetIdSelf (); # ifdef DEBUG this->pExpireTmr->show ( 0u ); -# endif +# endif } else { double delay = this->timerList.first ()->exp - currentTime; @@ -132,8 +132,8 @@ double timerQueue::process ( const epicsTime & currentTime ) { epicsGuardRelease < epicsMutex > unguard ( guard ); - debugPrintf ( ( "%5u expired \"%s\" with error %f sec\n", - N++, typeid ( this->pExpireTmr->notify ).name (), + debugPrintf ( ( "%5u expired \"%s\" with error %f sec\n", + N++, typeid ( this->pExpireTmr->notify ).name (), currentTime - this->pExpireTmr->exp ) ); try { expStat = pTmpNotify->expire ( currentTime ); @@ -151,11 +151,11 @@ double timerQueue::process ( const epicsTime & currentTime ) // while the call back was running // if ( this->cancelPending ) { - // 1) if another thread is canceling then cancel() waits for + // 1) if another thread is canceling then cancel() waits for // the event below // 2) if this thread is canceling in the timer callback then - // dont touch timer or notify here because the cancel might - // have occurred because they destroyed the timer in the + // dont touch timer or notify here because the cancel might + // have occurred because they destroyed the timer in the // callback this->cancelPending = false; this->cancelBlockingEvent.signal (); @@ -164,14 +164,14 @@ double timerQueue::process ( const epicsTime & currentTime ) this->pExpireTmr->curState = timer::stateLimbo; if ( this->pExpireTmr->pNotify ) { // pNotify was cleared above so if it is valid now we know that - // someone has started the timer from another thread and that + // someone has started the timer from another thread and that // predominates over the restart parameters from expire. - this->pExpireTmr->privateStart ( + this->pExpireTmr->privateStart ( *this->pExpireTmr->pNotify, this->pExpireTmr->exp ); } else if ( expStat.restart() ) { // restart as nec - this->pExpireTmr->privateStart ( + this->pExpireTmr->privateStart ( *pTmpNotify, currentTime + expStat.expirationDelay() ); } } @@ -180,11 +180,11 @@ double timerQueue::process ( const epicsTime & currentTime ) if ( this->timerList.first () ) { if ( currentTime >= this->timerList.first ()->exp ) { this->pExpireTmr = this->timerList.first (); - this->timerList.remove ( *this->pExpireTmr ); + this->timerList.remove ( *this->pExpireTmr ); this->pExpireTmr->curState = timer::stateActive; # ifdef DEBUG this->pExpireTmr->show ( 0u ); -# endif +# endif } else { delay = this->timerList.first ()->exp - currentTime; @@ -217,7 +217,7 @@ void timerQueue::show ( unsigned level ) const printf ( "epicsTimerQueue with %u items pending\n", this->timerList.count () ); if ( level >= 1u ) { tsDLIterConst < timer > iter = this->timerList.firstIter (); - while ( iter.valid () ) { + while ( iter.valid () ) { iter->show ( level - 1u ); ++iter; } diff --git a/modules/libcom/src/timer/timerQueueActive.cpp b/modules/libcom/src/timer/timerQueueActive.cpp index ab0599e21..59d66880d 100644 --- a/modules/libcom/src/timer/timerQueueActive.cpp +++ b/modules/libcom/src/timer/timerQueueActive.cpp @@ -35,17 +35,17 @@ epicsTimerQueueActive::~epicsTimerQueueActive () {} epicsTimerQueueActive & epicsTimerQueueActive::allocate ( bool okToShare, unsigned threadPriority ) { - epicsSingleton < timerQueueActiveMgr >::reference pMgr = + epicsSingleton < timerQueueActiveMgr >::reference pMgr = timerQueueMgrEPICS.getReference (); return pMgr->allocate ( pMgr, okToShare, threadPriority ); } timerQueueActive :: - timerQueueActive ( RefMgr & refMgr, + timerQueueActive ( RefMgr & refMgr, bool okToShareIn, unsigned priority ) : - _refMgr ( refMgr ), queue ( *this ), thread ( *this, "timerQueue", + _refMgr ( refMgr ), queue ( *this ), thread ( *this, "timerQueue", epicsThreadGetStackSize ( epicsThreadStackMedium ), priority ), - sleepQuantum ( epicsThreadSleepQuantum() ), okToShare ( okToShareIn ), + sleepQuantum ( epicsThreadSleepQuantum() ), okToShare ( okToShareIn ), exitFlag ( 0 ), terminateFlag ( false ) { } @@ -66,10 +66,10 @@ timerQueueActive::~timerQueueActive () this->exitEvent.signal (); } -void timerQueueActive :: _printLastChanceExceptionMessage ( +void timerQueueActive :: _printLastChanceExceptionMessage ( const char * pExceptionTypeName, const char * pExceptionContext ) -{ +{ char date[64]; try { epicsTime cur = epicsTime :: getCurrent (); @@ -78,7 +78,7 @@ void timerQueueActive :: _printLastChanceExceptionMessage ( catch ( ... ) { strcpy ( date, "" ); } - errlogPrintf ( + errlogPrintf ( "timerQueueActive: Unexpected C++ exception \"%s\" with type \"%s\" " "while processing timer queue, at %s\n", pExceptionContext, pExceptionTypeName, date ); @@ -131,10 +131,10 @@ double timerQueueActive::quantum () void timerQueueActive::show ( unsigned int level ) const { - printf ( "EPICS threaded timer queue at %p\n", + printf ( "EPICS threaded timer queue at %p\n", static_cast ( this ) ); if ( level > 0u ) { - // specifying level one here avoids recursive + // specifying level one here avoids recursive // show callback this->thread.show ( 1u ); this->queue.show ( level - 1u ); @@ -148,7 +148,7 @@ void timerQueueActive::show ( unsigned int level ) const } } -epicsTimerQueue & timerQueueActive::getEpicsTimerQueue () +epicsTimerQueue & timerQueueActive::getEpicsTimerQueue () { return static_cast < epicsTimerQueue &> ( * this ); } diff --git a/modules/libcom/src/timer/timerQueueActiveMgr.cpp b/modules/libcom/src/timer/timerQueueActiveMgr.cpp index 7e382f644..de826eae6 100644 --- a/modules/libcom/src/timer/timerQueueActiveMgr.cpp +++ b/modules/libcom/src/timer/timerQueueActiveMgr.cpp @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Author Jeffrey O. Hill @@ -27,7 +27,7 @@ timerQueueActiveMgr::~timerQueueActiveMgr () { epicsGuard < epicsMutex > locker ( this->mutex ); } - + epicsTimerQueueActiveForC & timerQueueActiveMgr :: allocate ( RefThis & refThis, bool okToShare, unsigned threadPriority ) { @@ -44,7 +44,7 @@ epicsTimerQueueActiveForC & timerQueueActiveMgr :: } } - epicsTimerQueueActiveForC & queue = + epicsTimerQueueActiveForC & queue = * new epicsTimerQueueActiveForC ( refThis, okToShare, threadPriority ); queue.timerQueueActiveMgrPrivate::referenceCount = 1u; if ( okToShare ) { @@ -67,7 +67,7 @@ void timerQueueActiveMgr :: this->sharedQueueList.remove ( queue ); } } - // delete only after we release the guard in case the embedded + // delete only after we release the guard in case the embedded // reference is the last one and this object is destroyed // as a side effect timerQueueActiveMgrPrivate * pPriv = & queue; @@ -79,6 +79,6 @@ timerQueueActiveMgrPrivate::timerQueueActiveMgrPrivate () : { } -timerQueueActiveMgrPrivate::~timerQueueActiveMgrPrivate () +timerQueueActiveMgrPrivate::~timerQueueActiveMgrPrivate () { } diff --git a/modules/libcom/src/timer/timerQueuePassive.cpp b/modules/libcom/src/timer/timerQueuePassive.cpp index 754484073..6b45203f8 100644 --- a/modules/libcom/src/timer/timerQueuePassive.cpp +++ b/modules/libcom/src/timer/timerQueuePassive.cpp @@ -5,7 +5,7 @@ * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Author Jeffrey O. Hill @@ -14,12 +14,12 @@ */ // -// Note, a free list for this class is not currently used because of +// Note, a free list for this class is not currently used because of // entanglements between the file scope free list destructor and a -// file scope fdManager destructor which is trying to call a +// file scope fdManager destructor which is trying to call a // destructor for a passive timer queue which is no longer valid // in pool. -// +// #include @@ -54,14 +54,14 @@ double timerQueuePassive::process ( const epicsTime & currentTime ) void timerQueuePassive::show ( unsigned int level ) const { - printf ( "EPICS non-threaded timer queue at %p\n", + printf ( "EPICS non-threaded timer queue at %p\n", static_cast ( this ) ); if ( level >=1u ) { this->queue.show ( level - 1u ); } } -epicsTimerQueue & timerQueuePassive::getEpicsTimerQueue () +epicsTimerQueue & timerQueuePassive::getEpicsTimerQueue () { return static_cast < epicsTimerQueue &> ( * this ); } diff --git a/modules/libcom/src/valgrind/valgrind.h b/modules/libcom/src/valgrind/valgrind.h index c503172d5..2f0957c0f 100755 --- a/modules/libcom/src/valgrind/valgrind.h +++ b/modules/libcom/src/valgrind/valgrind.h @@ -21,16 +21,16 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product + 2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 3. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written + 4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS @@ -52,13 +52,13 @@ the terms of the GNU General Public License, version 2. See the COPYING file in the source distribution for details. - ---------------------------------------------------------------- + ---------------------------------------------------------------- */ /* This file is for inclusion into client (your!) code. - You can use these macros to manipulate and query Valgrind's + You can use these macros to manipulate and query Valgrind's execution inside your own programs. The resulting executables will still run without Valgrind, just a @@ -222,8 +222,8 @@ this is executed not under Valgrind. Args are passed in a memory block, and so there's no intrinsic limit to the number that could be passed, but it's currently five. - - The macro args are: + + The macro args are: _zzq_rlval result lvalue _zzq_default default value (result returned when running on real CPU) _zzq_request request code @@ -250,7 +250,7 @@ || (defined(PLAT_x86_win32) && defined(__GNUC__)) typedef - struct { + struct { unsigned int nraddr; /* where's the code? */ } OrigFn; @@ -314,7 +314,7 @@ typedef #if defined(PLAT_x86_win32) && !defined(__GNUC__) typedef - struct { + struct { unsigned int nraddr; /* where's the code? */ } OrigFn; @@ -388,7 +388,7 @@ valgrind_do_client_request_expr(uintptr_t _zzq_default, uintptr_t _zzq_request, || (defined(PLAT_amd64_win64) && defined(__GNUC__)) typedef - struct { + struct { unsigned long long int nraddr; /* where's the code? */ } OrigFn; @@ -460,7 +460,7 @@ typedef #if defined(PLAT_ppc32_linux) typedef - struct { + struct { unsigned int nraddr; /* where's the code? */ } OrigFn; @@ -529,7 +529,7 @@ typedef #if defined(PLAT_ppc64be_linux) typedef - struct { + struct { unsigned long long int nraddr; /* where's the code? */ unsigned long long int r2; /* what tocptr do we need? */ } @@ -685,7 +685,7 @@ typedef #if defined(PLAT_arm_linux) typedef - struct { + struct { unsigned int nraddr; /* where's the code? */ } OrigFn; @@ -753,7 +753,7 @@ typedef #if defined(PLAT_arm64_linux) typedef - struct { + struct { unsigned long long int nraddr; /* where's the code? */ } OrigFn; @@ -898,7 +898,7 @@ typedef #if defined(PLAT_mips32_linux) typedef - struct { + struct { unsigned int nraddr; /* where's the code? */ } OrigFn; @@ -912,7 +912,7 @@ typedef "srl $0, $0, 29\n\t" \ "srl $0, $0, 3\n\t" \ "srl $0, $0, 19\n\t" - + #define VALGRIND_DO_CLIENT_REQUEST_EXPR( \ _zzq_default, _zzq_request, \ _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \ @@ -2161,7 +2161,7 @@ typedef #define VALGRIND_RESTORE_STACK \ "mr 1,28\n\t" -/* These CALL_FN_ macros assume that on ppc32-linux, +/* These CALL_FN_ macros assume that on ppc32-linux, sizeof(unsigned long) == 4. */ #define CALL_FN_W_v(lval, orig) \ @@ -4678,7 +4678,7 @@ typedef #define __CALLER_SAVED_REGS "0","1","2","3","4","5","14", \ "f0","f1","f2","f3","f4","f5","f6","f7" -/* Nb: Although r11 is modified in the asm snippets below (inside +/* Nb: Although r11 is modified in the asm snippets below (inside VALGRIND_CFI_PROLOGUE) it is not listed in the clobber section, for two reasons: (1) r11 is restored in VALGRIND_CFI_EPILOGUE, so effectively it is not @@ -5128,7 +5128,7 @@ typedef #endif /* PLAT_s390x_linux */ /* ------------------------- mips32-linux ----------------------- */ - + #if defined(PLAT_mips32_linux) /* These regs are trashed by the hidden call. */ @@ -6104,7 +6104,7 @@ typedef #define VG_IS_TOOL_USERREQ(a, b, v) \ (VG_USERREQ_TOOL_BASE(a,b) == ((v) & 0xffff0000)) -/* !! ABIWARNING !! ABIWARNING !! ABIWARNING !! ABIWARNING !! +/* !! ABIWARNING !! ABIWARNING !! ABIWARNING !! ABIWARNING !! This enum comprises an ABI exported by Valgrind to programs which use client requests. DO NOT CHANGE THE ORDER OF THESE ENTRIES, NOR DELETE ANY -- add new ones at the end. */ @@ -6242,7 +6242,7 @@ VALGRIND_PRINTF(const char *format, ...) _qzz_res = VALGRIND_DO_CLIENT_REQUEST_EXPR(0, VG_USERREQ__PRINTF_VALIST_BY_REF, (unsigned long)format, - (unsigned long)&vargs, + (unsigned long)&vargs, 0, 0, 0); #endif va_end(vargs); @@ -6280,7 +6280,7 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...) _qzz_res = VALGRIND_DO_CLIENT_REQUEST_EXPR(0, VG_USERREQ__PRINTF_BACKTRACE_VALIST_BY_REF, (unsigned long)format, - (unsigned long)&vargs, + (unsigned long)&vargs, 0, 0, 0); #endif va_end(vargs); @@ -6291,7 +6291,7 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...) /* These requests allow control to move from the simulated CPU to the real CPU, calling an arbitary function. - + Note that the current ThreadId is inserted as the first argument. So this call: @@ -6377,7 +6377,7 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...) - It marks the block as being addressable and undefined (if 'is_zeroed' is not set), or addressable and defined (if 'is_zeroed' is set). This controls how accesses to the block by the program are handled. - + 'addr' is the start of the usable block (ie. after any redzone), 'sizeB' is its size. 'rzB' is the redzone size if the allocator can apply redzones -- these are blocks of padding at the start and end of @@ -6385,7 +6385,7 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...) Valgrind will spot block overruns. `is_zeroed' indicates if the memory is zeroed (or filled with another predictable value), as is the case for calloc(). - + VALGRIND_MALLOCLIKE_BLOCK should be put immediately after the point where a heap block -- that will be used by the client program -- is allocated. It's best to put it at the outermost level of the allocator if possible; diff --git a/modules/libcom/src/yacc/antelope.c b/modules/libcom/src/yacc/antelope.c index 620035799..350dec7b3 100644 --- a/modules/libcom/src/yacc/antelope.c +++ b/modules/libcom/src/yacc/antelope.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include #include "defs.h" @@ -39,18 +39,18 @@ char *input_file_name = ""; char *output_file_name; char *verbose_file_name; -FILE *action_file; /* a temp file, used to save actions associated */ - /* with rules until the parser is written */ -FILE *code_file; /* y.code.c (used when the -r option is specified) */ -FILE *defines_file; /* y.tab.h */ -FILE *input_file; /* the input file */ -FILE *output_file; /* y.tab.c */ -FILE *text_file; /* a temp file, used to save text until all */ - /* symbols have been defined */ -FILE *union_file; /* a temp file, used to save the union */ - /* definition until all symbol have been */ - /* defined */ -FILE *verbose_file; /* y.output */ +FILE *action_file; /* a temp file, used to save actions associated */ + /* with rules until the parser is written */ +FILE *code_file; /* y.code.c (used when the -r option is specified) */ +FILE *defines_file; /* y.tab.h */ +FILE *input_file; /* the input file */ +FILE *output_file; /* y.tab.c */ +FILE *text_file; /* a temp file, used to save text until all */ + /* symbols have been defined */ +FILE *union_file; /* a temp file, used to save the union */ + /* definition until all symbol have been */ + /* defined */ +FILE *verbose_file; /* y.output */ int nitems; int nrules; @@ -95,15 +95,15 @@ set_signals(void) { #ifdef SIGINT if (signal(SIGINT, SIG_IGN) != SIG_IGN) - signal(SIGINT, onintr); + signal(SIGINT, onintr); #endif #ifdef SIGTERM if (signal(SIGTERM, SIG_IGN) != SIG_IGN) - signal(SIGTERM, onintr); + signal(SIGTERM, onintr); #endif #ifdef SIGHUP if (signal(SIGHUP, SIG_IGN) != SIG_IGN) - signal(SIGHUP, onintr); + signal(SIGHUP, onintr); #endif } @@ -124,97 +124,97 @@ getargs(int argc, char *argv[]) if (argc > 0) { myname = strrchr(argv[0], '/'); - if (myname) myname++; - else myname = argv[0]; + if (myname) myname++; + else myname = argv[0]; } for (i = 1; i < argc; ++i) { - s = argv[i]; - if (*s != '-') break; - switch (*++s) - { - case '\0': - input_file = stdin; - if (i + 1 < argc) usage(); - return(0); + s = argv[i]; + if (*s != '-') break; + switch (*++s) + { + case '\0': + input_file = stdin; + if (i + 1 < argc) usage(); + return(0); - case '-': - ++i; - goto no_more_options; + case '-': + ++i; + goto no_more_options; - case 'b': - if (*++s) - file_prefix = s; - else if (++i < argc) - file_prefix = argv[i]; - else - usage(); - continue; + case 'b': + if (*++s) + file_prefix = s; + else if (++i < argc) + file_prefix = argv[i]; + else + usage(); + continue; - case 'd': - dflag = 1; - break; + case 'd': + dflag = 1; + break; - case 'l': - lflag = 1; - break; + case 'l': + lflag = 1; + break; - case 'p': - if (*++s) - symbol_prefix = s; - else if (++i < argc) - symbol_prefix = argv[i]; - else - usage(); - continue; + case 'p': + if (*++s) + symbol_prefix = s; + else if (++i < argc) + symbol_prefix = argv[i]; + else + usage(); + continue; - case 'r': - rflag = 1; - break; + case 'r': + rflag = 1; + break; - case 't': - tflag = 1; - break; + case 't': + tflag = 1; + break; - case 'v': - vflag = 1; - break; + case 'v': + vflag = 1; + break; - default: - usage(); - } + default: + usage(); + } - for (;;) - { - switch (*++s) - { - case '\0': - goto end_of_option; + for (;;) + { + switch (*++s) + { + case '\0': + goto end_of_option; - case 'd': - dflag = 1; - break; + case 'd': + dflag = 1; + break; - case 'l': - lflag = 1; - break; + case 'l': + lflag = 1; + break; - case 'r': - rflag = 1; - break; + case 'r': + rflag = 1; + break; - case 't': - tflag = 1; - break; + case 't': + tflag = 1; + break; - case 'v': - vflag = 1; - break; + case 'v': + vflag = 1; + break; - default: - usage(); - } - } + default: + usage(); + } + } end_of_option:; } @@ -222,7 +222,7 @@ no_more_options:; if (i + 1 != argc) usage(); input_file_name = argv[i]; - return(0); + return(0); } @@ -234,8 +234,8 @@ allocate(unsigned int n) p = NULL; if (n) { - p = CALLOC(1, n); - if (!p) no_space(); + p = CALLOC(1, n); + if (!p) no_space(); } return (p); } @@ -245,42 +245,42 @@ static void create_file_names(void) { int len; - + len = strlen(file_prefix); output_file_name = MALLOC(len + 7); if (output_file_name == 0) - no_space(); + no_space(); strcpy(output_file_name, file_prefix); strcpy(output_file_name + len, OUTPUT_SUFFIX); if (rflag) { - code_file_name = MALLOC(len + 8); - if (code_file_name == 0) - no_space(); - strcpy(code_file_name, file_prefix); - strcpy(code_file_name + len, CODE_SUFFIX); + code_file_name = MALLOC(len + 8); + if (code_file_name == 0) + no_space(); + strcpy(code_file_name, file_prefix); + strcpy(code_file_name + len, CODE_SUFFIX); } else - code_file_name = output_file_name; + code_file_name = output_file_name; if (dflag) { - defines_file_name = MALLOC(len + 7); - if (defines_file_name == 0) - no_space(); - strcpy(defines_file_name, file_prefix); - strcpy(defines_file_name + len, DEFINES_SUFFIX); + defines_file_name = MALLOC(len + 7); + if (defines_file_name == 0) + no_space(); + strcpy(defines_file_name, file_prefix); + strcpy(defines_file_name + len, DEFINES_SUFFIX); } if (vflag) { - verbose_file_name = MALLOC(len + 8); - if (verbose_file_name == 0) - no_space(); - strcpy(verbose_file_name, file_prefix); - strcpy(verbose_file_name + len, VERBOSE_SUFFIX); + verbose_file_name = MALLOC(len + 8); + if (verbose_file_name == 0) + no_space(); + strcpy(verbose_file_name, file_prefix); + strcpy(verbose_file_name + len, VERBOSE_SUFFIX); } } @@ -292,48 +292,48 @@ open_files(void) if (input_file == 0) { - input_file = fopen(input_file_name, "r"); - if (input_file == 0) - open_error(input_file_name); + input_file = fopen(input_file_name, "r"); + if (input_file == 0) + open_error(input_file_name); } action_file = epicsTempFile(); if (action_file == 0) - open_error("temp action file"); + open_error("temp action file"); text_file = epicsTempFile(); if (text_file == 0) - open_error("temp text file"); + open_error("temp text file"); if (vflag) { - verbose_file = fopen(verbose_file_name, "w"); - if (verbose_file == 0) - open_error(verbose_file_name); + verbose_file = fopen(verbose_file_name, "w"); + if (verbose_file == 0) + open_error(verbose_file_name); } if (dflag) { - defines_file = fopen(defines_file_name, "w"); - if (defines_file == 0) - open_error(defines_file_name); - union_file = epicsTempFile(); - if (union_file == 0) - open_error("temp union file"); + defines_file = fopen(defines_file_name, "w"); + if (defines_file == 0) + open_error(defines_file_name); + union_file = epicsTempFile(); + if (union_file == 0) + open_error("temp union file"); } output_file = fopen(output_file_name, "w"); if (output_file == 0) - open_error(output_file_name); + open_error(output_file_name); if (rflag) { - code_file = fopen(code_file_name, "w"); - if (code_file == 0) - open_error(code_file_name); + code_file = fopen(code_file_name, "w"); + if (code_file == 0) + open_error(code_file_name); } else - code_file = output_file; + code_file = output_file; } diff --git a/modules/libcom/src/yacc/closure.c b/modules/libcom/src/yacc/closure.c index f08c8cd92..6e0a4643a 100644 --- a/modules/libcom/src/yacc/closure.c +++ b/modules/libcom/src/yacc/closure.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include "defs.h" @@ -39,22 +39,22 @@ set_EFF(void) row = EFF; for (i = start_symbol; i < nsyms; i++) { - sp = derives[i]; - for (rule = *sp; rule > 0; rule = *++sp) - { - symbol = ritem[rrhs[rule]]; - if (ISVAR(symbol)) - { - symbol -= start_symbol; - SETBIT(row, symbol); - } - } - row += rowsize; + sp = derives[i]; + for (rule = *sp; rule > 0; rule = *++sp) + { + symbol = ritem[rrhs[rule]]; + if (ISVAR(symbol)) + { + symbol -= start_symbol; + SETBIT(row, symbol); + } + } + row += rowsize; } reflexive_transitive_closure(EFF, nvars); -#ifdef DEBUG +#ifdef DEBUG print_EFF(); #endif } @@ -84,31 +84,31 @@ set_first_derives(void) rrow = first_derives + ntokens * rulesetsize; for (i = start_symbol; i < nsyms; i++) { - vrow = EFF + ((i - ntokens) * varsetsize); - k = BITS_PER_WORD; - for (j = start_symbol; j < nsyms; k++, j++) - { - if (k >= BITS_PER_WORD) - { - cword = *vrow++; - k = 0; - } + vrow = EFF + ((i - ntokens) * varsetsize); + k = BITS_PER_WORD; + for (j = start_symbol; j < nsyms; k++, j++) + { + if (k >= BITS_PER_WORD) + { + cword = *vrow++; + k = 0; + } - if (cword & (1 << k)) - { - rp = derives[j]; - while ((rule = *rp++) >= 0) - { - SETBIT(rrow, rule); - } - } - } + if (cword & (1 << k)) + { + rp = derives[j]; + while ((rule = *rp++) >= 0) + { + SETBIT(rrow, rule); + } + } + } - vrow += varsetsize; - rrow += rulesetsize; + vrow += varsetsize; + rrow += rulesetsize; } -#ifdef DEBUG +#ifdef DEBUG print_first_derives(); #endif @@ -136,19 +136,19 @@ closure(short int *nucleus, int n) rsp = ruleset; rsend = ruleset + rulesetsize; for (rsp = ruleset; rsp < rsend; rsp++) - *rsp = 0; + *rsp = 0; csend = nucleus + n; for (csp = nucleus; csp < csend; ++csp) { - symbol = ritem[*csp]; - if (ISVAR(symbol)) - { - dsp = first_derives + symbol * rulesetsize; - rsp = ruleset; - while (rsp < rsend) - *rsp++ |= *dsp++; - } + symbol = ritem[*csp]; + if (ISVAR(symbol)) + { + dsp = first_derives + symbol * rulesetsize; + rsp = ruleset; + while (rsp < rsend) + *rsp++ |= *dsp++; + } } ruleno = 0; @@ -156,29 +156,29 @@ closure(short int *nucleus, int n) csp = nucleus; for (rsp = ruleset; rsp < rsend; ++rsp) { - word = *rsp; - if (word) - { - for (i = 0; i < BITS_PER_WORD; ++i) - { - if (word & (1 << i)) - { - itemno = rrhs[ruleno+i]; - while (csp < csend && *csp < itemno) - *itemsetend++ = *csp++; - *itemsetend++ = itemno; - while (csp < csend && *csp == itemno) - ++csp; - } - } - } - ruleno += BITS_PER_WORD; + word = *rsp; + if (word) + { + for (i = 0; i < BITS_PER_WORD; ++i) + { + if (word & (1 << i)) + { + itemno = rrhs[ruleno+i]; + while (csp < csend && *csp < itemno) + *itemsetend++ = *csp++; + *itemsetend++ = itemno; + while (csp < csend && *csp == itemno) + ++csp; + } + } + } + ruleno += BITS_PER_WORD; } while (csp < csend) - *itemsetend++ = *csp++; + *itemsetend++ = *csp++; -#ifdef DEBUG +#ifdef DEBUG print_closure(n); #endif } @@ -219,22 +219,22 @@ print_EFF(void) for (i = start_symbol; i < nsyms; i++) { - printf("\n%s", symbol_name[i]); - rowp = EFF + ((i - start_symbol) * WORDSIZE(nvars)); - word = *rowp++; + printf("\n%s", symbol_name[i]); + rowp = EFF + ((i - start_symbol) * WORDSIZE(nvars)); + word = *rowp++; - k = BITS_PER_WORD; - for (j = 0; j < nvars; k++, j++) - { - if (k >= BITS_PER_WORD) - { - word = *rowp++; - k = 0; - } + k = BITS_PER_WORD; + for (j = 0; j < nvars; k++, j++) + { + if (k >= BITS_PER_WORD) + { + word = *rowp++; + k = 0; + } - if (word & (1 << k)) - printf(" %s", symbol_name[start_symbol + j]); - } + if (word & (1 << k)) + printf(" %s", symbol_name[start_symbol + j]); + } } } @@ -252,20 +252,20 @@ print_first_derives(void) for (i = start_symbol; i < nsyms; i++) { - printf("\n%s derives\n", symbol_name[i]); - rp = first_derives + i * WORDSIZE(nrules); - k = BITS_PER_WORD; - for (j = 0; j <= nrules; k++, j++) + printf("\n%s derives\n", symbol_name[i]); + rp = first_derives + i * WORDSIZE(nrules); + k = BITS_PER_WORD; + for (j = 0; j <= nrules; k++, j++) { - if (k >= BITS_PER_WORD) - { - cword = *rp++; - k = 0; - } + if (k >= BITS_PER_WORD) + { + cword = *rp++; + k = 0; + } - if (cword & (1 << k)) - printf(" %d\n", j); - } + if (cword & (1 << k)) + printf(" %d\n", j); + } } fflush(stdout); diff --git a/modules/libcom/src/yacc/defs.h b/modules/libcom/src/yacc/defs.h index 36b295fa8..9747de58a 100644 --- a/modules/libcom/src/yacc/defs.h +++ b/modules/libcom/src/yacc/defs.h @@ -4,59 +4,59 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include #include #include -/* machine-dependent definitions */ -/* the following definitions are for the Tahoe */ -/* they might have to be changed for other machines */ +/* machine-dependent definitions */ +/* the following definitions are for the Tahoe */ +/* they might have to be changed for other machines */ -/* MAXCHAR is the largest unsigned character value */ -/* MAXSHORT is the largest value of a C short */ -/* MINSHORT is the most negative value of a C short */ -/* MAXTABLE is the maximum table size */ -/* BITS_PER_WORD is the number of bits in a C unsigned */ -/* WORDSIZE computes the number of words needed to */ -/* store n bits */ -/* BIT returns the value of the n-th bit starting */ -/* from r (0-indexed) */ -/* SETBIT sets the n-th bit starting from r */ +/* MAXCHAR is the largest unsigned character value */ +/* MAXSHORT is the largest value of a C short */ +/* MINSHORT is the most negative value of a C short */ +/* MAXTABLE is the maximum table size */ +/* BITS_PER_WORD is the number of bits in a C unsigned */ +/* WORDSIZE computes the number of words needed to */ +/* store n bits */ +/* BIT returns the value of the n-th bit starting */ +/* from r (0-indexed) */ +/* SETBIT sets the n-th bit starting from r */ -#define MAXCHAR 255 -#define MAXSHORT 32767 -#define MINSHORT -32768 -#define MAXTABLE 32500 -#define BITS_PER_WORD 32 -#define WORDSIZE(n) (((n)+(BITS_PER_WORD-1))/BITS_PER_WORD) -#define BIT(r, n) ((((r)[(n)>>5])>>((n)&31))&1) -#define SETBIT(r, n) ((r)[(n)>>5]|=((unsigned)1<<((n)&31))) +#define MAXCHAR 255 +#define MAXSHORT 32767 +#define MINSHORT -32768 +#define MAXTABLE 32500 +#define BITS_PER_WORD 32 +#define WORDSIZE(n) (((n)+(BITS_PER_WORD-1))/BITS_PER_WORD) +#define BIT(r, n) ((((r)[(n)>>5])>>((n)&31))&1) +#define SETBIT(r, n) ((r)[(n)>>5]|=((unsigned)1<<((n)&31))) /* character names */ -#define NUL '\0' /* the null character */ -#define NEWLINE '\n' /* line feed */ -#define SP ' ' /* space */ -#define BS '\b' /* backspace */ -#define HT '\t' /* horizontal tab */ -#define VT '\013' /* vertical tab */ -#define CR '\r' /* carriage return */ -#define FF '\f' /* form feed */ -#define QUOTE '\'' /* single quote */ -#define DOUBLE_QUOTE '\"' /* double quote */ -#define BACKSLASH '\\' /* backslash */ +#define NUL '\0' /* the null character */ +#define NEWLINE '\n' /* line feed */ +#define SP ' ' /* space */ +#define BS '\b' /* backspace */ +#define HT '\t' /* horizontal tab */ +#define VT '\013' /* vertical tab */ +#define CR '\r' /* carriage return */ +#define FF '\f' /* form feed */ +#define QUOTE '\'' /* single quote */ +#define DOUBLE_QUOTE '\"' /* double quote */ +#define BACKSLASH '\\' /* backslash */ /* defines for constructing filenames */ -#define CODE_SUFFIX ".code.c" -#define DEFINES_SUFFIX ".tab.h" -#define OUTPUT_SUFFIX ".tab.c" -#define VERBOSE_SUFFIX ".output" +#define CODE_SUFFIX ".code.c" +#define DEFINES_SUFFIX ".tab.h" +#define OUTPUT_SUFFIX ".tab.c" +#define VERBOSE_SUFFIX ".output" /* keyword codes */ @@ -93,25 +93,25 @@ /* character macros */ -#define IS_IDENT(c) (isalnum(c) || (c) == '_' || (c) == '.' || (c) == '$') -#define IS_OCTAL(c) ((c) >= '0' && (c) <= '7') -#define NUMERIC_VALUE(c) ((c) - '0') +#define IS_IDENT(c) (isalnum(c) || (c) == '_' || (c) == '.' || (c) == '$') +#define IS_OCTAL(c) ((c) >= '0' && (c) <= '7') +#define NUMERIC_VALUE(c) ((c) - '0') /* symbol macros */ -#define ISTOKEN(s) ((s) < start_symbol) -#define ISVAR(s) ((s) >= start_symbol) +#define ISTOKEN(s) ((s) < start_symbol) +#define ISVAR(s) ((s) >= start_symbol) /* storage allocation macros */ -#define CALLOC(k,n) (calloc((unsigned)(k),(unsigned)(n))) -#define FREE(x) (free((char*)(x))) -#define MALLOC(n) (malloc((unsigned)(n))) -#define NEW(t) ((t*)allocate(sizeof(t))) -#define NEW2(n,t) ((t*)allocate((unsigned)((n)*sizeof(t)))) -#define REALLOC(p,n) (realloc((char*)(p),(unsigned)(n))) +#define CALLOC(k,n) (calloc((unsigned)(k),(unsigned)(n))) +#define FREE(x) (free((char*)(x))) +#define MALLOC(n) (malloc((unsigned)(n))) +#define NEW(t) ((t*)allocate(sizeof(t))) +#define NEW2(n,t) ((t*)allocate((unsigned)((n)*sizeof(t)))) +#define REALLOC(p,n) (realloc((char*)(p),(unsigned)(n))) /* the structure of a symbol table entry */ diff --git a/modules/libcom/src/yacc/error.c b/modules/libcom/src/yacc/error.c index d95c92a3a..6da8161a7 100644 --- a/modules/libcom/src/yacc/error.c +++ b/modules/libcom/src/yacc/error.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* routines for printing error messages */ @@ -39,7 +39,7 @@ void unexpected_EOF(void) { fprintf(stderr, "%s: error - line %d of \"%s\", unexpected end-of-file\n", - myname, lineno, input_file_name); + myname, lineno, input_file_name); done(1); } @@ -52,22 +52,22 @@ print_pos(char *st_line, char *st_cptr) if (st_line == 0) return(0); for (s = st_line; *s != '\n'; ++s) { - if (isprint((int) *s) || *s == '\t') - putc(*s, stderr); - else - putc('?', stderr); + if (isprint((int) *s) || *s == '\t') + putc(*s, stderr); + else + putc('?', stderr); } putc('\n', stderr); for (s = st_line; s < st_cptr; ++s) { - if (*s == '\t') - putc('\t', stderr); - else - putc(' ', stderr); + if (*s == '\t') + putc('\t', stderr); + else + putc(' ', stderr); } putc('^', stderr); putc('\n', stderr); - return(0); + return(0); } @@ -75,7 +75,7 @@ void syntax_error(int st_lineno, char *st_line, char *st_cptr) { fprintf(stderr, "%s: error - line %d of \"%s\", syntax error\n", - myname, st_lineno, input_file_name); + myname, st_lineno, input_file_name); print_pos(st_line, st_cptr); done(1); } @@ -85,7 +85,7 @@ void unterminated_comment(int c_lineno, char *c_line, char *c_cptr) { fprintf(stderr, "%s: error - line %d of \"%s\", unmatched /*\n", - myname, c_lineno, input_file_name); + myname, c_lineno, input_file_name); print_pos(c_line, c_cptr); done(1); } @@ -95,7 +95,7 @@ void unterminated_string(int s_lineno, char *s_line, char *s_cptr) { fprintf(stderr, "%s: error - line %d of \"%s\", unterminated string\n", - myname, s_lineno, input_file_name); + myname, s_lineno, input_file_name); print_pos(s_line, s_cptr); done(1); } @@ -105,7 +105,7 @@ void unterminated_text(int t_lineno, char *t_line, char *t_cptr) { fprintf(stderr, "%s: error - line %d of \"%s\", unmatched %%{\n", - myname, t_lineno, input_file_name); + myname, t_lineno, input_file_name); print_pos(t_line, t_cptr); done(1); } @@ -135,7 +135,7 @@ void illegal_tag(int t_lineno, char *t_line, char *t_cptr) { fprintf(stderr, "%s: error - line %d of \"%s\", illegal tag\n", - myname, t_lineno, input_file_name); + myname, t_lineno, input_file_name); print_pos(t_line, t_cptr); done(1); } @@ -145,7 +145,7 @@ void illegal_character(char *c_cptr) { fprintf(stderr, "%s: error - line %d of \"%s\", illegal character\n", - myname, lineno, input_file_name); + myname, lineno, input_file_name); print_pos(line, c_cptr); done(1); } @@ -240,7 +240,7 @@ void unterminated_action(int a_lineno, char *a_line, char *a_cptr) { fprintf(stderr, "%s: error - line %d of \"%s\", unterminated action\n", - myname, a_lineno, input_file_name); + myname, a_lineno, input_file_name); print_pos(a_line, a_cptr); done(1); } @@ -258,7 +258,7 @@ void dollar_error(int a_lineno, char *a_line, char *a_cptr) { fprintf(stderr, "%s: error - line %d of \"%s\", illegal $-name\n", - myname, a_lineno, input_file_name); + myname, a_lineno, input_file_name); print_pos(a_line, a_cptr); done(1); } @@ -268,7 +268,7 @@ void untyped_lhs(void) { fprintf(stderr, "%s: error - line %d of \"%s\", $$ is untyped\n", - myname, lineno, input_file_name); + myname, lineno, input_file_name); done(1); } @@ -277,7 +277,7 @@ void untyped_rhs(int i, char *s) { fprintf(stderr, "%s: error - line %d of \"%s\", $%d (%s) is untyped\n", - myname, lineno, input_file_name, i, s); + myname, lineno, input_file_name, i, s); done(1); } @@ -286,7 +286,7 @@ void unknown_rhs(int i) { fprintf(stderr, "%s: error - line %d of \"%s\", $%d is untyped\n", - myname, lineno, input_file_name, i); + myname, lineno, input_file_name, i); done(1); } diff --git a/modules/libcom/src/yacc/lalr.c b/modules/libcom/src/yacc/lalr.c index 1c8850f60..bbe149b8e 100644 --- a/modules/libcom/src/yacc/lalr.c +++ b/modules/libcom/src/yacc/lalr.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include "defs.h" @@ -83,7 +83,7 @@ set_state_table(void) state_table = NEW2(nstates, core *); for (sp = first_state; sp; sp = sp->next) - state_table[sp->number] = sp; + state_table[sp->number] = sp; } @@ -95,7 +95,7 @@ set_accessing_symbol(void) accessing_symbol = NEW2(nstates, short); for (sp = first_state; sp; sp = sp->next) - accessing_symbol[sp->number] = sp->accessing_symbol; + accessing_symbol[sp->number] = sp->accessing_symbol; } @@ -107,7 +107,7 @@ set_shift_table(void) shift_table = NEW2(nstates, shifts *); for (sp = first_shift; sp; sp = sp->next) - shift_table[sp->number] = sp; + shift_table[sp->number] = sp; } @@ -119,7 +119,7 @@ set_reduction_table(void) reduction_table = NEW2(nstates, reductions *); for (rp = first_reduction; rp; rp = rp->next) - reduction_table[rp->number] = rp; + reduction_table[rp->number] = rp; } @@ -138,14 +138,14 @@ set_maxrhs(void) for (itemp = ritem; itemp < item_end; itemp++) { if (*itemp >= 0) - { - length++; - } + { + length++; + } else - { - if (length > max) max = length; - length = 0; - } + { + if (length > max) max = length; + length = 0; + } } maxrhs = max; @@ -167,7 +167,7 @@ initialize_LA(void) lookaheads[i] = k; rp = reduction_table[i]; if (rp) - k += rp->nreds; + k += rp->nreds; } lookaheads[nstates] = k; @@ -180,13 +180,13 @@ initialize_LA(void) { rp = reduction_table[i]; if (rp) - { - for (j = 0; j < rp->nreds; j++) - { - LAruleno[k] = rp->rules[j]; - k++; - } - } + { + for (j = 0; j < rp->nreds; j++) + { + LAruleno[k] = rp->rules[j]; + k++; + } + } } } @@ -209,16 +209,16 @@ set_goto_map(void) for (sp = first_shift; sp; sp = sp->next) { for (i = sp->nshifts - 1; i >= 0; i--) - { - symbol = accessing_symbol[sp->shift[i]]; + { + symbol = accessing_symbol[sp->shift[i]]; - if (ISTOKEN(symbol)) break; + if (ISTOKEN(symbol)) break; - if (ngotos == MAXSHORT) - fatal("too many gotos"); + if (ngotos == MAXSHORT) + fatal("too many gotos"); - ngotos++; - goto_map[symbol]++; + ngotos++; + goto_map[symbol]++; } } @@ -242,16 +242,16 @@ set_goto_map(void) { state1 = sp->number; for (i = sp->nshifts - 1; i >= 0; i--) - { - state2 = sp->shift[i]; - symbol = accessing_symbol[state2]; + { + state2 = sp->shift[i]; + symbol = accessing_symbol[state2]; - if (ISTOKEN(symbol)) break; + if (ISTOKEN(symbol)) break; - k = temp_map[symbol]++; - from_state[k] = state1; - to_state[k] = state2; - } + k = temp_map[symbol]++; + from_state[k] = state1; + to_state[k] = state2; + } } FREE(temp_map + ntokens); @@ -259,7 +259,7 @@ set_goto_map(void) -/* Map_goto maps a state/symbol pair into its numeric representation. */ +/* Map_goto maps a state/symbol pair into its numeric representation. */ int map_goto(int state, int symbol) @@ -274,15 +274,15 @@ map_goto(int state, int symbol) for (;;) { - assert(low <= high); - middle = (low + high) >> 1; - s = from_state[middle]; - if (s == state) - return (middle); - else if (s < state) - low = middle + 1; - else - high = middle - 1; + assert(low <= high); + middle = (low + high) >> 1; + s = from_state[middle]; + if (s == state) + return (middle); + else if (s < state) + low = middle + 1; + else + high = middle - 1; } } @@ -318,35 +318,35 @@ initialize_F(void) sp = shift_table[stateno]; if (sp) - { - k = sp->nshifts; + { + k = sp->nshifts; - for (j = 0; j < k; j++) - { - symbol = accessing_symbol[sp->shift[j]]; - if (ISVAR(symbol)) - break; - SETBIT(rowp, symbol); - } + for (j = 0; j < k; j++) + { + symbol = accessing_symbol[sp->shift[j]]; + if (ISVAR(symbol)) + break; + SETBIT(rowp, symbol); + } - for (; j < k; j++) - { - symbol = accessing_symbol[sp->shift[j]]; - if (nullable[symbol]) - edge[nedges++] = map_goto(stateno, symbol); - } - - if (nedges) - { - reads[i] = rp = NEW2(nedges + 1, short); + for (; j < k; j++) + { + symbol = accessing_symbol[sp->shift[j]]; + if (nullable[symbol]) + edge[nedges++] = map_goto(stateno, symbol); + } - for (j = 0; j < nedges; j++) - rp[j] = edge[j]; + if (nedges) + { + reads[i] = rp = NEW2(nedges + 1, short); - rp[nedges] = -1; - nedges = 0; - } - } + for (j = 0; j < nedges; j++) + rp[j] = edge[j]; + + rp[nedges] = -1; + nedges = 0; + } + } rowp += tokensetsize; } @@ -357,7 +357,7 @@ initialize_F(void) for (i = 0; i < ngotos; i++) { if (reads[i]) - FREE(reads[i]); + FREE(reads[i]); } FREE(reads); @@ -398,50 +398,50 @@ build_relations(void) symbol1 = accessing_symbol[to_state[i]]; for (rulep = derives[symbol1]; *rulep >= 0; rulep++) - { - length = 1; - states[0] = state1; - stateno = state1; + { + length = 1; + states[0] = state1; + stateno = state1; - for (rp = ritem + rrhs[*rulep]; *rp >= 0; rp++) - { - symbol2 = *rp; - sp = shift_table[stateno]; - k = sp->nshifts; + for (rp = ritem + rrhs[*rulep]; *rp >= 0; rp++) + { + symbol2 = *rp; + sp = shift_table[stateno]; + k = sp->nshifts; - for (j = 0; j < k; j++) - { - stateno = sp->shift[j]; - if (accessing_symbol[stateno] == symbol2) break; - } + for (j = 0; j < k; j++) + { + stateno = sp->shift[j]; + if (accessing_symbol[stateno] == symbol2) break; + } - states[length++] = stateno; - } + states[length++] = stateno; + } - add_lookback_edge(stateno, *rulep, i); + add_lookback_edge(stateno, *rulep, i); - length--; - done = 0; - while (!done) - { - done = 1; - rp--; - if (ISVAR(*rp)) - { - stateno = states[--length]; - edge[nedges++] = map_goto(stateno, *rp); - if (nullable[*rp] && length > 0) done = 0; - } - } - } + length--; + done = 0; + while (!done) + { + done = 1; + rp--; + if (ISVAR(*rp)) + { + stateno = states[--length]; + edge[nedges++] = map_goto(stateno, *rp); + if (nullable[*rp] && length > 0) done = 0; + } + } + } if (nedges) - { - includes[i] = shortp = NEW2(nedges + 1, short); - for (j = 0; j < nedges; j++) - shortp[j] = edge[j]; - shortp[nedges] = -1; - } + { + includes[i] = shortp = NEW2(nedges + 1, short); + for (j = 0; j < nedges; j++) + shortp[j] = edge[j]; + shortp[nedges] = -1; + } } new_includes = transpose(includes, ngotos); @@ -471,10 +471,10 @@ add_lookback_edge(int stateno, int ruleno, int gotono) found = 0; while (!found && i < k) { - if (LAruleno[i] == ruleno) - found = 1; - else - ++i; + if (LAruleno[i] == ruleno) + found = 1; + else + ++i; } assert(found); @@ -502,10 +502,10 @@ transpose(short int **R, int n) { sp = R[i]; if (sp) - { - while (*sp >= 0) - nedges[*sp++]++; - } + { + while (*sp >= 0) + nedges[*sp++]++; + } } new_R = NEW2(n, short *); @@ -515,12 +515,12 @@ transpose(short int **R, int n) { k = nedges[i]; if (k > 0) - { - sp = NEW2(k + 1, short); - new_R[i] = sp; - temp_R[i] = sp; - sp[k] = -1; - } + { + sp = NEW2(k + 1, short); + new_R[i] = sp; + temp_R[i] = sp; + sp[k] = -1; + } } FREE(nedges); @@ -529,10 +529,10 @@ transpose(short int **R, int n) { sp = R[i]; if (sp) - { - while (*sp >= 0) - *temp_R[*sp++]++ = i; - } + { + while (*sp >= 0) + *temp_R[*sp++]++ = i; + } } FREE(temp_R); @@ -563,12 +563,12 @@ compute_lookaheads(void) { fp3 = rowp + tokensetsize; for (sp = lookback[i]; sp; sp = sp->next) - { - fp1 = rowp; - fp2 = F + tokensetsize * sp->value; - while (fp1 < fp3) - *fp1++ |= *fp2++; - } + { + fp1 = rowp; + fp2 = F + tokensetsize * sp->value; + while (fp1 < fp3) + *fp1++ |= *fp2++; + } rowp = fp3; } @@ -602,7 +602,7 @@ digraph(short **relation) for (i = 0; i < ngotos; i++) { if (INDEX[i] == 0 && R[i]) - traverse(i); + traverse(i); } FREE(INDEX); @@ -633,36 +633,36 @@ traverse(int i) if (rp) { while ((j = *rp++) >= 0) - { - if (INDEX[j] == 0) - traverse(j); + { + if (INDEX[j] == 0) + traverse(j); - if (INDEX[i] > INDEX[j]) - INDEX[i] = INDEX[j]; + if (INDEX[i] > INDEX[j]) + INDEX[i] = INDEX[j]; - fp1 = base; - fp2 = F + j * tokensetsize; + fp1 = base; + fp2 = F + j * tokensetsize; - while (fp1 < fp3) - *fp1++ |= *fp2++; - } + while (fp1 < fp3) + *fp1++ |= *fp2++; + } } if (INDEX[i] == height) { for (;;) - { - j = VERTICES[top--]; - INDEX[j] = infinity; + { + j = VERTICES[top--]; + INDEX[j] = infinity; - if (i == j) - break; + if (i == j) + break; - fp1 = base; - fp2 = F + j * tokensetsize; + fp1 = base; + fp2 = F + j * tokensetsize; - while (fp1 < fp3) - *fp2++ = *fp1++; - } + while (fp1 < fp3) + *fp2++ = *fp1++; + } } } diff --git a/modules/libcom/src/yacc/lr0.c b/modules/libcom/src/yacc/lr0.c index 23b950930..7cf7521ba 100644 --- a/modules/libcom/src/yacc/lr0.c +++ b/modules/libcom/src/yacc/lr0.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include "defs.h" @@ -62,12 +62,12 @@ allocate_itemsets(void) item_end = ritem + nitems; for (itemp = ritem; itemp < item_end; itemp++) { - symbol = *itemp; - if (symbol >= 0) - { - count++; - symbol_count[symbol]++; - } + symbol = *itemp; + if (symbol >= 0) + { + count++; + symbol_count[symbol]++; + } } kernel_base = NEW2(nsyms, short *); @@ -77,10 +77,10 @@ allocate_itemsets(void) max = 0; for (i = 0; i < nsyms; i++) { - kernel_base[i] = kernel_items + count; - count += symbol_count[i]; - if (max < symbol_count[i]) - max = symbol_count[i]; + kernel_base[i] = kernel_items + count; + count += symbol_count[i]; + if (max < symbol_count[i]) + max = symbol_count[i]; } shift_symbol = symbol_count; @@ -103,25 +103,25 @@ append_states(void) int j; int symbol; -#ifdef TRACE +#ifdef TRACE fprintf(stderr, "Entering append_states()\n"); #endif for (i = 1; i < nshifts; i++) { - symbol = shift_symbol[i]; - j = i; - while (j > 0 && shift_symbol[j - 1] > symbol) - { - shift_symbol[j] = shift_symbol[j - 1]; - j--; - } - shift_symbol[j] = symbol; + symbol = shift_symbol[i]; + j = i; + while (j > 0 && shift_symbol[j - 1] > symbol) + { + shift_symbol[j] = shift_symbol[j - 1]; + j--; + } + shift_symbol[j] = symbol; } for (i = 0; i < nshifts; i++) { - symbol = shift_symbol[i]; - shiftset[i] = get_state(symbol); + symbol = shift_symbol[i]; + shiftset[i] = get_state(symbol); } } @@ -149,15 +149,15 @@ generate_states(void) while (this_state) { - closure(this_state->items, this_state->nitems); - save_reductions(); - new_itemsets(); - append_states(); + closure(this_state->items, this_state->nitems); + save_reductions(); + new_itemsets(); + append_states(); - if (nshifts > 0) - save_shifts(); + if (nshifts > 0) + save_shifts(); - this_state = this_state->next; + this_state = this_state->next; } finalize_closure(); @@ -177,7 +177,7 @@ get_state(int symbol) int found; int n; -#ifdef TRACE +#ifdef TRACE fprintf(stderr, "Entering get_state(%d)\n", symbol); #endif @@ -190,39 +190,39 @@ get_state(int symbol) sp = state_set[key]; if (sp) { - found = 0; - while (!found) - { - if (sp->nitems == n) - { - found = 1; - isp1 = kernel_base[symbol]; - isp2 = sp->items; + found = 0; + while (!found) + { + if (sp->nitems == n) + { + found = 1; + isp1 = kernel_base[symbol]; + isp2 = sp->items; - while (found && isp1 < iend) - { - if (*isp1++ != *isp2++) - found = 0; - } - } + while (found && isp1 < iend) + { + if (*isp1++ != *isp2++) + found = 0; + } + } - if (!found) - { - if (sp->link) - { - sp = sp->link; - } - else - { - sp = sp->link = new_state(symbol); - found = 1; - } - } - } + if (!found) + { + if (sp->link) + { + sp = sp->link; + } + else + { + sp = sp->link = new_state(symbol); + found = 1; + } + } + } } else { - state_set[key] = sp = new_state(symbol); + state_set[key] = sp = new_state(symbol); } return (sp->number); @@ -238,7 +238,7 @@ initialize_states(void) start_derives = derives[start_symbol]; for (i = 0; start_derives[i] >= 0; ++i) - continue; + continue; p = (core *) MALLOC(sizeof(core) + i*sizeof(short)); if (p == 0) no_space(); @@ -250,7 +250,7 @@ initialize_states(void) p->nitems = i; for (i = 0; start_derives[i] >= 0; ++i) - p->items[i] = rrhs[start_derives[i]]; + p->items[i] = rrhs[start_derives[i]]; first_state = last_state = this_state = p; nstates = 1; @@ -266,26 +266,26 @@ new_itemsets(void) int symbol; for (i = 0; i < nsyms; i++) - kernel_end[i] = 0; + kernel_end[i] = 0; shiftcount = 0; isp = itemset; while (isp < itemsetend) { - i = *isp++; - symbol = ritem[i]; - if (symbol > 0) - { - ksp = kernel_end[symbol]; - if (!ksp) - { - shift_symbol[shiftcount++] = symbol; - ksp = kernel_base[symbol]; - } + i = *isp++; + symbol = ritem[i]; + if (symbol > 0) + { + ksp = kernel_end[symbol]; + if (!ksp) + { + shift_symbol[shiftcount++] = symbol; + ksp = kernel_base[symbol]; + } - *ksp++ = i + 1; - kernel_end[symbol] = ksp; - } + *ksp++ = i + 1; + kernel_end[symbol] = ksp; + } } nshifts = shiftcount; @@ -302,12 +302,12 @@ new_state(int symbol) short *isp2; short *iend; -#ifdef TRACE +#ifdef TRACE fprintf(stderr, "Entering new_state(%d)\n", symbol); #endif if (nstates >= MAXSHORT) - fatal("too many states"); + fatal("too many states"); isp1 = kernel_base[symbol]; iend = kernel_end[symbol]; @@ -320,7 +320,7 @@ new_state(int symbol) isp2 = p->items; while (isp1 < iend) - *isp2++ = *isp1++; + *isp2++ = *isp1++; last_state->next = p; last_state = p; @@ -342,26 +342,26 @@ show_cores(void) k = 0; for (p = first_state; p; ++k, p = p->next) { - if (k) printf("\n"); - printf("state %d, number = %d, accessing symbol = %s\n", - k, p->number, symbol_name[p->accessing_symbol]); - n = p->nitems; - for (i = 0; i < n; ++i) - { - itemno = p->items[i]; - printf("%4d ", itemno); - j = itemno; - while (ritem[j] >= 0) ++j; - printf("%s :", symbol_name[rlhs[-ritem[j]]]); - j = rrhs[-ritem[j]]; - while (j < itemno) - printf(" %s", symbol_name[ritem[j++]]); - printf(" ."); - while (ritem[j] >= 0) - printf(" %s", symbol_name[ritem[j++]]); - printf("\n"); - fflush(stdout); - } + if (k) printf("\n"); + printf("state %d, number = %d, accessing symbol = %s\n", + k, p->number, symbol_name[p->accessing_symbol]); + n = p->nitems; + for (i = 0; i < n; ++i) + { + itemno = p->items[i]; + printf("%4d ", itemno); + j = itemno; + while (ritem[j] >= 0) ++j; + printf("%s :", symbol_name[rlhs[-ritem[j]]]); + j = rrhs[-ritem[j]]; + while (j < itemno) + printf(" %s", symbol_name[ritem[j++]]); + printf(" ."); + while (ritem[j] >= 0) + printf(" %s", symbol_name[ritem[j++]]); + printf("\n"); + fflush(stdout); + } } } @@ -372,7 +372,7 @@ show_ritems(void) int i; for (i = 0; i < nitems; ++i) - printf("ritem[%d] = %d\n", i, ritem[i]); + printf("ritem[%d] = %d\n", i, ritem[i]); } @@ -382,7 +382,7 @@ show_rrhs(void) int i; for (i = 0; i < nrules; ++i) - printf("rrhs[%d] = %d\n", i, rrhs[i]); + printf("rrhs[%d] = %d\n", i, rrhs[i]); } @@ -395,12 +395,12 @@ show_shifts(void) k = 0; for (p = first_shift; p; ++k, p = p->next) { - if (k) printf("\n"); - printf("shift %d, number = %d, nshifts = %d\n", k, p->number, - p->nshifts); - j = p->nshifts; - for (i = 0; i < j; ++i) - printf("\t%d\n", p->shift[i]); + if (k) printf("\n"); + printf("shift %d, number = %d, nshifts = %d\n", k, p->number, + p->nshifts); + j = p->nshifts; + for (i = 0; i < j; ++i) + printf("\t%d\n", p->shift[i]); } } #endif @@ -414,7 +414,7 @@ save_shifts(void) short *send; p = (shifts *) allocate((unsigned) (sizeof(shifts) + - (nshifts - 1) * sizeof(short))); + (nshifts - 1) * sizeof(short))); p->number = this_state->number; p->nshifts = nshifts; @@ -424,17 +424,17 @@ save_shifts(void) send = shiftset + nshifts; while (sp1 < send) - *sp2++ = *sp1++; + *sp2++ = *sp1++; if (last_shift) { - last_shift->next = p; - last_shift = p; + last_shift->next = p; + last_shift = p; } else { - first_shift = p; - last_shift = p; + first_shift = p; + last_shift = p; } } @@ -453,38 +453,38 @@ save_reductions(void) count = 0; for (isp = itemset; isp < itemsetend; isp++) { - item = ritem[*isp]; - if (item < 0) - { - redset[count++] = -item; - } + item = ritem[*isp]; + if (item < 0) + { + redset[count++] = -item; + } } if (count) { - p = (reductions *) allocate((unsigned) (sizeof(reductions) + - (count - 1) * sizeof(short))); + p = (reductions *) allocate((unsigned) (sizeof(reductions) + + (count - 1) * sizeof(short))); - p->number = this_state->number; - p->nreds = count; + p->number = this_state->number; + p->nreds = count; - rp1 = redset; - rp2 = p->rules; - rend = rp1 + count; + rp1 = redset; + rp2 = p->rules; + rend = rp1 + count; - while (rp1 < rend) - *rp2++ = *rp1++; + while (rp1 < rend) + *rp2++ = *rp1++; - if (last_reduction) - { - last_reduction->next = p; - last_reduction = p; - } - else - { - first_reduction = p; - last_reduction = p; - } + if (last_reduction) + { + last_reduction->next = p; + last_reduction = p; + } + else + { + first_reduction = p; + last_reduction = p; + } } } @@ -501,20 +501,20 @@ set_derives(void) k = 0; for (lhs = start_symbol; lhs < nsyms; lhs++) { - derives[lhs] = rules + k; - for (i = 0; i < nrules; i++) - { - if (rlhs[i] == lhs) - { - rules[k] = i; - k++; - } - } - rules[k] = -1; - k++; + derives[lhs] = rules + k; + for (i = 0; i < nrules; i++) + { + if (rlhs[i] == lhs) + { + rules[k] = i; + k++; + } + } + rules[k] = -1; + k++; } -#ifdef DEBUG +#ifdef DEBUG print_derives(); #endif } @@ -526,7 +526,7 @@ free_derives(void) FREE(derives); } -#ifdef DEBUG +#ifdef DEBUG static void print_derives(void) { @@ -537,12 +537,12 @@ print_derives(void) for (i = start_symbol; i < nsyms; i++) { - printf("%s derives ", symbol_name[i]); - for (sp = derives[i]; *sp >= 0; sp++) - { - printf(" %d", *sp); - } - putchar('\n'); + printf("%s derives ", symbol_name[i]); + for (sp = derives[i]; *sp >= 0; sp++) + { + printf(" %d", *sp); + } + putchar('\n'); } putchar('\n'); @@ -560,40 +560,40 @@ set_nullable(void) if (nullable == 0) no_space(); for (i = 0; i < nsyms; ++i) - nullable[i] = 0; + nullable[i] = 0; done = 0; while (!done) { - done = 1; - for (i = 1; i < nitems; i++) - { - empty = 1; - while ((j = ritem[i]) >= 0) - { - if (!nullable[j]) - empty = 0; - ++i; - } - if (empty) - { - j = rlhs[-j]; - if (!nullable[j]) - { - nullable[j] = 1; - done = 0; - } - } - } + done = 1; + for (i = 1; i < nitems; i++) + { + empty = 1; + while ((j = ritem[i]) >= 0) + { + if (!nullable[j]) + empty = 0; + ++i; + } + if (empty) + { + j = rlhs[-j]; + if (!nullable[j]) + { + nullable[j] = 1; + done = 0; + } + } + } } #ifdef DEBUG for (i = 0; i < nsyms; i++) { - if (nullable[i]) - printf("%s is nullable\n", symbol_name[i]); - else - printf("%s is not nullable\n", symbol_name[i]); + if (nullable[i]) + printf("%s is nullable\n", symbol_name[i]); + else + printf("%s is not nullable\n", symbol_name[i]); } #endif } diff --git a/modules/libcom/src/yacc/mkpar.c b/modules/libcom/src/yacc/mkpar.c index 5385f0e00..03f5496e8 100644 --- a/modules/libcom/src/yacc/mkpar.c +++ b/modules/libcom/src/yacc/mkpar.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include "defs.h" @@ -40,7 +40,7 @@ make_parser(void) parser = NEW2(nstates, action *); for (i = 0; i < nstates; i++) - parser[i] = parse_actions(i); + parser[i] = parse_actions(i); find_final_state(); remove_conflicts(); @@ -74,23 +74,23 @@ get_shifts(int stateno) sp = shift_table[stateno]; if (sp) { - to_state = sp->shift; - for (i = sp->nshifts - 1; i >= 0; i--) - { - k = to_state[i]; - symbol = accessing_symbol[k]; - if (ISTOKEN(symbol)) - { - temp = NEW(action); - temp->next = actions; - temp->symbol = symbol; - temp->number = k; - temp->prec = symbol_prec[symbol]; - temp->action_code = SHIFT; - temp->assoc = symbol_assoc[symbol]; - actions = temp; - } - } + to_state = sp->shift; + for (i = sp->nshifts - 1; i >= 0; i--) + { + k = to_state[i]; + symbol = accessing_symbol[k]; + if (ISTOKEN(symbol)) + { + temp = NEW(action); + temp->next = actions; + temp->symbol = symbol; + temp->number = k; + temp->prec = symbol_prec[symbol]; + temp->action_code = SHIFT; + temp->assoc = symbol_assoc[symbol]; + actions = temp; + } + } } return (actions); } @@ -107,13 +107,13 @@ add_reductions(int stateno, action *actions) n = lookaheads[stateno + 1]; for (i = m; i < n; i++) { - ruleno = LAruleno[i]; - rowp = LA + i * tokensetsize; - for (j = ntokens - 1; j >= 0; j--) - { - if (BIT(rowp, j)) - actions = add_reduce(actions, ruleno, j); - } + ruleno = LAruleno[i]; + rowp = LA + i * tokensetsize; + for (j = ntokens - 1; j >= 0; j--) + { + if (BIT(rowp, j)) + actions = add_reduce(actions, ruleno, j); + } } return (actions); } @@ -126,19 +126,19 @@ add_reduce(action *actions, int ruleno, int symbol) prev = 0; for (next = actions; next && next->symbol < symbol; next = next->next) - prev = next; + prev = next; while (next && next->symbol == symbol && next->action_code == SHIFT) { - prev = next; - next = next->next; + prev = next; + next = next->next; } while (next && next->symbol == symbol && - next->action_code == REDUCE && next->number < ruleno) + next->action_code == REDUCE && next->number < ruleno) { - prev = next; - next = next->next; + prev = next; + next = next->next; } temp = NEW(action); @@ -150,9 +150,9 @@ add_reduce(action *actions, int ruleno, int symbol) temp->assoc = rassoc[ruleno]; if (prev) - prev->next = temp; + prev->next = temp; else - actions = temp; + actions = temp; return (actions); } @@ -170,8 +170,8 @@ find_final_state(void) goal = ritem[1]; for (i = p->nshifts - 1; i >= 0; --i) { - final_state = to_state[i]; - if (accessing_symbol[final_state] == goal) break; + final_state = to_state[i]; + if (accessing_symbol[final_state] == goal) break; } } @@ -186,27 +186,27 @@ unused_rules(void) if (rules_used == 0) no_space(); for (i = 0; i < nrules; ++i) - rules_used[i] = 0; + rules_used[i] = 0; for (i = 0; i < nstates; ++i) { - for (p = parser[i]; p; p = p->next) - { - if (p->action_code == REDUCE && p->suppressed == 0) - rules_used[p->number] = 1; - } + for (p = parser[i]; p; p = p->next) + { + if (p->action_code == REDUCE && p->suppressed == 0) + rules_used[p->number] = 1; + } } nunused = 0; for (i = 3; i < nrules; ++i) - if (!rules_used[i]) ++nunused; + if (!rules_used[i]) ++nunused; if (nunused) { - if (nunused == 1) - fprintf(stderr, "%s: 1 rule never reduced\n", myname); - else - fprintf(stderr, "%s: %d rules never reduced\n", myname, nunused); + if (nunused == 1) + fprintf(stderr, "%s: 1 rule never reduced\n", myname); + else + fprintf(stderr, "%s: %d rules never reduced\n", myname, nunused); } } @@ -224,65 +224,65 @@ remove_conflicts(void) RRconflicts = NEW2(nstates, short); for (i = 0; i < nstates; i++) { - SRcount = 0; - RRcount = 0; - symbol = -1; - for (p = parser[i]; p; p = p->next) - { - if (p->symbol != symbol) - { - pref = p; - symbol = p->symbol; - } - else if (i == final_state && symbol == 0) - { - SRcount++; - p->suppressed = 1; - } - else if (pref && pref->action_code == SHIFT) - { - if (pref->prec > 0 && p->prec > 0) - { - if (pref->prec < p->prec) - { - pref->suppressed = 2; - pref = p; - } - else if (pref->prec > p->prec) - { - p->suppressed = 2; - } - else if (pref->assoc == LEFT) - { - pref->suppressed = 2; - pref = p; - } - else if (pref->assoc == RIGHT) - { - p->suppressed = 2; - } - else - { - pref->suppressed = 2; - p->suppressed = 2; - } - } - else - { - SRcount++; - p->suppressed = 1; - } - } - else - { - RRcount++; - p->suppressed = 1; - } - } - SRtotal += SRcount; - RRtotal += RRcount; - SRconflicts[i] = SRcount; - RRconflicts[i] = RRcount; + SRcount = 0; + RRcount = 0; + symbol = -1; + for (p = parser[i]; p; p = p->next) + { + if (p->symbol != symbol) + { + pref = p; + symbol = p->symbol; + } + else if (i == final_state && symbol == 0) + { + SRcount++; + p->suppressed = 1; + } + else if (pref && pref->action_code == SHIFT) + { + if (pref->prec > 0 && p->prec > 0) + { + if (pref->prec < p->prec) + { + pref->suppressed = 2; + pref = p; + } + else if (pref->prec > p->prec) + { + p->suppressed = 2; + } + else if (pref->assoc == LEFT) + { + pref->suppressed = 2; + pref = p; + } + else if (pref->assoc == RIGHT) + { + p->suppressed = 2; + } + else + { + pref->suppressed = 2; + p->suppressed = 2; + } + } + else + { + SRcount++; + p->suppressed = 1; + } + } + else + { + RRcount++; + p->suppressed = 1; + } + } + SRtotal += SRcount; + RRtotal += RRcount; + SRconflicts[i] = SRcount; + RRconflicts[i] = RRcount; } } @@ -292,17 +292,17 @@ total_conflicts(void) { fprintf(stderr, "%s: ", myname); if (SRtotal == 1) - fprintf(stderr, "1 shift/reduce conflict"); + fprintf(stderr, "1 shift/reduce conflict"); else if (SRtotal > 1) - fprintf(stderr, "%d shift/reduce conflicts", SRtotal); + fprintf(stderr, "%d shift/reduce conflicts", SRtotal); if (SRtotal && RRtotal) - fprintf(stderr, ", "); + fprintf(stderr, ", "); if (RRtotal == 1) - fprintf(stderr, "1 reduce/reduce conflict"); + fprintf(stderr, "1 reduce/reduce conflict"); else if (RRtotal > 1) - fprintf(stderr, "%d reduce/reduce conflicts", RRtotal); + fprintf(stderr, "%d reduce/reduce conflicts", RRtotal); fprintf(stderr, ".\n"); } @@ -315,23 +315,23 @@ sole_reduction(int stateno) action *p; count = 0; - ruleno = 0; + ruleno = 0; for (p = parser[stateno]; p; p = p->next) { - if (p->action_code == SHIFT && p->suppressed == 0) - return 0; - else if (p->action_code == REDUCE && p->suppressed == 0) - { - if (ruleno > 0 && p->number != ruleno) - return 0; - if (p->symbol != 1) - ++count; - ruleno = p->number; - } + if (p->action_code == SHIFT && p->suppressed == 0) + return 0; + else if (p->action_code == REDUCE && p->suppressed == 0) + { + if (ruleno > 0 && p->number != ruleno) + return 0; + if (p->symbol != 1) + ++count; + ruleno = p->number; + } } if (count == 0) - return 0; + return 0; return ruleno; } @@ -343,7 +343,7 @@ defreds(void) defred = NEW2(nstates, short); for (i = 0; i < nstates; i++) - defred[i] = sole_reduction(i); + defred[i] = sole_reduction(i); } static void diff --git a/modules/libcom/src/yacc/output.c b/modules/libcom/src/yacc/output.c index a1913ed77..96b6d1e6f 100644 --- a/modules/libcom/src/yacc/output.c +++ b/modules/libcom/src/yacc/output.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include "defs.h" @@ -75,57 +75,57 @@ static void output_prefix(void) { if (symbol_prefix == NULL) - symbol_prefix = "yy"; + symbol_prefix = "yy"; else { - ++outline; - fprintf(code_file, "#define yyparse %sparse\n", symbol_prefix); - ++outline; - fprintf(code_file, "#define yylex %slex\n", symbol_prefix); - ++outline; - fprintf(code_file, "#define yyerror %serror\n", symbol_prefix); - ++outline; - fprintf(code_file, "#define yychar %schar\n", symbol_prefix); - ++outline; - fprintf(code_file, "#define yyval %sval\n", symbol_prefix); - ++outline; - fprintf(code_file, "#define yylval %slval\n", symbol_prefix); - ++outline; - fprintf(code_file, "#define yydebug %sdebug\n", symbol_prefix); - ++outline; - fprintf(code_file, "#define yynerrs %snerrs\n", symbol_prefix); - ++outline; - fprintf(code_file, "#define yyerrflag %serrflag\n", symbol_prefix); - ++outline; - fprintf(code_file, "#define yyss %sss\n", symbol_prefix); - ++outline; - fprintf(code_file, "#define yyssp %sssp\n", symbol_prefix); - ++outline; - fprintf(code_file, "#define yyvs %svs\n", symbol_prefix); - ++outline; - fprintf(code_file, "#define yyvsp %svsp\n", symbol_prefix); - ++outline; - fprintf(code_file, "#define yylhs %slhs\n", symbol_prefix); - ++outline; - fprintf(code_file, "#define yylen %slen\n", symbol_prefix); - ++outline; - fprintf(code_file, "#define yydefred %sdefred\n", symbol_prefix); - ++outline; - fprintf(code_file, "#define yydgoto %sdgoto\n", symbol_prefix); - ++outline; - fprintf(code_file, "#define yysindex %ssindex\n", symbol_prefix); - ++outline; - fprintf(code_file, "#define yyrindex %srindex\n", symbol_prefix); - ++outline; - fprintf(code_file, "#define yygindex %sgindex\n", symbol_prefix); - ++outline; - fprintf(code_file, "#define yytable %stable\n", symbol_prefix); - ++outline; - fprintf(code_file, "#define yycheck %scheck\n", symbol_prefix); - ++outline; - fprintf(code_file, "#define yyname %sname\n", symbol_prefix); - ++outline; - fprintf(code_file, "#define yyrule %srule\n", symbol_prefix); + ++outline; + fprintf(code_file, "#define yyparse %sparse\n", symbol_prefix); + ++outline; + fprintf(code_file, "#define yylex %slex\n", symbol_prefix); + ++outline; + fprintf(code_file, "#define yyerror %serror\n", symbol_prefix); + ++outline; + fprintf(code_file, "#define yychar %schar\n", symbol_prefix); + ++outline; + fprintf(code_file, "#define yyval %sval\n", symbol_prefix); + ++outline; + fprintf(code_file, "#define yylval %slval\n", symbol_prefix); + ++outline; + fprintf(code_file, "#define yydebug %sdebug\n", symbol_prefix); + ++outline; + fprintf(code_file, "#define yynerrs %snerrs\n", symbol_prefix); + ++outline; + fprintf(code_file, "#define yyerrflag %serrflag\n", symbol_prefix); + ++outline; + fprintf(code_file, "#define yyss %sss\n", symbol_prefix); + ++outline; + fprintf(code_file, "#define yyssp %sssp\n", symbol_prefix); + ++outline; + fprintf(code_file, "#define yyvs %svs\n", symbol_prefix); + ++outline; + fprintf(code_file, "#define yyvsp %svsp\n", symbol_prefix); + ++outline; + fprintf(code_file, "#define yylhs %slhs\n", symbol_prefix); + ++outline; + fprintf(code_file, "#define yylen %slen\n", symbol_prefix); + ++outline; + fprintf(code_file, "#define yydefred %sdefred\n", symbol_prefix); + ++outline; + fprintf(code_file, "#define yydgoto %sdgoto\n", symbol_prefix); + ++outline; + fprintf(code_file, "#define yysindex %ssindex\n", symbol_prefix); + ++outline; + fprintf(code_file, "#define yyrindex %srindex\n", symbol_prefix); + ++outline; + fprintf(code_file, "#define yygindex %sgindex\n", symbol_prefix); + ++outline; + fprintf(code_file, "#define yytable %stable\n", symbol_prefix); + ++outline; + fprintf(code_file, "#define yycheck %scheck\n", symbol_prefix); + ++outline; + fprintf(code_file, "#define yyname %sname\n", symbol_prefix); + ++outline; + fprintf(code_file, "#define yyrule %srule\n", symbol_prefix); } ++outline; fprintf(code_file, "#define YYPREFIX \"%s\"\n", symbol_prefix); @@ -139,19 +139,19 @@ output_rule_data(void) int j; fprintf(output_file, "static short %slhs[] = {%42d,", symbol_prefix, - symbol_value[start_symbol]); + symbol_value[start_symbol]); j = 10; for (i = 3; i < nrules; i++) { - if (j >= 10) - { - if (!rflag) ++outline; - putc('\n', output_file); - j = 1; - } + if (j >= 10) + { + if (!rflag) ++outline; + putc('\n', output_file); + j = 1; + } else - ++j; + ++j; fprintf(output_file, "%5d,", symbol_value[rlhs[i]]); } @@ -163,14 +163,14 @@ output_rule_data(void) j = 10; for (i = 3; i < nrules; i++) { - if (j >= 10) - { - if (!rflag) ++outline; - putc('\n', output_file); - j = 1; - } - else - j++; + if (j >= 10) + { + if (!rflag) ++outline; + putc('\n', output_file); + j = 1; + } + else + j++; fprintf(output_file, "%5d,", rrhs[i + 1] - rrhs[i] - 1); } @@ -185,21 +185,21 @@ output_yydefred(void) int i, j; fprintf(output_file, "static short %sdefred[] = {%39d,", symbol_prefix, - (defred[0] ? defred[0] - 2 : 0)); + (defred[0] ? defred[0] - 2 : 0)); j = 10; for (i = 1; i < nstates; i++) { - if (j < 10) - ++j; - else - { - if (!rflag) ++outline; - putc('\n', output_file); - j = 1; - } + if (j < 10) + ++j; + else + { + if (!rflag) ++outline; + putc('\n', output_file); + j = 1; + } - fprintf(output_file, "%5d,", (defred[i] ? defred[i] - 2 : 0)); + fprintf(output_file, "%5d,", (defred[i] ? defred[i] - 2 : 0)); } if (!rflag) outline += 2; @@ -248,75 +248,75 @@ token_actions(void) actionrow = NEW2(2*ntokens, short); for (i = 0; i < nstates; ++i) { - if (parser[i]) - { - for (j = 0; j < 2*ntokens; ++j) - actionrow[j] = 0; + if (parser[i]) + { + for (j = 0; j < 2*ntokens; ++j) + actionrow[j] = 0; - shiftcount = 0; - reducecount = 0; - for (p = parser[i]; p; p = p->next) - { - if (p->suppressed == 0) - { - if (p->action_code == SHIFT) - { - ++shiftcount; - actionrow[p->symbol] = p->number; - } - else if (p->action_code == REDUCE && p->number != defred[i]) - { - ++reducecount; - actionrow[p->symbol + ntokens] = p->number; - } - } - } + shiftcount = 0; + reducecount = 0; + for (p = parser[i]; p; p = p->next) + { + if (p->suppressed == 0) + { + if (p->action_code == SHIFT) + { + ++shiftcount; + actionrow[p->symbol] = p->number; + } + else if (p->action_code == REDUCE && p->number != defred[i]) + { + ++reducecount; + actionrow[p->symbol + ntokens] = p->number; + } + } + } - tally[i] = shiftcount; - tally[nstates+i] = reducecount; - width[i] = 0; - width[nstates+i] = 0; - if (shiftcount > 0) - { - froms[i] = r = NEW2(shiftcount, short); - tos[i] = s = NEW2(shiftcount, short); - min = MAXSHORT; - max = 0; - for (j = 0; j < ntokens; ++j) - { - if (actionrow[j]) - { - if (min > symbol_value[j]) - min = symbol_value[j]; - if (max < symbol_value[j]) - max = symbol_value[j]; - *r++ = symbol_value[j]; - *s++ = actionrow[j]; - } - } - width[i] = max - min + 1; - } - if (reducecount > 0) - { - froms[nstates+i] = r = NEW2(reducecount, short); - tos[nstates+i] = s = NEW2(reducecount, short); - min = MAXSHORT; - max = 0; - for (j = 0; j < ntokens; ++j) - { - if (actionrow[ntokens+j]) - { - if (min > symbol_value[j]) - min = symbol_value[j]; - if (max < symbol_value[j]) - max = symbol_value[j]; - *r++ = symbol_value[j]; - *s++ = actionrow[ntokens+j] - 2; - } - } - width[nstates+i] = max - min + 1; - } - } + tally[i] = shiftcount; + tally[nstates+i] = reducecount; + width[i] = 0; + width[nstates+i] = 0; + if (shiftcount > 0) + { + froms[i] = r = NEW2(shiftcount, short); + tos[i] = s = NEW2(shiftcount, short); + min = MAXSHORT; + max = 0; + for (j = 0; j < ntokens; ++j) + { + if (actionrow[j]) + { + if (min > symbol_value[j]) + min = symbol_value[j]; + if (max < symbol_value[j]) + max = symbol_value[j]; + *r++ = symbol_value[j]; + *s++ = actionrow[j]; + } + } + width[i] = max - min + 1; + } + if (reducecount > 0) + { + froms[nstates+i] = r = NEW2(reducecount, short); + tos[nstates+i] = s = NEW2(reducecount, short); + min = MAXSHORT; + max = 0; + for (j = 0; j < ntokens; ++j) + { + if (actionrow[ntokens+j]) + { + if (min > symbol_value[j]) + min = symbol_value[j]; + if (max < symbol_value[j]) + max = symbol_value[j]; + *r++ = symbol_value[j]; + *s++ = actionrow[ntokens+j] - 2; + } + } + width[nstates+i] = max - min + 1; + } + } } FREE(actionrow); } @@ -335,18 +335,18 @@ goto_actions(void) j = 10; for (i = start_symbol + 2; i < nsyms; i++) { - if (j >= 10) - { - if (!rflag) ++outline; - putc('\n', output_file); - j = 1; - } - else - ++j; + if (j >= 10) + { + if (!rflag) ++outline; + putc('\n', output_file); + j = 1; + } + else + ++j; - k = default_goto(i); - fprintf(output_file, "%5d,", k); - save_column(i, k); + k = default_goto(i); + fprintf(output_file, "%5d,", k); + save_column(i, k); } if (!rflag) outline += 2; @@ -369,20 +369,20 @@ default_goto(int symbol) if (m == n) return (0); for (i = 0; i < nstates; i++) - state_count[i] = 0; + state_count[i] = 0; for (i = m; i < n; i++) - state_count[to_state[i]]++; + state_count[to_state[i]]++; max = 0; default_state = 0; for (i = 0; i < nstates; i++) { - if (state_count[i] > max) - { - max = state_count[i]; - default_state = i; - } + if (state_count[i] > max) + { + max = state_count[i]; + default_state = i; + } } return (default_state); @@ -409,8 +409,8 @@ save_column(int symbol, int default_state) count = 0; for (i = m; i < n; i++) { - if (to_state[i] != default_state) - ++count; + if (to_state[i] != default_state) + ++count; } if (count == 0) return; @@ -421,11 +421,11 @@ save_column(int symbol, int default_state) for (i = m; i < n; i++) { - if (to_state[i] != default_state) - { - *sp1++ = from_state[i]; - *sp2++ = to_state[i]; - } + if (to_state[i] != default_state) + { + *sp1++ = from_state[i]; + *sp2++ = to_state[i]; + } } tally[symno] = count; @@ -447,23 +447,23 @@ sort_actions(void) for (i = 0; i < nvectors; i++) { if (tally[i] > 0) - { - t = tally[i]; - w = width[i]; - j = nentries - 1; + { + t = tally[i]; + w = width[i]; + j = nentries - 1; - while (j >= 0 && (width[order[j]] < w)) - j--; + while (j >= 0 && (width[order[j]] < w)) + j--; - while (j >= 0 && (width[order[j]] == w) && (tally[order[j]] < t)) - j--; + while (j >= 0 && (width[order[j]] == w) && (tally[order[j]] < t)) + j--; - for (k = nentries - 1; k > j; k--) - order[k + 1] = order[k]; + for (k = nentries - 1; k > j; k--) + order[k + 1] = order[k]; - order[j + 1] = i; - nentries++; - } + order[j + 1] = i; + nentries++; + } } } @@ -486,27 +486,27 @@ pack_table(void) high = 0; for (i = 0; i < maxtable; i++) - check[i] = -1; + check[i] = -1; for (i = 0; i < nentries; i++) { - state = matching_vector(i); + state = matching_vector(i); - if (state < 0) - place = pack_vector(i); - else - place = base[state]; + if (state < 0) + place = pack_vector(i); + else + place = base[state]; - pos[i] = place; - base[order[i]] = place; + pos[i] = place; + base[order[i]] = place; } for (i = 0; i < nvectors; i++) { - if (froms[i]) - FREE(froms[i]); - if (tos[i]) - FREE(tos[i]); + if (froms[i]) + FREE(froms[i]); + if (tos[i]) + FREE(tos[i]); } FREE(froms); @@ -515,21 +515,21 @@ pack_table(void) } -/* The function matching_vector determines if the vector specified by */ -/* the input parameter matches a previously considered vector. The */ -/* test at the start of the function checks if the vector represents */ -/* a row of shifts over terminal symbols or a row of reductions, or a */ -/* column of shifts over a nonterminal symbol. Berkeley Yacc does not */ -/* check if a column of shifts over a nonterminal symbols matches a */ -/* previously considered vector. Because of the nature of LR parsing */ -/* tables, no two columns can match. Therefore, the only possible */ -/* match would be between a row and a column. Such matches are */ -/* unlikely. Therefore, to save time, no attempt is made to see if a */ -/* column matches a previously considered vector. */ -/* */ -/* Matching_vector is poorly designed. The test could easily be made */ -/* faster. Also, it depends on the vectors being in a specific */ -/* order. */ +/* The function matching_vector determines if the vector specified by */ +/* the input parameter matches a previously considered vector. The */ +/* test at the start of the function checks if the vector represents */ +/* a row of shifts over terminal symbols or a row of reductions, or a */ +/* column of shifts over a nonterminal symbol. Berkeley Yacc does not */ +/* check if a column of shifts over a nonterminal symbols matches a */ +/* previously considered vector. Because of the nature of LR parsing */ +/* tables, no two columns can match. Therefore, the only possible */ +/* match would be between a row and a column. Such matches are */ +/* unlikely. Therefore, to save time, no attempt is made to see if a */ +/* column matches a previously considered vector. */ +/* */ +/* Matching_vector is poorly designed. The test could easily be made */ +/* faster. Also, it depends on the vectors being in a specific */ +/* order. */ int matching_vector(int vector) @@ -544,26 +544,26 @@ matching_vector(int vector) i = order[vector]; if (i >= 2*nstates) - return (-1); + return (-1); t = tally[i]; w = width[i]; for (prev = vector - 1; prev >= 0; prev--) { - j = order[prev]; - if (width[j] != w || tally[j] != t) - return (-1); + j = order[prev]; + if (width[j] != w || tally[j] != t) + return (-1); - match = 1; - for (k = 0; match && k < t; k++) - { - if (tos[j][k] != tos[i][k] || froms[j][k] != froms[i][k]) - match = 0; - } + match = 1; + for (k = 0; match && k < t; k++) + { + if (tos[j][k] != tos[i][k] || froms[j][k] != froms[i][k]) + match = 0; + } - if (match) - return (j); + if (match) + return (j); } return (-1); @@ -591,58 +591,58 @@ pack_vector(int vector) j = lowzero - from[0]; for (k = 1; k < t; ++k) - if (lowzero - from[k] > j) - j = lowzero - from[k]; + if (lowzero - from[k] > j) + j = lowzero - from[k]; for (;; ++j) { - if (j == 0) - continue; - ok = 1; - for (k = 0; ok && k < t; k++) - { - loc = j + from[k]; - if (loc >= maxtable) - { - if (loc >= MAXTABLE) - fatal("maximum table size exceeded"); + if (j == 0) + continue; + ok = 1; + for (k = 0; ok && k < t; k++) + { + loc = j + from[k]; + if (loc >= maxtable) + { + if (loc >= MAXTABLE) + fatal("maximum table size exceeded"); - newmax = maxtable; - do { newmax += 200; } while (newmax <= loc); - table = (short *) REALLOC(table, newmax*sizeof(short)); - if (table == 0) no_space(); - check = (short *) REALLOC(check, newmax*sizeof(short)); - if (check == 0) no_space(); - for (l = maxtable; l < newmax; ++l) - { - table[l] = 0; - check[l] = -1; - } - maxtable = newmax; - } + newmax = maxtable; + do { newmax += 200; } while (newmax <= loc); + table = (short *) REALLOC(table, newmax*sizeof(short)); + if (table == 0) no_space(); + check = (short *) REALLOC(check, newmax*sizeof(short)); + if (check == 0) no_space(); + for (l = maxtable; l < newmax; ++l) + { + table[l] = 0; + check[l] = -1; + } + maxtable = newmax; + } - if (check[loc] != -1) - ok = 0; - } - for (k = 0; ok && k < vector; k++) - { - if (pos[k] == j) - ok = 0; - } - if (ok) - { - for (k = 0; k < t; k++) - { - loc = j + from[k]; - table[loc] = to[k]; - check[loc] = from[k]; - if (loc > high) high = loc; - } + if (check[loc] != -1) + ok = 0; + } + for (k = 0; ok && k < vector; k++) + { + if (pos[k] == j) + ok = 0; + } + if (ok) + { + for (k = 0; k < t; k++) + { + loc = j + from[k]; + table[loc] = to[k]; + check[loc] = from[k]; + if (loc > high) high = loc; + } - while (check[lowzero] != -1) - ++lowzero; + while (check[lowzero] != -1) + ++lowzero; - return (j); - } + return (j); + } } } @@ -658,54 +658,54 @@ output_base(void) j = 10; for (i = 1; i < nstates; i++) { - if (j >= 10) - { - if (!rflag) ++outline; - putc('\n', output_file); - j = 1; - } - else - ++j; + if (j >= 10) + { + if (!rflag) ++outline; + putc('\n', output_file); + j = 1; + } + else + ++j; - fprintf(output_file, "%5d,", base[i]); + fprintf(output_file, "%5d,", base[i]); } if (!rflag) outline += 2; fprintf(output_file, "\n};\nstatic short %srindex[] = {%39d,", symbol_prefix, - base[nstates]); + base[nstates]); j = 10; for (i = nstates + 1; i < 2*nstates; i++) { - if (j >= 10) - { - if (!rflag) ++outline; - putc('\n', output_file); - j = 1; - } - else - ++j; + if (j >= 10) + { + if (!rflag) ++outline; + putc('\n', output_file); + j = 1; + } + else + ++j; - fprintf(output_file, "%5d,", base[i]); + fprintf(output_file, "%5d,", base[i]); } if (!rflag) outline += 2; fprintf(output_file, "\n};\nstatic short %sgindex[] = {%39d,", symbol_prefix, - base[2*nstates]); + base[2*nstates]); j = 10; for (i = 2*nstates + 1; i < nvectors - 1; i++) { - if (j >= 10) - { - if (!rflag) ++outline; - putc('\n', output_file); - j = 1; - } - else - ++j; + if (j >= 10) + { + if (!rflag) ++outline; + putc('\n', output_file); + j = 1; + } + else + ++j; - fprintf(output_file, "%5d,", base[i]); + fprintf(output_file, "%5d,", base[i]); } if (!rflag) outline += 2; @@ -724,21 +724,21 @@ output_table(void) ++outline; fprintf(code_file, "#define YYTABLESIZE %d\n", high); fprintf(output_file, "static short %stable[] = {%40d,", symbol_prefix, - table[0]); + table[0]); j = 10; for (i = 1; i <= high; i++) { - if (j >= 10) - { - if (!rflag) ++outline; - putc('\n', output_file); - j = 1; - } - else - ++j; + if (j >= 10) + { + if (!rflag) ++outline; + putc('\n', output_file); + j = 1; + } + else + ++j; - fprintf(output_file, "%5d,", table[i]); + fprintf(output_file, "%5d,", table[i]); } if (!rflag) outline += 2; @@ -755,21 +755,21 @@ output_check(void) int j; fprintf(output_file, "static short %scheck[] = {%40d,", symbol_prefix, - check[0]); + check[0]); j = 10; for (i = 1; i <= high; i++) { - if (j >= 10) - { - if (!rflag) ++outline; - putc('\n', output_file); - j = 1; - } - else - ++j; + if (j >= 10) + { + if (!rflag) ++outline; + putc('\n', output_file); + j = 1; + } + else + ++j; - fprintf(output_file, "%5d,", check[i]); + fprintf(output_file, "%5d,", check[i]); } if (!rflag) outline += 2; @@ -788,23 +788,23 @@ is_C_identifier(char *name) c = *s; if (c == '"') { - c = *++s; - if (!isalpha(c) && c != '_' && c != '$') - return (0); - while ((c = *++s) != '"') - { - if (!isalnum(c) && c != '_' && c != '$') - return (0); - } - return (1); + c = *++s; + if (!isalpha(c) && c != '_' && c != '$') + return (0); + while ((c = *++s) != '"') + { + if (!isalnum(c) && c != '_' && c != '$') + return (0); + } + return (1); } if (!isalpha(c) && c != '_' && c != '$') - return (0); + return (0); while ((c = *++s)) { - if (!isalnum(c) && c != '_' && c != '$') - return (0); + if (!isalnum(c) && c != '_' && c != '$') + return (0); } return (1); } @@ -818,33 +818,33 @@ output_defines(void) for (i = 2; i < ntokens; ++i) { - s = symbol_name[i]; - if (is_C_identifier(s)) - { - fprintf(code_file, "#define "); - if (dflag) fprintf(defines_file, "#define "); - c = *s; - if (c == '"') - { - while ((c = *++s) != '"') - { - putc(c, code_file); - if (dflag) putc(c, defines_file); - } - } - else - { - do - { - putc(c, code_file); - if (dflag) putc(c, defines_file); - } - while ((c = *++s)); - } - ++outline; - fprintf(code_file, " %d\n", symbol_value[i]); - if (dflag) fprintf(defines_file, " %d\n", symbol_value[i]); - } + s = symbol_name[i]; + if (is_C_identifier(s)) + { + fprintf(code_file, "#define "); + if (dflag) fprintf(defines_file, "#define "); + c = *s; + if (c == '"') + { + while ((c = *++s) != '"') + { + putc(c, code_file); + if (dflag) putc(c, defines_file); + } + } + else + { + do + { + putc(c, code_file); + if (dflag) putc(c, defines_file); + } + while ((c = *++s)); + } + ++outline; + fprintf(code_file, " %d\n", symbol_value[i]); + if (dflag) fprintf(defines_file, " %d\n", symbol_value[i]); + } } ++outline; @@ -852,11 +852,11 @@ output_defines(void) if (dflag && unionized) { - rewind(union_file); - while ((c = getc(union_file)) != EOF) - putc(c, defines_file); - fprintf(defines_file, " YYSTYPE;\nstatic YYSTYPE %slval;\n", - symbol_prefix); + rewind(union_file); + while ((c = getc(union_file)) != EOF) + putc(c, defines_file); + fprintf(defines_file, " YYSTYPE;\nstatic YYSTYPE %slval;\n", + symbol_prefix); } } @@ -870,19 +870,19 @@ output_stored_text(void) rewind(text_file); in = text_file; if ((c = getc(in)) == EOF) - return; + return; out = code_file; if (c == '\n') - ++outline; + ++outline; putc(c, out); while ((c = getc(in)) != EOF) { - if (c == '\n') - ++outline; - putc(c, out); + if (c == '\n') + ++outline; + putc(c, out); } if (!lflag) - fprintf(out, line_format, ++outline + 1, code_file_name); + fprintf(out, line_format, ++outline + 1, code_file_name); } @@ -896,27 +896,27 @@ output_debug(void) fprintf(code_file, "#define YYFINAL %d\n", final_state); outline += 3; fprintf(code_file, "#ifndef YYDEBUG\n#define YYDEBUG %d\n#endif\n", - tflag); + tflag); if (rflag) - fprintf(output_file, "#ifndef YYDEBUG\n#define YYDEBUG %d\n#endif\n", - tflag); + fprintf(output_file, "#ifndef YYDEBUG\n#define YYDEBUG %d\n#endif\n", + tflag); max = 0; for (i = 2; i < ntokens; ++i) - if (symbol_value[i] > max) - max = symbol_value[i]; + if (symbol_value[i] > max) + max = symbol_value[i]; ++outline; fprintf(code_file, "#define YYMAXTOKEN %d\n", max); symnam = (char **) MALLOC((max+1)*sizeof(char *)); if (symnam == 0) no_space(); - /* Note that it is not necessary to initialize the element */ - /* symnam[max]. */ + /* Note that it is not necessary to initialize the element */ + /* symnam[max]. */ for (i = 0; i < max; ++i) - symnam[i] = 0; + symnam[i] = 0; for (i = ntokens - 1; i >= 2; --i) - symnam[symbol_value[i]] = symbol_name[i]; + symnam[symbol_value[i]] = symbol_name[i]; symnam[0] = "end-of-file"; if (!rflag) ++outline; @@ -924,122 +924,122 @@ output_debug(void) j = 80; for (i = 0; i <= max; ++i) { - if ((s = symnam[i])) - { - if (s[0] == '"') - { - k = 7; - while (*++s != '"') - { - ++k; - if (*s == '\\') - { - k += 2; - if (*++s == '\\') - ++k; - } - } - j += k; - if (j > 80) - { - if (!rflag) ++outline; - putc('\n', output_file); - j = k; - } - fprintf(output_file, "\"\\\""); - s = symnam[i]; - while (*++s != '"') - { - if (*s == '\\') - { - fprintf(output_file, "\\\\"); - if (*++s == '\\') - fprintf(output_file, "\\\\"); - else - putc(*s, output_file); - } - else - putc(*s, output_file); - } - fprintf(output_file, "\\\"\","); - } - else if (s[0] == '\'') - { - if (s[1] == '"') - { - j += 7; - if (j > 80) - { - if (!rflag) ++outline; - putc('\n', output_file); - j = 7; - } - fprintf(output_file, "\"'\\\"'\","); - } - else - { - k = 5; - while (*++s != '\'') - { - ++k; - if (*s == '\\') - { - k += 2; - if (*++s == '\\') - ++k; - } - } - j += k; - if (j > 80) - { - if (!rflag) ++outline; - putc('\n', output_file); - j = k; - } - fprintf(output_file, "\"'"); - s = symnam[i]; - while (*++s != '\'') - { - if (*s == '\\') - { - fprintf(output_file, "\\\\"); - if (*++s == '\\') - fprintf(output_file, "\\\\"); - else - putc(*s, output_file); - } - else - putc(*s, output_file); - } - fprintf(output_file, "'\","); - } - } - else - { - k = strlen(s) + 3; - j += k; - if (j > 80) - { - if (!rflag) ++outline; - putc('\n', output_file); - j = k; - } - putc('"', output_file); - do { putc(*s, output_file); } while (*++s); - fprintf(output_file, "\","); - } - } - else - { - j += 2; - if (j > 80) - { - if (!rflag) ++outline; - putc('\n', output_file); - j = 2; - } - fprintf(output_file, "0,"); - } + if ((s = symnam[i])) + { + if (s[0] == '"') + { + k = 7; + while (*++s != '"') + { + ++k; + if (*s == '\\') + { + k += 2; + if (*++s == '\\') + ++k; + } + } + j += k; + if (j > 80) + { + if (!rflag) ++outline; + putc('\n', output_file); + j = k; + } + fprintf(output_file, "\"\\\""); + s = symnam[i]; + while (*++s != '"') + { + if (*s == '\\') + { + fprintf(output_file, "\\\\"); + if (*++s == '\\') + fprintf(output_file, "\\\\"); + else + putc(*s, output_file); + } + else + putc(*s, output_file); + } + fprintf(output_file, "\\\"\","); + } + else if (s[0] == '\'') + { + if (s[1] == '"') + { + j += 7; + if (j > 80) + { + if (!rflag) ++outline; + putc('\n', output_file); + j = 7; + } + fprintf(output_file, "\"'\\\"'\","); + } + else + { + k = 5; + while (*++s != '\'') + { + ++k; + if (*s == '\\') + { + k += 2; + if (*++s == '\\') + ++k; + } + } + j += k; + if (j > 80) + { + if (!rflag) ++outline; + putc('\n', output_file); + j = k; + } + fprintf(output_file, "\"'"); + s = symnam[i]; + while (*++s != '\'') + { + if (*s == '\\') + { + fprintf(output_file, "\\\\"); + if (*++s == '\\') + fprintf(output_file, "\\\\"); + else + putc(*s, output_file); + } + else + putc(*s, output_file); + } + fprintf(output_file, "'\","); + } + } + else + { + k = strlen(s) + 3; + j += k; + if (j > 80) + { + if (!rflag) ++outline; + putc('\n', output_file); + j = k; + } + putc('"', output_file); + do { putc(*s, output_file); } while (*++s); + fprintf(output_file, "\","); + } + } + else + { + j += 2; + if (j > 80) + { + if (!rflag) ++outline; + putc('\n', output_file); + j = 2; + } + fprintf(output_file, "0,"); + } } if (!rflag) outline += 2; fprintf(output_file, "\n};\n"); @@ -1049,51 +1049,51 @@ output_debug(void) fprintf(output_file, "static char *%srule[] = {\n", symbol_prefix); for (i = 2; i < nrules; ++i) { - fprintf(output_file, "\"%s :", symbol_name[rlhs[i]]); - for (j = rrhs[i]; ritem[j] > 0; ++j) - { - s = symbol_name[ritem[j]]; - if (s[0] == '"') - { - fprintf(output_file, " \\\""); - while (*++s != '"') - { - if (*s == '\\') - { - if (s[1] == '\\') - fprintf(output_file, "\\\\\\\\"); - else - fprintf(output_file, "\\\\%c", s[1]); - ++s; - } - else - putc(*s, output_file); - } - fprintf(output_file, "\\\""); - } - else if (s[0] == '\'') - { - if (s[1] == '"') - fprintf(output_file, " '\\\"'"); - else if (s[1] == '\\') - { - if (s[2] == '\\') - fprintf(output_file, " '\\\\\\\\"); - else - fprintf(output_file, " '\\\\%c", s[2]); - s += 2; - while (*++s != '\'') - putc(*s, output_file); - putc('\'', output_file); - } - else - fprintf(output_file, " '%c'", s[1]); - } - else - fprintf(output_file, " %s", s); - } - if (!rflag) ++outline; - fprintf(output_file, "\",\n"); + fprintf(output_file, "\"%s :", symbol_name[rlhs[i]]); + for (j = rrhs[i]; ritem[j] > 0; ++j) + { + s = symbol_name[ritem[j]]; + if (s[0] == '"') + { + fprintf(output_file, " \\\""); + while (*++s != '"') + { + if (*s == '\\') + { + if (s[1] == '\\') + fprintf(output_file, "\\\\\\\\"); + else + fprintf(output_file, "\\\\%c", s[1]); + ++s; + } + else + putc(*s, output_file); + } + fprintf(output_file, "\\\""); + } + else if (s[0] == '\'') + { + if (s[1] == '"') + fprintf(output_file, " '\\\"'"); + else if (s[1] == '\\') + { + if (s[2] == '\\') + fprintf(output_file, " '\\\\\\\\"); + else + fprintf(output_file, " '\\\\%c", s[2]); + s += 2; + while (*++s != '\'') + putc(*s, output_file); + putc('\'', output_file); + } + else + fprintf(output_file, " '%c'", s[1]); + } + else + fprintf(output_file, " %s", s); + } + if (!rflag) ++outline; + fprintf(output_file, "\",\n"); } if (!rflag) outline += 2; @@ -1106,8 +1106,8 @@ output_stype(void) { if (!unionized && ntags == 0) { - outline += 3; - fprintf(code_file, "#ifndef YYSTYPE\ntypedef int YYSTYPE;\n#endif\n"); + outline += 3; + fprintf(code_file, "#ifndef YYSTYPE\ntypedef int YYSTYPE;\n#endif\n"); } } @@ -1119,54 +1119,54 @@ output_trailing_text(void) FILE *in, *out; if (line == 0) - return; + return; in = input_file; out = code_file; c = *cptr; if (c == '\n') { - ++lineno; - if ((c = getc(in)) == EOF) - return; - if (!lflag) - { - ++outline; - fprintf(out, line_format, lineno, input_file_name); - } - if (c == '\n') - ++outline; - putc(c, out); - last = c; + ++lineno; + if ((c = getc(in)) == EOF) + return; + if (!lflag) + { + ++outline; + fprintf(out, line_format, lineno, input_file_name); + } + if (c == '\n') + ++outline; + putc(c, out); + last = c; } else { - if (!lflag) - { - ++outline; - fprintf(out, line_format, lineno, input_file_name); - } - do { putc(c, out); } while ((c = *++cptr) != '\n'); - ++outline; - putc('\n', out); - last = '\n'; + if (!lflag) + { + ++outline; + fprintf(out, line_format, lineno, input_file_name); + } + do { putc(c, out); } while ((c = *++cptr) != '\n'); + ++outline; + putc('\n', out); + last = '\n'; } while ((c = getc(in)) != EOF) { - if (c == '\n') - ++outline; - putc(c, out); - last = c; + if (c == '\n') + ++outline; + putc(c, out); + last = c; } if (last != '\n') { - ++outline; - putc('\n', out); + ++outline; + putc('\n', out); } if (!lflag) - fprintf(out, line_format, ++outline + 1, code_file_name); + fprintf(out, line_format, ++outline + 1, code_file_name); } @@ -1179,29 +1179,29 @@ output_semantic_actions(void) rewind(action_file); if ((c = getc(action_file)) == EOF) - return; + return; out = code_file; last = c; if (c == '\n') - ++outline; + ++outline; putc(c, out); while ((c = getc(action_file)) != EOF) { - if (c == '\n') - ++outline; - putc(c, out); - last = c; + if (c == '\n') + ++outline; + putc(c, out); + last = c; } if (last != '\n') { - ++outline; - putc('\n', out); + ++outline; + putc('\n', out); } if (!lflag) - fprintf(out, line_format, ++outline + 1, code_file_name); + fprintf(out, line_format, ++outline + 1, code_file_name); } @@ -1213,8 +1213,8 @@ free_itemsets(void) FREE(state_table); for (cp = first_state; cp; cp = next) { - next = cp->next; - FREE(cp); + next = cp->next; + FREE(cp); } } @@ -1227,8 +1227,8 @@ free_shifts(void) FREE(shift_table); for (sp = first_shift; sp; sp = next) { - next = sp->next; - FREE(sp); + next = sp->next; + FREE(sp); } } @@ -1241,7 +1241,7 @@ free_reductions(void) FREE(reduction_table); for (rp = first_reduction; rp; rp = next) { - next = rp->next; - FREE(rp); + next = rp->next; + FREE(rp); } } diff --git a/modules/libcom/src/yacc/reader.c b/modules/libcom/src/yacc/reader.c index 93a1a42de..05c5b1a50 100644 --- a/modules/libcom/src/yacc/reader.c +++ b/modules/libcom/src/yacc/reader.c @@ -4,14 +4,14 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include "defs.h" -/* The line size must be a positive integer. One hundred was chosen */ -/* because few lines in Yacc input grammars exceed 100 characters. */ -/* Note that if a line exceeds LINESIZE characters, the line buffer */ -/* will be expanded to accomodate it. */ +/* The line size must be a positive integer. One hundred was chosen */ +/* because few lines in Yacc input grammars exceed 100 characters. */ +/* Note that if a line exceeds LINESIZE characters, the line buffer */ +/* will be expanded to accomodate it. */ #define LINESIZE 100 @@ -52,9 +52,9 @@ cachec(int c) assert(cinc >= 0); if (cinc >= cache_size) { - cache_size += 256; - cache = REALLOC(cache, cache_size); - if (cache == 0) no_space(); + cache_size += 256; + cache = REALLOC(cache, cache_size); + if (cache == 0) no_space(); } cache[cinc] = c; ++cinc; @@ -70,40 +70,40 @@ get_line(void) if (saw_eof || (c = getc(f)) == EOF) { - if (line) { FREE(line); line = 0; } - cptr = 0; - saw_eof = 1; - return; + if (line) { FREE(line); line = 0; } + cptr = 0; + saw_eof = 1; + return; } if (line == 0 || linesize != (LINESIZE + 1)) { - if (line) FREE(line); - linesize = LINESIZE + 1; - line = MALLOC(linesize); - if (line == 0) no_space(); + if (line) FREE(line); + linesize = LINESIZE + 1; + line = MALLOC(linesize); + if (line == 0) no_space(); } i = 0; ++lineno; for (;;) { - line[i] = c; - if (c == '\n') { cptr = line; return; } - if (++i >= linesize) - { - linesize += LINESIZE; - line = REALLOC(line, linesize); - if (line == 0) no_space(); - } - c = getc(f); - if (c == EOF) - { - line[i] = '\n'; - saw_eof = 1; - cptr = line; - return; - } + line[i] = c; + if (c == '\n') { cptr = line; return; } + if (++i >= linesize) + { + linesize += LINESIZE; + line = REALLOC(line, linesize); + if (line == 0) no_space(); + } + c = getc(f); + if (c == EOF) + { + line[i] = '\n'; + saw_eof = 1; + cptr = line; + return; + } } } @@ -138,21 +138,21 @@ skip_comment(void) s = cptr + 2; for (;;) { - if (*s == '*' && s[1] == '/') - { - cptr = s + 2; - FREE(st_line); - return; - } - if (*s == '\n') - { - get_line(); - if (line == 0) - unterminated_comment(st_lineno, st_line, st_cptr); - s = cptr; - } - else - ++s; + if (*s == '*' && s[1] == '/') + { + cptr = s + 2; + FREE(st_line); + return; + } + if (*s == '\n') + { + get_line(); + if (line == 0) + unterminated_comment(st_lineno, st_line, st_cptr); + s = cptr; + } + else + ++s; } } @@ -164,57 +164,57 @@ nextc(void) if (line == 0) { - get_line(); - if (line == 0) - return (EOF); + get_line(); + if (line == 0) + return (EOF); } s = cptr; for (;;) { - switch (*s) - { - case '\n': - get_line(); - if (line == 0) return (EOF); - s = cptr; - break; + switch (*s) + { + case '\n': + get_line(); + if (line == 0) return (EOF); + s = cptr; + break; - case ' ': - case '\t': - case '\f': - case '\r': - case '\v': - case ',': - case ';': - ++s; - break; + case ' ': + case '\t': + case '\f': + case '\r': + case '\v': + case ',': + case ';': + ++s; + break; - case '\\': - cptr = s; - return ('%'); + case '\\': + cptr = s; + return ('%'); - case '/': - if (s[1] == '*') - { - cptr = s; - skip_comment(); - s = cptr; - break; - } - else if (s[1] == '/') - { - get_line(); - if (line == 0) return (EOF); - s = cptr; - break; - } - /* fall through */ + case '/': + if (s[1] == '*') + { + cptr = s; + skip_comment(); + s = cptr; + break; + } + else if (s[1] == '/') + { + get_line(); + if (line == 0) return (EOF); + s = cptr; + break; + } + /* fall through */ - default: - cptr = s; - return (*s); - } + default: + cptr = s; + return (*s); + } } } @@ -228,54 +228,54 @@ keyword(void) c = *++cptr; if (isalpha(c)) { - cinc = 0; - for (;;) - { - if (isalpha(c)) - { - if (isupper(c)) c = tolower(c); - cachec(c); - } - else if (isdigit(c) || c == '_' || c == '.' || c == '$') - cachec(c); - else - break; - c = *++cptr; - } - cachec(NUL); + cinc = 0; + for (;;) + { + if (isalpha(c)) + { + if (isupper(c)) c = tolower(c); + cachec(c); + } + else if (isdigit(c) || c == '_' || c == '.' || c == '$') + cachec(c); + else + break; + c = *++cptr; + } + cachec(NUL); - if (strcmp(cache, "token") == 0 || strcmp(cache, "term") == 0) - return (TOKEN); - if (strcmp(cache, "type") == 0) - return (TYPE); - if (strcmp(cache, "left") == 0) - return (LEFT); - if (strcmp(cache, "right") == 0) - return (RIGHT); - if (strcmp(cache, "nonassoc") == 0 || strcmp(cache, "binary") == 0) - return (NONASSOC); - if (strcmp(cache, "start") == 0) - return (START); - if (strcmp(cache, "union") == 0) - return (UNION); - if (strcmp(cache, "ident") == 0) - return (IDENT); + if (strcmp(cache, "token") == 0 || strcmp(cache, "term") == 0) + return (TOKEN); + if (strcmp(cache, "type") == 0) + return (TYPE); + if (strcmp(cache, "left") == 0) + return (LEFT); + if (strcmp(cache, "right") == 0) + return (RIGHT); + if (strcmp(cache, "nonassoc") == 0 || strcmp(cache, "binary") == 0) + return (NONASSOC); + if (strcmp(cache, "start") == 0) + return (START); + if (strcmp(cache, "union") == 0) + return (UNION); + if (strcmp(cache, "ident") == 0) + return (IDENT); } else { - ++cptr; - if (c == '{') - return (TEXT); - if (c == '%' || c == '\\') - return (MARK); - if (c == '<') - return (LEFT); - if (c == '>') - return (RIGHT); - if (c == '0') - return (TOKEN); - if (c == '2') - return (NONASSOC); + ++cptr; + if (c == '{') + return (TEXT); + if (c == '%' || c == '\\') + return (MARK); + if (c == '<') + return (LEFT); + if (c == '>') + return (RIGHT); + if (c == '0') + return (TOKEN); + if (c == '2') + return (NONASSOC); } syntax_error(lineno, line, t_cptr); /*NOTREACHED*/ @@ -295,19 +295,19 @@ copy_ident(void) fprintf(f, "#ident \""); for (;;) { - c = *++cptr; - if (c == '\n') - { - fprintf(f, "\"\n"); - return; - } - putc(c, f); - if (c == '"') - { - putc('\n', f); - ++cptr; - return; - } + c = *++cptr; + if (c == '\n') + { + fprintf(f, "\"\n"); + return; + } + putc(c, f); + if (c == '"') + { + putc('\n', f); + ++cptr; + return; + } } } @@ -325,9 +325,9 @@ copy_text(void) if (*cptr == '\n') { - get_line(); - if (line == 0) - unterminated_text(t_lineno, t_line, t_cptr); + get_line(); + if (line == 0) + unterminated_text(t_lineno, t_line, t_cptr); } if (!lflag) fprintf(f, line_format, lineno, input_file_name); @@ -337,109 +337,109 @@ loop: { case '\n': next_line: - putc('\n', f); - need_newline = 0; - get_line(); - if (line) goto loop; - unterminated_text(t_lineno, t_line, t_cptr); + putc('\n', f); + need_newline = 0; + get_line(); + if (line) goto loop; + unterminated_text(t_lineno, t_line, t_cptr); case '\'': case '"': - { - int s_lineno = lineno; - char *s_line = dup_line(); - char *s_cptr = s_line + (cptr - line - 1); + { + int s_lineno = lineno; + char *s_line = dup_line(); + char *s_cptr = s_line + (cptr - line - 1); - quote = c; - putc(c, f); - for (;;) - { - c = *cptr++; - putc(c, f); - if (c == quote) - { - need_newline = 1; - FREE(s_line); - goto loop; - } - if (c == '\n') - unterminated_string(s_lineno, s_line, s_cptr); - if (c == '\\') - { - c = *cptr++; - putc(c, f); - if (c == '\n') - { - get_line(); - if (line == 0) - unterminated_string(s_lineno, s_line, s_cptr); - } - } - } - } + quote = c; + putc(c, f); + for (;;) + { + c = *cptr++; + putc(c, f); + if (c == quote) + { + need_newline = 1; + FREE(s_line); + goto loop; + } + if (c == '\n') + unterminated_string(s_lineno, s_line, s_cptr); + if (c == '\\') + { + c = *cptr++; + putc(c, f); + if (c == '\n') + { + get_line(); + if (line == 0) + unterminated_string(s_lineno, s_line, s_cptr); + } + } + } + } case '/': - putc(c, f); - need_newline = 1; - c = *cptr; - if (c == '/') - { - putc('*', f); - while ((c = *++cptr) != '\n') - { - if (c == '*' && cptr[1] == '/') - fprintf(f, "* "); - else - putc(c, f); - } - fprintf(f, "*/"); - goto next_line; - } - if (c == '*') - { - int c_lineno = lineno; - char *c_line = dup_line(); - char *c_cptr = c_line + (cptr - line - 1); + putc(c, f); + need_newline = 1; + c = *cptr; + if (c == '/') + { + putc('*', f); + while ((c = *++cptr) != '\n') + { + if (c == '*' && cptr[1] == '/') + fprintf(f, "* "); + else + putc(c, f); + } + fprintf(f, "*/"); + goto next_line; + } + if (c == '*') + { + int c_lineno = lineno; + char *c_line = dup_line(); + char *c_cptr = c_line + (cptr - line - 1); - putc('*', f); - ++cptr; - for (;;) - { - c = *cptr++; - putc(c, f); - if (c == '*' && *cptr == '/') - { - putc('/', f); - ++cptr; - FREE(c_line); - goto loop; - } - if (c == '\n') - { - get_line(); - if (line == 0) - unterminated_comment(c_lineno, c_line, c_cptr); - } - } - } - need_newline = 1; - goto loop; + putc('*', f); + ++cptr; + for (;;) + { + c = *cptr++; + putc(c, f); + if (c == '*' && *cptr == '/') + { + putc('/', f); + ++cptr; + FREE(c_line); + goto loop; + } + if (c == '\n') + { + get_line(); + if (line == 0) + unterminated_comment(c_lineno, c_line, c_cptr); + } + } + } + need_newline = 1; + goto loop; case '%': case '\\': - if (*cptr == '}') - { - if (need_newline) putc('\n', f); - ++cptr; - FREE(t_line); - return; - } - /* fall through */ + if (*cptr == '}') + { + if (need_newline) putc('\n', f); + ++cptr; + FREE(t_line); + return; + } + /* fall through */ default: - putc(c, f); - need_newline = 1; - goto loop; + putc(c, f); + need_newline = 1; + goto loop; } } @@ -458,7 +458,7 @@ copy_union(void) unionized = 1; if (!lflag) - fprintf(text_file, line_format, lineno, input_file_name); + fprintf(text_file, line_format, lineno, input_file_name); fprintf(text_file, "typedef union"); if (dflag) fprintf(union_file, "typedef union"); @@ -472,115 +472,115 @@ loop: { case '\n': next_line: - get_line(); - if (line == 0) unterminated_union(u_lineno, u_line, u_cptr); - goto loop; + get_line(); + if (line == 0) unterminated_union(u_lineno, u_line, u_cptr); + goto loop; case '{': - ++depth; - goto loop; + ++depth; + goto loop; case '}': - if (--depth == 0) - { - fprintf(text_file, " YYSTYPE;\n"); - FREE(u_line); - return; - } - goto loop; + if (--depth == 0) + { + fprintf(text_file, " YYSTYPE;\n"); + FREE(u_line); + return; + } + goto loop; case '\'': case '"': - { - int s_lineno = lineno; - char *s_line = dup_line(); - char *s_cptr = s_line + (cptr - line - 1); + { + int s_lineno = lineno; + char *s_line = dup_line(); + char *s_cptr = s_line + (cptr - line - 1); - quote = c; - for (;;) - { - c = *cptr++; - putc(c, text_file); - if (dflag) putc(c, union_file); - if (c == quote) - { - FREE(s_line); - goto loop; - } - if (c == '\n') - unterminated_string(s_lineno, s_line, s_cptr); - if (c == '\\') - { - c = *cptr++; - putc(c, text_file); - if (dflag) putc(c, union_file); - if (c == '\n') - { - get_line(); - if (line == 0) - unterminated_string(s_lineno, s_line, s_cptr); - } - } - } - } + quote = c; + for (;;) + { + c = *cptr++; + putc(c, text_file); + if (dflag) putc(c, union_file); + if (c == quote) + { + FREE(s_line); + goto loop; + } + if (c == '\n') + unterminated_string(s_lineno, s_line, s_cptr); + if (c == '\\') + { + c = *cptr++; + putc(c, text_file); + if (dflag) putc(c, union_file); + if (c == '\n') + { + get_line(); + if (line == 0) + unterminated_string(s_lineno, s_line, s_cptr); + } + } + } + } case '/': - c = *cptr; - if (c == '/') - { - putc('*', text_file); - if (dflag) putc('*', union_file); - while ((c = *++cptr) != '\n') - { - if (c == '*' && cptr[1] == '/') - { - fprintf(text_file, "* "); - if (dflag) fprintf(union_file, "* "); - } - else - { - putc(c, text_file); - if (dflag) putc(c, union_file); - } - } - fprintf(text_file, "*/\n"); - if (dflag) fprintf(union_file, "*/\n"); - goto next_line; - } - if (c == '*') - { - int c_lineno = lineno; - char *c_line = dup_line(); - char *c_cptr = c_line + (cptr - line - 1); + c = *cptr; + if (c == '/') + { + putc('*', text_file); + if (dflag) putc('*', union_file); + while ((c = *++cptr) != '\n') + { + if (c == '*' && cptr[1] == '/') + { + fprintf(text_file, "* "); + if (dflag) fprintf(union_file, "* "); + } + else + { + putc(c, text_file); + if (dflag) putc(c, union_file); + } + } + fprintf(text_file, "*/\n"); + if (dflag) fprintf(union_file, "*/\n"); + goto next_line; + } + if (c == '*') + { + int c_lineno = lineno; + char *c_line = dup_line(); + char *c_cptr = c_line + (cptr - line - 1); - putc('*', text_file); - if (dflag) putc('*', union_file); - ++cptr; - for (;;) - { - c = *cptr++; - putc(c, text_file); - if (dflag) putc(c, union_file); - if (c == '*' && *cptr == '/') - { - putc('/', text_file); - if (dflag) putc('/', union_file); - ++cptr; - FREE(c_line); - goto loop; - } - if (c == '\n') - { - get_line(); - if (line == 0) - unterminated_comment(c_lineno, c_line, c_cptr); - } - } - } - goto loop; + putc('*', text_file); + if (dflag) putc('*', union_file); + ++cptr; + for (;;) + { + c = *cptr++; + putc(c, text_file); + if (dflag) putc(c, union_file); + if (c == '*' && *cptr == '/') + { + putc('/', text_file); + if (dflag) putc('/', union_file); + ++cptr; + FREE(c_line); + goto loop; + } + if (c == '\n') + { + get_line(); + if (line == 0) + unterminated_comment(c_lineno, c_line, c_cptr); + } + } + } + goto loop; default: - goto loop; + goto loop; } } @@ -589,11 +589,11 @@ static int hexval(int c) { if (c >= '0' && c <= '9') - return (c - '0'); + return (c - '0'); if (c >= 'A' && c <= 'F') - return (c - 'A' + 10); + return (c - 'A' + 10); if (c >= 'a' && c <= 'f') - return (c - 'a' + 10); + return (c - 'a' + 10); return (-1); } @@ -614,123 +614,123 @@ get_literal(void) cinc = 0; for (;;) { - c = *cptr++; - if (c == quote) break; - if (c == '\n') unterminated_string(s_lineno, s_line, s_cptr); - if (c == '\\') - { - char *c_cptr = cptr - 1; + c = *cptr++; + if (c == quote) break; + if (c == '\n') unterminated_string(s_lineno, s_line, s_cptr); + if (c == '\\') + { + char *c_cptr = cptr - 1; - c = *cptr++; - switch (c) - { - case '\n': - get_line(); - if (line == 0) unterminated_string(s_lineno, s_line, s_cptr); - continue; + c = *cptr++; + switch (c) + { + case '\n': + get_line(); + if (line == 0) unterminated_string(s_lineno, s_line, s_cptr); + continue; - case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - n = c - '0'; - c = *cptr; - if (IS_OCTAL(c)) - { - n = (n << 3) + (c - '0'); - c = *++cptr; - if (IS_OCTAL(c)) - { - n = (n << 3) + (c - '0'); - ++cptr; - } - } - if (n > MAXCHAR) illegal_character(c_cptr); - c = n; - break; + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + n = c - '0'; + c = *cptr; + if (IS_OCTAL(c)) + { + n = (n << 3) + (c - '0'); + c = *++cptr; + if (IS_OCTAL(c)) + { + n = (n << 3) + (c - '0'); + ++cptr; + } + } + if (n > MAXCHAR) illegal_character(c_cptr); + c = n; + break; - case 'x': - c = *cptr++; - n = hexval(c); - if (n < 0 || n >= 16) - illegal_character(c_cptr); - for (;;) - { - c = *cptr; - i = hexval(c); - if (i < 0 || i >= 16) break; - ++cptr; - n = (n << 4) + i; - if (n > MAXCHAR) illegal_character(c_cptr); - } - c = n; - break; + case 'x': + c = *cptr++; + n = hexval(c); + if (n < 0 || n >= 16) + illegal_character(c_cptr); + for (;;) + { + c = *cptr; + i = hexval(c); + if (i < 0 || i >= 16) break; + ++cptr; + n = (n << 4) + i; + if (n > MAXCHAR) illegal_character(c_cptr); + } + c = n; + break; - case 'a': c = 7; break; - case 'b': c = '\b'; break; - case 'f': c = '\f'; break; - case 'n': c = '\n'; break; - case 'r': c = '\r'; break; - case 't': c = '\t'; break; - case 'v': c = '\v'; break; - } - } - cachec(c); + case 'a': c = 7; break; + case 'b': c = '\b'; break; + case 'f': c = '\f'; break; + case 'n': c = '\n'; break; + case 'r': c = '\r'; break; + case 't': c = '\t'; break; + case 'v': c = '\v'; break; + } + } + cachec(c); } FREE(s_line); n = cinc; s = MALLOC(n); if (s == 0) no_space(); - + for (i = 0; i < n; ++i) - s[i] = cache[i]; + s[i] = cache[i]; cinc = 0; if (n == 1) - cachec('\''); + cachec('\''); else - cachec('"'); + cachec('"'); for (i = 0; i < n; ++i) { - c = ((unsigned char *)s)[i]; - if (c == '\\' || c == cache[0]) - { - cachec('\\'); - cachec(c); - } - else if (isprint(c)) - cachec(c); - else - { - cachec('\\'); - switch (c) - { - case 7: cachec('a'); break; - case '\b': cachec('b'); break; - case '\f': cachec('f'); break; - case '\n': cachec('n'); break; - case '\r': cachec('r'); break; - case '\t': cachec('t'); break; - case '\v': cachec('v'); break; - default: - cachec(((c >> 6) & 7) + '0'); - cachec(((c >> 3) & 7) + '0'); - cachec((c & 7) + '0'); - break; - } - } + c = ((unsigned char *)s)[i]; + if (c == '\\' || c == cache[0]) + { + cachec('\\'); + cachec(c); + } + else if (isprint(c)) + cachec(c); + else + { + cachec('\\'); + switch (c) + { + case 7: cachec('a'); break; + case '\b': cachec('b'); break; + case '\f': cachec('f'); break; + case '\n': cachec('n'); break; + case '\r': cachec('r'); break; + case '\t': cachec('t'); break; + case '\v': cachec('v'); break; + default: + cachec(((c >> 6) & 7) + '0'); + cachec(((c >> 3) & 7) + '0'); + cachec((c & 7) + '0'); + break; + } + } } if (n == 1) - cachec('\''); + cachec('\''); else - cachec('"'); + cachec('"'); cachec(NUL); bp = lookup(cache); bp->class = TERM; if (n == 1 && bp->value == UNDEFINED) - bp->value = *(unsigned char *)s; + bp->value = *(unsigned char *)s; FREE(s); return (bp); @@ -743,15 +743,15 @@ is_reserved(char *name) char *s; if (strcmp(name, ".") == 0 || - strcmp(name, "$accept") == 0 || - strcmp(name, "$end") == 0) - return (1); + strcmp(name, "$accept") == 0 || + strcmp(name, "$end") == 0) + return (1); if (name[0] == '$' && name[1] == '$' && isdigit((int) name[2])) { - s = name + 3; - while (isdigit((int) *s)) ++s; - if (*s == NUL) return (1); + s = name + 3; + while (isdigit((int) *s)) ++s; + if (*s == NUL) return (1); } return (0); @@ -765,7 +765,7 @@ get_name(void) cinc = 0; for (c = *cptr; IS_IDENT(c); c = *++cptr) - cachec(c); + cachec(c); cachec(NUL); if (is_reserved(cache)) used_reserved(cache); @@ -782,7 +782,7 @@ get_number(void) n = 0; for (c = *cptr; isdigit(c); c = *++cptr) - n = 10*n + (c - '0'); + n = 10*n + (c - '0'); return (n); } @@ -802,7 +802,7 @@ get_tag(void) c = nextc(); if (c == EOF) unexpected_EOF(); if (!isalpha(c) && c != '_' && c != '$') - illegal_tag(t_lineno, t_line, t_cptr); + illegal_tag(t_lineno, t_line, t_cptr); cinc = 0; do { cachec(c); c = *++cptr; } while (IS_IDENT(c)); @@ -811,22 +811,22 @@ get_tag(void) c = nextc(); if (c == EOF) unexpected_EOF(); if (c != '>') - illegal_tag(t_lineno, t_line, t_cptr); + illegal_tag(t_lineno, t_line, t_cptr); ++cptr; for (i = 0; i < ntags; ++i) { - if (strcmp(cache, tag_table[i]) == 0) - return (tag_table[i]); + if (strcmp(cache, tag_table[i]) == 0) + return (tag_table[i]); } if (ntags >= tagmax) { - tagmax += 16; - tag_table = (char **) - (tag_table ? REALLOC(tag_table, tagmax*sizeof(char *)) - : MALLOC(tagmax*sizeof(char *))); - if (tag_table == 0) no_space(); + tagmax += 16; + tag_table = (char **) + (tag_table ? REALLOC(tag_table, tagmax*sizeof(char *)) + : MALLOC(tagmax*sizeof(char *))); + if (tag_table == 0) no_space(); } s = MALLOC(cinc); @@ -853,50 +853,50 @@ declare_tokens(int assoc) if (c == EOF) unexpected_EOF(); if (c == '<') { - tag = get_tag(); - c = nextc(); - if (c == EOF) unexpected_EOF(); + tag = get_tag(); + c = nextc(); + if (c == EOF) unexpected_EOF(); } for (;;) { - if (isalpha(c) || c == '_' || c == '.' || c == '$') - bp = get_name(); - else if (c == '\'' || c == '"') - bp = get_literal(); - else - return; + if (isalpha(c) || c == '_' || c == '.' || c == '$') + bp = get_name(); + else if (c == '\'' || c == '"') + bp = get_literal(); + else + return; - if (bp == goal) tokenized_start(bp->name); - bp->class = TERM; + if (bp == goal) tokenized_start(bp->name); + bp->class = TERM; - if (tag) - { - if (bp->tag && tag != bp->tag) - retyped_warning(bp->name); - bp->tag = tag; - } + if (tag) + { + if (bp->tag && tag != bp->tag) + retyped_warning(bp->name); + bp->tag = tag; + } - if (assoc != TOKEN) - { - if (bp->prec && prec != bp->prec) - reprec_warning(bp->name); - bp->assoc = assoc; - bp->prec = prec; - } + if (assoc != TOKEN) + { + if (bp->prec && prec != bp->prec) + reprec_warning(bp->name); + bp->assoc = assoc; + bp->prec = prec; + } - c = nextc(); - if (c == EOF) unexpected_EOF(); - value = UNDEFINED; - if (isdigit(c)) - { - value = get_number(); - if (bp->value != UNDEFINED && value != bp->value) - revalued_warning(bp->name); - bp->value = value; - c = nextc(); - if (c == EOF) unexpected_EOF(); - } + c = nextc(); + if (c == EOF) unexpected_EOF(); + value = UNDEFINED; + if (isdigit(c)) + { + value = get_number(); + if (bp->value != UNDEFINED && value != bp->value) + revalued_warning(bp->name); + bp->value = value; + c = nextc(); + if (c == EOF) unexpected_EOF(); + } } } @@ -915,17 +915,17 @@ declare_types(void) for (;;) { - c = nextc(); - if (isalpha(c) || c == '_' || c == '.' || c == '$') - bp = get_name(); - else if (c == '\'' || c == '"') - bp = get_literal(); - else - return; + c = nextc(); + if (isalpha(c) || c == '_' || c == '.' || c == '$') + bp = get_name(); + else if (c == '\'' || c == '"') + bp = get_literal(); + else + return; - if (bp->tag && tag != bp->tag) - retyped_warning(bp->name); - bp->tag = tag; + if (bp->tag && tag != bp->tag) + retyped_warning(bp->name); + bp->tag = tag; } } @@ -939,12 +939,12 @@ declare_start(void) c = nextc(); if (c == EOF) unexpected_EOF(); if (!isalpha(c) && c != '_' && c != '.' && c != '$') - syntax_error(lineno, line, cptr); + syntax_error(lineno, line, cptr); bp = get_name(); if (bp->class == TERM) - terminal_start(bp->name); + terminal_start(bp->name); if (goal && goal != bp) - restarted_warning(); + restarted_warning(); goal = bp; } @@ -960,41 +960,41 @@ read_declarations(void) for (;;) { - c = nextc(); - if (c == EOF) unexpected_EOF(); - if (c != '%') syntax_error(lineno, line, cptr); - switch (k = keyword()) - { - case MARK: - return; + c = nextc(); + if (c == EOF) unexpected_EOF(); + if (c != '%') syntax_error(lineno, line, cptr); + switch (k = keyword()) + { + case MARK: + return; - case IDENT: - copy_ident(); - break; + case IDENT: + copy_ident(); + break; - case TEXT: - copy_text(); - break; + case TEXT: + copy_text(); + break; - case UNION: - copy_union(); - break; + case UNION: + copy_union(); + break; - case TOKEN: - case LEFT: - case RIGHT: - case NONASSOC: - declare_tokens(k); - break; + case TOKEN: + case LEFT: + case RIGHT: + case NONASSOC: + declare_tokens(k); + break; - case TYPE: - declare_types(); - break; + case TYPE: + declare_types(); + break; - case START: - declare_start(); - break; - } + case START: + declare_start(); + break; + } } } @@ -1063,36 +1063,36 @@ advance_to_start(void) for (;;) { - c = nextc(); - if (c != '%') break; - s_cptr = cptr; - switch (keyword()) - { - case MARK: - no_grammar(); + c = nextc(); + if (c != '%') break; + s_cptr = cptr; + switch (keyword()) + { + case MARK: + no_grammar(); - case TEXT: - copy_text(); - break; + case TEXT: + copy_text(); + break; - case START: - declare_start(); - break; + case START: + declare_start(); + break; - default: - syntax_error(lineno, line, s_cptr); - } + default: + syntax_error(lineno, line, s_cptr); + } } c = nextc(); if (!isalpha(c) && c != '_' && c != '.' && c != '_') - syntax_error(lineno, line, cptr); + syntax_error(lineno, line, cptr); bp = get_name(); if (goal == 0) { - if (bp->class == TERM) - terminal_start(bp->name); - goal = bp; + if (bp->class == TERM) + terminal_start(bp->name); + goal = bp; } s_lineno = lineno; @@ -1108,10 +1108,10 @@ static void start_rule(bucket *bp, int s_lineno) { if (bp->class == TERM) - terminal_lhs(s_lineno); + terminal_lhs(s_lineno); bp->class = NONTERM; if (nrules >= maxrules) - expand_rules(); + expand_rules(); plhs[nrules] = bp; rprec[nrules] = UNDEFINED; rassoc[nrules] = TOKEN; @@ -1125,9 +1125,9 @@ end_rule(void) if (!last_was_action && plhs[nrules]->tag) { - for (i = nitems - 1; pitem[i]; --i) continue; - if (pitem[i+1] == 0 || pitem[i+1]->tag != plhs[nrules]->tag) - default_action_warning(); + for (i = nitems - 1; pitem[i]; --i) continue; + if (pitem[i+1] == 0 || pitem[i+1]->tag != plhs[nrules]->tag) + default_action_warning(); } last_was_action = 0; @@ -1152,13 +1152,13 @@ insert_empty_rule(void) bp->class = NONTERM; if ((nitems += 2) > maxitems) - expand_items(); + expand_items(); bpp = pitem + nitems - 1; *bpp-- = bp; while ((bpp[0] = bpp[-1])) --bpp; if (++nrules >= maxrules) - expand_rules(); + expand_rules(); plhs[nrules] = plhs[nrules-1]; plhs[nrules-1] = bp; rprec[nrules] = rprec[nrules-1]; @@ -1177,25 +1177,25 @@ add_symbol(void) c = *cptr; if (c == '\'' || c == '"') - bp = get_literal(); + bp = get_literal(); else - bp = get_name(); + bp = get_name(); c = nextc(); if (c == ':') { - end_rule(); - start_rule(bp, s_lineno); - ++cptr; - return; + end_rule(); + start_rule(bp, s_lineno); + ++cptr; + return; } if (last_was_action) - insert_empty_rule(); + insert_empty_rule(); last_was_action = 0; if (++nitems > maxitems) - expand_items(); + expand_items(); pitem[nitems-1] = bp; } @@ -1214,12 +1214,12 @@ copy_action(void) char *a_cptr = a_line + (cptr - line); if (last_was_action) - insert_empty_rule(); + insert_empty_rule(); last_was_action = 1; fprintf(f, "case %d:\n", nrules - 2); if (!lflag) - fprintf(f, line_format, lineno, input_file_name); + fprintf(f, line_format, lineno, input_file_name); if (*cptr == '=') ++cptr; n = 0; @@ -1230,92 +1230,92 @@ loop: c = *cptr; if (c == '$') { - if (cptr[1] == '<') - { - int d_lineno = lineno; - char *d_line = dup_line(); - char *d_cptr = d_line + (cptr - line); + if (cptr[1] == '<') + { + int d_lineno = lineno; + char *d_line = dup_line(); + char *d_cptr = d_line + (cptr - line); - ++cptr; - tag = get_tag(); - c = *cptr; - if (c == '$') - { - fprintf(f, "yyval.%s", tag); - ++cptr; - FREE(d_line); - goto loop; - } - else if (isdigit(c)) - { - i = get_number(); - if (i > n) dollar_warning(d_lineno, i); - fprintf(f, "yyvsp[%d].%s", i - n, tag); - FREE(d_line); - goto loop; - } - else if (c == '-' && isdigit((int) cptr[1])) - { - ++cptr; - i = -get_number() - n; - fprintf(f, "yyvsp[%d].%s", i, tag); - FREE(d_line); - goto loop; - } - else - dollar_error(d_lineno, d_line, d_cptr); - } - else if (cptr[1] == '$') - { - if (ntags) - { - tag = plhs[nrules]->tag; - if (tag == 0) untyped_lhs(); - fprintf(f, "yyval.%s", tag); - } - else - fprintf(f, "yyval"); - cptr += 2; - goto loop; - } - else if (isdigit((int) cptr[1])) - { - ++cptr; - i = get_number(); - if (ntags) - { - if (i <= 0 || i > n) - unknown_rhs(i); - tag = pitem[nitems + i - n - 1]->tag; - if (tag == 0) untyped_rhs(i, pitem[nitems + i - n - 1]->name); - fprintf(f, "yyvsp[%d].%s", i - n, tag); - } - else - { - if (i > n) - dollar_warning(lineno, i); - fprintf(f, "yyvsp[%d]", i - n); - } - goto loop; - } - else if (cptr[1] == '-') - { - cptr += 2; - i = get_number(); - if (ntags) - unknown_rhs(-i); - fprintf(f, "yyvsp[%d]", -i - n); - goto loop; - } + ++cptr; + tag = get_tag(); + c = *cptr; + if (c == '$') + { + fprintf(f, "yyval.%s", tag); + ++cptr; + FREE(d_line); + goto loop; + } + else if (isdigit(c)) + { + i = get_number(); + if (i > n) dollar_warning(d_lineno, i); + fprintf(f, "yyvsp[%d].%s", i - n, tag); + FREE(d_line); + goto loop; + } + else if (c == '-' && isdigit((int) cptr[1])) + { + ++cptr; + i = -get_number() - n; + fprintf(f, "yyvsp[%d].%s", i, tag); + FREE(d_line); + goto loop; + } + else + dollar_error(d_lineno, d_line, d_cptr); + } + else if (cptr[1] == '$') + { + if (ntags) + { + tag = plhs[nrules]->tag; + if (tag == 0) untyped_lhs(); + fprintf(f, "yyval.%s", tag); + } + else + fprintf(f, "yyval"); + cptr += 2; + goto loop; + } + else if (isdigit((int) cptr[1])) + { + ++cptr; + i = get_number(); + if (ntags) + { + if (i <= 0 || i > n) + unknown_rhs(i); + tag = pitem[nitems + i - n - 1]->tag; + if (tag == 0) untyped_rhs(i, pitem[nitems + i - n - 1]->name); + fprintf(f, "yyvsp[%d].%s", i - n, tag); + } + else + { + if (i > n) + dollar_warning(lineno, i); + fprintf(f, "yyvsp[%d]", i - n); + } + goto loop; + } + else if (cptr[1] == '-') + { + cptr += 2; + i = get_number(); + if (ntags) + unknown_rhs(-i); + fprintf(f, "yyvsp[%d]", -i - n); + goto loop; + } } if (isalpha(c) || c == '_' || c == '$') { - do - { - putc(c, f); - c = *++cptr; - } while (isalnum(c) || c == '_' || c == '$'); - goto loop; + do + { + putc(c, f); + c = *++cptr; + } while (isalnum(c) || c == '_' || c == '$'); + goto loop; } putc(c, f); ++cptr; @@ -1323,105 +1323,105 @@ loop: { case '\n': next_line: - get_line(); - if (line) goto loop; - unterminated_action(a_lineno, a_line, a_cptr); + get_line(); + if (line) goto loop; + unterminated_action(a_lineno, a_line, a_cptr); case ';': - if (depth > 0) goto loop; - fprintf(f, "\nbreak;\n"); - FREE(a_line); - return; + if (depth > 0) goto loop; + fprintf(f, "\nbreak;\n"); + FREE(a_line); + return; case '{': - ++depth; - goto loop; + ++depth; + goto loop; case '}': - if (--depth > 0) goto loop; - fprintf(f, "\nbreak;\n"); - FREE(a_line); - return; + if (--depth > 0) goto loop; + fprintf(f, "\nbreak;\n"); + FREE(a_line); + return; case '\'': case '"': - { - int s_lineno = lineno; - char *s_line = dup_line(); - char *s_cptr = s_line + (cptr - line - 1); + { + int s_lineno = lineno; + char *s_line = dup_line(); + char *s_cptr = s_line + (cptr - line - 1); - quote = c; - for (;;) - { - c = *cptr++; - putc(c, f); - if (c == quote) - { - FREE(s_line); - goto loop; - } - if (c == '\n') - unterminated_string(s_lineno, s_line, s_cptr); - if (c == '\\') - { - c = *cptr++; - putc(c, f); - if (c == '\n') - { - get_line(); - if (line == 0) - unterminated_string(s_lineno, s_line, s_cptr); - } - } - } - } + quote = c; + for (;;) + { + c = *cptr++; + putc(c, f); + if (c == quote) + { + FREE(s_line); + goto loop; + } + if (c == '\n') + unterminated_string(s_lineno, s_line, s_cptr); + if (c == '\\') + { + c = *cptr++; + putc(c, f); + if (c == '\n') + { + get_line(); + if (line == 0) + unterminated_string(s_lineno, s_line, s_cptr); + } + } + } + } case '/': - c = *cptr; - if (c == '/') - { - putc('*', f); - while ((c = *++cptr) != '\n') - { - if (c == '*' && cptr[1] == '/') - fprintf(f, "* "); - else - putc(c, f); - } - fprintf(f, "*/\n"); - goto next_line; - } - if (c == '*') - { - int c_lineno = lineno; - char *c_line = dup_line(); - char *c_cptr = c_line + (cptr - line - 1); + c = *cptr; + if (c == '/') + { + putc('*', f); + while ((c = *++cptr) != '\n') + { + if (c == '*' && cptr[1] == '/') + fprintf(f, "* "); + else + putc(c, f); + } + fprintf(f, "*/\n"); + goto next_line; + } + if (c == '*') + { + int c_lineno = lineno; + char *c_line = dup_line(); + char *c_cptr = c_line + (cptr - line - 1); - putc('*', f); - ++cptr; - for (;;) - { - c = *cptr++; - putc(c, f); - if (c == '*' && *cptr == '/') - { - putc('/', f); - ++cptr; - FREE(c_line); - goto loop; - } - if (c == '\n') - { - get_line(); - if (line == 0) - unterminated_comment(c_lineno, c_line, c_cptr); - } - } - } - goto loop; + putc('*', f); + ++cptr; + for (;;) + { + c = *cptr++; + putc(c, f); + if (c == '*' && *cptr == '/') + { + putc('/', f); + ++cptr; + FREE(c_line); + goto loop; + } + if (c == '\n') + { + get_line(); + if (line == 0) + unterminated_comment(c_lineno, c_line, c_cptr); + } + } + } + goto loop; default: - goto loop; + goto loop; } } @@ -1435,34 +1435,34 @@ mark_symbol(void) c = cptr[1]; if (c == '%' || c == '\\') { - cptr += 2; - return (1); + cptr += 2; + return (1); } if (c == '=') - cptr += 2; + cptr += 2; else if ((c == 'p' || c == 'P') && - ((c = cptr[2]) == 'r' || c == 'R') && - ((c = cptr[3]) == 'e' || c == 'E') && - ((c = cptr[4]) == 'c' || c == 'C') && - ((c = cptr[5], !IS_IDENT(c)))) - cptr += 5; + ((c = cptr[2]) == 'r' || c == 'R') && + ((c = cptr[3]) == 'e' || c == 'E') && + ((c = cptr[4]) == 'c' || c == 'C') && + ((c = cptr[5], !IS_IDENT(c)))) + cptr += 5; else - syntax_error(lineno, line, cptr); + syntax_error(lineno, line, cptr); c = nextc(); if (isalpha(c) || c == '_' || c == '.' || c == '$') - bp = get_name(); + bp = get_name(); else if (c == '\'' || c == '"') - bp = get_literal(); + bp = get_literal(); else { - syntax_error(lineno, line, cptr); - /*NOTREACHED*/ + syntax_error(lineno, line, cptr); + /*NOTREACHED*/ } if (rprec[nrules] != UNDEFINED && bp->prec != rprec[nrules]) - prec_redeclared(); + prec_redeclared(); rprec[nrules] = bp->prec; rassoc[nrules] = bp->assoc; @@ -1480,25 +1480,25 @@ read_grammar(void) for (;;) { - c = nextc(); - if (c == EOF) break; - if (isalpha(c) || c == '_' || c == '.' || c == '$' || c == '\'' || - c == '"') - add_symbol(); - else if (c == '{' || c == '=') - copy_action(); - else if (c == '|') - { - end_rule(); - start_rule(plhs[nrules-1], 0); - ++cptr; - } - else if (c == '%') - { - if (mark_symbol()) break; - } - else - syntax_error(lineno, line, cptr); + c = nextc(); + if (c == EOF) break; + if (isalpha(c) || c == '_' || c == '.' || c == '$' || c == '\'' || + c == '"') + add_symbol(); + else if (c == '{' || c == '=') + copy_action(); + else if (c == '|') + { + end_rule(); + start_rule(plhs[nrules-1], 0); + ++cptr; + } + else if (c == '%') + { + if (mark_symbol()) break; + } + else + syntax_error(lineno, line, cptr); } end_rule(); } @@ -1513,8 +1513,8 @@ free_tags(void) for (i = 0; i < ntags; ++i) { - assert(tag_table[i]); - FREE(tag_table[i]); + assert(tag_table[i]); + FREE(tag_table[i]); } FREE(tag_table); } @@ -1528,7 +1528,7 @@ pack_names(void) name_pool_size = 13; /* 13 == sizeof("$end") + sizeof("$accept") */ for (bp = first_symbol; bp; bp = bp->next) - name_pool_size += strlen(bp->name) + 1; + name_pool_size += strlen(bp->name) + 1; name_pool = MALLOC(name_pool_size); if (name_pool == 0) no_space(); @@ -1537,11 +1537,11 @@ pack_names(void) t = name_pool + 13; for (bp = first_symbol; bp; bp = bp->next) { - p = t; - s = bp->name; - while ((*t++ = *s++)) continue; - FREE(bp->name); - bp->name = p; + p = t; + s = bp->name; + while ((*t++ = *s++)) continue; + FREE(bp->name); + bp->name = p; } } @@ -1552,15 +1552,15 @@ check_symbols(void) bucket *bp; if (goal->class == UNKNOWN) - undefined_goal(goal->name); + undefined_goal(goal->name); for (bp = first_symbol; bp; bp = bp->next) { - if (bp->class == UNKNOWN) - { - undefined_symbol_warning(bp->name); - bp->class = TERM; - } + if (bp->class == UNKNOWN) + { + undefined_symbol_warning(bp->name); + bp->class = TERM; + } } } @@ -1576,8 +1576,8 @@ pack_symbols(void) ntokens = 1; for (bp = first_symbol; bp; bp = bp->next) { - ++nsyms; - if (bp->class == TERM) ++ntokens; + ++nsyms; + if (bp->class == TERM) ++ntokens; } start_symbol = ntokens; nvars = nsyms - ntokens; @@ -1601,65 +1601,65 @@ pack_symbols(void) j = start_symbol + 1; for (bp = first_symbol; bp; bp = bp->next) { - if (bp->class == TERM) - v[i++] = bp; - else - v[j++] = bp; + if (bp->class == TERM) + v[i++] = bp; + else + v[j++] = bp; } assert(i == ntokens && j == nsyms); for (i = 1; i < ntokens; ++i) - v[i]->index = i; + v[i]->index = i; goal->index = start_symbol + 1; k = start_symbol + 2; while (++i < nsyms) - if (v[i] != goal) - { - v[i]->index = k; - ++k; - } + if (v[i] != goal) + { + v[i]->index = k; + ++k; + } goal->value = 0; k = 1; for (i = start_symbol + 1; i < nsyms; ++i) { - if (v[i] != goal) - { - v[i]->value = k; - ++k; - } + if (v[i] != goal) + { + v[i]->value = k; + ++k; + } } k = 0; for (i = 1; i < ntokens; ++i) { - n = v[i]->value; - if (n > 256) - { - for (j = k++; j > 0 && symbol_value[j-1] > n; --j) - symbol_value[j] = symbol_value[j-1]; - symbol_value[j] = n; - } + n = v[i]->value; + if (n > 256) + { + for (j = k++; j > 0 && symbol_value[j-1] > n; --j) + symbol_value[j] = symbol_value[j-1]; + symbol_value[j] = n; + } } if (v[1]->value == UNDEFINED) - v[1]->value = 256; + v[1]->value = 256; j = 0; n = 257; for (i = 2; i < ntokens; ++i) { - if (v[i]->value == UNDEFINED) - { - while (j < k && n == symbol_value[j]) - { - while (++j < k && n == symbol_value[j]) continue; - ++n; - } - v[i]->value = n; - ++n; - } + if (v[i]->value == UNDEFINED) + { + while (j < k && n == symbol_value[j]) + { + while (++j < k && n == symbol_value[j]) continue; + ++n; + } + v[i]->value = n; + ++n; + } } symbol_name[0] = name_pool + 8; @@ -1668,10 +1668,10 @@ pack_symbols(void) symbol_assoc[0] = TOKEN; for (i = 1; i < ntokens; ++i) { - symbol_name[i] = v[i]->name; - symbol_value[i] = v[i]->value; - symbol_prec[i] = v[i]->prec; - symbol_assoc[i] = v[i]->assoc; + symbol_name[i] = v[i]->name; + symbol_value[i] = v[i]->value; + symbol_prec[i] = v[i]->prec; + symbol_assoc[i] = v[i]->assoc; } symbol_name[start_symbol] = name_pool; symbol_value[start_symbol] = -1; @@ -1679,11 +1679,11 @@ pack_symbols(void) symbol_assoc[start_symbol] = TOKEN; for (++i; i < nsyms; ++i) { - k = v[i]->index; - symbol_name[k] = v[i]->name; - symbol_value[k] = v[i]->value; - symbol_prec[k] = v[i]->prec; - symbol_assoc[k] = v[i]->assoc; + k = v[i]->index; + symbol_name[k] = v[i]->name; + symbol_value[k] = v[i]->value; + symbol_prec[k] = v[i]->prec; + symbol_assoc[k] = v[i]->assoc; } FREE(v); @@ -1721,27 +1721,27 @@ pack_grammar(void) j = 4; for (i = 3; i < nrules; ++i) { - rlhs[i] = plhs[i]->index; - rrhs[i] = j; - assoc = TOKEN; - prec = 0; - while (pitem[j]) - { - ritem[j] = pitem[j]->index; - if (pitem[j]->class == TERM) - { - prec = pitem[j]->prec; - assoc = pitem[j]->assoc; - } - ++j; - } - ritem[j] = -i; - ++j; - if (rprec[i] == UNDEFINED) - { - rprec[i] = prec; - rassoc[i] = assoc; - } + rlhs[i] = plhs[i]->index; + rrhs[i] = j; + assoc = TOKEN; + prec = 0; + while (pitem[j]) + { + ritem[j] = pitem[j]->index; + if (pitem[j]->class == TERM) + { + prec = pitem[j]->prec; + assoc = pitem[j]->assoc; + } + ++j; + } + ritem[j] = -i; + ++j; + if (rprec[i] == UNDEFINED) + { + rprec[i] = prec; + rassoc[i] = assoc; + } } rrhs[i] = j; @@ -1762,27 +1762,27 @@ print_grammar(void) k = 1; for (i = 2; i < nrules; ++i) { - if (rlhs[i] != rlhs[i-1]) - { - if (i != 2) fprintf(f, "\n"); - fprintf(f, "%4d %s :", i - 2, symbol_name[rlhs[i]]); - spacing = strlen(symbol_name[rlhs[i]]) + 1; - } - else - { - fprintf(f, "%4d ", i - 2); - j = spacing; - while (--j >= 0) putc(' ', f); - putc('|', f); - } + if (rlhs[i] != rlhs[i-1]) + { + if (i != 2) fprintf(f, "\n"); + fprintf(f, "%4d %s :", i - 2, symbol_name[rlhs[i]]); + spacing = strlen(symbol_name[rlhs[i]]) + 1; + } + else + { + fprintf(f, "%4d ", i - 2); + j = spacing; + while (--j >= 0) putc(' ', f); + putc('|', f); + } - while (ritem[k] >= 0) - { - fprintf(f, " %s", symbol_name[ritem[k]]); - ++k; - } - ++k; - putc('\n', f); + while (ritem[k] >= 0) + { + fprintf(f, " %s", symbol_name[ritem[k]]); + ++k; + } + ++k; + putc('\n', f); } } diff --git a/modules/libcom/src/yacc/skeleton.c b/modules/libcom/src/yacc/skeleton.c index ab683c666..18fe40371 100644 --- a/modules/libcom/src/yacc/skeleton.c +++ b/modules/libcom/src/yacc/skeleton.c @@ -4,17 +4,17 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include "defs.h" -/* If the skeleton is changed, the banner should be changed so that */ -/* the altered version can be easily distinguished from the original. */ -/* */ -/* The #defines included with the banner are there because they are */ -/* useful in subsequent code. The macros #defined in the header or */ -/* the body either are not useful outside of semantic actions or */ -/* are conditional. */ +/* If the skeleton is changed, the banner should be changed so that */ +/* the altered version can be easily distinguished from the original. */ +/* */ +/* The #defines included with the banner are there because they are */ +/* useful in subsequent code. The macros #defined in the header or */ +/* the body either are not useful outside of semantic actions or */ +/* are conditional. */ char *banner[] = { @@ -31,18 +31,18 @@ char *banner[] = char *tables[] = { - "static short yylhs[];", /* JRW */ - "static short yylen[];", /* JRW */ - "static short yydefred[];", /* JRW */ - "static short yydgoto[];", /* JRW */ - "static short yysindex[];", /* JRW */ - "static short yyrindex[];", /* JRW */ - "static short yygindex[];", /* JRW */ - "static short yytable[];", /* JRW */ - "static short yycheck[];", /* JRW */ + "static short yylhs[];", /* JRW */ + "static short yylen[];", /* JRW */ + "static short yydefred[];", /* JRW */ + "static short yydgoto[];", /* JRW */ + "static short yysindex[];", /* JRW */ + "static short yyrindex[];", /* JRW */ + "static short yygindex[];", /* JRW */ + "static short yytable[];", /* JRW */ + "static short yycheck[];", /* JRW */ "#if YYDEBUG", - "static char *yyname[];", /* JRW */ - "static char *yyrule[];", /* JRW */ + "static char *yyname[];", /* JRW */ + "static char *yyrule[];", /* JRW */ "#endif", 0 }; @@ -61,18 +61,18 @@ char *header[] = "#define YYMAXDEPTH 500", "#endif", "#endif", - "#if YYDEBUG", /* MRK */ - "static int yydebug;", /* JRW */ - "#endif", /* MRK */ - "static int yynerrs;", /* JRW */ - "static int yyerrflag;", /* JRW */ - "static int yychar;", /* JRW */ - "static short *yyssp;", /* JRW */ - "static YYSTYPE *yyvsp;", /* JRW */ - "static YYSTYPE yyval;", /* JRW */ - "static YYSTYPE yylval;", /* JRW */ - "static short yyss[YYSTACKSIZE];", /* JRW */ - "static YYSTYPE yyvs[YYSTACKSIZE];", /* JRW */ + "#if YYDEBUG", /* MRK */ + "static int yydebug;", /* JRW */ + "#endif", /* MRK */ + "static int yynerrs;", /* JRW */ + "static int yyerrflag;", /* JRW */ + "static int yychar;", /* JRW */ + "static short *yyssp;", /* JRW */ + "static YYSTYPE *yyvsp;", /* JRW */ + "static YYSTYPE yyval;", /* JRW */ + "static YYSTYPE yylval;", /* JRW */ + "static short yyss[YYSTACKSIZE];", /* JRW */ + "static YYSTYPE yyvs[YYSTACKSIZE];", /* JRW */ "#define yystacksize YYSTACKSIZE", 0 }; @@ -84,8 +84,8 @@ char *body[] = "#define YYREJECT goto yyabort", "#define YYACCEPT goto yyaccept", "#define YYERROR goto yyerrlab", - "static int", /* JRW */ - "yyparse(void)", /* JRW */ + "static int", /* JRW */ + "yyparse(void)", /* JRW */ "{", " int yym, yyn, yystate;", "#if YYDEBUG", @@ -291,12 +291,12 @@ write_section(char *section[]) f = code_file; for (i = 0; (s = section[i]); ++i) { - ++outline; - while ((c = *s)) - { - putc(c, f); - ++s; - } - putc('\n', f); + ++outline; + while ((c = *s)) + { + putc(c, f); + ++s; + } + putc('\n', f); } } diff --git a/modules/libcom/src/yacc/symtab.c b/modules/libcom/src/yacc/symtab.c index 486835a21..cdf800b83 100644 --- a/modules/libcom/src/yacc/symtab.c +++ b/modules/libcom/src/yacc/symtab.c @@ -4,15 +4,15 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include "defs.h" /* TABLE_SIZE is the number of entries in the symbol table. */ -/* TABLE_SIZE must be a power of two. */ +/* TABLE_SIZE must be a power of two. */ -#define TABLE_SIZE 1024 +#define TABLE_SIZE 1024 bucket **symbol_table; @@ -30,7 +30,7 @@ hash(char *name) s = name; k = *s; while ((c = *++s)) - k = (31*k + c) & (TABLE_SIZE - 1); + k = (31*k + c) & (TABLE_SIZE - 1); return (k); } @@ -72,9 +72,9 @@ lookup(char *name) while (bp) { - if (strcmp(name, bp->name) == 0) return (bp); - bpp = &bp->link; - bp = *bpp; + if (strcmp(name, bp->name) == 0) return (bp); + bpp = &bp->link; + bp = *bpp; } *bpp = bp = make_bucket(name); @@ -93,7 +93,7 @@ create_symbol_table(void) symbol_table = (bucket **) MALLOC(TABLE_SIZE*sizeof(bucket *)); if (symbol_table == 0) no_space(); for (i = 0; i < TABLE_SIZE; i++) - symbol_table[i] = 0; + symbol_table[i] = 0; bp = make_bucket("error"); bp->index = 1; @@ -120,7 +120,7 @@ free_symbols(void) for (p = first_symbol; p; p = q) { - q = p->next; - FREE(p); + q = p->next; + FREE(p); } } diff --git a/modules/libcom/src/yacc/verbose.c b/modules/libcom/src/yacc/verbose.c index eb03cf386..bb539c9e3 100644 --- a/modules/libcom/src/yacc/verbose.c +++ b/modules/libcom/src/yacc/verbose.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include "defs.h" @@ -34,13 +34,13 @@ verbose(void) if (null_rules == 0) no_space(); fprintf(verbose_file, "\f\n"); for (i = 0; i < nstates; i++) - print_state(i); + print_state(i); FREE(null_rules); if (nunused) - log_unused(); + log_unused(); if (SRtotal || RRtotal) - log_conflicts(); + log_conflicts(); fprintf(verbose_file, "\n\n%d terminals, %d nonterminals\n", ntokens, nvars); fprintf(verbose_file, "%d grammar rules, %d states\n", nrules - 2, nstates); @@ -56,13 +56,13 @@ log_unused(void) fprintf(verbose_file, "\n\nRules never reduced:\n"); for (i = 3; i < nrules; ++i) { - if (!rules_used[i]) - { - fprintf(verbose_file, "\t%s :", symbol_name[rlhs[i]]); - for (p = ritem + rrhs[i]; *p >= 0; ++p) - fprintf(verbose_file, " %s", symbol_name[*p]); - fprintf(verbose_file, " (%d)\n", i - 2); - } + if (!rules_used[i]) + { + fprintf(verbose_file, "\t%s :", symbol_name[rlhs[i]]); + for (p = ritem + rrhs[i]; *p >= 0; ++p) + fprintf(verbose_file, " %s", symbol_name[*p]); + fprintf(verbose_file, " (%d)\n", i - 2); + } } } @@ -75,23 +75,23 @@ log_conflicts(void) fprintf(verbose_file, "\n\n"); for (i = 0; i < nstates; i++) { - if (SRconflicts[i] || RRconflicts[i]) - { - fprintf(verbose_file, "State %d contains ", i); - if (SRconflicts[i] == 1) - fprintf(verbose_file, "1 shift/reduce conflict"); - else if (SRconflicts[i] > 1) - fprintf(verbose_file, "%d shift/reduce conflicts", - SRconflicts[i]); - if (SRconflicts[i] && RRconflicts[i]) - fprintf(verbose_file, ", "); - if (RRconflicts[i] == 1) - fprintf(verbose_file, "1 reduce/reduce conflict"); - else if (RRconflicts[i] > 1) - fprintf(verbose_file, "%d reduce/reduce conflicts", - RRconflicts[i]); - fprintf(verbose_file, ".\n"); - } + if (SRconflicts[i] || RRconflicts[i]) + { + fprintf(verbose_file, "State %d contains ", i); + if (SRconflicts[i] == 1) + fprintf(verbose_file, "1 shift/reduce conflict"); + else if (SRconflicts[i] > 1) + fprintf(verbose_file, "%d shift/reduce conflicts", + SRconflicts[i]); + if (SRconflicts[i] && RRconflicts[i]) + fprintf(verbose_file, ", "); + if (RRconflicts[i] == 1) + fprintf(verbose_file, "1 reduce/reduce conflict"); + else if (RRconflicts[i] > 1) + fprintf(verbose_file, "%d reduce/reduce conflicts", + RRconflicts[i]); + fprintf(verbose_file, ".\n"); + } } } @@ -100,9 +100,9 @@ static void print_state(int state) { if (state) - fprintf(verbose_file, "\n\n"); + fprintf(verbose_file, "\n\n"); if (SRconflicts[state] || RRconflicts[state]) - print_conflicts(state); + print_conflicts(state); fprintf(verbose_file, "state %d\n", state); print_core(state); print_nulls(state); @@ -119,41 +119,41 @@ print_conflicts(int state) symbol = -1; for (p = parser[state]; p; p = p->next) { - if (p->suppressed == 2) - continue; + if (p->suppressed == 2) + continue; - if (p->symbol != symbol) - { - symbol = p->symbol; - number = p->number; - if (p->action_code == SHIFT) - act = SHIFT; - else - act = REDUCE; - } - else if (p->suppressed == 1) - { - if (state == final_state && symbol == 0) - { - fprintf(verbose_file, "%d: shift/reduce conflict \ + if (p->symbol != symbol) + { + symbol = p->symbol; + number = p->number; + if (p->action_code == SHIFT) + act = SHIFT; + else + act = REDUCE; + } + else if (p->suppressed == 1) + { + if (state == final_state && symbol == 0) + { + fprintf(verbose_file, "%d: shift/reduce conflict \ (accept, reduce %d) on $end\n", state, p->number - 2); - } - else - { - if (act == SHIFT) - { - fprintf(verbose_file, "%d: shift/reduce conflict \ + } + else + { + if (act == SHIFT) + { + fprintf(verbose_file, "%d: shift/reduce conflict \ (shift %d, reduce %d) on %s\n", state, number, p->number - 2, - symbol_name[symbol]); - } - else - { - fprintf(verbose_file, "%d: reduce/reduce conflict \ + symbol_name[symbol]); + } + else + { + fprintf(verbose_file, "%d: reduce/reduce conflict \ (reduce %d, reduce %d) on %s\n", state, number - 2, p->number - 2, - symbol_name[symbol]); - } - } - } + symbol_name[symbol]); + } + } + } } } @@ -173,23 +173,23 @@ print_core(int state) for (i = 0; i < k; i++) { - sp1 = sp = ritem + statep->items[i]; + sp1 = sp = ritem + statep->items[i]; - while (*sp >= 0) ++sp; - rule = -(*sp); - fprintf(verbose_file, "\t%s : ", symbol_name[rlhs[rule]]); + while (*sp >= 0) ++sp; + rule = -(*sp); + fprintf(verbose_file, "\t%s : ", symbol_name[rlhs[rule]]); for (sp = ritem + rrhs[rule]; sp < sp1; sp++) - fprintf(verbose_file, "%s ", symbol_name[*sp]); + fprintf(verbose_file, "%s ", symbol_name[*sp]); - putc('.', verbose_file); + putc('.', verbose_file); - while (*sp >= 0) - { - fprintf(verbose_file, " %s", symbol_name[*sp]); - sp++; - } - fprintf(verbose_file, " (%d)\n", -2 - *sp); + while (*sp >= 0) + { + fprintf(verbose_file, " %s", symbol_name[*sp]); + sp++; + } + fprintf(verbose_file, " (%d)\n", -2 - *sp); } } @@ -203,36 +203,36 @@ print_nulls(int state) nnulls = 0; for (p = parser[state]; p; p = p->next) { - if (p->action_code == REDUCE && - (p->suppressed == 0 || p->suppressed == 1)) - { - i = p->number; - if (rrhs[i] + 1 == rrhs[i+1]) - { - for (j = 0; j < nnulls && i > null_rules[j]; ++j) - continue; + if (p->action_code == REDUCE && + (p->suppressed == 0 || p->suppressed == 1)) + { + i = p->number; + if (rrhs[i] + 1 == rrhs[i+1]) + { + for (j = 0; j < nnulls && i > null_rules[j]; ++j) + continue; - if (j == nnulls) - { - ++nnulls; - null_rules[j] = i; - } - else if (i != null_rules[j]) - { - ++nnulls; - for (k = nnulls - 1; k > j; --k) - null_rules[k] = null_rules[k-1]; - null_rules[j] = i; - } - } - } + if (j == nnulls) + { + ++nnulls; + null_rules[j] = i; + } + else if (i != null_rules[j]) + { + ++nnulls; + for (k = nnulls - 1; k > j; --k) + null_rules[k] = null_rules[k-1]; + null_rules[j] = i; + } + } + } } for (i = 0; i < nnulls; ++i) { - j = null_rules[i]; - fprintf(verbose_file, "\t%s : . (%d)\n", symbol_name[rlhs[j]], - j - 2); + j = null_rules[i]; + fprintf(verbose_file, "\t%s : . (%d)\n", symbol_name[rlhs[j]], + j - 2); } fprintf(verbose_file, "\n"); } @@ -246,21 +246,21 @@ print_actions(int stateno) int as; if (stateno == final_state) - fprintf(verbose_file, "\t$end accept\n"); + fprintf(verbose_file, "\t$end accept\n"); p = parser[stateno]; if (p) { - print_shifts(p); - print_reductions(p, defred[stateno]); + print_shifts(p); + print_reductions(p, defred[stateno]); } sp = shift_table[stateno]; if (sp && sp->nshifts > 0) { - as = accessing_symbol[sp->shift[sp->nshifts - 1]]; - if (ISVAR(as)) - print_gotos(stateno); + as = accessing_symbol[sp->shift[sp->nshifts - 1]]; + if (ISVAR(as)) + print_gotos(stateno); } } @@ -274,18 +274,18 @@ print_shifts(action *p) count = 0; for (q = p; q; q = q->next) { - if (q->suppressed < 2 && q->action_code == SHIFT) - ++count; + if (q->suppressed < 2 && q->action_code == SHIFT) + ++count; } if (count > 0) { - for (; p; p = p->next) - { - if (p->action_code == SHIFT && p->suppressed == 0) - fprintf(verbose_file, "\t%s shift %d\n", - symbol_name[p->symbol], p->number); - } + for (; p; p = p->next) + { + if (p->action_code == SHIFT && p->suppressed == 0) + fprintf(verbose_file, "\t%s shift %d\n", + symbol_name[p->symbol], p->number); + } } } @@ -299,30 +299,30 @@ print_reductions(action *p, int defred) anyreds = 0; for (q = p; q ; q = q->next) { - if (q->action_code == REDUCE && q->suppressed < 2) - { - anyreds = 1; - break; - } + if (q->action_code == REDUCE && q->suppressed < 2) + { + anyreds = 1; + break; + } } if (anyreds == 0) - fprintf(verbose_file, "\t. error\n"); + fprintf(verbose_file, "\t. error\n"); else { - for (; p; p = p->next) - { - if (p->action_code == REDUCE && p->number != defred) - { - k = p->number - 2; - if (p->suppressed == 0) - fprintf(verbose_file, "\t%s reduce %d\n", - symbol_name[p->symbol], k); - } - } + for (; p; p = p->next) + { + if (p->action_code == REDUCE && p->number != defred) + { + k = p->number - 2; + if (p->suppressed == 0) + fprintf(verbose_file, "\t%s reduce %d\n", + symbol_name[p->symbol], k); + } + } if (defred > 0) - fprintf(verbose_file, "\t. reduce %d\n", defred - 2); + fprintf(verbose_file, "\t. reduce %d\n", defred - 2); } } @@ -340,10 +340,10 @@ print_gotos(int stateno) to_state = sp->shift; for (i = 0; i < sp->nshifts; ++i) { - k = to_state[i]; - as = accessing_symbol[k]; - if (ISVAR(as)) - fprintf(verbose_file, "\t%s goto %d\n", symbol_name[as], k); + k = to_state[i]; + as = accessing_symbol[k]; + if (ISVAR(as)) + fprintf(verbose_file, "\t%s goto %d\n", symbol_name[as], k); } } diff --git a/modules/libcom/src/yacc/warshall.c b/modules/libcom/src/yacc/warshall.c index 4477074c5..93a9177e5 100644 --- a/modules/libcom/src/yacc/warshall.c +++ b/modules/libcom/src/yacc/warshall.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include "defs.h" @@ -29,33 +29,33 @@ transitive_closure(unsigned int *R, int n) rowi = R; while (rowi < relend) { - ccol = cword; - rowj = R; + ccol = cword; + rowj = R; - while (rowj < relend) - { - if (*ccol & (1 << i)) - { - rp = rowi; - rend = rowj + rowsize; - while (rowj < rend) - *rowj++ |= *rp++; - } - else - { - rowj += rowsize; - } + while (rowj < relend) + { + if (*ccol & (1 << i)) + { + rp = rowi; + rend = rowj + rowsize; + while (rowj < rend) + *rowj++ |= *rp++; + } + else + { + rowj += rowsize; + } - ccol += rowsize; - } + ccol += rowsize; + } - if (++i >= BITS_PER_WORD) - { - i = 0; - cword++; - } + if (++i >= BITS_PER_WORD) + { + i = 0; + cword++; + } - rowi += rowsize; + rowi += rowsize; } } @@ -76,13 +76,13 @@ reflexive_transitive_closure(unsigned int *R, int n) rp = R; while (rp < relend) { - *rp |= (1 << i); - if (++i >= BITS_PER_WORD) - { - i = 0; - rp++; - } + *rp |= (1 << i); + if (++i >= BITS_PER_WORD) + { + i = 0; + rp++; + } - rp += rowsize; + rp += rowsize; } } diff --git a/modules/libcom/src/yajl/yajl.c b/modules/libcom/src/yajl/yajl.c index 02ca188ac..3fbb87aea 100644 --- a/modules/libcom/src/yajl/yajl.c +++ b/modules/libcom/src/yajl/yajl.c @@ -71,10 +71,10 @@ yajl_alloc(const yajl_callbacks * callbacks, hand->callbacks = callbacks; hand->ctx = ctx; - hand->lexer = NULL; + hand->lexer = NULL; hand->bytesConsumed = 0; hand->decodeBuf = yajl_buf_alloc(&(hand->alloc)); - hand->flags = 0; + hand->flags = 0; yajl_bs_init(hand->stateStack, &(hand->alloc)); yajl_bs_push(hand->stateStack, yajl_state_start); diff --git a/modules/libcom/src/yajl/yajl_buf.c b/modules/libcom/src/yajl/yajl_buf.c index 182db7257..4bd8d741b 100644 --- a/modules/libcom/src/yajl/yajl_buf.c +++ b/modules/libcom/src/yajl/yajl_buf.c @@ -33,7 +33,7 @@ static void yajl_buf_ensure_available(yajl_buf buf, size_t want) { size_t need; - + assert(buf != NULL); /* first call */ diff --git a/modules/libcom/src/yajl/yajl_buf.h b/modules/libcom/src/yajl/yajl_buf.h index 0da2396e1..f0f6fa02d 100644 --- a/modules/libcom/src/yajl/yajl_buf.h +++ b/modules/libcom/src/yajl/yajl_buf.h @@ -22,7 +22,7 @@ /* * Implementation/performance notes. If this were moved to a header - * only implementation using #define's where possible we might be + * only implementation using #define's where possible we might be * able to sqeeze a little performance out of the guy by killing function * call overhead. YMMV. */ diff --git a/modules/libcom/src/yajl/yajl_common.h b/modules/libcom/src/yajl/yajl_common.h index 9fbf8e283..57e2d7eb5 100644 --- a/modules/libcom/src/yajl/yajl_common.h +++ b/modules/libcom/src/yajl/yajl_common.h @@ -24,7 +24,7 @@ #ifdef __cplusplus extern "C" { -#endif +#endif /** \file yajl_common.h * \brief Common routines and macros used by other YAJL APIs. diff --git a/modules/libcom/src/yajl/yajl_encode.c b/modules/libcom/src/yajl/yajl_encode.c index 0aa06a3d6..dfd4af6ac 100644 --- a/modules/libcom/src/yajl/yajl_encode.c +++ b/modules/libcom/src/yajl/yajl_encode.c @@ -87,7 +87,7 @@ static void hexToDigit(unsigned int * val, const unsigned char * hex) } } -static void Utf32toUtf8(unsigned int codepoint, char * utf8Buf) +static void Utf32toUtf8(unsigned int codepoint, char * utf8Buf) { if (codepoint < 0x80) { utf8Buf[0] = (char) codepoint; @@ -117,7 +117,7 @@ void yajl_string_decode(yajl_buf buf, const unsigned char * str, size_t len) { size_t beg = 0; - size_t end = 0; + size_t end = 0; while (end < len) { if (str[end] == '\\') { @@ -144,8 +144,8 @@ void yajl_string_decode(yajl_buf buf, const unsigned char * str, unsigned int surrogate = 0; hexToDigit(&surrogate, str + end + 2); codepoint = - (((codepoint & 0x3F) << 10) | - ((((codepoint >> 6) & 0xF) + 1) << 16) | + (((codepoint & 0x3F) << 10) | + ((((codepoint >> 6) & 0xF) + 1) << 16) | (surrogate & 0x3FF)); end += 5; } else { @@ -153,7 +153,7 @@ void yajl_string_decode(yajl_buf buf, const unsigned char * str, break; } } - + Utf32toUtf8(codepoint, utf8Buf); unescaped = utf8Buf; @@ -183,13 +183,13 @@ int yajl_string_validate_utf8(const unsigned char * s, size_t len) { if (!len) return 1; if (!s) return 0; - + while (len--) { /* single byte */ if (*s <= 0x7f) { /* noop */ } - /* two byte */ + /* two byte */ else if ((*s >> 5) == 0x6) { ADV_PTR; if (!((*s >> 6) == 0x2)) return 0; @@ -201,7 +201,7 @@ int yajl_string_validate_utf8(const unsigned char * s, size_t len) ADV_PTR; if (!((*s >> 6) == 0x2)) return 0; } - /* four byte */ + /* four byte */ else if ((*s >> 3) == 0x1e) { ADV_PTR; if (!((*s >> 6) == 0x2)) return 0; @@ -212,9 +212,9 @@ int yajl_string_validate_utf8(const unsigned char * s, size_t len) } else { return 0; } - + s++; } - + return 1; } diff --git a/modules/libcom/src/yajl/yajl_gen.c b/modules/libcom/src/yajl/yajl_gen.c index 0727e9fc1..a40b9760a 100644 --- a/modules/libcom/src/yajl/yajl_gen.c +++ b/modules/libcom/src/yajl/yajl_gen.c @@ -139,7 +139,7 @@ yajl_gen_free(yajl_gen g) } else if (g->state[g->depth] == yajl_gen_map_val) { \ g->print(g->ctx, ":", 1); \ if ((g->flags & yajl_gen_beautify)) g->print(g->ctx, " ", 1); \ - } + } #define INSERT_WHITESPACE \ if ((g->flags & yajl_gen_beautify)) { \ @@ -212,7 +212,7 @@ yajl_gen_status yajl_gen_double(yajl_gen g, double number) { char i[32]; - ENSURE_VALID_STATE; ENSURE_NOT_KEY; + ENSURE_VALID_STATE; ENSURE_NOT_KEY; if (isnan(number) || isinf(number)) return yajl_gen_invalid_number; INSERT_SEP; INSERT_WHITESPACE; sprintf(i, "%.20g", number); @@ -268,7 +268,7 @@ yajl_gen_bool(yajl_gen g, int boolean) { const char * val = boolean ? "true" : "false"; - ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE; + ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE; g->print(g->ctx, val, (unsigned int)strlen(val)); APPENDED_ATOM; FINAL_NEWLINE; @@ -279,8 +279,8 @@ yajl_gen_status yajl_gen_map_open(yajl_gen g) { ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE; - INCREMENT_DEPTH; - + INCREMENT_DEPTH; + g->state[g->depth] = yajl_gen_map_start; g->print(g->ctx, "{", 1); if ((g->flags & yajl_gen_beautify)) g->print(g->ctx, "\n", 1); @@ -291,9 +291,9 @@ yajl_gen_map_open(yajl_gen g) yajl_gen_status yajl_gen_map_close(yajl_gen g) { - ENSURE_VALID_STATE; + ENSURE_VALID_STATE; DECREMENT_DEPTH; - + if ((g->flags & yajl_gen_beautify)) g->print(g->ctx, "\n", 1); APPENDED_ATOM; INSERT_WHITESPACE; @@ -306,7 +306,7 @@ yajl_gen_status yajl_gen_array_open(yajl_gen g) { ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE; - INCREMENT_DEPTH; + INCREMENT_DEPTH; g->state[g->depth] = yajl_gen_array_start; g->print(g->ctx, "[", 1); if ((g->flags & yajl_gen_beautify)) g->print(g->ctx, "\n", 1); diff --git a/modules/libcom/src/yajl/yajl_gen.h b/modules/libcom/src/yajl/yajl_gen.h index 233f7d141..e4a2c87a3 100644 --- a/modules/libcom/src/yajl/yajl_gen.h +++ b/modules/libcom/src/yajl/yajl_gen.h @@ -42,7 +42,7 @@ extern "C" { * state */ yajl_gen_in_error_state, /** A complete JSON document has been generated */ - yajl_gen_generation_complete, + yajl_gen_generation_complete, /** yajl_gen_double() was passed an invalid floating point value * (infinity or NaN). */ yajl_gen_invalid_number, @@ -163,6 +163,6 @@ extern "C" { #ifdef __cplusplus } -#endif +#endif #endif diff --git a/modules/libcom/src/yajl/yajl_lex.c b/modules/libcom/src/yajl/yajl_lex.c index b911da678..e0cc3b539 100644 --- a/modules/libcom/src/yajl/yajl_lex.c +++ b/modules/libcom/src/yajl/yajl_lex.c @@ -24,7 +24,7 @@ #ifdef YAJL_LEXER_DEBUG static const char * -tokToStr(yajl_tok tok) +tokToStr(yajl_tok tok) { switch (tok) { case yajl_tok_bool: return "bool"; @@ -53,13 +53,13 @@ tokToStr(yajl_tok tok) * the network or disk). This makes the lexer more complex. The * responsibility of the lexer is to handle transparently the case where * a chunk boundary falls in the middle of a token. This is - * accomplished is via a buffer and a character reading abstraction. + * accomplished is via a buffer and a character reading abstraction. * * Overview of implementation * * When we lex to end of input string before end of token is hit, we * copy all of the input text composing the token into our lexBuf. - * + * * Every time we read a character, we do so through the readChar function. * readChar's responsibility is to handle pulling all chars from the buffer * before pulling chars from input text @@ -74,7 +74,7 @@ struct yajl_lexer_t { yajl_lex_error error; /* a input buffer to handle the case where a token is spread over - * multiple chunks */ + * multiple chunks */ yajl_buf buf; /* in the case where we have data in the lexBuf, bufOff holds @@ -190,7 +190,7 @@ static const char charLookupTable[256] = * yajl_tok_eof - if end of input was hit before validation could * complete * yajl_tok_error - if invalid utf8 was encountered - * + * * NOTE: on error the offset will point to the first char of the * invalid utf8 */ #define UTF8_CHECK_EOF if (*offset >= jsonTextLen) { return yajl_tok_eof; } @@ -204,7 +204,7 @@ yajl_lex_utf8_char(yajl_lexer lexer, const unsigned char * jsonText, /* single byte */ return yajl_tok_string; } else if ((curChar >> 5) == 0x6) { - /* two byte */ + /* two byte */ UTF8_CHECK_EOF; curChar = readChar(lexer, jsonText, offset); if ((curChar >> 6) == 0x2) return yajl_tok_string; @@ -230,7 +230,7 @@ yajl_lex_utf8_char(yajl_lexer lexer, const unsigned char * jsonText, if ((curChar >> 6) == 0x2) return yajl_tok_string; } } - } + } return yajl_tok_error; } @@ -283,7 +283,7 @@ yajl_lex_string(yajl_lexer lexer, const unsigned char * jsonText, { const unsigned char * p; size_t len; - + if ((lexer->bufInUse && yajl_buf_len(lexer->buf) && lexer->bufOff < yajl_buf_len(lexer->buf))) { @@ -291,8 +291,8 @@ yajl_lex_string(yajl_lexer lexer, const unsigned char * jsonText, (lexer->bufOff)); len = yajl_buf_len(lexer->buf) - lexer->bufOff; lexer->bufOff += yajl_string_scan(p, len, lexer->validateUTF8); - } - else if (*offset < jsonTextLen) + } + else if (*offset < jsonTextLen) { p = jsonText + *offset; len = jsonTextLen - *offset; @@ -320,8 +320,8 @@ yajl_lex_string(yajl_lexer lexer, const unsigned char * jsonText, unsigned int i = 0; for (i=0;i<4;i++) { - STR_CHECK_EOF; - curChar = readChar(lexer, jsonText, offset); + STR_CHECK_EOF; + curChar = readChar(lexer, jsonText, offset); if (!(charLookupTable[curChar] & VHC)) { /* back up to offending char */ unreadChar(lexer, offset); @@ -333,8 +333,8 @@ yajl_lex_string(yajl_lexer lexer, const unsigned char * jsonText, /* back up to offending char */ unreadChar(lexer, offset); lexer->error = yajl_lex_string_invalid_escaped_char; - goto finish_string_lex; - } + goto finish_string_lex; + } } /* when not validating UTF8 it's a simple table lookup to determine * if the present character is invalid */ @@ -342,29 +342,29 @@ yajl_lex_string(yajl_lexer lexer, const unsigned char * jsonText, /* back up to offending char */ unreadChar(lexer, offset); lexer->error = yajl_lex_string_invalid_json_char; - goto finish_string_lex; + goto finish_string_lex; } /* when in validate UTF8 mode we need to do some extra work */ else if (lexer->validateUTF8) { yajl_tok t = yajl_lex_utf8_char(lexer, jsonText, jsonTextLen, offset, curChar); - + if (t == yajl_tok_eof) { tok = yajl_tok_eof; goto finish_string_lex; } else if (t == yajl_tok_error) { lexer->error = yajl_lex_string_invalid_utf8; goto finish_string_lex; - } + } } - /* accept it, and move on */ + /* accept it, and move on */ } finish_string_lex: /* tell our buddy, the parser, wether he needs to process this string * again */ if (hasEscapes && tok == yajl_tok_string) { tok = yajl_tok_string_with_escapes; - } + } return tok; } @@ -383,23 +383,23 @@ yajl_lex_number(yajl_lexer lexer, const unsigned char * jsonText, yajl_tok tok = yajl_tok_integer; - RETURN_IF_EOF; + RETURN_IF_EOF; c = readChar(lexer, jsonText, offset); /* optional leading minus */ if (c == '-') { - RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); + RETURN_IF_EOF; + c = readChar(lexer, jsonText, offset); } /* a single zero, or a series of integers */ if (c == '0') { - RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); + RETURN_IF_EOF; + c = readChar(lexer, jsonText, offset); } else if (c >= '1' && c <= '9') { do { - RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); + RETURN_IF_EOF; + c = readChar(lexer, jsonText, offset); } while (c >= '0' && c <= '9'); } else { unreadChar(lexer, offset); @@ -410,15 +410,15 @@ yajl_lex_number(yajl_lexer lexer, const unsigned char * jsonText, /* optional fraction (indicates this is floating point) */ if (c == '.') { int numRd = 0; - + RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); + c = readChar(lexer, jsonText, offset); while (c >= '0' && c <= '9') { numRd++; RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); - } + c = readChar(lexer, jsonText, offset); + } if (!numRd) { unreadChar(lexer, offset); @@ -431,18 +431,18 @@ yajl_lex_number(yajl_lexer lexer, const unsigned char * jsonText, /* optional exponent (indicates this is floating point) */ if (c == 'e' || c == 'E') { RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); + c = readChar(lexer, jsonText, offset); /* optional sign */ if (c == '+' || c == '-') { RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); + c = readChar(lexer, jsonText, offset); } if (c >= '0' && c <= '9') { do { RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); + c = readChar(lexer, jsonText, offset); } while (c >= '0' && c <= '9'); } else { unreadChar(lexer, offset); @@ -451,10 +451,10 @@ yajl_lex_number(yajl_lexer lexer, const unsigned char * jsonText, } tok = yajl_tok_double; } - + /* we always go "one too far" */ unreadChar(lexer, offset); - + return tok; } @@ -466,24 +466,24 @@ yajl_lex_comment(yajl_lexer lexer, const unsigned char * jsonText, yajl_tok tok = yajl_tok_comment; - RETURN_IF_EOF; + RETURN_IF_EOF; c = readChar(lexer, jsonText, offset); /* either slash or star expected */ if (c == '/') { /* now we throw away until end of line */ do { - RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); + RETURN_IF_EOF; + c = readChar(lexer, jsonText, offset); } while (c != '\n'); } else if (c == '*') { - /* now we throw away until end of comment */ + /* now we throw away until end of comment */ for (;;) { - RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); + RETURN_IF_EOF; + c = readChar(lexer, jsonText, offset); if (c == '*') { - RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); + RETURN_IF_EOF; + c = readChar(lexer, jsonText, offset); if (c == '/') { break; } else { @@ -495,7 +495,7 @@ yajl_lex_comment(yajl_lexer lexer, const unsigned char * jsonText, lexer->error = yajl_lex_invalid_char; tok = yajl_tok_error; } - + return tok; } @@ -603,7 +603,7 @@ yajl_lex_lex(yajl_lexer lexer, const unsigned char * jsonText, goto lexed; } case '-': - case '0': case '1': case '2': case '3': case '4': + case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { /* integer parsing wants to start from the beginning */ unreadChar(lexer, offset); @@ -630,11 +630,11 @@ yajl_lex_lex(yajl_lexer lexer, const unsigned char * jsonText, jsonTextLen, offset); if (tok == yajl_tok_comment) { /* "error" is silly, but that's the initial - * state of tok. guilty until proven innocent. */ + * state of tok. guilty until proven innocent. */ tok = yajl_tok_error; yajl_buf_clear(lexer->buf); lexer->bufInUse = 0; - startOffset = *offset; + startOffset = *offset; break; } /* hit error or eof, bail */ @@ -655,7 +655,7 @@ yajl_lex_lex(yajl_lexer lexer, const unsigned char * jsonText, lexer->bufInUse = 1; yajl_buf_append(lexer->buf, jsonText + startOffset, *offset - startOffset); lexer->bufOff = 0; - + if (tok != yajl_tok_eof) { *outBuf = yajl_buf_data(lexer->buf); *outLen = yajl_buf_len(lexer->buf); @@ -671,7 +671,7 @@ yajl_lex_lex(yajl_lexer lexer, const unsigned char * jsonText, { assert(*outLen >= 2); (*outBuf)++; - *outLen -= 2; + *outLen -= 2; } @@ -702,7 +702,7 @@ yajl_lex_error_to_string(yajl_lex_error error) case yajl_lex_string_invalid_escaped_char: return "inside a string, '\\' occurs before a character " "which it may not."; - case yajl_lex_string_invalid_json_char: + case yajl_lex_string_invalid_json_char: return "invalid character inside string."; case yajl_lex_string_invalid_hex_char: return "invalid (non-hex) character occurs after '\\u' inside " @@ -755,13 +755,13 @@ yajl_tok yajl_lex_peek(yajl_lexer lexer, const unsigned char * jsonText, size_t bufOff = lexer->bufOff; unsigned int bufInUse = lexer->bufInUse; yajl_tok tok; - + tok = yajl_lex_lex(lexer, jsonText, jsonTextLen, &offset, &outBuf, &outLen); lexer->bufOff = bufOff; lexer->bufInUse = bufInUse; yajl_buf_truncate(lexer->buf, bufLen); - + return tok; } diff --git a/modules/libcom/src/yajl/yajl_lex.h b/modules/libcom/src/yajl/yajl_lex.h index 7a79cd4a1..806ea1de0 100644 --- a/modules/libcom/src/yajl/yajl_lex.h +++ b/modules/libcom/src/yajl/yajl_lex.h @@ -20,21 +20,21 @@ #include "yajl_common.h" typedef enum { - yajl_tok_bool, + yajl_tok_bool, yajl_tok_colon, - yajl_tok_comma, + yajl_tok_comma, yajl_tok_eof, yajl_tok_error, - yajl_tok_left_brace, + yajl_tok_left_brace, yajl_tok_left_bracket, - yajl_tok_null, - yajl_tok_right_brace, + yajl_tok_null, + yajl_tok_right_brace, yajl_tok_right_bracket, /* we differentiate between integers and doubles to allow the * parser to interpret the number without re-scanning */ - yajl_tok_integer, - yajl_tok_double, + yajl_tok_integer, + yajl_tok_double, /* we differentiate between strings which require further processing, * and strings that do not */ @@ -69,7 +69,7 @@ n * error messages. * * When you pass the next chunk of data, context should be reinitialized * to zero. - * + * * Finally, the output buffer is usually just a pointer into the jsonText, * however in cases where the entity being lexed spans multiple chunks, * the lexer will buffer the entity and the data returned will be diff --git a/modules/libcom/src/yajl/yajl_parse.h b/modules/libcom/src/yajl/yajl_parse.h index 663a3a864..e5b565c80 100644 --- a/modules/libcom/src/yajl/yajl_parse.h +++ b/modules/libcom/src/yajl/yajl_parse.h @@ -98,7 +98,7 @@ extern "C" { * are encountered in the input text. May be NULL, * which is only useful for validation. * \param afs memory allocation functions, may be NULL for to use - * C runtime library routines (malloc and friends) + * C runtime library routines (malloc and friends) * \param ctx a context pointer that will be passed to callbacks. */ YAJL_API yajl_handle yajl_alloc(const yajl_callbacks * callbacks, diff --git a/modules/libcom/test/blockingSockTest.cpp b/modules/libcom/test/blockingSockTest.cpp index 1a16bb9e6..be2dcc4d3 100644 --- a/modules/libcom/test/blockingSockTest.cpp +++ b/modules/libcom/test/blockingSockTest.cpp @@ -69,9 +69,9 @@ protected: }; circuit::circuit ( SOCKET sockIn ) : - sock ( sockIn ), + sock ( sockIn ), id ( 0 ), - recvWakeup ( false ), + recvWakeup ( false ), sendWakeup ( false ) { testOk ( this->sock != INVALID_SOCKET, "Socket valid" ); @@ -102,7 +102,7 @@ void circuit::recvTest () { char buf [1]; while ( true ) { - int status = recv ( this->sock, + int status = recv ( this->sock, buf, (int) sizeof ( buf ), 0 ); if ( status == 0 ) { testDiag ( "%s was disconnected", this->pName () ); @@ -114,7 +114,7 @@ void circuit::recvTest () } else { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); testDiag ( "%s socket recv() error was \"%s\"", this->pName (), sockErrBuf ); @@ -134,14 +134,14 @@ clientCircuit::clientCircuit ( const address & addrIn ) : circuit ( epicsSocketCreate ( AF_INET, SOCK_STREAM, IPPROTO_TCP ) ) { address tmpAddr = addrIn; - int status = ::connect ( + int status = ::connect ( this->sock, & tmpAddr.sa, sizeof ( tmpAddr ) ); testOk ( status == 0, "Client end connected" ); circuit * pCir = this; - this->id = epicsThreadCreate ( - "client circuit", epicsThreadPriorityMedium, - epicsThreadGetStackSize(epicsThreadStackMedium), + this->id = epicsThreadCreate ( + "client circuit", epicsThreadPriorityMedium, + epicsThreadGetStackSize(epicsThreadStackMedium), socketRecvTest, pCir ); testOk ( this->id != 0, "Client thread created" ); } @@ -179,9 +179,9 @@ server::server ( const address & addrIn ) : void server::start () { - this->id = epicsThreadCreate ( - "server daemon", epicsThreadPriorityMedium, - epicsThreadGetStackSize(epicsThreadStackMedium), + this->id = epicsThreadCreate ( + "server daemon", epicsThreadPriorityMedium, + epicsThreadGetStackSize(epicsThreadStackMedium), serverDaemon, this ); testOk ( this->id != 0, "Server thread created" ); } @@ -192,7 +192,7 @@ void server::daemon () // accept client side address addr; osiSocklen_t addressSize = sizeof ( addr ); - SOCKET ns = accept ( this->sock, + SOCKET ns = accept ( this->sock, & addr.sa, & addressSize ); if ( this->exit ) break; @@ -256,7 +256,7 @@ MAIN(blockingSockTest) address addr; memset ( (char *) & addr, 0, sizeof ( addr ) ); addr.ia.sin_family = AF_INET; - addr.ia.sin_addr.s_addr = htonl ( INADDR_LOOPBACK ); + addr.ia.sin_addr.s_addr = htonl ( INADDR_LOOPBACK ); addr.ia.sin_port = 0; server srv ( addr ); diff --git a/modules/libcom/test/epicsAlgorithmTest.cpp b/modules/libcom/test/epicsAlgorithmTest.cpp index fa8c0c03f..ac1985b3b 100644 --- a/modules/libcom/test/epicsAlgorithmTest.cpp +++ b/modules/libcom/test/epicsAlgorithmTest.cpp @@ -7,7 +7,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ // epicsAlgorithmTest.cpp -// Authors: Jeff Hill & Andrew Johnson +// Authors: Jeff Hill & Andrew Johnson #include "epicsUnitTest.h" #include "epicsAlgorithm.h" @@ -17,47 +17,47 @@ MAIN(epicsAlgorithm) { testPlan(22); - + float f1 = 3.3f; float f2 = 3.4f; float Inf = epicsINF; float NaN = epicsNAN; - + testOk(epicsMin(f1, f2) == f1, "epicsMin(f1, f2)"); testOk(epicsMin(f1, -Inf) == -Inf, "epicsMin(f1, -Inf)"); testOk(isnan(epicsMin(f1, NaN)), "epicsMin(f1, NaN)"); testOk(epicsMin(f1, Inf) == f1, "epicsMin(f1, Inf)"); - + testOk(epicsMin(f2, f1) == f1, "epicsMin(f2, f1)"); testOk(epicsMin(-Inf, f1) == -Inf, "epicsMin(-Inf, f1)"); testOk(isnan(epicsMin(NaN, f1)), "epicsMin(NaN, f1)"); testOk(epicsMin(Inf, f1) == f1, "epicsMin(Inf, f1)"); - + testOk(epicsMax(f2, f1) == f2, "epicsMax(f2, f1)"); testOk(epicsMax(-Inf, f1) == f1, "epicsMax(-Inf, f1)"); testOk(isnan(epicsMax(NaN, f1)), "epicsMax(NaN, f1)"); testOk(epicsMax(Inf, f1) == Inf, "epicsMax(Inf, f1)"); - + testOk(epicsMax(f1, f2) == f2, "epicsMax(f1, f2)"); testOk(epicsMax(f1, -Inf) == f1, "epicsMax(f1, -Inf)"); testOk(isnan(epicsMax(f1, NaN)), "epicsMax(f1, NaN)"); testOk(epicsMax(f1, Inf) == Inf, "epicsMax(f1, Inf)"); - + epicsSwap(f1, f2); testOk(f1==3.4f && f2==3.3f, "epicsSwap(f1, f2)"); - + int i1 = 3; int i2 = 4; - + testOk(epicsMin(i1, i2) == i1, "epicsMin(i1,i2)"); testOk(epicsMin(i2, i1) == i1, "epicsMin(i2,i1)"); - + testOk(epicsMax(i1, i2) == i2, "epicsMax(i1,i2)"); testOk(epicsMax(i2, i1) == i2, "epicsMax(i2,i1)"); - + epicsSwap(i1, i2); testOk(i1 == 4 && i2 == 3, "epicsSwap(i1, i2)"); - + return testDone(); } diff --git a/modules/libcom/test/epicsAtomicPerform.cpp b/modules/libcom/test/epicsAtomicPerform.cpp index 98eaf1778..9062e9748 100644 --- a/modules/libcom/test/epicsAtomicPerform.cpp +++ b/modules/libcom/test/epicsAtomicPerform.cpp @@ -11,7 +11,7 @@ #include "testMain.h" using std :: size_t; -using namespace epics; +using namespace epics; using namespace atomic; class RefCtr { @@ -36,59 +36,59 @@ private: static RefCtr m_noOwnership; }; -inline RefCtr :: RefCtr () +inline RefCtr :: RefCtr () { epicsAtomicSetSizeT ( & m_cnt, 0 ); } -inline RefCtr :: ~RefCtr () -{ +inline RefCtr :: ~RefCtr () +{ unsigned cnt = epicsAtomicGetSizeT ( & m_cnt ); - assert ( cnt == 0u ); + assert ( cnt == 0u ); } -inline void RefCtr :: reference () -{ - epicsAtomicIncrSizeT ( & m_cnt ); +inline void RefCtr :: reference () +{ + epicsAtomicIncrSizeT ( & m_cnt ); } -inline void RefCtr :: unreference () -{ - epicsAtomicDecrSizeT ( & m_cnt ); +inline void RefCtr :: unreference () +{ + epicsAtomicDecrSizeT ( & m_cnt ); } RefCtr Ownership :: m_noOwnership; -inline Ownership :: Ownership () : - _pRefCtr ( & m_noOwnership ) +inline Ownership :: Ownership () : + _pRefCtr ( & m_noOwnership ) { m_noOwnership.reference (); } -inline Ownership :: Ownership ( RefCtr & refCtr ) : - _pRefCtr ( & refCtr ) -{ - refCtr.reference (); -} +inline Ownership :: Ownership ( RefCtr & refCtr ) : + _pRefCtr ( & refCtr ) +{ + refCtr.reference (); +} -inline Ownership :: Ownership ( const Ownership & ownership ) : - _pRefCtr ( ownership._pRefCtr ) -{ - _pRefCtr->reference (); -} +inline Ownership :: Ownership ( const Ownership & ownership ) : + _pRefCtr ( ownership._pRefCtr ) +{ + _pRefCtr->reference (); +} -inline Ownership :: ~Ownership () -{ - _pRefCtr->unreference (); -} +inline Ownership :: ~Ownership () +{ + _pRefCtr->unreference (); +} inline Ownership & Ownership :: operator = ( const Ownership & ownership ) { RefCtr * const pOldRefCtr = _pRefCtr; _pRefCtr = ownership._pRefCtr; - _pRefCtr->reference (); - pOldRefCtr->unreference (); + _pRefCtr->reference (); + pOldRefCtr->unreference (); return *this; } @@ -99,46 +99,46 @@ inline Ownership retOwnership ( const Ownership & ownership ) inline Ownership recurRetOwner10 ( const Ownership & ownershipIn ) { - Ownership ownership = - retOwnership ( - retOwnership ( - retOwnership ( - retOwnership ( + Ownership ownership = + retOwnership ( + retOwnership ( + retOwnership ( + retOwnership ( retOwnership ( ownershipIn ) ) ) ) ); - return retOwnership ( - retOwnership ( - retOwnership ( - retOwnership ( + return retOwnership ( + retOwnership ( + retOwnership ( + retOwnership ( retOwnership ( ownership ) ) ) ) ); } inline Ownership recurRetOwner100 ( const Ownership & ownershipIn ) { - Ownership ownership = - recurRetOwner10 ( - recurRetOwner10 ( - recurRetOwner10 ( - recurRetOwner10 ( + Ownership ownership = + recurRetOwner10 ( + recurRetOwner10 ( + recurRetOwner10 ( + recurRetOwner10 ( recurRetOwner10 ( ownershipIn ) ) ) ) ); - return recurRetOwner10 ( - recurRetOwner10 ( - recurRetOwner10 ( - recurRetOwner10 ( + return recurRetOwner10 ( + recurRetOwner10 ( + recurRetOwner10 ( + recurRetOwner10 ( recurRetOwner10 ( ownership ) ) ) ) ); } inline Ownership recurRetOwner1000 ( const Ownership & ownershipIn ) { - Ownership ownership = - recurRetOwner100 ( - recurRetOwner100 ( - recurRetOwner100 ( - recurRetOwner100 ( - recurRetOwner100 ( ownershipIn ) ) ) ) ); - return recurRetOwner100 ( - recurRetOwner100 ( + Ownership ownership = + recurRetOwner100 ( recurRetOwner100 ( - recurRetOwner100 ( + recurRetOwner100 ( + recurRetOwner100 ( + recurRetOwner100 ( ownershipIn ) ) ) ) ); + return recurRetOwner100 ( + recurRetOwner100 ( + recurRetOwner100 ( + recurRetOwner100 ( recurRetOwner100 ( ownership ) ) ) ) ); } @@ -155,13 +155,13 @@ inline void passRefOwnership10 ( const Ownership & ownershipIn, Ownership & owne passRefOwnership ( ownershipTmp0, ownershipTmp1 ); Ownership ownershipTmp2; passRefOwnership ( ownershipTmp1, ownershipTmp2 ); - Ownership ownershipTmp3; + Ownership ownershipTmp3; passRefOwnership ( ownershipTmp2, ownershipTmp3 ); Ownership ownershipTmp4; passRefOwnership ( ownershipTmp3, ownershipTmp4 ); Ownership ownershipTmp5; passRefOwnership ( ownershipTmp4, ownershipTmp5 ); - Ownership ownershipTmp6; + Ownership ownershipTmp6; passRefOwnership ( ownershipTmp5, ownershipTmp6 ); Ownership ownershipTmp7; passRefOwnership ( ownershipTmp6, ownershipTmp7 ); @@ -178,13 +178,13 @@ inline void passRefOwnership100 ( const Ownership & ownershipIn, Ownership & own passRefOwnership10 ( ownershipTmp0, ownershipTmp1 ); Ownership ownershipTmp2; passRefOwnership10 ( ownershipTmp1, ownershipTmp2 ); - Ownership ownershipTmp3; + Ownership ownershipTmp3; passRefOwnership10 ( ownershipTmp2, ownershipTmp3 ); Ownership ownershipTmp4; passRefOwnership10 ( ownershipTmp3, ownershipTmp4 ); Ownership ownershipTmp5; passRefOwnership10 ( ownershipTmp4, ownershipTmp5 ); - Ownership ownershipTmp6; + Ownership ownershipTmp6; passRefOwnership10 ( ownershipTmp5, ownershipTmp6 ); Ownership ownershipTmp7; passRefOwnership10 ( ownershipTmp6, ownershipTmp7 ); @@ -201,13 +201,13 @@ inline void passRefOwnership1000 ( const Ownership & ownershipIn, Ownership & ow passRefOwnership100 ( ownershipTmp0, ownershipTmp1 ); Ownership ownershipTmp2; passRefOwnership100 ( ownershipTmp1, ownershipTmp2 ); - Ownership ownershipTmp3; + Ownership ownershipTmp3; passRefOwnership100 ( ownershipTmp2, ownershipTmp3 ); Ownership ownershipTmp4; passRefOwnership100 ( ownershipTmp3, ownershipTmp4 ); Ownership ownershipTmp5; passRefOwnership100 ( ownershipTmp4, ownershipTmp5 ); - Ownership ownershipTmp6; + Ownership ownershipTmp6; passRefOwnership100 ( ownershipTmp5, ownershipTmp6 ); Ownership ownershipTmp7; passRefOwnership100 ( ownershipTmp6, ownershipTmp7 ); @@ -224,14 +224,14 @@ public: OrdinaryIncr () : m_target ( 0 ) {} void run (); void diagnostic ( double delay ); -private: +private: T m_target; }; -// tests the time it takes to perform a call to an external -// function and also increment an integer word. The -// epicsInterruptIsInterruptContext function is an -// out-of-line function implemented in a sharable library +// tests the time it takes to perform a call to an external +// function and also increment an integer word. The +// epicsInterruptIsInterruptContext function is an +// out-of-line function implemented in a sharable library // so hopefully it wont be optimized away. template < class T > inline void OrdinaryIncr < T > :: run () @@ -254,7 +254,7 @@ void OrdinaryIncr < T > :: diagnostic ( double delay ) delay /= 10.0; delay *= 1e6; const char * const pName = typeid ( T ) . name (); - testDiag ( "raw incr of \"%s\" and a NOOP function call takes %f microseconds", + testDiag ( "raw incr of \"%s\" and a NOOP function call takes %f microseconds", pName, delay ); } @@ -264,7 +264,7 @@ public: AtomicIncr () : m_target ( 0 ) {} void run (); void diagnostic ( double delay ); -private: +private: T m_target; }; @@ -289,7 +289,7 @@ void AtomicIncr < T > :: diagnostic ( double delay ) delay /= 10.0; delay *= 1e6; const char * const pName = typeid ( T ) . name (); - testDiag ( "epicsAtomicIncr \"%s\" takes %f microseconds", + testDiag ( "epicsAtomicIncr \"%s\" takes %f microseconds", pName, delay ); } @@ -303,7 +303,7 @@ inline int trueValue < int > () { return 1; } template <> inline int falseValue < int > () { return 0; } -// size_t +// size_t template <> inline size_t trueValue < size_t > () { return 1u; } @@ -312,11 +312,11 @@ inline size_t falseValue < size_t > () { return 0u; } // EpicsAtomicPtrT template <> -inline EpicsAtomicPtrT trueValue < EpicsAtomicPtrT > () +inline EpicsAtomicPtrT trueValue < EpicsAtomicPtrT > () { static char c; return & c; } template <> -inline EpicsAtomicPtrT falseValue < EpicsAtomicPtrT > () +inline EpicsAtomicPtrT falseValue < EpicsAtomicPtrT > () { return 0u; } template < class T > @@ -325,7 +325,7 @@ public: AtomicCmpAndSwap () : m_target ( 0 ) {} void run (); void diagnostic ( double delay ); -private: +private: T m_target; }; @@ -350,7 +350,7 @@ void AtomicCmpAndSwap < T > :: diagnostic ( double delay ) delay /= 10.0; delay *= 1e6; const char * const pName = typeid ( T ) . name (); - testDiag ( "epicsAtomicCmpAndSwap of \"%s\" takes %f microseconds", + testDiag ( "epicsAtomicCmpAndSwap of \"%s\" takes %f microseconds", pName, delay ); } @@ -360,7 +360,7 @@ public: AtomicSet () : m_target ( 0 ) {} void run (); void diagnostic ( double delay ); -private: +private: T m_target; }; @@ -385,8 +385,8 @@ void AtomicSet < T > :: diagnostic ( double delay ) delay /= 10.0; delay *= 1e6; const char * const pName = typeid ( T ) . name (); - testDiag ( "epicsAtomicSet of \"%s\" takes %f microseconds", - pName, delay ); + testDiag ( "epicsAtomicSet of \"%s\" takes %f microseconds", + pName, delay ); } static const unsigned N = 10000; @@ -421,7 +421,7 @@ void ownershipPassRefPerformance () } template < class T > -class Ten +class Ten { public: void run (); @@ -475,7 +475,7 @@ void measurePerformance () target.diagnostic ( delay ); } -template < class T > +template < class T > void measure () { measurePerformance < typename Ten < T > :: Hundred > (); diff --git a/modules/libcom/test/epicsAtomicTest.cpp b/modules/libcom/test/epicsAtomicTest.cpp index fd9fc2e6b..a06e7ffb0 100644 --- a/modules/libcom/test/epicsAtomicTest.cpp +++ b/modules/libcom/test/epicsAtomicTest.cpp @@ -27,8 +27,8 @@ template < class T > static void incr ( void *arg ) { using epics::atomic::increment; - TestDataIncrDecr < T > * const pTestData = - reinterpret_cast < TestDataIncrDecr < T > * > ( arg ); + TestDataIncrDecr < T > * const pTestData = + reinterpret_cast < TestDataIncrDecr < T > * > ( arg ); increment ( pTestData->m_testValue ); increment ( pTestData->m_testIterations ); } @@ -38,8 +38,8 @@ static void decr ( void *arg ) { using epics::atomic::decrement; using epics::atomic::increment; - TestDataIncrDecr < T > * const pTestData = - reinterpret_cast < TestDataIncrDecr < T > * > ( arg ); + TestDataIncrDecr < T > * const pTestData = + reinterpret_cast < TestDataIncrDecr < T > * > ( arg ); decrement ( pTestData->m_testValue ); increment ( pTestData->m_testIterations ); } @@ -50,8 +50,8 @@ static void add ( void *arg ) { using epics::atomic::add; using epics::atomic::increment; - TestDataAddSub < T > * const pTestData = - reinterpret_cast < TestDataAddSub < T > * > ( arg ); + TestDataAddSub < T > * const pTestData = + reinterpret_cast < TestDataAddSub < T > * > ( arg ); add ( pTestData->m_testValue, TestDataAddSub < T > :: delta ); increment ( pTestData->m_testIterations ); } @@ -61,8 +61,8 @@ static void sub ( void *arg ) { using epics::atomic::subtract; using epics::atomic::increment; - TestDataAddSub < T > * const pTestData = - reinterpret_cast < TestDataAddSub < T > * > ( arg ); + TestDataAddSub < T > * const pTestData = + reinterpret_cast < TestDataAddSub < T > * > ( arg ); subtract ( pTestData->m_testValue, TestDataAddSub < T > :: delta ); increment ( pTestData->m_testIterations ); } @@ -86,7 +86,7 @@ inline int trueValue < int > () { return 1; } template <> inline int falseValue < int > () { return 0; } -// size_t +// size_t template <> inline size_t trueValue < size_t > () { return 1u; } @@ -95,11 +95,11 @@ inline size_t falseValue < size_t > () { return 0u; } // EpicsAtomicPtrT template <> -inline EpicsAtomicPtrT trueValue < EpicsAtomicPtrT > () +inline EpicsAtomicPtrT trueValue < EpicsAtomicPtrT > () { static char c; return & c; } template <> -inline EpicsAtomicPtrT falseValue < EpicsAtomicPtrT > () +inline EpicsAtomicPtrT falseValue < EpicsAtomicPtrT > () { return 0u; } template < class T > @@ -110,15 +110,15 @@ static void cas ( void *arg ) using epics::atomic::decrement; using epics::atomic::compareAndSwap; - TestDataCAS < T > * const pTestData = - reinterpret_cast < TestDataCAS < T > * > ( arg ); + TestDataCAS < T > * const pTestData = + reinterpret_cast < TestDataCAS < T > * > ( arg ); /* * intentionally waste cpu and maximize * contention for the shared data */ increment ( pTestData->m_testIterationsNotSet ); - while ( ! compareAndSwap ( pTestData->m_testValue, - falseValue < T > (), + while ( ! compareAndSwap ( pTestData->m_testValue, + falseValue < T > (), trueValue < T > () ) ) { } decrement ( pTestData->m_testIterationsNotSet ); @@ -135,21 +135,21 @@ void testIncrDecr () static const size_t N = 90; static const T NT = static_cast < T > ( N ); - const unsigned int stackSize = + const unsigned int stackSize = epicsThreadGetStackSize ( epicsThreadStackSmall ); TestDataIncrDecr < T > testData = { 0, N }; set ( testData.m_testValue, NT ); testOk ( get ( testData.m_testValue ) == NT, - "get returns initial incr/decr test data value that was set" ); + "get returns initial incr/decr test data value that was set" ); set ( testData.m_testIterations, 0u ); testOk ( get ( testData.m_testIterations ) == 0u, - "get returns initial incr/decr test thread iterations value that was set" ); + "get returns initial incr/decr test thread iterations value that was set" ); for ( size_t i = 0u; i < N; i++ ) { epicsThreadMustCreate ( "incr", - 50, stackSize, incr < T >, & testData ); + 50, stackSize, incr < T >, & testData ); epicsThreadMustCreate ( "decr", - 50, stackSize, decr < T >, & testData ); + 50, stackSize, decr < T >, & testData ); if(i%10==0) testDiag("iteration %u", (unsigned)i); } @@ -157,9 +157,9 @@ void testIncrDecr () epicsThreadSleep ( 0.01 ); } testOk ( get ( testData.m_testIterations ) == 2 * N, - "proper number of incr/decr test thread iterations" ); - testOk ( get ( testData.m_testValue ) == NT, - "proper final incr/decr test value" ); + "proper number of incr/decr test thread iterations" ); + testOk ( get ( testData.m_testValue ) == NT, + "proper final incr/decr test value" ); } template < class T > @@ -170,31 +170,31 @@ void testAddSub () static const size_t N = 90; static const T NDT = TestDataAddSub < T > :: delta * - static_cast < T > ( N ); + static_cast < T > ( N ); - const unsigned int stackSize = + const unsigned int stackSize = epicsThreadGetStackSize ( epicsThreadStackSmall ); TestDataIncrDecr < T > testData = { 0, N }; set ( testData.m_testValue, NDT ); testOk ( get ( testData.m_testValue ) == NDT, - "get returns initial add/sub test data value that was set" ); + "get returns initial add/sub test data value that was set" ); set ( testData.m_testIterations, 0u ); testOk ( get ( testData.m_testIterations ) == 0u, - "get returns initial incr/decr test thread iterations value that was set" ); + "get returns initial incr/decr test thread iterations value that was set" ); for ( size_t i = 0u; i < N; i++ ) { epicsThreadMustCreate ( "add", - 50, stackSize, add < T >, & testData ); + 50, stackSize, add < T >, & testData ); epicsThreadMustCreate ( "sub", - 50, stackSize, sub < T >, & testData ); + 50, stackSize, sub < T >, & testData ); } while ( testData.m_testIterations < 2 * N ) { epicsThreadSleep ( 0.01 ); } testOk ( get ( testData.m_testIterations ) == 2 * N, - "proper number of add/sub test thread iterations" ); - testOk ( get ( testData.m_testValue ) == NDT, - "proper final add/sub test value" ); + "proper number of add/sub test thread iterations" ); + testOk ( get ( testData.m_testValue ) == NDT, + "proper final add/sub test value" ); } template < class T > @@ -203,35 +203,35 @@ void testCAS () using epics::atomic::set; using epics::atomic::get; - static const size_t N = 10; + static const size_t N = 10; - const unsigned int stackSize = + const unsigned int stackSize = epicsThreadGetStackSize ( epicsThreadStackSmall ); - TestDataCAS < T > testData = { 0, N, N }; - set ( testData.m_testIterationsSet, 0 ); - testOk ( get ( testData.m_testIterationsSet ) == 0u, - "get returns initial CAS test thread " + TestDataCAS < T > testData = { 0, N, N }; + set ( testData.m_testIterationsSet, 0 ); + testOk ( get ( testData.m_testIterationsSet ) == 0u, + "get returns initial CAS test thread " "iterations set value" ); - set ( testData.m_testIterationsNotSet, 0 ); - testOk ( get ( testData.m_testIterationsNotSet ) == 0u, - "get returns initial CAS test thread " + set ( testData.m_testIterationsNotSet, 0 ); + testOk ( get ( testData.m_testIterationsNotSet ) == 0u, + "get returns initial CAS test thread " "iterations not set value" ); - set ( testData.m_testValue, trueValue < T > () ); - testOk ( get ( testData.m_testValue ) == trueValue < T > (), - "set/get a true value" ); - for ( size_t i = 0u; i < N; i++ ) { + set ( testData.m_testValue, trueValue < T > () ); + testOk ( get ( testData.m_testValue ) == trueValue < T > (), + "set/get a true value" ); + for ( size_t i = 0u; i < N; i++ ) { epicsThreadMustCreate ( "tns", - 50, stackSize, cas < T >, & testData ); - } - set ( testData.m_testValue, falseValue < T > () ); - while ( testData.m_testIterationsSet < N ) { - epicsThreadSleep ( 0.01 ); - } - testOk ( get ( testData.m_testIterationsSet ) == N, - "proper number of CAS test thread set iterations" ); - testOk ( get ( testData.m_testIterationsNotSet ) == 0u, - "proper number of CAS test thread not set iterations" ); + 50, stackSize, cas < T >, & testData ); + } + set ( testData.m_testValue, falseValue < T > () ); + while ( testData.m_testIterationsSet < N ) { + epicsThreadSleep ( 0.01 ); + } + testOk ( get ( testData.m_testIterationsSet ) == N, + "proper number of CAS test thread set iterations" ); + testOk ( get ( testData.m_testIterationsNotSet ) == 0u, + "proper number of CAS test thread not set iterations" ); } // template instances, needed for vxWorks 5.5.2 diff --git a/modules/libcom/test/epicsCalcTest.cpp b/modules/libcom/test/epicsCalcTest.cpp index cd86d699d..a47736497 100644 --- a/modules/libcom/test/epicsCalcTest.cpp +++ b/modules/libcom/test/epicsCalcTest.cpp @@ -4,7 +4,7 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -// Author: Andrew Johnson +// Author: Andrew Johnson #include #include @@ -21,7 +21,7 @@ double doCalc(const char *expr) { /* Evaluate expression, return result */ double args[CALCPERFORM_NARGS] = { - 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 + 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 }; char *rpn = (char*)malloc(INFIX_TO_POSTFIX_SIZE(strlen(expr)+1)); short err; @@ -34,11 +34,11 @@ double doCalc(const char *expr) { } if (postfix(expr, rpn, &err)) { - testDiag("postfix: %s in expression '%s'", calcErrorStr(err), expr); + testDiag("postfix: %s in expression '%s'", calcErrorStr(err), expr); } else - if (calcPerform(args, &result, rpn) && finite(result)) { - testDiag("calcPerform: error evaluating '%s'", expr); - } + if (calcPerform(args, &result, rpn) && finite(result)) { + testDiag("calcPerform: error evaluating '%s'", expr); + } free(rpn); return result; } @@ -295,7 +295,7 @@ MAIN(epicsCalcTest) { int repeat; const double a=1.0, b=2.0, c=3.0, d=4.0, e=5.0, f=6.0, - g=7.0, h=8.0, i=9.0, j=10.0, k=11.0, l=12.0; + g=7.0, h=8.0, i=9.0, j=10.0, k=11.0, l=12.0; testPlan(630); @@ -339,11 +339,11 @@ MAIN(epicsCalcTest) testExpr(R2D); for (repeat=0; repeat<100; repeat++) { - double res = doCalc("rndm"); - if (res<0 || res >1) { - testDiag("rndm returned %g", res); - break; - } + double res = doCalc("rndm"); + if (res<0 || res >1) { + testDiag("rndm returned %g", res); + break; + } } testOk(repeat == 100, "rndm"); @@ -841,61 +841,61 @@ MAIN(epicsCalcTest) testCalc("l; l := 0", l); // Check relative precedences. - testExpr(0 ? 1 : 2 | 4); // 0 1 - testExpr(1 ? 1 : 2 | 4); // 0 1 - testExpr(0 ? 2 | 4 : 1); // 0 1 - testExpr(1 ? 2 | 4 : 1); // 0 1 - testExpr(0 ? 1 : 2 & 3); // 0 2 - testExpr(1 ? 1 : 2 & 3); // 0 2 - testExpr(0 ? 2 & 3 : 1); // 0 2 - testExpr(1 ? 2 & 3 : 1); // 0 2 - testExpr(0 ? 2 : 3 >= 1); // 0 3 - testExpr(0 ? 3 >= 1 : 2); // 0 3 - testExpr(1 ? 0 == 1 : 2); // 0 3 - testExpr(1 ? 2 : 0 == 1); // 0 3 - testExpr(0 ? 1 : 2 + 4); // 0 4 - testExpr(1 ? 1 : 2 + 4); // 0 4 - testExpr(0 ? 2 + 4 : 1); // 0 4 - testExpr(1 ? 2 + 4 : 1); // 0 4 - testExpr(0 ? 1 : 2 * 4); // 0 5 - testExpr(1 ? 1 : 2 * 4); // 0 5 - testExpr(0 ? 2 * 4 : 1); // 0 5 - testExpr(1 ? 2 * 4 : 1); // 0 5 - testCalc("0 ? 1 : 2 ** 3", 8); // 0 6 - testCalc("1 ? 1 : 2 ** 3", 1); // 0 6 - testCalc("0 ? 2 ** 3 : 1", 1); // 0 6 - testCalc("1 ? 2 ** 3 : 1", 8); // 0 6 - testCalc("1 | 3 XOR 1", (1 | 3) ^ 1); // 1 1 - testExpr(1 XOR 3 | 1); // 1 1 - testExpr(3 | 1 & 2); // 1 2 - testExpr(2 | 4 > 3); // 1 3 - testExpr(2 OR 4 > 3); // 1 3 - testExpr(2 XOR 3 >= 0); // 1 3 - testExpr(2 | 1 - 3); // 1 4 - testExpr(2 | 4 / 2); // 1 5 + testExpr(0 ? 1 : 2 | 4); // 0 1 + testExpr(1 ? 1 : 2 | 4); // 0 1 + testExpr(0 ? 2 | 4 : 1); // 0 1 + testExpr(1 ? 2 | 4 : 1); // 0 1 + testExpr(0 ? 1 : 2 & 3); // 0 2 + testExpr(1 ? 1 : 2 & 3); // 0 2 + testExpr(0 ? 2 & 3 : 1); // 0 2 + testExpr(1 ? 2 & 3 : 1); // 0 2 + testExpr(0 ? 2 : 3 >= 1); // 0 3 + testExpr(0 ? 3 >= 1 : 2); // 0 3 + testExpr(1 ? 0 == 1 : 2); // 0 3 + testExpr(1 ? 2 : 0 == 1); // 0 3 + testExpr(0 ? 1 : 2 + 4); // 0 4 + testExpr(1 ? 1 : 2 + 4); // 0 4 + testExpr(0 ? 2 + 4 : 1); // 0 4 + testExpr(1 ? 2 + 4 : 1); // 0 4 + testExpr(0 ? 1 : 2 * 4); // 0 5 + testExpr(1 ? 1 : 2 * 4); // 0 5 + testExpr(0 ? 2 * 4 : 1); // 0 5 + testExpr(1 ? 2 * 4 : 1); // 0 5 + testCalc("0 ? 1 : 2 ** 3", 8); // 0 6 + testCalc("1 ? 1 : 2 ** 3", 1); // 0 6 + testCalc("0 ? 2 ** 3 : 1", 1); // 0 6 + testCalc("1 ? 2 ** 3 : 1", 8); // 0 6 + testCalc("1 | 3 XOR 1", (1 | 3) ^ 1); // 1 1 + testExpr(1 XOR 3 | 1); // 1 1 + testExpr(3 | 1 & 2); // 1 2 + testExpr(2 | 4 > 3); // 1 3 + testExpr(2 OR 4 > 3); // 1 3 + testExpr(2 XOR 3 >= 0); // 1 3 + testExpr(2 | 1 - 3); // 1 4 + testExpr(2 | 4 / 2); // 1 5 testCalc("1 | 2 ** 3", 1 | (int) pow(2., 3.));// 1 6 - testExpr(3 << 2 & 10); // 2 2 - testCalc("18 & 6 << 2", (18 & 6) << 2); // 2 2 - testExpr(36 >> 2 & 10); // 2 2 - testCalc("36 >>> 2 & 10", 36u >> 2u & 10u); // 2 2 - testCalc("18 & 20 >> 2", (18 & 20) >> 2); // 2 2 + testExpr(3 << 2 & 10); // 2 2 + testCalc("18 & 6 << 2", (18 & 6) << 2); // 2 2 + testExpr(36 >> 2 & 10); // 2 2 + testCalc("36 >>> 2 & 10", 36u >> 2u & 10u); // 2 2 + testCalc("18 & 20 >> 2", (18 & 20) >> 2); // 2 2 testCalc("18 & 20 >>> 2", (18u & 20u) >> 2);// 2 2 - testExpr(3 & 4 == 4); // 2 3 - testExpr(3 AND 4 == 4); // 2 3 - testCalc("1 << 2 != 4", 1 << (2 != 4)); // 2 3 - testCalc("16 >> 2 != 4", 16 >> (2 != 4)); // 2 3 - testCalc("16 >>> 2 != 4", 16u >> (2 != 4)); // 2 3 - testExpr(3 AND -2); // 2 8 - testExpr(0 < 1 ? 2 : 3); // 3 0 - testExpr(1 <= 0 ? 2 : 3); // 3 0 - testExpr(0 + -1); // 4 8 - testExpr(0 - -1); // 4 8 - testExpr(10 + 10 * 2); // 4 5 - testExpr(20 + 20 / 2); // 4 5 - testExpr(-1 + 1); // 7 4 - testExpr(-1 - 2); // 7 4 - testCalc("-2 ** 2", pow(-2., 2.)); // 7 6 - testCalc("-2 ^ 2", pow(-2., 2.)); // 7 6 + testExpr(3 & 4 == 4); // 2 3 + testExpr(3 AND 4 == 4); // 2 3 + testCalc("1 << 2 != 4", 1 << (2 != 4)); // 2 3 + testCalc("16 >> 2 != 4", 16 >> (2 != 4)); // 2 3 + testCalc("16 >>> 2 != 4", 16u >> (2 != 4)); // 2 3 + testExpr(3 AND -2); // 2 8 + testExpr(0 < 1 ? 2 : 3); // 3 0 + testExpr(1 <= 0 ? 2 : 3); // 3 0 + testExpr(0 + -1); // 4 8 + testExpr(0 - -1); // 4 8 + testExpr(10 + 10 * 2); // 4 5 + testExpr(20 + 20 / 2); // 4 5 + testExpr(-1 + 1); // 7 4 + testExpr(-1 - 2); // 7 4 + testCalc("-2 ** 2", pow(-2., 2.)); // 7 6 + testCalc("-2 ^ 2", pow(-2., 2.)); // 7 6 // Check parentheses testCalc("(1 | 2) ** 3", pow((double) (1 | 2), 3.));// 8 6 @@ -916,7 +916,7 @@ MAIN(epicsCalcTest) testArgs("K", A_K, 0); testArgs("L", A_L, 0); testArgs("A+B+C+D+E+F+G+H+I+J+K+L", - A_A|A_B|A_C|A_D|A_E|A_F|A_G|A_H|A_I|A_J|A_K|A_L, 0); + A_A|A_B|A_C|A_D|A_E|A_F|A_G|A_H|A_I|A_J|A_K|A_L, 0); testArgs("0.1;A:=0", 0, A_A); testArgs("1.1;B:=0", 0, A_B); testArgs("2.1;C:=0", 0, A_C); diff --git a/modules/libcom/test/epicsEllTest.c b/modules/libcom/test/epicsEllTest.c index 62ee14e39..1ff66aa7e 100644 --- a/modules/libcom/test/epicsEllTest.c +++ b/modules/libcom/test/epicsEllTest.c @@ -5,7 +5,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ #include diff --git a/modules/libcom/test/epicsEventTest.cpp b/modules/libcom/test/epicsEventTest.cpp index 9a6e48a8f..1f6ec9d0f 100644 --- a/modules/libcom/test/epicsEventTest.cpp +++ b/modules/libcom/test/epicsEventTest.cpp @@ -65,7 +65,7 @@ static void consumer(void *arg) testDiag("consumer: message %p %p\n", message[0], message[1]); errors++; } - } + } } testOk(errors == 0, "consumer: errors = %d", errors); } diff --git a/modules/libcom/test/epicsMutexTest.cpp b/modules/libcom/test/epicsMutexTest.cpp index e3ad5868f..c46a8ce61 100644 --- a/modules/libcom/test/epicsMutexTest.cpp +++ b/modules/libcom/test/epicsMutexTest.cpp @@ -8,8 +8,8 @@ \*************************************************************************/ /* epicsMutexTest.c */ -/* - * Author: Marty Kraimer Date: 26JAN2000 +/* + * Author: Marty Kraimer Date: 26JAN2000 * Jeff Hill (added mutex performance test ) */ @@ -165,7 +165,7 @@ inline void tenQuadRecursiveLockPairsSquared ( epicsMutex & mutex ) void epicsMutexPerformance () { epicsMutex mutex; - unsigned i; + unsigned i; // test a single lock pair epicsTime begin = epicsTime::getMonotonic (); @@ -206,7 +206,7 @@ struct verifyTryLock { extern "C" void verifyTryLockThread ( void *pArg ) { - struct verifyTryLock *pVerify = + struct verifyTryLock *pVerify = ( struct verifyTryLock * ) pArg; testOk1(epicsMutexTryLock(pVerify->mutex) == epicsMutexLockTimeout); @@ -222,7 +222,7 @@ void verifyTryLock () testOk1(epicsMutexTryLock(verify.mutex) == epicsMutexLockOK); - epicsThreadCreate ( "verifyTryLockThread", 40, + epicsThreadCreate ( "verifyTryLockThread", 40, epicsThreadGetStackSize(epicsThreadStackSmall), verifyTryLockThread, &verify ); diff --git a/modules/libcom/test/epicsStackTraceTest.c b/modules/libcom/test/epicsStackTraceTest.c index f6c81a8f2..3739884fc 100644 --- a/modules/libcom/test/epicsStackTraceTest.c +++ b/modules/libcom/test/epicsStackTraceTest.c @@ -1,11 +1,11 @@ -/* +/* * Copyright: Stanford University / SLAC National Laboratory. * * EPICS BASE is distributed subject to a Software License Agreement found - * in file LICENSE that is included with this distribution. + * in file LICENSE that is included with this distribution. * * Author: Till Straumann , 2014 - */ + */ /* * Check stack trace functionality @@ -132,14 +132,14 @@ findNumOcc(const char *buf) } /* We should find an address close to epicsStackTraceRecurseGbl twice */ for (i=0; i= (char*)epicsStackTraceRecurseGbl && (char*)ptrs[i] < (char*)epicsStackTraceRecurseGbl + WINDOW_SZ ) { - rval ++; + rval ++; testDiag("found address %p again\n", ptrs[i]); } } @@ -160,7 +160,7 @@ MAIN(epicsStackTraceTest) testPlan(5); - features = epicsStackTraceGetFeatures(); + features = epicsStackTraceGetFeatures(); all_features = EPICS_STACKTRACE_LCL_SYMBOLS | EPICS_STACKTRACE_GBL_SYMBOLS diff --git a/modules/libcom/test/epicsStdioTest.c b/modules/libcom/test/epicsStdioTest.c index bf25784a5..5b32d144f 100644 --- a/modules/libcom/test/epicsStdioTest.c +++ b/modules/libcom/test/epicsStdioTest.c @@ -47,9 +47,9 @@ static void testEpicsSnprintf(void) { sprintf(exbuffer, format, ivalue, fvalue, svalue); rlen = strlen(expected)+1; - + strcpy(buffer, "AAAA"); - + for (size = 1; size < strlen(expected) + 5; ++size) { rtn = epicsSnprintf(buffer, size, format, ivalue, fvalue, svalue); testOk(rtn <= rlen-1, "epicsSnprintf(size=%d) = %d", size, rtn); @@ -69,7 +69,7 @@ void testStdoutRedir (const char *report) FILE *stream = 0; char linebuf[80]; size_t buflen = sizeof linebuf; - + testOk1(epicsGetStdout() == stdout); errno = 0; diff --git a/modules/libcom/test/epicsThreadPrivateTest.cpp b/modules/libcom/test/epicsThreadPrivateTest.cpp index 7ce28f4fd..330b96f81 100644 --- a/modules/libcom/test/epicsThreadPrivateTest.cpp +++ b/modules/libcom/test/epicsThreadPrivateTest.cpp @@ -34,8 +34,8 @@ MAIN(epicsThreadPrivateTest) priv.set ( &var ); testOk1 ( &var == priv.get() ); - epicsThreadCreate ( "epicsThreadPrivateTest", epicsThreadPriorityMax, - epicsThreadGetStackSize ( epicsThreadStackSmall ), + epicsThreadCreate ( "epicsThreadPrivateTest", epicsThreadPriorityMax, + epicsThreadGetStackSize ( epicsThreadStackSmall ), epicsThreadPrivateTestThread, 0 ); epicsThreadSleep ( 1.0 ); testOk1 ( &var == priv.get() ); diff --git a/modules/libcom/test/epicsTimerTest.cpp b/modules/libcom/test/epicsTimerTest.cpp index 12454b0c2..4e1e3e725 100644 --- a/modules/libcom/test/epicsTimerTest.cpp +++ b/modules/libcom/test/epicsTimerTest.cpp @@ -62,7 +62,7 @@ void testRefCount() Q1->release(); } -static const double delayVerifyOffset = 1.0; // sec +static const double delayVerifyOffset = 1.0; // sec class delayVerify : public epicsTimerNotify { public: @@ -148,7 +148,7 @@ void testAccuracy () testDiag ( "Testing timer accuracy" ); - epicsTimerQueueActive &queue = + epicsTimerQueueActive &queue = epicsTimerQueueActive::allocate ( true, epicsThreadPriorityMax ); for ( i = 0u; i < nTimers; i++ ) { @@ -171,7 +171,7 @@ void testAccuracy () averageMeasuredError += pTimers[i]->checkError (); } averageMeasuredError /= nTimers; - testDiag ("average timer delay error %f ms", + testDiag ("average timer delay error %f ms", averageMeasuredError * 1000 ); queue.release (); } @@ -242,7 +242,7 @@ void testCancel () testDiag ( "Testing timer cancellation" ); - epicsTimerQueueActive &queue = + epicsTimerQueueActive &queue = epicsTimerQueueActive::allocate ( true, epicsThreadPriorityMin ); for ( i = 0u; i < nTimers; i++ ) { @@ -331,7 +331,7 @@ void testExpireDestroy () testDiag ( "Testing timer destruction in expire()" ); - epicsTimerQueueActive &queue = + epicsTimerQueueActive &queue = epicsTimerQueueActive::allocate ( true, epicsThreadPriorityMin ); for ( i = 0u; i < nTimers; i++ ) { @@ -373,7 +373,7 @@ private: }; periodicVerify::periodicVerify ( epicsTimerQueue & queueIn ) : - timer ( queueIn.createTimer () ), nExpire ( 0u ), + timer ( queueIn.createTimer () ), nExpire ( 0u ), cancelCalled ( false ) { } @@ -425,7 +425,7 @@ void testPeriodic () testDiag ( "Testing periodic timers" ); - epicsTimerQueueActive &queue = + epicsTimerQueueActive &queue = epicsTimerQueueActive::allocate ( true, epicsThreadPriorityMin ); for ( i = 0u; i < nTimers; i++ ) { diff --git a/modules/libcom/test/fdmgrTest.c b/modules/libcom/test/fdmgrTest.c index e41784ccf..950da0715 100644 --- a/modules/libcom/test/fdmgrTest.c +++ b/modules/libcom/test/fdmgrTest.c @@ -88,7 +88,7 @@ void testTimer (fdctx *pfdm, double delay) measuredDelay = epicsTimeDiffInSeconds (&cbs.time, &begin); measuredError = fabs (measuredDelay-delay); - printf ("measured delay for %lf sec was off by %lf sec (%lf %%)\n", + printf ("measured delay for %lf sec was off by %lf sec (%lf %%)\n", delay, measuredError, 100.0*measuredError/delay); } @@ -130,9 +130,9 @@ int main (int argc, char **argv) status = fdmgr_delete (pfdm); verify (status==0); - + printf ( "Test Complete\n" ); - + return 0; } diff --git a/modules/libcom/test/macDefExpandTest.c b/modules/libcom/test/macDefExpandTest.c index a5e45a420..8ce161923 100644 --- a/modules/libcom/test/macDefExpandTest.c +++ b/modules/libcom/test/macDefExpandTest.c @@ -120,11 +120,11 @@ static void check(const char *str, const char *macros, const char *expect) static const char *pairs[] = { "", "environ", NULL, NULL }; char *got; int pass = 1; - + macCreateHandle(&handle, pairs); macParseDefns(NULL, macros, &defines); macInstallMacros(handle, defines); - + got = macDefExpand(str, handle); if (expect && !got) { @@ -140,7 +140,7 @@ static void check(const char *str, const char *macros, const char *expect) pass = 0; } testOk(pass, "%s", str); - + macDeleteHandle(handle); } @@ -222,7 +222,7 @@ MAIN(macDefExpandTest) check("${FOO,BAR=x}/${BAR}", "BAR=GLEEP", "BLETCH/GLEEP"); check("${BAZ=BLETCH,BAR}/${BAR}", "BAR=GLEEP", "BLETCH/GLEEP"); check("${BAZ=BLETCH,BAR=x}/${BAR}", "BAR=GLEEP", "BLETCH/GLEEP"); - + check("${${FOO}}", "BAR=GLEEP,BLETCH=BAR", "BAR"); check("x${${FOO}}y", "BAR=GLEEP,BLETCH=BAR", "xBARy"); check("${${FOO}=GRIBBLE}", "BAR=GLEEP,BLETCH=BAR", "BAR"); @@ -247,7 +247,7 @@ MAIN(macDefExpandTest) check("${FOO=$(BAR),BAR=$(FOO)}", "BAR=${FOO},BLETCH=${BAR},STR1=VAL1,STR2=VAL2", NULL); macEnvScope(); - + errlogFlush(); eltc(1); return testDone(); diff --git a/modules/libcom/test/ringBytesTest.c b/modules/libcom/test/ringBytesTest.c index bb91d0201..75465d785 100644 --- a/modules/libcom/test/ringBytesTest.c +++ b/modules/libcom/test/ringBytesTest.c @@ -27,7 +27,7 @@ typedef struct info { epicsEventId consumerEvent; - epicsRingBytesId ring; + epicsRingBytesId ring; }info; static void check(epicsRingBytesId ring, int expectedFree, @@ -41,7 +41,7 @@ static void check(epicsRingBytesId ring, int expectedFree, int isEmpty = epicsRingBytesIsEmpty(ring); int isFull = epicsRingBytesIsFull(ring); int highWaterMark = epicsRingBytesHighWaterMark(ring); - + testOk(nFree == expectedFree, "Free: %d == %d", nFree, expectedFree); testOk(nUsed == expectedUsed, "Used: %d == %d", nUsed, expectedUsed); testOk(isEmpty == expectedEmpty, "Empty: %d == %d", isEmpty, expectedEmpty); @@ -49,7 +49,7 @@ static void check(epicsRingBytesId ring, int expectedFree, testOk(highWaterMark == expectedHighWaterMark, "HighWaterMark: %d == %d", highWaterMark, expectedHighWaterMark); } - + MAIN(ringBytesTest) { int i, n; From 96f9f355c9a6a8a1b4b0f1a6483adf37bb5222f3 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Wed, 20 May 2020 19:47:14 +0200 Subject: [PATCH 189/216] doc: update simulation parameters sections in dbds - refer to appropriate sections in dbCommonInput/dbCommonOutput --- .../database/src/std/rec/aaiRecord.dbd.pod | 17 ++++-- .../database/src/std/rec/aaoRecord.dbd.pod | 17 ++++-- modules/database/src/std/rec/aiRecord.dbd.pod | 37 ++++--------- modules/database/src/std/rec/aoRecord.dbd.pod | 19 +++++-- modules/database/src/std/rec/biRecord.dbd.pod | 29 +++++++--- modules/database/src/std/rec/boRecord.dbd.pod | 19 +++++-- .../src/std/rec/int64inRecord.dbd.pod | 55 +++++++++++-------- .../src/std/rec/int64outRecord.dbd.pod | 28 ++++------ .../database/src/std/rec/longinRecord.dbd.pod | 18 ++++-- .../src/std/rec/longoutRecord.dbd.pod | 21 +++++-- .../database/src/std/rec/lsiRecord.dbd.pod | 17 ++++-- .../database/src/std/rec/lsoRecord.dbd.pod | 18 ++++-- .../src/std/rec/mbbiDirectRecord.dbd.pod | 21 +++++-- .../database/src/std/rec/mbbiRecord.dbd.pod | 18 ++++-- .../src/std/rec/mbboDirectRecord.dbd.pod | 18 ++++-- .../database/src/std/rec/mbboRecord.dbd.pod | 21 +++++-- .../src/std/rec/stringinRecord.dbd.pod | 20 +++++-- .../src/std/rec/stringoutRecord.dbd.pod | 22 +++++--- .../src/std/rec/waveformRecord.dbd.pod | 16 +++++- 19 files changed, 286 insertions(+), 145 deletions(-) diff --git a/modules/database/src/std/rec/aaiRecord.dbd.pod b/modules/database/src/std/rec/aaiRecord.dbd.pod index e3af631e6..80d702388 100644 --- a/modules/database/src/std/rec/aaiRecord.dbd.pod +++ b/modules/database/src/std/rec/aaiRecord.dbd.pod @@ -127,11 +127,20 @@ into the array. =fields VAL, BPTR, NORD -The following fields are used to operate the array analog input record in the -simulation mode. See L for more information on the simulation -mode fields. +=head3 Simulation Mode Parameters -=fields SIOL, SIML, SIMM, SIMS +The following fields are used to operate the record in simulation mode. + +If SIMM (fetched through SIML) is YES, the record is put in SIMS +severity and the value is fetched through SIOL. +SSCN sets a different SCAN mechanism to use in simulation mode. +SDLY sets a delay (in sec) that is used for asynchronous simulation +processing. + +See L +for more information on simulation mode and its fields. + +=fields SIML, SIMM, SIOL, SIMS, SDLY, SSCN =begin html diff --git a/modules/database/src/std/rec/aaoRecord.dbd.pod b/modules/database/src/std/rec/aaoRecord.dbd.pod index a5756c29a..b2f588957 100644 --- a/modules/database/src/std/rec/aaoRecord.dbd.pod +++ b/modules/database/src/std/rec/aaoRecord.dbd.pod @@ -127,11 +127,20 @@ the output, =fields VAL, BPTR, NORD -The following fields are used to operate the array analog output record in the -simulation mode. See L for more information on the simulation -mode fields. +=head3 Simulation Mode Parameters -=fields SIOL, SIML, SIMM, SIMS +The following fields are used to operate the record in simulation mode. + +If SIMM (fetched through SIML) is YES, the record is put in SIMS +severity and the value is written through SIOL. +SSCN sets a different SCAN mechanism to use in simulation mode. +SDLY sets a delay (in sec) that is used for asynchronous simulation +processing. + +See L +for more information on simulation mode and its fields. + +=fields SIML, SIMM, SIOL, SIMS, SDLY, SSCN =begin html diff --git a/modules/database/src/std/rec/aiRecord.dbd.pod b/modules/database/src/std/rec/aiRecord.dbd.pod index 14a4c9243..d0bef3cb2 100644 --- a/modules/database/src/std/rec/aiRecord.dbd.pod +++ b/modules/database/src/std/rec/aiRecord.dbd.pod @@ -441,35 +441,22 @@ monitoring functionality. interest(3) } -=head3 Simulation Mode +=head3 Simulation Mode Parameters -The record provides several fields to support simulation of absent hardware. -If the SIML field is set it is used to read a value into the SIMM field, which -controls whether simulation is used or not: +The following fields are used to operate the record in simulation mode. -=over +If SIMM (fetched through SIML) is YES or RAW, the record is put in SIMS +severity and the value is fetched through SIOL (buffered in SVAL). +If SIMM is YES, SVAL is written to VAL without conversion, +if SIMM is RAW, SVAL is trancated to RVAL and converted. +SSCN sets a different SCAN mechanism to use in simulation mode. +SDLY sets a delay (in sec) that is used for asynchronous simulation +processing. -=item * -SIMM must be zero (C) for the record to request a value from the device -support. +See L +for more information on simulation mode and its fields. -=item * -If SIMM is C and the SIOL link field is set, a simlated value in -engineering units is read using the link into the SVAL field, from where it will -subsequently be copied into the VAL field. - -=item * -If SIMM is C the SIOL link is still read into SVAL, but is then truncated -and copied into the RVAL field. -The L process described above is then followed to transform -the simulated raw value into engineering units. - -=back - -The SIMS field can be set to give the record an alarm severity while it is in -simulation mode. - -=fields SIML, SIMM, SIOL, SVAL, SIMS +=fields SIML, SIMM, SIOL, SVAL, SIMS, SDLY, SSCN =cut diff --git a/modules/database/src/std/rec/aoRecord.dbd.pod b/modules/database/src/std/rec/aoRecord.dbd.pod index 68c0d6c86..1338cfb35 100644 --- a/modules/database/src/std/rec/aoRecord.dbd.pod +++ b/modules/database/src/std/rec/aoRecord.dbd.pod @@ -228,7 +228,7 @@ a complete explanation of monitors. =fields ADEL, MDEL -=head3 Run-time and Simulation Mode Parameters +=head3 Run-time Parameters These parameters are used by the run-time code for processing the analog output. They are not configurable. They represent the current @@ -259,11 +259,20 @@ processing. =fields ORAW, RBV, ORBV, LALM, ALST, MLST, INIT, PBRK, LBRK, PVAL, OMOD -The following fields are used when the record is in simulation mode. See -L for -more information on these fields. +=head3 Simulation Mode Parameters -=fields SIOL, SIML, SIMM, SIMS +The following fields are used to operate the record in simulation mode. + +If SIMM (fetched through SIML) is YES, the record is put in SIMS +severity and the value is written through SIOL, without conversion. +SSCN sets a different SCAN mechanism to use in simulation mode. +SDLY sets a delay (in sec) that is used for asynchronous simulation +processing. + +See L +for more information on simulation mode and its fields. + +=fields SIML, SIMM, SIOL, SIMS, SDLY, SSCN =cut diff --git a/modules/database/src/std/rec/biRecord.dbd.pod b/modules/database/src/std/rec/biRecord.dbd.pod index 62bcf3bf2..5bd9c9238 100644 --- a/modules/database/src/std/rec/biRecord.dbd.pod +++ b/modules/database/src/std/rec/biRecord.dbd.pod @@ -131,7 +131,7 @@ common to all record types. =fields ZSV, OSV, COSV -=head3 Run-time Parameters and Simulation Mode Parameters +=head3 Run-time Parameters These parameters are used by the run-time code for processing the binary input. They are not configured using a database configuration tool. @@ -153,13 +153,6 @@ is not equal to VAL. =fields ORAW, MASK, LALM, MLST -The following fields are used to operate the binary input in simulation -mode. See L for more information on -these fields. - -=fields SIOL, SVAL, SIML, SIMM, SIMS - - =cut include "dbCommon.dbd" @@ -235,6 +228,26 @@ these fields. special(SPC_NOMOD) interest(3) } + +=head3 Simulation Mode Parameters + +The following fields are used to operate the record in simulation mode. + +If SIMM (fetched through SIML) is YES or RAW, the record is put in SIMS +severity and the value is fetched through SIOL (buffered in SVAL). +If SIMM is YES, SVAL is written to VAL without conversion, +if SIMM is RAW, SVAL is trancated to RVAL and converted. +SSCN sets a different SCAN mechanism to use in simulation mode. +SDLY sets a delay (in sec) that is used for asynchronous simulation +processing. + +See L +for more information on simulation mode and its fields. + +=fields SIML, SIMM, SIOL, SVAL, SIMS, SDLY, SSCN + +=cut + field(SIOL,DBF_INLINK) { prompt("Simulation Input Link") promptgroup("90 - Simulate") diff --git a/modules/database/src/std/rec/boRecord.dbd.pod b/modules/database/src/std/rec/boRecord.dbd.pod index 6b6d1800c..4e5cd442d 100644 --- a/modules/database/src/std/rec/boRecord.dbd.pod +++ b/modules/database/src/std/rec/boRecord.dbd.pod @@ -170,7 +170,7 @@ common to all record types. =fields ZSV, OSV, COSV, IVOA, IVOV -=head3 Run-Time and Simulation Mode Parameters +=head3 Run-Time Parameters These parameters are used by the run-time code for processiong the binary output. They are not configurable using a configuration tool. They @@ -201,11 +201,20 @@ The WPDT field is a private field for honoring seconds to hold HIGH. =fields ORAW, MASK, RBV, ORBV, LALM, MLST, RPVT, WDPT -The following fields are used to operate the binary output in the -simulation mode. See L for more -information on these fields. +=head3 Simulation Mode Parameters -=fields SIOL, SIML, SIMM, SIMS +The following fields are used to operate the record in simulation mode. + +If SIMM (fetched through SIML) is YES, the record is put in SIMS +severity and the value is written through SIOL. +SSCN sets a different SCAN mechanism to use in simulation mode. +SDLY sets a delay (in sec) that is used for asynchronous simulation +processing. + +See L +for more information on simulation mode and its fields. + +=fields SIML, SIMM, SIOL, SIMS, SDLY, SSCN =cut diff --git a/modules/database/src/std/rec/int64inRecord.dbd.pod b/modules/database/src/std/rec/int64inRecord.dbd.pod index edb19a73f..6b1d9a759 100644 --- a/modules/database/src/std/rec/int64inRecord.dbd.pod +++ b/modules/database/src/std/rec/int64inRecord.dbd.pod @@ -238,29 +238,20 @@ monitoring deadband functionality. interest(3) } -=head3 Simulation Mode +=head3 Simulation Mode Parameters -The record provides several fields to support simulation of absent hardware. -If the SIML field is set it is used to read a value into the SIMM field, which -controls whether simulation is used or not: +The following fields are used to operate the record in simulation mode. -=over +If SIMM (fetched through SIML) is YES, the record is put in SIMS +severity and the value is fetched through SIOL (buffered in SVAL). +SSCN sets a different SCAN mechanism to use in simulation mode. +SDLY sets a delay (in sec) that is used for asynchronous simulation +processing. -=item * -SIMM must be zero (C) for the record to request a value from the device -support. +See L +for more information on simulation mode and its fields. -=item * -If SIMM is C and the SIOL link field is set, a simulated value in -engineering units is read using the link into the SVAL field, from where it will -subsequently be copied into the VAL field. - -=back - -The SIMS field can be set to give the record an alarm severity while it is in -simulation mode. - -=fields SIML, SIMM, SIOL, SVAL, SIMS +=fields SIML, SIMM, SIOL, SVAL, SIMS, SDLY, SSCN =cut @@ -375,14 +366,30 @@ If PACT is FALSE, read the value, honoring simulation mode: =item * If SIMM is C, call the device support C routine and return. -=item * If SIMM is C, -read the simulated value into SVAL using the SIOL link, -then copy the value into VAL and set UDF to 0 on success. +=item * If SIMM is C, then + +=over + +=item * + +Set alarm status to SIMM_ALARM and severity to SIMS, +if SIMS is greater than zero. + +=item * + +If the record simulation processing is synchronous (SDLY < 0) or the record is +in the second phase of an asynchronous processing, call C +to read the input value from SIOL into SVAL. +Set status to the return code from C. +If the call succeeded, write the value to VAL and set UDF to 0. + +Otherwise (record is in first phase of an asynchronous processing), set up a +callback processing with the delay specified in SDLY. + +=back =item * Raise an alarm for other values of SIMM. -=item * Set the record to the severity configured in SIMS. - =back =item 3. diff --git a/modules/database/src/std/rec/int64outRecord.dbd.pod b/modules/database/src/std/rec/int64outRecord.dbd.pod index 1b5003efe..7d8bd0f02 100644 --- a/modules/database/src/std/rec/int64outRecord.dbd.pod +++ b/modules/database/src/std/rec/int64outRecord.dbd.pod @@ -279,28 +279,20 @@ monitoring deadband functionality. interest(3) } -=head3 Simulation Mode +=head3 Simulation Mode Parameters -The record provides several fields to support simulation of absent hardware. -If the SIML field is set it is used to read a value into the SIMM field, -which controls whether simulation is used or not: +The following fields are used to operate the record in simulation mode. -=over +If SIMM (fetched through SIML) is YES, the record is put in SIMS +severity and the value is written through SIOL. +SSCN sets a different SCAN mechanism to use in simulation mode. +SDLY sets a delay (in sec) that is used for asynchronous simulation +processing. -=item * -SIMM must be zero (C) for the record to write a value to the device -support. +See L +for more information on simulation mode and its fields. -=item * -If SIMM is C and the SIOL link field is set, the value in engineering -units is written using the link. - -=back - -The SIMS field can be set to give the record an alarm severity while it is in -simulation mode. - -=fields SIML, SIMM, SIOL, SIMS +=fields SIML, SIMM, SIOL, SIMS, SDLY, SSCN =cut diff --git a/modules/database/src/std/rec/longinRecord.dbd.pod b/modules/database/src/std/rec/longinRecord.dbd.pod index cf2a3a395..34c7f4ed0 100644 --- a/modules/database/src/std/rec/longinRecord.dbd.pod +++ b/modules/database/src/std/rec/longinRecord.dbd.pod @@ -95,7 +95,7 @@ monitors. See L for a complete explanation of monitors. =fields ADEL, MDEL -=head3 Run-time and Simulation Mode Parameters +=head3 Run-time Parameters The LALM, MLST, and ALST fields are used to implement the hysteresis factors for monitor callbacks. Only if the difference between these fields and the @@ -105,10 +105,20 @@ between VAL and MLST is greater than MDEL are the monitors triggered for VAL. =fields LALM, ALST, MLST -The following fields are used to operate the long input in the simulation mode. -See L for more information on these fields. +=head3 Simulation Mode Parameters -=fields SIOL, SVAL, SIML, SIMM, SIMS +The following fields are used to operate the record in simulation mode. + +If SIMM (fetched through SIML) is YES, the record is put in SIMS +severity and the value is fetched through SIOL (buffered in SVAL). +SSCN sets a different SCAN mechanism to use in simulation mode. +SDLY sets a delay (in sec) that is used for asynchronous simulation +processing. + +See L +for more information on simulation mode and its fields. + +=fields SIML, SIMM, SIOL, SVAL, SIMS, SDLY, SSCN =head2 Record Support diff --git a/modules/database/src/std/rec/longoutRecord.dbd.pod b/modules/database/src/std/rec/longoutRecord.dbd.pod index 276f3046f..f726ed546 100644 --- a/modules/database/src/std/rec/longoutRecord.dbd.pod +++ b/modules/database/src/std/rec/longoutRecord.dbd.pod @@ -298,7 +298,7 @@ monitors. interest(3) } -=head3 Run-time and Simulation Mode Parameters +=head3 Run-time Parameters The LALM, MLST, and ALST fields are used to implement the hysteresis factors for monitor callbacks. Only if the difference between these fields and the @@ -308,15 +308,24 @@ between VAL and MLST is greater than MDEL are the monitors triggered for VAL. =fields LALM, ALST, MLST -The following fields are used to operate the long output in the simulation mode. -See L for more information on the simulation -mode fields +=head3 Simulation Mode Parameters -=fields SIOL, SIML, SIMM, SIMS +The following fields are used to operate the record in simulation mode. + +If SIMM (fetched through SIML) is YES, the record is put in SIMS +severity and the value is written through SIOL. +SSCN sets a different SCAN mechanism to use in simulation mode. +SDLY sets a delay (in sec) that is used for asynchronous simulation +processing. + +See L +for more information on simulation mode and its fields. + +=fields SIML, SIMM, SIOL, SIMS, SDLY, SSCN =cut - field(SIOL,DBF_OUTLINK) { + field(SIOL,DBF_OUTLINK) { prompt("Sim Output Specifctn") promptgroup("90 - Simulate") interest(1) diff --git a/modules/database/src/std/rec/lsiRecord.dbd.pod b/modules/database/src/std/rec/lsiRecord.dbd.pod index f829a3ce6..fc21d5552 100644 --- a/modules/database/src/std/rec/lsiRecord.dbd.pod +++ b/modules/database/src/std/rec/lsiRecord.dbd.pod @@ -133,7 +133,7 @@ The long string input record has the alarm parameters common to all record types. L lists other fields related to a alarms that are common to all record types. -=head3 Run-time and Simulation Mode Parameters +=head3 Run-time Parameters The old value field (OVAL) of the long string input record is used to implement value change monitors for VAL. If VAL is not equal to OVAL, then monitors are @@ -142,11 +142,20 @@ length of the string in OVAL. =fields OVAL, LEN, OLEN +=head3 Simulation Mode Parameters -The following fields are used to operate the string input in the simulation -mode. See L for more information on simulation mode fields. +The following fields are used to operate the record in simulation mode. -=fields SIOL, SIML, SIMM, SIMS +If SIMM (fetched through SIML) is YES, the record is put in SIMS +severity and the value is fetched through SIOL. +SSCN sets a different SCAN mechanism to use in simulation mode. +SDLY sets a delay (in sec) that is used for asynchronous simulation +processing. + +See L +for more information on simulation mode and its fields. + +=fields SIML, SIMM, SIOL, SIMS, SDLY, SSCN =cut diff --git a/modules/database/src/std/rec/lsoRecord.dbd.pod b/modules/database/src/std/rec/lsoRecord.dbd.pod index bc83c36bc..34be8a1bd 100644 --- a/modules/database/src/std/rec/lsoRecord.dbd.pod +++ b/modules/database/src/std/rec/lsoRecord.dbd.pod @@ -192,7 +192,7 @@ lists other fields related to a alarms that are common to all record types. } -=head3 Run-time and Simulation Mode Parameters +=head3 Run-time Parameters The old value field (OVAL) of the long string input record is used to implement value change monitors for VAL. If VAL is not equal to OVAL, then monitors are @@ -201,10 +201,20 @@ length of the string in OVAL. =fields OVAL, LEN, OLEN -The following fields are used to operate the string input in the simulation -mode. See L for more information on simulation mode fields. +=head3 Simulation Mode Parameters -=fields SIOL, SIML, SIMM, SIMS +The following fields are used to operate the record in simulation mode. + +If SIMM (fetched through SIML) is YES, the record is put in SIMS +severity and the value is written through SIOL. +SSCN sets a different SCAN mechanism to use in simulation mode. +SDLY sets a delay (in sec) that is used for asynchronous simulation +processing. + +See L +for more information on simulation mode and its fields. + +=fields SIML, SIMM, SIOL, SIMS, SDLY, SSCN =cut diff --git a/modules/database/src/std/rec/mbbiDirectRecord.dbd.pod b/modules/database/src/std/rec/mbbiDirectRecord.dbd.pod index 5b1c4da09..1759c7ef8 100644 --- a/modules/database/src/std/rec/mbbiDirectRecord.dbd.pod +++ b/modules/database/src/std/rec/mbbiDirectRecord.dbd.pod @@ -127,7 +127,7 @@ description (DESC) fields. interest(1) } -=head3 Run-time and Simulation Mode Parameters +=head3 Run-time Parameters These parameters are used by the run-time code for processing the mbbi direct record. They are not configurable prior to run-time. @@ -139,11 +139,22 @@ MLST holds the value when the last monitor for value change was triggered. =fields NOBT, ORAW, MASK, MLST -The following fields are used to operate the mbbiDirect record in the simulation -mode. See L for more information on these -fields. +=head3 Simulation Mode Parameters -=fields SIOL, SVAL, SIML, SIMM, SIMS, SSCN, SDLY +The following fields are used to operate the record in simulation mode. + +If SIMM (fetched through SIML) is YES or RAW, the record is put in SIMS +severity and the value is fetched through SIOL (buffered in SVAL). +If SIMM is YES, SVAL is written to VAL without conversion, +if SIMM is RAW, SVAL is trancated to RVAL and converted. +SSCN sets a different SCAN mechanism to use in simulation mode. +SDLY sets a delay (in sec) that is used for asynchronous simulation +processing. + +See L +for more information on simulation mode and its fields. + +=fields SIML, SIMM, SIOL, SVAL, SIMS, SDLY, SSCN =cut diff --git a/modules/database/src/std/rec/mbbiRecord.dbd.pod b/modules/database/src/std/rec/mbbiRecord.dbd.pod index b4ab1b402..df1a556b3 100644 --- a/modules/database/src/std/rec/mbbiRecord.dbd.pod +++ b/modules/database/src/std/rec/mbbiRecord.dbd.pod @@ -609,14 +609,24 @@ SDEF is used by record support to save time if no states are defined. =head3 Simulation Mode Parameters -The following fields are used to operate the mbbi record in the simulation mode. -See L for more information on these fields. +The following fields are used to operate the record in simulation mode. -=fields SIOL, SVAL, SIML, SIMM, SIMS, SSCN, SDLY +If SIMM (fetched through SIML) is YES or RAW, the record is put in SIMS +severity and the value is fetched through SIOL (buffered in SVAL). +If SIMM is YES, SVAL is written to VAL without conversion, +if SIMM is RAW, SVAL is trancated to RVAL and converted. +SSCN sets a different SCAN mechanism to use in simulation mode. +SDLY sets a delay (in sec) that is used for asynchronous simulation +processing. + +See L +for more information on simulation mode and its fields. + +=fields SIML, SIMM, SIOL, SVAL, SIMS, SDLY, SSCN =cut - field(SIOL,DBF_INLINK) { + field(SIOL,DBF_INLINK) { prompt("Simulation Input Link") promptgroup("90 - Simulate") interest(1) diff --git a/modules/database/src/std/rec/mbboDirectRecord.dbd.pod b/modules/database/src/std/rec/mbboDirectRecord.dbd.pod index ca49bcd53..aff5029bc 100644 --- a/modules/database/src/std/rec/mbboDirectRecord.dbd.pod +++ b/modules/database/src/std/rec/mbboDirectRecord.dbd.pod @@ -155,7 +155,7 @@ description (DESC) fields. interest(1) } -=head3 Run-time and Simulation Mode Parameters +=head3 Run-time Parameters These parameters are used by the run-time code for processing the mbbo Direct record. @@ -167,10 +167,20 @@ MLST holds the value when the last monitor for value change was triggered. =fields NOBT, ORAW, MASK, MLST -The following fields are used to operate the mbboDirect record in the simulation -mode. See L for more information on the simulation mode fields. +=head3 Simulation Mode Parameters -=fields SIOL, SIML, SIMM, SIMS, SSCN, SDLY +The following fields are used to operate the record in simulation mode. + +If SIMM (fetched through SIML) is YES, the record is put in SIMS +severity and the value is written through SIOL, without conversion. +SSCN sets a different SCAN mechanism to use in simulation mode. +SDLY sets a delay (in sec) that is used for asynchronous simulation +processing. + +See L +for more information on simulation mode and its fields. + +=fields SIML, SIMM, SIOL, SIMS, SDLY, SSCN =cut diff --git a/modules/database/src/std/rec/mbboRecord.dbd.pod b/modules/database/src/std/rec/mbboRecord.dbd.pod index 2196aa5a2..da3e00bc5 100644 --- a/modules/database/src/std/rec/mbboRecord.dbd.pod +++ b/modules/database/src/std/rec/mbboRecord.dbd.pod @@ -145,7 +145,7 @@ common to all record types. =fields UNSV, COSV, IVOA, IVOV, ZRSV, ONSV, TWSV, THSV, FRSV, FVSV, SXSV, SVSV, EISV, NISV, TESV, ELSV, TVSV, TTSV, FTSV, FFSV -=head3 Run-Time and Simulation Mode Parameters +=head3 Run-Time Parameters These parameters are used by the run-time code for processing the multi-bit binary output. @@ -164,15 +164,24 @@ for converting VAL to RVAL. =fields NOBT, ORAW, MASK, LALM, MLST, SDEF -The following fields are used to operate the mbbo record in the simulation mode. -See L for more information on the simulation -mode fields. +=head3 Simulation Mode Parameters -=fields SIOL, SIML, SIMM, SIMS, SSCN, SDLY +The following fields are used to operate the record in simulation mode. + +If SIMM (fetched through SIML) is YES, the record is put in SIMS +severity and the value is written through SIOL, without conversion. +SSCN sets a different SCAN mechanism to use in simulation mode. +SDLY sets a delay (in sec) that is used for asynchronous simulation +processing. + +See L +for more information on simulation mode and its fields. + +=fields SIML, SIMM, SIOL, SIMS, SDLY, SSCN =cut - include "dbCommon.dbd" + include "dbCommon.dbd" field(VAL,DBF_ENUM) { prompt("Desired Value") promptgroup("50 - Output") diff --git a/modules/database/src/std/rec/stringinRecord.dbd.pod b/modules/database/src/std/rec/stringinRecord.dbd.pod index a9d7aadfc..5cb64acac 100644 --- a/modules/database/src/std/rec/stringinRecord.dbd.pod +++ b/modules/database/src/std/rec/stringinRecord.dbd.pod @@ -111,21 +111,31 @@ The string input record has the alarm parameters common to all record types. L lists other fields related to a alarms that are common to all record types. -=head3 Run-time and Simulation Mode Parameters +=head3 Run-time Parameters The old value field (OVAL) of the string input is used to implement value change monitors for VAL. If VAL is not equal to OVAL, then monitors are triggered. =fields OVAL -The following fields are used to operate the string input in the simulation -mode. See L for more information on simulation mode fields. +=head3 Simulation Mode Parameters -=fields SIOL, SVAL, SIML, SIMM, SIMS, SSCN, SDLY +The following fields are used to operate the record in simulation mode. + +If SIMM (fetched through SIML) is YES, the record is put in SIMS +severity and the value is fetched through SIOL (buffered in SVAL). +SSCN sets a different SCAN mechanism to use in simulation mode. +SDLY sets a delay (in sec) that is used for asynchronous simulation +processing. + +See L +for more information on simulation mode and its fields. + +=fields SIML, SIMM, SIOL, SVAL, SIMS, SDLY, SSCN =cut - field(SIOL,DBF_INLINK) { + field(SIOL,DBF_INLINK) { prompt("Simulation Input Link") promptgroup("90 - Simulate") interest(1) diff --git a/modules/database/src/std/rec/stringoutRecord.dbd.pod b/modules/database/src/std/rec/stringoutRecord.dbd.pod index cd8915b2e..1b3c91f75 100644 --- a/modules/database/src/std/rec/stringoutRecord.dbd.pod +++ b/modules/database/src/std/rec/stringoutRecord.dbd.pod @@ -146,23 +146,31 @@ for more on the record name (NAME) and description (DESC) fields. =fields NAME, DESC -=head3 Run-time and Simulation Mode Parameters +=head3 Run-time Parameters The old value field (OVAL) of the string input is used to implement value change monitors for VAL. If VAL is not equal to OVAL, then monitors are triggered. =fields OVAL -The following fields are used to operate the string output in the simulation -mode. See -L -for more information on these fields. +=head3 Simulation Mode Parameters -=fields SIOL, SIML, SIMM, SIMS, SSCN, SDLY +The following fields are used to operate the record in simulation mode. + +If SIMM (fetched through SIML) is YES, the record is put in SIMS +severity and the value is written through SIOL. +SSCN sets a different SCAN mechanism to use in simulation mode. +SDLY sets a delay (in sec) that is used for asynchronous simulation +processing. + +See L +for more information on simulation mode and its fields. + +=fields SIML, SIMM, SIOL, SIMS, SDLY, SSCN =cut - field(SIOL,DBF_OUTLINK) { + field(SIOL,DBF_OUTLINK) { prompt("Simulation Output Link") promptgroup("90 - Simulate") interest(1) diff --git a/modules/database/src/std/rec/waveformRecord.dbd.pod b/modules/database/src/std/rec/waveformRecord.dbd.pod index 80628b564..7c4b5f192 100644 --- a/modules/database/src/std/rec/waveformRecord.dbd.pod +++ b/modules/database/src/std/rec/waveformRecord.dbd.pod @@ -131,10 +131,20 @@ indicates if the device is armed but has not yet been digitized. =fields VAL, BPTR, NORD, BUSY -The following fields are used to operate the waveform in the simulation mode. -See L for more information on the simulation mode fields. +=head3 Simulation Mode Parameters -=fields SIOL, SIML, SIMM, SIMS +The following fields are used to operate the record in simulation mode. + +If SIMM (fetched through SIML) is YES, the record is put in SIMS +severity and the value is fetched through SIOL. +SSCN sets a different SCAN mechanism to use in simulation mode. +SDLY sets a delay (in sec) that is used for asynchronous simulation +processing. + +See L +for more information on simulation mode and its fields. + +=fields SIML, SIMM, SIOL, SIMS, SDLY, SSCN =begin html From 4eeb205374dacab0a797e73290af0a0f1b27acb3 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 21 May 2020 11:49:27 -0700 Subject: [PATCH 190/216] Remove ANSI-C OS prototypes from flexdef.h Use osiUnistd.h instead. Add io.h to osiUnistd.h on Windows # Conflicts: # modules/libcom/src/flex/flexdef.h # modules/libcom/src/osi/os/WIN32/osiUnistd.h --- modules/libcom/src/flex/flexdef.h | 10 +--------- modules/libcom/src/osi/os/WIN32/osiUnistd.h | 4 ++-- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/modules/libcom/src/flex/flexdef.h b/modules/libcom/src/flex/flexdef.h index 932878899..1c5ffbce3 100644 --- a/modules/libcom/src/flex/flexdef.h +++ b/modules/libcom/src/flex/flexdef.h @@ -43,11 +43,7 @@ #include #include -#ifdef _WIN32 -# include -#else -# include -#endif +#include #ifdef __GNUC__ #define NORETURN __attribute__((noreturn)) @@ -827,8 +823,4 @@ extern void stack1 (int, int, int, int); extern int yylex (); - -/* The Unix kernel calls used here */ - #endif /* INC_flexdef_H */ - diff --git a/modules/libcom/src/osi/os/WIN32/osiUnistd.h b/modules/libcom/src/osi/os/WIN32/osiUnistd.h index a83c49be4..6252b51d4 100644 --- a/modules/libcom/src/osi/os/WIN32/osiUnistd.h +++ b/modules/libcom/src/osi/os/WIN32/osiUnistd.h @@ -3,8 +3,7 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -14,3 +13,4 @@ */ #include +#include From 0f88c67473d246be4f721f6f058289eaffcd75b4 Mon Sep 17 00:00:00 2001 From: hir12111 Date: Wed, 1 Apr 2020 15:24:34 +0100 Subject: [PATCH 191/216] Add a getter function for field_type --- modules/database/src/ioc/dbStatic/dbStaticLib.c | 8 ++++++++ modules/database/src/ioc/dbStatic/dbStaticLib.h | 1 + 2 files changed, 9 insertions(+) diff --git a/modules/database/src/ioc/dbStatic/dbStaticLib.c b/modules/database/src/ioc/dbStatic/dbStaticLib.c index 1664542d0..539ea3aa4 100644 --- a/modules/database/src/ioc/dbStatic/dbStaticLib.c +++ b/modules/database/src/ioc/dbStatic/dbStaticLib.c @@ -1381,6 +1381,14 @@ char * dbGetFieldName(DBENTRY *pdbentry) return(pflddes->name); } +int dbGetFieldDbfType(DBENTRY *pdbentry) +{ + dbFldDes *pflddes = pdbentry->pflddes; + + if(!pflddes) return(-1); + return(pflddes->field_type); +} + char * dbGetDefault(DBENTRY *pdbentry) { dbFldDes *pflddes = pdbentry->pflddes; diff --git a/modules/database/src/ioc/dbStatic/dbStaticLib.h b/modules/database/src/ioc/dbStatic/dbStaticLib.h index ffa5fa25d..edef8404b 100644 --- a/modules/database/src/ioc/dbStatic/dbStaticLib.h +++ b/modules/database/src/ioc/dbStatic/dbStaticLib.h @@ -110,6 +110,7 @@ epicsShareFunc long dbFirstField(DBENTRY *pdbentry, int dctonly); epicsShareFunc long dbNextField(DBENTRY *pdbentry, int dctonly); epicsShareFunc int dbGetNFields(DBENTRY *pdbentry, int dctonly); epicsShareFunc char * dbGetFieldName(DBENTRY *pdbentry); +epicsShareFunc int dbGetFieldDbfType(DBENTRY *pdbentry); epicsShareFunc char * dbGetDefault(DBENTRY *pdbentry); epicsShareFunc char * dbGetPrompt(DBENTRY *pdbentry); epicsShareFunc int dbGetPromptGroup(DBENTRY *pdbentry); From 2f2c023a519701453d89486a069061b2f3af0655 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Fri, 22 May 2020 10:18:48 -0700 Subject: [PATCH 192/216] update submodules --- .ci | 2 +- modules/normativeTypes | 2 +- modules/pvAccess | 2 +- modules/pvData | 2 +- modules/pvDatabase | 2 +- modules/pva2pva | 2 +- modules/pvaClient | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.ci b/.ci index e91a58837..ba5508b39 160000 --- a/.ci +++ b/.ci @@ -1 +1 @@ -Subproject commit e91a5883704e9fa57792953436eb7020baf37063 +Subproject commit ba5508b39eee4e4717bdf7861220a8c24e572142 diff --git a/modules/normativeTypes b/modules/normativeTypes index 6d41566b4..7a2d264f2 160000 --- a/modules/normativeTypes +++ b/modules/normativeTypes @@ -1 +1 @@ -Subproject commit 6d41566b40a3f20582f1b37dbf4557bfdf5da674 +Subproject commit 7a2d264f2cb107bfd10adb23bc2b73d8323a79e4 diff --git a/modules/pvAccess b/modules/pvAccess index ef4bf9120..3cae45128 160000 --- a/modules/pvAccess +++ b/modules/pvAccess @@ -1 +1 @@ -Subproject commit ef4bf9120e2d624dab8d25af49d627380c8c98d5 +Subproject commit 3cae45128fc58cf455ea7aa09fb2fb84b266630a diff --git a/modules/pvData b/modules/pvData index 3d93a80cc..81e796823 160000 --- a/modules/pvData +++ b/modules/pvData @@ -1 +1 @@ -Subproject commit 3d93a80cce58eb4a639d8be9866aff57b2930e45 +Subproject commit 81e79682302111aee29cdcf796f01ac894a2e52a diff --git a/modules/pvDatabase b/modules/pvDatabase index 634153a28..85165e657 160000 --- a/modules/pvDatabase +++ b/modules/pvDatabase @@ -1 +1 @@ -Subproject commit 634153a28d42e8a41fefb8dea7ec2863c0f36bf2 +Subproject commit 85165e6579c65968fca0bb25598974917296ce84 diff --git a/modules/pva2pva b/modules/pva2pva index 29a6f261d..cda2222ed 160000 --- a/modules/pva2pva +++ b/modules/pva2pva @@ -1 +1 @@ -Subproject commit 29a6f261dcd28e213d273d5b2acb0ae7408dfcb2 +Subproject commit cda2222ed5fa22d65bef2e1d033bcb655f58b4a6 diff --git a/modules/pvaClient b/modules/pvaClient index 9add9daf8..c3aec4e27 160000 --- a/modules/pvaClient +++ b/modules/pvaClient @@ -1 +1 @@ -Subproject commit 9add9daf85bc5cc970bf43be798f013d64263332 +Subproject commit c3aec4e27b61aad87d8825f67ffe607eeec98c7a From 04dd52c79a5eacb4798c5857a5f68873cd0c6b7c Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Sun, 24 May 2020 11:05:30 -0700 Subject: [PATCH 193/216] update release notes --- documentation/RELEASE_NOTES.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/documentation/RELEASE_NOTES.md b/documentation/RELEASE_NOTES.md index a02d1a28b..6765607e3 100644 --- a/documentation/RELEASE_NOTES.md +++ b/documentation/RELEASE_NOTES.md @@ -14,6 +14,17 @@ release. ## EPICS Release 7.0.3.2 +### \*_API macros in headers + +Internally, the Com and ca libraries now express dllimport/export (Windows) +and symbol visibility (GCC) with individual macros (eg. LIBCOM_API) +instead of using epicsShare\*. This change may effect user code which uses +epicsShare\* macros without explicitly including the shareLib.h header. +Such code should be changed to include shareLib.h directly. + +A new helper script makeAPIheader.pl and rules to generate \*API.h headers +has been added. Run 'makeAPIheader.pl -h' for application information. + ### IOCsh usage messages `help ` now prints a descriptive usage message From b2fb83179a5e533adb3ae892d2e0b326fb3b65b3 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 22 May 2020 17:03:55 -0500 Subject: [PATCH 194/216] Remove duplicate MBA template files --- modules/database/src/template/Makefile | 5 ++++ src/template/base/Makefile | 5 ---- src/template/base/top/supportApp/Db/Makefile | 18 ------------ src/template/base/top/supportApp/Makefile | 7 ----- src/template/base/top/supportApp/src/Makefile | 28 ------------------- .../base/top/supportApp/src/_APPNAME_.dbd | 6 ---- 6 files changed, 5 insertions(+), 64 deletions(-) delete mode 100644 src/template/base/top/supportApp/Db/Makefile delete mode 100644 src/template/base/top/supportApp/Makefile delete mode 100644 src/template/base/top/supportApp/src/Makefile delete mode 100644 src/template/base/top/supportApp/src/_APPNAME_.dbd diff --git a/modules/database/src/template/Makefile b/modules/database/src/template/Makefile index 8dfc6c6f3..9eed8fc20 100644 --- a/modules/database/src/template/Makefile +++ b/modules/database/src/template/Makefile @@ -9,6 +9,11 @@ TEMPLATES += top/iocApp/Db/Makefile TEMPLATES += top/iocApp/src/Makefile TEMPLATES += top/iocApp/src/_APPNAME_Main.cpp +TEMPLATES += top/supportApp/Makefile +TEMPLATES += top/supportApp/Db/Makefile +TEMPLATES += top/supportApp/src/Makefile +TEMPLATES += top/supportApp/src/_APPNAME_.dbd + TEMPLATES += top/exampleApp/Makefile TEMPLATES += top/exampleApp/Db/Makefile TEMPLATES += top/exampleApp/Db/circle.db diff --git a/src/template/base/Makefile b/src/template/base/Makefile index c758964b7..d03dc0841 100644 --- a/src/template/base/Makefile +++ b/src/template/base/Makefile @@ -14,11 +14,6 @@ TEMPLATES += top/configure/RULES.ioc TEMPLATES += top/configure/RULES_DIRS TEMPLATES += top/configure/RULES_TOP -TEMPLATES += top/supportApp/Makefile -TEMPLATES += top/supportApp/Db/Makefile -TEMPLATES += top/supportApp/src/Makefile -TEMPLATES += top/supportApp/src/_APPNAME_.dbd - SCRIPTS_HOST += makeBaseApp.pl include $(TOP)/configure/RULES diff --git a/src/template/base/top/supportApp/Db/Makefile b/src/template/base/top/supportApp/Db/Makefile deleted file mode 100644 index 8eb97279d..000000000 --- a/src/template/base/top/supportApp/Db/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -TOP=../.. -include $(TOP)/configure/CONFIG -#---------------------------------------- -# ADD MACRO DEFINITIONS AFTER THIS LINE - -#---------------------------------------------------- -# Create and install (or just install) into /db -# databases, templates, substitutions like this -#DB += xxx.db - -#---------------------------------------------------- -# If .db template is not named *.template add -# _template = - -include $(TOP)/configure/RULES -#---------------------------------------- -# ADD RULES AFTER THIS LINE - diff --git a/src/template/base/top/supportApp/Makefile b/src/template/base/top/supportApp/Makefile deleted file mode 100644 index ab15bfb1c..000000000 --- a/src/template/base/top/supportApp/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -TOP = .. -include $(TOP)/configure/CONFIG -DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard *src*)) -DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard *Src*)) -DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard *db*)) -DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard *Db*)) -include $(TOP)/configure/RULES_DIRS diff --git a/src/template/base/top/supportApp/src/Makefile b/src/template/base/top/supportApp/src/Makefile deleted file mode 100644 index 941d94f8b..000000000 --- a/src/template/base/top/supportApp/src/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -TOP=../.. - -include $(TOP)/configure/CONFIG -#---------------------------------------- -# ADD MACRO DEFINITIONS AFTER THIS LINE -#============================= - -#================================================== -# build a support library - -LIBRARY_IOC += _APPNAME_ - -# xxxRecord.h will be created from xxxRecord.dbd -#DBDINC += xxxRecord -# install _APPNAME_.dbd into /dbd -DBD += _APPNAME_.dbd - -# specify all source files to be compiled and added to the library -#_APPNAME__SRCS += xxx - -_APPNAME__LIBS += $(EPICS_BASE_IOC_LIBS) - -#=========================== - -include $(TOP)/configure/RULES -#---------------------------------------- -# ADD RULES AFTER THIS LINE - diff --git a/src/template/base/top/supportApp/src/_APPNAME_.dbd b/src/template/base/top/supportApp/src/_APPNAME_.dbd deleted file mode 100644 index e70223b19..000000000 --- a/src/template/base/top/supportApp/src/_APPNAME_.dbd +++ /dev/null @@ -1,6 +0,0 @@ -# provide definitions such as -#include "xxxRecord.dbd" -#device(xxx,CONSTANT,devXxxSoft,"SoftChannel") -#driver(myDriver) -#registrar(myRegistrar) -#variable(myVariable) From 290f2d7e7d548c97b3b3a2e1bf6fb87fcf0ede52 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 25 May 2020 20:42:35 -0500 Subject: [PATCH 195/216] Skip appveyor builds when only .travis.yml changes --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 6a289f6ea..f98fb81bb 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -29,9 +29,9 @@ clone_depth: 5 skip_commits: files: - 'documentation/*' - - 'templates/*' - '**/*.html' - '**/*.md' + - '.travis.yml' #---------------------------------# # build matrix configuration # From f89ef1f12fa606c8d2b2999e080f50d0a49168b5 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 25 May 2020 20:45:14 -0500 Subject: [PATCH 196/216] Re-enable RTEMS tests in Travis builds --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5edb00dcd..1c92081ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -79,9 +79,9 @@ jobs: # Cross-compilation to RTEMS - - env: RTEMS=4.10 TEST=NO + - env: RTEMS=4.10 - - env: RTEMS=4.9 TEST=NO + - env: RTEMS=4.9 # MacOS build From ab281f0f53b2e1bb95d3e389edb6f5e76b115ad0 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 25 May 2020 21:05:18 -0500 Subject: [PATCH 197/216] Excuse RTEMS for failing tests... --- modules/libcom/test/epicsMessageQueueTest.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/libcom/test/epicsMessageQueueTest.cpp b/modules/libcom/test/epicsMessageQueueTest.cpp index f23683c84..b6e1bbb44 100644 --- a/modules/libcom/test/epicsMessageQueueTest.cpp +++ b/modules/libcom/test/epicsMessageQueueTest.cpp @@ -363,9 +363,15 @@ extern "C" void messageQueueTest(void *parm) sleepySender(0.009); sleepySender(0.010); sleepySender(0.011); +#ifdef __rtems__ + testTodoBegin("RTEMS failure expected"); +#endif sleepyReceiver(0.009); sleepyReceiver(0.010); sleepyReceiver(0.011); +#ifdef __rtems__ + testTodoEnd(); +#endif testDiag("Single receiver, single sender tests:"); epicsThreadSetPriority(myThreadId, epicsThreadPriorityHigh); From 9ff6c4bb365f2ee2577bda65e5b1aaa565c650e0 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Tue, 26 May 2020 11:04:32 +0200 Subject: [PATCH 198/216] Update .ci to ci-scripts bb9b591 (bugfix) --- .ci | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci b/.ci index ba5508b39..bb9b59156 160000 --- a/.ci +++ b/.ci @@ -1 +1 @@ -Subproject commit ba5508b39eee4e4717bdf7861220a8c24e572142 +Subproject commit bb9b59156c52b7abb97cd94bbaa4e05e64ae76c4 From ee39b0583965d1d1c4615926188e2ac48f3bbe6b Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Tue, 26 May 2020 11:08:43 +0200 Subject: [PATCH 199/216] travis-ci: remove declarative DIST settings Travis started showing the distribution setting on the web UI --- .travis.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1c92081ba..2983b481a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,28 +46,24 @@ jobs: include: # Different configurations of default gcc and clang -# (the DIST settings are just FYI on the travis-ci.org site) - dist: bionic - env: DIST=bionic - - env: DIST=xenial + - dist: xenial - dist: bionic - env: DIST=bionic EXTRA="CMD_CXXFLAGS=-std=c++11" + env: EXTRA="CMD_CXXFLAGS=-std=c++11" - dist: trusty - env: DIST=trusty STATIC=YES EXTRA="CMD_CXXFLAGS=-std=c++11" + env: STATIC=YES EXTRA="CMD_CXXFLAGS=-std=c++11" - dist: bionic compiler: clang - env: DIST=bionic - compiler: clang - env: DIST=xenial - dist: trusty compiler: clang - env: DIST=trusty STATIC=YES + env: STATIC=YES # Cross-compilations to Windows using MinGW and WINE From 1f4e8122238c01c5b87472b3021a8e179d0e3c03 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 26 May 2020 10:24:39 -0700 Subject: [PATCH 200/216] update ci-scripts --- .ci | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci b/.ci index bb9b59156..55038b731 160000 --- a/.ci +++ b/.ci @@ -1 +1 @@ -Subproject commit bb9b59156c52b7abb97cd94bbaa4e05e64ae76c4 +Subproject commit 55038b731516f22584b7e1cede4ef0a05b8b647e From dd1b65f32c7e51d28448aecd907817db4e98fea0 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 26 May 2020 21:49:35 -0500 Subject: [PATCH 201/216] Many edits to record reference docs Add documentation for aSub from wiki. Fix incorrect document structures. Remove inclusion of menu.dbd files. Fix links to common doc's, remove some links to nowhere. Adjust podToHtml.pl and the rule that calls it. --- configure/RULES.Db | 2 +- .../database/src/std/rec/aSubRecord.dbd.pod | 539 +++++++++++++++++- .../database/src/std/rec/aaiRecord.dbd.pod | 43 +- .../database/src/std/rec/aaoRecord.dbd.pod | 24 +- modules/database/src/std/rec/biRecord.dbd.pod | 41 +- modules/database/src/std/rec/boRecord.dbd.pod | 13 +- .../database/src/std/rec/calcRecord.dbd.pod | 42 +- .../src/std/rec/calcoutRecord.dbd.pod | 44 +- .../src/std/rec/compressRecord.dbd.pod | 13 +- .../src/std/rec/dfanoutRecord.dbd.pod | 40 +- .../database/src/std/rec/eventRecord.dbd.pod | 34 +- .../database/src/std/rec/fanoutRecord.dbd.pod | 31 +- .../src/std/rec/histogramRecord.dbd.pod | 9 +- .../src/std/rec/int64inRecord.dbd.pod | 5 +- .../src/std/rec/int64outRecord.dbd.pod | 6 +- .../database/src/std/rec/longinRecord.dbd.pod | 28 +- .../src/std/rec/longoutRecord.dbd.pod | 41 +- .../database/src/std/rec/lsiRecord.dbd.pod | 19 +- .../database/src/std/rec/lsoRecord.dbd.pod | 63 +- .../src/std/rec/mbbiDirectRecord.dbd.pod | 30 +- .../database/src/std/rec/mbbiRecord.dbd.pod | 21 +- .../src/std/rec/mbboDirectRecord.dbd.pod | 25 +- .../database/src/std/rec/mbboRecord.dbd.pod | 35 +- .../src/std/rec/permissiveRecord.dbd.pod | 8 +- .../database/src/std/rec/printfRecord.dbd.pod | 15 +- .../database/src/std/rec/selRecord.dbd.pod | 26 +- .../database/src/std/rec/seqRecord.dbd.pod | 45 +- .../database/src/std/rec/stateRecord.dbd.pod | 13 +- .../src/std/rec/stringinRecord.dbd.pod | 30 +- .../src/std/rec/stringoutRecord.dbd.pod | 47 +- .../src/std/rec/subArrayRecord.dbd.pod | 19 +- .../database/src/std/rec/subRecord.dbd.pod | 30 +- .../src/std/rec/waveformRecord.dbd.pod | 51 +- src/tools/podToHtml.pl | 10 +- 34 files changed, 856 insertions(+), 586 deletions(-) diff --git a/configure/RULES.Db b/configure/RULES.Db index fae5014ab..42a57430c 100644 --- a/configure/RULES.Db +++ b/configure/RULES.Db @@ -436,7 +436,7 @@ $(COMMON_DIR)/%.html: %.dbd.pod $(COMMON_DIR)/%.html: %.pod @$(RM) $(notdir $@) - $(PODTOHTML) -o $(notdir $@) $< + $(PODTOHTML) -s -s -o $(notdir $@) $< @$(MV) $(notdir $@) $@ $(COMMON_DIR)/%.html: %.pm diff --git a/modules/database/src/std/rec/aSubRecord.dbd.pod b/modules/database/src/std/rec/aSubRecord.dbd.pod index 73f734629..9a975cdf9 100644 --- a/modules/database/src/std/rec/aSubRecord.dbd.pod +++ b/modules/database/src/std/rec/aSubRecord.dbd.pod @@ -4,37 +4,53 @@ # Copyright (c) 2002 The Regents of the University of California, as # Operator of Los Alamos National Laboratory. # EPICS BASE is distributed subject to a Software License Agreement found -# in file LICENSE that is included with this distribution. +# in file LICENSE that is included with this distribution. #************************************************************************* =title Array Subroutine Record (aSub) -... +The aSub record is an advanced variant of the 'sub' (subroutine) record which +has a number of additional features: + +=over + +=item * + +It provides 20 different input and output fields which can hold array or +scalar values. +The types and array capacities of these are user configurable, and they all +have an associated input or output link. + +=item * + +The name of the C or C++ subroutine to be called when the record processes +can be changed dynamically while the IOC is running. +The name can either be fetched from another record using an input link, or +written directly into the SNAM field. + +=item * + +The user can choose whether monitor events should be posted for the output +fields. + +=item * + +The VAL field is set to the return value from the user subroutine, which is +treated as a status value and controls whether the output links will be used +or not. The record can also raise an alarm with a chosen severity if the status +value is non-zero. + +=back =head2 Record-specific Menus =head3 Menu aSubLFLG -The LFLG field uses this menu to ... +The LFLG menu field controls whether the SUBL link will be read to update +the name of the subroutine to be called when the record processes. =menu aSubLFLG -=head3 Menu aSubEFLG - -The EFLG field uses this menu to ... - -=menu aSubEFLG - -... - -=head2 Parameter Fields - -The record-specific fields are described below. - -=recordtype aSub - -... - =cut menu(aSubLFLG) { @@ -42,14 +58,69 @@ menu(aSubLFLG) { choice(aSubLFLG_READ,"READ") } +=head3 Menu aSubEFLG + +The EFLG menu field indicates whether monitor events should be posted for the +VALA..VALU output value fields. + +=menu aSubEFLG + +=cut + menu(aSubEFLG) { choice(aSubEFLG_NEVER,"NEVER") choice(aSubEFLG_ON_CHANGE,"ON CHANGE") choice(aSubEFLG_ALWAYS,"ALWAYS") } +=head2 Parameter Fields + +The record-specific fields are described below. + +=recordtype aSub + +=cut + recordtype(aSub) { include "dbCommon.dbd" + +=head3 Subroutine Fields + +The VAL field is set to the value returned by the user subroutine. +The value is treated as an error status value where zero mean success. +The output links OUTA ... OUTU will only be used to forward the associated +output value fields when the subroutine has returned a zero status. +If the return status was non-zero, the record will be put into C +state with severity given by the BRSV field. + +The INAM field may be used to name a subroutine that will be called once at +IOC initialization time. + +LFLG tells the record whether to read or ignore the SUBL link. +If the value is C, then the name of the subroutine to be called at +process time is read from SUBL. +If the value is C, the name of the subroutine is that currently held +in SNAM. + +A string is read from the SUBL link to fetch the name of the subroutine to +be run during record processing. + +SNAM holds the name of the subroutine to be called when the record processes. +The value in this field can be overwritten by the SUBL link if LFLG is set +to C. + +The SADR field is only accessible from C code; it points to the subroutine +to be called. + +The CADR field may be set by the user subroutine to point to another function +that will be called immediately before setting the SADR field to some other +routine. This allows the main user subroutine to allocate resources when it is +first called and be able to release them again when they are no longer needed. + +=fields VAL, OVAL, INAM, LFLG, SUBL, SNAM, ONAM, SADR, CADR, BRSV + +=cut + field(VAL,DBF_LONG) { prompt("Subr. return value") asl(ASL0) @@ -112,12 +183,34 @@ recordtype(aSub) { interest(1) menu(menuAlarmSevr) } + +=head3 Operator Display Parameters + +The PREC field specifies the number of decimal places with which to display +the values of the value fields A ... U and VALA ... VALU. +Except when it doesn't. + +=cut + field(PREC,DBF_SHORT) { prompt("Display Precision") promptgroup("80 - Display") interest(1) prop(YES) } + +=head3 Output Event Flag + +This field tells the record when to post change events on the output fields +VALA ... VALU. If the value is C, events are never posted. If the value +is C, events are posted every time the record processes. If the value +is C, events are posted when any element of an array changes value. +This flag controls value, log (archive) and alarm change events. + +=fields EFLG + +=cut + field(EFLG,DBF_MENU) { prompt("Output Event Flag") promptgroup("50 - Output") @@ -125,6 +218,16 @@ recordtype(aSub) { menu(aSubEFLG) initial("1") } + +=head3 Input Link Fields + +The input links from where the values of A,...,U are fetched +during record processing. + +=fields INPA, INPB, INPC, INPD, INPE, INPF, INPG, INPH, INPI, INPJ, INPK, INPL, INPM, INPN, INPO, INPP, INPQ, INPR, INPS, INPT, INPU + +=cut + field(INPA,DBF_INLINK) { prompt("Input Link A") promptgroup("41 - Input A-G") @@ -231,9 +334,10 @@ recordtype(aSub) { interest(1) } -=head3 Input Fields +=head3 Input Value Fields -... +Thse fields hold the scalar or array values fetched through the input links +INPA,...,INPU. =fields A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U @@ -449,6 +553,16 @@ recordtype(aSub) { #=write Yes #=type Set by FTU } + +=head3 Input Value Data Types + +Field types of the input value fields. +The choices can be found by following the link to the menuFtype definition. + +=fields FTA, FTB, FTC, FTD, FTE, FTF, FTG, FTH, FTI, FTJ, FTK, FTL, FTM, FTN, FTO, FTP, FTQ, FTR, FTS, FTT, FTU + +=cut + field(FTA,DBF_MENU) { prompt("Type of A") promptgroup("41 - Input A-G") @@ -617,6 +731,15 @@ recordtype(aSub) { initial("DOUBLE") menu(menuFtype) } + +=head3 Input Value Array Capacity + +These fields specify how many array elements the input value fields may hold. + +=fields NOA, NOB, NOC, NOD, NOE, NOF, NOG, NOH, NOI, NOJ, NOK, NOL, NOM, NON, NOO, NOP, NOQ, NOR, NOS, NOT, NOU + +=cut + field(NOA,DBF_ULONG) { prompt("Max. elements in A") promptgroup("41 - Input A-G") @@ -764,6 +887,16 @@ recordtype(aSub) { interest(1) initial("1") } + +=head3 Input Value Array Size + +These fields specify how many array elements the input value fields currently +contain. + +=fields NEA, NEB, NEC, NED, NEE, NEF, NEG, NEH, NEI, NEJ, NEK, NEL, NEM, NEN, NEO, NEP, NEQ, NER, NES, NET, NEU + +=cut + field(NEA,DBF_ULONG) { prompt("Num. elements in A") special(SPC_NOMOD) @@ -890,6 +1023,15 @@ recordtype(aSub) { interest(3) initial("1") } + +=head3 Output Link Fields + +The output links through which the VALA ... VALU field values are sent +during record processing, provided the subroutine returned 0. + +=fields OUTA, OUTB, OUTC, OUTD, OUTE, OUTF, OUTG, OUTH, OUTI, OUTJ, OUTK, OUTL, OUTM, OUTN, OUTO, OUTP, OUTQ, OUTR, OUTS, OUTT, OUTU + +=cut field(OUTA,DBF_OUTLINK) { prompt("Output Link A") promptgroup("51 - Output A-G") @@ -996,9 +1138,10 @@ recordtype(aSub) { interest(1) } -=head3 Value Fields +=head3 Output Value Fields -... +These fields hold scalar or array data generated by the subroutine which will +be sent through the OUTA ... OUTU links during record processing. =fields VALA, VALB, VALC, VALD, VALE, VALF, VALG, VALH, VALI, VALJ, VALK, VALL, VALM, VALN, VALO, VALP, VALQ, VALR, VALS, VALT, VALU @@ -1214,6 +1357,16 @@ recordtype(aSub) { #=write Yes #=type Set by FTVU } + +=head3 Old Value Fields + +The previous values of the output fields. +These are used to determine when to post events if EFLG is set to C. + +=fields VALA, VALB, VALC, VALD, VALE, VALF, VALG, VALH, VALI, VALJ, VALK, VALL, VALM, VALN, VALO, VALP, VALQ, VALR, VALS, VALT, VALU + +=cut + field(OVLA,DBF_NOACCESS) { prompt("Old Output A") asl(ASL0) @@ -1361,6 +1514,16 @@ recordtype(aSub) { interest(4) extra("void *ovlu") } + +=head3 Output Value Data Types + +Field types of the output value fields. +The choices can be found by following a link to the menuFtype definition. + +=fields FTVA, FTVB, FTVC, FTVD, FTVE, FTVF, FTVG, FTVH, FTVI, FTVJ, FTVK, FTVL, FTVM, FTVN, FTVO, FTVP, FTVQ, FTVR, FTVS, FTVT, FTVU + +=cut + field(FTVA,DBF_MENU) { prompt("Type of VALA") promptgroup("51 - Output A-G") @@ -1529,6 +1692,15 @@ recordtype(aSub) { initial("DOUBLE") menu(menuFtype) } + +=head3 Output Value Array Capacity + +These fields specify how many array elements the output value fields may hold. + +=fields NOVA, NOVB, NOVC, NOVD, NOVE, NOVF, NOVG, NOVH, NOVI, NOVJ, NOVK, NOVL, NOVM, NOVN, NOVO, NOVP, NOVQ, NOVR, NOVS, NOVT, NOVU + +=cut + field(NOVA,DBF_ULONG) { prompt("Max. elements in VALA") promptgroup("51 - Output A-G") @@ -1676,6 +1848,16 @@ recordtype(aSub) { interest(1) initial("1") } + +=head3 Output Value Array Size + +These fields specify how many array elements the output value fields currently +contain. + +=fields NEVA, NEVB, NEVC, NEVD, NEVE, NEVF, NEVG, NEVH, NEVI, NEVJ, NEVK, NEVL, NEVM, NEVN, NEVO, NEVP, NEVQ, NEVR, NEVS, NEVT, NEVU + +=cut + field(NEVA,DBF_ULONG) { prompt("Num. elements in VALA") special(SPC_NOMOD) @@ -1802,6 +1984,16 @@ recordtype(aSub) { interest(3) initial("1") } + +=head3 Old Value Array Size + +These fields specify how many array elements the old value fields currently +contain. + +=fields ONVA, ONVB, ONVC, ONVD, ONVE, ONVF, ONVG, ONVH, ONVI, ONVJ, ONVK, ONVL, ONVM, ONVN, ONVO, ONVP, ONVQ, ONVR, ONVS, ONVT, ONVU + +=cut + field(ONVA,DBF_ULONG) { prompt("Num. elements in OVLA") special(SPC_NOMOD) @@ -1928,4 +2120,305 @@ recordtype(aSub) { interest(4) initial("1") } + +=begin html + +
+
+
+ +=end html + +=head2 Record Support Routines + +=head3 init_record + + long (*init_record)(struct dbCommon *precord, int pass) + +This routine is called twice at iocInit. On the first call it does the +following: + +=over + +=item * + +Calloc sufficient space to hold the number of input scalars and/or arrays +defined by the settings of the fields FTA-FTU and NOA-NOU. Initialize fields +NE* to the values of the associated NO* field values. + +=item * + +Calloc sufficient space to hold the number of output scalars and/or arrays +defined by the settings of the fields FTVA-FTVU and NOVA-NOVU. For the output +fields, also calloc space to hold the previous value of a field. This is +required when the decision is made on whether or not to post events. + +=back + +On the second call, it does the following: + +=over + +=item * + +Initializes SUBL if it is a constant link. + +=item * + +Initializes each constant input link. + +=item * + +If the field INAM is set, look-up the address of the routine and call it. + +=item * + +If the field LFLG is set to IGNORE and SNAM is defined, look up the address of +the process routine. + +=back + +=head3 process + + long (*process)(struct dbCommon *precord) + +This routine implements the following algorithm: + +=over + +=item * + +If PACT is FALSE, perform normal processing + +=item * + +If PACT is TRUE, perform asynchronous-completion processing + +=back + +Normal processing: + +=over + +=item * + +Set PACT to TRUE. + +=item * + +If the field LFLG is set to READ, get the subroutine name from the SUBL link. +If the name is not NULL and it is not the same as the previous subroutine name, +look up the subroutine address. Set the old subroutine name, ONAM, equal to the +current name, SNAM. + +=item * + +Fetch the values from the input links. + +=item * + +Set PACT to FALSE + +=item * + +If all input-link fetches succeeded, call the routine specified by SNAM. + +=item * + +Set VAL equal to the return value from the routine specified by SNAM. + +=item * + +If the SNAM routine set PACT to TRUE, then return. In this case, we presume +the routine has arranged that process will be called at some later time for +asynchronous completion. + +=item * + +Set PACT to TRUE. + +=item * + +If VAL is zero, write the output values using the output links. + +=item * + +Get the time of processing and put it into the timestamp field. + +=item * + +If VAL has changed, post a change-of value and log event for this field. +If EFLG is set to ALWAYS, post change-of-value and log events for every output +field. If EFLG is set to ON CHANGE, post change-of-value and log events for +every output field which has changed. In the case of an array, an event will be +posted if any single element of the array has changed. If EFLG is set to NEVER, +no change-of-value or log events are posted for the output fields. + +=item * + +Process the record on the end of the forward link, if one exists. + +=item * + +Set PACT to FALSE. + +=back + +Asynchronous-completion processing: + +=over + +=item * + +Call the routine specified by SNAM (again). + +=item * + +Set VAL equal to the return value from the routine specified by SNAM. + +=item * + +Set PACT to TRUE. + +=item * + +If VAL is zero, write the output values using the output links. + +=item * + +Get the time of processing and put it into the timestamp field. + +=item * + +If VAL has changed, post a change-of value and log event for this field. If +EFLG is set to ALWAYS, post change-of-value and log events for every output +field. If EFLG is set to ON CHANGE, post change-of-value and log events for +every output field which has changed. In the case of an array, an event will +be posted if any single element of the array has changed. If EFLG is set to +NEVER, no change-of-value or log events are posted for the output fields. + +=item * + +Process the record on the end of the forward link, if one exists. + +=item * + +Set PACT to FALSE. + +=back + + +=begin html + +
+
+
+ +=end html + +=head2 Use of the aSub Record + +The aSub record has input-value fields (A-U) and output-value fields +(VALA-VALU), which are completely independent. The input-value fields have +associated input links (INPA-INPU), and the output-value fields have associated +output links (OUTA-OUTU). Both inputs and outputs have type fields (FTA-FTU, +FTVA-FTVU, which default to 'DOUBLE') and number-of-element fields (NOA-NOU, +NOVA-NOVU, which default to '1'). The output links OUTA-OUTU will only be +processed if the subroutine returns a zero (OK) status value. + +=head3 Example database fragment + +To use the A field to read an array from some other record, then, you would +need a database fragment that might look something like this: + + record(aSub,"my_asub_record") { + field(SNAM,"my_asub_routine") + ... + field(FTA, "LONG") + field(NOA, "100") + field(INPA, "myWaveform_1 NPP NMS") + ... + } + +If you wanted some other record to be able to write to the A field, then you +would delete the input link above. If you wanted the A field to hold a scalar +value, you would either delete the NOA specification, or specify it as "1". + +=head3 Example subroutine fragment + +The associated subroutine code that uses the A field might look like this: + + static long my_asub_routine(aSubRecord *prec) { + long i, *a; + double sum=0; + ... + a = (long *)prec->a; + for (i=0; inoa; i++) { + sum += a[i]; + } + ... + return 0; /* process output links */ + } + +Note that the subroutine code must always handle the value fields (A-U, +VALA-VALU) as arrays, even if they contain only a single element. + +=head3 Required export code + +Aside from your own code, you must export and register your subroutines so the +record can locate them. The simplest way is as follows: + + #include + #include + + static long my_asub_routine(aSubRecord *prec) { + ... + } + epicsRegisterFunction(my_asub_routine); + +=head3 Required database-definition code + +The .dbd file loaded by the ioc must then contain the following line, which +tells the linker to include your object file in the IOC binary: + + function(my_asub_routine) + +=head3 Device support, writing to hardware + +The aSub record does not call any device support routines. If you want to write +to hardware, you might use your output fields and links to write to some other +record that can write to hardware. + +=head3 Dynamically Changing the User Routine called during Record Processing + +The aSub record allows the user to dynamically change which routine is called +when the record processes. This can be done in two ways: + +=over + +=item * + +The LFLG field can be set to READ so that the name of the routine is read from +the SUBL link. Thus, whatever is feeding this link can change the name of the +routine before the aSub record is processed. In this case, the record looks in +the symbol table for the symbol name whenever the name of routine fetched from +the link changes. + +=item * + +The LFLG field can be set to IGNORE. In this case, the routine called during +record processing is that specified in the SNAM field. Under these conditions, +the SNAM field can be changed by a Channel Access write to that field. During +development when trying several versions of the routine, it is not necessary +to reboot the IOC and reload the database. A new routine can be loaded with +the vxWorks ld command, and Channel Access or the dbpf command used to put the +name of the routine into the record's SNAM field. The record will look up the +symbol name in the symbol table whenever the SNAM field gets modified. The +same routine name can even be used as the vxWorks symbol lookup returns the +latest version of the code to have been loaded. + +=back + +=cut + } diff --git a/modules/database/src/std/rec/aaiRecord.dbd.pod b/modules/database/src/std/rec/aaiRecord.dbd.pod index d9e0723f3..8eb8bad05 100644 --- a/modules/database/src/std/rec/aaiRecord.dbd.pod +++ b/modules/database/src/std/rec/aaiRecord.dbd.pod @@ -18,8 +18,6 @@ storage. =cut -include "menuFtype.dbd" - menu(aaiPOST) { choice(aaiPOST_Always,"Always") choice(aaiPOST_OnChange,"On Change") @@ -34,10 +32,8 @@ The record-specific fields are described below, grouped by functionality. =head3 Scan Parameters The array analog input record has the standard fields for specifying under what -circumstances the record will be processed. These fields are listed in L. In addition, L explains how these fields are -used. Note that I/O event scanning is only supported for those card types that -interrupt. +circumstances the record will be processed. +These fields are described in L. =head3 Read Parameters @@ -46,8 +42,7 @@ reads its data. The INP field determines from where the array analog input gets its input. It can be a hardware address, a channel access or database link, or a constant. Only in records that use soft device support can the INP field be a channel access link, a database link, or a constant. Otherwise, the INP field must -be a hardware address. See L
for information on the format -of hardware addresses and database links. +be a hardware address. =head4 Fields related to waveform reading @@ -55,14 +50,11 @@ The DTYP field must contain the name of the appropriate device support module. The values retrieved from the input link are placed in an array referenced by VAL. (If the INP link is a constant, elements can be placed in the array via dbPuts.) NELM specifies the number of elements that the array will hold, while -FTVL specifies the data type of the elements. +FTVL specifies the data type of the elements (follow the link in the table below +for a list of the available choices). =fields DTYP, INP, NELM, FTVL -=head4 Possible data types for FTVL - -=menu menuFtype - =head3 Operator Display Parameters These parameters are used to present meaningful data to the operator. They @@ -82,8 +74,9 @@ The PREC field determines the floating point precision with which to display the array values. It is used whenever the C<<< get_precision() >>> record support routine is called. -See L for more on the record name (NAME) and -description (DESC) fields. +See L for more on the record name (NAME) and description (DESC) fields. + =fields EGU, HOPR, LOPR, PREC, NAME, DESC @@ -95,21 +88,21 @@ The array analog input record has the alarm parameters common to all record type =head3 Monitor Parameters These parameters are used to determine when to send monitors placed on the VAL -field. The APST and MPST fields are a menu with choices "Always" and "On -Change". The default is "Always", thus monitors will normally be sent every time -the record processes. Selecting "On Change" causes a 32-bit hash of the VAL +field. The APST and MPST fields are a menu with choices C and C. The default is C, thus monitors will normally be sent every time +the record processes. Selecting C causes a 32-bit hash of the VAL field buffer to be calculated and compared with the previous hash value every time the record processes; the monitor will only be sent if the hash is different, indicating that the buffer has changed. Note that there is a small chance that two different value buffers might result in the same hash value, so -for critical systems "Always" may be a better choice, even though it re-sends +for critical systems C may be a better choice, even though it re-sends duplicate data. -=head4 Record fields related to I - =fields APST, MPST, HASH -=head4 Menu choices for C and C fields +=head4 Menu aaiPOST + +These are the possible choices for the C and C fields: =menu aaiPOST @@ -312,7 +305,7 @@ Scan forward link if necessary, set PACT FALSE, and return. special(SPC_DBADDR) pp(TRUE) extra("void * val") - #=type DOUBLE[] + #=type DOUBLE[NELM] #=read Yes #=write Yes } @@ -434,7 +427,6 @@ Scan forward link if necessary, set PACT FALSE, and return. prompt("Hash of OnChange data.") interest(3) } -} =head2 Device Support @@ -485,7 +477,7 @@ C routine. long get_ioint_info(int cmd, dbCommon *precord, IOSCANPVT *ppvt) This routine is called by the ioEventScan system each time the record is added -or deleted from an I/O event scan list. cmd has the value (0,1) if the +or deleted from an I/O event scan list. C has the value (0,1) if the record is being (added to, deleted from) an I/O event list. It must be provided for any device type that can use the ioEvent scanner. @@ -521,3 +513,4 @@ in the array. If the INP link type is constant, then NORD is set to zero. =cut +} diff --git a/modules/database/src/std/rec/aaoRecord.dbd.pod b/modules/database/src/std/rec/aaoRecord.dbd.pod index 8b4faeed3..d4e8c5b59 100644 --- a/modules/database/src/std/rec/aaoRecord.dbd.pod +++ b/modules/database/src/std/rec/aaoRecord.dbd.pod @@ -18,8 +18,6 @@ device support to allocate the array storage. =cut -include "menuFtype.dbd" - menu(aaoPOST) { choice(aaoPOST_Always,"Always") choice(aaoPOST_OnChange,"On Change") @@ -54,14 +52,11 @@ The DTYP field must contain the name of the appropriate device support module. T values in the array referenced by are written to the location specified in the OUT field. (If the OUT link is a constant, no data are written.) NELM specifies the maximum number of elements that the array can hold, while FTVL specifies the data -type of the elements. +type of the elements (follow the link in the table below for a list of the +available choices). =fields DTYP, OUT, NELM, FTVL -=head4 Possible data types for FTVL - -=menu menuFtype - =head3 Operator Display Parameters These parameters are used to present meaningful data to the operator. They @@ -81,8 +76,9 @@ The PREC field determines the floating point precision with which to display the array values. It is used whenever the C<<< get_precision >>> record support routine is called. -See L for more on the record name (NAME) and -description (DESC) fields. +See L for more on the record name (NAME) and description (DESC) fields. + =fields EGU, HOPR, LOPR, PREC, NAME, DESC @@ -109,7 +105,9 @@ duplicate data. =fields APST, MPST, HASH -=head4 Menu choices for C and C fields +=head4 Menu aaoPOST + +These are the choices available for the C and C fields =menu aaoPOST @@ -434,7 +432,6 @@ Scan forward link if necessary, set PACT FALSE, and return. prompt("Hash of OnChange data.") interest(3) } -} =head2 Device Support @@ -475,7 +472,7 @@ with C set to 1. =head4 init_record - init_record(dbCommon *precord) + long init_record(dbCommon *precord) This routine is optional. If provided, it is called by the record support C routine. @@ -485,7 +482,7 @@ C routine. long get_ioint_info(int cmd, dbCommon *precord, IOSCANPVT *ppvt) This routine is called by the ioEventScan system each time the record is added -or deleted from an I/O event scan list. cmd has the value (0,1) if the +or deleted from an I/O event scan list. C has the value (0,1) if the record is being (added to, deleted from) an I/O event list. It must be provided for any device type that can use the ioEvent scanner. @@ -519,3 +516,4 @@ is written to the link. NORD is set to the number of items in the array. If the OUT link type is constant, then NORD is set to zero. =cut +} diff --git a/modules/database/src/std/rec/biRecord.dbd.pod b/modules/database/src/std/rec/biRecord.dbd.pod index ea4f43b22..449a68441 100644 --- a/modules/database/src/std/rec/biRecord.dbd.pod +++ b/modules/database/src/std/rec/biRecord.dbd.pod @@ -23,26 +23,7 @@ value into RVAL just like normal hardware modules. =head2 Parameter Fields -The binary input's fields fall into the following categories: - -=over - -=item * -scan Parameters - -=item * -read and convert parameters - -=item * -operator display parameters - -=item * -alarm parameters - -=item * -run-time parameters - -=back +The record-specific fields are described below, grouped by functionality. =recordtype bi @@ -53,12 +34,8 @@ recordtype(bi) { =head3 Scan Parameters The binary input record has the standard fields for specifying under what -circumstances the record will be processed. These fields are listed in -L. In addition, L explains how these -fields are used. Note that I/O event scanning is only supported for those -card types that interrupt. - -=fields SCAN +circumstances the record will be processed. +These fields are described in L. =head3 Read and Convert Parameters @@ -106,8 +83,8 @@ corresponding to the VAL's state. If the value is 1, C will return the string in the ONAM field; and if 0, C will return the ZNAM string. -See L for more on the record name (NAME) -and description (DESC) fields. +See L for more on the record name (NAME) and description (DESC) fields. =fields ZNAM, ONAM, NAME, DESC @@ -126,7 +103,7 @@ the one state. COSV causes an alarm whenever the state changes between 0 and 1 and the severity is configured as MINOR or MAJOR. See L for a complete explanation of the discrete alarm -states. L lists other fields related to alarms that are +states. L lists other fields related to alarms that are common to all record types. =fields ZSV, OSV, COSV @@ -160,8 +137,8 @@ is not equal to VAL. %/* Declare Device Support Entry Table */ %struct biRecord; %typedef struct bidset { - % dset common; /*init_record returns: (-1,0)=>(failure,success)*/ - % long (*read_bi)(struct biRecord *prec);/*(0,2)=> success and convert, don't convert); if convert then raw value stored in rval */ + % dset common; + % long (*read_bi)(struct biRecord *prec); %} bidset; %#define HAS_bidset % @@ -327,7 +304,7 @@ If device support includes C, it is called. long process(struct dbCommon *precord); -See L below. +See L below. long get_enum_str(const struct dbAddr *paddr, char *pbuffer); diff --git a/modules/database/src/std/rec/boRecord.dbd.pod b/modules/database/src/std/rec/boRecord.dbd.pod index fdc9191a0..bfbc8e820 100644 --- a/modules/database/src/std/rec/boRecord.dbd.pod +++ b/modules/database/src/std/rec/boRecord.dbd.pod @@ -48,7 +48,8 @@ recordtype(bo) { The binary output record has the standard fields for specifying under what circumstances the record will be processed. The fields are listed in -L. In addition, L explains how these + +L. In addition, L explains how these fields are used. Note that I/O event scanning is only supported for those card types that interrupt. @@ -147,8 +148,8 @@ corresponding to the VAL's state. So, if the value is 1, C will return the string in the ONAM field: and if 0, C will return the ZNAM string. -See L for more on the record name (NAME) -and description (DESC) fields. +See L for more on the record name (NAME) and description (DESC) fields. =fields ZNAM, ONAM, NAME, DESC @@ -164,8 +165,8 @@ C. The ZSV holds the severity for the zero state; OSV for the one state. COSV is used to cause an alarm whenever the state changes between states (0-1, 1-0) and its severity is configured as MINOR or MAJOR. -See L for more information on the IVOA and -IVOV fields. L lists other fields related to alarms that are +See L for more information on the IVOA and +IVOV fields. L lists other fields related to alarms that are common to all record types. =fields ZSV, OSV, COSV, IVOA, IVOV @@ -493,7 +494,7 @@ Check alarms: This routine checks to see if the new VAL causes the alarm status and severity to change. If so, NSEV, NSTA, and LALM are set. =item 4. -Check severity and write the new value. See L +Check severity and write the new value. See L for more information on how INVALID alarms affect output. =item 5. diff --git a/modules/database/src/std/rec/calcRecord.dbd.pod b/modules/database/src/std/rec/calcRecord.dbd.pod index 83b8edd76..b1d4242b4 100644 --- a/modules/database/src/std/rec/calcRecord.dbd.pod +++ b/modules/database/src/std/rec/calcRecord.dbd.pod @@ -16,32 +16,7 @@ then be used. =head2 Parameter Fields -The fields in the record fall into the following categories: - -=over 1 - -=item * -scan parameters - -=item * -read parameters - -=item * -expression parameters - -=item * -operator display parameters - -=item * -alarm parameters - -=item * -monitor parameters - -=item * -run-time parameters - -=back +The record-specific fields are described below, grouped by functionality. =recordtype calc @@ -52,13 +27,8 @@ recordtype(calc) { =head3 Scan Parameters The Calc record has the standard fields for specifying under what -circumstances the record will be processed. These fields are listed in -L. In addition, L explains how these -fields are used. Since the Calc record supports no direct interfaces to -hardware, it cannot be scanned on I/O interrupt, so its SCAN field cannot -be C. - -=fields SCAN +circumstances the record will be processed. +These fields are listed in L. =head3 Read Parameters @@ -466,8 +436,8 @@ solely for an operator's sake and does not have to be used. The HOPR and LOPR fields only refer to the limits of the VAL, HIHI, HIGH, LOW and LOLO fields. PREC controls the precision of the VAL field. -See L for more on the record name (NAME) -and description (DESC) fields. +See L for more on the record name (NAME) and description (DESC) fields. =fields EGU, PREC, HOPR, LOPR, NAME, DESC @@ -484,7 +454,7 @@ limit alarms for the VAL field and the severity corresponding to those conditions. The HYST field defines an alarm deadband for each limit. See L -for a complete explanation of alarms of these fields. L +for a complete explanation of alarms of these fields. L lists other fields related to alarms that are common to all record types. =fields HIHI, HIGH, LOW, LOLO, HHSV, HSV, LSV, LLSV, HYST diff --git a/modules/database/src/std/rec/calcoutRecord.dbd.pod b/modules/database/src/std/rec/calcoutRecord.dbd.pod index b38baa07f..9302ba410 100644 --- a/modules/database/src/std/rec/calcoutRecord.dbd.pod +++ b/modules/database/src/std/rec/calcoutRecord.dbd.pod @@ -22,35 +22,7 @@ Wait record. =head2 Parameter Fields -The fields in this record fall into these categories: - -=over 1 - -=item * -scan parameters - -=item * -read parameters - -=item * -expression parameters - -=item * -output parameters - -=item * -operator display parameters - -=item * -alarm parameters - -=item * -monitor parameters - -=item * -run-time parameters - -=back +The record-specific fields are described below, grouped by functionality. =recordtype calcout @@ -80,11 +52,8 @@ recordtype(calcout) { =head3 Scan Parameters The Calcout record has the standard fields for specifying under what -circumstances the record will be processed. The fields are listed in -L. In addition, L explains how these -fields are used. Since the Calcout record supports no direct interfaces to -hardware, it cannot be scanned on I/O interrupt, so its SCAN field cannot -be C. +circumstances the record will be processed. +These fields are listed in L. =head3 Read Parameters @@ -99,9 +68,6 @@ example, whether or not the specified PV was found and a link to it established. See L for an explanation of these fields. -See L
for information on how to specify database -links. - =fields INPA, INPB, INPC, INPD, INPE, INPF, INPG, INPH, INPI, INPJ, INPK, INPL =head3 Expression @@ -607,8 +573,8 @@ is set to one. The DLYA field is set to one during the delay specified in ODLY. -See L for more information on the record -name (NAME) and description (DESC) fields. +See L for more on the record name (NAME) and description (DESC) fields. =fields EGU, PREC, HOPR, LOPR, INAV, INBV, INCV, INDV, INEV, INFV, INGV, INHV, INIV, INJV, INKV, INLV, OUTV, CLCV, OCLV, DLYA, NAME, DESC diff --git a/modules/database/src/std/rec/compressRecord.dbd.pod b/modules/database/src/std/rec/compressRecord.dbd.pod index 3bc3416a7..d421fff5a 100644 --- a/modules/database/src/std/rec/compressRecord.dbd.pod +++ b/modules/database/src/std/rec/compressRecord.dbd.pod @@ -44,8 +44,6 @@ The record-specific fields are described below. =recordtype compress -... - =cut menu(compressALG) { @@ -70,7 +68,8 @@ The record-specific fields are described below, grouped by functionality. The compression record has the standard fields for specifying under what circumstances the record will be processed. These fields are listed in -L. In addition, L + +L. In addition, L explains how these fields are used. Since the compression record supports no direct interfaces to hardware, its SCAN field cannot specify C<<< I/O Intr >>>. @@ -197,14 +196,14 @@ PREC controls the floating-point precision whenever C<<< get_precision >>> is called, and the field being referenced is the VAL field (i.e., one of the values contained in the circular buffer). -See L -for more on the record name (NAME) and description (DESC) fields. +See L for more on the record name (NAME) and description (DESC) fields. =head3 Alarm Parameters The compression record has the alarm parameters common to all record types -described in L. +described in L. =head3 Run-time Parameters @@ -234,7 +233,7 @@ appropriate fields in the record. long process(struct dbCommon *precord) -See L below. +See L below. long special(struct dbAddr *paddr, int after) diff --git a/modules/database/src/std/rec/dfanoutRecord.dbd.pod b/modules/database/src/std/rec/dfanoutRecord.dbd.pod index 8943bf9b9..9aa632b55 100644 --- a/modules/database/src/std/rec/dfanoutRecord.dbd.pod +++ b/modules/database/src/std/rec/dfanoutRecord.dbd.pod @@ -16,32 +16,7 @@ device support. =head2 Parameter Fields -The fields in this record can be classified into the following categories: - -=over - -=item * -scan parameters - -=item * -desired output parameters - -=item * -write parameters - -=item * -operator display parameters - -=item * -alarm parameters - -=item * -monitor parameters - -=item * -run-time and simulation mode parameters - -=back +The record-specific fields are described below, grouped by functionality. =recordtype dfanout @@ -58,11 +33,8 @@ recordtype(dfanout) { =head3 Scan Parameters The data fanout record has the standard fields for specifying under what -circumstances it will be processed. These fields are listed in -L. In addition, L explains how these -fields are used. Since the data fanout record supports no direct interfaces -to hardware, it cannot be scanned on I/O interrupt, so its SCAN field -cannot be C. +circumstances it will be processed. +These fields are listed in L. =head3 Desired Output Parameters @@ -131,8 +103,8 @@ displays. They apply to the VAL, HIHI, HIGH, LOW, and LOLO fields. The record support routines C and C retrieve HOPR and LOPR. -See L for more on the record name (NAME) -and description (DESC) fields. +See L for more on the record name (NAME) and description (DESC) fields. =fields EGU, HOPR, LOPR, NAME, DESC @@ -148,7 +120,7 @@ NO_ALARM, MINOR, or MAJOR. In the hysteresis field (HYST) can be entered a number which serves as the deadband on the limit alarms. See L for a complete explanation of alarms and these -fields. L lists other fields related to alarms that are +fields. L lists other fields related to alarms that are common to all record types. =fields HIHI, HIGH, LOW, LOLO, HHSV, HSV, LSV, LLSV, HYST diff --git a/modules/database/src/std/rec/eventRecord.dbd.pod b/modules/database/src/std/rec/eventRecord.dbd.pod index 4004056b5..811c387da 100644 --- a/modules/database/src/std/rec/eventRecord.dbd.pod +++ b/modules/database/src/std/rec/eventRecord.dbd.pod @@ -15,27 +15,7 @@ handler routine for I/O Event-scanned records. =head2 Parameter Fields -The records in this field fall into the following groups of parameters: - -=over - -=item * - -scan parameters - -=item * - -read parameters - -=item * - -event number parameters - -=item * - -simulation mode parameters - -=back +The record-specific fields are described below, grouped by functionality. =recordtype event @@ -59,9 +39,8 @@ recordtype(event) { The event record has the standard fields for specifying under what circumstances it will be processed. If the SCAN field specifies C, then device support will provide an interrupt handler, posting an event number when an I/O -interrupt occurs. These fields are listed in L. In addition, -L explains how the scanning fields work. Note that I/O -event scanning is only supported for those card types that interrupt. +interrupt occurs. +These fields are listed in L. =head3 Event Number Parameters @@ -112,8 +91,9 @@ access link. For soft records, the DTYP field should specify C. =head3 Operator Display Parameters -See L for more on the record name (NAME) and -description (DESC) fields. +See L for more on the record name (NAME) and description (DESC) fields. + =fields NAME, DESC @@ -276,7 +256,7 @@ C routine. get_ioint_info(int cmd, struct dbCommon *precord, IOSCANPVT *ppvt) This routine is called by the ioEventScan system each time the record is added -or deleted from an I/O event scan list. cmd has the value (0,1) if the record is +or deleted from an I/O event scan list. C has the value (0,1) if the record is being (added to, deleted from) an I/O event list. It must be provided for any device type that can use the ioEvent scanner. diff --git a/modules/database/src/std/rec/fanoutRecord.dbd.pod b/modules/database/src/std/rec/fanoutRecord.dbd.pod index 11a9ad32e..9e186b4d7 100644 --- a/modules/database/src/std/rec/fanoutRecord.dbd.pod +++ b/modules/database/src/std/rec/fanoutRecord.dbd.pod @@ -17,27 +17,11 @@ process. If more than sixteen are needed, one of the forward links in the fanout record (or its FLNK field) can point to another fanout record. B The dfanout or -data fanout record can, on the other hand, send data to other records. +Data Fanout record can, on the other hand, send data to other records. =head2 Parameter Fields -The fanout record's fields fall into the following categories: - -=over - -=item * - -scan parameters - -=item * - -operator display parameters - -=item * - -run-time parameters. - -=back +The record-specific fields are described below, grouped by functionality. =recordtype fanout @@ -113,9 +97,7 @@ retrieved from SELL each time the record is processed and can also be changed via dbPuts. The Fanout record also has the standard scanning fields common to all records. -These fields are listed in L. In addition, -L explains in more detail how forward links and the -scanning algorithms work. +These fields are listed in L. =fields SELM, SELN, SELL, OFFS, SHFT, LNK0, LNK1, LNK2, LNK3, LNK4, LNK5, LNK6, LNK7, LNK8, LNK9, LNKA, LNKB, LNKC, LNKD, LNKE, LNKF @@ -238,15 +220,16 @@ scanning algorithms work. =head3 Operator Display Parameters These parameters are used to present meaningful data to the operator. See -L for more on these fields. +L +for more on these fields. =fields NAME, DESC =head3 Alarm Parameters The Fanout record has the alarm parameters common to all record types. -L lists other fields related to a alarms that are common to all -record types. +L lists the fields related to +alarms that are common to all record types. =head3 Run-time Parameters diff --git a/modules/database/src/std/rec/histogramRecord.dbd.pod b/modules/database/src/std/rec/histogramRecord.dbd.pod index a943102bf..261023084 100644 --- a/modules/database/src/std/rec/histogramRecord.dbd.pod +++ b/modules/database/src/std/rec/histogramRecord.dbd.pod @@ -52,16 +52,17 @@ These intervals are determined by dividing the range by NELM: These parameters are used to present meaningful data to the operator. These fields are used to display the value and other parameters of the histogram -either textually or graphically. See L for -more on the record name (NAME) and description (DESC) fields. +either textually or graphically. See +L +for more on the record name (NAME) and description (DESC) fields. =fields NAME, DESC =head3 Alarm Parameters The Histogram record has the alarm parameters common to all record types. -L lists other fields related to a alarms that are common to all -record types. +L lists the fields related to +alarms that are common to all record types. =head3 Monitor Parameters diff --git a/modules/database/src/std/rec/int64inRecord.dbd.pod b/modules/database/src/std/rec/int64inRecord.dbd.pod index e0eec467a..48e976155 100644 --- a/modules/database/src/std/rec/int64inRecord.dbd.pod +++ b/modules/database/src/std/rec/int64inRecord.dbd.pod @@ -43,10 +43,7 @@ that comes with Base. The INP link field contains a database or channel access link or provides hardware address information that the device support uses to determine where the input data should come from. -The format for the INP field value depends on the device support layer that is -selected by the DTYP field. -See L
for a description of the various hardware -address formats supported. + =head3 Operator Display Parameters diff --git a/modules/database/src/std/rec/int64outRecord.dbd.pod b/modules/database/src/std/rec/int64outRecord.dbd.pod index 167afbeff..e096ee5d5 100644 --- a/modules/database/src/std/rec/int64outRecord.dbd.pod +++ b/modules/database/src/std/rec/int64outRecord.dbd.pod @@ -74,10 +74,6 @@ that comes with Base. The OUT link field contains a database or channel access link or provides hardware address information that the device support uses to determine where the output data should be sent to. -The format for the OUT field value depends on the device support layer that is -selected by the DTYP field. -See L
for a description of the various hardware -address formats supported. =head3 Operator Display Parameters @@ -463,7 +459,7 @@ by at least HYST between level alarm status and severity changes. =item 4. -Check severity and write the new value. See L +Check severity and write the new value. See L for details on how invalid alarms affect output records. =item 5. diff --git a/modules/database/src/std/rec/longinRecord.dbd.pod b/modules/database/src/std/rec/longinRecord.dbd.pod index 3f929457c..498cf61c6 100644 --- a/modules/database/src/std/rec/longinRecord.dbd.pod +++ b/modules/database/src/std/rec/longinRecord.dbd.pod @@ -28,10 +28,8 @@ The record-specific fields are described below, grouped by functionality. =head3 Scan Parameters The long input record has the standard fields for specifying under what -circumstances the record will be processed. These fields are listed in L. In addition, L explains how these fields are -used. Note that I/O event scanning is only supported for those card types -that interrupt. +circumstances the record will be processed. +These fields are listed in L. =head3 Read Parameters @@ -43,9 +41,7 @@ I/O bus used. For soft records, the INP can be a constant, a database link, or a channel access link. The value is read directly into VAL. The C<<< Soft Channel >>> -device support module is available for longin records. See L
for information on the format of hardware addresses and a -database links. +device support module is available for longin records. =fields VAL, INP, DTYP @@ -62,8 +58,9 @@ The HOPR and LOPR fields set the upper and lower display limits for the VAL, HIHI, HIGH, LOW, and LOLO fields. Both the C<<< get_graphic_double >>> and C<<< get_control_double >>> record support routines retrieve these fields. -See L for more on the record name (NAME) and -description (DESC) fields. +See L for more on the record name (NAME) and description (DESC) fields. + =fields EGU, HOPR, LOPR, NAME, DESC @@ -76,10 +73,9 @@ routines. The limit alarms are configured by the user in the HIHI, LOLO, HIGH, and LOW fields using numerical values. For each of these fields, there is a corresponding severity field which can be either NO_ALARM, MINOR, or MAJOR. The -HYST field can be used to specify a deadband around each limit. See L for a complete explanation of alarms and these fields. L lists other fields related to a alarms that are common to all record -types. +HYST field can be used to specify a deadband around each limit. +L lists the fields related to +alarms that are common to all record types. =fields HIHI, HIGH, LOW, LOLO, HHSV, HSV, LSV, LLSV, HYST @@ -91,7 +87,7 @@ field (see the next section) by the appropriate deadband. If these fields have a value of zero, everytime the value changes, a monitor will be triggered; if they have a value of -1, everytime the record is scanned, monitors are triggered. The ADEL field is used by archive monitors and the MDEL field for all other types of -monitors. See L for a complete explanation of monitors. +monitors. =fields ADEL, MDEL @@ -100,7 +96,7 @@ monitors. See L for a complete explanation of monitors. The LALM, MLST, and ALST fields are used to implement the hysteresis factors for monitor callbacks. Only if the difference between these fields and the corresponding value field is greater than the appropriate delta (MDEL, ADEL, -HYST)--only then are monitors triggered. For instance, only if the difference +HYST) will monitors be triggered. For instance, only if the difference between VAL and MLST is greater than MDEL are the monitors triggered for VAL. =fields LALM, ALST, MLST @@ -275,7 +271,7 @@ C routine. get_ioint_info(int cmd,struct dbCommon *precord,IOSCANPVT *ppvt) This routine is called by the ioEventScan system each time the record is added -or deleted from an I/O event scan list. cmd has the value (0,1) if the +or deleted from an I/O event scan list. C has the value (0,1) if the record is being (added to, deleted from) an I/O event list. It must be provided for any device type that can use the ioEvent scanner. diff --git a/modules/database/src/std/rec/longoutRecord.dbd.pod b/modules/database/src/std/rec/longoutRecord.dbd.pod index 24e06d880..60037a62f 100644 --- a/modules/database/src/std/rec/longoutRecord.dbd.pod +++ b/modules/database/src/std/rec/longoutRecord.dbd.pod @@ -24,33 +24,13 @@ recordtype(longout) { =head2 Parameter Fields -The fields in this record fall into the following categories: - -=over - -=item * L - -=item * L - -=item * L - -=item * L - -=item * L - -=item * L - -=item * L - -=back +The record-specific fields are described below, grouped by functionality. =head3 Scan Parameters The longout record has the standard fields for specifying under what -circumstances it will be processed. These fields are listed in L. -In addition, L explains how these fields are used. Note -that I/O event scanning is only supported for those card types that -interrupt. +circumstances it will be processed. +These fields are listed in L. =head3 Desired Output Parameters @@ -141,8 +121,8 @@ The HOPR and LOPR fields set the upper and lower display limits for the VAL, HIHI, HIGH, LOW, and LOLO fields. Both the C<<< get_graphic_double >>> and C<<< get_control_double >>> record support routines retrieve these fields. -See L for more on the record name (NAME) and -description (DESC) fields. +See L for more on the record name (NAME) and description (DESC) fields. =fields EGU, HOPR, LOPR, NAME, DESC @@ -195,10 +175,10 @@ fields using floating-point values. For each of these fields, there is a corresponding severity field which can be either NO_ALARM, MINOR, or MAJOR. The HYST field contains the alarm deadband around each limit alarm. -See the See L for a complete explanation of alarms and +See L for a complete explanation of alarms and these fields. For an explanation of the IVOA and IVOV fields, see L. L lists other fields related to a alarms that are common -to all record types. +Records>. L lists the fields related to +alarms that are common to all record types. =fields HIHI, HIGH, LOW, LOLO, HHSV, HSV, LSV, LLSV, HYST, IVOA, IVOV @@ -482,7 +462,8 @@ before the alarm status and severity is lowered. =item 4. -Check severity and write the new value. See L for +Check severity and write the new value. See +L for information on how INVALID alarms affect output records. =item 5. @@ -569,7 +550,7 @@ C routine. get_ioint_info(int cmd,struct dbCommon *precord,IOSCANPVT *ppvt) This routine is called by the ioEventScan system each time the record is added -or deleted from an I/O event scan list. cmd has the value (0,1) if the +or deleted from an I/O event scan list. C has the value (0,1) if the record is being (added to, deleted from) an I/O event list. It must be provided for any device type that can use the ioEvent scanner. diff --git a/modules/database/src/std/rec/lsiRecord.dbd.pod b/modules/database/src/std/rec/lsiRecord.dbd.pod index e143982f5..035dc0cb4 100644 --- a/modules/database/src/std/rec/lsiRecord.dbd.pod +++ b/modules/database/src/std/rec/lsiRecord.dbd.pod @@ -24,8 +24,8 @@ recordtype(lsi) { =head3 Scan Parameters The long string input record has the standard fields for specifying under what -circumstances it will be processed. These fields are listed in L. -In addition, L explains how these fields are used. +circumstances it will be processed. +These fields are listed in L. =head3 Input Specification @@ -37,8 +37,6 @@ is processed and placed in the VAL field. The maximum number of characters in VAL is given by SIZV, and cannot be larger than 65535. In addition, the appropriate device support module must be entered into the DTYP field. -See L
for information on specifying links. - =fields VAL, OVAL, SIZV, INP, DTYP =cut @@ -59,7 +57,7 @@ See L
for information on specifying links. pp(TRUE) special(SPC_DBADDR) extra("char *val") - #=type STRING[SIZV] + #=type STRING or CHAR[SIZV] #=read Yes #=write Yes } @@ -68,7 +66,7 @@ See L
for information on specifying links. special(SPC_DBADDR) interest(3) extra("char *oval") - #=type STRING[SIZV] + #=type STRING or [SIZV] #=read Yes #=write No } @@ -119,16 +117,17 @@ APST is used for archiver monitors and MPST for all other type of monitors. =head3 Operator Display Parameters -See L for more on the record name (NAME) and -description (DESC) fields. +See L for more on the record name (NAME) and description (DESC) fields. + =fields NAME, DESC =head3 Alarm Parameters The long string input record has the alarm parameters common to all record -types. L lists other fields related to a alarms that are common to -all record types. +types. L lists the fields related to +alarms that are common to all record types. =head3 Run-time Parameters diff --git a/modules/database/src/std/rec/lsoRecord.dbd.pod b/modules/database/src/std/rec/lsoRecord.dbd.pod index 6056ac1d7..e072552ac 100644 --- a/modules/database/src/std/rec/lsoRecord.dbd.pod +++ b/modules/database/src/std/rec/lsoRecord.dbd.pod @@ -19,15 +19,13 @@ The record-specific fields are described below, grouped by functionality. =cut -include "menuIvoa.dbd" - recordtype(lso) { =head3 Scan Parameters The long string output record has the standard fields for specifying under what -circumstances it will be processed. These fields are listed in L. -In addition, L explains how these fields are used. +circumstances it will be processed. +These fields are listed in L. =head3 Desired Output Parameters @@ -49,8 +47,6 @@ interpreted as a CA link name. If you want to initialize your string output record, it is therefore best to use the VAL field. Note that if DOL is a constant, OMSL cannot be C. -See L
for information on specifying links. - =fields VAL, SIZV, DOL, OMSL =head3 Output Specification @@ -59,8 +55,6 @@ The output link specified in the OUT field specifies where the long string output record is to write its string. The link can be a database or channel access link. If the OUT field is a constant, no output will be written. -See L
for information on specifying links. - In addition, the appropriate device support module must be entered into the DTYP field. @@ -79,30 +73,22 @@ APST is used for archiver monitors and MPST for all other type of monitors. =head3 Operator Display Parameters -See L for more on the record name (NAME) and -description (DESC) fields. +See L for more on the record name (NAME) and description (DESC) fields. =fields NAME, DESC =head3 Alarm Parameters -The long string input record has the alarm parameters common to all record -types. L lists other fields related to a alarms that are common to -all record types. +The long string input record has the same alarm parameters common to all record +types. L lists the fields related to +alarms that are common to all record types. The IVOA field specifies an action to take when the INVALID alarm is triggered. -There are three possible actions: - -=head4 Menu menuIvoa - -=menu menuIvoa - When C<<< Set output to IVOV >>>, the value contained in the IVOV field is written to the output link during an alarm condition. See -L +L for more information on the IVOA and IVOV fields. -L -lists other fields related to a alarms that are common to all record types. =fields IVOA, IVOV @@ -124,12 +110,18 @@ lists other fields related to a alarms that are common to all record types. pp(TRUE) special(SPC_DBADDR) extra("char *val") + #=type STRING or CHAR[SIZV] + #=read Yes + #=write Yes } field(OVAL,DBF_NOACCESS) { prompt("Previous Value") special(SPC_DBADDR) interest(3) extra("char *oval") + #=type STRING or [SIZV] + #=read Yes + #=write No } field(SIZV,DBF_USHORT) { prompt("Size of buffers") @@ -266,26 +258,23 @@ for more information on simulation mode and its fields. } - =head2 Device Support Interface -The record requires device support to provide an entry table (dset) which -defines the following members: +The record defines a device support entry table type C in the generated +lsoRecord.h file as follows: - typedef struct { - long number; - long (*report)(int level); - long (*init)(int after); - long (*init_record)(lsoRecord *prec); - long (*get_ioint_info)(int cmd, lsoRecord *prec, IOSCANPVT *piosl); - long (*write_string)(lsoRecord *prec); + typedef struct lsodset { + dset common; + long (*write_string)(struct lsoRecord *prec); } lsodset; + #define HAS_lsodset -The module must set C to at least 5, and provide a pointer to its -C routine; the other function pointers may be C if their -associated functionality is not required for this support layer. -Most device supports also provide an C routine to configure the -record instance and connect it to the hardware or driver support layer. +The support module must set C to at least 5, and provide a +pointer to its C routine; the other function pointers may be +C if their associated functionality is not required for this support +layer. +Most device supports also provide a C routine to configure +the record instance and connect it to the hardware or driver support layer. =head2 Device Support for Soft Records diff --git a/modules/database/src/std/rec/mbbiDirectRecord.dbd.pod b/modules/database/src/std/rec/mbbiDirectRecord.dbd.pod index 38fc3f651..df0914d03 100644 --- a/modules/database/src/std/rec/mbbiDirectRecord.dbd.pod +++ b/modules/database/src/std/rec/mbbiDirectRecord.dbd.pod @@ -31,10 +31,8 @@ The record-specific fields are described below, grouped by functionality. =head3 Scan Parameters The mbbiDirect record has the standard fields for specifying under what -circumstances the record will be processed. These fields are listed in L. In addition, L explains how these fields are -used. Note that I/O event scanning is only supported for those card types -that interrupt. +circumstances the record will be processed. +These fields are listed in L. =head3 Read and Convert Parameters @@ -42,8 +40,7 @@ The device support routines obtain the record's input from the device or link specified in the INP field. For records that obtain their input from devices, the INP field must contain the address of the I/O card, and the DTYP field must specify the proper device support module. Be aware that the address format -differs according to the I/O bus used. See L
for -information on the format of hardware addresses. +differs according to the I/O bus used. Two soft device support modules can be specified in DTYP C and C<<< Raw Soft Channel >>>. @@ -53,8 +50,7 @@ upon which the normal conversion process is undergone. C<<< Soft Channel >>> reads any unsigned integer directly into VAL. For a soft mbbiDirect record, the INP field can be a constant, a database, or a channel access link. If INP is a constant, then the VAL is initialized to the INP value but can be changed at -run-time via dbPutField or dbPutLink. See L
for -information on how to database links. +run-time via dbPutField or dbPutLink. For records that don't use C<<< Soft Channel >>> device support, RVAL is used to determine VAL as follows: @@ -77,8 +73,9 @@ Each of the fields, B0-BF and B10-B1F, represents one bit of the word. These parameters are used to present meaningful data to the operator. -See L for more on the record name (NAME) and -description (DESC) fields. +See L for more on the record name (NAME) and description (DESC) fields. + =fields NAME, DESC @@ -220,14 +217,13 @@ for more information on simulation mode and its fields. =head3 Alarm Parameters -The possible alarm conditions for multi-bit binary input direct records are the -SCAN and READ alarms. These alarms are not configurable by the user since they -are always of MAJOR severity. See L for a complete -explanation of Scan and Read alarms. No fields exist for the mbbi direct record +The possible alarm conditions for multi-bit binary input direct records are the +SCAN and READ alarms. These alarms are not configurable by the user since they +are always of MAJOR severity. No fields exist for the mbbi direct record to have state alarms. -L lists other fields related to a alarms that are common to all -record types. +L lists the fields related to +alarms that are common to all record types. =cut @@ -545,7 +541,7 @@ also give SHFT a value. get_ioint_info(int cmd,struct dbCommon *precord,IOSCANPVT *ppvt) This routine is called by the ioEventScan system each time the record is added -or deleted from an IEO event scan list. cmd has the value (0,1) if the +or deleted from an IEO event scan list. C has the value (0,1) if the record is being (added to, deleted from) an IEO event list. It must be provided for any device type that can use the ioEvent scanner. diff --git a/modules/database/src/std/rec/mbbiRecord.dbd.pod b/modules/database/src/std/rec/mbbiRecord.dbd.pod index bc0ecbc81..14e932007 100644 --- a/modules/database/src/std/rec/mbbiRecord.dbd.pod +++ b/modules/database/src/std/rec/mbbiRecord.dbd.pod @@ -38,10 +38,8 @@ The record-specific fields are described below, grouped by functionality. =head3 Scan Parameters The multi-bit binary input record has the standard fields for specifying under -what circumstances it will be processed. These fields are listed in L. In addition, L explains how these fields are -used. Note that I/O event scanning is only supported for those card types that -interrupt. +what circumstances it will be processed. +These fields are listed in L. =head3 Read and Convert Parameters @@ -49,8 +47,7 @@ The device support routines obtain the record's input from the device or link specified in the INP field. For records that obtain their input from devices, the INP field must contain the address of the I/O card, and the DTYP field must specify the proper device support module. Be aware that the address format -differs according to the I/O bus used. See L
for -information on the format of hardware addresses. +differs according to the I/O bus used. Two soft device support modules can be specified in DTYP C and C<<< Raw Soft Channel >>>. @@ -60,8 +57,7 @@ upon which the normal conversion process is undergone. C<<< Soft Channel >>> reads any unsigned integer directly into VAL. For a soft mbbi record, the INP field can be a constant, a database, or a channel access link. If INP is a constant, then the VAL is initialized to the constant value but can be changed -at run-time via dbPutField or dbPutLink. See L
for -information on the format of database addresses. +at run-time via dbPutField or dbPutLink. MASK is used by the raw soft channel read routine, and by typical device support read routines, to select only the desired bits when reading the hardware @@ -111,8 +107,9 @@ record routines retrieve these strings for the operator. C<<< Get_enum_str >>> gets the string corresponding to the value set in VAL, and C<<< get_enum_strs >>> retrieves all the strings. -See L for more on the record name (NAME) and -description (DESC) fields. +See L for more on the record name (NAME) and description (DESC) fields. + =fields NAME, DESC, ZRST, ONST, TWST, THST, FRST, FVST, SXST, SVST, EIST, NIST, TEST, ELST, TVST, TTST, FTST, FFST @@ -417,7 +414,7 @@ state occurs, if set to MAJOR or MINOR. The other fields, when set to MAJOR or MINOR, trigger an alarm when VAL equals the corresponding state. See the See L for a complete -explanation of discrete alarms and these fields. L lists other +explanation of discrete alarms and these fields. L lists other fields related to a alarms that are common to all record types. =fields UNSV, COSV, ZRSV, ONSV, TWSV, THSV, FRSV, FVSV, SXSV, SVSV, EISV, NISV, TESV, ELSV, TVSV, TTSV, FTSV, FFSV @@ -885,7 +882,7 @@ also give SHFT a value. get_ioint_info(int cmd,struct dbCommon *precord,IOSCANPVT *ppvt) This routine is called by the ioEventScan system each time the record is added -or deleted from an I/O event scan list. cmd has the value (0,1) if the record is +or deleted from an I/O event scan list. C has the value (0,1) if the record is being (added to, deleted from) an I/O event list. It must be provided for any device type that can use the I/O Event scanner. diff --git a/modules/database/src/std/rec/mbboDirectRecord.dbd.pod b/modules/database/src/std/rec/mbboDirectRecord.dbd.pod index 6cea4c454..d15ad6448 100644 --- a/modules/database/src/std/rec/mbboDirectRecord.dbd.pod +++ b/modules/database/src/std/rec/mbboDirectRecord.dbd.pod @@ -28,10 +28,8 @@ The record-specific fields are described below, grouped by functionality. =head3 Scan Parameters The mbboDirect record has the standard fields for specifying under what -circumstances it will be processed. These fields are listed in L. -In addition, L explains how these fields are used. Note -that I/O event scanning is only supported for those card types that -interrupt. +circumstances it will be processed. +These fields are listed in L. =head3 Desired Output Parameters @@ -45,8 +43,7 @@ the DOL field is ignored and the current value of VAL is used. The desired output can be written into the VAL field via dpPuts at run-time when the record is in C<<< supervisory >>> mode. DOL can also be a constant, in which case VAL is initialized to the constant value. Note that OMSL cannot be C<<< closed_loop ->>> when DOL is a constant. See L
for information on how -to specify database links. +>>> when DOL is a constant. VAL is then converted to RVAL in the routine described in the next section. However, the C<<< Soft Channel >>> device support module for the mbboDirect @@ -75,15 +72,15 @@ routines--{Soft Channel} or C<<< Raw Soft Channel >>>. The difference between the two is that C<<< Soft Channel >>> writes the desired output value from VAL directly to the output link while C<<< Raw Soft Channel >>> writes the value from RVAL to the output link after it has undergone the conversion described -above. See L
for information on how to specify database -links. +above. =fields OUT, RVAL, SHFT, B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, BA, BB, BC, BD, BE, BF =head3 Operator Display Parameters -See L for more on the record name (NAME) and -description (DESC) fields. +See L for more on the record name (NAME) and description (DESC) fields. + =fields NAME, DESC @@ -252,9 +249,9 @@ The IVOA field specifies an action to take when the INVALID alarm is triggered. There are three possible actions: C<<< Continue normally >>>, C<<< Don't drive outputs >>>, or C<<< Set output to IVOV >>>. When C<<< Set output to IVOV >>> is specified and a INVALID alarm is triggered, the record will write the value in -the IVOV field to output. See L for more -information. L lists other fields related to a alarms that are -common to all record types. +the IVOV field to output. See L for more +information. L lists the fields related to +alarms that are common to all record types. =fields IVOA, IVOV @@ -656,7 +653,7 @@ SHFT given a value. get_ioint_info(int cmd,struct dbCommon *precord,IOSCANPVT *ppvt) This routine is called by the ioEventScan system each time the record is added -or deleted from an I/O event scan list. cmd has the value (0,1) if the +or deleted from an I/O event scan list. C has the value (0,1) if the record is being (added to, deleted from) an I/O event list. It must be provided for any device type that can use the ioEvent scanner. diff --git a/modules/database/src/std/rec/mbboRecord.dbd.pod b/modules/database/src/std/rec/mbboRecord.dbd.pod index 3e43929b2..56d031760 100644 --- a/modules/database/src/std/rec/mbboRecord.dbd.pod +++ b/modules/database/src/std/rec/mbboRecord.dbd.pod @@ -28,9 +28,8 @@ The record-specific fields are described below, grouped by functionality. =head3 Scan Parameters The mbbo record has the standard fields for specifying under what circumstances -it will be processed. These fields are listed in L. In addition, -L explains how these fields are used. Note that I/O -event scanning is only supported for those card types that interrupt. +it will be processed. +These fields are listed in L. =head3 Desired Output Parameters @@ -64,8 +63,7 @@ constant, no value will be written. For records that write their values to hardware devices, the OUT output link must specify the address of the I/O card, and the DTYP field must specify the corresponding device support module. Be aware that the address format -differs according to the I/O bus used. See L
for -information on the format of hardware addresses. +differs according to the I/O bus used. For mbbo records that write to hardware, the value written to the output location is the value contained in RVAL, which is converted from VAL, VAL @@ -87,8 +85,7 @@ constant, then the DTYP field must specify either one of the two soft device support modules-- C<<< Soft Channel >>> or C<<< Raw Soft Channel >>>. C<<< Soft >>> C<<< Channel >>> writes the value of VAL to the output link, without any conversion, while C<<< Raw Soft Channel >>> writes the value from RVAL after it -has undergone the above conversion. See L
for information -on specifying links. +has undergone the above conversion. Note also that when a string is retrieved as the desired output, a record support routine is provided (C<<< put_enum_str() >>>) that will check to see @@ -108,8 +105,8 @@ C<<< get_enum_strs() >>> record routines retrieve these strings for the operator. C<<< get_enum_str() >>> gets the string corresponding to the value in VAL, and C<<< get_enum_strs() >>> retrieves all the strings. -See L for more on the record name (NAME) and -description (DESC) fields. +See L for more on the record name (NAME) and description (DESC) fields. =fields NAME, DESC, ZRST, ONST, TWST, THST, FRST, FVST, SXST, SVST, EIST, NIST, TEST, ELST, TVST, TTST, FTST, FFST @@ -138,10 +135,10 @@ state changes, if set to MAJOR or MINOR. The state severity (ZRSV-FFSV) fields, when set to MAJOR or MINOR, trigger an alarm when VAL equals the corresponding field. -See L for a complete explanation of discrete alarms and -these fields. See L for an explanation of the IVOA -and IVOV fields. L lists other fields related to a alarms that are -common to all record types. +See L +for an explanation of the IVOA and IVOV fields. +L lists the fields related to +alarms that are common to all record types. =fields UNSV, COSV, IVOA, IVOV, ZRSV, ONSV, TWSV, THSV, FRSV, FVSV, SXSV, SVSV, EISV, NISV, TESV, ELSV, TVSV, TTSV, FTSV, FFSV @@ -705,7 +702,6 @@ for more information on simulation mode and its fields. promptgroup("50 - Output") interest(2) } -} =head2 Record Support @@ -858,8 +854,10 @@ and severity to change. If so, NSEV, NSTA and LALM are set. =item 5. -Check severity and write the new value. See L and L for more information. +Check severity and write the new value. See +L and +L for +more information. =item 6. @@ -944,7 +942,7 @@ given a value. get_ioint_info(int cmd,struct dbCommon *precord,IOSCANPVT *ppvt) This routine is called by the ioEventScan system each time the record is added -or deleted from an I/O event scan list. cmd has the value (0,1) if the +or deleted from an I/O event scan list. C has the value (0,1) if the record is being (added to, deleted from) an I/O event list. It must be provided for any device type that can use the ioEvent scanner. @@ -975,7 +973,7 @@ The C<<< Soft Channel >>> module writes the current value of VAL. If the OUT link type is PV_LINK, then dbCaAddInlink is called by C. -write_mbbo calls recGblPutLinkValue to write the current value of VAL. See +C calls C to write the current value of VAL. See L for more information. =head4 Raw Soft Channel @@ -984,3 +982,4 @@ This module writes RVAL to the location specified in the output link. It returns a 0. =cut +} diff --git a/modules/database/src/std/rec/permissiveRecord.dbd.pod b/modules/database/src/std/rec/permissiveRecord.dbd.pod index 5ad979f74..0d9e1f612 100644 --- a/modules/database/src/std/rec/permissiveRecord.dbd.pod +++ b/modules/database/src/std/rec/permissiveRecord.dbd.pod @@ -31,9 +31,7 @@ The record-specific fields are described below, grouped by functionality. The permissive record has the standard fields for specifying under what circumstances the record will be processed. These fields are listed in -L. In addition, L explains how these -fields are used. Since the permissive record supports no direct interfaces to -hardware, its SCAN field cannot be C<<< I/O Intr >>>. +L. =head3 Client-server Parameters @@ -87,8 +85,8 @@ description (DESC) fields. =head3 Alarm Parameters The Permissive record has the alarm parameters common to all record types. -L lists other fields related to a alarms that are common to all -record types. +L lists the fields related to +alarms that are common to all record types. =head3 Run-time Parameters diff --git a/modules/database/src/std/rec/printfRecord.dbd.pod b/modules/database/src/std/rec/printfRecord.dbd.pod index 5756daf86..d30dc0a0d 100644 --- a/modules/database/src/std/rec/printfRecord.dbd.pod +++ b/modules/database/src/std/rec/printfRecord.dbd.pod @@ -24,8 +24,8 @@ recordtype(printf) { =head3 Scan Parameters The printf record has the standard fields for specifying under what -circumstances it will be processed. These fields are listed in L. -In addition, L explains how these fields are used. +circumstances it will be processed. +These fields are listed in L. =head3 String Generation Parameters @@ -154,8 +154,6 @@ The output link specified in the OUT field specifies where the printf record is to write the contents of its VAL field. The link can be a database or channel access link. If the OUT field is a constant, no output will be written. -See L
for information on specifying links. - In addition, the appropriate device support module must be entered into the DTYP field. @@ -163,8 +161,9 @@ field. =head3 Operator Display Parameters -See L for more on the record name (NAME) and -description (DESC) fields. +See L for more on the record name (NAME) and description (DESC) fields. + =fields NAME, DESC @@ -217,8 +216,8 @@ description (DESC) fields. =head3 Alarm Parameters The printf record has the alarm parameters common to all record types. -L lists other fields related to a alarms that are common to all -record types. +L lists the fields related to +alarms that are common to all record types. The IVLS field specifies a string which is sent to the OUT link if if input link data are invalid. diff --git a/modules/database/src/std/rec/selRecord.dbd.pod b/modules/database/src/std/rec/selRecord.dbd.pod index fe8301db6..42dcccd77 100644 --- a/modules/database/src/std/rec/selRecord.dbd.pod +++ b/modules/database/src/std/rec/selRecord.dbd.pod @@ -33,9 +33,8 @@ The record-specific fields are described below, grouped by functionality. =head3 Scan Parameters The select record has the standard fields for specifying under what -circumstances the record will be processed. These fields are listed in -L. In addition, L -explains how these fields work. +circumstances the record will be processed. +These fields are listed in L. =head3 Read Parameters @@ -45,8 +44,7 @@ links configured by the user to be either constants, channel access links, or database links. If channel access or database links, a value is retrieved for each link and placed in the corresponding value field, A-L. If any input link is a constant, the value field for that link will be initialized with the constant -value given to it and can be modified via dbPuts. See L
-for information on how to specify database links. +value given to it and can be modified via dbPuts. Any links not defined are ignored by the selection record and its algorithm. An undefined link is any constant link whose value is 0. At initialization time, @@ -80,8 +78,7 @@ SELN's value. NVL is an input link from which a value for SELN can be retrieved, Like most other input links NVL can be a constant, or a channel access or database link. If NVL is a link, SELN is retrieved from the location in NVL. If a constant, SELN is initialized to the value given to the constant and can be -changed via dbPuts. See L
for information on how to -specify database links. +changed via dbPuts. The C<<< High Signal >>>, C<<< Low Signal >>>, and C<<< Median Signal >>> algorithms do not use SELN or NVL. If C<<< High Signal >>> is chosen, VAL is set @@ -113,8 +110,8 @@ The PREC field determines the floating point precision with which to display VAL. It is used whenever the C<<< get_precision >>> record support routine is called. -See L for more on the record name (NAME) -and description (DESC) fields. +See L for more on the record name (NAME) and description (DESC) fields. =fields EGU, HOPR, LOPR, PREC, NAME, DESC @@ -125,9 +122,9 @@ alarms. The SCAN and READ alarms are called by the record or device support routines. The limit alarms are configured by the user in the HIHI, LOLO, HIGH, and LOW fields using numerical values. They specify conditions for the VAL field. For each of these fields, there is a corresponding severity field which -can be either NO_ALARM, MINOR, or MAJOR. See L -for a complete explanation of alarms and these fields. L -lists other fields related to a alarms that are common to all record types. +can be either NO_ALARM, MINOR, or MAJOR. +L lists the fields related to +alarms that are common to all record types. =fields HIHI, HIGH, LOW, LOLO, HHSV, HSV, LSV, LLSV, HYST @@ -138,8 +135,7 @@ archiver and monitor calls for the VAL field. Unless, VAL changes by more than the value specified by each, then the respective monitors will not be called. If these fields have a value of zero, everytime the VAL changes, monitors are triggered; if they have a value of -1, everytime the record is processed, -monitors are triggered. L -gives a complete explanation of alarms and deadbands. +monitors are triggered. =fields ADEL, MDEL @@ -183,7 +179,7 @@ is created. long (*process)(struct dbCommon *precord) -See L. +See L. =head4 get_units diff --git a/modules/database/src/std/rec/seqRecord.dbd.pod b/modules/database/src/std/rec/seqRecord.dbd.pod index 00c1229e9..6544a5f9a 100644 --- a/modules/database/src/std/rec/seqRecord.dbd.pod +++ b/modules/database/src/std/rec/seqRecord.dbd.pod @@ -35,8 +35,8 @@ The record-specific fields are described below, grouped by functionality. =head3 Scan Parameters The sequence record has the standard fields for specifying under what -circumstances it will be processed. These fields are listed in L. -In addition, L explains how these fields are used. +circumstances it will be processed. +These fields are listed in L. =head3 Desired Output Parameters @@ -48,15 +48,13 @@ The sequence record can retrieve up to 16 values from 16 locations. The user specifies the locations in the Desired Output Link fields (DOL0-DOLF), which can be either constants, database links, or channel access links. If a Desired Output Link is a constant, the corresponding value field for that link is -initialized to the constant value and ''cannot'' be changed via dbputs. +initialized to the constant value. Otherwise, if the Desired Output Link is a database or channel access link, a -value is fetched from the link each time the record is processed (provided that -the output link is part of the record's selection algorithm). See L
for information on how to specify database links. +value is fetched from the link each time the record is processed. The value fetched from the Desired Output Links are stored in the corresponding Desired Output Value fields (DO0-DOF). These fields can be initialized to a -constant value, but they cannot be changed via dbPuts. +constant value, and may subsequently be changed via dbPuts. =head4 Desired Output Link Fields @@ -97,19 +95,23 @@ See L below; B -This field can be initialized as a CONSTANT or as a LINK to any other record. SELN will fetch its value from this field when the seq record is processed. -Thus, when using I or I modes, the links that seq will process can be dinamically changed by the record pointed by SELL. +This field can be initialized as a CONSTANT or as a LINK to any other record. +SELN will fetch its value from this field when the seq record is processed. +Thus, when using C or C modes, the links that seq will +process can be dynamically changed by the record pointed by SELL. B -When B> this is the index number of the link that will be processed, used in combination with the C field: +When B> this is the index number of the link that will be +processed, used in combination with the C field: SELN = SELN + OFFS I<(By default, the OFFS is initalized to ZERO)> -When B> this field is the bitmask that will be used to determine which links will be processed by the seq record, +When B> this field is the bitmask that will be used to determine +which links will be processed by the seq record, in combination with the C field: if (SHFT >= 0) @@ -121,11 +123,15 @@ I<(By default, the SHFT is initalized to -1)> =head4 B -The first versions of seq record had DO, DOL, LNK and DLY fields starting with index ONE (DO1, DOL1, LNK1 and DLY1). -New version of the seq record now supports 16 links, starting by index ZERO (DO0, DOL0, LNK0 and DLY0). The SHFT and OFFS fields -were introduced to keep compatibility of old databases that used seq record with its links indexed from one onwards. +The first versions of seq record had DO, DOL, LNK and DLY fields starting with +index ONE (DO1, DOL1, LNK1 and DLY1). +Since EPICS 7 the seq record now supports 16 links, starting from index ZERO +(DO0, DOL0, LNK0 and DLY0). +The SHFT and OFFS fields were introduced to keep compatibility of old databases +that used seq records with links indexed from one. -B +B =head4 Selection Algorithms Description @@ -179,16 +185,17 @@ Precision field (PREC) determines the decimal precision for the VAL field when it is displayed. It is used when the C<<< get_precision >>> record routine is called. -See L for more on the record name (NAME) and -description (DESC) fields. +See L for more on the record name (NAME) and description (DESC) fields. + =fields PREC, NAME, DESC =head3 Alarm Parameters The sequence record has the alarm parameters common to all record types. -L lists other fields related to a alarms that are common to all -record types. +L lists the fields related to +alarms that are common to all record types. =head2 Record Support diff --git a/modules/database/src/std/rec/stateRecord.dbd.pod b/modules/database/src/std/rec/stateRecord.dbd.pod index 2e582c292..de1cb3942 100644 --- a/modules/database/src/std/rec/stateRecord.dbd.pod +++ b/modules/database/src/std/rec/stateRecord.dbd.pod @@ -30,21 +30,22 @@ The record-specific fields are described below, grouped by functionality. =head3 Scan Parameters The state record has the standard fields for specifying under what circumstances -it will be processed. These fields are listed in L. In addition, -L explains how these fields are used. +it will be processed. +These fields are listed in L. =head3 Operator Display Parameters -See L for more on the record name (NAME) and -description (DESC) fields. +See L for more on the record name (NAME) and description (DESC) fields. + =fields NAME, DESC =head3 Alarm Parameters The state record has the alarm parameters common to all record types. -L lists other fields related to a alarms that are common to all -record types. +L lists the fields related to +alarms that are common to all record types. =head3 Run-time Parameters diff --git a/modules/database/src/std/rec/stringinRecord.dbd.pod b/modules/database/src/std/rec/stringinRecord.dbd.pod index b4b9abb9f..2c7aab439 100644 --- a/modules/database/src/std/rec/stringinRecord.dbd.pod +++ b/modules/database/src/std/rec/stringinRecord.dbd.pod @@ -54,8 +54,8 @@ The record-specific fields are described below, grouped by functionality. =head3 Scan Parameters The string input record has the standard fields for specifying under what -circumstances it will be processed. These fields are listed in L. -In addition, L explains how these fields are used. +circumstances it will be processed. +These fields are listed in L. =head3 Input Specification @@ -67,8 +67,6 @@ placed in the VAL field. The maximum number of characters that the string in VAL can be is 40. In addition, the appropriate device support module must be entered into the DTYP field. -See L
for information on specifying links. - =fields VAL, INP, DTYP =cut @@ -109,16 +107,17 @@ APST is used for archiver monitors and MPST is for all other type of monitors. =head3 Operator Display Parameters -See L for more on the record name (NAME) and -description (DESC) fields. +See L for more on the record name (NAME) and description (DESC) fields. + =fields NAME, DESC =head3 Alarm Parameters The string input record has the alarm parameters common to all record types. -L lists other fields related to a alarms that are common to all -record types. +L lists the fields related to +alarms that are common to all record types. =head3 Run-time Parameters @@ -345,9 +344,13 @@ This routine must provide a new input value. It returns the following values: =over -=item * 0: Success. A new ASCII string is stored into VAL. +=item * -=item * Other: Error. +0: Success. A new ASCII string is stored into VAL. + +=item * + +Other: Error. =back @@ -355,9 +358,10 @@ This routine must provide a new input value. It returns the following values: The C<<< Soft Channel >>> module reads a value directly into VAL. -Device support for DTYP C is provided for retrieving strings from environment variables. -C addressing C!!@ !!is used on the C link field to select the -desired environment variable. +Device support for DTYP C is provided for retrieving strings from +environment variables. +C addressing C<<< @ >>> is used in the INP +link field to select the desired environment variable. =cut diff --git a/modules/database/src/std/rec/stringoutRecord.dbd.pod b/modules/database/src/std/rec/stringoutRecord.dbd.pod index 0791e2fbd..7c4d6299b 100644 --- a/modules/database/src/std/rec/stringoutRecord.dbd.pod +++ b/modules/database/src/std/rec/stringoutRecord.dbd.pod @@ -16,12 +16,11 @@ characters to other records or software variables. =cut -include "menuIvoa.dbd" - menu(stringoutPOST) { choice(stringoutPOST_OnChange,"On Change") choice(stringoutPOST_Always,"Always") } + recordtype(stringout) { include "dbCommon.dbd" % @@ -55,10 +54,8 @@ The record-specific fields are described below, grouped by functionality. =head3 Scan Parameters The string output record has the standard fields for specifying under what -circumstances it will be processed. These fields are listed in -L. -In addition, L -explains how these fields are used. +circumstances it will be processed. +These fields are listed in L. =head3 Desired Output Parameters @@ -72,13 +69,11 @@ field's value is obtained from the address specified in the desired output location field (DOL) which can be either a database link or a channel access link. -DOL can also be a constant in addition to a link, in which case VAL is -initialized to the constant value. However, your string constant may be -interpreted as a CA link name, so if you want to initialize your string output -record, it's best to use the VAL field. Note that if DOL is a constant, OMSL -cannot be C<<< closed_loop. >>> See -L
-for information on specifying links. +DOL can also be a constant, in which case VAL will be initialized to the +constant value. However to be interpreted as a constant instead of a CA link +the constant can only be numeric, so string output records are best initialized +by dirctly setting the VAL field. Note that if DOL is a constant, OMSL +cannot be C<<< closed_loop >>>. =fields VAL, DOL, OMSL @@ -100,8 +95,7 @@ for information on specifying links. The output link specified in the OUT field specifies where the string output record is to write its string. The link can be a database or channel access -link. If the OUT field is a constant, no output will be written. See L
for information on specifying links. +link. If the OUT field is a constant, no output will be written. In addition, the appropriate device support module must be entered into the DTYP field. @@ -150,8 +144,8 @@ These parameters are used to present meaningful data to the operator. These fields are used to display the value and other parameters of the string output either textually or graphically. -See L -for more on the record name (NAME) and description (DESC) fields. +See L for more on the record name (NAME) and description (DESC) fields. =fields NAME, DESC @@ -235,18 +229,13 @@ and INVALID alarms. The severity of the first two is always MAJOR and not configurable. The IVOA field specifies an action to take when the INVALID alarm is triggered. -There are three possible actions: - -=head4 Menu menuIvoa - -=menu menuIvoa - When C<<< Set output to IVOV >>>, the value contained in the IVOV field is written to the output link during an alarm condition. See -L +L for more information on the IVOA and IVOV fields. -L -lists other fields related to a alarms that are common to all record types. + +L lists the fields related to +alarms that are common to all record types. =fields IVOA, IVOV @@ -291,7 +280,7 @@ If device support includes C, it is called. long (*process)(struct dbCommon *precord) -See L. +See L. =head3 Record Processing @@ -315,8 +304,8 @@ If the return status of recGblGetLinkValue is zero then UDF is set to FALSE. =item 3. Check severity and write the new value. See -L -and L +L and +L for details on how the simulation mode and the INVALID alarm conditions affect output. =item 4. diff --git a/modules/database/src/std/rec/subArrayRecord.dbd.pod b/modules/database/src/std/rec/subArrayRecord.dbd.pod index b2d0141cc..8a95b142e 100644 --- a/modules/database/src/std/rec/subArrayRecord.dbd.pod +++ b/modules/database/src/std/rec/subArrayRecord.dbd.pod @@ -36,17 +36,14 @@ The record-specific fields are described below, grouped by functionality. =head3 Scan Parameters The subArray record has the standard fields for specifying under what -circumstances the record will be processed. These fields are listed in -L. -In addition, L explains how these fields are used. +circumstances the record will be processed. +These fields are listed in L. =head3 Read Parameters The subArray's input link (INP) should be configured to reference the Waveform record. It should specify the VAL field of a Waveform record. The INP field can -be a channel access link, in addition to a database link. See -L
-for information on specifying links. +be a channel access link, in addition to a database link. In addition, the DTYP field must specify a device support module. Currently, the only device support module is C. @@ -94,16 +91,16 @@ The PREC field determines the floating point precision with which to display VAL. It is used whenever the C record support routine is called. -See L -for more on the record name (NAME) and description (DESC) fields. +See L for more on the record name (NAME) and description (DESC) fields. =fields EGU, HOPR, LOPR, PREC, NAME, DESC =head3 Alarm Parameters The subarray record has the alarm parameters common to all record types. -L lists other fields related to a alarms that are common to all -record types. +L lists the fields related to +alarms that are common to all record types. =head3 Run-time Parameters @@ -144,7 +141,7 @@ C, it is called. long (*process)(struct dbCommon *precord) -See L. +See L. =head4 cvt_dbaddr diff --git a/modules/database/src/std/rec/subRecord.dbd.pod b/modules/database/src/std/rec/subRecord.dbd.pod index 98166c383..0a63d1d0b 100644 --- a/modules/database/src/std/rec/subRecord.dbd.pod +++ b/modules/database/src/std/rec/subRecord.dbd.pod @@ -25,9 +25,8 @@ The record-specific fields are described below, grouped by functionality. =head3 Scan Parameters The subroutine record has the standard fields for specifying under what -circumstances it will be processed. These fields are listed in -L. In addition, L -explains how these fields are used. +circumstances it will be processed. +These fields are described in L. =head3 Read Parameters @@ -39,7 +38,7 @@ The input links can be either channel access or database links, or constants. When constants, the corresponding value field for the link is initialized with the constant value and the field's value can be changed at run-time via dbPuts. Otherwise, the values for (A-F) are fetched from the input links when the record -is processed. See L
for information on specifying links. +is processed. =fields INPA, INPB, INPC, INPD, INPE, INPF, INPG, INPH, INPI, INPJ, INPK, INPL, A, B, C, D, E, F, G, H, I, J, K, L @@ -69,8 +68,8 @@ The PREC field determines the floating point precision with which to display VAL. It is used whenever the C<<< get_precision >>> record support routine is called. -See L -for more on the record name (NAME) and description (DESC) fields. +See L for more on the record name (NAME) and description (DESC) fields. =fields EGU, HOPR, LOPR, PREC, NAME, DESC @@ -85,9 +84,10 @@ these fields, there is a corresponding severity field which can be either NO_ALARM, MINOR, or MAJOR. The BRSV field is where the user can set the alarm severity in case the -subroutine returns a negative value. See L -for a complete explanation of alarms and these fields. L -lists other fields related to a alarms that are common to all record types. +subroutine returns a negative value. + +L lists the fields related to +alarms that are common to all record types. =fields HIHI, HIGH, LOW, LOLO, HHSV, HSV, LSV, LLSV, BRSV, HYST @@ -101,8 +101,7 @@ minimum delta which the change must surpass before the value-change monitors are invoked. If these fields have a value of zero, everytime the value changes, a monitor will be triggered; if they have a value of -1, everytime the record is processed, monitors are triggered. The ADEL field is used by archive monitors -and the MDEL field for all other types of monitors. See L -for a complete explanation of monitors and deadbands. +and the MDEL field for all other types of monitors. =fields ADEL, MDEL @@ -142,7 +141,7 @@ The processing subroutine is located and its address stored in SADR. long (*process)(struct dbCommon *precord) -See L. +See L. =head4 get_units @@ -218,7 +217,12 @@ If return value is 1, return =item 3. -Check alarms. This routine checks to see if the new VAL causes the alarm status and severity to change. If so, NSEV, NSTA and LALM are set. It also honors the alarm hysteresis factor (HYST). Thus the value must change by more than HYST before the alarm status and severity is lowered. +Check alarms. This routine checks to see if the new VAL causes the alarm status +and severity to change. +If so, NSEV, NSTA and LALM are set. +It also honors the alarm hysteresis factor (HYST). +Thus the value must change by more than HYST before the alarm status and +severity is lowered. =item 4. diff --git a/modules/database/src/std/rec/waveformRecord.dbd.pod b/modules/database/src/std/rec/waveformRecord.dbd.pod index 19116a9da..d787b7bbd 100644 --- a/modules/database/src/std/rec/waveformRecord.dbd.pod +++ b/modules/database/src/std/rec/waveformRecord.dbd.pod @@ -17,8 +17,6 @@ types. =cut -include "menuFtype.dbd" - menu(waveformPOST) { choice(waveformPOST_Always,"Always") choice(waveformPOST_OnChange,"On Change") @@ -33,10 +31,8 @@ The record-specific fields are described below, grouped by functionality. =head3 Scan Parameters The waveform record has the standard fields for specifying under what -circumstances the record will be processed. These fields are listed in L. In addition, L explains how these fields are -used. Note that I/O event scanning is only supported for those card types that -interrupt. +circumstances the record will be processed. +These fields are listed in L. =head3 Read Parameters @@ -45,9 +41,7 @@ record reads its data. How the INP field is configured determines where the waveform gets its input. It can be a hardware address, a channel access or database link, or a constant. Only in records that use soft device support can the INP field be a channel access link, a database link, or a constant. -Otherwise, the INP field must be a hardware address. See L
for information on the format of hardware addresses and database -links. +Otherwise, the INP field must be a hardware address. =head4 Fields related to waveform reading @@ -57,12 +51,11 @@ The DTYP field must contain the name of the appropriate device support module. The values retrieved from the input link are placed in an array referenced by VAL. (If the INP link is a constant, elements can be placed in the array via dbPuts.) NELM specifies the number of elements that the array will hold, while -FTVL specifies the data type of the elements. -The RARM field causes the device to re-arm when this field is set to 1. +FTVL specifies the data type of the elements (follow the link in the table +above for a list of the available choices). -=head4 Possible data types for FTVL - -=menu menuFtype +The RARM field used to cause some device types to re-arm when it was set to 1, +but we don't know of any such devices any more. =head3 Operator Display Parameters @@ -85,34 +78,36 @@ The PREC field determines the floating point precision with which to display the array values. It is used whenever the C<<< get_precision >>> record support routine is called. -See L for more on the record name (NAME) and -description (DESC) fields. +See L for more on the record name (NAME) and description (DESC) fields. =head3 Alarm Parameters -The waveform record has the alarm parameters common to all record types. L lists other fields related to a alarms that are common to all record -types. +The waveform record has the alarm parameters common to all record types. +L lists the fields related to +alarms that are common to all record types. =head3 Monitor Parameters These parameters are used to determine when to send monitors placed on the VAL -field. The APST and MPST fields are a menu with choices "Always" and "On -Change". The default is "Always", thus monitors will normally be sent every time -the record processes. Selecting "On Change" causes a 32-bit hash of the VAL +field. +The APST and MPST fields are a menu with choices C and C. +The default is C, thus monitors will normally be sent every time +the record processes. +Selecting C causes a 32-bit hash of the VAL field buffer to be calculated and compared with the previous hash value every time the record processes; the monitor will only be sent if the hash is different, indicating that the buffer has changed. Note that there is a small chance that two different value buffers might result in the same hash value, so -for critical systems "Always" may be a better choice, even though it re-sends +for critical systems C may be a better choice, even though it re-sends duplicate data. -=head4 Record fields related to I - =fields APST, MPST, HASH -=head4 Menu choices for C and C fields +=head4 Menu waveformPOST + +This menu defines the possible choices for C and C fields: =menu waveformPOST @@ -179,7 +174,7 @@ If device support includes C, it is called. static long process(waveformRecord *prec) -See L section below. +See L section below. =head4 cvt_dbaddr @@ -347,7 +342,7 @@ C routine. long get_ioint_info(int cmd, dbCommon *precord, IOSCANPVT *ppvt) This routine is called by the ioEventScan system each time the record is added -or deleted from an I/O event scan list. cmd has the value (0,1) if the +or deleted from an I/O event scan list. C has the value (0,1) if the record is being (added to, deleted from) an I/O event list. It must be provided for any device type that can use the ioEvent scanner. diff --git a/src/tools/podToHtml.pl b/src/tools/podToHtml.pl index d42e20ae3..d1676781d 100644 --- a/src/tools/podToHtml.pl +++ b/src/tools/podToHtml.pl @@ -16,8 +16,7 @@ use warnings; use FindBin qw($Bin); use lib ("$Bin/../../lib/perl", $Bin); -use Getopt::Std; -$Getopt::Std::STANDARD_HELP_VERSION = 1; +use EPICS::Getopts; use EPICS::PodHtml; @@ -52,9 +51,10 @@ Help, display this document as text. =item B<-s> -Indicates that the first component of the input file path is not part of the +Indicates that one leading component of the input file path is not part of the final installation path, thus should be removed before calculating the relative -path to the style-sheet file. +path to the style-sheet file. This flag may be repeated as many times as needed +to remove multiple leading components from the path to the style sheet. =item B<-o> file.html @@ -87,7 +87,7 @@ if (!$opt_o) { } # Calculate path to style.css file -shift @inpath if $opt_s; # Remove leading .. +shift @inpath while $opt_s--; # Remove leading .. my $root = '../' x scalar @inpath; open my $out, '>', $opt_o or From 808cf80579e95414f7b33a6e478e5ff4a7b58e00 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 26 May 2020 21:50:49 -0500 Subject: [PATCH 202/216] Fix Makefiles to use RULES_DIRS instead of _TOP --- modules/ca/Makefile | 2 +- modules/database/Makefile | 2 +- modules/database/test/Makefile | 2 +- test/Makefile | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/ca/Makefile b/modules/ca/Makefile index eeb147b07..8fde37827 100644 --- a/modules/ca/Makefile +++ b/modules/ca/Makefile @@ -12,4 +12,4 @@ include $(TOP)/configure/CONFIG DIRS += src -include $(TOP)/configure/RULES_TOP +include $(TOP)/configure/RULES_DIRS diff --git a/modules/database/Makefile b/modules/database/Makefile index 9bb746e82..729a0326e 100644 --- a/modules/database/Makefile +++ b/modules/database/Makefile @@ -15,4 +15,4 @@ DIRS += src DIRS += test test_DEPEND_DIRS = src -include $(TOP)/configure/RULES_TOP +include $(TOP)/configure/RULES_DIRS diff --git a/modules/database/test/Makefile b/modules/database/test/Makefile index b54d01757..f7bc8e5cf 100644 --- a/modules/database/test/Makefile +++ b/modules/database/test/Makefile @@ -19,4 +19,4 @@ DIRS += std/filters DIRS += tools -include $(TOP)/configure/RULES_TOP +include $(TOP)/configure/RULES_DIRS diff --git a/test/Makefile b/test/Makefile index 4c0f140a0..67910890b 100644 --- a/test/Makefile +++ b/test/Makefile @@ -12,4 +12,4 @@ include $(TOP)/configure/CONFIG DIRS += tools -include $(TOP)/configure/RULES_TOP +include $(TOP)/configure/RULES_DIRS From 7ba12f600c7368752a8f8be94f0debbe87790ca1 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 26 May 2020 21:52:55 -0500 Subject: [PATCH 203/216] Perl: Close and delete output files when dying --- modules/database/src/tools/dbdToHtml.pl | 6 ++++++ src/tools/makeAPIheader.pl | 6 ++++++ src/tools/podRemove.pl | 6 ++++++ src/tools/podToHtml.pl | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/modules/database/src/tools/dbdToHtml.pl b/modules/database/src/tools/dbdToHtml.pl index 39c377cfb..d25801478 100644 --- a/modules/database/src/tools/dbdToHtml.pl +++ b/modules/database/src/tools/dbdToHtml.pl @@ -108,6 +108,12 @@ if ($opt_D) { # Output dependencies only open my $out, '>', $opt_o or die "Can't create $opt_o: $!\n"; +$SIG{__DIE__} = sub { + die @_ if $^S; # Ignore eval deaths + close $out; + unlink $opt_o; +}; + my $podHtml; my $idify; my $contentType = diff --git a/src/tools/makeAPIheader.pl b/src/tools/makeAPIheader.pl index db043d8cb..4ebbeea9e 100644 --- a/src/tools/makeAPIheader.pl +++ b/src/tools/makeAPIheader.pl @@ -126,6 +126,12 @@ my $guard = "INC_${stem}API_H"; open my $o, '>', $outfile or die "makeAPIheader.pl: Can't create $outfile: $!\n"; +$SIG{__DIE__} = sub { + die @_ if $^S; # Ignore eval deaths + close $o; + unlink $outfile; +}; + print $o <<"__EOF__"; /* This is a generated file, do not edit! */ diff --git a/src/tools/podRemove.pl b/src/tools/podRemove.pl index 14fbf58f0..ae77f7b41 100644 --- a/src/tools/podRemove.pl +++ b/src/tools/podRemove.pl @@ -68,6 +68,12 @@ open my $inp, '<', $infile or open my $out, '>', $opt_o or die "podRemove.pl: Can't create $opt_o: $!\n"; +$SIG{__DIE__} = sub { + die @_ if $^S; # Ignore eval deaths + close $out; + unlink $opt_o; +}; + my $inPod = 0; while (<$inp>) { if (m/\A=[a-zA-Z]/) { diff --git a/src/tools/podToHtml.pl b/src/tools/podToHtml.pl index d1676781d..a6698dac4 100644 --- a/src/tools/podToHtml.pl +++ b/src/tools/podToHtml.pl @@ -93,6 +93,12 @@ my $root = '../' x scalar @inpath; open my $out, '>', $opt_o or die "Can't create $opt_o: $!\n"; +$SIG{__DIE__} = sub { + die @_ if $^S; # Ignore eval deaths + close $out; + unlink $opt_o; +}; + my $podHtml = EPICS::PodHtml->new(); $podHtml->html_css($root . 'style.css'); From c56311424c8250c5934cbff0529f426676cefbc7 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 27 May 2020 00:11:59 -0500 Subject: [PATCH 204/216] Add TOUCH command --- configure/os/CONFIG.UnixCommon.Common | 1 + configure/os/CONFIG.win32-x86.Common | 1 + 2 files changed, 2 insertions(+) diff --git a/configure/os/CONFIG.UnixCommon.Common b/configure/os/CONFIG.UnixCommon.Common index 026a5234d..72c1ee929 100644 --- a/configure/os/CONFIG.UnixCommon.Common +++ b/configure/os/CONFIG.UnixCommon.Common @@ -11,6 +11,7 @@ RM = rm -f MKDIR = mkdir -p RMDIR = rm -rf CAT = cat +TOUCH = touch # Allow site overrides -include $(CONFIG)/os/CONFIG_SITE.UnixCommon.Common diff --git a/configure/os/CONFIG.win32-x86.Common b/configure/os/CONFIG.win32-x86.Common index 43cfc342f..c76af8ea3 100644 --- a/configure/os/CONFIG.win32-x86.Common +++ b/configure/os/CONFIG.win32-x86.Common @@ -11,6 +11,7 @@ MKDIR = $(PERL) -MExtUtils::Command -e mkpath RMDIR = $(PERL) -MExtUtils::Command -e rm_rf NOP = $(PERL) -e '' CAT = $(PERL) -MExtUtils::Command -e cat +TOUCH = $(PERL) -MExtUtils::Command -e touch WIND_HOST_TYPE = x86-win32 OSITHREAD_USE_DEFAULT_STACK = NO From a6f85ffd1a6e74a3e42bde345aaf43d16b5ad544 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 27 May 2020 00:13:56 -0500 Subject: [PATCH 205/216] Decorate the output from epicsProve.pl Adds the CWD at the top, plus top & bottom separators --- src/tools/epicsProve.pl | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/tools/epicsProve.pl b/src/tools/epicsProve.pl index a1b0c14d4..65a30dfea 100644 --- a/src/tools/epicsProve.pl +++ b/src/tools/epicsProve.pl @@ -1,10 +1,23 @@ #!/usr/bin/env perl # Some Windows Perl installations provide a prove.bat file which -# doesn't work properly. +# doesn't work properly. This also lets us make the output stand +# out a bit more. + +use strict; +use warnings; use App::Prove; +use Cwd 'abs_path'; + +my $path = abs_path('.'); + +printf "\n%s\n%s\n", '-' x length($path), $path; my $app = App::Prove->new; $app->process_args(@ARGV); -exit( $app->run ? 0 : 1 ); +my $res = $app->run; + +print "-------------------\n\n"; + +exit( $res ? 0 : 1 ); From d41b3979fb8249de866bc55708b4c934cda3b2fb Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 27 May 2020 01:43:40 -0500 Subject: [PATCH 206/216] Collect submodule test failures into the parent Instead of displaying the failures from each submodule at the end of testing that submodule, RULES_TOP suppresses the output when it detects a parent module, and RULES_MODULES adds the children's failure lists into the parent's list so they all get shown at the end of the tests/results. --- configure/CONFIG_BASE | 3 ++- configure/RULES_MODULES | 13 ++++++++++++- configure/RULES_TOP | 6 ++++-- src/tools/testFailures.pl | 9 +++++++-- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/configure/CONFIG_BASE b/configure/CONFIG_BASE index ad963ba94..54d19f2cd 100644 --- a/configure/CONFIG_BASE +++ b/configure/CONFIG_BASE @@ -68,5 +68,6 @@ TAPTOJUNIT = $(PERL) $(TOOLS)/tap-to-junit-xml.pl PROVE = $(PERL) $(TOOLS)/epicsProve.pl PROVE.tap = $(PROVE) --ext .tap --exec "$(CAT)" -TEST_FAILURE_FILE = $(TOP)/.tests-failed +TEST_FAILURE_FILENAME = .tests-failed +TEST_FAILURE_FILE = $(TOP)/$(TEST_FAILURE_FILENAME) PROVE_FAILURE = echo $(abspath .)>> $(TEST_FAILURE_FILE) diff --git a/configure/RULES_MODULES b/configure/RULES_MODULES index 08ebb3e10..a163ce18d 100644 --- a/configure/RULES_MODULES +++ b/configure/RULES_MODULES @@ -23,7 +23,8 @@ # -include $(TOP)/../CONFIG_SITE.local # Add checked-out submodules to DIRS -DIRS += $(subst /Makefile,,$(wildcard $(addsuffix /Makefile, $(SUBMODULES)))) +LIVE_SUBMODULES = $(subst /Makefile,,$(wildcard $(addsuffix /Makefile, $(SUBMODULES)))) +DIRS += $(LIVE_SUBMODULES) include $(CONFIG)/RULES_DIRS @@ -45,3 +46,13 @@ realclean: $(RM) $(wildcard RELEASE.*.local) .PHONY: RELEASE.host realclean + +# Append all our live submodule failure files +FAILURE_FILES = $(addsuffix /$(TEST_FAILURE_FILENAME), $(LIVE_SUBMODULES)) + +runtests: | $(addsuffix $(DIVIDER)runtests, $(LIVE_SUBMODULES)) + @$(TOUCH) $(FAILURE_FILES) + @$(CAT) $(FAILURE_FILES) >> $(TEST_FAILURE_FILE) +test-results: | $(addsuffix $(DIVIDER)test-results, $(LIVE_SUBMODULES)) + @$(TOUCH) $(FAILURE_FILES) + @$(CAT) $(FAILURE_FILES) >> $(TEST_FAILURE_FILE) diff --git a/configure/RULES_TOP b/configure/RULES_TOP index c2b77d64c..b956839ec 100644 --- a/configure/RULES_TOP +++ b/configure/RULES_TOP @@ -50,6 +50,9 @@ uninstall$(DIVIDER)%: $(RMDIR) $(addsuffix /$(subst uninstall$(DIVIDER),,$@), \ $(INSTALL_LOCATION_BIN) $(INSTALL_LOCATION_LIB)) +runtests test-results: + @$(PERL) $(TOOLS)/testFailures.pl $(TEST_FAILURE_FILE) + else # # Using a disabled rule aborts @@ -63,8 +66,7 @@ endif # DISABLE_TOP_RULES before-runtests before-test-results: rm-failure-file rm-failure-file: @$(RM) $(TEST_FAILURE_FILE) -runtests test-results: - $(PERL) $(TOOLS)/testFailures.pl $(TEST_FAILURE_FILE) + @$(TOUCH) $(TEST_FAILURE_FILE) help: @echo "Usage: gnumake [options] [target] ..." diff --git a/src/tools/testFailures.pl b/src/tools/testFailures.pl index e19d00006..3007957e3 100644 --- a/src/tools/testFailures.pl +++ b/src/tools/testFailures.pl @@ -22,12 +22,17 @@ use warnings; die "Usage: testFailures.pl .tests-failed\n" unless @ARGV == 1; +# No file means success. open FAILURES, '<', shift or exit 0; -my @failures = ; +chomp(my @failures = ); close FAILURES; +# A file with just empty lines also mean success +my @dirs = grep {$_} @failures; +exit 0 unless @dirs; + print "\nTest failures were reported in:\n", - (map {" $_"} @failures), "\n"; + (map {" $_\n"} @dirs), "\n\n"; exit 1; From c3cb72a2ca0229b3c69f3bd9093809feb8ede51c Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 27 May 2020 01:46:14 -0500 Subject: [PATCH 207/216] Rename .tests-failed to match a .gitignore pattern This is simpler than trying to add that file to the .gitignore files in all of the submodules. --- .gitignore | 1 - configure/CONFIG_BASE | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index dfe2eb44a..af33a79de 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ /configure/*.local /modules/RELEASE.*.local /modules/Makefile.local -/.tests-failed O.*/ /QtC-* *.orig diff --git a/configure/CONFIG_BASE b/configure/CONFIG_BASE index 54d19f2cd..0b17dc60a 100644 --- a/configure/CONFIG_BASE +++ b/configure/CONFIG_BASE @@ -68,6 +68,6 @@ TAPTOJUNIT = $(PERL) $(TOOLS)/tap-to-junit-xml.pl PROVE = $(PERL) $(TOOLS)/epicsProve.pl PROVE.tap = $(PROVE) --ext .tap --exec "$(CAT)" -TEST_FAILURE_FILENAME = .tests-failed +TEST_FAILURE_FILENAME = .tests-failed.log TEST_FAILURE_FILE = $(TOP)/$(TEST_FAILURE_FILENAME) PROVE_FAILURE = echo $(abspath .)>> $(TEST_FAILURE_FILE) From 75a3442669af831d8a6b5b8bfba9d50da271e5a9 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 27 May 2020 01:50:23 -0500 Subject: [PATCH 208/216] Move RTEMS test-skip to just the failing test --- modules/libcom/test/epicsMessageQueueTest.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/libcom/test/epicsMessageQueueTest.cpp b/modules/libcom/test/epicsMessageQueueTest.cpp index b6e1bbb44..d46a3b9e5 100644 --- a/modules/libcom/test/epicsMessageQueueTest.cpp +++ b/modules/libcom/test/epicsMessageQueueTest.cpp @@ -208,8 +208,14 @@ void sleepyReceiver(double delay) epicsThreadSleep(delay); } +#ifdef __rtems__ + testTodoBegin("RTEMS failure expected"); +#endif testOk(numSent == SLEEPY_TESTS, "Sent %d (should be %d)", numSent, SLEEPY_TESTS); +#ifdef __rtems__ + testTodoEnd(); +#endif testOk(numReceived == SLEEPY_TESTS, "Received %d (should be %d)", numReceived, SLEEPY_TESTS); @@ -363,15 +369,9 @@ extern "C" void messageQueueTest(void *parm) sleepySender(0.009); sleepySender(0.010); sleepySender(0.011); -#ifdef __rtems__ - testTodoBegin("RTEMS failure expected"); -#endif sleepyReceiver(0.009); sleepyReceiver(0.010); sleepyReceiver(0.011); -#ifdef __rtems__ - testTodoEnd(); -#endif testDiag("Single receiver, single sender tests:"); epicsThreadSetPriority(myThreadId, epicsThreadPriorityHigh); From 591e1f22dd13695d9efa8d53c3f5554ceee033f5 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 28 May 2020 16:34:28 -0500 Subject: [PATCH 209/216] Update submodules to tagged versions for 7.0.3.2 --- modules/normativeTypes | 2 +- modules/pvAccess | 2 +- modules/pvData | 2 +- modules/pvDatabase | 2 +- modules/pva2pva | 2 +- modules/pvaClient | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/normativeTypes b/modules/normativeTypes index 7a2d264f2..1250a3c23 160000 --- a/modules/normativeTypes +++ b/modules/normativeTypes @@ -1 +1 @@ -Subproject commit 7a2d264f2cb107bfd10adb23bc2b73d8323a79e4 +Subproject commit 1250a3c236f0aa92e0b5bd73647fd71d8a09360d diff --git a/modules/pvAccess b/modules/pvAccess index 3cae45128..1641bd18b 160000 --- a/modules/pvAccess +++ b/modules/pvAccess @@ -1 +1 @@ -Subproject commit 3cae45128fc58cf455ea7aa09fb2fb84b266630a +Subproject commit 1641bd18b4243e5c281dc955c628c33925cab8c2 diff --git a/modules/pvData b/modules/pvData index 81e796823..d9b3f98e3 160000 --- a/modules/pvData +++ b/modules/pvData @@ -1 +1 @@ -Subproject commit 81e79682302111aee29cdcf796f01ac894a2e52a +Subproject commit d9b3f98e3571b77995a048af5457eb583673433a diff --git a/modules/pvDatabase b/modules/pvDatabase index 85165e657..3f5bfd067 160000 --- a/modules/pvDatabase +++ b/modules/pvDatabase @@ -1 +1 @@ -Subproject commit 85165e6579c65968fca0bb25598974917296ce84 +Subproject commit 3f5bfd067f7ffc414335a3e948be30c9be664231 diff --git a/modules/pva2pva b/modules/pva2pva index cda2222ed..cb13435d1 160000 --- a/modules/pva2pva +++ b/modules/pva2pva @@ -1 +1 @@ -Subproject commit cda2222ed5fa22d65bef2e1d033bcb655f58b4a6 +Subproject commit cb13435d152a1247ac0a6dcc8ea6f5c7d8a5fa80 diff --git a/modules/pvaClient b/modules/pvaClient index c3aec4e27..bc9ac8422 160000 --- a/modules/pvaClient +++ b/modules/pvaClient @@ -1 +1 @@ -Subproject commit c3aec4e27b61aad87d8825f67ffe607eeec98c7a +Subproject commit bc9ac8422cb94a38c27385c3c6781aea30c2c8b8 From 005580556cadb6741a039e1935962baaa9333029 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 28 May 2020 17:33:18 -0500 Subject: [PATCH 210/216] Add and document the macro IOCSHFUNCDEF_HAS_USAGE --- documentation/RELEASE_NOTES.md | 15 +++++++++------ modules/libcom/src/iocsh/iocsh.h | 1 + 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/documentation/RELEASE_NOTES.md b/documentation/RELEASE_NOTES.md index 8d568b9d8..f17d2f88e 100644 --- a/documentation/RELEASE_NOTES.md +++ b/documentation/RELEASE_NOTES.md @@ -27,12 +27,15 @@ has been added. Run 'makeAPIheader.pl -h' for application information. ### IOCsh usage messages -`help ` now prints a descriptive usage message -for many internal IOCsh commands. Try `help *` to -see them all. +At the iocShell prompt `help ` now prints a descriptive usage message +for many internal IOCsh commands in addition to the command parameters. +Try `help *` to see all commands, or a glob pattern such as `help db*` to see +a subset. -External code which wishes to provide a usage message -should do so through the new `iocshFuncDef::usage` member. +External code may provide usage messages when registering commands using a +new `const char *usage` member of the `iocshFuncDef` structure. +The `iocsh.h` header also now defines a macro `IOCSHFUNCDEF_HAS_USAGE` which +can be used to detect Base versions that support this feature at compile-time. ### Variable names in RELEASE files @@ -62,7 +65,7 @@ the stdin/out of a process, like caget, which has spawned it in the background. This has been known to cause problems in some cases when caget is itself being run from a shell script. -caRepeater will now understand the '-v' argument to retain stdin/out/err +caRepeater will now understand the `-v` argument to retain stdin/out/err which may be necessary to see any error messages it may emit. ### `state` record deprecated diff --git a/modules/libcom/src/iocsh/iocsh.h b/modules/libcom/src/iocsh/iocsh.h index c8a7245bd..72265a8bd 100644 --- a/modules/libcom/src/iocsh/iocsh.h +++ b/modules/libcom/src/iocsh/iocsh.h @@ -64,6 +64,7 @@ typedef struct iocshFuncDef { const iocshArg * const *arg; const char* usage; }iocshFuncDef; +#define IOCSHFUNCDEF_HAS_USAGE typedef void (*iocshCallFunc)(const iocshArgBuf *argBuf); From f0d814d5c709157f723e4c7dc422ae3622233277 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 28 May 2020 17:55:27 -0500 Subject: [PATCH 211/216] Final Release Notes update, added bug links --- documentation/RELEASE_NOTES.md | 46 ++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/documentation/RELEASE_NOTES.md b/documentation/RELEASE_NOTES.md index f17d2f88e..45fd04614 100644 --- a/documentation/RELEASE_NOTES.md +++ b/documentation/RELEASE_NOTES.md @@ -8,22 +8,48 @@ which they were originally committed.** Thus it is important to read more than just the first section to understand everything that has changed in each release. -The external PVA submodules each have their own separate set of release notes -which should also be read to understand what has changed since an earlier -release. +The PVA submodules each have their own individual sets of release notes which +should also be read to understand what has changed since earlier releases. ## EPICS Release 7.0.3.2 -### \*_API macros in headers +### Bug fixes + +The following launchpad bugs have fixes included in this release: + +- [lp: 1812084](https://bugs.launchpad.net/bugs/1812084), Build failure on + RTEMS 4.10.2 +- [lp: 1829919](https://bugs.launchpad.net/bugs/1829919), IOC segfaults when + calling dbLoadRecords after iocInit +- [lp: 1838792](https://bugs.launchpad.net/bugs/1838792), epicsCalc bit-wise + operators on aarch64 +- [lp: 1853148](https://bugs.launchpad.net/bugs/1853148), mingw compiler + problem with printf/scanf formats +- [lp: 1852653](https://bugs.launchpad.net/bugs/1852653), USE_TYPED_DSET + incompatible with C++ +- [lp: 1862328](https://bugs.launchpad.net/bugs/1862328), Race condition on + IOC start leaves rsrv unresponsive +- [lp: 1866651](https://bugs.launchpad.net/bugs/1866651), thread joinable race +- [lp: 1868486](https://bugs.launchpad.net/bugs/1868486), epicsMessageQueue + lost messages +- [lp: 1868680](https://bugs.launchpad.net/bugs/1868680), Access Security file + reload (asInit) fails + +### \*_API macros in EPICS headers Internally, the Com and ca libraries now express dllimport/export (Windows) -and symbol visibility (GCC) with individual macros (eg. LIBCOM_API) -instead of using epicsShare\*. This change may effect user code which uses -epicsShare\* macros without explicitly including the shareLib.h header. -Such code should be changed to include shareLib.h directly. +and symbol visibility (GCC) using library-specific macros (eg. `LIBCOM_API`) +instead of the macros `epicsShareFunc`, `epicsShareClass`, `epicsShareDef` etc. +that are defined in the `shareLib.h` header. +This change may affect some user code which uses the `epicsShare*` macros +without having explicitly included the `shareLib.h` header themselves. +Such code should be changed to include `shareLib.h` directly. -A new helper script makeAPIheader.pl and rules to generate \*API.h headers -has been added. Run 'makeAPIheader.pl -h' for application information. +A new helper script `makeAPIheader.pl` and build rules to generate a +library-specific `*API.h` header file has been added. Run `makeAPIheader.pl -h` +for information on how to use this in your own applications, but note that the +resulting sources will not be able to be compiled using earlier versions of +EPICS Base. ### IOCsh usage messages From 688bc3247c7b55f62f1f0cd62bfaad31b2c74c17 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 20 May 2020 19:55:51 -0700 Subject: [PATCH 212/216] missing include --- modules/database/test/ioc/db/xRecord.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/database/test/ioc/db/xRecord.c b/modules/database/test/ioc/db/xRecord.c index 5188bf187..8a8e78088 100644 --- a/modules/database/test/ioc/db/xRecord.c +++ b/modules/database/test/ioc/db/xRecord.c @@ -13,6 +13,8 @@ * Ralph Lange */ +#include + #include "dbAccessDefs.h" #include "recSup.h" #include "recGbl.h" From 745d2755f91eb7ae2922f39f5414fdc1e4d45fab Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 28 May 2020 18:12:51 -0500 Subject: [PATCH 213/216] Update version numbers for release With both libcom and database having minor version bumps I concluded that this couldn't be 7.0.3.2 and should really be numbered 7.0.4 --- configure/CONFIG_BASE_VERSION | 8 ++++---- configure/CONFIG_CA_VERSION | 2 +- configure/CONFIG_DATABASE_VERSION | 2 +- configure/CONFIG_LIBCOM_VERSION | 6 +++--- documentation/RELEASE_NOTES.md | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/configure/CONFIG_BASE_VERSION b/configure/CONFIG_BASE_VERSION index 463882f4d..28f1c4899 100644 --- a/configure/CONFIG_BASE_VERSION +++ b/configure/CONFIG_BASE_VERSION @@ -48,16 +48,16 @@ EPICS_VERSION = 7 EPICS_REVISION = 0 # EPICS_MODIFICATION must be a number >=0 and <256 -EPICS_MODIFICATION = 3 +EPICS_MODIFICATION = 4 # EPICS_PATCH_LEVEL must be a number (win32 resource file requirement) # Not included in the official EPICS version number if zero -EPICS_PATCH_LEVEL = 2 +EPICS_PATCH_LEVEL = 0 # Immediately after an official release the EPICS_PATCH_LEVEL is incremented # and the -DEV suffix is added (similar to the Maven -SNAPSHOT versions) -#EPICS_DEV_SNAPSHOT= -EPICS_DEV_SNAPSHOT=-DEV +EPICS_DEV_SNAPSHOT= +#EPICS_DEV_SNAPSHOT=-DEV #EPICS_DEV_SNAPSHOT=-pre1 #EPICS_DEV_SNAPSHOT=-pre1-DEV #EPICS_DEV_SNAPSHOT=-rc1 diff --git a/configure/CONFIG_CA_VERSION b/configure/CONFIG_CA_VERSION index c75b4e421..f77f09be6 100644 --- a/configure/CONFIG_CA_VERSION +++ b/configure/CONFIG_CA_VERSION @@ -6,7 +6,7 @@ EPICS_CA_MAINTENANCE_VERSION = 6 # Development flag, set to zero for release versions -EPICS_CA_DEVELOPMENT_FLAG = 1 +EPICS_CA_DEVELOPMENT_FLAG = 0 # Immediately after a release the MAINTENANCE_VERSION # will be incremented and the DEVELOPMENT_FLAG set to 1 diff --git a/configure/CONFIG_DATABASE_VERSION b/configure/CONFIG_DATABASE_VERSION index 93a87a0a3..aa2fd79ba 100644 --- a/configure/CONFIG_DATABASE_VERSION +++ b/configure/CONFIG_DATABASE_VERSION @@ -6,7 +6,7 @@ EPICS_DATABASE_MAINTENANCE_VERSION = 0 # Development flag, set to zero for release versions -EPICS_DATABASE_DEVELOPMENT_FLAG = 1 +EPICS_DATABASE_DEVELOPMENT_FLAG = 0 # Immediately after a release the MAINTENANCE_VERSION # will be incremented and the DEVELOPMENT_FLAG set to 1 diff --git a/configure/CONFIG_LIBCOM_VERSION b/configure/CONFIG_LIBCOM_VERSION index 3def716cb..2f2b13589 100644 --- a/configure/CONFIG_LIBCOM_VERSION +++ b/configure/CONFIG_LIBCOM_VERSION @@ -1,12 +1,12 @@ # Version number for the libcom APIs and shared library EPICS_LIBCOM_MAJOR_VERSION = 3 -EPICS_LIBCOM_MINOR_VERSION = 17 -EPICS_LIBCOM_MAINTENANCE_VERSION = 7 +EPICS_LIBCOM_MINOR_VERSION = 18 +EPICS_LIBCOM_MAINTENANCE_VERSION = 0 # Development flag, set to zero for release versions -EPICS_LIBCOM_DEVELOPMENT_FLAG = 1 +EPICS_LIBCOM_DEVELOPMENT_FLAG = 0 # Immediately after a release the MAINTENANCE_VERSION # will be incremented and the DEVELOPMENT_FLAG set to 1 diff --git a/documentation/RELEASE_NOTES.md b/documentation/RELEASE_NOTES.md index 45fd04614..986ac93d6 100644 --- a/documentation/RELEASE_NOTES.md +++ b/documentation/RELEASE_NOTES.md @@ -11,7 +11,7 @@ release. The PVA submodules each have their own individual sets of release notes which should also be read to understand what has changed since earlier releases. -## EPICS Release 7.0.3.2 +## EPICS Release 7.0.4 ### Bug fixes From cd0788814945d06d31ba6925b1d7e038328efa09 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 28 May 2020 18:25:32 -0500 Subject: [PATCH 214/216] Set next development versions --- configure/CONFIG_BASE_VERSION | 6 +++--- configure/CONFIG_CA_VERSION | 4 ++-- configure/CONFIG_DATABASE_VERSION | 4 ++-- configure/CONFIG_LIBCOM_VERSION | 4 ++-- documentation/RELEASE_NOTES.md | 7 +++++++ documentation/ReleaseChecklist.html | 20 ++++++++++---------- modules/normativeTypes | 2 +- modules/pvAccess | 2 +- modules/pvData | 2 +- modules/pvDatabase | 2 +- modules/pva2pva | 2 +- modules/pvaClient | 2 +- 12 files changed, 32 insertions(+), 25 deletions(-) diff --git a/configure/CONFIG_BASE_VERSION b/configure/CONFIG_BASE_VERSION index 28f1c4899..66767f545 100644 --- a/configure/CONFIG_BASE_VERSION +++ b/configure/CONFIG_BASE_VERSION @@ -52,12 +52,12 @@ EPICS_MODIFICATION = 4 # EPICS_PATCH_LEVEL must be a number (win32 resource file requirement) # Not included in the official EPICS version number if zero -EPICS_PATCH_LEVEL = 0 +EPICS_PATCH_LEVEL = 1 # Immediately after an official release the EPICS_PATCH_LEVEL is incremented # and the -DEV suffix is added (similar to the Maven -SNAPSHOT versions) -EPICS_DEV_SNAPSHOT= -#EPICS_DEV_SNAPSHOT=-DEV +#EPICS_DEV_SNAPSHOT= +EPICS_DEV_SNAPSHOT=-DEV #EPICS_DEV_SNAPSHOT=-pre1 #EPICS_DEV_SNAPSHOT=-pre1-DEV #EPICS_DEV_SNAPSHOT=-rc1 diff --git a/configure/CONFIG_CA_VERSION b/configure/CONFIG_CA_VERSION index f77f09be6..28de9e09e 100644 --- a/configure/CONFIG_CA_VERSION +++ b/configure/CONFIG_CA_VERSION @@ -2,11 +2,11 @@ EPICS_CA_MAJOR_VERSION = 4 EPICS_CA_MINOR_VERSION = 13 -EPICS_CA_MAINTENANCE_VERSION = 6 +EPICS_CA_MAINTENANCE_VERSION = 7 # Development flag, set to zero for release versions -EPICS_CA_DEVELOPMENT_FLAG = 0 +EPICS_CA_DEVELOPMENT_FLAG = 1 # Immediately after a release the MAINTENANCE_VERSION # will be incremented and the DEVELOPMENT_FLAG set to 1 diff --git a/configure/CONFIG_DATABASE_VERSION b/configure/CONFIG_DATABASE_VERSION index aa2fd79ba..9c4684ffc 100644 --- a/configure/CONFIG_DATABASE_VERSION +++ b/configure/CONFIG_DATABASE_VERSION @@ -2,11 +2,11 @@ EPICS_DATABASE_MAJOR_VERSION = 3 EPICS_DATABASE_MINOR_VERSION = 18 -EPICS_DATABASE_MAINTENANCE_VERSION = 0 +EPICS_DATABASE_MAINTENANCE_VERSION = 1 # Development flag, set to zero for release versions -EPICS_DATABASE_DEVELOPMENT_FLAG = 0 +EPICS_DATABASE_DEVELOPMENT_FLAG = 1 # Immediately after a release the MAINTENANCE_VERSION # will be incremented and the DEVELOPMENT_FLAG set to 1 diff --git a/configure/CONFIG_LIBCOM_VERSION b/configure/CONFIG_LIBCOM_VERSION index 2f2b13589..6251b1e1f 100644 --- a/configure/CONFIG_LIBCOM_VERSION +++ b/configure/CONFIG_LIBCOM_VERSION @@ -2,11 +2,11 @@ EPICS_LIBCOM_MAJOR_VERSION = 3 EPICS_LIBCOM_MINOR_VERSION = 18 -EPICS_LIBCOM_MAINTENANCE_VERSION = 0 +EPICS_LIBCOM_MAINTENANCE_VERSION = 1 # Development flag, set to zero for release versions -EPICS_LIBCOM_DEVELOPMENT_FLAG = 0 +EPICS_LIBCOM_DEVELOPMENT_FLAG = 1 # Immediately after a release the MAINTENANCE_VERSION # will be incremented and the DEVELOPMENT_FLAG set to 1 diff --git a/documentation/RELEASE_NOTES.md b/documentation/RELEASE_NOTES.md index 986ac93d6..6fd80615a 100644 --- a/documentation/RELEASE_NOTES.md +++ b/documentation/RELEASE_NOTES.md @@ -11,6 +11,13 @@ release. The PVA submodules each have their own individual sets of release notes which should also be read to understand what has changed since earlier releases. +**This version of EPICS has not been released yet.** + +## Changes made on the 7.0 branch since 7.0.4 + + + + ## EPICS Release 7.0.4 ### Bug fixes diff --git a/documentation/ReleaseChecklist.html b/documentation/ReleaseChecklist.html index 0a80c7cba..117748b06 100644 --- a/documentation/ReleaseChecklist.html +++ b/documentation/ReleaseChecklist.html @@ -147,17 +147,17 @@ starting at Release Approval.

Tag the module in Git, using these tag conventions:
  • - R7.0.3.2-pren + R7.0.4.1-pren — pre-release tag
  • - R7.0.3.2-rcn + R7.0.4.1-rcn — release candidate tag
cd base-7.0
- git tag -m 'ANJ: Tagged for 7.0.3.2-rc1' R7.0.3.2-rc1 + git tag -m 'ANJ: Tagged for 7.0.4.1-rc1' R7.0.4.1-rc1
Note that submodules must not be tagged with the version used for the top-level, they each have their own separate version numbers @@ -171,11 +171,11 @@ starting at Release Approval.

files and directories that are only used for continuous integration:
cd base-7.0
- ./.tools/make-tar.sh R7.0.3.2-rc1 base-7.0.3.2-rc1.tar.gz base-7.0.3.2-rc1/ + ./.tools/make-tar.sh R7.0.4.1-rc1 base-7.0.4.1-rc1.tar.gz base-7.0.4.1-rc1/
Create a GPG signature file of the tarfile as follows:
- gpg --armor --sign --detach-sig base-7.0.3.2-rc1.tar.gz + gpg --armor --sign --detach-sig base-7.0.4.1-rc1.tar.gz
@@ -298,7 +298,7 @@ starting at Release Approval.

  • Tag the module:
    - git tag -m 'ANJ: Tag for EPICS 7.0.3.2' <module-version> + git tag -m 'ANJ: Tag for EPICS 7.0.4.1' <module-version>
  • @@ -355,7 +355,7 @@ starting at Release Approval.

    Tag the epics-base module in Git:
    cd base-7.0
    - git tag -m 'ANJ: Tagged for 7.0.3.2' R7.0.3.2 + git tag -m 'ANJ: Tagged for release' R7.0.4.1

    Don't push these commits or the new tag to the Launchpad repository yet.

    @@ -387,12 +387,12 @@ starting at Release Approval.

    files and directories that are only used for continuous integration:
    cd base-7.0
    - ./.tools/make-tar.sh R7.0.3.2 ../base-7.0.3.2.tar.gz base-7.0.3.2/ + ./.tools/make-tar.sh R7.0.4.1 ../base-7.0.4.1.tar.gz base-7.0.4.1/
    Create a GPG signature file of the tarfile as follows:
    cd ..
    - gpg --armor --sign --detach-sig base-7.0.3.2.tar.gz + gpg --armor --sign --detach-sig base-7.0.4.1.tar.gz
    @@ -457,7 +457,7 @@ starting at Release Approval.

    Upload the tar file and its .asc signature file to the epics-controls web-server.
    - scp base-7.0.3.2.tar.gz base-7.0.3.2.tar.gz.asc epics-controls:download/base
    + scp base-7.0.4.1.tar.gz base-7.0.4.1.tar.gz.asc epics-controls:download/base
    diff --git a/modules/normativeTypes b/modules/normativeTypes index 1250a3c23..7a2d264f2 160000 --- a/modules/normativeTypes +++ b/modules/normativeTypes @@ -1 +1 @@ -Subproject commit 1250a3c236f0aa92e0b5bd73647fd71d8a09360d +Subproject commit 7a2d264f2cb107bfd10adb23bc2b73d8323a79e4 diff --git a/modules/pvAccess b/modules/pvAccess index 1641bd18b..4e85d38bb 160000 --- a/modules/pvAccess +++ b/modules/pvAccess @@ -1 +1 @@ -Subproject commit 1641bd18b4243e5c281dc955c628c33925cab8c2 +Subproject commit 4e85d38bbad1c1562ea34bdd18bc1964fb00350b diff --git a/modules/pvData b/modules/pvData index d9b3f98e3..0fa927afa 160000 --- a/modules/pvData +++ b/modules/pvData @@ -1 +1 @@ -Subproject commit d9b3f98e3571b77995a048af5457eb583673433a +Subproject commit 0fa927afa7d92f490f92eb4906e27046080309e2 diff --git a/modules/pvDatabase b/modules/pvDatabase index 3f5bfd067..cb5d9f976 160000 --- a/modules/pvDatabase +++ b/modules/pvDatabase @@ -1 +1 @@ -Subproject commit 3f5bfd067f7ffc414335a3e948be30c9be664231 +Subproject commit cb5d9f976a2433f87a48bcd8b3de83dd05d26fcc diff --git a/modules/pva2pva b/modules/pva2pva index cb13435d1..94d1eedc7 160000 --- a/modules/pva2pva +++ b/modules/pva2pva @@ -1 +1 @@ -Subproject commit cb13435d152a1247ac0a6dcc8ea6f5c7d8a5fa80 +Subproject commit 94d1eedc7536f7b5eacdcfb81cf6b8a306b9687f diff --git a/modules/pvaClient b/modules/pvaClient index bc9ac8422..7722fdf35 160000 --- a/modules/pvaClient +++ b/modules/pvaClient @@ -1 +1 @@ -Subproject commit bc9ac8422cb94a38c27385c3c6781aea30c2c8b8 +Subproject commit 7722fdf353b54b681a2d883c36374aa0211241ef From 6188d3fdaf20393c65f19ce8f850631be217a7dc Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 28 May 2020 16:26:34 -0700 Subject: [PATCH 215/216] update doc comments --- modules/libcom/src/cppStd/epicsAlgorithm.h | 9 +------- modules/libcom/src/misc/dbDefs.h | 4 +--- modules/libcom/src/misc/epicsExport.h | 16 +++++-------- modules/libcom/src/misc/epicsUnitTest.h | 27 +++++++++++++++------- modules/libcom/src/osi/epicsEvent.h | 6 ++--- modules/libcom/src/osi/epicsMutex.h | 14 +++++++---- modules/libcom/src/osi/epicsTime.h | 8 +++---- 7 files changed, 44 insertions(+), 40 deletions(-) diff --git a/modules/libcom/src/cppStd/epicsAlgorithm.h b/modules/libcom/src/cppStd/epicsAlgorithm.h index e2043cf26..1920fa4e3 100644 --- a/modules/libcom/src/cppStd/epicsAlgorithm.h +++ b/modules/libcom/src/cppStd/epicsAlgorithm.h @@ -12,14 +12,7 @@ * * \brief Contains a few templates out of the C++ standard header algorithm * - * \note The templates are provided here in a much smaller file. Standard algorithm - * contains many templates for sorting and searching through C++ template containers - * which are not used in EPICS. If all you need from there is std::min(), - * std::max() and/or std::swap() your code may compile faster if you include - * epicsAlgorithm.h and use epicsMin(), epicsMax() and epicsSwap() instead. - * - * The C++ standard only requires types to be less-than comparable, so - * the epicsMin and epicsMax templates only use operator <. + * \deprecated Use std::min()/max()/swap() in new code */ #ifndef __EPICS_ALGORITHM_H__ diff --git a/modules/libcom/src/misc/dbDefs.h b/modules/libcom/src/misc/dbDefs.h index 5de0cd922..bda05ed3f 100644 --- a/modules/libcom/src/misc/dbDefs.h +++ b/modules/libcom/src/misc/dbDefs.h @@ -73,9 +73,7 @@ /** \brief Size of a record name without the nil terminator */ #define PVNAME_SZ (PVNAME_STRINGSZ - 1) -/** - * \def PVLINK_STRINGSZ - * \brief Buffer size for the string representation of a DBF_*LINK field +/** \brief Buffer size for the string representation of a DBF_*LINK field */ #define PVLINK_STRINGSZ 1024 diff --git a/modules/libcom/src/misc/epicsExport.h b/modules/libcom/src/misc/epicsExport.h index 13b27b19e..d1c849eaf 100644 --- a/modules/libcom/src/misc/epicsExport.h +++ b/modules/libcom/src/misc/epicsExport.h @@ -35,17 +35,7 @@ extern "C" { typedef void (*REGISTRAR)(void); -/** \brief Generate a name for an export object. - * \param typ Object's data type. - * \param obj Object's name. - * \return C identifier for the export object. - */ #define EPICS_EXPORT_POBJ(typ, obj) pvar_ ## typ ## _ ## obj - -/** \brief Generate a name for an export function object. - * \param fun Function's name. - * \return C identifier for the export object. - */ #define EPICS_EXPORT_PFUNC(fun) EPICS_EXPORT_POBJ(func, fun) /** \brief Declare an object for exporting. @@ -79,6 +69,8 @@ typedef void (*REGISTRAR)(void); * * \param typ Object's data type. * \param obj Object's name. + * + * \note C++ code needs to wrap with @code extern "C" { } @endcode */ #define epicsExportAddress(typ, obj) \ epicsShareExtern typ *EPICS_EXPORT_POBJ(typ,obj); \ @@ -96,6 +88,8 @@ typedef void (*REGISTRAR)(void); \endcode * * \param fun Registrar function's name. + * + * \note C++ code needs to wrap with @code extern "C" { } @endcode */ #define epicsExportRegistrar(fun) \ epicsShareFunc REGISTRAR EPICS_EXPORT_PFUNC(fun) = (REGISTRAR) &fun @@ -111,6 +105,8 @@ typedef void (*REGISTRAR)(void); \endcode * * \param fun Function's name + * + * \note C++ code needs to wrap with @code extern "C" { } @endcode */ #define epicsRegisterFunction(fun) \ static void register_func_ ## fun(void) \ diff --git a/modules/libcom/src/misc/epicsUnitTest.h b/modules/libcom/src/misc/epicsUnitTest.h index f090eb192..302c87bf5 100644 --- a/modules/libcom/src/misc/epicsUnitTest.h +++ b/modules/libcom/src/misc/epicsUnitTest.h @@ -88,14 +88,16 @@ MAIN(iocTest) { - iocBuildIsolated() || iocRun(); - - ... test code ... - - iocShutdown(); - dbFreeBase(pdbbase); - registryFree(); - pdbbase = NULL; + testPlan(0); + testdbPrepare(); + testdbReadDatabase(".dbd", 0, 0); + _registerRecordDeviceDriver(pdbbase); + testdbReadDatabase("some.db", 0, 0); + ... test code before iocInit(). eg. dbGetString() ... + testIocInitOk(); + ... test code with IOC running. eg. dbGet() + testIocShutdownOk(); + testdbCleanup(); return testDone(); } \endcode @@ -235,6 +237,15 @@ LIBCOM_API int testDiag(const char *fmt, ...) */ LIBCOM_API int testDone(void); +/** \brief Return non-zero in shared/oversubscribed testing envrionments + * + * May be used to testSkip(), or select longer timeouts, for some cases + * when the test process may be preempted for arbitrarily long times. + * This is common in shared CI environments. + * + * The environment variable $EPICS_TEST_IMPRECISE_TIMING=YES should be + * set in by such testing environments. + */ LIBCOM_API int testImpreciseTiming(void); diff --git a/modules/libcom/src/osi/epicsEvent.h b/modules/libcom/src/osi/epicsEvent.h index 9429b9db6..dfa8a4fdf 100644 --- a/modules/libcom/src/osi/epicsEvent.h +++ b/modules/libcom/src/osi/epicsEvent.h @@ -20,12 +20,12 @@ * * When creating the consumer thread also create an epicsEvent. \code - epicsEvent *pevent = new epicsEvent; + epicsEvent event; \endcode * The consumer thread has code containing: \code while(1) { - pevent->wait(); + pevent.wait(); while( {more work} ) { {process work} } @@ -33,7 +33,7 @@ \endcode * Producers create requests and issue the statement: \code - pevent->trigger(); + pevent.trigger(); \endcode **/ diff --git a/modules/libcom/src/osi/epicsMutex.h b/modules/libcom/src/osi/epicsMutex.h index af27f2f96..6c79fd9e0 100644 --- a/modules/libcom/src/osi/epicsMutex.h +++ b/modules/libcom/src/osi/epicsMutex.h @@ -19,12 +19,18 @@ * * The typical C++ use of a mutual exclusion semaphore is: \code - epicsMutex *plock = new epicsMutex; + epicsMutex lock; ... ... - plock->lock(); - // process resources - plock->unlock(); + { + epicsMutex::guard_t G(lock); // lock + // process resources + } // unlock + // or for compatiblity + { + epicsGuard G(lock); // lock + // process resources + } // unlock \endcode * * \note The implementation: diff --git a/modules/libcom/src/osi/epicsTime.h b/modules/libcom/src/osi/epicsTime.h index a1ccf382d..fcfa679a5 100644 --- a/modules/libcom/src/osi/epicsTime.h +++ b/modules/libcom/src/osi/epicsTime.h @@ -155,10 +155,10 @@ public: static epicsTime getCurrent (); /** \brief Get current monotonic time * - * Returns an epicsTime containing the current monotonic time, a - * high-resolution OS clock that counts at a steady rate, never - * going backwards or jumping forwards. This time is only useful - * for measuring time differences. + * Returns an epicsTime containing the current monotonic time, an + * OS clock which never going backwards or jumping forwards. + * This time is has an undefined epoch, and is only useful for + * measuring time differences. */ static epicsTime getMonotonic (); From 0bfe0eda0cafcb48734e13acbbeae7285f7e050a Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 28 May 2020 21:18:28 -0500 Subject: [PATCH 216/216] Update the things to skip in make-tar.sh --- .tools/make-tar.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.tools/make-tar.sh b/.tools/make-tar.sh index e6bf59315..4bb0c8a3a 100755 --- a/.tools/make-tar.sh +++ b/.tools/make-tar.sh @@ -89,7 +89,8 @@ git archive --prefix=$PREFIX $TOPREV | tar -C "$TDIR"/tar -x # # sub-modules appear in tree as eg.: # 160000 commit c3a6cfcf0dad4a4eeecf59b474710d06ff3eb68a modules/ca -git ls-tree -r $TOPREV | awk '/^[0-9]+ commit / {print $3, $4}' | \ +git ls-tree -r $TOPREV | \ + awk '/^[0-9]+ commit / && $4 != ".ci" {print $3, $4}' | \ while read HASH MODDIR do echo "Visiting $HASH $MODDIR" @@ -105,13 +106,17 @@ sed -i -e 's|^\./||' "$TDIR"/list.1 # Exclude files sed \ - -e '/\/\.\?ci\//d' \ + -e '/\/\.ci\//d' \ + -e '/\/\.ci-local\//d' \ -e '/\/\.tools\//d' \ -e '/\/jenkins\//d' \ -e '/\/\.git/d' \ + -e '/\/\.hgtags$/d' \ + -e '/\/\.cproject$/d' \ -e '/\/\.project$/d' \ -e '/\/\.travis\.yml$/d' \ -e '/\/\.appveyor\.yml$/d' \ + -e '/\/\.readthedocs\.yml$/d' \ "$TDIR"/list.1 > "$TDIR"/list.2 if ! diff -U 0 "$TDIR"/list.1 "$TDIR"/list.2