# HG changeset patch # User jwe # Date 1077310774 0 # Node ID a62215ab8a03b5217becd2ec1adbaada1ea1b922 # Parent d2038299c683f6cd50668706d6585e7007bcbe5b [project @ 2004-02-20 20:59:34 by jwe] diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-02-20 Per Persson + + * mkoctfile.in (LINK_DEPS): Include $LDFLAGS in the list. + 2004-02-18 Per Persson * configure.in (*-*-darwin*): Define SONAME_FLAGS. diff --git a/libcruft/ChangeLog b/libcruft/ChangeLog --- a/libcruft/ChangeLog +++ b/libcruft/ChangeLog @@ -1,3 +1,8 @@ +2004-02-20 John W. Eaton + + * misc/quit.h (OCTAVE_QUIT): Set octave_interrupt_state to -1 + while we are handling interrupts. + 2004-02-14 John W. Eaton * Makefile.in (LINK_DEPS): Always define. diff --git a/libcruft/misc/quit.h b/libcruft/misc/quit.h --- a/libcruft/misc/quit.h +++ b/libcruft/misc/quit.h @@ -68,6 +68,10 @@ extern sig_atomic_t octave_interrupt_immediately; +// > 0: interrupt pending +// 0: no interrupt pending +// < 0: handling interrupt +// extern sig_atomic_t octave_interrupt_state; extern sig_atomic_t octave_allocation_error; @@ -79,9 +83,9 @@ #define OCTAVE_QUIT \ do \ { \ - if (octave_interrupt_state) \ + if (octave_interrupt_state > 0) \ { \ - octave_interrupt_state = 0; \ + octave_interrupt_state = -1; \ octave_throw_interrupt_exception (); \ } \ } \ diff --git a/mkoctfile.in b/mkoctfile.in --- a/mkoctfile.in +++ b/mkoctfile.in @@ -383,7 +383,7 @@ exit 1 fi else - LINK_DEPS="$LFLAGS $OCTAVE_LIBS $BLAS_LIBS $FFTW_LIBS $LIBS $FLIBS" + LINK_DEPS="$LFLAGS $OCTAVE_LIBS $LDFLAGS $BLAS_LIBS $FFTW_LIBS $LIBS $FLIBS" cmd="$DL_LD $DL_LDFLAGS -o $octfile $objfiles $ldflags $LINK_DEPS" $dbg $cmd eval $cmd diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,19 @@ +2004-02-20 John W. Eaton + + * sighandlers.cc (sigfpe_handler, sigpipe_handler): + Don't increment octave_interrupt_state if it is less than 0. + (sigint_handler): If octave_interrupt_state is less than zero, + reset it. + + * pt-except.cc (do_catch_code): Call OCTAVE_QUIT here so the catch + code won't run if an interrupt is pending. Don't run catch code + if intterrupt_state is less than zero. + +2004-02-20 Per Persson + + * Makefile.in (OCT_LINK_DEPS, OCTINTERP_LINK_DEPS): + Include $(LIBS) in the list before $(FLIBS). + 2004-02-20 John W. Eaton * pr-output.cc (octave_print_internal (std::ostream&, const diff --git a/src/Makefile.in b/src/Makefile.in --- a/src/Makefile.in +++ b/src/Makefile.in @@ -195,11 +195,11 @@ $(LIBPLPLOT) $(LIBGLOB) $(LIBDLFCN) OCTINTERP_LINK_DEPS = \ - -L../liboctave $(LIBOCTAVE) -L../libcruft $(LIBCRUFT) $(FLIBS) + -L../liboctave $(LIBOCTAVE) -L../libcruft $(LIBCRUFT) $(LIBS) $(FLIBS) OCT_LINK_DEPS = \ -L../libcruft $(LIBCRUFT) -L../liboctave $(LIBOCTAVE) \ - -L. $(LIBOCTINTERP) $(BLAS_LIBS) $(FFTW_LIBS) $(FLIBS) + -L. $(LIBOCTINTERP) $(BLAS_LIBS) $(FFTW_LIBS) $(LIBS) $(FLIBS) DISTFILES = Makefile.in ChangeLog mkdefs mkops mkgendoc \ DOCSTRINGS mkbuiltins mk-oct-links \ diff --git a/src/pt-except.cc b/src/pt-except.cc --- a/src/pt-except.cc +++ b/src/pt-except.cc @@ -57,7 +57,27 @@ static void do_catch_code (void *ptr) { - if (octave_interrupt_immediately) + // Is it safe to call OCTAVE_QUIT here? We are already running + // something on the unwind_protect stack, but the element for this + // action would have already been popped from the top of the stack, + // so we should not be attempting to run it again. + + OCTAVE_QUIT; + + // If we are interrupting immediately, or if an interrupt is in + // progress (octave_interrupt_state < 0), then we don't want to run + // the catch code (it should only run on errors, not interrupts). + + // If octave_interrupt_state is positive, an interrupt is pending. + // The only way that could happen would be for the interrupt to + // come in after the OCTAVE_QUIT above and before the if statement + // below -- it's possible, but unlikely. In any case, we should + // probably let the catch code throw the exception because we don't + // want to skip that and potentially run some other code. For + // example, an error may have originally brought us here for some + // cleanup operation and we shouldn't skip that. + + if (octave_interrupt_immediately || octave_interrupt_state < 0) return; tree_statement_list *list = static_cast (ptr); diff --git a/src/sighandlers.cc b/src/sighandlers.cc --- a/src/sighandlers.cc +++ b/src/sighandlers.cc @@ -237,7 +237,7 @@ // XXX FIXME XXX -- will setting octave_interrupt_state really help // here? - if (can_interrupt) + if (can_interrupt && octave_interrupt_state >= 0) octave_interrupt_state++; SIGHANDLER_RETURN (0); @@ -334,6 +334,13 @@ octave_jump_to_enclosing_context (); else { + // If we are already cleaning up from a previous interrupt, + // take note of the fact that another interrupt signal has + // arrived. + + if (octave_interrupt_state < 0) + octave_interrupt_state = 0; + octave_interrupt_state++; if (interactive && octave_interrupt_state == 2) @@ -363,7 +370,7 @@ // XXX FIXME XXX -- will setting octave_interrupt_state really help // here? - if (pipe_handler_error_count > 100) + if (pipe_handler_error_count > 100 && octave_interrupt_state >= 0) octave_interrupt_state++; SIGHANDLER_RETURN (0);