changeset 20676:0d5d8db55790

maint: periodic merge of stable to default
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Tue, 03 Nov 2015 17:58:15 -0500
parents 1672bb8882dd (current diff) 78b3e9868b67 (diff)
children 4b00afb5e9c3
files configure.ac doc/interpreter/contributors.in libgui/src/m-editor/file-editor-tab.cc libinterp/corefcn/debug.cc scripts/general/validateattributes.m scripts/plot/util/private/__gnuplot_draw_axes__.m scripts/time/datevec.m
diffstat 17 files changed, 82 insertions(+), 60 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac
+++ b/configure.ac
@@ -2154,7 +2154,7 @@
 AC_CHECK_HEADERS([grp.h ieeefp.h inttypes.h locale.h memory.h ncurses.h])
 AC_CHECK_HEADERS([poll.h pthread.h pwd.h sunmath.h sys/ioctl.h])
 AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/resource.h])
-AC_CHECK_HEADERS([sys/select.h termcap.h])
+AC_CHECK_HEADERS([sys/select.h sys/stropts.h termcap.h])
 
 ## C++ headers
 
--- a/doc/interpreter/contributors.in
+++ b/doc/interpreter/contributors.in
@@ -135,6 +135,7 @@
 Allan Jacobs
 Geoff Jacobsen
 Vytautas JanĨauskas
+Nick Jankowski
 Mats Jansson
 Cai Jianming
 Steven G. Johnson
--- a/doc/interpreter/expr.txi
+++ b/doc/interpreter/expr.txi
@@ -931,7 +931,7 @@
 If it is false, the result of the overall expression is 0.  If it is
 true, the expression @var{boolean2} is evaluated and converted to a
 scalar using the equivalent of the operation @code{all
-(@var{boolean1}(:))}.  If it is true, the result of the overall expression
+(@var{boolean2}(:))}.  If it is true, the result of the overall expression
 is 1.  Otherwise, the result of the overall expression is 0.
 
 @strong{Warning:} there is one exception to the rule of evaluating
@@ -947,7 +947,7 @@
 If it is true, the result of the overall expression is 1.  If it is
 false, the expression @var{boolean2} is evaluated and converted to a
 scalar using the equivalent of the operation @code{all
-(@var{boolean1}(:))}.  If it is true, the result of the overall expression
+(@var{boolean2}(:))}.  If it is true, the result of the overall expression
 is 1.  Otherwise, the result of the overall expression is 0.
 
 @strong{Warning:} the truth value of an empty matrix is always @code{false},
--- a/doc/interpreter/intro.txi
+++ b/doc/interpreter/intro.txi
@@ -194,7 +194,7 @@
 $@code{A}^{-1}@code{b}$,
 @end tex
 @ifnottex
-@code{inv (a) * b},
+@code{inv (A) * b},
 @end ifnottex
 but avoids computing the inverse of a matrix directly.
 
--- a/libgui/src/m-editor/file-editor-tab.cc
+++ b/libgui/src/m-editor/file-editor-tab.cc
@@ -168,6 +168,8 @@
   QSettings *settings = resource_manager::get_settings ();
   if (settings)
     notice_settings (settings, true);
+
+  setFocusProxy (_edit_area);
 }
 
 file_editor_tab::~file_editor_tab (void)
--- a/libgui/src/m-editor/file-editor.cc
+++ b/libgui/src/m-editor/file-editor.cc
@@ -1222,6 +1222,9 @@
      i.key ()->setTitle (i.value ().at (! enable));
      ++i;
    }
+
+  if (enable)
+    focus ();
 }
 
 QMenu*
--- a/libgui/src/octave-dock-widget.cc
+++ b/libgui/src/octave-dock-widget.cc
@@ -124,6 +124,7 @@
 
   installEventFilter (this);
 
+  setFocusPolicy (Qt::StrongFocus);
 }
 
 octave_dock_widget::~octave_dock_widget ()
--- a/libgui/src/octave-gui.cc
+++ b/libgui/src/octave-gui.cc
@@ -175,6 +175,9 @@
       shortcut_manager::init_data ();
     }
 
+  // Force left-to-right alignment (see bug #46204)
+  application.setLayoutDirection (Qt::LeftToRight);
+
   // Create and show main window.
 
   main_window w (0, start_gui);
--- a/libgui/src/qtinfo/webinfo.cc
+++ b/libgui/src/qtinfo/webinfo.cc
@@ -241,6 +241,9 @@
 void
 webinfo::search ()
 {
+  if (_search_line_edit->text ().trimmed ().isEmpty ())
+    return;   // do nothing if search field is empty or only has whitespaces
+
   if (_search_check_box->isChecked ())
     {
       // Global search
--- a/libgui/src/terminal-dock-widget.cc
+++ b/libgui/src/terminal-dock-widget.cc
@@ -39,7 +39,6 @@
 
   setWidget (terminal);
   setFocusProxy (terminal);
-  setFocusPolicy (Qt::StrongFocus);
 
   connect (terminal, SIGNAL (interrupt_signal (void)),
            this, SLOT (terminal_interrupt ()));
--- a/libinterp/corefcn/debug.cc
+++ b/libinterp/corefcn/debug.cc
@@ -462,28 +462,7 @@
   return retval;
 }
 
-bp_table::intmap
-bp_table::do_remove_all_breakpoints_in_file_1 (octave_user_code *fcn,
-                                               const std::string& fname)
-{
-  intmap retval;
-
-  std::string file = fcn->fcn_file_name ();
-
-  tree_statement_list *cmds = fcn->body ();
-
-  if (cmds)
-    {
-      retval = cmds->remove_all_breakpoints (file);
-
-      bp_set_iterator it = bp_set.find (fname);
-      if (it != bp_set.end ())
-        bp_set.erase (it);
-    }
-
-  return retval;
-}
-
+// Remove all breakpoints from a file, including those in subfunctions
 bp_table::intmap
 bp_table::do_remove_all_breakpoints_in_file (const std::string& fname,
                                              bool silent)
@@ -494,24 +473,17 @@
 
   if (dbg_fcn)
     {
-      retval = do_remove_all_breakpoints_in_file_1 (dbg_fcn, fname);
-
-      // Order is not important here.
+      std::string file = dbg_fcn->fcn_file_name ();
 
-      typedef std::map<std::string, octave_value>::const_iterator
-        subfcns_const_iterator;
-
-      std::map<std::string, octave_value> subfcns = dbg_fcn->subfunctions ();
+      tree_statement_list *cmds = dbg_fcn->body ();
 
-      for (subfcns_const_iterator p = subfcns.begin ();
-           p != subfcns.end (); p++)
+      if (cmds)
         {
-          octave_user_code *dbg_subfcn = p->second.user_code_value ();
+          retval = cmds->remove_all_breakpoints (file);
 
-          intmap tmp = do_remove_all_breakpoints_in_file_1 (dbg_subfcn, fname);
-
-          // Merge new list with retval.
-          retval.insert (tmp.begin (), tmp.end ());
+          bp_set_iterator it = bp_set.find (fname);
+          if (it != bp_set.end ())
+            bp_set.erase (it);
         }
     }
   else if (! silent)
--- a/libinterp/dldfcn/module-files
+++ b/libinterp/dldfcn/module-files
@@ -9,6 +9,8 @@
 __osmesa_print__.cc|$(OSMESA_CPPFLAGS) $(FT2_CPPFLAGS)|$(OSMESA_LDFLAGS)|$(OSMESA_LIBS)
 __voronoi__.cc|$(QHULL_CPPFLAGS)|$(QHULL_LDFLAGS)|$(QHULL_LIBS)
 amd.cc|$(SPARSE_XCPPFLAGS)|$(SPARSE_XLDFLAGS)|$(SPARSE_XLIBS)
+audiodevinfo.cc|$(PORTAUDIO_CPPFLAGS)|$(PORTAUDIO_LDFLAGS)|$(PORTAUDIO_LIBS)
+audioread.cc|$(SNDFILE_CPPFLAGS)|$(SNDFILE_LDFLAGS)|$(SNDFILE_LIBS)
 ccolamd.cc|$(SPARSE_XCPPFLAGS)|$(SPARSE_XLDFLAGS)|$(SPARSE_XLIBS)
 chol.cc|$(SPARSE_XCPPFLAGS)|$(SPARSE_XLDFLAGS)|$(SPARSE_XLIBS)
 colamd.cc|$(SPARSE_XCPPFLAGS)|$(SPARSE_XLDFLAGS)|$(SPARSE_XLIBS)
@@ -18,5 +20,3 @@
 qr.cc|$(QRUPDATE_CPPFLAGS) $(SPARSE_XCPPFLAGS)|$(QRUPDATE_LDFLAGS) $(SPARSE_XLDFLAGS)|$(QRUPDATE_LIBS) $(SPARSE_XLIBS)
 symbfact.cc|$(SPARSE_XCPPFLAGS)|$(SPARSE_XLDFLAGS)|$(SPARSE_XLIBS)
 symrcm.cc|$(SPARSE_XCPPFLAGS)|$(SPARSE_XLDFLAGS)|$(SPARSE_XLIBS)
-audioread.cc|$(SNDFILE_CPPFLAGS)|$(SNDFILE_LDFLAGS)|$(SNDFILE_LIBS)
-audiodevinfo.cc|$(PORTAUDIO_CPPFLAGS)|$(PORTAUDIO_LDFLAGS)|$(PORTAUDIO_LIBS)
--- a/scripts/general/validateattributes.m
+++ b/scripts/general/validateattributes.m
@@ -120,7 +120,7 @@
 ## @item @qcode{"nonnan"}
 ## No value is a @code{NaN}.
 ##
-## @item @qcode{"non-negative"}
+## @item @qcode{"nonnegative"}
 ## All values are non negative.
 ##
 ## @item @qcode{"nonsparse"}
--- a/scripts/plot/draw/plot.m
+++ b/scripts/plot/draw/plot.m
@@ -99,12 +99,14 @@
 ## in pairs.  These arguments are applied to the line objects drawn by
 ## @code{plot}.  Useful properties to modify are @qcode{"linestyle"},
 ## @qcode{"linewidth"}, @qcode{"color"}, @qcode{"marker"},
-## @qcode{"markersize"}, @qcode{"markeredgecolor"}, @qcode{"markerfacecolor"}.
+## @qcode{"markersize"}, @qcode{"markeredgecolor"}, @qcode{"markerfacecolor"}.  
+## @xref{Line Properties}.  
 ##
 ## The @var{fmt} format argument can also be used to control the plot style.
-## The format is composed of three parts: linestyle, markerstyle, color.
-## When a markerstyle is specified, but no linestyle, only the markers are
-## plotted.  Similarly, if a linestyle is specified, but no markerstyle, then
+## It is a string composed of four optional parts:
+## "<linestyle><marker><color><;displayname;>".
+## When a marker is specified, but no linestyle, only the markers are
+## plotted.  Similarly, if a linestyle is specified, but no marker, then
 ## only lines are drawn.  If both are specified then lines and markers will
 ## be plotted.  If no @var{fmt} and no @var{property}/@var{value} pairs are
 ## given, then the default plot style is solid lines with no markers and the
@@ -122,7 +124,7 @@
 ## @item @samp{-.} @tab Use dash-dotted lines.
 ## @end multitable
 ##
-## @item markerstyle
+## @item marker
 ##
 ## @multitable @columnfractions 0.06 0.94
 ## @item @samp{+} @tab crosshair
@@ -152,11 +154,11 @@
 ## @item @samp{w} @tab White
 ## @end multitable
 ##
-## @item @qcode{";key;"}
-## Here @qcode{"key"} is the label to use for the plot legend.
+## @item @qcode{";displayname;"}
+## Here @qcode{"displayname"} is the label to use for the plot legend.
 ## @end table
 ##
-## The @var{fmt} argument may also be used to assign legend keys.
+## The @var{fmt} argument may also be used to assign legend labels.
 ## To do so, include the desired label between semicolons after the
 ## formatting sequence described above, e.g., @qcode{"+b;Key Title;"}.
 ## Note that the last semicolon is required and Octave will generate
--- a/scripts/plot/util/private/__gnuplot_draw_axes__.m
+++ b/scripts/plot/util/private/__gnuplot_draw_axes__.m
@@ -146,7 +146,7 @@
   fputs (plot_stream, "unset ytics;\n");
   fputs (plot_stream, "unset ztics;\n");
   fputs (plot_stream, "unset x2tics;\n");
-  fputs (plot_stream, "unset x2tics;\n");
+  fputs (plot_stream, "unset y2tics;\n");
 
   if (! isempty (axis_obj.title))
     t = get (axis_obj.title);
--- a/scripts/statistics/distributions/normrnd.m
+++ b/scripts/statistics/distributions/normrnd.m
@@ -90,7 +90,7 @@
     endif
   else
     rnd = mu + sigma .* randn (sz, cls);
-    k = ! isfinite (mu) | !(sigma > 0) | !(sigma < Inf);
+    k = ! isfinite (mu) | !(sigma >= 0) | !(sigma < Inf);
     rnd(k) = NaN;
   endif
 
--- a/scripts/time/datevec.m
+++ b/scripts/time/datevec.m
@@ -252,15 +252,33 @@
 
   idx = strfind (f, "FFF");
   if (! isempty (idx))
-    ## Kludge to handle FFF millisecond format since strptime does not
-    f(idx:idx+2) = [];
-    [~, nc] = strptime (ds, f);
+    ## Kludge to handle FFF millisecond format since strptime does not.
+
+    ## Find location of FFF in ds.
+    ## Might not match idx because of things like yyyy -> %y.
+    [~, nc] = strptime (ds, f(1:idx-1));
+    
+    msec = ds(nc:min (nc+2,end)); # pull 3-digit fractional seconds.
+    msec_idx = find (! isdigit (msec), 1);
+    
+    if (! isempty (msec_idx))  # non-digits in msec
+      msec = msec(1:msec_idx-1);
+      msec(end+1:3) = "0";     # pad msec with trailing zeros
+      ds = [ds(1:(nc-1)), msec, ds((nc-1)+msec_idx:end)];  # zero pad ds
+    elseif (numel (msec) < 3)  # less than three digits in msec
+      m_len = numel (msec); 
+      msec(end+1:3) = "0";     # pad msec with trailing zeros
+      ds = [ds(1:(nc-1)), msec, ds(nc+m_len:end)];  # zero pad ds as well
+    endif
+    
+    ## replace FFF with digits to guarantee match in strptime.
+    f(idx:idx+2) = msec;
+  
     if (nc > 0)
-      msec = ds(nc:min(nc+2, end));
-      f = [f(1:idx-1) msec f(idx:end)];
       [tm, nc] = strptime (ds, f);
       tm.usec = 1000 * str2double (msec);
     endif
+
   else
     [tm, nc] = strptime (ds, f);
   endif
@@ -323,7 +341,25 @@
 %!assert (datevec ("03/13/1962"), [1962,3,13,0,0,0])
 
 ## Test millisecond format FFF
-%!assert (datevec ("15:38:21.25", "HH:MM:SS.FFF"), [yr,1,1,15,38,21.025])
+%!assert (datevec ("15:38:21.2", "HH:MM:SS.FFF"), [yr,1,1,15,38,21.2])
+%!assert (datevec ("15:38:21.25", "HH:MM:SS.FFF"), [yr,1,1,15,38,21.25])
+%!assert (datevec ("15:38:21.251", "HH:MM:SS.FFF"), [yr,1,1,15,38,21.251])
+
+## Test millisecond format FFF with AM/PM, and 1,2, or 3 FFF digits
+%!assert (datevec ("06/01/2015 3:07:12.102 PM", "mm/dd/yyyy HH:MM:SS.FFF PM"),
+%!        [2015,6,1,15,7,12.102])
+%!assert (datevec ("06/01/2015 11:07:12.102 PM", "mm/dd/yyyy HH:MM:SS.FFF PM"),
+%!        [2015,6,1,23,7,12.102])
+%!assert (datevec ("06/01/2015 3:07:12.102 AM", "mm/dd/yyyy HH:MM:SS.FFF PM"),
+%!        [2015,6,1,3,7,12.102])
+%!assert (datevec ("06/01/2015 11:07:12.102 AM", "mm/dd/yyyy HH:MM:SS.FFF PM"),
+%!        [2015,6,1,11,7,12.102])
+%!assert (datevec ("06/01/2015 3:07:12.1 PM", "mm/dd/yyyy HH:MM:SS.FFF PM"),
+%!        [2015,6,1,15,7,12.1])
+%!assert (datevec ("06/01/2015 3:07:12.12 AM", "mm/dd/yyyy HH:MM:SS.FFF PM"),
+%!        [2015,6,1,3,7,12.12])
+%!assert (datevec ("06/01/2015 3:07:12.12 PM", "mm/dd/yyyy HH:MM:SS.FFF PM"),
+%!        [2015,6,1,15,7,12.12])
 
 ## Test structure of return value (bug #42334)
 %!test