version 1.91, 2015/08/19 05:29:23 |
version 1.95, 2017/02/07 08:30:31 |
|
|
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* |
* |
* $OpenXM: OpenXM_contrib2/asir2000/parse/glob.c,v 1.90 2015/08/14 13:51:56 fujimoto Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/parse/glob.c,v 1.94 2016/08/26 04:51:34 ohara Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "al.h" |
#include "al.h" |
#include "parse.h" |
#include "parse.h" |
#include "ox.h" |
#include "ox.h" |
|
#include <signal.h> |
#if !defined(VISUAL) && !defined(__MINGW32__) && !defined(_PA_RISC1_1) && !defined(linux) && !defined(SYSV) && !defined(__CYGWIN__) && !defined(__INTERIX) && !defined(__FreeBSD__) |
#if !defined(VISUAL) && !defined(__MINGW32__) && !defined(_PA_RISC1_1) && !defined(linux) && !defined(SYSV) && !defined(__CYGWIN__) && !defined(__INTERIX) && !defined(__FreeBSD__) |
#include <sgtty.h> |
#include <sgtty.h> |
#endif |
#endif |
Line 161 void glob_init() { |
|
Line 162 void glob_init() { |
|
VR(&oVLIST[i]) = &oVAR[i]; NEXT(&oVLIST[i]) = &oVLIST[i+1]; |
VR(&oVLIST[i]) = &oVAR[i]; NEXT(&oVLIST[i]) = &oVLIST[i+1]; |
} |
} |
VR(&oVLIST[i]) = &oVAR[i]; NEXT(&oVLIST[i]) = 0; |
VR(&oVLIST[i]) = &oVAR[i]; NEXT(&oVLIST[i]) = 0; |
reallocarray((char **)&GPVS->va,(int *)&GPVS->asize,(int *)&GPVS->n,(int)sizeof(struct oPV)); |
asir_reallocarray((char **)&GPVS->va,(int *)&GPVS->asize,(int *)&GPVS->n,(int)sizeof(struct oPV)); |
reallocarray((char **)&APVS->va,(int *)&APVS->asize,(int *)&APVS->n,(int)sizeof(struct oPV)); |
asir_reallocarray((char **)&APVS->va,(int *)&APVS->asize,(int *)&APVS->n,(int)sizeof(struct oPV)); |
reallocarray((char **)&PPVS->va,(int *)&PPVS->asize,(int *)&PPVS->n,(int)sizeof(struct oPV)); |
asir_reallocarray((char **)&PPVS->va,(int *)&PPVS->asize,(int *)&PPVS->n,(int)sizeof(struct oPV)); |
CPVS = GPVS; |
CPVS = GPVS; |
MKNODE(ONENODE,mkfnode(1,I_FORMULA,ONE),NULLP); |
MKNODE(ONENODE,mkfnode(1,I_FORMULA,ONE),NULLP); |
OID(F_TRUE)=O_F; FOP(F_TRUE)=AL_TRUE; F_TRUE->arg.dummy = 0; |
OID(F_TRUE)=O_F; FOP(F_TRUE)=AL_TRUE; F_TRUE->arg.dummy = 0; |
Line 247 void asir_terminate(int status) |
|
Line 248 void asir_terminate(int status) |
|
mpi_finalize(); |
mpi_finalize(); |
#else |
#else |
#if defined(SIGPIPE) |
#if defined(SIGPIPE) |
signal(SIGPIPE,SIG_IGN); |
set_signal(SIGPIPE,SIG_IGN); |
#endif |
#endif |
close_allconnections(); |
close_allconnections(); |
#endif |
#endif |
Line 429 void process_args(int ac,char **av) |
|
Line 430 void process_args(int ac,char **av) |
|
#endif |
#endif |
} |
} |
|
|
#include <signal.h> |
#if defined(HAVE_SIGACTION) |
|
void (*set_signal(int sig, void (*handler)(int)))(int) |
|
{ |
|
struct sigaction act; |
|
struct sigaction oldact; |
|
if (handler == SIG_IGN || handler == SIG_DFL) { |
|
return signal(sig,handler); |
|
} |
|
act.sa_handler=handler; |
|
act.sa_flags=0; |
|
act.sa_flags |= SA_RESTART; |
|
sigemptyset(&act.sa_mask); |
|
sigaction(sig,&act,&oldact); |
|
return oldact.sa_handler; |
|
} |
|
#endif |
|
|
void sig_init() { |
void sig_init() { |
#if !defined(VISUAL) && !defined(__MINGW32__) |
#if !defined(VISUAL) && !defined(__MINGW32__) |
signal(SIGINT,int_handler); |
set_signal(SIGINT,int_handler); |
#else |
#else |
void register_ctrlc_handler(); |
void register_ctrlc_handler(); |
|
|
register_ctrlc_handler(); |
register_ctrlc_handler(); |
#endif |
#endif |
signal(SIGSEGV,segv_handler); |
set_signal(SIGSEGV,segv_handler); |
|
|
#if defined(SIGFPE) |
#if defined(SIGFPE) |
signal(SIGFPE,fpe_handler); |
set_signal(SIGFPE,fpe_handler); |
#endif |
#endif |
|
|
#if defined(SIGPIPE) |
#if defined(SIGPIPE) |
signal(SIGPIPE,pipe_handler); |
set_signal(SIGPIPE,pipe_handler); |
#endif |
#endif |
|
|
#if defined(SIGILL) |
#if defined(SIGILL) |
signal(SIGILL,ill_handler); |
set_signal(SIGILL,ill_handler); |
#endif |
#endif |
|
|
#if !defined(VISUAL) && !defined(__MINGW32__) |
#if !defined(VISUAL) && !defined(__MINGW32__) |
signal(SIGBUS,bus_handler); |
set_signal(SIGBUS,bus_handler); |
#endif |
#endif |
} |
} |
|
|
static void (*old_int)(int); |
static void (*old_int)(int); |
|
|
void asir_save_handler() { |
void asir_save_handler() { |
old_int = signal(SIGINT,SIG_IGN); |
old_int = set_signal(SIGINT,SIG_IGN); |
signal(SIGINT,old_int); |
set_signal(SIGINT,old_int); |
} |
} |
|
|
void asir_set_handler() { |
void asir_set_handler() { |
signal(SIGINT,int_handler); |
set_signal(SIGINT,int_handler); |
} |
} |
|
|
void asir_reset_handler() { |
void asir_reset_handler() { |
signal(SIGINT,old_int); |
set_signal(SIGINT,old_int); |
} |
} |
|
|
extern int I_am_server; |
extern int I_am_server; |
Line 532 void int_handler(int sig) |
|
Line 548 void int_handler(int sig) |
|
#if defined(VISUAL) || defined(__MINGW32__) |
#if defined(VISUAL) || defined(__MINGW32__) |
suspend_timer(); |
suspend_timer(); |
#endif |
#endif |
signal(SIGINT,SIG_IGN); |
set_signal(SIGINT,SIG_IGN); |
#if !defined(VISUAL) && !defined(__MINGW32__) |
#if !defined(VISUAL) && !defined(__MINGW32__) |
if ( do_server_in_X11 ) { |
if ( do_server_in_X11 ) { |
debug(PVSS?((VS)BDY(PVSS))->usrf->f.usrf->body:0); |
debug(PVSS?((VS)BDY(PVSS))->usrf->f.usrf->body:0); |
Line 645 void restore_handler() { |
|
Line 661 void restore_handler() { |
|
resume_timer(); |
resume_timer(); |
#endif |
#endif |
#if defined(SIGINT) |
#if defined(SIGINT) |
signal(SIGINT,int_handler); |
set_signal(SIGINT,int_handler); |
#endif |
#endif |
} |
} |
|
|
void segv_handler(int sig) |
void segv_handler(int sig) |
{ |
{ |
#if defined(SIGSEGV) |
#if defined(SIGSEGV) |
signal(SIGSEGV,segv_handler); |
set_signal_for_restart(SIGSEGV,segv_handler); |
error("internal error (SEGV)"); |
error("internal error (SEGV)"); |
#endif |
#endif |
} |
} |
Line 660 void segv_handler(int sig) |
|
Line 676 void segv_handler(int sig) |
|
void ill_handler(int sig) |
void ill_handler(int sig) |
{ |
{ |
#if defined(SIGILL) |
#if defined(SIGILL) |
signal(SIGILL,ill_handler); |
set_signal_for_restart(SIGILL,ill_handler); |
error("illegal instruction (ILL)"); |
error("illegal instruction (ILL)"); |
#endif |
#endif |
} |
} |
Line 685 void alrm_handler(int sig) |
|
Line 701 void alrm_handler(int sig) |
|
void bus_handler(int sig) |
void bus_handler(int sig) |
{ |
{ |
#if defined(SIGBUS) |
#if defined(SIGBUS) |
signal(SIGBUS,bus_handler); |
set_signal_for_restart(SIGBUS,bus_handler); |
error("internal error (BUS ERROR)"); |
error("internal error (BUS ERROR)"); |
#endif |
#endif |
} |
} |
Line 693 void bus_handler(int sig) |
|
Line 709 void bus_handler(int sig) |
|
void fpe_handler(int sig) |
void fpe_handler(int sig) |
{ |
{ |
#if defined(SIGFPE) |
#if defined(SIGFPE) |
signal(SIGFPE,fpe_handler); |
set_signal_for_restart(SIGFPE,fpe_handler); |
error("internal error (FPE)"); |
error("internal error (FPE)"); |
#endif |
#endif |
} |
} |
Line 701 void fpe_handler(int sig) |
|
Line 717 void fpe_handler(int sig) |
|
void pipe_handler(int sig) |
void pipe_handler(int sig) |
{ |
{ |
#if defined(SIGPIPE) |
#if defined(SIGPIPE) |
signal(SIGPIPE,pipe_handler); |
set_signal_for_restart(SIGPIPE,pipe_handler); |
end_critical(); |
end_critical(); |
error("internal error (BROKEN PIPE)"); |
error("internal error (BROKEN PIPE)"); |
#endif |
#endif |
Line 802 void set_timer(int interval) |
|
Line 818 void set_timer(int interval) |
|
it.it_value.tv_sec = interval; |
it.it_value.tv_sec = interval; |
it.it_value.tv_usec = 0; |
it.it_value.tv_usec = 0; |
setitimer(ITIMER_TYPE,&it,0); |
setitimer(ITIMER_TYPE,&it,0); |
signal(SIGNAL_FOR_TIMER,alrm_handler); |
set_signal(SIGNAL_FOR_TIMER,alrm_handler); |
timer_is_set = 1; |
timer_is_set = 1; |
} |
} |
|
|
Line 815 void reset_timer() |
|
Line 831 void reset_timer() |
|
it.it_value.tv_sec = 0; |
it.it_value.tv_sec = 0; |
it.it_value.tv_usec = 0; |
it.it_value.tv_usec = 0; |
setitimer(ITIMER_TYPE,&it,0); |
setitimer(ITIMER_TYPE,&it,0); |
signal(SIGNAL_FOR_TIMER,SIG_IGN); |
set_signal(SIGNAL_FOR_TIMER,SIG_IGN); |
timer_is_set = 0; |
timer_is_set = 0; |
} |
} |
#endif |
#endif |
Line 868 char *scopyright() |
|
Line 884 char *scopyright() |
|
} |
} |
|
|
#if defined(VISUAL) || defined(__MINGW32__) |
#if defined(VISUAL) || defined(__MINGW32__) |
|
int recv_intr; |
void check_intr() |
void check_intr() |
{ |
{ |
extern int recv_intr; |
extern int recv_intr; |
if ( recv_intr ) { |
if ( recv_intr ) { |
if ( recv_intr == 1 ) { |
if ( recv_intr == 1 ) { |
recv_intr = 0; |
recv_intr = 0; |
int_handler(0); |
int_handler(SIGINT); |
} else { |
} else { |
recv_intr = 0; |
recv_intr = 0; |
ox_usr1_handler(0); |
ox_usr1_handler(0); |