Push the server and option code down to reduce dependency loops

This commit is contained in:
Douglas Clowes
2014-04-03 16:46:43 +11:00
parent a557cf577a
commit 93276478f5
5 changed files with 36 additions and 34 deletions

View File

@ -24,12 +24,6 @@
#include "nserver.h"
#include "servlog.h"
/***************************** Necessary Globals ****************************/
IPair *pSICSOptions = NULL;
pServer pServ = NULL;
const char *argv0;
/* ========================= Less dreadful file statics =================== */
#define DEFAULTINIFILE "servo.tcl"
@ -53,6 +47,8 @@ int main(int argc, char *argv[])
int daemonize = 0;
char *file = NULL;
int i, firstArg = 1;
extern const char *argv0;
extern pServer pServ;
argv0 = argv[0];
if (argc < 2)
@ -101,28 +97,3 @@ int main(int argc, char *argv[])
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;
}

View File

@ -47,6 +47,7 @@
#include "ifile.h"
/*====================== Locals ============================================*/
IPair *pSICSOptions = NULL;
static IPair *CreateNewEntry(char *name, char *val, IPair * pN)
{

View File

@ -44,13 +44,19 @@ int ServerSetupInterrupt(int iPort, pNetRead pNet, pTaskMan pTasker);
configures a port for listening for interrupts
*/
extern void StopExit(void); /* in SICSmain.c */
extern int openDevexecLog(); /* in devexec.c */
extern int NetWatchTask(void *pData); /* in nwatch.c */
/* ========================= Less dreadful file statics =================== */
/*------------------------------------------------------------------------*/
static void StopExit(void)
{
if (pServ) {
StopServer(pServ);
}
}
#define DEFAULTINIFILE "servo.tcl"
#define DEFAULTSTATUSFILE "sicsstat.tcl"
#define INIT(F) { void F(void); F(); }
@ -510,3 +516,23 @@ int ServerIsStarting(pServer self)
{
return self->pReader == NULL;
}
pServer pServ = NULL;
/*--------------------------------------------------------------------------*/
SicsInterp *GetInterpreter(void)
{
return pServ->pSics;
}
/*--------------------------------------------------------------------------*/
pExeList GetExecutor(void)
{
return pServ->pExecutor;
}
/*-------------------------------------------------------------------------*/
pTaskMan GetTasker(void)
{
return pServ->pTasker;
}

4
sicsglobal.c Normal file
View File

@ -0,0 +1,4 @@
/***************************** Necessary Globals ****************************/
const char *argv0 = (void*) 0;

View File

@ -17,7 +17,7 @@ SOBJ = alias.o anticollider.o arrayutil.o ascon.o asyncprotocol.o asyncqueue.o a
passwd.o perfmon.o polldriv.o protocol.o proxy.o reflist.o regresscter.o remob.o \
rmtrail.o rs232controller.o rwpuffer.o sansbc.o savehdb.o scaldate.o scan.o scanvar.o SCinter.o \
scriptcontext.o script.o sctdriveadapter.o sctdriveobj.o sdynar.o selector.o \
selvar.o servlog.o sgclib.o sghkl.o sgio.o sicscron.o sicsdata.o sicsexit.o sicshdbadapter.o \
selvar.o servlog.o sgclib.o sghkl.o sgio.o sicscron.o sicsdata.o sicsexit.o sicsglobal.o sicshdbadapter.o \
sicshdbfactory.o sicshipadaba.o sicslist.o SICSmain.o sicsobj.o sicspoll.o sicsutil.o \
sicvar.o sig_die.o simchop.o simev.o simidx.o simindex.o sinfox.o singlebi.o singlediff.o singlenb.o singlebinb.o singletas.o singlex.o splitter.o s_rnge.o statemon.o \
statistics.o statusfile.o status.o stdscan.o stptok.o stringdict.o strlutil.o strrepl.o \