From 36a8b51d8e743c487cc5f4c079746b234b2afca1 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Wed, 20 May 2020 14:43:02 -0700 Subject: [PATCH] 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;