This is Unofficial EPICS BASE Doxygen Site
iocsh.h
Go to the documentation of this file.
1 /*************************************************************************\
2 * Copyright (c) 2002 The University of Chicago, as Operator of Argonne
3 * National Laboratory.
4 * Copyright (c) 2002 The Regents of the University of California, as
5 * Operator of Los Alamos National Laboratory.
6 * EPICS BASE Versions 3.13.7
7 * and higher are distributed subject to a Software License Agreement found
8 * in file LICENSE that is included with this distribution.
9 \*************************************************************************/
10 /* iocsh.h ioc: call registered function*/
11 /* Author: Marty Kraimer Date: 27APR2000 */
12 
13 #ifndef INCiocshH
14 #define INCiocshH
15 
16 #include <stdio.h>
17 #include "compilerDependencies.h"
18 #include "libComAPI.h"
19 
20 #if defined(vxWorks) || defined(__rtems__)
21 #define IOCSH_STATIC_FUNC
22 #else
23 #define IOCSH_STATIC_FUNC static EPICS_ALWAYS_INLINE
24 #endif
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 typedef enum {
38 
39 typedef union iocshArgBuf {
40  int ival;
41  double dval;
42  char *sval;
43  void *vval;
44  struct {
45  int ac;
46  char **av;
47  } aval;
49 
50 typedef struct iocshVarDef {
51  const char *name;
52  iocshArgType type;
53  void * pval;
55 
56 typedef struct iocshArg {
57  const char *name;
58  iocshArgType type;
59 }iocshArg;
60 
61 typedef struct iocshFuncDef {
62  const char *name;
63  int nargs;
64  const iocshArg * const *arg;
65  const char* usage;
67 #define IOCSHFUNCDEF_HAS_USAGE
68 
69 typedef void (*iocshCallFunc)(const iocshArgBuf *argBuf);
70 
71 typedef struct iocshCmdDef {
75 
76 LIBCOM_API void epicsStdCall iocshRegister(
77  const iocshFuncDef *piocshFuncDef, iocshCallFunc func);
78 LIBCOM_API void epicsStdCall iocshRegisterVariable (
79  const iocshVarDef *piocshVarDef);
80 LIBCOM_API const iocshCmdDef * epicsStdCall iocshFindCommand(
81  const char* name) EPICS_DEPRECATED;
82 LIBCOM_API const iocshVarDef * epicsStdCall iocshFindVariable(
83  const char* name);
84 
85 /* iocshFree frees storage used by iocshRegister*/
86 /* This should only be called when iocsh is no longer needed*/
87 LIBCOM_API void epicsStdCall iocshFree(void);
88 
90 LIBCOM_API int epicsStdCall iocsh(const char *pathname);
92 LIBCOM_API int epicsStdCall iocshCmd(const char *cmd);
98 LIBCOM_API int epicsStdCall iocshLoad(const char *pathname, const char* macros);
104 LIBCOM_API int epicsStdCall iocshRun(const char *cmd, const char* macros);
105 
111 LIBCOM_API int iocshSetError(int err);
112 
113 /* Makes macros that shadow environment variables work correctly with epicsEnvSet */
114 LIBCOM_API void epicsStdCall iocshEnvClear(const char *name);
115 
116 /* 'weak' link to pdbbase */
117 LIBCOM_API extern struct dbBase **iocshPpdbbase;
118 
119 #ifdef __cplusplus
120 }
121 #endif
122 
123 #endif /*INCiocshH*/
struct iocshCmdDef iocshCmdDef
iocshCallFunc func
Definition: iocsh.h:73
LIBCOM_API void epicsStdCall iocshEnvClear(const char *name)
Definition: iocsh.cpp:1054
LIBCOM_API int iocshSetError(int err)
Signal error from an IOC shell function.
Definition: iocsh.cpp:536
struct iocshArgBuf::@13 aval
iocshFuncDef const * pFuncDef
Definition: iocsh.h:72
iocshArgType
Definition: iocsh.h:30
LIBCOM_API int epicsStdCall iocsh(const char *pathname)
Definition: iocsh.cpp:1011
LIBCOM_API const iocshCmdDef *epicsStdCall iocshFindCommand(const char *name) EPICS_DEPRECATED
Definition: iocsh.cpp:154
const char * name
Definition: iocsh.h:57
struct iocshFuncDef iocshFuncDef
char * sval
Definition: iocsh.h:42
struct iocshArg iocshArg
LIBCOM_API int epicsStdCall iocshCmd(const char *cmd)
Definition: iocsh.cpp:1017
char ** av
Definition: iocsh.h:46
const char * name
Definition: iocsh.h:51
iocshArgType type
Definition: iocsh.h:52
const iocshArg *const * arg
Definition: iocsh.h:64
LIBCOM_API const iocshVarDef *epicsStdCall iocshFindVariable(const char *name)
Definition: iocsh.cpp:222
double dval
Definition: iocsh.h:41
LIBCOM_API struct dbBase ** iocshPpdbbase
Definition: iocsh.cpp:41
int ac
Definition: iocsh.h:45
LIBCOM_API void epicsStdCall iocshRegisterVariable(const iocshVarDef *piocshVarDef)
Definition: iocsh.cpp:167
const char * name
Definition: iocsh.h:62
LIBCOM_API int epicsStdCall iocshLoad(const char *pathname, const char *macros)
Definition: iocsh.cpp:1023
struct iocshVarDef iocshVarDef
int ival
Definition: iocsh.h:40
LIBCOM_API void epicsStdCall iocshRegister(const iocshFuncDef *piocshFuncDef, iocshCallFunc func)
Definition: iocsh.cpp:111
struct rset rset EPICS_DEPRECATED
Definition: recSup.h:88
Definition: dbBase.h:170
LIBCOM_API int epicsStdCall iocshRun(const char *cmd, const char *macros)
Definition: iocsh.cpp:1031
void * vval
Definition: iocsh.h:43
const char * usage
Definition: iocsh.h:65
void * pval
Definition: iocsh.h:53
Compiler specific declarations.
LIBCOM_API void epicsStdCall iocshFree(void)
Definition: iocsh.cpp:231
union iocshArgBuf iocshArgBuf
int nargs
Definition: iocsh.h:63
iocshArgType type
Definition: iocsh.h:58
Definition: iocsh.h:56
void(* iocshCallFunc)(const iocshArgBuf *argBuf)
Definition: iocsh.h:69