changeset 16004:1045790f9be4

Merge in Juan Pablo's changes
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Wed, 06 Feb 2013 10:36:38 -0500
parents cddf9103a566 (diff) 3b3321f9db9f (current diff)
children a60b6911842c
files libinterp/corefcn/cellfun.cc
diffstat 8 files changed, 57 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/cellfun.cc	Tue Feb 05 10:55:45 2013 +0100
+++ b/libinterp/corefcn/cellfun.cc	Wed Feb 06 10:36:38 2013 -0500
@@ -69,7 +69,14 @@
                  octave_value& func,
                  octave_value& error_handler)
 {
-  octave_value_list tmp = func.do_multi_index_op (nargout, inputlist);
+  octave_value_list tmp;
+  try {
+    tmp = func.do_multi_index_op (nargout, inputlist);
+  }
+  catch (octave_execution_exception) {
+    if (error_handler.is_defined ())
+      error_state = 1;
+  }
 
   if (error_state)
     {
@@ -996,6 +1003,7 @@
 %!assert (cellfun (@atan2, {1,1;1,1}, {1,2;1,2}), atan2 ([1,1;1,1],[1,2;1,2]))
 %!error cellfun (@factorial, {-1,3})
 %!assert (cellfun (@factorial,{-1,3},"ErrorHandler",@(x,y) NaN), [NaN,6])
+%!assert (cellfun (@(x) x(2),{[1],[1,2]},"ErrorHandler",@(x,y) NaN), [NaN,2])
 %!test
 %! [a,b,c] = cellfun (@fileparts, {fullfile("a","b","c.d"), fullfile("e","f","g.h")}, "UniformOutput", false);
 %! assert (a, {fullfile("a","b"), fullfile("e","f")});
--- a/scripts/plot/legend.m	Tue Feb 05 10:55:45 2013 +0100
+++ b/scripts/plot/legend.m	Wed Feb 06 10:36:38 2013 -0500
@@ -874,6 +874,7 @@
         if (addprops)
           addlistener (hlegend, "edgecolor", @updatelegendtext);
           addlistener (hlegend, "textcolor", @updatelegendtext);
+          addlistener (hlegend, "fontsize", @updatelegendtext);
           addlistener (hlegend, "interpreter", @updatelegendtext);
           addlistener (hlegend, "location", @updatelegend);
           addlistener (hlegend, "orientation", @updatelegend);
@@ -915,7 +916,10 @@
   text_kids = findobj (kids, "-property", "interpreter", "type", "text");
   interpreter = get (h, "interpreter");
   textcolor = get (h, "textcolor");
-  set (text_kids, "interpreter", interpreter, "color", textcolor);
+  fontsize = get (h, "fontsize");
+  set (text_kids, "interpreter", interpreter,
+                  "fontsize", fontsize,
+                  "color", textcolor);
 endfunction
 
 function hideshowlegend (h, d, ca, pos1, pos2)
--- a/scripts/plot/private/__go_draw_axes__.m	Tue Feb 05 10:55:45 2013 +0100
+++ b/scripts/plot/private/__go_draw_axes__.m	Wed Feb 06 10:36:38 2013 -0500
@@ -1591,7 +1591,19 @@
       else
         fontspec = "";
       endif
-      colorspec = get_text_colorspec (hlgnd.textcolor, mono);
+      textcolors = get (findobj (hlgnd.children, "type", "text"), "color");
+      if (iscell (textcolors))
+        textcolors = cell2mat (textcolors);
+        textcolors = unique (textcolors, "rows");
+      endif
+      if (rows (textcolors) > 1)
+        ## Gnuplot is unable to assign arbitrary colors to each text entry
+        ## for the key/legend.  But, the text color can be set to match the
+        ## color of the plot object.
+        colorspec = "textcolor variable";
+      else
+        colorspec = get_text_colorspec (textcolors, mono);
+      endif
       fprintf (plot_stream, "set key %s %s;\nset key %s %s %s %s %s;\n",
                inout, pos, box, reverse, horzvert, fontspec, colorspec);
     else
@@ -2350,7 +2362,7 @@
   persistent sym = __setup_sym_table__ ();
   persistent flds = fieldnames (sym);
 
-  [s, e, m] = regexp (str,'\\\\([a-zA-Z]+|0)','start','end','matches');
+  [s, e, m] = regexp (str, "\\\\([a-zA-Z]+|0)", "start", "end", "matches");
 
   for i = length (s) : -1 : 1
     ## special case for "\0"  and replace with "{/Symbol \306}'
--- a/test/Makefile.am	Tue Feb 05 10:55:45 2013 +0100
+++ b/test/Makefile.am	Wed Feb 06 10:36:38 2013 -0500
@@ -52,6 +52,7 @@
 
 include bug-35448/module.mk
 include bug-36025/module.mk
+include bug-38236/module.mk
 include classes/module.mk
 include class-concat/module.mk
 include ctor-vs-method/module.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/bug-38236/df_vr.m	Wed Feb 06 10:36:38 2013 -0500
@@ -0,0 +1,2 @@
+# df_vr.m
+vr = 7;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/bug-38236/module.mk	Wed Feb 06 10:36:38 2013 -0500
@@ -0,0 +1,6 @@
+bug_38236_FCN_FILES = \
+  bug-38236/dv_vr.m \
+  bug-38236/u_vr.m \
+  bug-35448/test_bug_38236.m
+
+FCN_FILES += $(bug_38236_FCN_FILES)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/bug-38236/test_bug_38236.m	Wed Feb 06 10:36:38 2013 -0500
@@ -0,0 +1,3 @@
+%!test
+%! u_vr
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/bug-38236/u_vr.m	Wed Feb 06 10:36:38 2013 -0500
@@ -0,0 +1,17 @@
+# u_vr.m
+
+cmd = "\
+function __demo__ () \
+  df_vr; \
+  v = vr * 2; \
+endfunction \
+";
+
+for ii = 1:2
+  unwind_protect
+    eval (cmd);
+    __demo__;
+  unwind_protect_cleanup
+    clear __demo__
+  end_unwind_protect
+endfor
\ No newline at end of file