EPICS Base  7.0.6.1
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
iocsh.h
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 * SPDX-License-Identifier: EPICS
7 * EPICS Base is 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 {
31  iocshArgInt,
32  iocshArgDouble,
33  iocshArgString,
34  iocshArgPdbbase,
35  iocshArgArgv,
36  iocshArgPersistentString
37 }iocshArgType;
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 {
72  iocshFuncDef const *pFuncDef;
73  iocshCallFunc func;
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*/
Compiler specific declarations.
Definition: iocsh.h:56
Definition: dbBase.h:171