/*************************************************************************\ * Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * Copyright (c) 2003 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to the Software License Agreement * found in the file LICENSE that is included with this distribution. \*************************************************************************/ /* Author: Andrew Johnson Date: 2003-04-08 */ #include #include #include #include #include #include #include "registryFunction.h" #include "epicsThread.h" #include "epicsExit.h" #include "epicsStdio.h" #include "epicsString.h" #include "dbStaticLib.h" #include "subRecord.h" #include "dbAccess.h" #include "asDbLib.h" #include "iocInit.h" #include "iocsh.h" #include "osiFileName.h" #include extern "C" int softIocPVA_registerRecordDeviceDriver(struct dbBase *pdbbase); #ifndef EPICS_BASE // so IDEs knows EPICS_BASE is a string constant # define EPICS_BASE "/" # error -DEPICS_BASE required #endif #if EPICS_VERSION_INT>=VERSION_INT(7,0,2,0) # define USE_EXECDIR #endif #define DBD_BASE "dbd" OSI_PATH_SEPARATOR "softIocPVA.dbd" #define EXIT_BASE "db" OSI_PATH_SEPARATOR "softIocExit.db" #define DBD_FILE_REL ".." OSI_PATH_SEPARATOR ".." OSI_PATH_SEPARATOR DBD_BASE #define EXIT_FILE_REL ".." OSI_PATH_SEPARATOR ".." OSI_PATH_SEPARATOR EXIT_BASE #define DBD_FILE EPICS_BASE OSI_PATH_SEPARATOR DBD_BASE #define EXIT_FILE EPICS_BASE OSI_PATH_SEPARATOR EXIT_BASE namespace { bool verbose = false; static void exitSubroutine(subRecord *precord) { epicsExitLater((precord->a == 0.0) ? EXIT_SUCCESS : EXIT_FAILURE); } void usage(const char *arg0, const std::string& base_dbd) { std::cout<<"Usage: "< If used, must come first. Specify the path to the softIocPVA.dbdfile." " The compile-time install location is saved in the binary as a default.\n" "\n" " -h Print this mesage and exit.\n" "\n" " -S Prevents an interactive shell being started.\n" "\n" " -s Previously caused a shell to be started. Now accepted and ignored.\n" "\n" " -v Verbose, display steps taken during startup.\n" "\n" " -a Access Security configuration file. Macro substitution is\n" " performed.\n" "\n" " -G DB Group definition file in JSON format.\n" "\n" " -m =,... Set/replace macro definitions used by subsequent -d and\n" " -a.\n" "\n" " -d Load records from file (dbLoadRecords). Macro substitution is\n" " performed.\n" "\n" " -x Load softIocExit.db. Provides a record \":exit\".\n" " Put 0 to exit with success, or non-zero to exit with an error.\n" "\n" "Any number of -m and -d arguments can be interspersed; the macros are applied\n" "to the following .db files. Each later -m option causes earlier macros to be\n" "discarded.\n" "\n" "A st.cmd file is optional. If any databases were loaded the st.cmd file will\n" "be run *after* iocInit. To perform iocsh commands before iocInit, all database\n" "loading must be performed by the script itself, or by the user from the\n" "interactive IOC shell.\n" "\n" "Compiled-in path to softIocPVA.dbd is:\n" "\t"<