Index: mttroot/mtt/bin/trans/make_ode2odes ================================================================== --- mttroot/mtt/bin/trans/make_ode2odes +++ mttroot/mtt/bin/trans/make_ode2odes @@ -7,10 +7,15 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.51.2.4 2001/03/12 03:59:30 geraint +## SIGINT (C-c C-c) now causes simulation data to be dumped to MTT.core. +## SIGQUIT (C-c C-\) as for SIGINT, then raises default SIGQUIT. +## SIGFPE as for SIGINT, then raises default SIGABRT. +## ## Revision 1.51.2.3 2001/03/07 04:06:55 geraint ## Irix: catch SIGFPE and write data before aborting (.exe). ## GNU/Linux: nada. ## ## Revision 1.51.2.2 2001/03/02 00:45:21 geraint @@ -306,10 +311,11 @@ #include "${sys}_def.h" #include "${sys}_sympar.h" #ifdef STANDALONE #include +#include // for Irix psignal #include extern ColumnVector F${sys}_input ( ColumnVector &x, ColumnVector &y, @@ -611,10 +617,11 @@ if (dump_data) { Matrix written_data = data.extract (0, 0, row-1, data.cols ()-1); save_ascii_data_for_plotting (file, written_data, "MTT_data"); + return; } const int nx = x.length (), ny = y.length (); register int col = 0; @@ -646,10 +653,12 @@ { ColumnVector null (0.0); mtt_write (0.0, null, null, 0, true, file); } +void set_signal_handlers (void); + void handle_signal (int signum) { // handle some signals to ensure data is written. psignal (signum, "# Writing data to MTT.core"); ofstream corefile ("MTT.core"); @@ -659,23 +668,23 @@ case SIGFPE: // Intel chips do not raise SIGFPE for DIVZERO :-( raise (SIGABRT); break; case SIGINT: - cerr << "# Continuing." << endl; break; case SIGQUIT: - cerr << "# Quitting." << endl; signal (SIGQUIT, SIG_DFL); raise (SIGQUIT); break; default: cerr << "# Warning: make_ode2odes needs updating!" << endl; signal (signum, SIG_DFL); raise (signum); break; } + corefile.close (); + set_signal_handlers (); } void set_signal_handlers (void) { signal (SIGFPE, handle_signal);