various improvements
- use dig for resolving host names - ascon.c: fix terminator parsing - property callback: change property before callback - logger.c:default for logger period must be the old value instead of 1 - add frappy type history writing - increase max. logreader line length - HIPNONE returns "null" with json protocol - encode strings properly in formatNameValue - fix memory leak in json2tcl - scriptcontext: do not show debug messages when script starts with underscore or when the "send" property is empty - scriptcontext: remove args for action timestamp - scriptcontext: "que" function will replace an already queued action, e.g. for 'halt - introduced updatestatus script
This commit is contained in:
243
sea_ofac.c
Normal file
243
sea_ofac.c
Normal file
@ -0,0 +1,243 @@
|
||||
/**
|
||||
* Startup commands and definitions
|
||||
*
|
||||
* copyright: see file COPYRIGHT
|
||||
*
|
||||
* Mark Koennecke 1996 - ?
|
||||
* heavy modifications to separate PSI specific commands into a
|
||||
* separate library. Mark Koennecke, June 2003
|
||||
*
|
||||
* moved some functions to sicsutil.c
|
||||
* Markus Zolliker Jan 2010
|
||||
*
|
||||
* reduced version for SEA only, June 2020
|
||||
*/
|
||||
|
||||
#include "ofac.h"
|
||||
#include "exeman.h"
|
||||
#include "statusfile.h"
|
||||
#include "site.h"
|
||||
#include "sicshipadaba.h"
|
||||
#include "sicsglobal.h"
|
||||
|
||||
static unsigned int killStartupCommands = 1;
|
||||
int isDuringInitialization;
|
||||
|
||||
|
||||
extern void DevExecInit(void); /* devexec.c */
|
||||
/*--------------------------------------------------------------------------*/
|
||||
static void InitGeneral(void)
|
||||
{
|
||||
#define INIT(F) { void F(void); F(); }
|
||||
|
||||
/* insert here initialization routines ... */
|
||||
|
||||
INIT(StatisticsInit);
|
||||
INIT(InitializerInit);
|
||||
INIT(SaveHdbInit); /* must be after InitializerInit */
|
||||
INIT(DefineAliasInit);
|
||||
INIT(SctInit);
|
||||
INIT(SctDriveAdapterInit);
|
||||
INIT(SctDriveObjInit);
|
||||
INIT(SctDriveAdapterInit);
|
||||
INIT(SICSGetInit);
|
||||
INIT(LogReaderInit);
|
||||
INIT(LogSetupInit);
|
||||
INIT(InstallBackground);
|
||||
INIT(MakeProtocol);
|
||||
INIT(UdpInit);
|
||||
INIT(HelpInit);
|
||||
INIT(AddTestProt);
|
||||
INIT(AddGenBinProtocoll);
|
||||
INIT(AddSyncedProt);
|
||||
INIT(AddBinProtocol);
|
||||
INIT(AddPMACProtocoll);
|
||||
INIT(AddCharByCharProtocoll);
|
||||
INIT(AddLscProtocol);
|
||||
INIT(AddSecopProtocol);
|
||||
INIT(AddSecop3Protocol);
|
||||
INIT(MakeTrace);
|
||||
INIT(InitTaskOBJ);
|
||||
INIT(RemoteObjectInit);
|
||||
INIT(Logv2Init);
|
||||
INIT(LogListenInit);
|
||||
INIT(SiteInit); /* site specific initializations */
|
||||
}
|
||||
|
||||
static void InitIniCommands(SicsInterp * pInter)
|
||||
{
|
||||
|
||||
/* declare and add permanent command */
|
||||
#define PCMD(NAME, FUN) { \
|
||||
int FUN(SConnection * pCon, SicsInterp * pSics, void *pData, \
|
||||
int argc, char *argv[]); \
|
||||
AddCommandWithFlag(pInter, NAME, FUN, NULL, NULL, 0); \
|
||||
}
|
||||
|
||||
/* declare and add startup command */
|
||||
#define SCMD(NAME, FUN) { \
|
||||
int FUN(SConnection * pCon, SicsInterp * pSics, void *pData, \
|
||||
int argc, char *argv[]); \
|
||||
AddCommandWithFlag(pInter, NAME, FUN, NULL, NULL, 1); \
|
||||
}
|
||||
|
||||
/* permanent commands in alphabetic order */
|
||||
PCMD("alias", MakeAlias);
|
||||
PCMD("broadcast", Broadcast);
|
||||
PCMD("ClientPut", ClientPut);
|
||||
PCMD("ClientLog", ClientLog);
|
||||
PCMD("config", ConfigCon);
|
||||
PCMD("db", SICSDebug);
|
||||
PCMD("Dir", ListObjects);
|
||||
PCMD("dolater", MakeCron);
|
||||
PCMD("DrivableInvoke", TclDrivableInvoke);
|
||||
PCMD("DynSicsObj", InstallSICSOBJ);
|
||||
PCMD("EVFactory", EVControlFactory);
|
||||
PCMD("FileEval", MacroFileEval);
|
||||
PCMD("findalias", LocateAliasAction);
|
||||
PCMD("fulltransact", TransactAction);
|
||||
PCMD("GetInt", GetSICSInterrupt);
|
||||
PCMD("GumPut", GumPut);
|
||||
PCMD("InternEval", InternalFileEval);
|
||||
PCMD("kill_command", SICSKill);
|
||||
PCMD("list", SicsList);
|
||||
PCMD("MakeAsyncProtocol", AsyncProtocolFactory);
|
||||
PCMD("MakeAsyncQueue", AsyncQueueFactory);
|
||||
PCMD("MakeMulti", MakeMulti);
|
||||
PCMD("MakeOptimise", MakeOptimiser);
|
||||
PCMD("MakeSecMotor", SecMotorFactory);
|
||||
PCMD("Publish", TclPublish);
|
||||
PCMD("Remob", RemobCreate);
|
||||
PCMD("ResetServer", ResetStatus);
|
||||
PCMD("scriptcallback", CallbackScript);
|
||||
PCMD("SetInt", SetSICSInterrupt);
|
||||
PCMD("SetStatus", SetSICSStatus);
|
||||
PCMD("SICSBounds", SICSBounds);
|
||||
PCMD("sicscron", MakeCron);
|
||||
PCMD("sicsdatafactory", SICSDataFactory);
|
||||
PCMD("sicsdescriptor", SICSDescriptor);
|
||||
PCMD("SICSLog", LogOutput);
|
||||
PCMD("sicsprompt", SicsPrompt);
|
||||
PCMD("SICSStatus", SICSStatus);
|
||||
/* PCMD("sicstime", SICSTime); */
|
||||
PCMD("doubletime", SICSDoubleTime);
|
||||
PCMD("SICSType", SICSType);
|
||||
PCMD("Sics_Exitus", SicsExit);
|
||||
PCMD("silent", SICSSilent);
|
||||
PCMD("json2tcl", SICSjson2tcl);
|
||||
PCMD("status", UserStatus);
|
||||
PCMD("TclReplaceDrivable", TclReplaceDrivable);
|
||||
PCMD("transact", TransactAction);
|
||||
PCMD("wait", UserWait);
|
||||
PCMD("yield", UserYield);
|
||||
PCMD("checksum", CheckSum);
|
||||
PCMD("loguserinfo", LogUserInfoWrapper);
|
||||
|
||||
/* startup commands in alphabetic order */
|
||||
SCMD("allowexec", AllowExec);
|
||||
SCMD("AntiCollisionInstall", AntiColliderFactory);
|
||||
SCMD("ChopperAdapter", CHAdapterFactory);
|
||||
SCMD("MakeBatchManager", MakeExeManager);
|
||||
SCMD("MakeChopper", ChocoFactory);
|
||||
SCMD("MakeConfigurableMotor", MakeConfigurableVirtualMotor);
|
||||
SCMD("MakeCounter", MakeCounter);
|
||||
SCMD("MakeDataNumber", DNFactory);
|
||||
SCMD("MakeDiffScan", MakeDiffScan);
|
||||
SCMD("MakeDrive", MakeDrive);
|
||||
SCMD("MakeEnergy", MakeEnergyVar);
|
||||
SCMD("MakeGPIB", MakeGPIB);
|
||||
SCMD("MakeHdbTable", HdbTableFactory);
|
||||
SCMD("MakeLin2Ang", MakeLin2Ang);
|
||||
SCMD("MakeMaximize", MaximizeFactory);
|
||||
SCMD("MakeMono", MonoInit);
|
||||
SCMD("MakeMultiCounter", MakeMultiCounter);
|
||||
SCMD("MakeMultiSec", MakeMultiSec);
|
||||
SCMD("MakeO2T", CreateO2T);
|
||||
SCMD("MakeOscillator", MakeOscillator);
|
||||
SCMD("MakePeakCenter", FitFactory);
|
||||
SCMD("MakeProxy", ProxyFactory);
|
||||
SCMD("MakeRefList", MakeReflectionList);
|
||||
SCMD("MakeRS232Controller", RS232Factory);
|
||||
SCMD("MakeScanCommand", ScanFactory);
|
||||
SCMD("MakeSecCounter", MakeSecCter);
|
||||
SCMD("MakeSicsObj", InstallSICSOBJ);
|
||||
SCMD("MakeSicsPoll", InstallSICSPoll);
|
||||
SCMD("MakeStateMon", StateMonFactory);
|
||||
SCMD("MakeSync", MakeSync);
|
||||
SCMD("MakeTclInt", MakeTclInt);
|
||||
SCMD("MakeWaveLength", MakeWaveLengthVar);
|
||||
SCMD("MakeXYTable", XYFactory);
|
||||
SCMD("Motor", MotorCreate);
|
||||
SCMD("ServerOption", IFServerOption);
|
||||
SCMD("SicsAlias", SicsAlias);
|
||||
SCMD("SicsUser", PWSicsUser);
|
||||
SCMD("TokenInit", TokenInit);
|
||||
SCMD("VarMake", VarFactory);
|
||||
SCMD("VelocitySelector", VelSelFactory);
|
||||
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int InitObjectCommands(pServer pServ, char *file)
|
||||
{
|
||||
SConnection *pCon = NULL;
|
||||
char pBueffel[1024];
|
||||
int iRet;
|
||||
SicsInterp *pSics;
|
||||
pExeList pExe;
|
||||
pEnvMon pEnv = NULL;
|
||||
pSite site = NULL;
|
||||
|
||||
pSics = pServ->pSics;
|
||||
assert(pSics);
|
||||
|
||||
InitGeneral();
|
||||
|
||||
/* general initialization */
|
||||
/* create a connection */
|
||||
pCon = SCCreateDummyConnection(pSics);
|
||||
if (!pCon) {
|
||||
return 0;
|
||||
}
|
||||
MakeExeManager(pCon, pSics, NULL, 1, NULL);
|
||||
|
||||
pExe = CreateExeList(pServ->pTasker);
|
||||
pServ->pExecutor = pExe;
|
||||
pEnv = CreateEnvMon();
|
||||
DevExecInit();
|
||||
|
||||
assert(pExe);
|
||||
assert(pEnv);
|
||||
|
||||
InitIniCommands(pSics);
|
||||
/*
|
||||
install site specific commands
|
||||
*/
|
||||
site = getSite();
|
||||
if (site != NULL) {
|
||||
site->AddSiteCommands(pServ->pSics);
|
||||
}
|
||||
|
||||
InstallBckRestore(pCon, pSics);
|
||||
InstallSICSHipadaba(pCon, pSics,NULL,0,NULL);
|
||||
|
||||
/* evaluate the file */
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "fileeval %s", file);
|
||||
iRet = InterpExecute(pSics, pCon, pBueffel);
|
||||
|
||||
/* done */
|
||||
SCDeleteConnection(pCon);
|
||||
if (site != NULL && site->RemoveSiteCommands != NULL) {
|
||||
site->RemoveSiteCommands(pSics);
|
||||
}
|
||||
if(killStartupCommands){
|
||||
RemoveStartupCommands();
|
||||
}
|
||||
isDuringInitialization = 0;
|
||||
return 1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
void KeepStartupCommands()
|
||||
{
|
||||
killStartupCommands = 0;
|
||||
}
|
Reference in New Issue
Block a user