| version 1.6, 2004/09/05 00:51:18 |
version 1.11, 2016/03/31 05:27:34 |
|
|
| /* $OpenXM: OpenXM/src/k097/ox_k0.c,v 1.5 2003/12/05 14:02:23 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/k097/ox_k0.c,v 1.10 2015/10/10 11:29:46 takayama Exp $ */ |
| #include <stdio.h> |
#include <stdio.h> |
| #include <sys/types.h> |
#include <sys/types.h> |
| #include <sys/socket.h> |
#include <sys/socket.h> |
|
|
| #include <netdb.h> |
#include <netdb.h> |
| #include <signal.h> |
#include <signal.h> |
| #include <setjmp.h> |
#include <setjmp.h> |
| |
#include <string.h> |
| |
#include <stdlib.h> |
| /* -lnsl -lsocket /usr/ucblib/libucb.a */ |
/* -lnsl -lsocket /usr/ucblib/libucb.a */ |
| #include "../kxx/ox_kan.h" |
#include "../kxx/ox_kan.h" |
| #include "../kxx/serversm.h" |
#include "../kxx/serversm.h" |
| Line 69 nullserver(int fdStreamIn,int fdStreamOut) { |
|
| Line 71 nullserver(int fdStreamIn,int fdStreamOut) { |
|
| ox_stream ostreamIn; |
ox_stream ostreamIn; |
| ox_stream ostreamOut; |
ox_stream ostreamOut; |
| char sreason[1024]; |
char sreason[1024]; |
| |
extern int RestrictedMode, RestrictedMode_saved; |
| extern void controlResetHandler(); |
extern void controlResetHandler(); |
| #if defined(__CYGWIN__) |
#if defined(__CYGWIN__) |
| extern sigjmp_buf EnvOfStackMachine; |
extern sigjmp_buf EnvOfStackMachine; |
| Line 120 nullserver(int fdStreamIn,int fdStreamOut) { |
|
| Line 123 nullserver(int fdStreamIn,int fdStreamOut) { |
|
| fprintf(stderr," ?! \n"); fflush(NULL); |
fprintf(stderr," ?! \n"); fflush(NULL); |
| } |
} |
| if (!Calling_ctrlC_hook) { |
if (!Calling_ctrlC_hook) { |
| Calling_ctrlC_hook = 1; |
Calling_ctrlC_hook = 1; RestrictedMode = 0; |
| KSexecuteString(" ctrlC-hook "); /* Execute User Defined functions. */ |
KSexecuteString(" ctrlC-hook "); /* Execute User Defined functions. */ |
| |
RestrictedMode = RestrictedMode_saved; |
| } |
} |
| Calling_ctrlC_hook = 0; |
Calling_ctrlC_hook = 0; |
| KSexecuteString(" (Computation is interrupted.) "); |
KSexecuteString(" (Computation is interrupted.) "); |
| InSendmsg2 = 0; |
InSendmsg2 = 0; |
| signal(SIGUSR1,controlResetHandler); goto aaa; |
mysignal(SIGUSR1,controlResetHandler); goto aaa; |
| } else { |
} else { |
| if (JmpMessage) fprintf(stderr,"Set EnvOfChildServer.\n"); |
if (JmpMessage) fprintf(stderr,"Set EnvOfChildServer.\n"); |
| signal(SIGUSR1,controlResetHandler); |
mysignal(SIGUSR1,controlResetHandler); |
| } |
} |
| #if defined(__CYGWIN__) |
#if defined(__CYGWIN__) |
| if (sigsetjmp(EnvOfStackMachine,1)) { |
if (sigsetjmp(EnvOfStackMachine,1)) { |
| Line 157 nullserver(int fdStreamIn,int fdStreamOut) { |
|
| Line 161 nullserver(int fdStreamIn,int fdStreamOut) { |
|
| */ |
*/ |
| Sm1_pushError2(SerialCurrent,-1,"Global jump by sm1 error"); |
Sm1_pushError2(SerialCurrent,-1,"Global jump by sm1 error"); |
| |
|
| KSexecuteString(" ctrlC-hook "); /* Execute User Defined functions. */ |
if (!Calling_ctrlC_hook) { |
| |
Calling_ctrlC_hook = 1; RestrictedMode = 0; |
| |
KSexecuteString(" ctrlC-hook "); /* Execute User Defined functions. */ |
| |
RestrictedMode = RestrictedMode_saved; |
| |
} |
| |
Calling_ctrlC_hook = 0; |
| InSendmsg2=0; |
InSendmsg2=0; |
| signal(SIGUSR1,controlResetHandler); goto aaa ; |
mysignal(SIGUSR1,controlResetHandler); goto aaa ; |
| } else { |
} else { |
| if (JmpMessage) fprintf(stderr,"Set EnvOfStackMachine.\n"); |
if (JmpMessage) fprintf(stderr,"Set EnvOfStackMachine.\n"); |
| if (signal(SIGUSR1,SIG_IGN) != SIG_IGN) { |
if (mysignal(SIGUSR1,SIG_IGN) != SIG_IGN) { |
| signal(SIGUSR1,controlResetHandler); |
mysignal(SIGUSR1,controlResetHandler); |
| } |
} |
| } |
} |
| |
|
| Line 283 nullserverCommand(ox_stream ostreamIn,ox_stream ostrea |
|
| Line 292 nullserverCommand(ox_stream ostreamIn,ox_stream ostrea |
|
| if (message) fprintf(stderr," executeStringByLocalParser\n"); |
if (message) fprintf(stderr," executeStringByLocalParser\n"); |
| OxCritical = 0; |
OxCritical = 0; |
| iresult = K0_executeStringByLocalParser(); |
iresult = K0_executeStringByLocalParser(); |
| OxCritical = 1; signal(SIGUSR1,controlResetHandler); |
OxCritical = 1; mysignal(SIGUSR1,controlResetHandler); |
| if (iresult < 0) { |
if (iresult < 0) { |
| emsg = Sm1_popErrorMessage("executeString: "); |
emsg = Sm1_popErrorMessage("executeString: "); |
| Sm1_pushError2(SerialCurrent,-1,emsg); |
Sm1_pushError2(SerialCurrent,-1,emsg); |
| Line 294 nullserverCommand(ox_stream ostreamIn,ox_stream ostrea |
|
| Line 303 nullserverCommand(ox_stream ostreamIn,ox_stream ostrea |
|
| if (message) fprintf(stderr," executeFunction\n"); |
if (message) fprintf(stderr," executeFunction\n"); |
| OxCritical = 0; |
OxCritical = 0; |
| iresult = K0_executeStringByLocalParser(); |
iresult = K0_executeStringByLocalParser(); |
| OxCritical = 1; signal(SIGUSR1,controlResetHandler); |
OxCritical = 1; mysignal(SIGUSR1,controlResetHandler); |
| if (iresult < 0) { |
if (iresult < 0) { |
| emsg = Sm1_popErrorMessage("executeFunction: "); |
emsg = Sm1_popErrorMessage("executeFunction: "); |
| Sm1_pushError2(SerialCurrent,-1,emsg); |
Sm1_pushError2(SerialCurrent,-1,emsg); |
| Line 335 nullserver_simplest(int fd) { |
|
| Line 344 nullserver_simplest(int fd) { |
|
| int c; |
int c; |
| while(1) { |
while(1) { |
| c = readOneByte(fd); |
c = readOneByte(fd); |
| if (c == '@') { return; } |
if (c == '@') { return 0; } |
| } |
} |
| } |
} |
| |
|
| Line 343 nullserver_simplest(int fd) { |
|
| Line 352 nullserver_simplest(int fd) { |
|
| void controlResetHandler(sig) |
void controlResetHandler(sig) |
| int sig; |
int sig; |
| { |
{ |
| signal(sig,SIG_IGN); |
mysignal(sig,SIG_IGN); |
| cancelAlarm(); |
cancelAlarm(); |
| fprintf(stderr,"From controlResetHandler. OxCritical = %d\n",OxCritical); |
fprintf(stderr,"From controlResetHandler. OxCritical = %d\n",OxCritical); |
| OxInterruptFlag = 1; |
OxInterruptFlag = 1; |