Enhanced EPICS iocshCmd functions. More...
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <math.h>
#include <exception>
#include <algorithm>
#include <stdexcept>
#include <iostream>
#include <map>
#include <list>
#include <string>
#include <time.h>
#include <sstream>
#include <fstream>
#include <unistd.h>
#include "epicsStdlib.h"
#include "epicsString.h"
#include "epicsStdio.h"
#include "dbDefs.h"
#include "epicsMutex.h"
#include "dbBase.h"
#include "dbStaticLib.h"
#include "dbFldTypes.h"
#include "dbCommon.h"
#include "dbAccessDefs.h"
#include <epicsTypes.h>
#include <epicsTime.h>
#include <epicsThread.h>
#include <epicsTimer.h>
#include <iocsh.h>
#include "envDefs.h"
#include "macLib.h"
#include "errlog.h"
#include <registryFunction.h>
#include <epicsExport.h>
#include "utilities.h"
Go to the source code of this file.
Functions | |
static char * | ioc_getenv (const char *var) |
static void | loadMacEnviron (MAC_HANDLE *pmh) |
static void | subMacros (std::string &new_macros, const char *macros, const char *loopVar) |
look for e.g. $(I) and replace with so we can substitute later with macEnvExpand() More... | |
epicsShareFunc void | iocshCmdLoop (const char *command, const char *macros, const char *loopVar, int start, int stop, int step) |
Execute command multiple times substituting a specified macro according to a number range. More... | |
epicsShareFunc void | iocshCmdList (const char *command, const char *macros, const char *loopVar, const char *list, const char *sep) |
Execute a command multiple times according to a list of items separated by known separator(s). More... | |
static void | iocshCmdLoopInitCallFunc (const iocshArgBuf *args) |
static void | iocshCmdListInitCallFunc (const iocshArgBuf *args) |
static void | iocshCmdFuncsRegister (void) |
epicsExportRegistrar (iocshCmdFuncsRegister) | |
Variables | |
static const iocshArg | iocshCmdLoopInitArg0 = { "command", iocshArgString } |
command string More... | |
static const iocshArg | iocshCmdLoopInitArg1 = { "macros", iocshArgString } |
macros to pass to command More... | |
static const iocshArg | iocshCmdLoopInitArg2 = { "loopVar", iocshArgString } |
loop macro variable name More... | |
static const iocshArg | iocshCmdLoopInitArg3 = { "start", iocshArgInt } |
Loop start value. More... | |
static const iocshArg | iocshCmdLoopInitArg4 = { "stop", iocshArgInt } |
Loop end value. More... | |
static const iocshArg | iocshCmdLoopInitArg5 = { "step", iocshArgInt } |
Loop step (default: 1) More... | |
static const iocshArg *const | iocshCmdLoopInitArgs [] |
static const iocshArg | iocshCmdListInitArg0 = { "command", iocshArgString } |
command string More... | |
static const iocshArg | iocshCmdListInitArg1 = { "macros", iocshArgString } |
macros to pass to command More... | |
static const iocshArg | iocshCmdListInitArg2 = { "loopVar", iocshArgString } |
list macro variable name More... | |
static const iocshArg | iocshCmdListInitArg3 = { "list", iocshArgString } |
list of values to substitute More... | |
static const iocshArg | iocshCmdListInitArg4 = { "sep", iocshArgString } |
list value separator character More... | |
static const iocshArg *const | iocshCmdListInitArgs [] |
static const iocshFuncDef | iocshCmdLoopDef = {"iocshCmdLoop", sizeof(iocshCmdLoopInitArgs) / sizeof(iocshArg*), iocshCmdLoopInitArgs} |
static const iocshFuncDef | iocshCmdListDef = {"iocshCmdList", sizeof(iocshCmdListInitArgs) / sizeof(iocshArg*), iocshCmdListInitArgs} |
Enhanced EPICS iocshCmd functions.
Definition in file iocshCmdFuncs.cpp.
epicsExportRegistrar | ( | iocshCmdFuncsRegister | ) |
|
static |
Definition at line 52 of file iocshCmdFuncs.cpp.
Referenced by iocshCmdList(), and iocshCmdLoop().
|
static |
Definition at line 283 of file iocshCmdFuncs.cpp.
References iocshCmdListInitCallFunc(), and iocshCmdLoopInitCallFunc().
epicsShareFunc void iocshCmdList | ( | const char * | command, |
const char * | macros, | ||
const char * | loopVar, | ||
const char * | list, | ||
const char * | sep | ||
) |
Execute a command multiple times according to a list of items separated by known separator(s).
The command argument is executed, as per the usual EPICS iocshCmd(), but with additional environment variables set according to the macros arguments; however at the end of execution these macros are reset back to their original values. It is possible to embed a changing macro loopVar within this list whose value follows items in list.
The name of the macro to be used for substitution is contained in loopVar and needs to be referenced in an \ escaped way to make sure EPICS does not try to substitute it too soon. As well as the macros the command is also passed the loopVar macro value
[in] | command | command string |
[in] | macros | macros to pass to command |
[in] | loopVar | list macro variable name |
[in] | list | list of values to substitute |
[in] | sep | list value separator character |
Definition at line 194 of file iocshCmdFuncs.cpp.
References ioc_getenv(), loadMacEnviron(), and subMacros().
Referenced by iocshCmdListInitCallFunc().
|
static |
Definition at line 278 of file iocshCmdFuncs.cpp.
References iocshCmdList().
Referenced by iocshCmdFuncsRegister().
epicsShareFunc void iocshCmdLoop | ( | const char * | command, |
const char * | macros, | ||
const char * | loopVar, | ||
int | start, | ||
int | stop, | ||
int | step | ||
) |
Execute command multiple times substituting a specified macro according to a number range.
The command argument is executed, as per the usual EPICS iocshCmd(), but with additional environment variables set according to the macros arguments; however at the end of execution these macros are reset back to their original values. It is possible to embed a changing macro loopVar within this list whose value follows the range start to stop.
The name of the macro to be used for substitution is contained in loopVar and needs to be referenced in an \ escaped way to make sure EPICS does not try to substitute it too soon. As well as the macros the command is also passed the loopVar macro value
[in] | command | command string |
[in] | macros | macros to pass to command |
[in] | loopVar | loop macro variable name |
[in] | start | Loop start value. |
[in] | stop | Loop end value. |
[in] | step | Loop step (default: 1) |
Definition at line 123 of file iocshCmdFuncs.cpp.
References ioc_getenv(), loadMacEnviron(), and subMacros().
Referenced by iocshCmdLoopInitCallFunc().
|
static |
Definition at line 273 of file iocshCmdFuncs.cpp.
References iocshCmdLoop().
Referenced by iocshCmdFuncsRegister().
|
static |
Definition at line 65 of file iocshCmdFuncs.cpp.
Referenced by iocshCmdList(), and iocshCmdLoop().
|
static |
look for e.g. $(I) and replace with so we can substitute later with macEnvExpand()
Definition at line 81 of file iocshCmdFuncs.cpp.
Referenced by iocshCmdList(), and iocshCmdLoop().
|
static |
Definition at line 271 of file iocshCmdFuncs.cpp.
|
static |
command string
Definition at line 261 of file iocshCmdFuncs.cpp.
|
static |
macros to pass to command
Definition at line 262 of file iocshCmdFuncs.cpp.
|
static |
list macro variable name
Definition at line 263 of file iocshCmdFuncs.cpp.
|
static |
list of values to substitute
Definition at line 264 of file iocshCmdFuncs.cpp.
|
static |
list value separator character
Definition at line 265 of file iocshCmdFuncs.cpp.
|
static |
Definition at line 266 of file iocshCmdFuncs.cpp.
|
static |
Definition at line 269 of file iocshCmdFuncs.cpp.
|
static |
command string
Definition at line 252 of file iocshCmdFuncs.cpp.
|
static |
macros to pass to command
Definition at line 253 of file iocshCmdFuncs.cpp.
|
static |
loop macro variable name
Definition at line 254 of file iocshCmdFuncs.cpp.
|
static |
Loop start value.
Definition at line 255 of file iocshCmdFuncs.cpp.
|
static |
Loop end value.
Definition at line 256 of file iocshCmdFuncs.cpp.
|
static |
Loop step (default: 1)
Definition at line 257 of file iocshCmdFuncs.cpp.
|
static |
Definition at line 258 of file iocshCmdFuncs.cpp.