version 1.15, 2004/09/05 00:51:18 |
version 1.20, 2015/10/09 05:03:37 |
|
|
/* $OpenXM: OpenXM/src/kxx/oxserver00.c,v 1.14 2004/03/08 08:24:42 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/kxx/oxserver00.c,v 1.19 2015/10/08 11:49:38 takayama Exp $ */ |
/* nullserver01 */ |
/* nullserver01 */ |
#include <stdio.h> |
#include <stdio.h> |
#include <sys/types.h> |
#include <sys/types.h> |
Line 21 extern int SerialOX; /* Serial number of the packets |
|
Line 21 extern int SerialOX; /* Serial number of the packets |
|
extern int SerialCurrent; /* Current Serial number of the recieved packet. */ |
extern int SerialCurrent; /* Current Serial number of the recieved packet. */ |
extern int OXprintMessage; /* print oxmessages? */ |
extern int OXprintMessage; /* print oxmessages? */ |
extern int Calling_ctrlC_hook; |
extern int Calling_ctrlC_hook; |
|
extern int RestrictedMode, RestrictedMode_saved; |
|
|
#if defined(__CYGWIN__) |
#if defined(__CYGWIN__) || defined(__MSYS__) |
sigjmp_buf EnvOfChildServer; |
sigjmp_buf EnvOfChildServer; |
#else |
#else |
jmp_buf EnvOfChildServer; |
jmp_buf EnvOfChildServer; |
Line 98 nullserver(int fdStreamIn,int fdStreamOut) { |
|
Line 99 nullserver(int fdStreamIn,int fdStreamOut) { |
|
ox_stream ostreamOut; |
ox_stream ostreamOut; |
char sreason[1024]; |
char sreason[1024]; |
extern void controlResetHandler(); |
extern void controlResetHandler(); |
#if defined(__CYGWIN__) |
#if defined(__CYGWIN__) || defined(__MSYS__) |
extern sigjmp_buf EnvOfStackMachine; |
extern sigjmp_buf EnvOfStackMachine; |
#else |
#else |
extern jmp_buf EnvOfStackMachine; |
extern jmp_buf EnvOfStackMachine; |
Line 130 nullserver(int fdStreamIn,int fdStreamOut) { |
|
Line 131 nullserver(int fdStreamIn,int fdStreamOut) { |
|
if (PacketMonitor) fp2watch(ostreamOut,stdout); |
if (PacketMonitor) fp2watch(ostreamOut,stdout); |
} |
} |
|
|
|
fprintf(stderr,"Hello world.\n"); OXprintMessage = 1; |
|
JmpMessage = 1; |
|
|
aaa : ; |
aaa : ; |
#if defined(__CYGWIN__) |
#if defined(__CYGWIN__) |
if (sigsetjmp(EnvOfChildServer,1)) { |
if (MYSIGSETJMP(EnvOfChildServer,1)) { |
#else |
#else |
if (setjmp(EnvOfChildServer)) { |
if (MYSETJMP(EnvOfChildServer)) { |
#endif |
#endif |
fprintf(stderr,"childServerMain: jump here.\n"); |
fprintf(stderr,"childServerMain: jump here.\n"); |
if (OxInterruptFlag == 0) { |
if (OxInterruptFlag == 0) { |
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.) "); |
Line 152 nullserver(int fdStreamIn,int fdStreamOut) { |
|
Line 157 nullserver(int fdStreamIn,int fdStreamOut) { |
|
signal(SIGUSR1,controlResetHandler); |
signal(SIGUSR1,controlResetHandler); |
} |
} |
#if defined(__CYGWIN__) |
#if defined(__CYGWIN__) |
if (sigsetjmp(EnvOfStackMachine,1)) { |
if (MYSIGSETJMP(EnvOfStackMachine,1)) { |
#else |
#else |
if (setjmp(EnvOfStackMachine)) { |
if (MYSETJMP(EnvOfStackMachine)) { |
#endif |
#endif |
fprintf(stderr,"childServerMain: jump here by EnvOfStackMachine or timeout.\n"); |
fprintf(stderr,"childServerMain: jump here by EnvOfStackMachine or timeout.\n"); |
if (OxInterruptFlag == 0) { |
if (OxInterruptFlag == 0) { |
Line 171 nullserver(int fdStreamIn,int fdStreamOut) { |
|
Line 176 nullserver(int fdStreamIn,int fdStreamOut) { |
|
Sm1_pushError2(SerialCurrent,-1,"Global jump by sm1 error"); |
Sm1_pushError2(SerialCurrent,-1,"Global jump by sm1 error"); |
|
|
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; |
signal(SIGUSR1,controlResetHandler); goto aaa ; |
signal(SIGUSR1,controlResetHandler); goto aaa ; |
Line 361 nullserver_simplest(int fd) { |
|
Line 367 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 377 void controlResetHandler(sig) |
|
Line 383 void controlResetHandler(sig) |
|
return; |
return; |
}else{ |
}else{ |
(void) traceShowStack(); traceClearStack(); |
(void) traceShowStack(); traceClearStack(); |
#if defined(__CYGWIN__) |
#if defined(__CYGWIN__) || defined(__MSYS__) |
siglongjmp(EnvOfChildServer,2); /* returns 2 for ctrl-C */ |
MYSIGLONGJMP(EnvOfChildServer,2); /* returns 2 for ctrl-C */ |
#else |
#else |
longjmp(EnvOfChildServer,2); /* returns 2 for ctrl-C */ |
MYLONGJMP(EnvOfChildServer,2); /* returns 2 for ctrl-C */ |
#endif |
#endif |
} |
} |
} |
} |