Mercurial > hg > octave-lojdl
changeset 4787:02c748eb2ddc
[project @ 2004-02-18 21:20:26 by jwe]
author | jwe |
---|---|
date | Wed, 18 Feb 2004 21:20:26 +0000 |
parents | fc316bde0053 |
children | 82a558043db9 |
files | scripts/control/base/dre.m src/ChangeLog src/DLD-FUNCTIONS/fftn.cc src/DLD-FUNCTIONS/fftw_wisdom.cc src/sighandlers.cc |
diffstat | 5 files changed, 72 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/control/base/dre.m +++ b/scripts/control/base/dre.m @@ -77,12 +77,12 @@ ## @item tvals ## time values at which @var{p}(@var{t}) is computed ## @item plist -## list values of @var{p}(@var{t}); @var{plist} { @var{ii} } +## list values of @var{p}(@var{t}); @var{plist} @{ @var{ii} @} ## is @var{p}(@var{tvals}(@var{ii})). ## ## @item tvals ## @example -## is selected so that || Plist{ii} - Plist{ii-1} || < Ptol +## is selected so that || Plist@{ii@} - Plist@{ii-1@} || < Ptol ## for ii=2:length(tvals) ## @end example ## @end table
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2004-02-18 John W. Eaton <jwe@bevo.che.wisc.edu> + + * sighandlers.cc (my_friendly_exit): New optional arg, save_vars. + Only call save_user_variables if save_vars is true. + (sigint_handler): If interactive, offer to abort and save + workspace after three consecutive interrupts. + (sigint_handler, sigpipe_handler, sigfpe_handler): + Increment octave_interrupt_handler instead of setting it to 1. + 2004-02-16 John W. Eaton <jwe@bevo.che.wisc.edu> * version.h (OCTAVE_VERSION): Now 2.1.54.
--- a/src/DLD-FUNCTIONS/fftn.cc +++ b/src/DLD-FUNCTIONS/fftn.cc @@ -120,14 +120,14 @@ DEFUN_DLD (fftn, args, , "-*- texinfo -*-\n\ -@deftypefn {Loadable Function} {} fftn (@var{a}, @var{siz})\n\ +@deftypefn {Loadable Function} {} fftn (@var{a}, @var{size})\n\ Compute the N dimensional FFT of @var{a} using subroutines from\n" FFTSRC -". The optional vector argument @var{siz} may be used specify the\n\ -dimensions of the array to be used. If an element of @var{siz} is\n\ +". The optional vector argument @var{size} may be used specify the\n\ +dimensions of the array to be used. If an element of @var{size} is\n\ smaller than the corresponding dimension, then the dimension is\n\ truncated prior to performing the FFT. Otherwise if an element\n\ -of @var{siz} is larger than the corresponding dimension @var{a}\n\ +of @var{size} is larger than the corresponding dimension @var{a}\n\ is resized and padded with zeros.\n\ @end deftypefn\n\ @seealso {ifftn, fft, fft2, fftw_wisdom}") @@ -137,14 +137,14 @@ DEFUN_DLD (ifftn, args, , "-*- texinfo -*-\n\ -@deftypefn {Loadable Function} {} ifftn (@var{a}, @var{siz})\n\ +@deftypefn {Loadable Function} {} ifftn (@var{a}, @var{size})\n\ Compute the invesre N dimensional FFT of @var{a} using subroutines from\n" FFTSRC -". The optional vector argument @var{siz} may be used specify the\n\ -dimensions of the array to be used. If an element of @var{siz} is\n\ +". The optional vector argument @var{size} may be used specify the\n\ +dimensions of the array to be used. If an element of @var{size} is\n\ smaller than the corresponding dimension, then the dimension is\n\ truncated prior to performing the inverse FFT. Otherwise if an element\n\ -of @var{siz} is larger than the corresponding dimension @var{a}\n\ +of @var{size} is larger than the corresponding dimension @var{a}\n\ is resized and padded with zeros.\n\ @end deftypefn\n\ @seealso {fftn, ifft, ifft2, fftw_wisdom}")
--- a/src/DLD-FUNCTIONS/fftw_wisdom.cc +++ b/src/DLD-FUNCTIONS/fftw_wisdom.cc @@ -108,9 +108,12 @@ } std::string wisdom = octave_env::make_absolute - (Vload_path_dir_path.find_first_of (args(0).string_value ().c_str ()), + (Vload_path_dir_path.find_first_of (args(0).string_value ()), octave_env::getcwd ()); + // XXX FIXME XXX -- should probably protect FILE* resources with + // auto_ptr or similar... + if (wisdom.empty () || overwrite) { FILE *ofile = fopen (wisdom.c_str (), "wb"); @@ -190,7 +193,7 @@ #else - error ("fftw_wisdom: this copy of Octave was not configured to use FFTW3"); + warning ("fftw_wisdom: this copy of Octave was not configured to use FFTW3"); #endif
--- a/src/sighandlers.cc +++ b/src/sighandlers.cc @@ -46,6 +46,7 @@ #include "pager.h" #include "pt-bp.h" #include "sighandlers.h" +#include "sysdep.h" #include "syswait.h" #include "toplev.h" #include "utils.h" @@ -93,7 +94,8 @@ #endif static void -my_friendly_exit (const char *sig_name, int sig_number) +my_friendly_exit (const char *sig_name, int sig_number, + bool save_vars = true) { static bool been_there_done_that = false; @@ -112,7 +114,8 @@ std::cerr << "panic: " << sig_name << " -- stopping myself...\n"; - save_user_variables (); + if (save_vars) + save_user_variables (); if (sig_number < 0) exit (1); @@ -235,7 +238,7 @@ // here? if (can_interrupt) - octave_interrupt_state = 1; + octave_interrupt_state++; SIGHANDLER_RETURN (0); } @@ -303,11 +306,7 @@ // for SIGINT only. static RETSIGTYPE -#if defined (ACK_USES_SIG) || defined (REINSTALL_USES_SIG) sigint_handler (int sig) -#else -sigint_handler (int) -#endif { MAYBE_ACK_SIGNAL (sig); @@ -334,7 +333,47 @@ if (octave_interrupt_immediately) octave_jump_to_enclosing_context (); else - octave_interrupt_state = 1; + { + octave_interrupt_state++; + + if (interactive) + { + if (octave_interrupt_state > 3) + { + // XXX FIXME XXX -- might want to attempt to flush + // any pending input first... + + std::cerr << "abort [y/N]? "; + + int c = octave_kbhit (); + + std::cerr << static_cast<char> (c) << std::endl; + + if (c == 'y' || c == 'Y') + { + std::cerr << "save top-level workspace [y/N]? "; + + c = octave_kbhit (); + + std::cerr << static_cast<char> (c) << std::endl; + + my_friendly_exit (sys_siglist[sig], sig, + (c == 'y' || c == 'Y')); + } + else + { + // We will still eventually interrupt and jump to + // the top level even if no additional interrupts + // happen, but we will have to wait until it is + // safe to do so. It will take 3 more + // consecutive interrupts before we offer to + // abort again. + + octave_interrupt_state = 1; + } + } + } + } } SIGHANDLER_RETURN (0); @@ -357,7 +396,7 @@ // here? if (pipe_handler_error_count > 100) - octave_interrupt_state = 1; + octave_interrupt_state++; SIGHANDLER_RETURN (0); }