Mercurial > octave
changeset 20773:4d78e076a592
maint: periodic merge of stable to default
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 28 Nov 2015 14:07:09 -0500 |
parents | ed708a7ce0a2 (current diff) 51ab9145f6e6 (diff) |
children | 5c5e085a1ae6 |
files | libgui/src/files-dock-widget.cc libgui/src/settings-dialog.ui libgui/src/workspace-view.cc libinterp/corefcn/find.cc libinterp/parse-tree/lex.ll scripts/general/randi.m |
diffstat | 7 files changed, 97 insertions(+), 70 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/languages/de_DE.ts Fri Nov 27 16:00:30 2015 -0500 +++ b/libgui/languages/de_DE.ts Sat Nov 28 14:07:09 2015 -0500 @@ -39,7 +39,7 @@ <message> <location line="+1"/> <source>persistent</source> - <translation>Beständig</translation> + <translation>Persistent</translation> </message> <message> <location filename="../qterminal/libqterminal/QTerminal.cc" line="+65"/> @@ -727,9 +727,9 @@ is about to be closed but has been modified. %2</source> <translation>Die Datei - + %1 - + soll geschlossen werden, wurde aber modifiziert. %2</translation> </message> <message> @@ -818,7 +818,7 @@ <message> <location line="+1"/> <source>Browse your files.</source> - <translation>Dateien durchsuchen.</translation> + <translation>Dateien durchsuchen</translation> </message> <message> <location line="+18"/> @@ -1684,7 +1684,8 @@ <message> <location line="+9"/> <source>Current Directory: </source> - <translation>Aktuelles Verzeichnis:</translation> + <translatorcomment>Armin: Leerzeichen Bestandteil des Layouts</translatorcomment> + <translation>Aktuelles Verzeichnis: </translation> </message> <message> <location line="+4"/> @@ -2027,9 +2028,9 @@ <location line="+135"/> <location filename="../src/ui-settings-dialog.h" line="+4"/> <source>This works well for monospaced fonts. The line is drawn at a position based on the width of a space character in the default font. It may not work very well if styles use proportional fonts or if varied font sizes or bold, italic and normal texts are used.</source> - <translation>Funktioniert gut mit Schriftarten fester Breite. + <translation>Funktioniert gut mit Schriftarten fester Breite. Die Position der angezeigten Linie basiert auf der Breite eines Leerzeichens der Standardschriftart. -Dies funktioniert möglicherweise nicht mit Stilen, die eine Schriftart variabler Breite verwenden +Dies funktioniert möglicherweise nicht mit Stilen, die eine Schriftart variabler Breite verwenden oder wenn unterschiedliche Schriftgrößen oder -stile (fett/kursiv/normal) verwendet werden.</translation> </message> <message> @@ -3163,11 +3164,13 @@ <message> <location line="-125"/> <source>Step</source> + <translatorcomment>Armin: Vorher "Überspringen" im Kontrast zu "Hineinspringen"</translatorcomment> <translation>Einzelschritt</translation> </message> <message> <location line="+36"/> <source>Reset Default Window Layout</source> + <translatorcomment>Armin: Bisschen lang, Menü wird groß</translatorcomment> <translation>Fensterlayout auf Grundeinstellung zurücksetzen</translation> </message> <message> @@ -3259,7 +3262,7 @@ <message> <location line="+5"/> <source>Toggle Breakpoint</source> - <translation>Lesezeichen umschalten</translation> + <translation>Haltepunkt umschalten</translation> </message> <message> <location line="+2"/>
--- a/libgui/src/files-dock-widget.cc Fri Nov 27 16:00:30 2015 -0500 +++ b/libgui/src/files-dock-widget.cc Sat Nov 28 14:07:09 2015 -0500 @@ -67,7 +67,7 @@ setObjectName ("FilesDockWidget"); setWindowIcon (QIcon (":/actions/icons/logo.png")); set_title (tr ("File Browser")); - setToolTip (tr ("Browse your files.")); + setToolTip (tr ("Browse your files")); _sig_mapper = 0;
--- a/libgui/src/settings-dialog.ui Fri Nov 27 16:00:30 2015 -0500 +++ b/libgui/src/settings-dialog.ui Sat Nov 28 14:07:09 2015 -0500 @@ -1952,7 +1952,7 @@ </sizepolicy> </property> <property name="title"> - <string>Colors for variable attributes </string> + <string>Colors for variable attributes</string> </property> </widget> </item>
--- a/libgui/src/workspace-view.cc Fri Nov 27 16:00:30 2015 -0500 +++ b/libgui/src/workspace-view.cc Sat Nov 28 14:07:09 2015 -0500 @@ -307,7 +307,7 @@ if (! wm->is_top_level ()) { rename->setDisabled (true); - rename->setToolTip (tr ("Only top-level symbols may be renamed.")); + rename->setToolTip (tr ("Only top-level symbols may be renamed")); } menu.addSeparator ();
--- a/libinterp/corefcn/find.cc Fri Nov 27 16:00:30 2015 -0500 +++ b/libinterp/corefcn/find.cc Sat Nov 28 14:07:09 2015 -0500 @@ -87,6 +87,7 @@ find_nonzero_elem_idx (const Sparse<T>& v, int nargout, octave_idx_type n_to_find, int direction) { + nargout = std::min (nargout, 5); octave_value_list retval ((nargout == 0 ? 1 : nargout), Matrix ()); octave_idx_type nr = v.rows (); @@ -217,11 +218,6 @@ case 2: retval(1) = j_idx; retval(0) = i_idx; - break; - - default: - panic_impossible (); - break; } return retval; @@ -232,6 +228,7 @@ octave_idx_type n_to_find, int direction) { // There are far fewer special cases to handle for a PermMatrix. + nargout = std::min (nargout, 5); octave_value_list retval ((nargout == 0 ? 1 : nargout), Matrix ()); octave_idx_type nr = v.rows (); @@ -315,11 +312,6 @@ case 2: retval(1) = j_idx; retval(0) = i_idx; - break; - - default: - panic_impossible (); - break; } return retval;
--- a/libinterp/parse-tree/lex.ll Fri Nov 27 16:00:30 2015 -0500 +++ b/libinterp/parse-tree/lex.ll Sat Nov 28 14:07:09 2015 -0500 @@ -2024,6 +2024,7 @@ maybe_classdef_get_set_method = false; parsing_classdef_get_method = false; parsing_classdef_set_method = false; + quote_is_transpose = false; force_script = false; reading_fcn_file = false; reading_script_file = false; @@ -2036,6 +2037,7 @@ defining_func = 0; looking_at_function_handle = 0; block_comment_nesting_level = 0; + command_arg_paren_count = 0; token_count = 0; current_input_line = ""; comment_text = ""; @@ -2047,13 +2049,13 @@ fcn_file_full_name = ""; looking_at_object_index.clear (); looking_at_object_index.push_front (false); - command_arg_paren_count = 0; while (! parsed_function_name.empty ()) parsed_function_name.pop (); + pending_local_variables.clear (); + symtab_context.clear (); nesting_level.reset (); - tokens.clear (); }
--- a/scripts/general/randi.m Fri Nov 27 16:00:30 2015 -0500 +++ b/scripts/general/randi.m Sat Nov 28 14:07:09 2015 -0500 @@ -46,7 +46,8 @@ ## Implementation Note: @code{randi} relies internally on @code{rand} which ## uses class @qcode{"double"} to represent numbers. This limits the maximum ## integer (@var{imax}) and range (@var{imax} - @var{imin}) to the value -## returned by the @code{flintmax} function. +## returned by the @code{flintmax} function. For IEEE floating point numbers +## this value is @w{@math{2^{53} - 1}}. ## ## @seealso{rand} ## @end deftypefn @@ -58,10 +59,9 @@ if (nargin < 1) print_usage (); endif - nargoutchk (0, 1); if (! (isnumeric (bounds) && all (bounds == fix (bounds)))) - error ("randi: IMIN and IMAX must be integer bounds."); + error ("randi: IMIN and IMAX must be integer bounds"); endif bounds = real (double (bounds)); @@ -69,13 +69,13 @@ imin = 1; imax = bounds; if (imax < 1) - error ("randi: require IMAX >= 1."); + error ("randi: require IMAX >= 1"); endif else imin = bounds(1); imax = bounds(2); if (imax < imin) - error ("randi: require IMIN <= IMAX."); + error ("randi: require IMIN <= IMAX"); endif endif @@ -86,33 +86,35 @@ rclass = "double"; endif - ## Limit set by use of class double in rand() - if (imax >= flintmax ()) - error ("randi: maximum integer IMAX must be smaller than flintmax ()."); + ## Limit set by use of class double in rand(): Any consecutive integer in the + ## range [-flintmax(), flintmax()] can be represented by a double. + if ((abs (imax) >= flintmax ()) || (abs (imin) >= flintmax ())) + error ("randi: IMIN and IMAX must be smaller than flintmax()"); endif - if ((imax - imin) >= flintmax ()) - error ("randi: maximum integer range must be smaller than flintmax ()."); + if ((imax - imin) >= (flintmax () - 1)) + error ("randi: integer range must be smaller than flintmax()-1"); endif - - ri = imin + floor ( (imax-imin+1)*rand (varargin{:}) ); + ri = imin + floor ((imax - imin + 1) * rand (varargin{:})); if (! strcmp (rclass, "double")) if (strfind (rclass, "int")) - maxval = intmax (rclass); - minval = intmin (rclass); + maxval = double (intmax (rclass)); + minval = double (intmin (rclass)); elseif (strcmp (rclass, "single")) - maxval = flintmax (rclass); + maxval = double (flintmax (rclass)); minval = -maxval; + else + error ("randi: unknown requested output class '%s'", rclass); endif - if ((imax >= maxval) || ((imax - imin) >= maxval)) - warning (["randi: maximum integer IMAX or range exceeds requested ", ... - "type. Values might be truncated to requested type."]); + if (imax > maxval) + warning (["randi: integer IMAX exceeds requested type. ", ... + "Values might be truncated to requested type."]); + elseif (imin < minval) + warning (["randi: integer IMIN exceeds requested type. ", ... + " Values might be truncated to requested type."]); endif - if (imin < minval) - warning (["randi: minimum integer IMIN exceeds requested type. ", ... - "Values might be truncated to requested type."]); - endif + ri = cast (ri, rclass); endif @@ -127,6 +129,8 @@ %! assert (rows (ri), 1000); %! assert (columns (ri), 1); %! assert (class (ri), "double"); +## FIXME: Does Octave guarantee support for int64 even when underlying hardware +## is 32-bit? %!test %! ri = randi (int64 (100), 1, 1000); %! assert (ri, fix (ri)); @@ -147,37 +151,63 @@ %! assert (min (ri), single (-5)); %! assert (max (ri), single (10)); %! assert (class (ri), "single"); -%! -%!assert (size (randi (10, 3,1,2)), [3, 1, 2]) + +%!assert (size (randi (10, 3, 1, 2)), [3, 1, 2]) + +%!shared max_int8, min_int8, max_uint8, min_uint8, max_single +%! max_int8 = double (intmax ("int8")); +%! min_int8 = double (intmin ("int8")); +%! max_uint8 = double (intmax ("uint8")); +%! min_uint8 = double (intmin ("uint8")); +%! max_single = double (flintmax ("single")); -## Test range exceedings +## Test that no warning thrown if IMAX is exactly on the limits of the range +%!function test_no_warning (func, varargin) +%! state = warning ("query"); +%! unwind_protect +%! warning ("error", "all"); +%! func (varargin{:}); +%! unwind_protect_cleanup +%! warning (state); +%! end_unwind_protect +%!endfunction +%!test test_no_warning (@randi, max_int8, "int8"); +%!test test_no_warning (@randi, max_uint8, "uint8"); +%!test test_no_warning (@randi, max_single, "single"); +%!test test_no_warning (@randi, [min_int8, max_int8], "int8"); +%!test test_no_warning (@randi, [min_uint8, max_uint8], "uint8"); +%!test test_no_warning (@randi, [-max_single, max_single], "single"); + +## Test exceeding range +%!warning <exceeds requested type> +%! randi ([min_int8-1, max_int8], "int8"); +%!warning <exceeds requested type> +%! randi ([min_uint8-1, max_uint8], "uint8"); +%!warning <exceeds requested type> +%! randi ([min_int8, max_int8 + 1], "int8"); +%!warning <exceeds requested type> +%! randi ([min_uint8, max_uint8 + 1], "uint8"); +%!warning <exceeds requested type> +%! randi ([0, max_single + 1], "single"); %!warning <exceeds requested type> %! ri = randi ([-5, 10], 1000, 1, "uint8"); %! assert (ri, fix (ri)); %! assert (min (ri), uint8 (-5)); %! assert (max (ri), uint8 (10)); %! assert (class (ri), "uint8"); -%!warning <exceeds requested type> randi (intmax("int8"), 10, 1, "int8"); -%!warning <exceeds requested type> randi (flintmax("single"), 10, 1, "single"); -%!warning <exceeds requested type> -%! randi ([-1, intmax("int8") - 1], 10, 1, "int8"); -%!warning <exceeds requested type> -%! randi ([-1, flintmax("single") - 1], 10, 1, "single"); -%!warning <exceeds requested type> -%! randi ([-flintmax("single"), 0], 10, 1, "single"); -%!warning <exceeds requested type> -%! randi ([-flintmax("single") + 1, 1], 10, 1, "single"); + ## Test input validation -%!error (randi ()) -%!error (randi ("test")) -%!error (randi (struct ("a", 1))) -%!error (randi (0)) -%!error (randi (1.5)) -%!error (randi ([1.5, 2.5])) -%!error (randi ([1, 2.5])) -%!error (randi ([1.5, 2])) -%!error (randi ([10, 1])) -%!error (randi (flintmax ())) -%!error (randi ([-1, flintmax() - 1])) -%!error ([r1, r2] = randi ()) +%!error randi () +%!error <must be integer bounds> randi ("test") +%!error <must be integer bounds> randi (struct ("a", 1)) +%!error <must be integer bounds> randi (1.5) +%!error <must be integer bounds> randi ([1.5, 2.5]) +%!error <must be integer bounds> randi ([1, 2.5]) +%!error <must be integer bounds> randi ([1.5, 2]) +%!error <require IMAX .= 1> randi (0) +%!error <require IMIN <= IMAX> randi ([10, 1]) +%!error <IMIN and IMAX must be smaller than flintmax\(\)> randi (flintmax ()) +%!error <range must be smaller than flintmax\(\)-1> randi ([-1, flintmax() - 1]) +%!error <unknown requested output class 'foo'> randi (10, "foo") +