Reorganized iocsh command registration to untangle the build order.

The iocsh core is now part of libCom, and commands are registered locally
with a Register routine for each IOC library.
This commit is contained in:
Andrew Johnson
2007-03-13 17:54:23 +00:00
parent bc01dca042
commit 70cc7eaab9
59 changed files with 1055 additions and 1372 deletions
+10 -6
View File
@@ -13,17 +13,21 @@ include $(TOP)/configure/CONFIG
DBD += base.dbd
INC += epicsRelease.h
INC += iocInit.h
INC += epicsRelease.h
INC += iocInit.h
INC += miscIocRegister.h
INC += iocshRegisterCommon.h
LIBSRCS += epicsRelease.c
LIBSRCS += iocInit.c
LIBSRCS += asSubRecordFunctions.c
LIB_SRCS += epicsRelease.c
LIB_SRCS += iocInit.c
LIB_SRCS += asSubRecordFunctions.c
LIB_SRCS += miscIocRegister.c
LIB_SRCS += iocshRegisterCommon.c
LIBRARY_IOC = miscIoc
miscIoc_RCS_WIN32 = miscIoc.rc
miscIoc_LIBS = rsrvIoc asIoc dbIoc registryIoc dbStaticIoc ca Com
miscIoc_LIBS = rsrvIoc asIoc dbtoolsIoc dbIoc registryIoc dbStaticIoc ca Com
# For R3.13 compatibility only
ifeq ($(strip $(COMPAT_313)),YES)
+36
View File
@@ -0,0 +1,36 @@
/*************************************************************************\
* Copyright (c) 2007 UChicago Argonne LLC, 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 is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#include "iocsh.h"
#include "dbAccess.h"
#include "dbStaticIocRegister.h"
#include "registryIocRegister.h"
#include "asIocRegister.h"
#include "dbIocRegister.h"
#include "dbtoolsIocRegister.h"
#include "rsrvIocRegister.h"
#include "miscIocRegister.h"
#include "libComRegister.h"
#define epicsExportSharedSymbols
#include "iocshRegisterCommon.h"
void epicsShareAPI iocshRegisterCommon(void)
{
iocshPpdbbase = &pdbbase;
dbStaticIocRegister();
registryIocRegister();
dbIocRegister();
dbtoolsIocRegister();
asIocRegister();
rsrvIocRegister();
miscIocRegister();
libComRegister();
}
+28
View File
@@ -0,0 +1,28 @@
/*************************************************************************\
* Copyright (c) 2007 UChicago Argonne LLC, 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 is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/* iocshRegisterCommon.h */
/* Author: Marty Kraimer Date: 27APR2000 */
#ifndef INCiocshRegisterCommonH
#define INCiocshRegisterCommonH
#include "shareLib.h"
#ifdef __cplusplus
extern "C" {
#endif
/* register many useful commands */
epicsShareFunc void epicsShareAPI iocshRegisterCommon(void);
#ifdef __cplusplus
}
#endif
#endif /*INCiocshRegisterCommonH*/
+65
View File
@@ -0,0 +1,65 @@
/*************************************************************************\
* Copyright (c) 2007 UChicago Argonne LLC, 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 is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#include <stdlib.h>
#include "iocsh.h"
#include "errlog.h"
#include "epicsExport.h"
#define epicsExportSharedSymbols
#include "iocInit.h"
#include "epicsRelease.h"
#include "miscIocRegister.h"
/* iocInit */
static const iocshFuncDef iocInitFuncDef =
{"iocInit",0,NULL};
static void iocInitCallFunc(const iocshArgBuf *args)
{
iocInit();
}
/* coreRelease */
static const iocshFuncDef coreReleaseFuncDef = {"coreRelease",0,NULL};
static void coreReleaseCallFunc(const iocshArgBuf *args)
{
coreRelease ();
}
void epicsShareAPI miscIocRegister(void)
{
iocshRegister(&iocInitFuncDef,iocInitCallFunc);
iocshRegister(&coreReleaseFuncDef, coreReleaseCallFunc);
}
/* system -- escape to system command interpreter.
*
* Disabled by default, for security reasons. To enable this command, add
* registrar(iocshSystemCommand)
* to an application dbd file.
*/
static const iocshArg systemArg0 = { "command string",iocshArgString};
static const iocshArg * const systemArgs[] = {&systemArg0};
static const iocshFuncDef systemFuncDef = {"system",1,systemArgs};
static void systemCallFunc(const iocshArgBuf *args)
{
system(args[0].sval);
}
static void iocshSystemCommand(void)
{
if (system(NULL))
iocshRegister(&systemFuncDef, systemCallFunc);
else
errlogPrintf ("Can't register 'system' command -- no command interpreter available.\n");
}
epicsExportRegistrar(iocshSystemCommand);
+25
View File
@@ -0,0 +1,25 @@
/*************************************************************************\
* Copyright (c) 2007 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 is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#ifndef INC_miscIocRegister_H
#define INC_miscIocRegister_H
#include "shareLib.h"
#ifdef __cplusplus
extern "C" {
#endif
epicsShareFunc void epicsShareAPI miscIocRegister(void);
#ifdef __cplusplus
}
#endif
#endif /* INC_miscIocRegister_H */