changeset 4793:a62215ab8a03

[project @ 2004-02-20 20:59:34 by jwe]
author jwe
date Fri, 20 Feb 2004 20:59:34 +0000
parents d2038299c683
children 6279796dc2b9
files ChangeLog libcruft/ChangeLog libcruft/misc/quit.h mkoctfile.in src/ChangeLog src/Makefile.in src/pt-except.cc src/sighandlers.cc
diffstat 8 files changed, 64 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Feb 20 18:44:43 2004 +0000
+++ b/ChangeLog	Fri Feb 20 20:59:34 2004 +0000
@@ -1,3 +1,7 @@
+2004-02-20  Per Persson  <persquare@mac.com>
+
+	* mkoctfile.in (LINK_DEPS): Include $LDFLAGS in the list.
+
 2004-02-18  Per Persson  <persquare@mac.com>
 
 	* configure.in (*-*-darwin*): Define SONAME_FLAGS.
--- a/libcruft/ChangeLog	Fri Feb 20 18:44:43 2004 +0000
+++ b/libcruft/ChangeLog	Fri Feb 20 20:59:34 2004 +0000
@@ -1,3 +1,8 @@
+2004-02-20  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* misc/quit.h (OCTAVE_QUIT): Set octave_interrupt_state to -1
+	while we are handling interrupts.
+
 2004-02-14  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* Makefile.in (LINK_DEPS): Always define.
--- a/libcruft/misc/quit.h	Fri Feb 20 18:44:43 2004 +0000
+++ b/libcruft/misc/quit.h	Fri Feb 20 20:59:34 2004 +0000
@@ -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 (); \
         } \
     } \
--- a/mkoctfile.in	Fri Feb 20 18:44:43 2004 +0000
+++ b/mkoctfile.in	Fri Feb 20 20:59:34 2004 +0000
@@ -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
--- a/src/ChangeLog	Fri Feb 20 18:44:43 2004 +0000
+++ b/src/ChangeLog	Fri Feb 20 20:59:34 2004 +0000
@@ -1,3 +1,19 @@
+2004-02-20  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* 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  <persquare@mac.com>
+
+	* Makefile.in (OCT_LINK_DEPS, OCTINTERP_LINK_DEPS):
+	Include	$(LIBS) in the list before $(FLIBS).
+
 2004-02-20  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* pr-output.cc (octave_print_internal (std::ostream&, const
--- a/src/Makefile.in	Fri Feb 20 18:44:43 2004 +0000
+++ b/src/Makefile.in	Fri Feb 20 20:59:34 2004 +0000
@@ -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 \
--- a/src/pt-except.cc	Fri Feb 20 18:44:43 2004 +0000
+++ b/src/pt-except.cc	Fri Feb 20 20:59:34 2004 +0000
@@ -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<tree_statement_list *> (ptr);
--- a/src/sighandlers.cc	Fri Feb 20 18:44:43 2004 +0000
+++ b/src/sighandlers.cc	Fri Feb 20 20:59:34 2004 +0000
@@ -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);