- Adapted indenation to new agreed upon system
- Added support for second generation scriptcontext based counter
This commit is contained in:
681
ofac.c
681
ofac.c
@ -133,366 +133,351 @@
|
||||
#include "motorsec.h"
|
||||
#include "background.h"
|
||||
/*----------------------- Server options creation -------------------------*/
|
||||
static int IFServerOption(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
int argc, char *argv[])
|
||||
{
|
||||
char pBueffel[512];
|
||||
|
||||
assert(pSics);
|
||||
assert(pCon);
|
||||
static int IFServerOption(SConnection * pCon, SicsInterp * pSics,
|
||||
void *pData, int argc, char *argv[])
|
||||
{
|
||||
char pBueffel[512];
|
||||
|
||||
assert(pSics);
|
||||
assert(pCon);
|
||||
|
||||
/* check authorisation */
|
||||
if (!SCMatchRights(pCon, usMugger)) {
|
||||
SCWrite(pCon, "Insufficient privilege to set options", eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* test if sufficient arguments */
|
||||
if (argc < 3) {
|
||||
sprintf(pBueffel, "Syntax: %s name value ", argv[0]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* just do it */
|
||||
pSICSOptions = IFAddOption(pSICSOptions, argv[1], argv[2]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* check authorisation */
|
||||
if(!SCMatchRights(pCon,usMugger))
|
||||
{
|
||||
SCWrite(pCon,"Insufficient privilege to set options",eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* test if sufficient arguments */
|
||||
if(argc < 3)
|
||||
{
|
||||
sprintf(pBueffel,"Syntax: %s name value ", argv[0]);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* just do it */
|
||||
pSICSOptions = IFAddOption(pSICSOptions,argv[1],argv[2]);
|
||||
return 1;
|
||||
}
|
||||
/*----------------------- Password database update -------------------------*/
|
||||
static int PWSicsUser(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
int argc, char *argv[])
|
||||
{
|
||||
char pBueffel[512];
|
||||
TokenList *pList = NULL;
|
||||
|
||||
assert(pSics);
|
||||
assert(pCon);
|
||||
static int PWSicsUser(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
int argc, char *argv[])
|
||||
{
|
||||
char pBueffel[512];
|
||||
TokenList *pList = NULL;
|
||||
|
||||
/* check authorisation */
|
||||
if(SCGetRights(pCon) > usMugger)
|
||||
{
|
||||
SCWrite(pCon,"Insufficient privilege to set users",eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* analyse commandlist */
|
||||
pList = SplitArguments(argc-1, &argv[1]);
|
||||
if( (!pList) || (!pList->pNext) || (!pList->pNext->pNext) )
|
||||
{
|
||||
sprintf(pBueffel,"Invalid Passwd Entry ::\n %s %s %s\n", argv[1],
|
||||
argv[2], argv[3]);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
DeleteTokenList(pList);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(pList->pNext->pNext->Type != eInt)
|
||||
{
|
||||
SCWrite(pCon,"Need integer rights code",eError);
|
||||
DeleteTokenList(pList);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
AddUser(pList->text, pList->pNext->text,
|
||||
pList->pNext->pNext->iVal);
|
||||
}
|
||||
}
|
||||
DeleteTokenList(pList);
|
||||
return 1;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
static void InitIniCommands(SicsInterp *pInter,pTaskMan pTask)
|
||||
{
|
||||
pExeList pExe;
|
||||
pEnvMon pEnv = NULL;
|
||||
pSite site = NULL;
|
||||
assert(pInter);
|
||||
|
||||
pExe = CreateExeList(pTask);
|
||||
pServ->pExecutor = pExe;
|
||||
pEnv = CreateEnvMon();
|
||||
|
||||
assert(pExe);
|
||||
assert(pEnv);
|
||||
|
||||
/* permanent commands */
|
||||
AddCommand(pInter,"Sics_Exitus",SicsExit,NULL,NULL);
|
||||
AddCommand(pInter,"FileEval",MacroFileEval,NULL,NULL);
|
||||
assert(pSics);
|
||||
assert(pCon);
|
||||
|
||||
AddCommand(pInter,"InternEval",InternalFileEval,NULL,NULL);
|
||||
AddCommand(pInter,"ClientPut",ClientPut,NULL,NULL);
|
||||
AddCommand(pInter,"GumPut",GumPut,NULL,NULL);
|
||||
AddCommand(pInter,"broadcast",Broadcast,NULL,NULL);
|
||||
AddCommand(pInter,"transact",TransactAction,NULL,NULL);
|
||||
AddCommand(pInter,"fulltransact",TransactAction,NULL,NULL);
|
||||
AddCommand(pInter,"sicsprompt", SicsPrompt,NULL,NULL);
|
||||
AddCommand(pInter,"Publish",TclPublish,NULL,NULL);
|
||||
AddCommand(pInter,"GetLog", LogCapture,NULL,NULL);
|
||||
AddCommand(pInter,"config", ConfigCon,NULL,NULL);
|
||||
AddCommand(pInter,"wait", UserWait,NULL,NULL);
|
||||
AddCommand(pInter,"status", UserStatus,NULL,NULL);
|
||||
AddCommand(pInter,"ResetServer",ResetStatus,NULL,NULL);
|
||||
AddCommand(pInter,"Dir",ListObjects,NULL,NULL);
|
||||
AddCommand(pInter,"SetInt", SetSICSInterrupt,NULL,NULL);
|
||||
AddCommand(pInter,"GetInt",GetSICSInterrupt,NULL,NULL);
|
||||
AddCommand(pInter,"SICSType",SICSType,NULL,NULL);
|
||||
AddCommand(pInter,"SICSBounds",SICSBounds,NULL,NULL);
|
||||
AddCommand(pInter,"SICSStatus",SICSStatus,NULL,NULL);
|
||||
AddCommand(pInter,"sicstime",SICSTime,NULL,NULL);
|
||||
AddCommand(pInter,"sicsdescriptor",SICSDescriptor,NULL,NULL);
|
||||
AddCommand(pInter,"SetStatus",SetSICSStatus,NULL,NULL);
|
||||
AddCommand(pInter,"db",SICSDebug,NULL,NULL);
|
||||
AddCommand(pInter,"EVFactory",EVControlFactory,NULL,NULL);
|
||||
AddCommand(pInter,"emon",EVWrapper,DeleteEnvMon,pEnv);
|
||||
AddCommand(pInter,"commandlog",CommandLog,CommandLogClose,NULL);
|
||||
AddCommand(pInter,"udpquieck",QuieckAction,KillQuieck,NULL);
|
||||
AddCommand(pInter,"alias",MakeAlias,NULL,NULL);
|
||||
AddCommand(pInter,"findalias",LocateAliasAction,NULL,NULL);
|
||||
AddCommand(pInter,"sicscron",MakeCron,NULL,NULL);
|
||||
AddCommand(pInter,"dolater",MakeCron,NULL,NULL);
|
||||
AddCommand(pInter,"sicsdatafactory",SICSDataFactory,NULL,NULL);
|
||||
AddCommand(pInter,"scriptcallback",CallbackScript,NULL,NULL);
|
||||
AddCommand(pInter,"help",SicsHelp,KillHelp,NULL);
|
||||
AddCommand(pInter,"list",SicsList,NULL,NULL);
|
||||
AddCommand(pInter,"InstallHdb",InstallSICSHipadaba,NULL,NULL);
|
||||
MakeProtocol(pInter);
|
||||
InstallBackground(pInter);
|
||||
|
||||
/* commands to do with the executor. Only StopExe carries the
|
||||
DeleteFunction in order to avoid double deletion. All the
|
||||
other commands operate on the same datastructure.
|
||||
*/
|
||||
AddCommand(pInter,"StopExe",StopCommand,DeleteExeList, pExe);
|
||||
AddCommand(pInter,"ListExe",ListExe,NULL,pExe);
|
||||
AddCommand(pInter,"sicsidle",SicsIdle,NULL,pExe);
|
||||
AddCommand(pInter,"Success",Success,NULL,pExe);
|
||||
AddCommand(pInter,"pause",PauseAction,NULL,pExe);
|
||||
AddCommand(pInter,"continue",ContinueAction,NULL,pExe);
|
||||
AddCommand(pInter,"devexec",DevexecAction,NULL,pExe);
|
||||
|
||||
/* add additional object creation commands here */
|
||||
AddCommand(pInter,"TokenInit",TokenInit,NULL,NULL);
|
||||
AddCommand(pInter,"ServerOption",IFServerOption,NULL,NULL);
|
||||
AddCommand(pInter,"SicsUser", PWSicsUser,NULL,NULL);
|
||||
AddCommand(pInter,"VarMake",VarFactory,NULL,NULL);
|
||||
AddCommand(pInter,"MakeDrive",MakeDrive,NULL,NULL);
|
||||
AddCommand(pInter,"Motor",MotorCreate,NULL,NULL);
|
||||
AddCommand(pInter,"MakeMulti",MakeMulti,NULL,NULL);
|
||||
AddCommand(pInter,"MakeMono",MonoInit,NULL,NULL);
|
||||
AddCommand(pInter,"MakeWaveLength",MakeWaveLengthVar,NULL,NULL);
|
||||
AddCommand(pInter,"MakeEnergy",MakeEnergyVar,NULL,NULL);
|
||||
AddCommand(pInter,"MakeCounter",MakeCounter,NULL,NULL);
|
||||
AddCommand(pInter,"MakeO2T",CreateO2T,NULL,NULL);
|
||||
AddCommand(pInter,"SicsAlias",SicsAlias,NULL,NULL);
|
||||
AddCommand(pInter,"DefineAlias",DefineAlias,NULL,NULL); /* M.Z. */
|
||||
AddCommand(pInter,"MakeHM",MakeHistMemory,NULL,NULL);
|
||||
AddCommand(pInter,"VelocitySelector",VelSelFactory,NULL,NULL);
|
||||
AddCommand(pInter,"MakeDataNumber",DNFactory,NULL,NULL);
|
||||
AddCommand(pInter,"MakeScanCommand",ScanFactory,NULL,NULL);
|
||||
AddCommand(pInter,"MakePeakCenter",FitFactory,NULL,NULL);
|
||||
AddCommand(pInter,"MakeHKL",HKLFactory,NULL,NULL);
|
||||
AddCommand(pInter,"MakeOptimise",MakeOptimiser,NULL,NULL);
|
||||
AddCommand(pInter,"MakeMesure",MesureFactory,NULL,NULL);
|
||||
AddCommand(pInter,"kill_command",SICSKill,NULL,NULL);
|
||||
AddCommand(pInter,"MakeChopper",ChocoFactory,NULL,NULL);
|
||||
AddCommand(pInter,"ChopperAdapter",CHAdapterFactory,NULL,NULL);
|
||||
AddCommand(pInter,"MakeXYTable",XYFactory,NULL,NULL);
|
||||
AddCommand(pInter,"MakeMaximize",MaximizeFactory,NULL,NULL);
|
||||
AddCommand(pInter,"MakeLin2Ang",MakeLin2Ang,NULL,NULL);
|
||||
AddCommand(pInter,"MakeSync",MakeSync,NULL,NULL);
|
||||
AddCommand(pInter,"MakeHMControl",MakeHMControl,NULL,NULL);
|
||||
AddCommand(pInter,"MakeRS232Controller",RS232Factory,NULL,NULL);
|
||||
AddCommand(pInter,"MakeMaxDetector",LoMaxFactory,NULL,NULL);
|
||||
AddCommand(pInter,"AntiCollisionInstall",AntiColliderFactory,NULL,NULL);
|
||||
AddCommand(pInter,"MakeGPIB",MakeGPIB,NULL,NULL);
|
||||
AddCommand(pInter,"MakeNXScript",MakeNXScript,NULL,NULL);
|
||||
AddCommand(pInter,"MakeTclInt",MakeTclInt,NULL,NULL);
|
||||
AddCommand(pInter,"TclReplaceDrivable",TclReplaceDrivable,NULL,NULL);
|
||||
AddCommand(pInter,"DrivableInvoke", TclDrivableInvoke,NULL,NULL);
|
||||
AddCommand(pInter,"UpdateFactory",UpdateFactory,NULL,NULL);
|
||||
AddCommand(pInter,"allowexec",AllowExec,NULL,NULL);
|
||||
AddCommand(pInter,"MakeConfigurableMotor",
|
||||
MakeConfigurableVirtualMotor,NULL,NULL);
|
||||
AddCommand(pInter,"MakeBatchManager",
|
||||
MakeExeManager,NULL,NULL);
|
||||
AddCommand(pInter,"MakeOscillator",
|
||||
MakeOscillator,NULL,NULL);
|
||||
AddCommand(pInter,"MakeDiffScan",
|
||||
MakeDiffScan,NULL,NULL);
|
||||
AddCommand(pInter,"MakeHKLMot",
|
||||
HKLMotInstall,NULL,NULL);
|
||||
AddCommand(pInter,"MakeUBCalc",
|
||||
MakeUBCalc,NULL,NULL);
|
||||
AddCommand(pInter,"MakeTasUB",
|
||||
TasUBFactory,NULL,NULL);
|
||||
AddCommand(pInter,"MakeTasScan",
|
||||
TASUBScanFactory,NULL,NULL);
|
||||
AddCommand(pInter,"MakeMcStasReader",
|
||||
McStasReaderFactory,NULL,NULL);
|
||||
AddCommand(pInter,"MakeMcStasController",
|
||||
McStasControllerFactory,NULL,NULL);
|
||||
AddCommand(pInter,"InstallSinfox",
|
||||
InstallSinfox,NULL,NULL);
|
||||
AddCommand(pInter,"MakeCone",
|
||||
MakeCone,NULL,NULL);
|
||||
AddCommand(pInter,"MakeMultiCounter",
|
||||
MakeMultiCounter,NULL,NULL);
|
||||
AddCommand(pInter,"MakeSicsPoll",
|
||||
InstallSICSPoll,NULL,NULL);
|
||||
AddCommand(pInter,"MakeStateMon",
|
||||
StateMonFactory,NULL,NULL);
|
||||
AddCommand(pInter,"MakeAsyncProtocol",AsyncProtocolFactory,NULL,NULL);
|
||||
AddCommand(pInter,"MakeAsyncQueue",AsyncQueueFactory,NULL,NULL);
|
||||
AddCommand(pInter,"MakeSicsObj",InstallSICSOBJ,NULL,NULL);
|
||||
AddCommand(pInter,"DynSicsObj",InstallSICSOBJ,NULL,NULL);
|
||||
/* AddCommand(pInter,"MakeHdbQueue",MakeHDBQueue,NULL,NULL); */
|
||||
AddCommand(pInter,"MakeGenController",GenControllerFactory,NULL,NULL);
|
||||
AddCommand(pInter,"genconfigure",GenControllerConfigure,NULL,NULL);
|
||||
AddCommand(pInter,"MakeProxy",ProxyFactory,NULL,NULL);
|
||||
AddCommand(pInter,"MakeRefList",MakeReflectionList,NULL,NULL);
|
||||
AddCommand(pInter,"MakeSingleX",MakeSingleX,NULL,NULL);
|
||||
AddCommand(pInter,"MakeSecMotor",SecMotorFactory,NULL,NULL);
|
||||
/* check authorisation */
|
||||
if (SCGetRights(pCon) > usMugger) {
|
||||
SCWrite(pCon, "Insufficient privilege to set users", eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
install site specific commands
|
||||
*/
|
||||
site = getSite();
|
||||
if(site != NULL){
|
||||
site->AddSiteCommands(pInter);
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void KillIniCommands(SicsInterp *pSics)
|
||||
{
|
||||
pSite site = NULL;
|
||||
|
||||
/* specify superfluous initialization commands here */
|
||||
RemoveCommand(pSics,"TokenInit");
|
||||
RemoveCommand(pSics,"ServerOption");
|
||||
RemoveCommand(pSics,"SicsUser");
|
||||
RemoveCommand(pSics,"VarMake");
|
||||
RemoveCommand(pSics,"MakeDrive");
|
||||
RemoveCommand(pSics,"Motor");
|
||||
/*
|
||||
RemoveCommand(pSics,"MakeMulti");
|
||||
*/
|
||||
RemoveCommand(pSics,"MakeMono");
|
||||
RemoveCommand(pSics,"MakeWaveLength");
|
||||
RemoveCommand(pSics,"MakeEnergy");
|
||||
RemoveCommand(pSics,"MakeCounter");
|
||||
RemoveCommand(pSics,"MakeRuenBuffer");
|
||||
RemoveCommand(pSics,"MakeScan");
|
||||
RemoveCommand(pSics,"MakeO2T");
|
||||
RemoveCommand(pSics,"SicsAlias");
|
||||
RemoveCommand(pSics,"MakeHM");
|
||||
RemoveCommand(pSics,"VelocitySelector");
|
||||
RemoveCommand(pSics,"MakeDataNumber");
|
||||
RemoveCommand(pSics,"MakeScanCommand");
|
||||
RemoveCommand(pSics,"MakePeakCenter");
|
||||
RemoveCommand(pSics,"MakeHKL");
|
||||
RemoveCommand(pSics,"MakeOptimiser");
|
||||
RemoveCommand(pSics,"MakeMesure");
|
||||
RemoveCommand(pSics,"MakeChopper");
|
||||
RemoveCommand(pSics,"ChopperAdapter");
|
||||
RemoveCommand(pSics,"MakeHklscan");
|
||||
RemoveCommand(pSics,"MakeXYTable");
|
||||
RemoveCommand(pSics,"MakeMaximize");
|
||||
RemoveCommand(pSics,"MakeLin2Ang");
|
||||
RemoveCommand(pSics,"MakeSync");
|
||||
RemoveCommand(pSics,"MakeHMControl");
|
||||
RemoveCommand(pSics,"MakeRS232Controller");
|
||||
RemoveCommand(pSics,"MakeMaxDetector");
|
||||
RemoveCommand(pSics,"AntiColliderInstall");
|
||||
RemoveCommand(pSics,"MakeGPIB");
|
||||
RemoveCommand(pSics,"MakeNXScript");
|
||||
RemoveCommand(pSics,"MakeTclInt");
|
||||
RemoveCommand(pSics,"UpdateFactory");
|
||||
RemoveCommand(pSics,"allowexec");
|
||||
RemoveCommand(pSics,"MakeConfigurableMotor");
|
||||
RemoveCommand(pSics,"MakeBatchManager");
|
||||
RemoveCommand(pSics,"MakeOscillator");
|
||||
RemoveCommand(pSics,"MakeDiffScan");
|
||||
RemoveCommand(pSics,"MakeHKLMot");
|
||||
RemoveCommand(pSics,"MakeUBCalc");
|
||||
RemoveCommand(pSics,"MakeTasUB");
|
||||
RemoveCommand(pSics,"MakeTasScan");
|
||||
RemoveCommand(pSics,"MakemcStasReader");
|
||||
RemoveCommand(pSics,"InstallSinfox");
|
||||
RemoveCommand(pSics,"MakeCone");
|
||||
RemoveCommand(pSics,"MakeMultiCounter");
|
||||
RemoveCommand(pSics,"MakeStateMon");
|
||||
RemoveCommand(pSics,"MakeAsyncQueue");
|
||||
RemoveCommand(pSics,"MakeAsyncProtocol");
|
||||
RemoveCommand(pSics,"MakeSicsObject");
|
||||
RemoveCommand(pSics,"MakeGenController");
|
||||
RemoveCommand(pSics,"genconfigure");
|
||||
RemoveCommand(pSics,"MakeProxy");
|
||||
RemoveCommand(pSics,"MakeRefList");
|
||||
RemoveCommand(pSics,"MakeSingleX");
|
||||
RemoveCommand(pSics,"MakeSecMotor");
|
||||
/*
|
||||
remove site specific installation commands
|
||||
*/
|
||||
site = getSite();
|
||||
if(site != NULL){
|
||||
site->RemoveSiteCommands(pSics);
|
||||
/* analyse commandlist */
|
||||
pList = SplitArguments(argc - 1, &argv[1]);
|
||||
if ((!pList) || (!pList->pNext) || (!pList->pNext->pNext)) {
|
||||
sprintf(pBueffel, "Invalid Passwd Entry ::\n %s %s %s\n", argv[1],
|
||||
argv[2], argv[3]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
DeleteTokenList(pList);
|
||||
return 0;
|
||||
} else {
|
||||
if (pList->pNext->pNext->Type != eInt) {
|
||||
SCWrite(pCon, "Need integer rights code", eError);
|
||||
DeleteTokenList(pList);
|
||||
return 0;
|
||||
} else {
|
||||
AddUser(pList->text, pList->pNext->text, pList->pNext->pNext->iVal);
|
||||
}
|
||||
}
|
||||
DeleteTokenList(pList);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
void InitGeneral(void)
|
||||
{
|
||||
static void InitIniCommands(SicsInterp * pInter, pTaskMan pTask)
|
||||
{
|
||||
pExeList pExe;
|
||||
pEnvMon pEnv = NULL;
|
||||
pSite site = NULL;
|
||||
assert(pInter);
|
||||
|
||||
pExe = CreateExeList(pTask);
|
||||
pServ->pExecutor = pExe;
|
||||
pEnv = CreateEnvMon();
|
||||
|
||||
assert(pExe);
|
||||
assert(pEnv);
|
||||
|
||||
/* permanent commands */
|
||||
AddCommand(pInter, "Sics_Exitus", SicsExit, NULL, NULL);
|
||||
AddCommand(pInter, "FileEval", MacroFileEval, NULL, NULL);
|
||||
|
||||
AddCommand(pInter, "InternEval", InternalFileEval, NULL, NULL);
|
||||
AddCommand(pInter, "ClientPut", ClientPut, NULL, NULL);
|
||||
AddCommand(pInter, "GumPut", GumPut, NULL, NULL);
|
||||
AddCommand(pInter, "broadcast", Broadcast, NULL, NULL);
|
||||
AddCommand(pInter, "transact", TransactAction, NULL, NULL);
|
||||
AddCommand(pInter, "fulltransact", TransactAction, NULL, NULL);
|
||||
AddCommand(pInter, "sicsprompt", SicsPrompt, NULL, NULL);
|
||||
AddCommand(pInter, "Publish", TclPublish, NULL, NULL);
|
||||
AddCommand(pInter, "GetLog", LogCapture, NULL, NULL);
|
||||
AddCommand(pInter, "config", ConfigCon, NULL, NULL);
|
||||
AddCommand(pInter, "wait", UserWait, NULL, NULL);
|
||||
AddCommand(pInter, "status", UserStatus, NULL, NULL);
|
||||
AddCommand(pInter, "ResetServer", ResetStatus, NULL, NULL);
|
||||
AddCommand(pInter, "Dir", ListObjects, NULL, NULL);
|
||||
AddCommand(pInter, "SetInt", SetSICSInterrupt, NULL, NULL);
|
||||
AddCommand(pInter, "GetInt", GetSICSInterrupt, NULL, NULL);
|
||||
AddCommand(pInter, "SICSType", SICSType, NULL, NULL);
|
||||
AddCommand(pInter, "SICSBounds", SICSBounds, NULL, NULL);
|
||||
AddCommand(pInter, "SICSStatus", SICSStatus, NULL, NULL);
|
||||
AddCommand(pInter, "sicstime", SICSTime, NULL, NULL);
|
||||
AddCommand(pInter, "sicsdescriptor", SICSDescriptor, NULL, NULL);
|
||||
AddCommand(pInter, "SetStatus", SetSICSStatus, NULL, NULL);
|
||||
AddCommand(pInter, "db", SICSDebug, NULL, NULL);
|
||||
AddCommand(pInter, "EVFactory", EVControlFactory, NULL, NULL);
|
||||
AddCommand(pInter, "emon", EVWrapper, DeleteEnvMon, pEnv);
|
||||
AddCommand(pInter, "commandlog", CommandLog, CommandLogClose, NULL);
|
||||
AddCommand(pInter, "udpquieck", QuieckAction, KillQuieck, NULL);
|
||||
AddCommand(pInter, "alias", MakeAlias, NULL, NULL);
|
||||
AddCommand(pInter, "findalias", LocateAliasAction, NULL, NULL);
|
||||
AddCommand(pInter, "sicscron", MakeCron, NULL, NULL);
|
||||
AddCommand(pInter, "dolater", MakeCron, NULL, NULL);
|
||||
AddCommand(pInter, "sicsdatafactory", SICSDataFactory, NULL, NULL);
|
||||
AddCommand(pInter, "scriptcallback", CallbackScript, NULL, NULL);
|
||||
AddCommand(pInter, "help", SicsHelp, KillHelp, NULL);
|
||||
AddCommand(pInter, "list", SicsList, NULL, NULL);
|
||||
AddCommand(pInter, "InstallHdb", InstallSICSHipadaba, NULL, NULL);
|
||||
MakeProtocol(pInter);
|
||||
InstallBackground(pInter);
|
||||
|
||||
/* commands to do with the executor. Only StopExe carries the
|
||||
DeleteFunction in order to avoid double deletion. All the
|
||||
other commands operate on the same datastructure.
|
||||
*/
|
||||
AddCommand(pInter, "StopExe", StopCommand, DeleteExeList, pExe);
|
||||
AddCommand(pInter, "ListExe", ListExe, NULL, pExe);
|
||||
AddCommand(pInter, "sicsidle", SicsIdle, NULL, pExe);
|
||||
AddCommand(pInter, "Success", Success, NULL, pExe);
|
||||
AddCommand(pInter, "pause", PauseAction, NULL, pExe);
|
||||
AddCommand(pInter, "continue", ContinueAction, NULL, pExe);
|
||||
AddCommand(pInter, "devexec", DevexecAction, NULL, pExe);
|
||||
|
||||
/* add additional object creation commands here */
|
||||
AddCommand(pInter, "TokenInit", TokenInit, NULL, NULL);
|
||||
AddCommand(pInter, "ServerOption", IFServerOption, NULL, NULL);
|
||||
AddCommand(pInter, "SicsUser", PWSicsUser, NULL, NULL);
|
||||
AddCommand(pInter, "VarMake", VarFactory, NULL, NULL);
|
||||
AddCommand(pInter, "MakeDrive", MakeDrive, NULL, NULL);
|
||||
AddCommand(pInter, "Motor", MotorCreate, NULL, NULL);
|
||||
AddCommand(pInter, "MakeMulti", MakeMulti, NULL, NULL);
|
||||
AddCommand(pInter, "MakeMono", MonoInit, NULL, NULL);
|
||||
AddCommand(pInter, "MakeWaveLength", MakeWaveLengthVar, NULL, NULL);
|
||||
AddCommand(pInter, "MakeEnergy", MakeEnergyVar, NULL, NULL);
|
||||
AddCommand(pInter, "MakeCounter", MakeCounter, NULL, NULL);
|
||||
AddCommand(pInter, "MakeSecCounter", MakeSecCter, NULL, NULL);
|
||||
AddCommand(pInter, "MakeO2T", CreateO2T, NULL, NULL);
|
||||
AddCommand(pInter, "SicsAlias", SicsAlias, NULL, NULL);
|
||||
AddCommand(pInter, "DefineAlias", DefineAlias, NULL, NULL); /* M.Z. */
|
||||
AddCommand(pInter, "MakeHM", MakeHistMemory, NULL, NULL);
|
||||
AddCommand(pInter, "VelocitySelector", VelSelFactory, NULL, NULL);
|
||||
AddCommand(pInter, "MakeDataNumber", DNFactory, NULL, NULL);
|
||||
AddCommand(pInter, "MakeScanCommand", ScanFactory, NULL, NULL);
|
||||
AddCommand(pInter, "MakePeakCenter", FitFactory, NULL, NULL);
|
||||
AddCommand(pInter, "MakeHKL", HKLFactory, NULL, NULL);
|
||||
AddCommand(pInter, "MakeOptimise", MakeOptimiser, NULL, NULL);
|
||||
AddCommand(pInter, "MakeMesure", MesureFactory, NULL, NULL);
|
||||
AddCommand(pInter, "kill_command", SICSKill, NULL, NULL);
|
||||
AddCommand(pInter, "MakeChopper", ChocoFactory, NULL, NULL);
|
||||
AddCommand(pInter, "ChopperAdapter", CHAdapterFactory, NULL, NULL);
|
||||
AddCommand(pInter, "MakeXYTable", XYFactory, NULL, NULL);
|
||||
AddCommand(pInter, "MakeMaximize", MaximizeFactory, NULL, NULL);
|
||||
AddCommand(pInter, "MakeLin2Ang", MakeLin2Ang, NULL, NULL);
|
||||
AddCommand(pInter, "MakeSync", MakeSync, NULL, NULL);
|
||||
AddCommand(pInter, "MakeHMControl", MakeHMControl, NULL, NULL);
|
||||
AddCommand(pInter, "MakeRS232Controller", RS232Factory, NULL, NULL);
|
||||
AddCommand(pInter, "MakeMaxDetector", LoMaxFactory, NULL, NULL);
|
||||
AddCommand(pInter, "AntiCollisionInstall", AntiColliderFactory, NULL,
|
||||
NULL);
|
||||
AddCommand(pInter, "MakeGPIB", MakeGPIB, NULL, NULL);
|
||||
AddCommand(pInter, "MakeNXScript", MakeNXScript, NULL, NULL);
|
||||
AddCommand(pInter, "MakeTclInt", MakeTclInt, NULL, NULL);
|
||||
AddCommand(pInter, "TclReplaceDrivable", TclReplaceDrivable, NULL, NULL);
|
||||
AddCommand(pInter, "DrivableInvoke", TclDrivableInvoke, NULL, NULL);
|
||||
AddCommand(pInter, "UpdateFactory", UpdateFactory, NULL, NULL);
|
||||
AddCommand(pInter, "allowexec", AllowExec, NULL, NULL);
|
||||
AddCommand(pInter, "MakeConfigurableMotor",
|
||||
MakeConfigurableVirtualMotor, NULL, NULL);
|
||||
AddCommand(pInter, "MakeBatchManager", MakeExeManager, NULL, NULL);
|
||||
AddCommand(pInter, "MakeOscillator", MakeOscillator, NULL, NULL);
|
||||
AddCommand(pInter, "MakeDiffScan", MakeDiffScan, NULL, NULL);
|
||||
AddCommand(pInter, "MakeHKLMot", HKLMotInstall, NULL, NULL);
|
||||
AddCommand(pInter, "MakeUBCalc", MakeUBCalc, NULL, NULL);
|
||||
AddCommand(pInter, "MakeTasUB", TasUBFactory, NULL, NULL);
|
||||
AddCommand(pInter, "MakeTasScan", TASUBScanFactory, NULL, NULL);
|
||||
AddCommand(pInter, "MakeMcStasReader", McStasReaderFactory, NULL, NULL);
|
||||
AddCommand(pInter, "MakeMcStasController",
|
||||
McStasControllerFactory, NULL, NULL);
|
||||
AddCommand(pInter, "InstallSinfox", InstallSinfox, NULL, NULL);
|
||||
AddCommand(pInter, "MakeCone", MakeCone, NULL, NULL);
|
||||
AddCommand(pInter, "MakeMultiCounter", MakeMultiCounter, NULL, NULL);
|
||||
AddCommand(pInter, "MakeSicsPoll", InstallSICSPoll, NULL, NULL);
|
||||
AddCommand(pInter, "MakeStateMon", StateMonFactory, NULL, NULL);
|
||||
AddCommand(pInter, "MakeAsyncProtocol", AsyncProtocolFactory, NULL,
|
||||
NULL);
|
||||
AddCommand(pInter, "MakeAsyncQueue", AsyncQueueFactory, NULL, NULL);
|
||||
AddCommand(pInter, "MakeSicsObj", InstallSICSOBJ, NULL, NULL);
|
||||
AddCommand(pInter, "DynSicsObj", InstallSICSOBJ, NULL, NULL);
|
||||
/* AddCommand(pInter,"MakeHdbQueue",MakeHDBQueue,NULL,NULL); */
|
||||
AddCommand(pInter, "MakeGenController", GenControllerFactory, NULL,
|
||||
NULL);
|
||||
AddCommand(pInter, "genconfigure", GenControllerConfigure, NULL, NULL);
|
||||
AddCommand(pInter, "MakeProxy", ProxyFactory, NULL, NULL);
|
||||
AddCommand(pInter, "MakeRefList", MakeReflectionList, NULL, NULL);
|
||||
AddCommand(pInter, "MakeSingleX", MakeSingleX, NULL, NULL);
|
||||
AddCommand(pInter, "MakeSecMotor", SecMotorFactory, NULL, NULL);
|
||||
|
||||
/*
|
||||
install site specific commands
|
||||
*/
|
||||
site = getSite();
|
||||
if (site != NULL) {
|
||||
site->AddSiteCommands(pInter);
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void KillIniCommands(SicsInterp * pSics)
|
||||
{
|
||||
pSite site = NULL;
|
||||
|
||||
/* specify superfluous initialization commands here */
|
||||
RemoveCommand(pSics, "TokenInit");
|
||||
RemoveCommand(pSics, "ServerOption");
|
||||
RemoveCommand(pSics, "SicsUser");
|
||||
RemoveCommand(pSics, "VarMake");
|
||||
RemoveCommand(pSics, "MakeDrive");
|
||||
RemoveCommand(pSics, "Motor");
|
||||
/*
|
||||
RemoveCommand(pSics,"MakeMulti");
|
||||
*/
|
||||
RemoveCommand(pSics, "MakeMono");
|
||||
RemoveCommand(pSics, "MakeWaveLength");
|
||||
RemoveCommand(pSics, "MakeEnergy");
|
||||
RemoveCommand(pSics, "MakeCounter");
|
||||
RemoveCommand(pSics, "MakeSecCounter");
|
||||
RemoveCommand(pSics, "MakeRuenBuffer");
|
||||
RemoveCommand(pSics, "MakeScan");
|
||||
RemoveCommand(pSics, "MakeO2T");
|
||||
RemoveCommand(pSics, "SicsAlias");
|
||||
RemoveCommand(pSics, "MakeHM");
|
||||
RemoveCommand(pSics, "VelocitySelector");
|
||||
RemoveCommand(pSics, "MakeDataNumber");
|
||||
RemoveCommand(pSics, "MakeScanCommand");
|
||||
RemoveCommand(pSics, "MakePeakCenter");
|
||||
RemoveCommand(pSics, "MakeHKL");
|
||||
RemoveCommand(pSics, "MakeOptimiser");
|
||||
RemoveCommand(pSics, "MakeMesure");
|
||||
RemoveCommand(pSics, "MakeChopper");
|
||||
RemoveCommand(pSics, "ChopperAdapter");
|
||||
RemoveCommand(pSics, "MakeHklscan");
|
||||
RemoveCommand(pSics, "MakeXYTable");
|
||||
RemoveCommand(pSics, "MakeMaximize");
|
||||
RemoveCommand(pSics, "MakeLin2Ang");
|
||||
RemoveCommand(pSics, "MakeSync");
|
||||
RemoveCommand(pSics, "MakeHMControl");
|
||||
RemoveCommand(pSics, "MakeRS232Controller");
|
||||
RemoveCommand(pSics, "MakeMaxDetector");
|
||||
RemoveCommand(pSics, "AntiColliderInstall");
|
||||
RemoveCommand(pSics, "MakeGPIB");
|
||||
RemoveCommand(pSics, "MakeNXScript");
|
||||
RemoveCommand(pSics, "MakeTclInt");
|
||||
RemoveCommand(pSics, "UpdateFactory");
|
||||
RemoveCommand(pSics, "allowexec");
|
||||
RemoveCommand(pSics, "MakeConfigurableMotor");
|
||||
RemoveCommand(pSics, "MakeBatchManager");
|
||||
RemoveCommand(pSics, "MakeOscillator");
|
||||
RemoveCommand(pSics, "MakeDiffScan");
|
||||
RemoveCommand(pSics, "MakeHKLMot");
|
||||
RemoveCommand(pSics, "MakeUBCalc");
|
||||
RemoveCommand(pSics, "MakeTasUB");
|
||||
RemoveCommand(pSics, "MakeTasScan");
|
||||
RemoveCommand(pSics, "MakemcStasReader");
|
||||
RemoveCommand(pSics, "InstallSinfox");
|
||||
RemoveCommand(pSics, "MakeCone");
|
||||
RemoveCommand(pSics, "MakeMultiCounter");
|
||||
RemoveCommand(pSics, "MakeStateMon");
|
||||
RemoveCommand(pSics, "MakeAsyncQueue");
|
||||
RemoveCommand(pSics, "MakeAsyncProtocol");
|
||||
RemoveCommand(pSics, "MakeSicsObject");
|
||||
RemoveCommand(pSics, "MakeGenController");
|
||||
RemoveCommand(pSics, "genconfigure");
|
||||
RemoveCommand(pSics, "MakeProxy");
|
||||
RemoveCommand(pSics, "MakeRefList");
|
||||
RemoveCommand(pSics, "MakeSingleX");
|
||||
RemoveCommand(pSics, "MakeSecMotor");
|
||||
/*
|
||||
remove site specific installation commands
|
||||
*/
|
||||
site = getSite();
|
||||
if (site != NULL) {
|
||||
site->RemoveSiteCommands(pSics);
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
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(SctInit);
|
||||
INIT(SctDriveInit);
|
||||
INIT(LogReaderInit);
|
||||
INIT(LogSetupInit);
|
||||
INIT(StatusFileInit);
|
||||
INIT(StatisticsInit);
|
||||
INIT(InitializerInit);
|
||||
INIT(SaveHdbInit); /* must be after InitializerInit */
|
||||
INIT(SctInit);
|
||||
INIT(SctDriveInit);
|
||||
INIT(LogReaderInit);
|
||||
INIT(LogSetupInit);
|
||||
INIT(StatusFileInit);
|
||||
|
||||
INIT(SiteInit); /* site specific initializations */
|
||||
}
|
||||
|
||||
INIT(SiteInit); /* site specific initializations */
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int InitObjectCommands(pServer pServ, char *file)
|
||||
{
|
||||
SConnection *pCon = NULL;
|
||||
char pBueffel[1024];
|
||||
int iRet;
|
||||
SicsInterp *pSics;
|
||||
|
||||
pSics = pServ->pSics;
|
||||
assert(pSics);
|
||||
|
||||
InitGeneral();
|
||||
|
||||
/* general initialization */
|
||||
/* create a connection */
|
||||
pCon = SCCreateDummyConnection(pSics);
|
||||
if(!pCon)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
MakeExeManager(pCon,pSics,NULL,1, NULL);
|
||||
InitIniCommands(pSics,pServ->pTasker);
|
||||
InstallBckRestore(pCon,pSics);
|
||||
|
||||
|
||||
/* evaluate the file */
|
||||
sprintf(pBueffel,"fileeval %s",file);
|
||||
iRet = InterpExecute(pSics,pCon,pBueffel);
|
||||
|
||||
/* done */
|
||||
SCDeleteConnection(pCon);
|
||||
KillIniCommands(pSics);
|
||||
RemoveStartupCommands();
|
||||
return 1;
|
||||
}
|
||||
int InitObjectCommands(pServer pServ, char *file)
|
||||
{
|
||||
SConnection *pCon = NULL;
|
||||
char pBueffel[1024];
|
||||
int iRet;
|
||||
SicsInterp *pSics;
|
||||
|
||||
pSics = pServ->pSics;
|
||||
assert(pSics);
|
||||
|
||||
InitGeneral();
|
||||
|
||||
/* general initialization */
|
||||
/* create a connection */
|
||||
pCon = SCCreateDummyConnection(pSics);
|
||||
if (!pCon) {
|
||||
return 0;
|
||||
}
|
||||
MakeExeManager(pCon, pSics, NULL, 1, NULL);
|
||||
InitIniCommands(pSics, pServ->pTasker);
|
||||
InstallBckRestore(pCon, pSics);
|
||||
|
||||
|
||||
/* evaluate the file */
|
||||
sprintf(pBueffel, "fileeval %s", file);
|
||||
iRet = InterpExecute(pSics, pCon, pBueffel);
|
||||
|
||||
/* done */
|
||||
SCDeleteConnection(pCon);
|
||||
KillIniCommands(pSics);
|
||||
RemoveStartupCommands();
|
||||
return 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user