changeset 7202:ffdbdf53665c

[project @ 2007-11-27 20:14:41 by jwe]
author jwe
date Tue, 27 Nov 2007 20:16:19 +0000
parents 76341ffda11e
children 0d91c2af10bd
files scripts/ChangeLog scripts/plot/__go_draw_figure__.m src/ChangeLog src/error.cc src/octave.cc src/toplev.cc src/toplev.h
diffstat 7 files changed, 93 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Tue Nov 27 18:23:48 2007 +0000
+++ b/scripts/ChangeLog	Tue Nov 27 20:16:19 2007 +0000
@@ -1,9 +1,14 @@
+2007-11-27  David Bateman  <dbateman@free.fr>
+
+	* plot/__go_draw_figure__.m: Force a multiplot mode with a
+	colorbar, to ensure that the colorbar is on the canvas for png and
+	postscipt outputs.
+
 2007-11-26  David Bateman  <dbateman@free.fr>
 
 	* sparse/spstats.m, statistics/base/mode.m: More care with sparse
 	return values.
 
-
 	* plot/plotyy.m: New function
 	* plot/Makefile.in (SOURCES): Add it here.
 	* plot/__go_draw_axes__.m: Force axis margins for plotyy. Set text
--- a/scripts/plot/__go_draw_figure__.m	Tue Nov 27 18:23:48 2007 +0000
+++ b/scripts/plot/__go_draw_figure__.m	Tue Nov 27 20:16:19 2007 +0000
@@ -37,6 +37,10 @@
 	  switch (obj.type)
 	    case "axes"
 	      axes_count++;
+	      ## Force multiplot with a colorbar to ensure colorbar on the page
+	      if (!strcmp (obj.__colorbar__, "none"))
+		axes_count++;
+	      endif
 	  endswitch
 	endfor
 
--- a/src/ChangeLog	Tue Nov 27 18:23:48 2007 +0000
+++ b/src/ChangeLog	Tue Nov 27 20:16:19 2007 +0000
@@ -1,5 +1,13 @@
 2007-11-27  John W. Eaton  <jwe@octave.org>
 
+	* error.cc (Fwarning): If setting state "all" to "error", leave
+	Octave:matlab-incompatible warning state unchanged.
+
+	* octave.cc (execute_eval_option_code, execute_command_line_file):
+	Handle interrupts.
+	* toplev.cc (recover_from_exception): Now extern.
+	* toplev.h (recover_from_exception): Provide decl.
+
 	* pt-idx.cc (tree_index_expression::lvalue): Treat object == []
 	the same as undefined.
 
--- a/src/error.cc	Tue Nov 27 18:23:48 2007 +0000
+++ b/src/error.cc	Tue Nov 27 20:16:19 2007 +0000
@@ -1074,8 +1074,44 @@
 		{
 		  Octave_map tmp;
 
-		  tmp.assign ("identifier", arg2);
-		  tmp.assign ("state", arg1);
+		  Cell id (1, 1);
+		  Cell st (1, 1);
+
+		  id(0) = arg2;
+		  st(0) = arg1;
+
+		  // Since internal Octave functions are not
+		  // compatible, turning all warnings into errors
+		  // should leave the state of
+		  // Octave:matlab-incompatible alone.
+
+		  if (arg1 == "error"
+		      && warning_options.contains ("identifier"))
+		    {
+		      Cell tid = warning_options.contents ("identifier");
+		      Cell tst = warning_options.contents ("state");
+
+		      for (octave_idx_type i = 0; i < tid.numel (); i++)
+			{
+			  octave_value vid = tid(i);
+
+			  if (vid.is_string ()
+			      && (vid.string_value ()
+				  == "Octave:matlab-incompatible"))
+			    {
+			      id.resize (dim_vector (1, 2));
+			      st.resize (dim_vector (1, 2));
+
+			      id(1) = tid(i);
+			      st(1) = tst(i);
+
+			      break;
+			    }
+			}
+		    }
+
+		  tmp.assign ("identifier", id);
+		  tmp.assign ("state", st);
 
 		  warning_options = tmp;
 
--- a/src/octave.cc	Tue Nov 27 18:23:48 2007 +0000
+++ b/src/octave.cc	Tue Nov 27 20:16:19 2007 +0000
@@ -366,6 +366,18 @@
 {
   unwind_protect::begin_frame ("execute_eval_option_code");
 
+  octave_save_signal_mask ();
+
+  can_interrupt = true;
+
+  octave_signal_hook = octave_signal_handler;
+  octave_interrupt_hook = unwind_protect::run_all;
+  octave_bad_alloc_hook = unwind_protect::run_all;
+
+  octave_catch_interrupts ();
+
+  octave_initialized = true;
+
   unwind_protect_bool (interactive);
 
   interactive = false;
@@ -376,6 +388,11 @@
     {
       eval_string (code, false, parse_status, 0);
     }
+  catch (octave_interrupt_exception)
+    {
+      recover_from_exception ();
+      octave_stdout << "\n";
+    }
   catch (std::bad_alloc)
     {
       std::cerr << "error: memory exhausted or requested size too large for range of Octave's index type -- eval failed"
@@ -392,6 +409,18 @@
 {
   unwind_protect::begin_frame ("execute_command_line_file");
 
+  octave_save_signal_mask ();
+
+  can_interrupt = true;
+
+  octave_signal_hook = octave_signal_handler;
+  octave_interrupt_hook = unwind_protect::run_all;
+  octave_bad_alloc_hook = unwind_protect::run_all;
+
+  octave_catch_interrupts ();
+
+  octave_initialized = true;
+
   unwind_protect_bool (interactive);
   unwind_protect_bool (reading_script_file);
   unwind_protect_bool (input_from_command_line_file);
@@ -422,6 +451,11 @@
     {
       parse_and_execute (fname, false, "octave");
     }
+  catch (octave_interrupt_exception)
+    {
+      recover_from_exception ();
+      octave_stdout << "\n";
+    }
   catch (std::bad_alloc)
     {
       std::cerr << "error: memory exhausted or requested size too large for range of Octave's index type -- execution of "
--- a/src/toplev.cc	Tue Nov 27 18:23:48 2007 +0000
+++ b/src/toplev.cc	Tue Nov 27 20:16:19 2007 +0000
@@ -175,7 +175,7 @@
   delete f;
 }
 
-static void
+void
 recover_from_exception (void)
 {
   can_interrupt = true;
--- a/src/toplev.h	Tue Nov 27 18:23:48 2007 +0000
+++ b/src/toplev.h	Tue Nov 27 20:16:19 2007 +0000
@@ -39,6 +39,8 @@
 extern void
 clean_up_and_exit (int) GCC_ATTR_NORETURN;
 
+extern void recover_from_exception (void);
+
 extern int main_loop (void);
 
 extern void