/*------------------------------------------------------------------------ D U M M Y This is an empty site interface for SICS. Can be used as a starting point for own site specific stuff. copyright: see file COPYRIGHT Mark Koennecke, June 2003 -----------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include "anstohm.h" #include "dmc2143.h" static pSite siteANSTO = NULL; /*----------------------------------------------------------------------*/ static void AddCommands(SicsInterp *pInter){ //AddCommand(pInter,"MakeRefl2T",Refl2TFactory,NULL,NULL); } /*---------------------------------------------------------------------*/ static void RemoveCommands(SicsInterp *pSics){ //RemoveCommand(pInter,"MakeRefl2T"); } /*-------------------------------------------------------------------*/ static pMotor CreateMotor(SConnection *pCon, int argc, char *argv[]){ MotorDriver *pDriver = NULL; pMotor pNew = NULL; Tcl_Interp *pTcl = NULL; char pBueffel[132]; /* create the motor */ strtolower(argv[1]); if(strcmp(argv[1],"dmc2143") == 0){ pDriver = (MotorDriver *)CreateDMC2143(pCon,argc-2,&argv[2]); if(!pDriver){ return NULL; } pNew = MotorInit("DMC2143",argv[0],pDriver); if(!pNew){ sprintf(pBueffel,"Failure to create motor %s",argv[1]); SCWrite(pCon,pBueffel,eError); return NULL; } } return pNew; } /*-------------------------------------------------------------------*/ static pCounterDriver CreateAnstoCounterDriver(SConnection *pCon, int argc, char *argv[]){ pCounterDriver pNew = NULL; return pNew; } /*-------------------------------------------------------------------*/ static HistDriver *CreateHistMem(char *name, pStringDict pOptions){ HistDriver *pNew = NULL; if(strcmp(name,"anstohm") == 0){ printf("try to CreateAnstoHM() ...\n"); #ifdef __cplusplus pNew = CreateAnstoHM(pOptions); #endif /* __cplusplus */ } return pNew; } /*-------------------------------------------------------------------*/ static pVelSelDriv CreateVelSelDriv(char *name, char *array, Tcl_Interp *pTcl){ pVelSelDriv pNew = NULL; return pNew; } /*-------------------------------------------------------------------*/ static pCodri CreateController(SConnection *pCon,int argc, char *argv[]){ pCodri pNew = NULL; return pNew; } /*------------------------------------------------------------------*/ static pEVControl InstallEnvironmentController(SicsInterp *pSics, SConnection *pCon, int argc, char *argv[]){ pEVControl pNew = NULL; pEVDriver pDriv = NULL; return pNew; } /*-----------------------------------------------------------------*/ static int ConfigureScan(pScanData self, char *option){ return 0; } /*--------------------------------------------------------------------*/ static void KillSite(void *site){ free(site); siteANSTO = NULL; } /*--------------------------------------------------------------------- The scheme here goes along the lines of the singleton design pattern ---------------------------------------------------------------------*/ pSite getSite(void){ if(siteANSTO == NULL){ siteANSTO = (pSite)malloc(sizeof(Site)); /* we cannot go on if we do not even have enough memory to allocate the site data structure */ assert(siteANSTO); /* initializing function pointers */ siteANSTO->AddSiteCommands = AddCommands; siteANSTO->RemoveSiteCommands = RemoveCommands; siteANSTO->CreateMotor = CreateMotor; siteANSTO->CreateCounterDriver = CreateAnstoCounterDriver; siteANSTO->CreateHistogramMemoryDriver = CreateHistMem; siteANSTO->CreateVelocitySelector = CreateVelSelDriv; siteANSTO->CreateControllerDriver = CreateController; siteANSTO->InstallEnvironmentController = InstallEnvironmentController; siteANSTO->ConfigureScan = ConfigureScan; siteANSTO->KillSite = KillSite; } return siteANSTO; }