91 lines
2.1 KiB
C
91 lines
2.1 KiB
C
/*--------------------------------------------------------------------------
|
|
|
|
THE SICS SERVER
|
|
|
|
|
|
This file contains the main entry point into the world of SICS.
|
|
|
|
|
|
|
|
Mark Koennecke, October 1996
|
|
|
|
Copyright: see copyright.h
|
|
|
|
Labor fuer Neutronenstreuung
|
|
Paul Scherrer Institut
|
|
CH-5423 Villigen-PSI
|
|
|
|
|
|
----------------------------------------------------------------------------*/
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include "nserver.h"
|
|
#include "servlog.h"
|
|
|
|
/***************************** Necessary Globals ****************************/
|
|
|
|
IPair *pSICSOptions = NULL;
|
|
pServer pServ = NULL;
|
|
|
|
/* ========================= Less dreadful file statics =================== */
|
|
|
|
#define DEFAULTINIFILE "servo.tcl"
|
|
|
|
/*---------------------------------------------------------------------------
|
|
The Servers Main program. May take one argument: the name of an
|
|
initialisation file
|
|
*/
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
int iRet;
|
|
char *file=NULL;
|
|
int i;
|
|
|
|
/* initialise, will die on you if problems */
|
|
for (i=1; i<argc; i++) {
|
|
if (strcmp(argv[i], "-nolog") == 0) {
|
|
SICSLogEnable(0);
|
|
} else if (file == NULL) {
|
|
file = argv[i];
|
|
}
|
|
}
|
|
iRet = InitServer(file,&pServ);
|
|
if(!iRet)
|
|
{
|
|
printf("Unrecoverable error on server startup, exiting.........\n");
|
|
exit(1);
|
|
}
|
|
|
|
|
|
RunServer(pServ);
|
|
|
|
StopServer(pServ);
|
|
pServ = NULL;
|
|
exit(0);
|
|
}
|
|
/*--------------------------------------------------------------------------*/
|
|
SicsInterp *GetInterpreter(void)
|
|
{
|
|
return pServ->pSics;
|
|
}
|
|
/*--------------------------------------------------------------------------*/
|
|
pExeList GetExecutor(void)
|
|
{
|
|
return pServ->pExecutor;
|
|
}
|
|
/*------------------------------------------------------------------------*/
|
|
void StopExit(void)
|
|
{
|
|
if(pServ)
|
|
{
|
|
StopServer(pServ);
|
|
}
|
|
}
|
|
/*-------------------------------------------------------------------------*/
|
|
pTaskMan GetTasker(void)
|
|
{
|
|
return pServ->pTasker;
|
|
}
|