Cleaned up ANSTO code to merge with sinqdev.sics

This is our new RELEASE-4_0 branch which was taken from ansto/93d9a7c
Conflicts:
	.gitignore
	SICSmain.c
	asynnet.c
	confvirtualmot.c
	counter.c
	devexec.c
	drive.c
	event.h
	exebuf.c
	exeman.c
	histmem.c
	interface.h
	motor.c
	motorlist.c
	motorsec.c
	multicounter.c
	napi.c
	napi.h
	napi4.c
	network.c
	nwatch.c
	nxscript.c
	nxxml.c
	nxxml.h
	ofac.c
	reflist.c
	scan.c
	sicshipadaba.c
	sicsobj.c
	site_ansto/docs/Copyright.txt
	site_ansto/instrument/lyrebird/config/tasmad/sicscommon/nxsupport.tcl
	site_ansto/instrument/lyrebird/config/tasmad/taspub_sics/tasscript.tcl
	statusfile.c
	tasdrive.c
	tasub.c
	tasub.h
	tasublib.c
	tasublib.h
This commit is contained in:
Ferdi Franceschini
2015-04-23 20:49:26 +10:00
parent c650788a2c
commit 10d29d597c
1336 changed files with 9430 additions and 226646 deletions

View File

@ -39,10 +39,6 @@
#include "sicshipadaba.h"
#include "commandlog.h"
int ServerSetupInterrupt(int iPort, pNetRead pNet, pTaskMan pTasker);
/*
configures a port for listening for interrupts
*/
extern int openDevexecLog(); /* in devexec.c */
@ -185,7 +181,8 @@ int InitServer(char *file, pServer * pServ)
assert((pReader =
CreateNetReader(self, iPasswordTimeOut,
iCommandTimeOut)) != NULL);
TaskRegister(self->pTasker, NetReaderTask, NetReaderSignal, NULL, /* call DeleteNetReader later than TaskerDelete */
TaskRegisterN(self->pTasker, "Network Reader",
NetReaderTask, NetReaderSignal, NULL, /* call DeleteNetReader later than TaskerDelete */
pReader, 1);
self->pReader = pReader;
@ -230,7 +227,6 @@ int InitServer(char *file, pServer * pServ)
printf("Cannot find InterruptPort number in options file %s\n",
"This value is required!");
DeleteInterp(self->pSics);
IFDeleteOptions(pSICSOptions);
return 0;
}
iRet = sscanf(pText, "%d", &iPort);
@ -241,26 +237,25 @@ int InitServer(char *file, pServer * pServ)
IFDeleteOptions(pSICSOptions);
return 0;
}
iRet = ServerSetupInterrupt(iPort, pReader, self->pTasker);
if (!iRet) {
SCWrite(pCon, "WARNING: UDP interrupt port not initialized", eWarning);
}
/* install a secret fully priviledged entry point for ME */
AddUser("Achterbahn", "Kiel", usInternal);
/* install a secret entry point for remote objects */
AddUser("RemoteMaster","3ed4c656a15f0aa45e02fd5ec429225bb93b762e7eb06cc81a0b4f6c35c76184",usInternal);
/* install environment monitor */
self->pMonitor = GetEnvMon(self->pSics);
TaskRegister(self->pTasker,
TaskRegisterN(self->pTasker,"EV Monitor",
EnvMonTask, EnvMonSignal, NULL, self->pMonitor, 1);
/* install performance monitor */
pMon = CreatePerfMon(20);
AddCommand(self->pSics, "Performance", PerfMonWrapper, DeletePerfMon,
pMon);
TaskRegister(self->pTasker, PerfMonTask, PerfMonSignal, NULL, pMon, 1);
TaskRegisterN(self->pTasker,"perfmon", PerfMonTask, PerfMonSignal, NULL, pMon, 1);
/* Install a second one for higher granularity measurement */
pMon = CreatePerfMon(2);
TaskRegister(self->pTasker, PerfMonTask, PerfMonSignal, DeletePerfMon, pMon, 1);
TaskRegisterN(self->pTasker,"perfmon2",
PerfMonTask, PerfMonSignal, DeletePerfMon, pMon, 1);
/* install telnet port */
@ -275,6 +270,9 @@ int InitServer(char *file, pServer * pServ)
INIT(StatusFileInit);
/* install status task */
InitStatus();
/* exit handlers need to be installed here */
atexit(StopExit);
(void)Fortify_CheckAllMemory();
@ -350,10 +348,6 @@ void StopServer(pServer self)
/* remove the in memory password database */
KillPasswd();
/* close Interrupt system */
ServerStopInterrupt();
/* Remove Status Callback */
KillStatus(NULL);
@ -471,20 +465,23 @@ int UserWait(SConnection * pCon, SicsInterp * pSics, void *pData,
return 1;
}
eOld = GetStatus();
SetStatus(eUserWait);
sWait.dFinish = DoubleTime() + (double)fVal;
sWait.iEnd = 0;
lID = TaskRegister(pTask, WaitTask, WaitSignal, NULL, &sWait, 1);
TaskWait(pTask, lID);
SetStatus(eOld);
if (SCGetInterrupt(pCon) != eContinue) {
lID = TaskRegisterN(pTask,"wait", WaitTask, WaitSignal, NULL, &sWait, 1);
TaskWait(pTask, lID); if (SCGetInterrupt(pCon) != eContinue) {
return 0;
} else {
return 1;
}
}
/*--------------------------------------------------------------------------*/
int UserYield(SConnection * pCon, SicsInterp * pSics, void *pData,
int argc, char *argv[])
{
TaskYield(pServ->pTasker);
return 1;
}
/*--------------------------------------------------------------------------*/
int SicsWait(long lTime)
{
pTaskMan pTasker = NULL;