forked from epics-base/epics-base
-
Notifications
You must be signed in to change notification settings - Fork 2
/
iocsh.h
109 lines (90 loc) · 2.95 KB
/
iocsh.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/* iocsh.h ioc: call registered function*/
/* Author: Marty Kraimer Date: 27APR2000 */
#ifndef INCiocshH
#define INCiocshH
#include <stdio.h>
#include "compilerDependencies.h"
#include "shareLib.h"
#if defined(vxWorks) || defined(__rtems__)
#define IOCSH_STATIC_FUNC
#else
#define IOCSH_STATIC_FUNC static EPICS_ALWAYS_INLINE
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
iocshArgInt,
iocshArgDouble,
iocshArgString,
iocshArgPdbbase,
iocshArgArgv,
iocshArgPersistentString
}iocshArgType;
typedef union iocshArgBuf {
int ival;
double dval;
char *sval;
void *vval;
struct {
int ac;
char **av;
} aval;
}iocshArgBuf;
typedef struct iocshVarDef {
const char *name;
iocshArgType type;
void * pval;
}iocshVarDef;
typedef struct iocshArg {
const char *name;
iocshArgType type;
}iocshArg;
typedef struct iocshFuncDef {
const char *name;
int nargs;
const iocshArg * const *arg;
}iocshFuncDef;
typedef void (*iocshCallFunc)(const iocshArgBuf *argBuf);
typedef struct iocshCmdDef {
iocshFuncDef const *pFuncDef;
iocshCallFunc func;
}iocshCmdDef;
epicsShareFunc void epicsShareAPI iocshRegister(
const iocshFuncDef *piocshFuncDef, iocshCallFunc func);
epicsShareFunc void epicsShareAPI iocshRegisterVariable (
const iocshVarDef *piocshVarDef);
epicsShareFunc const iocshCmdDef * epicsShareAPI iocshFindCommand(
const char* name);
epicsShareFunc const iocshVarDef * epicsShareAPI iocshFindVariable(
const char* name);
/* iocshFree frees storage used by iocshRegister*/
/* This should only be called when iocsh is no longer needed*/
epicsShareFunc void epicsShareAPI iocshFree(void);
epicsShareFunc int epicsShareAPI iocsh(const char *pathname);
epicsShareFunc int epicsShareAPI iocshCmd(const char *cmd);
epicsShareFunc int epicsShareAPI iocshLoad(const char *pathname, const char* macros);
epicsShareFunc int epicsShareAPI iocshRun(const char *cmd, const char* macros);
/** @brief Signal error from an IOC shell function.
*
* @param err 0 - success (no op), !=0 - error
* @return The err argument value.
*/
epicsShareFunc int iocshSetError(int err);
/* Makes macros that shadow environment variables work correctly with epicsEnvSet */
epicsShareFunc void epicsShareAPI iocshEnvClear(const char *name);
/* 'weak' link to pdbbase */
epicsShareExtern struct dbBase **iocshPpdbbase;
#ifdef __cplusplus
}
#endif
#endif /*INCiocshH*/