Mercurial > octave
changeset 29423:e4904768ca48
maint: merge stable to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 09 Mar 2021 22:39:33 -0500 |
parents | 4ee5a22dd4fe (current diff) 8b9e3f0bd06f (diff) |
children | 11a1e69e0035 |
files | libgui/graphics/Table.cc libinterp/parse-tree/pt-eval.cc |
diffstat | 2 files changed, 22 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/graphics/Table.cc Tue Mar 09 22:19:58 2021 -0500 +++ b/libgui/graphics/Table.cc Tue Mar 09 22:39:33 2021 -0500 @@ -80,11 +80,13 @@ char format = 'f', \ int precision = 4) \ { \ + type ten = 10; \ if (format == 'n') \ { \ if (d == floor (d)) \ return QString::number (d, 'g', precision); \ - else if (d <= pow (10, precision - 1) && d > pow (10, 1 - precision)) \ + else if (d <= pow (ten, precision - 1) \ + && d > pow (ten, 1 - precision)) \ return QString::number (d, 'f', precision); \ else \ return QString::number (d, 'e', precision); \ @@ -92,7 +94,7 @@ else if (format == 'F') \ { \ int exponent = floor (log10 (d) / 3) * 3; \ - d *= pow (10, -exponent); \ + d *= pow (ten, -exponent); \ return QString::number (d, 'f', precision) + "e" + \ (exponent < 0 ? "-" : "+") + \ QString ("%1").arg (abs (exponent), 3, 10, QChar ('0')); \ @@ -100,7 +102,7 @@ else if (format == 'E') \ { \ int exponent = floor (log10 (d) / 3) * 3; \ - d *= pow (10, -exponent); \ + d *= pow (ten, -exponent); \ return QString::number (d, \ 'f', \ precision - floor (log10 (d)) - 1) + \
--- a/libinterp/parse-tree/pt-eval.cc Tue Mar 09 22:19:58 2021 -0500 +++ b/libinterp/parse-tree/pt-eval.cc Tue Mar 09 22:39:33 2021 -0500 @@ -1565,6 +1565,12 @@ octave_value ov_fcn = symtab.find_scoped_function (fcn_name, curr_scope); + // If name is operator, we are in Fstr2func, so skip the stack + // frame for that function. + + bool skip_first = name_is_operator; + octave_function *curr_fcn = current_function (skip_first); + if (ov_fcn.is_defined ()) { octave_function *fcn = ov_fcn.function_value (); @@ -1579,6 +1585,17 @@ std::shared_ptr<stack_frame> frame = m_call_stack.get_current_stack_frame (); + // If we are creating a handle to the current + // function, then use the calling stack frame as the + // context. + + std::string curr_fcn_name; + if (curr_fcn) + curr_fcn_name = curr_fcn->name (); + + if (fcn_name == curr_fcn_name) + frame = frame->access_link (); + octave_fcn_handle *fh = new octave_fcn_handle (ov_fcn, fcn_name, frame); @@ -1601,12 +1618,6 @@ } } - // If name is operator, we are in Fstr2func, so skip the stack - // frame for that function. - - bool skip_first = name_is_operator; - octave_function *curr_fcn = current_function (skip_first); - if (curr_fcn && (curr_fcn->is_class_method () || curr_fcn->is_class_constructor ())) {