# HG changeset patch # User John W. Eaton # Date 1406898381 14400 # Node ID c59745865c7f6656ebd4898e07d6e46746640ef9 # Parent 12462638ab20c8df4b59436dbc9f768d646a81cc# Parent d8abf813c69f0364923f560e86fa56bfc1284f2d maint: Periodic merge of stable to gui-release. diff -r 12462638ab20 -r c59745865c7f build-aux/common.mk --- a/build-aux/common.mk Wed Jul 30 07:02:41 2014 +0200 +++ b/build-aux/common.mk Fri Aug 01 09:06:21 2014 -0400 @@ -46,6 +46,7 @@ YACC = @YACC@ AM_YFLAGS = -dv +BISON_API_PREFIX_DECL_STYLE = @BISON_API_PREFIX_DECL_STYLE@ BISON_PUSH_PULL_DECL_STYLE = @BISON_PUSH_PULL_DECL_STYLE@ GPERF = @GPERF@ diff -r 12462638ab20 -r c59745865c7f configure.ac --- a/configure.ac Wed Jul 30 07:02:41 2014 +0200 +++ b/configure.ac Fri Aug 01 09:06:21 2014 -0400 @@ -2770,6 +2770,7 @@ if test $build_gui = yes; then OCTAVE_CHECK_QFONT_MONOSPACE + OCTAVE_CHECK_QFONT_FORCE_INTEGER_METRICS OCTAVE_CHECK_FUNC_SETPLACEHOLDERTEXT OCTAVE_CHECK_FUNC_QTABWIDGET_SETMOVABLE OCTAVE_CHECK_FUNC_QSCI_FINDSELECTION diff -r 12462638ab20 -r c59745865c7f doc/interpreter/external.txi --- a/doc/interpreter/external.txi Wed Jul 30 07:02:41 2014 +0200 +++ b/doc/interpreter/external.txi Fri Aug 01 09:06:21 2014 -0400 @@ -23,7 +23,7 @@ @cindex Dynamically Linked Functions @cindex Octave API -“The sum of human wisdom is not contained in any one language" +"The sum of human wisdom is not contained in any one language" ---Ezra Pound Octave is a fantastic language for solving many problems in science and diff -r 12462638ab20 -r c59745865c7f libgui/Makefile.am --- a/libgui/Makefile.am Wed Jul 30 07:02:41 2014 +0200 +++ b/libgui/Makefile.am Fri Aug 01 09:06:21 2014 -0400 @@ -22,6 +22,10 @@ MOC_CPPFLAGS = +## Fix for bug #42839 where -mieee CFLAG option is added to CPPFLAGS by gnulib. +## Eventually gnulib will be appropriately fixed and this hack removed. +MOC_OCTAVE_CPPFLAGS = $(filter-out -mieee, $(AM_CPPFLAGS) $(CPPFLAGS)) + octlib_LTLIBRARIES = liboctgui.la TRANSLATIONS = \ @@ -94,7 +98,7 @@ ( echo '#ifdef HAVE_CONFIG_H'; \ echo '#include '; \ echo '#endif'; \ - $(MOC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(MOC_CPPFLAGS) $(liboctgui_la_CPPFLAGS) $< ) > $@-t + $(MOC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MOC_OCTAVE_CPPFLAGS) $(MOC_CPPFLAGS) $(liboctgui_la_CPPFLAGS) $< ) > $@-t mv $@-t $@ endef diff -r 12462638ab20 -r c59745865c7f libgui/qterminal/libqterminal/unix/TerminalView.cpp --- a/libgui/qterminal/libqterminal/unix/TerminalView.cpp Wed Jul 30 07:02:41 2014 +0200 +++ b/libgui/qterminal/libqterminal/unix/TerminalView.cpp Fri Aug 01 09:06:21 2014 -0400 @@ -212,8 +212,11 @@ // Disabling kerning saves some computation when rendering text. // font.setKerning(false); - font.setStyleStrategy ( QFont::StyleStrategy(font.styleStrategy() - | QFont::ForceIntegerMetrics) ); + QFont::StyleStrategy strategy = font.styleStrategy(); +#if defined (HAVE_QFONT_FORCE_INTEGER_METRICS) + strategy |= QFont::ForceIntegerMetrics; +#endif + font.setStyleStrategy(QFont::StyleStrategy(strategy)); QWidget::setFont(font); fontChange(font); diff -r 12462638ab20 -r c59745865c7f libinterp/dldfcn/__magick_read__.cc --- a/libinterp/dldfcn/__magick_read__.cc Wed Jul 30 07:02:41 2014 +0200 +++ b/libinterp/dldfcn/__magick_read__.cc Fri Aug 01 09:06:21 2014 -0400 @@ -74,15 +74,32 @@ static bool is_indexed (const Magick::Image& img) { - bool retval = false; - const std::string format = img.magick (); - if (img.classType () == Magick::PseudoClass - && format != "JPEG" - && (format != "PNG" - || const_cast (img).attribute ("PNG:IHDR.color-type-orig") == "3")) - retval = true; - - return retval; + bool indexed = (img.classType () == Magick::PseudoClass); + // Our problem until now is non-indexed images, being represented as indexed + // by GM. The following attempts educated guesses to undo this optimization. + if (indexed) + { + const std::string fmt = img.magick (); + if (fmt == "JPEG") + // The JPEG format does not support indexed images, but GM sometimes + // reports grayscale JPEG as indexed. Always false for JPEG. + indexed = false; + else if (fmt == "PNG") + { + // Newer versions of GM (at least does not happens with 1.3.16) will + // store values from the underlying library as image attributes. In + // the case of PNG files, this is libpng where an indexed image will + // always have a value of 3 for "color-type-orig". This property + // always has a value in libpng so if we get nothing, we assume this + // GM version does not store them and we have to go with whatever + // GM PseudoClass says. + const std::string color_type = + const_cast (img).attribute ("PNG:IHDR.color-type-orig"); + if (! color_type.empty() && color_type != "3") + indexed = false; + } + } + return indexed; } // The depth from depth() is not always correct for us but seems to be the diff -r 12462638ab20 -r c59745865c7f libinterp/parse-tree/lex.ll --- a/libinterp/parse-tree/lex.ll Wed Jul 30 07:02:41 2014 +0200 +++ b/libinterp/parse-tree/lex.ll Fri Aug 01 09:06:21 2014 -0400 @@ -96,6 +96,17 @@ #include #include +// FIXME: with bison 3.x, OCTAVE_STYPE appears in the generated +// oct-parse.h file, but there is no definition for YYSTYPE, which is +// needed by the code that is generated by flex. I can't seem to find a +// way to tell flex to use OCTAVE_STYPE instead of YYSTYPE in the code +// it generates, or to tell bison to provide the definition of YYSTYPE +// in the generated oct-parse.h file. + +#if defined (OCTAVE_STYPE_IS_DECLARED) && ! defined YYSTYPE +#define YYSTYPE OCTAVE_STYPE +#endif + #if defined (GNULIB_NAMESPACE) // Calls to the following functions appear in the generated output from // flex without the namespace tag. Redefine them so we will use them diff -r 12462638ab20 -r c59745865c7f libinterp/parse-tree/module.mk --- a/libinterp/parse-tree/module.mk Wed Jul 30 07:02:41 2014 +0200 +++ b/libinterp/parse-tree/module.mk Fri Aug 01 09:06:21 2014 -0400 @@ -86,15 +86,20 @@ rm -f $@-t1 parse-tree/oct-parse.yy: parse-tree/oct-parse.in.yy + case "$(BISON_API_PREFIX_DECL_STYLE)" in \ + *api*) api_prefix_decl='%define api.prefix "octave-"'; ;; \ + *name*) api_prefix_decl='%name-prefix="octave_"'; ;; \ + esac; \ case "$(BISON_PUSH_PULL_DECL_STYLE)" in \ - *quote*) quote='"' ;; \ + *quote*) quote='"' ;; \ *) quote="" ;; \ - esac; \ - case "$(BISON_PUSH_PULL_DECL_STYLE)" in \ - *dash*) decl="%define api.push-pull $${quote}both$${quote}"; ;; \ - *underscore*) decl="%define api.push_pull $${quote}both$${quote}"; ;; \ - esac; \ - $(SED) "s/%PUSH_PULL_DECL%/$$decl/" $< > $@-t + esac; \ + case "$(BISON_PUSH_PULL_DECL_STYLE)" in \ + *dash*) push_pull_decl="%define api.push-pull $${quote}both$${quote}"; ;; \ + *underscore*) push_pull_decl="%define api.push_pull $${quote}both$${quote}"; ;; \ + esac; \ + $(SED) -e "s/%PUSH_PULL_DECL%/$$push_pull_decl/" \ + -e "s/%API_PREFIX_DECL%/$$api_prefix_decl/" $< > $@-t mv $@-t $@ noinst_LTLIBRARIES += \ diff -r 12462638ab20 -r c59745865c7f libinterp/parse-tree/oct-parse.in.yy --- a/libinterp/parse-tree/oct-parse.in.yy Wed Jul 30 07:02:41 2014 +0200 +++ b/libinterp/parse-tree/oct-parse.in.yy Fri Aug 01 09:06:21 2014 -0400 @@ -129,10 +129,7 @@ %expect 14 -// Don't add spaces around the = here; it causes some versions of -// bison to fail to properly recognize the directive. - -%name-prefix="octave_" +%API_PREFIX_DECL% // We are using the pure parser interface and the reentrant lexer // interface but the Octave parser and lexer are NOT properly diff -r 12462638ab20 -r c59745865c7f m4/acinclude.m4 --- a/m4/acinclude.m4 Wed Jul 30 07:02:41 2014 +0200 +++ b/m4/acinclude.m4 Fri Aug 01 09:06:21 2014 -0400 @@ -383,6 +383,30 @@ fi ]) dnl +dnl Check whether Qt provides QFont::ForceIntegerMetrics +dnl +AC_DEFUN([OCTAVE_CHECK_QFONT_FORCE_INTEGER_METRICS], [ + AC_CACHE_CHECK([whether Qt provides QFont::ForceIntegerMetrics], + [octave_cv_decl_qfont_force_integer_metrics], + [AC_LANG_PUSH(C++) + ac_octave_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #include + ]], [[ + QFont::StyleStrategy strategy = QFont::ForceIntegerMetrics; + ]])], + octave_cv_decl_qfont_force_integer_metrics=yes, + octave_cv_decl_qfont_force_integer_metrics=no) + CPPFLAGS="$ac_octave_save_CPPFLAGS" + AC_LANG_POP(C++) + ]) + if test $octave_cv_decl_qfont_force_integer_metrics = yes; then + AC_DEFINE(HAVE_QFONT_FORCE_INTEGER_METRICS, 1, + [Define to 1 if Qt provides QFont::ForceIntegerMetrics.]) + fi +]) +dnl dnl Check whether Qscintilla SetPlaceholderText function exists. dnl FIXME: This test uses a version number. It potentially could dnl be re-written to actually call the function, but is it worth it? @@ -1811,6 +1835,49 @@ esac if test $tmp_have_bison = yes; then + AC_CACHE_CHECK([syntax of bison api.prefix (or name-prefix) declaration], + [octave_cv_bison_api_prefix_decl_style], [ + style="api name" + for s in $style; do + if test $s = "api"; then + def='%define api.prefix "foo_"' + else + def='%name-prefix="foo_"' + fi + cat << EOF > conftest.yy +$def +%start input +%% +input:; +%% +EOF + $YACC conftest.yy > /dev/null 2>&1 + ac_status=$? + if test $ac_status -eq 0; then + octave_cv_bison_api_prefix_decl_style="$s" + break + fi + if test $ac_status -eq 0; then + break + fi + done + rm -f conftest.yy y.tab.h y.tab.c + ]) + fi + + AC_SUBST(BISON_API_PREFIX_DECL_STYLE, $octave_cv_bison_api_prefix_decl_style) + + if test -z "$octave_cv_bison_api_prefix_decl_style"; then + YACC= + warn_bison_api_prefix_decl_style=" + +I wasn't able to find a suitable style for declaring the api prefix +in a bison input file so I'm disabling bison. +" + OCTAVE_CONFIGURE_WARNING([warn_bison_api_prefix_decl_style]) + fi + + if test $tmp_have_bison = yes; then AC_CACHE_CHECK([syntax of bison push/pull declaration], [octave_cv_bison_push_pull_decl_style], [ style="dash underscore" diff -r 12462638ab20 -r c59745865c7f scripts/gui/waitforbuttonpress.m --- a/scripts/gui/waitforbuttonpress.m Wed Jul 30 07:02:41 2014 +0200 +++ b/scripts/gui/waitforbuttonpress.m Fri Aug 01 09:06:21 2014 -0400 @@ -18,7 +18,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} waitforbuttonpress () -## @deftypefnx {Function File} {@var{a} =} waitforbuttonpress () +## @deftypefnx {Function File} {@var{b} =} waitforbuttonpress () ## Wait for mouse click or key press over the current figure window. ## ## The return value of @var{b} is 0 if a mouse button was pressed or 1 if a diff -r 12462638ab20 -r c59745865c7f scripts/statistics/base/statistics.m --- a/scripts/statistics/base/statistics.m Wed Jul 30 07:02:41 2014 +0200 +++ b/scripts/statistics/base/statistics.m Fri Aug 01 09:06:21 2014 -0400 @@ -61,7 +61,7 @@ emp_inv = quantile (x, [0.25; 0.5; 0.75], dim, 7); stats = cat (dim, min (x, [], dim), emp_inv, max (x, [], dim), mean (x, dim), - std (x, [], dim), skewness (x, dim), kurtosis (x, dim)); + std (x, [], dim), skewness (x, [], dim), kurtosis (x, [], dim)); endfunction @@ -77,6 +77,16 @@ %! assert (skewness (x), s(8,:), eps); %! assert (kurtosis (x), s(9,:), eps); +%! x = rand (7,5); +%! s = statistics (x, 2); +%! assert (min (x, [], 2), s(:,1), eps); +%! assert (median (x, 2), s(:,3), eps); +%! assert (max (x, [], 2), s(:,5), eps); +%! assert (mean (x, 2), s(:,6), eps); +%! assert (std (x, [], 2), s(:,7), eps); +%! assert (skewness (x, [], 2), s(:,8), eps); +%! assert (kurtosis (x, [], 2), s(:,9), eps); + %% Test input validation %!error statistics () %!error statistics (1, 2, 3)