EPICS Base 7.0.8.0
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Enumerations | Functions | Variables
iocsh.h File Reference

C and C++ defintions of functions for IOC shell programming. More...

#include <stdio.h>
#include "compilerDependencies.h"
#include "libComAPI.h"
Include dependency graph for iocsh.h:

Go to the source code of this file.

Classes

union  iocshArgBuf
 
struct  iocshVarDef
 
struct  iocshArg
 
struct  iocshFuncDef
 
struct  iocshCmdDef
 

Macros

#define IOCSH_STATIC_FUNC   static EPICS_ALWAYS_INLINE
 
#define IOCSHFUNCDEF_HAS_USAGE
 

Typedefs

typedef void(* iocshCallFunc) (const iocshArgBuf *argBuf)
 

Enumerations

enum  iocshArgType {
  iocshArgInt , iocshArgDouble , iocshArgString , iocshArgPdbbase ,
  iocshArgArgv , iocshArgPersistentString , iocshArgStringRecord , iocshArgStringPath
}
 

Functions

LIBCOM_API void epicsStdCall iocshRegister (const iocshFuncDef *piocshFuncDef, iocshCallFunc func)
 This function is used to register a command with the IOC shell.
 
LIBCOM_API void epicsStdCall iocshRegisterVariable (const iocshVarDef *piocshVarDef)
 
LIBCOM_API const iocshCmdDef *epicsStdCall iocshFindCommand (const char *name) EPICS_DEPRECATED
 Returns a struct of type iocshCmdDef whose element values are determined by the name parameter. This function calls the function registryFind, defined in Registry.h.
 
LIBCOM_API const iocshVarDef *epicsStdCall iocshFindVariable (const char *name)
 Returns a struct of type iocshVarDef whose element values are determined by the name parameter. This function calls the function registryFind, defined in Registry.h.
 
LIBCOM_API void epicsStdCall iocshFree (void)
 Frees all memory allocated to registered commands and variables.
 
LIBCOM_API int epicsStdCall iocsh (const char *pathname)
 This function is used to execute IOC shell commands from a file.
 
LIBCOM_API int epicsStdCall iocshCmd (const char *cmd)
 This function is used to exectute a single IOC shell command.
 
LIBCOM_API int epicsStdCall iocshLoad (const char *pathname, const char *macros)
 Read and evaluate IOC shell commands from the given file. A list of macros can be supplied as a parameter. These macros are treated as environment variables during exectution of the file's commands.
 
LIBCOM_API int epicsStdCall iocshRun (const char *cmd, const char *macros)
 Evaluate a single IOC shell command. A list of macros can be supplied as a parameter. These macros are treated as environment variables during exectution of the command.
 
LIBCOM_API int iocshSetError (int err)
 Signal error from an IOC shell function.
 
LIBCOM_API void epicsStdCall iocshEnvClear (const char *name)
 Unsets macro values.
 

Variables

LIBCOM_API struct dbBase ** iocshPpdbbase
 

Detailed Description

The iocsh API provides an interface for running commands in the shell of the IOC, as well as registering commands and variables for use in the shell. It consists of 4 functions for the former and 2 functions for the latter.

Command functions:
int iocsh (const char *pathname)
int iocshLoad (const char *pathname, const char *macros)
int iocshCmd (const char *cmd)
int iocshRun (const char *cmd, const char *macros)
Registration functions:
void iocshRegister (const iocshFuncDef * piocshFuncDef, iocshCallFunc func)
void epicsStdCall iocshRegisterVariable (const iocshVarDef *piocshVarDef)

Definition in file iocsh.h.

Macro Definition Documentation

◆ IOCSH_STATIC_FUNC

#define IOCSH_STATIC_FUNC   static EPICS_ALWAYS_INLINE

Definition at line 44 of file iocsh.h.

◆ IOCSHFUNCDEF_HAS_USAGE

#define IOCSHFUNCDEF_HAS_USAGE

Definition at line 164 of file iocsh.h.

Typedef Documentation

◆ iocshCallFunc

typedef void(* iocshCallFunc) (const iocshArgBuf *argBuf)

Definition at line 184 of file iocsh.h.

Enumeration Type Documentation

◆ iocshArgType

This typedef lists the values that can be used as argument data types when building the piocshFuncDef parameter of iocshRegister().

static const iocshArg AsynGenericConfigArg0 = {"Port Name", iocshArgString};
static const iocshArg AsynGenericConfigArg1 = {"Number Devices", iocshArgInt};
Provides an RAII style lock/unlock of a mutex.
Definition epicsGuard.h:53
Enumerator
iocshArgStringRecord 

Equivalent to iocshArgString with a hint for tab completion that the argument is a record name.

Since
7.0.8
iocshArgStringPath 

Equivalent to iocshArgString with a hint for tab completion that the argument is a file system path.

Since
7.0.8

Definition at line 62 of file iocsh.h.

Function Documentation

◆ iocshRegister()

LIBCOM_API void epicsStdCall iocshRegister ( const iocshFuncDef piocshFuncDef,
iocshCallFunc  func 
)
Parameters
piocshFuncDefA pointer to a data structure that describes the command and its arguments.
funcA pointer to a function which is called by iocsh() when the command is encountered.
Returns
void

◆ iocshRegisterVariable()

LIBCOM_API void epicsStdCall iocshRegisterVariable ( const iocshVarDef piocshVarDef)
Parameters
piocshVarDef
Returns
void

◆ iocshFindCommand()

LIBCOM_API const iocshCmdDef *epicsStdCall iocshFindCommand ( const char name)
Parameters
name
Returns
const iocshCmdDef*

◆ iocshFindVariable()

LIBCOM_API const iocshVarDef *epicsStdCall iocshFindVariable ( const char name)
Parameters
name
Returns
const iocshVarDef*

◆ iocshFree()

LIBCOM_API void epicsStdCall iocshFree ( void  )
Returns
void

◆ iocsh()

LIBCOM_API int epicsStdCall iocsh ( const char pathname)

Commands are read from the file until and exit command is encountered or the end-of-file character is reached.

Parameters
pathnameA string that represents the path to a file from which commands are read.
Returns
0 on success, non-zero on error

Equivalent to:

LIBCOM_API int epicsStdCall iocshLoad(const char *pathname, const char *macros)
Read and evaluate IOC shell commands from the given file. A list of macros can be supplied as a param...

◆ iocshCmd()

LIBCOM_API int epicsStdCall iocshCmd ( const char cmd)
Parameters
cmdA string that represents the command to be executed.
Returns
0 on success, non-zero on error

Equivalent to:

iocshRun(cmd, NULL)
LIBCOM_API int epicsStdCall iocshRun(const char *cmd, const char *macros)
Evaluate a single IOC shell command. A list of macros can be supplied as a parameter....

◆ iocshLoad()

LIBCOM_API int epicsStdCall iocshLoad ( const char pathname,
const char macros 
)
Parameters
pathnameA string that represents the path to a file from which commands are read.
macrosNULL or a comma separated list of macro definitions. eg. "VAR1=x,VAR2=y"
Returns
0 on success, non-zero on error

◆ iocshRun()

LIBCOM_API int epicsStdCall iocshRun ( const char cmd,
const char macros 
)
Parameters
cmdCommand string. eg. "echo \"something or other\""
macrosNULL or a comma separated list of macro definitions. eg. "VAR1=x,VAR2=y"
Returns
0 on success, non-zero on error

◆ iocshSetError()

LIBCOM_API int iocshSetError ( int  err)
Parameters
err0 - success (no op), !=0 - error
Returns
The err argument value.
Since
7.0.3.1

◆ iocshEnvClear()

LIBCOM_API void epicsStdCall iocshEnvClear ( const char name)

This function sets the values of all macros passed to either iocshLoad or iocshRun to NULL.

Parameters
name
Returns
void