- Adapted indenation to new agreed upon system
- Added support for second generation scriptcontext based counter
This commit is contained in:
144
intserv.c
144
intserv.c
@ -38,82 +38,80 @@
|
||||
#define MAXINTERRUPT 7
|
||||
#define INTERUPTWAIT 5
|
||||
|
||||
static mkChannel *IntPort = NULL;
|
||||
static pTaskMan pTask = NULL;
|
||||
static mkChannel *IntPort = NULL;
|
||||
static pTaskMan pTask = NULL;
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static char *pIntText[] = {
|
||||
"continue",
|
||||
"abortop",
|
||||
"abortscan",
|
||||
"abortbatch",
|
||||
"halt",
|
||||
"free",
|
||||
"end",
|
||||
NULL };
|
||||
static char *pIntText[] = {
|
||||
"continue",
|
||||
"abortop",
|
||||
"abortscan",
|
||||
"abortbatch",
|
||||
"halt",
|
||||
"free",
|
||||
"end",
|
||||
NULL
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int ServerSetupInterrupt(int iPort, pNetRead pNet, pTaskMan pTasker)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
pTask = pTasker;
|
||||
/* setup interrupt port */
|
||||
IntPort = UDPOpen(iPort);
|
||||
if(IntPort == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
NetReadRegister(pNet, IntPort,udp,NULL);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
int ServerSetupInterrupt(int iPort, pNetRead pNet, pTaskMan pTasker)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
pTask = pTasker;
|
||||
/* setup interrupt port */
|
||||
IntPort = UDPOpen(iPort);
|
||||
if (IntPort == NULL) {
|
||||
return 0;
|
||||
} else {
|
||||
NetReadRegister(pNet, IntPort, udp, NULL);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
void ServerStopInterrupt(void)
|
||||
{
|
||||
|
||||
/* close the port */
|
||||
if(IntPort)
|
||||
{
|
||||
NETClosePort(IntPort);
|
||||
free(IntPort);
|
||||
}
|
||||
}
|
||||
void ServerStopInterrupt(void)
|
||||
{
|
||||
|
||||
/* close the port */
|
||||
if (IntPort) {
|
||||
NETClosePort(IntPort);
|
||||
free(IntPort);
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void SetInterrupt(int iCode)
|
||||
{
|
||||
int iInt;
|
||||
|
||||
iInt = iCode;
|
||||
|
||||
TaskSignal(pTask,SICSINT, &iInt);
|
||||
}
|
||||
void SetInterrupt(int iCode)
|
||||
{
|
||||
int iInt;
|
||||
|
||||
iInt = iCode;
|
||||
|
||||
TaskSignal(pTask, SICSINT, &iInt);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int Interrupt2Text(int iInterrupt, char *text, int iTextLen)
|
||||
{
|
||||
if( (iInterrupt < 0) || (iInterrupt > MAXINTERRUPT))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
strncpy(text,pIntText[iInterrupt],iTextLen-1);
|
||||
return 1;
|
||||
}
|
||||
int Interrupt2Text(int iInterrupt, char *text, int iTextLen)
|
||||
{
|
||||
if ((iInterrupt < 0) || (iInterrupt > MAXINTERRUPT)) {
|
||||
return 0;
|
||||
}
|
||||
strncpy(text, pIntText[iInterrupt], iTextLen - 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
int Text2Interrupt(char *text)
|
||||
{
|
||||
int i = 0;
|
||||
while(pIntText[i] != NULL)
|
||||
{
|
||||
if(strcmp(pIntText[i],text) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if(i >= MAXINTERRUPT)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
int Text2Interrupt(char *text)
|
||||
{
|
||||
int i = 0;
|
||||
while (pIntText[i] != NULL) {
|
||||
if (strcmp(pIntText[i], text) == 0) {
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (i >= MAXINTERRUPT) {
|
||||
return -1;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
Reference in New Issue
Block a user