From 06974e91bd58836b5a48cc8847bc925a438cf3c2 Mon Sep 17 00:00:00 2001 From: zolliker Date: Thu, 28 Jan 2010 08:16:51 +0000 Subject: [PATCH] restructured configuration - removed RemovePsiCommands (the choice if a command is removed or not should be done when declaring it) - reduced the include list to the necessary files --- psi.c | 176 ++++++++++++++++++++-------------------------------------- 1 file changed, 61 insertions(+), 115 deletions(-) diff --git a/psi.c b/psi.c index 2697f5c..a7f2249 100644 --- a/psi.c +++ b/psi.c @@ -3,32 +3,29 @@ This is the site specific interface to SICS for PSI. This file implements the interface defined in ../site.h - + + copyright: see file COPYRIGHT Mark Koennecke, June 2003 - May 2007 + + Modules initialized with an installation sics command are added to + AddPsiCommands with SCMD. + Modules initialized with a startup C command are added to SiteInit with + INIT. + There is no need to add include statements or prototype declarations for + above items. + However, for drivers added, we still need to declare the prototypes or + include the header file. + Markus Zolliker, Jan 2010 -----------------------------------------------------------------------*/ -#include -#include -#include -#include -#include #include +#include "site.h" +#include "sics.h" +#include #include -#include "buffer.h" -#include "sps.h" -#include "pimotor.h" -#include "sanswave.h" -#include "faverage.h" -#include "amorstat.h" -#include "tas.h" -#include "swmotor.h" -#include "polterwrite.h" -#include "ecb.h" -#include "frame.h" #include "ecbdriv.h" #include "ecbcounter.h" -#include #include "sinqhmdriv.i" #include "tdchm.h" #include "tecsdriv.h" @@ -40,41 +37,8 @@ #include "el755driv.h" #include #include "serial.h" -#include "fomerge.h" -#include "remob.h" -#include "tricssupport.h" #include "sinq.h" -#include "tabledrive.h" -#include "amorset.h" #include "sinqhttp.h" -#include "poldizug.h" -#include "autowin.h" -/* - * from julcho.c - */ -extern int JulChoFactory(SConnection * pCon, SicsInterp * pSics, - void *pData, int argc, char *argv[]); -/* from ritastorage.c */ -extern int MakeRitaFix(SConnection * pCon, SicsInterp * pSics, void *pData, - int argc, char *argv[]); -/* from sanslirebin.c */ -extern int MakeSansliRebin(SConnection * pCon, SicsInterp * pSics, - void *pData, int argc, char *argv[]); -/* from lmd200.c */ -extern int MakeLMD200(SConnection * pCon, SicsInterp * pSics, void *pData, - int argc, char *argv[]); -/* from julchoprot.c */ -extern void AddJulChoProtocoll(); -/* from sinqhttpprot.c */ -extern void AddHttpProtocoll(); -/* from pmacprot.c */ -extern void AddPMACProtocoll(); -/* from pfeifferprot.c */ -extern void AddPfeifferProtocoll(); -/* from termprot.c */ -extern void AddTermProtocoll(); -/* from phytron.c */ -extern void AddPhytronProtocoll(); /*--------------------------------------------------------------------------*/ void SiteInit(void) @@ -99,12 +63,12 @@ void SiteInit(void) /* * SICS specific Asynchronous I/O protocols */ - AddJulChoProtocoll(); - AddHttpProtocoll(); - AddPMACProtocoll(); - AddPfeifferProtocoll(); - AddTermProtocoll(); - AddPhytronProtocoll(); + INIT(AddJulChoProtocoll); + INIT(AddHttpProtocoll); + INIT(AddPMACProtocoll); + INIT(AddPfeifferProtocoll); + INIT(AddTermProtocoll); + INIT(AddPhytronProtocoll); } @@ -114,66 +78,48 @@ static pSite sitePSI = NULL; /*----------------------------------------------------------------------*/ static void AddPsiCommands(SicsInterp * pInter) { - AddCommand(pInter, "MakeRuenBuffer", InitBufferSys, NULL, NULL); - AddCommand(pInter, "MakeTRICSSupport", MakeTricsSupport, NULL, NULL); - AddCommand(pInter, "MakeSPS", SPSFactory, NULL, NULL); - AddCommand(pInter, "MakePIMotor", PIMotorFactory, NULL, NULL); - AddCommand(pInter, "MakeSANSWave", MakeSANSWave, NULL, NULL); - AddCommand(pInter, "MakeFocusAverager", MakeFA, NULL, NULL); - AddCommand(pInter, "MakeAmorStatus", AmorStatusFactory, NULL, NULL); - AddCommand(pInter, "MakeTAS", TASFactory, NULL, NULL); - AddCommand(pInter, "MakeSWMotor", MakeSWMotor, NULL, NULL); - AddCommand(pInter, "MakeSWHPMotor", MakeSWHPMotor, NULL, NULL); - AddCommand(pInter, "PolterInstall", PolterInstall, NULL, NULL); - AddCommand(pInter, "MakeECB", MakeECB, NULL, NULL); - AddCommand(pInter, "MakePSDFrame", MakeFrameFunc, NULL, NULL); - AddCommand(pInter, "SerialInit", SerialInit, NULL, NULL); - AddCommand(pInter, "InstallFocusMerge", InstallFocusMerge, NULL, NULL); - AddCommand(pInter, "Remob", RemobCreate, NULL, NULL); - AddCommand(pInter, "MakeSinq", SinqFactory, NULL, NULL); - AddCommand(pInter, "MakeTableDrive", TableDriveFactory, NULL, NULL); - AddCommand(pInter, "MakeAmorSet", AmorSetFactory, NULL, NULL); - AddCommand(pInter, "MakeJulCho", JulChoFactory, NULL, NULL); - AddCommand(pInter, "MakeRitaFix", MakeRitaFix, NULL, NULL); - AddCommand(pInter, "MakePoldiReiss", MakePoldiReiss, NULL, NULL); - AddCommand(pInter, "MakeSansliRebin", MakeSansliRebin, NULL, NULL); - AddCommand(pInter, "MakeLMD200", MakeLMD200, NULL, NULL); - AddCommand(pInter, "MakeRitaWin", MakeRitaWin, NULL, NULL); -/* - AddCommand(pInter,"MakeDifrac",MakeDifrac,NULL,NULL); -*/ -} +/* 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); \ + } -/*---------------------------------------------------------------------*/ -static void RemovePsiCommands(SicsInterp * pSics) -{ - RemoveCommand(pSics, "MakeTRICSSupport"); - RemoveCommand(pSics, "MakeSPS"); - RemoveCommand(pSics, "MakePIMotor"); - RemoveCommand(pSics, "MakeSANSWave"); - RemoveCommand(pSics, "MakeFocusAverager"); - RemoveCommand(pSics, "FocusInstall"); - RemoveCommand(pSics, "InstallFocusMerge"); - RemoveCommand(pSics, "MakeStoreAmor"); - RemoveCommand(pSics, "MakeAmorStatus"); - RemoveCommand(pSics, "MakeJulCho"); - RemoveCommand(pSics, "MakeRitaFix"); - RemoveCommand(pSics, "MakePoldiReiss"); - RemoveCommand(pSics, "MakeSansliRebin"); - RemoveCommand(pSics, "MakeLMD200"); + /* alphabetic order */ + SCMD("InstallFocusMerge", InstallFocusMerge); + SCMD("MakeAmorSet", AmorSetFactory); + SCMD("MakeAmorStatus", AmorStatusFactory); + SCMD("MakeECB", MakeECB); + SCMD("MakeFocusAverager", MakeFA); + SCMD("MakeJulCho", JulChoFactory); + SCMD("MakeLMD200", MakeLMD200); + SCMD("MakePIMotor", PIMotorFactory); + SCMD("MakePoldiReiss", MakePoldiReiss); + SCMD("MakePSDFrame", MakeFrameFunc); + SCMD("MakeRitaFix", MakeRitaFix); + SCMD("MakeRitaWin", MakeRitaWin); + PCMD("MakeRuenBuffer", InitBufferSys); + SCMD("MakeSansliRebin", MakeSansliRebin); + SCMD("MakeSANSWave", MakeSANSWave); + SCMD("MakeSinq", SinqFactory); + SCMD("MakeSPS", SPSFactory); + PCMD("MakeSWHPMotor", MakeSWHPMotor); + SCMD("MakeSWMotor", MakeSWMotor); + SCMD("MakeTableDrive", TableDriveFactory); + SCMD("MakeTAS", TASFactory); + SCMD("MakeTRICSSupport", MakeTricsSupport); + SCMD("PolterInstall", PolterInstall); + SCMD("SerialInit", SerialInit); /* - RemoveCommand(pSics,"MakeDifrac"); + SCMD("MakeDifrac",MakeDifrac); */ - RemoveCommand(pSics, "MakeTAS"); - RemoveCommand(pSics, "MakeSWMotor"); - RemoveCommand(pSics, "PolterInstall"); - RemoveCommand(pSics, "MakeECB"); - RemoveCommand(pSics, "MakePSDFrame"); - RemoveCommand(pSics, "SerialInit"); - RemoveCommand(pSics, "MakeSinq"); - RemoveCommand(pSics, "MakeTableDrive"); - RemoveCommand(pSics, "MakeAmorSet"); - RemoveCommand(pSics, "MakeRitaWin"); } /*---------------------------------------------------------------------*/ @@ -599,7 +545,7 @@ pSite getSite(void) initializing function pointers */ sitePSI->AddSiteCommands = AddPsiCommands; - sitePSI->RemoveSiteCommands = RemovePsiCommands; + sitePSI->RemoveSiteCommands = NULL; sitePSI->CreateMotor = CreatePsiMotor; sitePSI->CreateCounterDriver = CreatePsiCounterDriver; sitePSI->CreateHistogramMemoryDriver = CreatePsiHistMem;