build: atInit module moved to libcom.
This commit is contained in:
committed by
Andrew Johnson
parent
41f19bd798
commit
8752372af1
@@ -11,10 +11,6 @@
|
||||
|
||||
SRC_DIRS += $(IOCDIR)/misc
|
||||
|
||||
# Include atInit module
|
||||
DBD += atInit.dbd
|
||||
dbCore_SRCS += atInit.c
|
||||
|
||||
DBD += system.dbd
|
||||
DBD += dlload.dbd
|
||||
DBD += dbCore.dbd
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
registrar(atInitRegister)
|
||||
@@ -19,8 +19,6 @@ DBD += softIoc.dbd
|
||||
softIoc_DBD += base.dbd
|
||||
softIoc_DBD += dlload.dbd
|
||||
softIoc_DBD += system.dbd
|
||||
# Include atInit module
|
||||
softIoc_DBD += atInit.dbd
|
||||
|
||||
softIoc_SRCS += softIoc_registerRecordDeviceDriver.cpp
|
||||
softIoc_SRCS_DEFAULT += softMain.cpp
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Copyright (c) 2010 UChicago Argonne LLC, as Operator of Argonne
|
||||
# National Laboratory.
|
||||
# EPICS BASE is distributed subject to a Software License Agreement found
|
||||
# in file LICENSE that is included with this distribution.
|
||||
# in file LICENSE that is included with this distribution.
|
||||
#*************************************************************************
|
||||
|
||||
# This is a Makefile fragment, see src/libCom/Makefile.
|
||||
@@ -16,6 +16,7 @@ Com_SRCS += iocsh.cpp
|
||||
Com_SRCS += initHooks.c
|
||||
Com_SRCS += registry.c
|
||||
Com_SRCS += libComRegister.c
|
||||
Com_SRCS += atInit.c
|
||||
|
||||
iocsh_CXXFLAGS += -DEPICS_COMMANDLINE_LIBRARY=EPICS_COMMANDLINE_LIBRARY_$(COMMANDLINE_LIBRARY)
|
||||
iocsh_INCLUDES += $(INCLUDES_$(COMMANDLINE_LIBRARY))
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
/* Copyright (C) 2020 Dirk Zimoch */
|
||||
/* Copyright (C) 2020-2025 European Spallation Source, ERIC */
|
||||
/* Copyright (C) 2020-2025 European Spallation Source, ERIC
|
||||
* Maintainer: Jerzy Jamroz
|
||||
*/
|
||||
|
||||
#include <cantProceed.h>
|
||||
#include <dbAccess.h>
|
||||
#include <ellLib.h>
|
||||
#include <epicsExport.h>
|
||||
#include <epicsStdio.h>
|
||||
#include <epicsString.h>
|
||||
#include <errlog.h>
|
||||
#include <errno.h>
|
||||
#include <initHooks.h>
|
||||
#include <iocsh.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "atInit.h"
|
||||
|
||||
#define __AT_INIT_LOG(svr) svr " atInit: "
|
||||
|
||||
// Version within the message
|
||||
static const char helpMessage[] =
|
||||
"atInit version 2.0.1\n"
|
||||
"atInit version 2.1.1\n"
|
||||
"Allows you to define commands to be run after the iocInit\n"
|
||||
"Example commands:\n"
|
||||
" atInit \"dbpf <PV> <VAL>\"\n"
|
||||
@@ -30,7 +30,8 @@ struct cmditem
|
||||
char* cmd;
|
||||
};
|
||||
|
||||
static ELLLIST cmdlist;
|
||||
static ELLLIST s_cmdlist = {};
|
||||
static int s_initendflag = 0; // Defines the end of the initialization
|
||||
|
||||
static void atInitHook(initHookState state)
|
||||
{
|
||||
@@ -39,7 +40,7 @@ static void atInitHook(initHookState state)
|
||||
|
||||
struct cmditem* item = NULL;
|
||||
|
||||
while(item = (struct cmditem*)ellGet(&cmdlist))
|
||||
while(item = (struct cmditem*)ellGet(&s_cmdlist))
|
||||
{
|
||||
epicsStdoutPrintf("%s\n", item->cmd);
|
||||
|
||||
@@ -48,6 +49,8 @@ static void atInitHook(initHookState state)
|
||||
|
||||
free(item);
|
||||
}
|
||||
|
||||
s_initendflag = 1;
|
||||
}
|
||||
|
||||
static struct cmditem* newItem(char* cmd)
|
||||
@@ -64,7 +67,7 @@ static struct cmditem* newItem(char* cmd)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ellAdd(&cmdlist, &item->node);
|
||||
ellAdd(&s_cmdlist, &item->node);
|
||||
|
||||
return item;
|
||||
}
|
||||
@@ -80,7 +83,7 @@ static void atInitFunc(const iocshArgBuf* args)
|
||||
static int first_time = 1;
|
||||
char* cmd = args[0].sval;
|
||||
|
||||
if(interruptAccept)
|
||||
if(s_initendflag)
|
||||
{
|
||||
epicsStdoutPrintf(__AT_INIT_LOG(ERL_WARNING) "can only be used before iocInit (check help)\n");
|
||||
return;
|
||||
@@ -108,7 +111,7 @@ static void atInitFunc(const iocshArgBuf* args)
|
||||
epicsStdoutPrintf(__AT_INIT_LOG(ERL_ERROR) "failed to add the command '%s' %s\n", cmd, strerror(errno));
|
||||
}
|
||||
|
||||
static void atInitRegister(void)
|
||||
void atInitRegister(void)
|
||||
{
|
||||
static int first_time = 1;
|
||||
if(first_time)
|
||||
@@ -119,5 +122,3 @@ static void atInitRegister(void)
|
||||
}
|
||||
|
||||
#undef __AT_INIT_LOG
|
||||
|
||||
epicsExportRegistrar(atInitRegister);
|
||||
6
modules/libcom/src/iocsh/atInit.h
Normal file
6
modules/libcom/src/iocsh/atInit.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef INC_atInit_H
|
||||
#define INC_atInit_H
|
||||
|
||||
void atInitRegister(void);
|
||||
|
||||
#endif /* INC_atInit_H */
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "epicsGeneralTime.h"
|
||||
#include "freeList.h"
|
||||
#include "libComRegister.h"
|
||||
|
||||
#include "atInit.h"
|
||||
/* Register the PWD environment variable when the cd IOC shell function is
|
||||
* registered. This variable contains the current directory path.
|
||||
*/
|
||||
@@ -512,6 +512,8 @@ void epicsStdCall libComRegister(void)
|
||||
iocshRegister(&generalTimeReportFuncDef,generalTimeReportCallFunc);
|
||||
iocshRegister(&installLastResortEventProviderFuncDef, installLastResortEventProviderCallFunc);
|
||||
|
||||
atInitRegister();
|
||||
|
||||
comDefs[0].pval = &asCheckClientIP;
|
||||
comDefs[1].pval = &freeListBypass;
|
||||
iocshRegisterVariable(comDefs);
|
||||
|
||||
Reference in New Issue
Block a user