Mercurial > octave
changeset 32633:4b601ca024d5
maint: merge stable to default
line wrap: on
line diff
--- a/.github/workflows/make.yaml Fri Dec 22 12:08:17 2023 -0500 +++ b/.github/workflows/make.yaml Fri Dec 22 12:14:08 2023 -0500 @@ -595,7 +595,7 @@ matrix: # For available GitHub-hosted runners, see: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners os: [windows-latest] - msystem: [MINGW64, UCRT64] + msystem: [MINGW64, CLANG64] include: - msystem: MINGW64 mingw-prefix: mingw64 @@ -605,14 +605,21 @@ f77: gfortran extra-config-flags: "" ccache-max: 0.9G - - msystem: UCRT64 - mingw-prefix: ucrt64 - target-prefix: mingw-w64-ucrt-x86_64 - cc: gcc - cxx: g++ - f77: gfortran - extra-config-flags: "" - ccache-max: 0.9G + - msystem: CLANG64 + mingw-prefix: clang64 + target-prefix: mingw-w64-clang-x86_64 + cc: clang + # It looks like we and graphicsmagick++ aren't ready for C++17 yet. + cxx: "clang++ -std=gnu++14" + f77: flang + # Clang seems to require a different set of dllexport attributes than GCC. + # autoconf and libtool still need help to correctly invoke flang. + extra-config-flags: + --disable-lib-visibility-flags + --enable-fortran-calling-convention=gfortran + ac_cv_f77_compiler_gnu=yes + lt_cv_prog_gnu_ld=yes + ccache-max: 400M env: CHERE_INVOKING: 1 @@ -808,6 +815,28 @@ echo "history_file (make_absolute_filename ('./a/b/c/history')); disp ('test')" | ./.build/run-octave -i [ -f ./a/b/c/history ] || echo "::warning::Creating history file failed" + - name: install and compress + if: matrix.msystem == 'MINGW64' + continue-on-error: true + run: | + echo "::group::Installing Octave" + mkdir -p /c/octave/pkg + make -C ./.build DESTDIR=/c/octave/pkg install + echo "::endgroup::" + echo "::group::Compressing Octave package" + cd /c/octave/pkg + tar -cvzf octave.tar.gz * + echo "::endgroup::" + + - name: upload build artifact + if: matrix.msystem == 'MINGW64' + continue-on-error: true + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.target-prefix }}-octave-${{ steps.ccache-prepare.outputs.timestamp }} + path: C:\octave\pkg\octave.tar.gz + retention-days: 7 + cygwin: runs-on: ${{ matrix.os }}
--- a/configure.ac Fri Dec 22 12:08:17 2023 -0500 +++ b/configure.ac Fri Dec 22 12:14:08 2023 -0500 @@ -27,7 +27,7 @@ ### Initialize Autoconf AC_PREREQ([2.65]) -AC_INIT([GNU Octave], [9.0.1], [https://octave.org/bugs.html], [octave], +AC_INIT([GNU Octave], [10.0.0], [https://octave.org/bugs.html], [octave], [https://www.gnu.org/software/octave/]) ### Declare version numbers @@ -39,9 +39,9 @@ ## explains how to update these numbers for release and development ## versions. -OCTAVE_MAJOR_VERSION=9 +OCTAVE_MAJOR_VERSION=10 OCTAVE_MINOR_VERSION=0 -OCTAVE_PATCH_VERSION=1 +OCTAVE_PATCH_VERSION=0 dnl PACKAGE_VERSION is set by the AC_INIT VERSION argument. OCTAVE_VERSION="$PACKAGE_VERSION"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/etc/NEWS.10.md Fri Dec 22 12:14:08 2023 -0500 @@ -0,0 +1,68 @@ +Summary of important user-visible changes for version 10 (yyyy-mm-dd): +--------------------------------------------------------------------- + +### General improvements + +### Graphical User Interface + +### Graphics backend + +- `polar` plots now include the center tick mark value, typically 0, in +the 'rtick' parameter when the plot is created. Subsequent modifications +to 'rtick' by the function `rticks` will only include the center tick mark +value if it is specified. + +### Matlab compatibility + +- `height` and `width` are now aliases for the `rows` and `columns` functions. + +### Alphabetical list of new functions added in Octave 10 + +* `rticklabels` +* `tticklabels` + +### Deprecated functions, properties, and operators + +The following functions and properties have been deprecated in Octave 10 +and will be removed from Octave 12 (or whatever version is the second +major release after 10): + +- Functions + + Function | Replacement + -----------------------|------------------ + +- Core + + Function | Replacement + --------------------------------------|------------------ + symbol_record_rep::mark_as_variable | symbol_record_rep::mark_variable + symbol_record_rep::unmark_as_variable | symbol_record_rep::unmark_variable + symbol_record::mark_as_variable | symbol_record::mark_variable + symbol_record::unmark_as_variable | symbol_record::unmark_variable + +The following features were deprecated in Octave 8 and have been removed +from Octave 10. + +- Functions + + Function | Replacement + -----------------------|------------------ + shift | circshift + sparse_auto_mutate | none (see below) + + +Summary of bugs fixed for version 10.1.0 (yyyy-mm-dd): +---------------------------------------------------- + +### Old release news + +- [Octave 9.x](etc/NEWS.9.md) +- [Octave 8.x](etc/NEWS.8.md) +- [Octave 7.x](etc/NEWS.7.md) +- [Octave 6.x](etc/NEWS.6.md) +- [Octave 5.x](etc/NEWS.5.md) +- [Octave 4.x](etc/NEWS.4) +- [Octave 3.x](etc/NEWS.3) +- [Octave 2.x](etc/NEWS.2) +- [Octave 1.x](etc/NEWS.1)
--- a/etc/RELEASE_CHECKLIST.md Fri Dec 22 12:08:17 2023 -0500 +++ b/etc/RELEASE_CHECKLIST.md Fri Dec 22 12:14:08 2023 -0500 @@ -24,6 +24,9 @@ `etc/HACKING.md`). * Bump version numbers in `configure.ac` on default branch (see `etc/HACKING.md`). +* Create new `etc/NEWS.VERSION+1.md` file on default branch by copying + `etc/NEWS.VERSION.md` and then removing text so that it is a template file + with headings only. ### ⚙️ Update gnulib to latest version ### @@ -37,10 +40,13 @@ Completion Date: -* Put out a general call for reports on [Octave Discourse](https://octave.discourse.group/) for all outstanding unreported known bugs. -* Create Savannah tag `VERSION.0.90` on bug tracker for 1st release candidate. +* Put out a general call for reports on [Octave Discourse](https://octave.discourse.group/) for all outstanding, but unreported, known bugs. +* Create Savannah `Release` tag `VERSION.0.90` on bug tracker for 1st release + candidate. * Mark items that should be fixed for the release with this tag. -* Bug overview at <https://octave.space/savannah/>. +* Update Savannah `Planned Release` and `Fixed Release` tags by adding + `VERSION.1.0 (current stable)` and `VERSION+1.1.0 (current default)`. +* Review bug overview at <https://octave.space/savannah/>. ### 📢 Update GUI translation files ### @@ -50,7 +56,7 @@ might change GUI strings. * String freeze date: * Update language translation files (`*.ts`). See instructions in - `libgui/languages/build_ts/README.md`). + `libgui/languages/build_ts/README.md`. * Create bug report on Savannah as a centralized location for uploading files and tracking status of translations. * Call for translations of GUI strings on [Octave Discourse Maintainers](https://octave.discourse.group/c/maintainers/7), CC-ing the translators (see [list of translators](https://hg.savannah.gnu.org/hgweb/octave/file/tip/libgui/languages/translators)). @@ -61,7 +67,16 @@ Completion Date: * Update copyright statements for all source controlled files. -* Update dates in any other locations (launch message, citation, MXE files, + + Command to update copyright notifications + + `hg locate | xargs sed -i 's/Copyright (C) \([0-9][0-9][0-9][0-9]\)-2023 The Octave Project Developers/Copyright (C) \1-2024 The Octave Project Developers/; s/Copyright (C) 2023 The Octave Project Developers/Copyright (C) 2023-2024 The Octave Project Developers/'` + + Command to check results before checking in + + `hg diff | grep ^[-+][^-+] | sed 's/[0-9][0-9][0-9][0-9]-/YYYY-/' | sort -u` + +* Update dates in any other locations (`CITATION`, launch message, MXE files, etc.). * Add any new contributors to `doc/interpreter/contributors.in` who wish to be mentioned (don't add them without permission). @@ -157,10 +172,10 @@ * Update web site files: `NEWS-VERSION.html`, `index.in`, `news.in`, and `download.in`. * Update <https://wiki.octave.org/Release_History> page. -* Update Savannah bug tracker version info to have new release number. +* Update Savannah bug tracker `Release` field to have new release number. * Update Savannah bug tracker: **OPEN** bugs marked as **WON'T FIX** should be marked as **CONFIRMED** (or more appropriate) for the final release. -* Hide release candidate versions in Savannah. +* Hide release candidate versions for `Release` field on Savannah. ### 📢 Announce final release ### @@ -181,9 +196,8 @@ Completion Date: -* Remove all deprecated functions (either tagged with `OCTAVE_DEPRECATED` in - C++ or in the directory `scripts/deprecated` for m-files) scheduled for - deletion on default branch. Check file `etc/NEWS.VERSION-2.md` for list of - features that have been deprecated. -* Create new `etc/NEWS.VERSION+1.md` file by copying `etc/NEWS.VERSION.md` and - then removing text so that it is a template file with headings only. +* Remove all deprecated functions scheduled for deletion on default + branch. These functions are tagged with `OCTAVE_DEPRECATED` in C++ or are + m-files located in the directory `scripts/deprecated`. Check file + `etc/NEWS.VERSION-2.md` for list of features that have been deprecated. +
--- a/etc/module.mk Fri Dec 22 12:08:17 2023 -0500 +++ b/etc/module.mk Fri Dec 22 12:14:08 2023 -0500 @@ -14,6 +14,7 @@ %reldir%/NEWS.7.md \ %reldir%/NEWS.8.md \ %reldir%/NEWS.9.md \ + %reldir%/NEWS.10.md \ %reldir%/gdbinit %canon_reldir%_EXTRA_DIST += \
--- a/libgui/graphics/FigureWindow.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/graphics/FigureWindow.cc Fri Dec 22 12:14:08 2023 -0500 @@ -35,7 +35,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) FigureWindow::FigureWindow (QWidget *xparent) -: FigureWindowBase (xparent) + : FigureWindowBase (xparent) { // set icon from application resources setWindowIcon (QIcon (global_icon_paths.at (ICON_THEME_OCTAVE))); @@ -51,7 +51,8 @@ return nullptr; } -void FigureWindow::showEvent (QShowEvent *ev) +void +FigureWindow::showEvent (QShowEvent *ev) { QMainWindow::showEvent (ev); emit figureWindowShown();
--- a/libgui/graphics/GenericEventNotify.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/graphics/GenericEventNotify.h Fri Dec 22 12:14:08 2023 -0500 @@ -66,9 +66,8 @@ virtual void eventNotifyAfter (QObject *obj, QEvent *evt) = 0; }; -inline -bool GenericEventNotifySender::notifyReceiversBefore (QObject *obj, - QEvent *evt) +inline bool +GenericEventNotifySender::notifyReceiversBefore (QObject *obj, QEvent *evt) { for (auto *r : m_receivers) if (r->eventNotifyBefore (obj, evt)) @@ -77,9 +76,8 @@ return false; } -inline -void GenericEventNotifySender::notifyReceiversAfter (QObject *obj, - QEvent *evt) +inline void +GenericEventNotifySender::notifyReceiversAfter (QObject *obj, QEvent *evt) { for (auto *r : m_receivers) r->eventNotifyAfter (obj, evt);
--- a/libgui/graphics/KeyMap.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/graphics/KeyMap.cc Fri Dec 22 12:14:08 2023 -0500 @@ -250,7 +250,8 @@ return keyMapper; } - std::string qKeyToKeyString (int key) + std::string + qKeyToKeyString (int key) { static const QMap<int, std::string> keyMapper = makeKeyMapper ();
--- a/libgui/graphics/Object.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/graphics/Object.cc Fri Dec 22 12:14:08 2023 -0500 @@ -189,7 +189,8 @@ Object::beingDeleted () { } -void Object::objectDestroyed (QObject *obj) +void +Object::objectDestroyed (QObject *obj) { if (obj && obj == m_qobject) m_qobject = nullptr;
--- a/libgui/graphics/ObjectProxy.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/graphics/ObjectProxy.cc Fri Dec 22 12:14:08 2023 -0500 @@ -40,7 +40,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) ObjectProxy::ObjectProxy (Object *obj) -: QObject (), m_object (nullptr) + : QObject (), m_object (nullptr) { init (obj); }
--- a/libgui/graphics/PopupMenuControl.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/graphics/PopupMenuControl.cc Fri Dec 22 12:14:08 2023 -0500 @@ -71,7 +71,8 @@ PopupMenuControl::~PopupMenuControl () { } -void PopupMenuControl::update (int pId) +void +PopupMenuControl::update (int pId) { uicontrol::properties& up = properties<uicontrol> (); QComboBox *box = qWidget<QComboBox> ();
--- a/libgui/graphics/QtHandlesUtils.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/graphics/QtHandlesUtils.cc Fri Dec 22 12:14:08 2023 -0500 @@ -85,7 +85,8 @@ return v; } - Cell toCellString (const QStringList& l) + Cell + toCellString (const QStringList& l) { QStringList tmp = l; @@ -284,7 +285,7 @@ QImage makeImageFromCData (const octave_value& v, int width, int height) { - dim_vector dv (v.dims ()); + const dim_vector& dv = v.dims (); if (dv.ndims () == 3 && dv(2) == 3) { @@ -384,7 +385,7 @@ #if defined (Q_OS_MAC) modList.push_back ("command"); #else - modList.push_back ("control"); + modList.push_back ("control"); #endif if (mods & Qt::AltModifier) modList.push_back ("alt");
--- a/libgui/graphics/Table.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/graphics/Table.cc Fri Dec 22 12:14:08 2023 -0500 @@ -61,7 +61,8 @@ #define AUTO_HEIGHT (tp.get_fontsize () * 2 - 1) -static QSize realQSizeForTable (QTableWidget *t) +static QSize +realQSizeForTable (QTableWidget *t) { int w = t->verticalHeader ()->width () + 4; for (int i = 0; i < t->columnCount (); i++) @@ -329,8 +330,8 @@ #undef FORMAT_UINT_VALUE #undef FORMAT_INT_VALUE -static QTableWidgetItem * itemFor (octave_value val, std::string format = "", - bool enabled = false) +static QTableWidgetItem * +itemFor (octave_value val, std::string format = "", bool enabled = false) { QTableWidgetItem *retval = new QTableWidgetItem (); std::pair<Qt::AlignmentFlag, QString> flag_and_text =
--- a/libgui/graphics/ToolBarButton.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/graphics/ToolBarButton.cc Fri Dec 22 12:14:08 2023 -0500 @@ -153,7 +153,8 @@ } template <typename T> -QIcon ToolBarButton<T>::get_icon (const std::string& name) +QIcon +ToolBarButton<T>::get_icon (const std::string& name) { return QIcon (global_icon_paths.at (ICON_THEME_OCTAVE) + QString::fromStdString (name) + ".png"); }
--- a/libgui/graphics/annotation-dialog.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/graphics/annotation-dialog.cc Fri Dec 22 12:14:08 2023 -0500 @@ -133,7 +133,7 @@ m_props.append (ovl ("string", m_ui->edit_string->text ().toStdString ())); m_props.append (ovl ("fitboxtotext", - m_ui->cb_fit_box_to_text->isChecked () ? "on" : "off")); + m_ui->cb_fit_box_to_text->isChecked () ? "on" : "off")); // FIXME: only "normalized" units is selectable, change the code below // once more units are added in the UI. @@ -153,11 +153,11 @@ m_props.append (ovl ("fontsize", m_ui->sb_font_size->value ())); m_props.append (ovl ("fontweight", - m_ui->cb_font_bold->isChecked () ? "bold" : "normal")); + m_ui->cb_font_bold->isChecked () ? "bold" : "normal")); m_props.append (ovl ("fontangle", - m_ui->cb_font_italic->isChecked () ? "italic" : "normal")); + m_ui->cb_font_italic->isChecked () ? "italic" : "normal")); m_props.append (ovl ("color", octave::Utils::toRgb (m_ui->btn_color->palette (). - color (QPalette::Button)))); + color (QPalette::Button)))); // FIXME: only "none" linestyle is selectable, change the code bellow // once more linestyles are added in the UI.
--- a/libgui/graphics/qt-graphics-toolkit.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/graphics/qt-graphics-toolkit.cc Fri Dec 22 12:14:08 2023 -0500 @@ -459,47 +459,52 @@ } } -void qt_graphics_toolkit::gh_callback_event (const graphics_handle& h, - const std::string& nm) +void +qt_graphics_toolkit::gh_callback_event (const graphics_handle& h, + const std::string& nm) { gh_manager& gh_mgr = m_interpreter.get_gh_manager (); gh_mgr.post_callback (h, nm); } -void qt_graphics_toolkit::gh_callback_event (const graphics_handle& h, - const std::string& nm, - const octave_value& data) +void +qt_graphics_toolkit::gh_callback_event (const graphics_handle& h, + const std::string& nm, + const octave_value& data) { gh_manager& gh_mgr = m_interpreter.get_gh_manager (); gh_mgr.post_callback (h, nm, data); } -void qt_graphics_toolkit::gh_set_event (const graphics_handle& h, - const std::string& nm, - const octave_value& value) +void +qt_graphics_toolkit::gh_set_event (const graphics_handle& h, + const std::string& nm, + const octave_value& value) { gh_manager& gh_mgr = m_interpreter.get_gh_manager (); gh_mgr.post_set (h, nm, value); } -void qt_graphics_toolkit::gh_set_event (const graphics_handle& h, - const std::string& nm, - const octave_value& value, - bool notify_toolkit) +void +qt_graphics_toolkit::gh_set_event (const graphics_handle& h, + const std::string& nm, + const octave_value& value, + bool notify_toolkit) { gh_manager& gh_mgr = m_interpreter.get_gh_manager (); gh_mgr.post_set (h, nm, value, notify_toolkit); } -void qt_graphics_toolkit::gh_set_event (const graphics_handle& h, - const std::string& nm, - const octave_value& value, - bool notify_toolkit, - bool redraw_figure) +void +qt_graphics_toolkit::gh_set_event (const graphics_handle& h, + const std::string& nm, + const octave_value& value, + bool notify_toolkit, + bool redraw_figure) { gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
--- a/libgui/qterminal/libqterminal/QTerminal.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/qterminal/libqterminal/QTerminal.h Fri Dec 22 12:14:08 2023 -0500 @@ -57,8 +57,8 @@ virtual void has_extra_interrupt (bool extra) = 0; - virtual QList<QAction*> get_hotspot_actions (const QPoint&) - { return QList<QAction*> (); } + virtual QList<QAction *> get_hotspot_actions (const QPoint&) + { return QList<QAction *> (); } enum CursorType {
--- a/libgui/src/color-picker.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/color-picker.cc Fri Dec 22 12:14:08 2023 -0500 @@ -36,7 +36,7 @@ // Constructor with initial color as parameter color_picker::color_picker (QColor old_color, QWidget *p) -: QPushButton (p) + : QPushButton (p) { m_color = old_color; setFlat (true); @@ -46,7 +46,8 @@ } // Slot for button clicked: select a new color using QColorDialog -void color_picker::select_color () +void +color_picker::select_color () { QColor new_color = QColorDialog::getColor (m_color); @@ -58,14 +59,16 @@ } // Set the color of the button -void color_picker::set_color (QColor new_color) +void +color_picker::set_color (QColor new_color) { m_color = new_color; update_button (); } // Draw the button with the actual color (using a stylesheet) -void color_picker::update_button () +void +color_picker::update_button () { // Is this the right place to look for a "foreground" color that would // provide a reasonable border for the color swatches?
--- a/libgui/src/command-widget.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/command-widget.cc Fri Dec 22 12:14:08 2023 -0500 @@ -100,7 +100,8 @@ } -void command_widget::init_command_prompt () +void +command_widget::init_command_prompt () { // The interpreter_event callback function below emits a signal. // Because we don't control when that happens, use a guarded pointer @@ -129,22 +130,26 @@ }); } -void command_widget::update_prompt (const QString& prompt) +void +command_widget::update_prompt (const QString& prompt) { m_prompt = prompt; } -QString command_widget::prompt () +QString +command_widget::prompt () { return m_prompt; } -void command_widget::insert_interpreter_output (const QString& msg) +void +command_widget::insert_interpreter_output (const QString& msg) { m_console->append (msg); } -void command_widget::process_input_line (const QString& input_line) +void +command_widget::process_input_line (const QString& input_line) { // The interpreter_event callback function below emits a signal. // Because we don't control when that happens, use a guarded pointer @@ -180,7 +185,8 @@ } -void command_widget::notice_settings () +void +command_widget::notice_settings () { gui_settings settings; @@ -201,7 +207,7 @@ QColor bgc = settings.color_value (cs_colors[1], mode); m_console->setStyleSheet (QString ("color: %1; background-color:%2;") - .arg (fgc.name ()).arg (bgc.name ())); + .arg (fgc.name ()).arg (bgc.name ())); } // The console itself using QScintilla. @@ -231,7 +237,8 @@ } // Prepare a new command line with the current prompt -void console::new_command_line (const QString& command) +void +console::new_command_line (const QString& command) { if (! text (lines () -1).isEmpty ()) append ("\n"); @@ -239,14 +246,15 @@ append_string (m_command_widget->prompt ()); int line, index; - getCursorPosition (&line,&index); + getCursorPosition (&line, &index); m_command_position = positionFromLineIndex (line, index); append_string (command); } // Accept the current command line (or block) -void console::accept_command_line () +void +console::accept_command_line () { QString input_line = text (lines () - 1); @@ -264,7 +272,8 @@ } // Execute a command -void console::execute_command (const QString& command) +void +console::execute_command (const QString& command) { if (command.trimmed ().isEmpty ()) return; @@ -274,7 +283,8 @@ } // Append a string and update the curdor püosition -void console::append_string (const QString& string) +void +console::append_string (const QString& string) { setReadOnly (false); append (string); @@ -286,7 +296,8 @@ } // Cursor position changed: Are we in the command line or not? -void console::cursor_position_changed (int line, int col) +void +console::cursor_position_changed (int line, int col) { m_cursor_position = positionFromLineIndex (line, col); if (m_cursor_position < m_command_position) @@ -308,7 +319,8 @@ // User attempted to type on read only mode: move cursor at end and allow // editing -void console::move_cursor_to_end () +void +console::move_cursor_to_end () { if ((! m_last_key_string.isEmpty ()) && (m_last_key_string.at (0).isPrint ())) { @@ -319,13 +331,15 @@ // Text has changed: is cursor still in "writable" area? // This signal seems to be emitted before cursor position changed. -void console::text_changed () +void +console::text_changed () { m_text_changed = true; } // Re-implement key event -void console::keyPressEvent (QKeyEvent *e) +void +console::keyPressEvent (QKeyEvent *e) { if (e->key () == Qt::Key_Return) // On "return", accept the current command line
--- a/libgui/src/community-news.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/community-news.cc Fri Dec 22 12:14:08 2023 -0500 @@ -53,8 +53,9 @@ construct (base_url, page, serial); } -void community_news::construct (const QString& base_url, const QString& page, - int serial) +void +community_news::construct (const QString& base_url, const QString& page, + int serial) { m_browser = new QTextBrowser (this); @@ -114,12 +115,14 @@ worker_thread->start (); } -void community_news::set_news (const QString& news) +void +community_news::set_news (const QString& news) { m_browser->setHtml (news); } -void community_news::display () +void +community_news::display () { if (! isVisible ()) show ();
--- a/libgui/src/dialog.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/dialog.cc Fri Dec 22 12:14:08 2023 -0500 @@ -65,19 +65,21 @@ this, &QUIWidgetCreator::handle_create_filedialog); } -QString QUIWidgetCreator::rm_amp (const QString& text) +QString +QUIWidgetCreator::rm_amp (const QString& text) { QString text_wo_amp = text; text_wo_amp.replace (QRegularExpression {"&(\\w)"}, "\\1"); return text_wo_amp; } -QString QUIWidgetCreator::message_dialog (const QString& message, - const QString& title, - const QString& icon, - const QStringList& buttons, - const QString& defbutton, - const QStringList& role) +QString +QUIWidgetCreator::message_dialog (const QString& message, + const QString& title, + const QString& icon, + const QStringList& buttons, + const QString& defbutton, + const QStringList& role) { QMutexLocker autolock (&m_mutex); @@ -130,11 +132,12 @@ // Create a message dialog with specified string, buttons and // decorative text. -QStringList QUIWidgetCreator::input_dialog (const QStringList& prompt, - const QString& title, - const QFloatList& nr, - const QFloatList& nc, - const QStringList& defaults) +QStringList +QUIWidgetCreator::input_dialog (const QStringList& prompt, + const QString& title, + const QFloatList& nr, + const QFloatList& nc, + const QStringList& defaults) { if (prompt.isEmpty ()) return QStringList (); @@ -150,11 +153,12 @@ return m_string_list; }; -QStringList QUIWidgetCreator::file_dialog (const QStringList& filters, - const QString& title, - const QString& filename, - const QString& dirname, - const QString& multimode) +QStringList +QUIWidgetCreator::file_dialog (const QStringList& filters, + const QString& title, + const QString& filename, + const QString& dirname, + const QString& multimode) { QMutexLocker autolock (&m_mutex); @@ -173,12 +177,13 @@ return retval; } -void QUIWidgetCreator::handle_create_dialog (const QString& message, - const QString& title, - const QString& icon, - const QStringList& button, - const QString& defbutton, - const QStringList& role) +void +QUIWidgetCreator::handle_create_dialog (const QString& message, + const QString& title, + const QString& icon, + const QStringList& button, + const QString& defbutton, + const QStringList& role) { MessageDialog *message_dialog = new MessageDialog (message, title, icon, button, defbutton, role); @@ -190,7 +195,8 @@ message_dialog->show (); } -void QUIWidgetCreator::dialog_button_clicked (QAbstractButton *button) +void +QUIWidgetCreator::dialog_button_clicked (QAbstractButton *button) { // button is NULL when dialog is closed. if (button) @@ -222,14 +228,15 @@ // Create a list dialog with specified list, initially selected, mode, // view size and decorative text. -void QUIWidgetCreator::handle_create_listview (const QStringList& list, - const QString& mode, - int wd, int ht, - const QIntList& initial, - const QString& name, - const QStringList& prompt, - const QString& ok_string, - const QString& cancel_string) +void +QUIWidgetCreator::handle_create_listview (const QStringList& list, + const QString& mode, + int wd, int ht, + const QIntList& initial, + const QString& name, + const QStringList& prompt, + const QString& ok_string, + const QString& cancel_string) { ListDialog *list_dialog = new ListDialog (list, mode, wd, ht, initial, @@ -242,8 +249,9 @@ list_dialog->show (); } -void QUIWidgetCreator::list_select_finished (const QIntList& selected, - int button_pressed) +void +QUIWidgetCreator::list_select_finished (const QIntList& selected, + int button_pressed) { // Store the value so that builtin functions can retrieve. @@ -257,11 +265,12 @@ // Create an input dialog with specified prompts and defaults, title // and row/column size specifications. -void QUIWidgetCreator::handle_create_inputlayout (const QStringList& prompt, - const QString& title, - const QFloatList& nr, - const QFloatList& nc, - const QStringList& defaults) +void +QUIWidgetCreator::handle_create_inputlayout (const QStringList& prompt, + const QString& title, + const QFloatList& nr, + const QFloatList& nc, + const QStringList& defaults) { InputDialog *input_dialog = new InputDialog (prompt, title, nr, nc, defaults); @@ -273,8 +282,9 @@ input_dialog->show (); } -void QUIWidgetCreator::input_finished (const QStringList& input, - int button_pressed) +void +QUIWidgetCreator::input_finished (const QStringList& input, + int button_pressed) { // Store the value so that builtin functions can retrieve. @@ -285,11 +295,12 @@ wake_all (); } -void QUIWidgetCreator::handle_create_filedialog (const QStringList& filters, - const QString& title, - const QString& filename, - const QString& dirname, - const QString& multimode) +void +QUIWidgetCreator::handle_create_filedialog (const QStringList& filters, + const QString& title, + const QString& filename, + const QString& dirname, + const QString& multimode) { FileDialog *file_dialog = new FileDialog (filters, title, filename, dirname, multimode); @@ -301,9 +312,10 @@ file_dialog->show (); } -void QUIWidgetCreator::filedialog_finished (const QStringList& files, - const QString& path, - int filterindex) +void +QUIWidgetCreator::filedialog_finished (const QStringList& files, + const QString& path, + int filterindex) { // Store the value so that builtin functions can retrieve. @@ -475,7 +487,8 @@ this, &ListDialog::item_double_clicked); } -void ListDialog::buttonOk_clicked () +void +ListDialog::buttonOk_clicked () { // Store information about what button was pressed so that builtin // functions can retrieve. @@ -491,7 +504,8 @@ done (QDialog::Accepted); } -void ListDialog::buttonCancel_clicked () +void +ListDialog::buttonCancel_clicked () { // Store information about what button was pressed so that builtin // functions can retrieve. @@ -503,12 +517,14 @@ done (QDialog::Rejected); } -void ListDialog::reject () +void +ListDialog::reject () { buttonCancel_clicked (); } -void ListDialog::item_double_clicked (const QModelIndex&) +void +ListDialog::item_double_clicked (const QModelIndex&) { buttonOk_clicked (); } @@ -580,7 +596,8 @@ this, &InputDialog::buttonCancel_clicked); } -void InputDialog::buttonOk_clicked () +void +InputDialog::buttonOk_clicked () { // Store information about what button was pressed so that builtin // functions can retrieve. @@ -592,7 +609,8 @@ done (QDialog::Accepted); } -void InputDialog::buttonCancel_clicked () +void +InputDialog::buttonCancel_clicked () { // Store information about what button was pressed so that builtin // functions can retrieve. @@ -602,7 +620,8 @@ done (QDialog::Rejected); } -void InputDialog::reject () +void +InputDialog::reject () { buttonCancel_clicked (); } @@ -658,13 +677,15 @@ connect (this, &FileDialog::rejected, this, &FileDialog::rejectSelection); } -void FileDialog::rejectSelection () +void +FileDialog::rejectSelection () { QStringList empty; emit finish_input (empty, "", 0); } -void FileDialog::acceptSelection () +void +FileDialog::acceptSelection () { QStringList string_result; QString path;
--- a/libgui/src/documentation-bookmarks.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/documentation-bookmarks.cc Fri Dec 22 12:14:08 2023 -0500 @@ -82,9 +82,9 @@ // Define the icons for the tree view m_icon_folder.addPixmap (style ()->standardPixmap(QStyle::SP_DirClosedIcon), - QIcon::Normal, QIcon::Off); + QIcon::Normal, QIcon::Off); m_icon_folder.addPixmap (style ()->standardPixmap(QStyle::SP_DirOpenIcon), - QIcon::Normal, QIcon::On); + QIcon::Normal, QIcon::On); m_icon_bookmark.addPixmap (style ()->standardPixmap(QStyle::SP_FileIcon)); // Setup and read the bookmarkfile @@ -154,7 +154,8 @@ } // Slot for adding the current page as a bookmark -void documentation_bookmarks::add_bookmark () +void +documentation_bookmarks::add_bookmark () { QUrl url = m_browser->historyUrl (0); @@ -179,17 +180,18 @@ } // Function for actually adding a bookmark to the tree -void documentation_bookmarks::add_bookmark (const QString& title, - const QString& url, - QTreeWidgetItem* item) +void +documentation_bookmarks::add_bookmark (const QString& title, + const QString& url, + QTreeWidgetItem *item) { // Create new bookmark QTreeWidgetItem *new_item = new QTreeWidgetItem (QStringList (title)); new_item->setData (0, tag_role, QVariant (bookmark_tag)); new_item->setData (0, url_role, QVariant (url)); new_item->setFlags ((new_item->flags () & (~Qt::ItemIsDropEnabled)) - | Qt::ItemIsEditable - | Qt::ItemIsDragEnabled); + | Qt::ItemIsEditable + | Qt::ItemIsDragEnabled); new_item->setIcon (0, m_icon_bookmark); // Insert as top level or child item @@ -202,7 +204,8 @@ } // Slot for adding a folder from the context menu -void documentation_bookmarks::add_folder (bool) +void +documentation_bookmarks::add_folder (bool) { QTreeWidgetItem *parent_item = nullptr; @@ -225,14 +228,15 @@ } // Function for actually adding a folder to the tree -QTreeWidgetItem* documentation_bookmarks::add_folder (const QString& folder, - QTreeWidgetItem *item, bool expanded) +QTreeWidgetItem * +documentation_bookmarks::add_folder (const QString& folder, + QTreeWidgetItem *item, bool expanded) { QTreeWidgetItem *new_folder = new QTreeWidgetItem (QStringList (folder)); new_folder->setData (0, tag_role, QVariant (folder_tag)); new_folder->setFlags (new_folder->flags() | Qt::ItemIsEditable - | Qt::ItemIsDragEnabled - | Qt::ItemIsDropEnabled); + | Qt::ItemIsDragEnabled + | Qt::ItemIsDropEnabled); new_folder->setChildIndicatorPolicy (QTreeWidgetItem::DontShowIndicatorWhenChildless); new_folder->setIcon (0, m_icon_folder); new_folder->setExpanded (expanded); @@ -246,7 +250,8 @@ return new_folder; } -void documentation_bookmarks::filter_bookmarks (const QString& pattern) +void +documentation_bookmarks::filter_bookmarks (const QString& pattern) { QTreeWidgetItemIterator it (m_tree); @@ -271,7 +276,8 @@ } } -void documentation_bookmarks::filter_activate (bool state) +void +documentation_bookmarks::filter_activate (bool state) { m_filter->setEnabled (state); @@ -282,7 +288,8 @@ filter_bookmarks (pattern); } -void documentation_bookmarks::update_filter_history () +void +documentation_bookmarks::update_filter_history () { QString text = m_filter->currentText (); // get current text int index = m_filter->findText (text); // and its actual index @@ -294,7 +301,8 @@ m_filter->setCurrentIndex (0); } -void documentation_bookmarks::handle_double_click (QTreeWidgetItem *item, int) +void +documentation_bookmarks::handle_double_click (QTreeWidgetItem *item, int) { int tag = item->data (0, tag_role).toInt (); @@ -313,7 +321,8 @@ } } -void documentation_bookmarks::ctx_menu (const QPoint& xpos) +void +documentation_bookmarks::ctx_menu (const QPoint& xpos) { QMenu menu (this); @@ -345,7 +354,8 @@ menu.exec (m_tree->mapToGlobal (xpos)); } -void documentation_bookmarks::open (bool) +void +documentation_bookmarks::open (bool) { QList<QTreeWidgetItem *> items = m_tree->selectedItems (); @@ -353,7 +363,8 @@ handle_double_click (items.at (0)); } -void documentation_bookmarks::edit (bool) +void +documentation_bookmarks::edit (bool) { QList<QTreeWidgetItem *> items = m_tree->selectedItems (); @@ -361,7 +372,8 @@ m_tree->editItem (items.at (0)); } -void documentation_bookmarks::remove (bool) +void +documentation_bookmarks::remove (bool) { QList<QTreeWidgetItem *> items = m_tree->selectedItems (); @@ -370,13 +382,15 @@ m_tree->takeTopLevelItem (m_tree->indexOfTopLevelItem (it)); } -void documentation_bookmarks::show_filter (bool) +void +documentation_bookmarks::show_filter (bool) { m_filter_shown = ! m_filter_shown; m_filter_widget->setVisible (m_filter_shown); } -void documentation_bookmarks::save_settings () +void +documentation_bookmarks::save_settings () { // Write the bookmarks to the xbel-file write_bookmarks (); @@ -395,7 +409,8 @@ settings.sync (); } -void documentation_bookmarks::write_bookmarks () +void +documentation_bookmarks::write_bookmarks () { if (! m_xbel_file.open (QFile::WriteOnly | QFile::Text)) { @@ -424,8 +439,9 @@ m_xbel_file.close (); } -void documentation_bookmarks::write_tree_item (QXmlStreamWriter* xml_writer, - const QTreeWidgetItem *item) +void +documentation_bookmarks::write_tree_item (QXmlStreamWriter *xml_writer, + const QTreeWidgetItem *item) { switch (item->data (0, tag_role).toInt ()) { @@ -448,7 +464,8 @@ } } -QString documentation_bookmarks::read_bookmarks () +QString +documentation_bookmarks::read_bookmarks () { QString error_message; @@ -497,8 +514,9 @@ return error_message; } -void documentation_bookmarks::read_next_item (QXmlStreamReader *xml_reader, - item_tag tag, QTreeWidgetItem *item) +void +documentation_bookmarks::read_next_item (QXmlStreamReader *xml_reader, + item_tag tag, QTreeWidgetItem *item) { QString title (tr ("Unknown title")); if (tag == folder_tag)
--- a/libgui/src/documentation-dock-widget.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/documentation-dock-widget.cc Fri Dec 22 12:14:08 2023 -0500 @@ -46,33 +46,39 @@ make_window (); } -void documentation_dock_widget::notice_settings () +void +documentation_dock_widget::notice_settings () { m_docs->notice_settings (); } -void documentation_dock_widget::save_settings () +void +documentation_dock_widget::save_settings () { m_docs->save_settings (); octave_dock_widget::save_settings (); } -void documentation_dock_widget::copyClipboard () +void +documentation_dock_widget::copyClipboard () { m_docs->copyClipboard (); } -void documentation_dock_widget::pasteClipboard () +void +documentation_dock_widget::pasteClipboard () { m_docs->pasteClipboard (); } -void documentation_dock_widget::selectAll () +void +documentation_dock_widget::selectAll () { m_docs->selectAll (); } -void documentation_dock_widget::showDoc (const QString& name) +void +documentation_dock_widget::showDoc (const QString& name) { // show the doc pane without focus for carrying on typing in the console if (! isVisible ()) @@ -83,12 +89,14 @@ m_docs->load_ref (name); } -void documentation_dock_widget::registerDoc (const QString& name) +void +documentation_dock_widget::registerDoc (const QString& name) { m_docs->registerDoc (name); } -void documentation_dock_widget::unregisterDoc (const QString& name) +void +documentation_dock_widget::unregisterDoc (const QString& name) { m_docs->unregisterDoc (name); }
--- a/libgui/src/documentation.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/documentation.cc Fri Dec 22 12:14:08 2023 -0500 @@ -357,9 +357,10 @@ } } -QAction * documentation::add_action (const QIcon& icon, const QString& text, - const char *member, QWidget *receiver, - QToolBar *tool_bar) +QAction * +documentation::add_action (const QIcon& icon, const QString& text, + const char *member, QWidget *receiver, + QToolBar *tool_bar) { QAction *a; QWidget *r = this; @@ -380,7 +381,8 @@ return a; } -void documentation::construct_tool_bar () +void +documentation::construct_tool_bar () { // Home, Previous, Next gui_settings settings; @@ -470,7 +472,8 @@ tr ("Bookmark current page"), nullptr, nullptr, m_tool_bar); } -void documentation::global_search () +void +documentation::global_search () { if (! m_help_engine) return; @@ -508,12 +511,14 @@ m_help_engine->searchEngine ()->search (queries); } -void documentation::global_search_started () +void +documentation::global_search_started () { qApp->setOverrideCursor(QCursor(Qt::WaitCursor)); } -void documentation::global_search_finished (int) +void +documentation::global_search_finished (int) { if (! m_help_engine) return; @@ -586,7 +591,8 @@ qApp->restoreOverrideCursor(); } -void documentation::handle_search_result_clicked (const QUrl& url) +void +documentation::handle_search_result_clicked (const QUrl& url) { // Open url with matching text m_doc_browser->handle_index_clicked (url); @@ -612,7 +618,8 @@ } } -void documentation::select_all_occurrences (const QString& text) +void +documentation::select_all_occurrences (const QString& text) { // Get highlight background and text color QPalette pal = QApplication::palette (); @@ -640,7 +647,8 @@ m_doc_browser->moveCursor (QTextCursor::Start); } -void documentation::notice_settings () +void +documentation::notice_settings () { gui_settings settings; @@ -673,7 +681,8 @@ m_doc_browser->notice_settings (); } -void documentation::save_settings () +void +documentation::save_settings () { gui_settings settings; @@ -681,7 +690,8 @@ m_bookmarks->save_settings (); } -void documentation::copyClipboard () +void +documentation::copyClipboard () { if (m_doc_browser->hasFocus ()) { @@ -689,11 +699,14 @@ } } -void documentation::pasteClipboard () { } +void +documentation::pasteClipboard () { } -void documentation::selectAll () { } +void +documentation::selectAll () { } -void documentation::load_index () +void +documentation::load_index () { m_indexed = true; @@ -707,7 +720,8 @@ m_help_engine->contentWidget ()->expandToDepth (0); } -void documentation::load_ref (const QString& ref_name) +void +documentation::load_ref (const QString& ref_name) { if (! m_help_engine || ref_name.isEmpty ()) return; @@ -773,7 +787,8 @@ } } -void documentation::activate_find () +void +documentation::activate_find () { if (m_find_line_edit->parentWidget ()->isVisible ()) { @@ -788,7 +803,8 @@ } } -void documentation::filter_update (const QString& expression) +void +documentation::filter_update (const QString& expression) { if (! m_help_engine) return; @@ -800,7 +816,8 @@ m_help_engine->indexWidget ()->filterIndices(expression, wildcard); } -void documentation::filter_update_history () +void +documentation::filter_update_history () { QString text = m_filter->currentText (); // get current text int index = m_filter->findText (text); // and its actual index @@ -812,12 +829,14 @@ m_filter->setCurrentIndex (0); } -void documentation::find_backward () +void +documentation::find_backward () { find (true); } -void documentation::find (bool backward) +void +documentation::find (bool backward) { if (! m_help_engine) return; @@ -841,7 +860,8 @@ record_anchor_position (); } -void documentation::find_forward_from_anchor (const QString& text) +void +documentation::find_forward_from_anchor (const QString& text) { if (! m_help_engine) return; @@ -860,7 +880,8 @@ } } -void documentation::record_anchor_position () +void +documentation::record_anchor_position () { if (! m_help_engine) return; @@ -868,7 +889,8 @@ m_search_anchor_position = m_doc_browser->textCursor ().position (); } -void documentation::handle_cursor_position_change () +void +documentation::handle_cursor_position_change () { if (! m_help_engine) return; @@ -877,7 +899,8 @@ record_anchor_position (); } -void documentation::registerDoc (const QString& qch) +void +documentation::registerDoc (const QString& qch) { if (m_help_engine) { @@ -906,7 +929,8 @@ } } -void documentation::unregisterDoc (const QString& qch) +void +documentation::unregisterDoc (const QString& qch) { if (! m_help_engine) return; @@ -921,7 +945,8 @@ } } -void documentation::update_history_menus () +void +documentation::update_history_menus () { if (m_prev_pages_count != m_doc_browser->backwardHistoryCount ()) { @@ -938,7 +963,8 @@ } } -void documentation::update_history (int new_count, QAction **actions) +void +documentation::update_history (int new_count, QAction **actions) { // Which menu has to be updated? int prev_next = -1; @@ -976,14 +1002,16 @@ } } -void documentation::open_hist_url (QAction *a) +void +documentation::open_hist_url (QAction *a) { m_doc_browser->setSource (a->data ().toUrl ()); } // Utility functions -QString documentation::title_and_anchor (const QString& title, const QUrl& url) +QString +documentation::title_and_anchor (const QString& title, const QUrl& url) { QString retval = title; QString u = url.toString (); @@ -1037,7 +1065,8 @@ // Make sure we have access to one of the monospace fonts listed in // octave.css for rendering formated code blocks QStringList fonts = {"Fantasque Sans Mono", "FreeMono", "Courier New", - "Cousine", "Courier"}; + "Cousine", "Courier" + }; bool load_default_font = true; @@ -1058,7 +1087,8 @@ + sys::file_ops::dir_sep_str ()); QStringList default_fonts = {"FreeMono", "FreeMonoBold", - "FreeMonoBoldOblique", "FreeMonoOblique"}; + "FreeMonoBoldOblique", "FreeMonoOblique" + }; for (int i = 0; i < default_fonts.size (); ++i) { @@ -1069,8 +1099,8 @@ } } -void documentation_browser::handle_index_clicked (const QUrl& url, - const QString&) +void +documentation_browser::handle_index_clicked (const QUrl& url, const QString&) { if (url.scheme () == "qthelp") setSource (url); @@ -1078,7 +1108,8 @@ QDesktopServices::openUrl (url); } -void documentation_browser::notice_settings () +void +documentation_browser::notice_settings () { gui_settings settings; @@ -1090,7 +1121,8 @@ } } -QVariant documentation_browser::loadResource (int type, const QUrl& url) +QVariant +documentation_browser::loadResource (int type, const QUrl& url) { if (m_help_engine && url.scheme () == "qthelp") return QVariant (m_help_engine->fileData(url)); @@ -1098,7 +1130,8 @@ return QTextBrowser::loadResource(type, url); } -void documentation_browser::save_settings () +void +documentation_browser::save_settings () { gui_settings settings; @@ -1107,7 +1140,8 @@ settings.sync (); } -void documentation_browser::zoom_in () +void +documentation_browser::zoom_in () { if (m_zoom_level < max_zoom_level) { @@ -1116,7 +1150,8 @@ } } -void documentation_browser::zoom_out () +void +documentation_browser::zoom_out () { if (m_zoom_level > min_zoom_level) { @@ -1125,13 +1160,15 @@ } } -void documentation_browser::zoom_original () +void +documentation_browser::zoom_original () { zoomIn (- m_zoom_level); m_zoom_level = 0; } -void documentation_browser::wheelEvent (QWheelEvent *we) +void +documentation_browser::wheelEvent (QWheelEvent *we) { if (we->modifiers () == Qt::ControlModifier) {
--- a/libgui/src/dw-main-window.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/dw-main-window.cc Fri Dec 22 12:14:08 2023 -0500 @@ -79,7 +79,8 @@ } // Re-implementing the popup menu of the main window -QMenu *dw_main_window::createPopupMenu () +QMenu * +dw_main_window::createPopupMenu () { QList<QAction *> new_actions = QList<QAction *> (); new_actions.append (m_close_action); @@ -101,9 +102,10 @@ } // Adding an action to the main window -QAction * dw_main_window::add_action (QMenu *menu, const QIcon& icon, - const QString& text, const char *member, - QWidget *receiver) +QAction * +dw_main_window::add_action (QMenu *menu, const QIcon& icon, + const QString& text, const char *member, + QWidget *receiver) { QAction *a; QWidget *r = this; @@ -127,7 +129,8 @@ } // Update the settings -void dw_main_window::notice_settings () +void +dw_main_window::notice_settings () { gui_settings settings; @@ -142,7 +145,8 @@ // Slots for handling actions // Close current widget -void dw_main_window::request_close () +void +dw_main_window::request_close () { for (int i = 0; i < m_dw_list.length (); i++) { @@ -157,7 +161,8 @@ } // Close other widgets -void dw_main_window::request_close_other () +void +dw_main_window::request_close_other () { for (int i = m_dw_list.length () - 1; i >= 0; i--) { @@ -167,26 +172,30 @@ } // Close all widgets -void dw_main_window::request_close_all () +void +dw_main_window::request_close_all () { for (int i = m_dw_list.length () - 1; i >= 0; i--) m_dw_list.at (i)->close (); } // Switch to left widget -void dw_main_window::request_switch_left () +void +dw_main_window::request_switch_left () { request_switch (-1); } // Switch to right widget -void dw_main_window::request_switch_right () +void +dw_main_window::request_switch_right () { request_switch (1); } // Switch to left/right widget -void dw_main_window::request_switch (int direction) +void +dw_main_window::request_switch (int direction) { int active = -1, next; @@ -215,7 +224,8 @@ } // Reimplemented Event -bool dw_main_window::event (QEvent *ev) +bool +dw_main_window::event (QEvent *ev) { if (ev->type () == QEvent::ChildAdded || ev->type () == QEvent::ChildRemoved)
--- a/libgui/src/external-editor-interface.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/external-editor-interface.cc Fri Dec 22 12:14:08 2023 -0500 @@ -80,26 +80,30 @@ // Slots for the several signals for invoking the editor -void external_editor_interface::request_new_file (const QString&) +void +external_editor_interface::request_new_file (const QString&) { call_custom_editor (); } -void external_editor_interface::request_open_file (const QString& file_name, - const QString&, int line, - bool, bool, bool, - const QString&) +void +external_editor_interface::request_open_file (const QString& file_name, + const QString&, int line, + bool, bool, bool, + const QString&) { call_custom_editor (file_name, line); } -void external_editor_interface::handle_edit_file_request (const QString& file) +void +external_editor_interface::handle_edit_file_request (const QString& file) { call_custom_editor (file); } // Get and verify the settings of the external editor program -QString external_editor_interface::external_editor () +QString +external_editor_interface::external_editor () { gui_settings settings;
--- a/libgui/src/files-dock-widget.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/files-dock-widget.cc Fri Dec 22 12:14:08 2023 -0500 @@ -104,7 +104,7 @@ auto parent_dir = QDir(filePath (parent (idx))); - files_dock_widget *fdw = static_cast<files_dock_widget*>(parent()); + files_dock_widget *fdw = static_cast<files_dock_widget *>(parent()); fdw->file_remove_signal(parent_dir.filePath(old_name), parent_dir.filePath(new_name)); @@ -144,7 +144,7 @@ { public: RenameItemDelegate (QObject *parent = nullptr) - : QStyledItemDelegate{ parent } + : QStyledItemDelegate{ parent } { } @@ -415,7 +415,8 @@ make_window (); } -void files_dock_widget::save_settings () +void +files_dock_widget::save_settings () { gui_settings settings; @@ -441,24 +442,28 @@ delete m_sig_mapper; } -void files_dock_widget::item_double_clicked (const QModelIndex& index) +void +files_dock_widget::item_double_clicked (const QModelIndex& index) { // Retrieve the file info associated with the model index. QFileInfo fileInfo = m_file_system_model->fileInfo (index); set_current_directory (fileInfo.absoluteFilePath ()); } -void files_dock_widget::set_current_directory (const QString& dir) +void +files_dock_widget::set_current_directory (const QString& dir) { display_directory (dir); } -void files_dock_widget::accept_directory_line_edit () +void +files_dock_widget::accept_directory_line_edit () { display_directory (m_current_directory->currentText ()); } -void files_dock_widget::change_directory_up () +void +files_dock_widget::change_directory_up () { QDir dir = QDir (m_file_system_model->filePath (m_file_tree_view->rootIndex ())); @@ -467,7 +472,8 @@ display_directory (dir.absolutePath ()); } -void files_dock_widget::do_sync_octave_directory () +void +files_dock_widget::do_sync_octave_directory () { QDir dir = QDir (m_file_system_model->filePath (m_file_tree_view->rootIndex ())); @@ -475,20 +481,23 @@ emit displayed_directory_changed (dir.absolutePath ()); } -void files_dock_widget::do_sync_browser_directory () +void +files_dock_widget::do_sync_browser_directory () { display_directory (m_octave_dir, false); // false: no sync of octave dir } -void files_dock_widget::update_octave_directory (const QString& dir) +void +files_dock_widget::update_octave_directory (const QString& dir) { m_octave_dir = dir; if (m_sync_octave_dir) display_directory (m_octave_dir, false); // false: no sync of octave dir } -void files_dock_widget::display_directory (const QString& dir, - bool set_octave_dir) +void +files_dock_widget::display_directory (const QString& dir, + bool set_octave_dir) { QFileInfo fileInfo (dir); if (fileInfo.exists ()) @@ -537,7 +546,8 @@ } } -void files_dock_widget::open_item_in_app (const QModelIndex& index) +void +files_dock_widget::open_item_in_app (const QModelIndex& index) { // Retrieve the file info associated with the model index. QFileInfo fileInfo = m_file_system_model->fileInfo (index); @@ -547,7 +557,8 @@ QDesktopServices::openUrl (QUrl::fromLocalFile (file)); } -void files_dock_widget::toggle_header (int col) +void +files_dock_widget::toggle_header (int col) { gui_settings settings; @@ -572,7 +583,8 @@ } } -void files_dock_widget::headercontextmenu_requested (const QPoint& mpos) +void +files_dock_widget::headercontextmenu_requested (const QPoint& mpos) { QMenu menu (this); @@ -604,7 +616,8 @@ menu.exec (m_file_tree_view->mapToGlobal (mpos)); } -void files_dock_widget::contextmenu_requested (const QPoint& mpos) +void +files_dock_widget::contextmenu_requested (const QPoint& mpos) { QMenu menu (this); @@ -701,7 +714,8 @@ } } -void files_dock_widget::contextmenu_open (bool) +void +files_dock_widget::contextmenu_open (bool) { QItemSelectionModel *m = m_file_tree_view->selectionModel (); @@ -715,7 +729,8 @@ } } -void files_dock_widget::contextmenu_open_in_editor (bool) +void +files_dock_widget::contextmenu_open_in_editor (bool) { QItemSelectionModel *m = m_file_tree_view->selectionModel (); @@ -729,7 +744,8 @@ } } -void files_dock_widget::contextmenu_open_in_app (bool) +void +files_dock_widget::contextmenu_open_in_app (bool) { QItemSelectionModel *m = m_file_tree_view->selectionModel (); QModelIndexList rows = m->selectedRows (); @@ -738,7 +754,8 @@ open_item_in_app (it); } -void files_dock_widget::contextmenu_copy_selection (bool) +void +files_dock_widget::contextmenu_copy_selection (bool) { QItemSelectionModel *m = m_file_tree_view->selectionModel (); QModelIndexList rows = m->selectedRows (); @@ -756,7 +773,8 @@ clipboard->setText (selection.join ("\n")); } -void files_dock_widget::contextmenu_load (bool) +void +files_dock_widget::contextmenu_load (bool) { QItemSelectionModel *m = m_file_tree_view->selectionModel (); QModelIndexList rows = m->selectedRows (); @@ -771,7 +789,8 @@ } } -void files_dock_widget::contextmenu_run (bool) +void +files_dock_widget::contextmenu_run (bool) { QItemSelectionModel *m = m_file_tree_view->selectionModel (); QModelIndexList rows = m->selectedRows (); @@ -785,7 +804,8 @@ } } -void files_dock_widget::contextmenu_rename (bool) +void +files_dock_widget::contextmenu_rename (bool) { QItemSelectionModel *m = m_file_tree_view->selectionModel (); QModelIndexList rows = m->selectedRows (); @@ -796,7 +816,8 @@ } } -void files_dock_widget::contextmenu_delete (bool) +void +files_dock_widget::contextmenu_delete (bool) { QItemSelectionModel *m = m_file_tree_view->selectionModel (); QModelIndexList rows = m->selectedRows (); @@ -826,10 +847,10 @@ else { dlg_answer = QMessageBox::question (this, - tr ("Delete file/directory"), - tr ("Are you sure you want to delete\n") - + info.filePath (), - QMessageBox::Yes | QMessageBox::No); + tr ("Delete file/directory"), + tr ("Are you sure you want to delete\n") + + info.filePath (), + QMessageBox::Yes | QMessageBox::No); } if (dlg_answer == QMessageBox::Yes) @@ -872,7 +893,8 @@ // Get the currently selected files/dirs and return their file info // in a list. -QList<QFileInfo> files_dock_widget::get_selected_items_info (bool dir) +QList<QFileInfo> +files_dock_widget::get_selected_items_info (bool dir) { QItemSelectionModel *m = m_file_tree_view->selectionModel (); QModelIndexList rows = m->selectedRows (); @@ -891,7 +913,8 @@ return infos; } -void files_dock_widget::contextmenu_newfile (bool) +void +files_dock_widget::contextmenu_newfile (bool) { QItemSelectionModel *m = m_file_tree_view->selectionModel (); QModelIndexList rows = m->selectedRows (); @@ -907,7 +930,8 @@ } } -void files_dock_widget::contextmenu_newdir (bool) +void +files_dock_widget::contextmenu_newdir (bool) { QItemSelectionModel *m = m_file_tree_view->selectionModel (); QModelIndexList rows = m->selectedRows (); @@ -923,7 +947,8 @@ } } -void files_dock_widget::contextmenu_setcurrentdir (bool) +void +files_dock_widget::contextmenu_setcurrentdir (bool) { QList<QFileInfo> infos = get_selected_items_info (true); @@ -931,7 +956,8 @@ process_set_current_dir (infos.first ().absoluteFilePath ()); } -void files_dock_widget::contextmenu_add_to_path (bool, bool rm, bool subdirs) +void +files_dock_widget::contextmenu_add_to_path (bool, bool rm, bool subdirs) { QList<QFileInfo> infos = get_selected_items_info (true); @@ -944,22 +970,26 @@ emit modify_path_signal (dir_list, rm, subdirs); } -void files_dock_widget::contextmenu_add_to_path_subdirs (bool) +void +files_dock_widget::contextmenu_add_to_path_subdirs (bool) { contextmenu_add_to_path (true, false, true); } -void files_dock_widget::contextmenu_rm_from_path (bool) +void +files_dock_widget::contextmenu_rm_from_path (bool) { contextmenu_add_to_path (true, true, false); } -void files_dock_widget::contextmenu_rm_from_path_subdirs (bool) +void +files_dock_widget::contextmenu_rm_from_path_subdirs (bool) { contextmenu_add_to_path (true, true, true); } -void files_dock_widget::contextmenu_findfiles (bool) +void +files_dock_widget::contextmenu_findfiles (bool) { QItemSelectionModel *m = m_file_tree_view->selectionModel (); QModelIndexList rows = m->selectedRows (); @@ -977,7 +1007,8 @@ } } -void files_dock_widget::notice_settings () +void +files_dock_widget::notice_settings () { gui_settings settings; @@ -993,7 +1024,7 @@ // filenames are always shown, other columns can be hidden by settings for (int i = 0; i < 3; i++) m_file_tree_view->setColumnHidden (i + 1, - ! settings.value (m_columns_shown_keys.at (i),false).toBool ()); + ! settings.value (m_columns_shown_keys.at (i), false).toBool ()); QDir::Filters current_filter = m_file_system_model->filter (); if (settings.value (m_columns_shown_keys.at (3), false).toBool ()) @@ -1002,7 +1033,7 @@ m_file_system_model->setFilter (current_filter & (~QDir::Hidden)); m_file_tree_view->setAlternatingRowColors - (settings.value (m_columns_shown_keys.at (4),true).toBool ()); + (settings.value (m_columns_shown_keys.at (4), true).toBool ()); m_file_tree_view->setModel (m_file_system_model); // enable the buttons to sync octave/browser dir @@ -1022,7 +1053,8 @@ do_sync_browser_directory (); } -void files_dock_widget::popdownmenu_home (bool) +void +files_dock_widget::popdownmenu_home (bool) { QString dir = QString::fromStdString (sys::env::get_home_directory ()); @@ -1032,7 +1064,8 @@ set_current_directory (dir); } -void files_dock_widget::popdownmenu_search_dir (bool) +void +files_dock_widget::popdownmenu_search_dir (bool) { // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved. int opts = QFileDialog::ShowDirsOnly; @@ -1043,28 +1076,32 @@ opts |= QFileDialog::DontUseNativeDialog; QString dir = QFileDialog::getExistingDirectory (this, - tr ("Set directory of file browser"), - m_file_system_model->rootPath (), - QFileDialog::Option (opts)); + tr ("Set directory of file browser"), + m_file_system_model->rootPath (), + QFileDialog::Option (opts)); set_current_directory (dir); } -void files_dock_widget::popdownmenu_findfiles (bool) +void +files_dock_widget::popdownmenu_findfiles (bool) { process_find_files (m_file_system_model->rootPath ()); } -void files_dock_widget::popdownmenu_newdir (bool) +void +files_dock_widget::popdownmenu_newdir (bool) { process_new_dir (m_file_system_model->rootPath ()); } -void files_dock_widget::popdownmenu_newfile (bool) +void +files_dock_widget::popdownmenu_newfile (bool) { process_new_file (m_file_system_model->rootPath ()); } -void files_dock_widget::process_new_file (const QString& parent_dir) +void +files_dock_widget::process_new_file (const QString& parent_dir) { bool ok; @@ -1082,7 +1119,8 @@ } } -void files_dock_widget::process_new_dir (const QString& parent_dir) +void +files_dock_widget::process_new_dir (const QString& parent_dir) { bool ok; @@ -1098,17 +1136,20 @@ } } -void files_dock_widget::process_set_current_dir (const QString& dir) +void +files_dock_widget::process_set_current_dir (const QString& dir) { emit displayed_directory_changed (dir); } -void files_dock_widget::process_find_files (const QString& dir) +void +files_dock_widget::process_find_files (const QString& dir) { emit find_files_signal (dir); } -void files_dock_widget::copyClipboard () +void +files_dock_widget::copyClipboard () { if (m_file_tree_view->hasFocus ()) contextmenu_copy_selection (true); @@ -1124,7 +1165,8 @@ } } -void files_dock_widget::pasteClipboard () +void +files_dock_widget::pasteClipboard () { if (m_current_directory->hasFocus ()) { @@ -1136,7 +1178,8 @@ } } -void files_dock_widget::selectAll () +void +files_dock_widget::selectAll () { if (m_file_tree_view->hasFocus ()) m_file_tree_view->selectAll ();
--- a/libgui/src/find-files-dialog.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/find-files-dialog.cc Fri Dec 22 12:14:08 2023 -0500 @@ -129,8 +129,8 @@ m_file_list->sortByColumn (settings.int_value (ff_sort_files_by_column), static_cast<Qt::SortOrder> (settings.uint_value (ff_sort_files_by_order))); - // FIXME: use value<Qt::SortOrder> instead of static cast after - // dropping support of Qt 5.4 + // FIXME: use value<Qt::SortOrder> instead of static cast after + // dropping support of Qt 5.4 connect (m_file_list, &QTableView::doubleClicked, this, &find_files_dialog::item_double_clicked); @@ -205,7 +205,8 @@ delete m_dir_iterator; } -void find_files_dialog::save_settings () +void +find_files_dialog::save_settings () { gui_settings settings; @@ -231,13 +232,15 @@ settings.sync (); } -void find_files_dialog::set_search_dir (const QString& dir) +void +find_files_dialog::set_search_dir (const QString& dir) { stop_find (); m_start_dir_edit->setText (dir); } -void find_files_dialog::start_find () +void +find_files_dialog::start_find () { stop_find (); @@ -279,7 +282,8 @@ m_timer->start (0); } -void find_files_dialog::stop_find () +void +find_files_dialog::stop_find () { m_timer->stop (); @@ -302,7 +306,8 @@ m_status_bar->showMessage (res_str); } -void find_files_dialog::browse_folders () +void +find_files_dialog::browse_folders () { int opts = 0; // No options by default. @@ -322,7 +327,8 @@ m_start_dir_edit->setText (dir); } -void find_files_dialog::item_double_clicked (const QModelIndex& idx) +void +find_files_dialog::item_double_clicked (const QModelIndex& idx) { find_files_model *m = static_cast<find_files_model *> (m_file_list->model ()); @@ -343,7 +349,8 @@ } } -void find_files_dialog::look_for_files () +void +find_files_dialog::look_for_files () { if (m_dir_iterator && m_dir_iterator->hasNext ()) { @@ -361,13 +368,15 @@ } } -void find_files_dialog::handle_done (int) +void +find_files_dialog::handle_done (int) { // make sure we stopped processing stop_find (); } -bool find_files_dialog::is_match (const QFileInfo& info) +bool +find_files_dialog::is_match (const QFileInfo& info) { bool match = true; if (info.isDir ())
--- a/libgui/src/find-files-model.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/find-files-model.cc Fri Dec 22 12:14:08 2023 -0500 @@ -42,7 +42,8 @@ find_file_less_than (int ord) { m_sortorder = ord; } - QVariant getValue (const QFileInfo& f) const + QVariant + getValue (const QFileInfo& f) const { QVariant val; @@ -65,13 +66,15 @@ return val; } - bool lessThan (const QVariant& left, const QVariant& right) const + bool + lessThan (const QVariant& left, const QVariant& right) const { return left.toString ().compare (right.toString (), Qt::CaseInsensitive) < 0; } - bool operator () (const QFileInfo& left, const QFileInfo& right) const + bool + operator () (const QFileInfo& left, const QFileInfo& right) const { QVariant leftval = getValue (left); QVariant rightval = getValue (right); @@ -95,7 +98,8 @@ m_sortorder = 0; } -void find_files_model::clear () +void +find_files_model::clear () { beginResetModel (); @@ -104,7 +108,8 @@ endResetModel (); } -void find_files_model::addFile (const QFileInfo& info) +void +find_files_model::addFile (const QFileInfo& info) { beginInsertRows (QModelIndex (), m_files.size (), m_files.size ()); @@ -125,17 +130,20 @@ endInsertRows (); } -int find_files_model::rowCount (const QModelIndex&) const +int +find_files_model::rowCount (const QModelIndex&) const { return m_files.size (); } -int find_files_model::columnCount (const QModelIndex&) const +int +find_files_model::columnCount (const QModelIndex&) const { return m_columnNames.size (); } -QVariant find_files_model::data (const QModelIndex& idx, int role) const +QVariant +find_files_model::data (const QModelIndex& idx, int role) const { QVariant retval; @@ -173,15 +181,17 @@ return retval; } -QVariant find_files_model::headerData (int section, - Qt::Orientation orientation, - int role) const +QVariant +find_files_model::headerData (int section, + Qt::Orientation orientation, + int role) const { return ((orientation == Qt::Horizontal && role == Qt::DisplayRole) ? m_columnNames[section] : QVariant ()); } -void find_files_model::sort (int column, Qt::SortOrder order) +void +find_files_model::sort (int column, Qt::SortOrder order) { if (column >= 0) { @@ -204,12 +214,14 @@ } } -QFileInfo find_files_model::fileInfo (const QModelIndex& p) const +QFileInfo +find_files_model::fileInfo (const QModelIndex& p) const { return p.isValid () ? m_files[p.row ()] : QFileInfo (); } -QIcon find_files_model::fileIcon (const QModelIndex& p) const +QIcon +find_files_model::fileIcon (const QModelIndex& p) const { QFileIconProvider icon_provider;
--- a/libgui/src/gui-preferences-cs.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/gui-preferences-cs.h Fri Dec 22 12:14:08 2023 -0500 @@ -56,7 +56,8 @@ extern gui_pref cs_colors[]; const QStringList -cs_color_names = { +cs_color_names = +{ QT_TRANSLATE_NOOP ("octave::settings_dialog", "Foreground"), QT_TRANSLATE_NOOP ("octave::settings_dialog", "Background"), QT_TRANSLATE_NOOP ("octave::settings_dialog", "Selection"),
--- a/libgui/src/gui-preferences-ed.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/gui-preferences-ed.h Fri Dec 22 12:14:08 2023 -0500 @@ -133,7 +133,8 @@ ed_last_comment_str ("editor/oct_last_comment_str"); const QStringList -ed_comment_strings = { +ed_comment_strings = +{ "##", "#", "%", @@ -159,7 +160,8 @@ // Tabs const QStringList -ed_tab_position_names = { +ed_tab_position_names = +{ QT_TRANSLATE_NOOP ("octave::settings_dialog", "Top"), QT_TRANSLATE_NOOP ("octave::settings_dialog", "Bottom"), QT_TRANSLATE_NOOP ("octave::settings_dialog", "Left"),
--- a/libgui/src/gui-preferences-global.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/gui-preferences-global.h Fri Dec 22 12:14:08 2023 -0500 @@ -93,7 +93,8 @@ } ; const QStringList -global_icon_paths = { +global_icon_paths = +{ "", ":/icons/octave/128x128/", ":/icons/tango/128x128/", @@ -103,7 +104,8 @@ extern gui_pref global_icon_theme_index; const QStringList -global_all_icon_themes = { +global_all_icon_themes = +{ "", "octave", "tango", @@ -111,7 +113,8 @@ }; const QStringList -global_all_icon_theme_names = { +global_all_icon_theme_names = +{ "System", "Octave", "Tango" @@ -126,7 +129,8 @@ EXTRA_STYLE_FUSION_DARK = 0 } ; const QStringList -global_extra_styles = { +global_extra_styles = +{ "Fusion-Dark" }; @@ -173,7 +177,8 @@ extern gui_pref global_proxy_pass; const QStringList -global_proxy_all_types = { +global_proxy_all_types = +{ "HttpProxy", "Socks5Proxy", QT_TRANSLATE_NOOP ("octave::settings_dialog", "Environment Variables")
--- a/libgui/src/gui-preferences-sc.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/gui-preferences-sc.cc Fri Dec 22 12:14:08 2023 -0500 @@ -217,7 +217,8 @@ sc_pref sc_doc_go_next (QCoreApplication::translate ("shortcuts", "Go Forward one Page"), sc_doc + ":go_next", QKeySequence::Forward); sc_pref sc_doc_bookmark (QCoreApplication::translate ("shortcuts", "Bookmark this Page"), sc_doc + ":bookmark", OCTAVE_QT_KEYCOMBINATION (CTRL, Qt::Key_D)); -QString get_shortcut_section (const QString& key) +QString +get_shortcut_section (const QString& key) { QString section;
--- a/libgui/src/gui-preferences-ve.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/gui-preferences-ve.h Fri Dec 22 12:14:08 2023 -0500 @@ -51,7 +51,8 @@ extern gui_pref ve_colors[]; -const QStringList ve_color_names = { +const QStringList ve_color_names = +{ QT_TRANSLATE_NOOP ("octave::settings_dialog", "Foreground"), QT_TRANSLATE_NOOP ("octave::settings_dialog", "Background"), QT_TRANSLATE_NOOP ("octave::settings_dialog", "Selected Foreground"), @@ -59,7 +60,8 @@ QT_TRANSLATE_NOOP ("octave::settings_dialog", "Alternating Background") }; -const QStringList ve_save_formats = { +const QStringList ve_save_formats = +{ "ascii", "binary", "float-binary", @@ -74,7 +76,8 @@ // The following list is a relation between save format and fiel extension. // The format string are case insensitive. -const QStringList ve_save_formats_ext = { +const QStringList ve_save_formats_ext = +{ "-ascii", "dat", "-hdf5", "h5", "-text", "txt",
--- a/libgui/src/gui-preferences-ws.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/gui-preferences-ws.h Fri Dec 22 12:14:08 2023 -0500 @@ -46,14 +46,16 @@ extern gui_pref ws_mru_list; -const QStringList ws_columns_shown = { +const QStringList ws_columns_shown = +{ QT_TRANSLATE_NOOP ("octave::workspace_view", "Class"), QT_TRANSLATE_NOOP ("octave::workspace_view", "Dimension"), QT_TRANSLATE_NOOP ("octave::workspace_view", "Value"), QT_TRANSLATE_NOOP ("octave::workspace_view", "Attribute") }; -const QStringList ws_columns_shown_keys = { +const QStringList ws_columns_shown_keys = +{ "workspaceview/show_class", "workspaceview/show_dimension", "workspaceview/show_value", @@ -71,7 +73,8 @@ const QString ws_class_chars ("agp"); const QStringList -ws_color_names = { +ws_color_names = +{ QT_TRANSLATE_NOOP ("octave::settings_dialog", "argument"), QT_TRANSLATE_NOOP ("octave::settings_dialog", "global"), QT_TRANSLATE_NOOP ("octave::settings_dialog", "persistent")
--- a/libgui/src/gui-preferences.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/gui-preferences.cc Fri Dec 22 12:14:08 2023 -0500 @@ -39,30 +39,34 @@ all_gui_preferences *all_gui_preferences::s_instance = nullptr; -void all_gui_preferences::insert (const QString& settings_key, - const gui_pref& pref) +void +all_gui_preferences::insert (const QString& settings_key, + const gui_pref& pref) { ensure_instance (); s_instance->do_insert (settings_key, pref); } -const gui_pref all_gui_preferences::value (const QString& settings_key) +const gui_pref +all_gui_preferences::value (const QString& settings_key) { ensure_instance (); return s_instance->do_value (settings_key); } -QStringList all_gui_preferences::keys () +QStringList +all_gui_preferences::keys () { ensure_instance (); return s_instance->do_keys (); } -void all_gui_preferences::do_insert (const QString& settings_key, - const gui_pref& pref) +void +all_gui_preferences::do_insert (const QString& settings_key, + const gui_pref& pref) { m_hash.insert (settings_key, pref); } @@ -73,12 +77,14 @@ return m_hash.value (settings_key); } -QStringList all_gui_preferences::do_keys () const +QStringList +all_gui_preferences::do_keys () const { return m_hash.keys (); } -void all_gui_preferences::ensure_instance () +void +all_gui_preferences::ensure_instance () { if (! s_instance) s_instance = new all_gui_preferences (); @@ -108,7 +114,8 @@ all_shortcut_preferences::insert (settings_key, *this); } -QKeySequence sc_pref::def_value () const +QKeySequence +sc_pref::def_value () const { QKeySequence key_seq = QKeySequence (); @@ -120,37 +127,42 @@ return key_seq; } -QString sc_pref::def_text () const +QString +sc_pref::def_text () const { return def_value ().toString (); } all_shortcut_preferences *all_shortcut_preferences::s_instance = nullptr; -void all_shortcut_preferences::insert (const QString& settings_key, - const sc_pref& scpref) +void +all_shortcut_preferences::insert (const QString& settings_key, + const sc_pref& scpref) { ensure_instance (); s_instance->do_insert (settings_key, scpref); } -const sc_pref all_shortcut_preferences::value (const QString& settings_key) +const sc_pref +all_shortcut_preferences::value (const QString& settings_key) { ensure_instance (); return s_instance->do_value (settings_key); } -QStringList all_shortcut_preferences::keys () +QStringList +all_shortcut_preferences::keys () { ensure_instance (); return s_instance->do_keys (); } -void all_shortcut_preferences::do_insert (const QString& settings_key, - const sc_pref& scpref) +void +all_shortcut_preferences::do_insert (const QString& settings_key, + const sc_pref& scpref) { m_hash.insert (settings_key, scpref); } @@ -161,12 +173,14 @@ return m_hash.value (settings_key); } -QStringList all_shortcut_preferences::do_keys () const +QStringList +all_shortcut_preferences::do_keys () const { return m_hash.keys (); } -void all_shortcut_preferences::ensure_instance () +void +all_shortcut_preferences::ensure_instance () { if (! s_instance) s_instance = new all_shortcut_preferences ();
--- a/libgui/src/gui-settings.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/gui-settings.cc Fri Dec 22 12:14:08 2023 -0500 @@ -71,54 +71,64 @@ return fileName (); } -QString gui_settings::directory_name () const +QString +gui_settings::directory_name () const { QFileInfo sfile (fileName ()); return sfile.absolutePath (); } -bool gui_settings::bool_value (const gui_pref& pref) const +bool +gui_settings::bool_value (const gui_pref& pref) const { return value (pref).toBool (); } -QByteArray gui_settings::byte_array_value (const gui_pref& pref) const +QByteArray +gui_settings::byte_array_value (const gui_pref& pref) const { return value (pref).toByteArray (); } -QColor gui_settings::color_value (const gui_pref& pref) const +QColor +gui_settings::color_value (const gui_pref& pref) const { return value (pref).value<QColor> (); } -QDateTime gui_settings::date_time_value (const gui_pref& pref) const +QDateTime +gui_settings::date_time_value (const gui_pref& pref) const { return value (pref).toDateTime (); } -int gui_settings::int_value (const gui_pref& pref) const +int +gui_settings::int_value (const gui_pref& pref) const { return value (pref).toInt (); } -QString gui_settings::string_value (const gui_pref& pref) const +QString +gui_settings::string_value (const gui_pref& pref) const { return value (pref).toString (); } -QStringList gui_settings::string_list_value (const gui_pref& pref) const +QStringList +gui_settings::string_list_value (const gui_pref& pref) const { return value (pref).toStringList (); } -uint gui_settings::uint_value (const gui_pref& pref) const +uint +gui_settings::uint_value (const gui_pref& pref) const { return value (pref).toUInt (); } -QColor gui_settings::get_color_value (const QVariant& def, int mode) const +QColor +gui_settings::get_color_value (const QVariant& def, int mode) const { QColor default_color; @@ -136,8 +146,8 @@ // the application's palette default_color = QApplication::palette ().color (static_cast<QPalette::ColorRole> (def.toInt ())); - // FIXME: use value<QPalette::ColorRole> instead of static cast after - // dropping support of Qt 5.4 + // FIXME: use value<QPalette::ColorRole> instead of static cast after + // dropping support of Qt 5.4 } if ((mode == 1) && (default_color != settings_color_no_change)) @@ -158,7 +168,8 @@ return default_color; } -QColor gui_settings::color_value (const gui_pref& pref, int mode) const +QColor +gui_settings::color_value (const gui_pref& pref, int mode) const { QColor default_color = get_color_value (pref.def (), mode); @@ -166,8 +177,9 @@ QVariant (default_color)).value<QColor> (); } -void gui_settings::set_color_value (const gui_pref& pref, - const QColor& color, int mode) +void +gui_settings::set_color_value (const gui_pref& pref, + const QColor& color, int mode) { int m = mode; if (m > 1) @@ -177,7 +189,8 @@ QVariant (color)); } -QString gui_settings::sc_value (const sc_pref& scpref) const +QString +gui_settings::sc_value (const sc_pref& scpref) const { QKeySequence key_seq = sc_def_value (scpref); @@ -187,13 +200,14 @@ key_seq.toString ()).toString (); } -QKeySequence gui_settings::sc_def_value (const sc_pref& scpref) const +QKeySequence +gui_settings::sc_def_value (const sc_pref& scpref) const { return scpref.def_value (); } -void gui_settings::set_shortcut (QAction *action, const sc_pref& scpref, - bool enable) +void +gui_settings::set_shortcut (QAction *action, const sc_pref& scpref, bool enable) { if (! enable) { @@ -211,7 +225,8 @@ << " not found in settings"; } -void gui_settings::shortcut (QShortcut *sc, const sc_pref& scpref) +void +gui_settings::shortcut (QShortcut *sc, const sc_pref& scpref) { QString shortcut = sc_value (scpref); @@ -222,7 +237,8 @@ << " not found in settings"; } -void gui_settings::config_icon_theme () +void +gui_settings::config_icon_theme () { int theme_index; @@ -267,8 +283,9 @@ setValue (global_icon_fallbacks.settings_key (), icon_fallbacks); } -QIcon gui_settings::icon (const QString& icon_name, bool octave_only, - const QString& icon_alt_name) +QIcon +gui_settings::icon (const QString& icon_name, bool octave_only, + const QString& icon_alt_name) { if (octave_only) return QIcon (global_icon_paths.at (ICON_THEME_OCTAVE) + icon_name + ".png"); @@ -288,11 +305,12 @@ return QIcon (icon_file); } - //QIcon::setThemeName (current_theme); - return QIcon (); + //QIcon::setThemeName (current_theme); + return QIcon (); } -QString gui_settings::get_default_font_family () +QString +gui_settings::get_default_font_family () { // Get all available fixed width fonts from the Qt font database. @@ -349,7 +367,8 @@ return default_family; } -QStringList gui_settings::get_default_font () +QStringList +gui_settings::get_default_font () { QString default_family = get_default_font_family (); @@ -379,7 +398,8 @@ return result; } -QString gui_settings::get_gui_translation_dir () +QString +gui_settings::get_gui_translation_dir () { // get environment variable for the locale dir (e.g. from run-octave) std::string dldir = sys::env::getenv ("OCTAVE_LOCALE_DIR"); @@ -388,9 +408,10 @@ return QString::fromStdString (dldir); } -void gui_settings::config_translators (QTranslator *qt_tr, - QTranslator *qsci_tr, - QTranslator *gui_tr) +void +gui_settings::config_translators (QTranslator *qt_tr, + QTranslator *qsci_tr, + QTranslator *gui_tr) { bool loaded; @@ -437,7 +458,8 @@ } #if defined (HAVE_QSCINTILLA) -int gui_settings::get_valid_lexer_styles (QsciLexer *lexer, int *styles) +int +gui_settings::get_valid_lexer_styles (QsciLexer *lexer, int *styles) { int max_style = 0; int actual_style = 0; @@ -458,7 +480,8 @@ * @param attr QFont with the desired attributes * @param base QFont with desired family and size */ -static QFont copy_font_attributes (const QFont& attr, const QFont& base) +static QFont +copy_font_attributes (const QFont& attr, const QFont& base) { QFont dest (base); @@ -470,7 +493,8 @@ } #if defined (HAVE_QSCINTILLA) -void gui_settings::read_lexer_settings (QsciLexer *lexer, int mode, int def) +void +gui_settings::read_lexer_settings (QsciLexer *lexer, int mode, int def) { // Test whether the settings for lexer is already contained in the // given gui settings file. If yes, load them, if not copy them from the @@ -539,8 +563,9 @@ } #endif -bool gui_settings::update_settings_key (const QString& old_key, - const QString& new_key) +bool +gui_settings::update_settings_key (const QString& old_key, + const QString& new_key) { if (contains (old_key)) { @@ -553,7 +578,8 @@ return false; } -void gui_settings::update_network_settings () +void +gui_settings::update_network_settings () { QNetworkProxy proxy; @@ -614,7 +640,7 @@ while (! proxy_url.isValid () && count < env_vars.size ()) { proxy_url = QUrl (QString::fromStdString - (sys::env::getenv (env_vars[count]))); + (sys::env::getenv (env_vars[count]))); count++; } @@ -654,7 +680,8 @@ } // initialize a given combo box with available text encodings -void gui_settings::combo_encoding (QComboBox *combo, const QString& current) +void +gui_settings::combo_encoding (QComboBox *combo, const QString& current) { std::vector<std::string> encoding_list {string::get_encoding_list ()}; @@ -717,7 +744,8 @@ combo->setMaxVisibleItems (12); } -void gui_settings::reload () +void +gui_settings::reload () { // Declare some empty options, which may be set at first startup for // writing them into the newly created settings file @@ -758,7 +786,8 @@ setValue (global_mono_font.settings_key (), get_default_font_family ()); } -void gui_settings::check () +void +gui_settings::check () { if (status () == QSettings::NoError) {
--- a/libgui/src/gui-utils.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/gui-utils.h Fri Dec 22 12:14:08 2023 -0500 @@ -51,9 +51,9 @@ @return New color as QColor */ - extern OCTGUI_API QColor - interpolate_color (const QColor& col1, const QColor& col2, - double fs, double fv); +extern OCTGUI_API QColor +interpolate_color (const QColor& col1, const QColor& col2, + double fs, double fv); /*! Get the screen geometry of the actual screen.
--- a/libgui/src/history-dock-widget.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/history-dock-widget.cc Fri Dec 22 12:14:08 2023 -0500 @@ -58,13 +58,15 @@ make_window (); } -void history_dock_widget::set_history (const QStringList& hist) +void +history_dock_widget::set_history (const QStringList& hist) { m_history_model->setStringList (hist); m_history_list_view->scrollToBottom (); } -void history_dock_widget::append_history (const QString& hist_entry) +void +history_dock_widget::append_history (const QString& hist_entry) { QStringList lst = m_history_model->stringList (); lst.append (hist_entry); @@ -80,12 +82,14 @@ m_history_list_view->scrollToBottom (); } -void history_dock_widget::clear_history () +void +history_dock_widget::clear_history () { m_history_model->setStringList (QStringList ()); } -void history_dock_widget::save_settings () +void +history_dock_widget::save_settings () { gui_settings settings; @@ -102,7 +106,8 @@ octave_dock_widget::save_settings (); } -void history_dock_widget::update_filter_history () +void +history_dock_widget::update_filter_history () { QString text = m_filter->currentText (); // get current text int index = m_filter->findText (text); // and its actual index @@ -114,7 +119,8 @@ m_filter->setCurrentIndex (0); } -void history_dock_widget::set_filter_focus (bool focus) +void +history_dock_widget::set_filter_focus (bool focus) { if (focus) { @@ -128,7 +134,8 @@ } } -void history_dock_widget::filter_activate (bool state) +void +history_dock_widget::filter_activate (bool state) { m_filter->setEnabled (state); m_sort_filter_proxy_model.setDynamicSortFilter (state); @@ -141,7 +148,8 @@ set_filter_focus (state); } -void history_dock_widget::ctxMenu (const QPoint& xpos) +void +history_dock_widget::ctxMenu (const QPoint& xpos) { QMenu menu (this); @@ -169,12 +177,14 @@ menu.exec (m_history_list_view->mapToGlobal (xpos)); } -void history_dock_widget::handle_double_click (QModelIndex modelIndex) +void +history_dock_widget::handle_double_click (QModelIndex modelIndex) { emit command_double_clicked (modelIndex.data ().toString ()); } -void history_dock_widget::handle_contextmenu_copy (bool) +void +history_dock_widget::handle_contextmenu_copy (bool) { QString text; QItemSelectionModel *selectionModel = m_history_list_view->selectionModel (); @@ -193,7 +203,8 @@ QApplication::clipboard ()->setText (text); } -void history_dock_widget::handle_contextmenu_evaluate (bool) +void +history_dock_widget::handle_contextmenu_evaluate (bool) { QItemSelectionModel *selectionModel = m_history_list_view->selectionModel (); QModelIndexList rows = selectionModel->selectedRows (); @@ -202,7 +213,8 @@ emit command_double_clicked (it.data ().toString ()); } -void history_dock_widget::handle_contextmenu_create_script (bool) +void +history_dock_widget::handle_contextmenu_create_script (bool) { QString text; QItemSelectionModel *selectionModel = m_history_list_view->selectionModel (); @@ -224,7 +236,8 @@ emit command_create_script (text); } -void history_dock_widget::handle_contextmenu_filter () +void +history_dock_widget::handle_contextmenu_filter () { m_filter_shown = ! m_filter_shown; m_filter_widget->setVisible (m_filter_shown); @@ -232,7 +245,8 @@ set_filter_focus (m_filter_shown && m_filter_checkbox->isChecked ()) ; } -void history_dock_widget::copyClipboard () +void +history_dock_widget::copyClipboard () { if (m_history_list_view->hasFocus ()) handle_contextmenu_copy (true); @@ -244,7 +258,8 @@ } } -void history_dock_widget::pasteClipboard () +void +history_dock_widget::pasteClipboard () { if (m_filter->lineEdit ()->hasFocus ()) { @@ -255,7 +270,8 @@ } } -void history_dock_widget::selectAll () +void +history_dock_widget::selectAll () { if (m_filter->lineEdit ()->hasFocus ()) m_filter->lineEdit ()->selectAll (); @@ -264,7 +280,8 @@ m_history_list_view->selectAll (); } -void history_dock_widget::handle_visibility (bool visible) +void +history_dock_widget::handle_visibility (bool visible) { octave_dock_widget::handle_visibility (visible); @@ -275,7 +292,8 @@ } } -void history_dock_widget::construct () +void +history_dock_widget::construct () { m_history_model = new QStringListModel (); m_sort_filter_proxy_model.setSourceModel (m_history_model); @@ -352,7 +370,8 @@ m_history_list_view->setTextElideMode (Qt::ElideRight); } -void history_dock_widget::notice_settings () +void +history_dock_widget::notice_settings () { gui_settings settings;
--- a/libgui/src/interpreter-qobject.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/interpreter-qobject.cc Fri Dec 22 12:14:08 2023 -0500 @@ -42,7 +42,8 @@ : QObject (), m_octave_qobj (oct_qobj), m_interpreter (nullptr) { } -void interpreter_qobject::execute () +void +interpreter_qobject::execute () { // The Octave application context owns the interpreter. @@ -108,7 +109,8 @@ emit shutdown_finished (exit_status); } -void interpreter_qobject::interpreter_event (const fcn_callback& fcn) +void +interpreter_qobject::interpreter_event (const fcn_callback& fcn) { if (! m_interpreter) return; @@ -118,7 +120,8 @@ evmgr.post_event (fcn); } -void interpreter_qobject::interpreter_event (const meth_callback& meth) +void +interpreter_qobject::interpreter_event (const meth_callback& meth) { if (! m_interpreter) return; @@ -128,7 +131,8 @@ evmgr.post_event (meth); } -void interpreter_qobject::interrupt () +void +interpreter_qobject::interrupt () { if (! m_interpreter) return; @@ -139,7 +143,8 @@ m_interpreter->interrupt (); } -void interpreter_qobject::pause () +void +interpreter_qobject::pause () { // FIXME: Should we make this action work with the old terminal // widget? @@ -156,7 +161,8 @@ } } -void interpreter_qobject::stop () +void +interpreter_qobject::stop () { // FIXME: Should we make this action work with the old terminal // widget? @@ -173,7 +179,8 @@ } } -void interpreter_qobject::resume () +void +interpreter_qobject::resume () { // FIXME: Should we make this action work with the old terminal // widget? @@ -193,7 +200,8 @@ } } -qt_interpreter_events *interpreter_qobject::qt_link () +qt_interpreter_events * +interpreter_qobject::qt_link () { return m_octave_qobj.qt_link (); }
--- a/libgui/src/led-indicator.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/led-indicator.cc Fri Dec 22 12:14:08 2023 -0500 @@ -35,13 +35,14 @@ OCTAVE_BEGIN_NAMESPACE(octave) led_indicator::led_indicator (led_state initial_state, QWidget *p) -: QLabel (p) + : QLabel (p) { setFixedSize(12, 12); set_state (initial_state); } -void led_indicator::set_state (led_state state) +void +led_indicator::set_state (led_state state) { QColor col (Qt::gray); @@ -63,7 +64,8 @@ setStyleSheet (style_sheet (col)); } -QString led_indicator::style_sheet (const QColor& col) +QString +led_indicator::style_sheet (const QColor& col) { QColor col_light = interpolate_color (col, QColor (Qt::white), 0.25, 0.9);
--- a/libgui/src/led-indicator.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/led-indicator.h Fri Dec 22 12:14:08 2023 -0500 @@ -37,11 +37,11 @@ public: enum led_state - { - LED_STATE_NO = -1, - LED_STATE_INACTIVE, - LED_STATE_ACTIVE - }; + { + LED_STATE_NO = -1, + LED_STATE_INACTIVE, + LED_STATE_ACTIVE + }; led_indicator (led_state initial_state = LED_STATE_INACTIVE, QWidget *parent = 0);
--- a/libgui/src/m-editor/file-editor-tab.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/m-editor/file-editor-tab.cc Fri Dec 22 12:14:08 2023 -0500 @@ -133,7 +133,7 @@ m_last_modified = QDateTime::currentDateTimeUtc(); connect (m_edit_area, SIGNAL (cursorPositionChanged (int, int)), - this, SLOT (handle_cursor_moved (int,int))); + this, SLOT (handle_cursor_moved (int, int))); connect (m_edit_area, SIGNAL (SCN_CHARADDED (int)), this, SLOT (handle_char_added (int))); @@ -293,7 +293,8 @@ } } -void file_editor_tab::set_encoding (const QString& new_encoding) +void +file_editor_tab::set_encoding (const QString& new_encoding) { if (new_encoding.isEmpty ()) return; @@ -304,7 +305,8 @@ set_modified (true); } -void file_editor_tab::closeEvent (QCloseEvent *e) +void +file_editor_tab::closeEvent (QCloseEvent *e) { int save_dialog = check_file_modified (true); if ((save_dialog == QMessageBox::Cancel) || @@ -322,12 +324,14 @@ } } -void file_editor_tab::set_current_directory (const QString& dir) +void +file_editor_tab::set_current_directory (const QString& dir) { m_ced = dir; } -void file_editor_tab::handle_context_menu_edit (const QString& word_at_cursor) +void +file_editor_tab::handle_context_menu_edit (const QString& word_at_cursor) { // Search for a function with that name in the current file // This is done first because local functions and subfunctions have priority @@ -366,7 +370,7 @@ // reg expr. found: it is an internal function m_edit_area->setCursorPosition (line, match.capturedStart ()); m_edit_area->SendScintilla (2232, line); // SCI_ENSUREVISIBLE - // SCI_VISIBLEFROMDOCLINE + // SCI_VISIBLEFROMDOCLINE int vis_line = m_edit_area->SendScintilla (2220, line); m_edit_area->SendScintilla (2613, vis_line); // SCI_SETFIRSTVISIBLELINE return; @@ -378,7 +382,8 @@ // If "dbstop if ..." selected from context menu, create a conditional // breakpoint. The default condition is (a) the existing condition if there // is already a breakpoint, (b) any selected text, or (c) empty -void file_editor_tab::handle_context_menu_break_condition (int linenr) +void +file_editor_tab::handle_context_menu_break_condition (int linenr) { // Ensure editor line numbers match Octave core's line numbers. // Give users the option to save modifications if necessary. @@ -422,8 +427,9 @@ // to add the breakpoint in the editor tab or a signal to display a // new dialog. -void file_editor_tab::handle_dbstop_if (const QString& prompt, int line, - const QString& cond) +void +file_editor_tab::handle_dbstop_if (const QString& prompt, int line, + const QString& cond) { bool ok; QString new_cond @@ -507,7 +513,8 @@ } } -void file_editor_tab::set_file_name (const QString& fileName) +void +file_editor_tab::set_file_name (const QString& fileName) { // update tracked file if we really have a file on disk QStringList trackedFiles = m_file_system_watcher.files (); @@ -539,7 +546,8 @@ // valid_file_name (file): checks whether "file" names a file. // By default, "file" is empty; then m_file_name is checked -bool file_editor_tab::valid_file_name (const QString& file) +bool +file_editor_tab::valid_file_name (const QString& file) { if (file.isEmpty ()) { @@ -552,7 +560,8 @@ return true; } -void file_editor_tab::enable_file_watcher (bool do_enable) +void +file_editor_tab::enable_file_watcher (bool do_enable) { if (do_enable) m_file_system_watcher.addPath (m_file_name); @@ -565,7 +574,8 @@ // not match what Octave core is interpreting in the // file on disk. This function gives the user the option // to save before creating the breakpoint. -bool file_editor_tab::unchanged_or_saved () +bool +file_editor_tab::unchanged_or_saved () { bool retval = true; if (m_edit_area->isModified () || ! valid_file_name ()) @@ -586,8 +596,9 @@ // Toggle a breakpoint at the editor_linenr or, if this was called by // a click with CTRL pressed, toggle a bookmark at that point. -void file_editor_tab::handle_margin_clicked (int margin, int editor_linenr, - Qt::KeyboardModifiers state) +void +file_editor_tab::handle_margin_clicked (int margin, int editor_linenr, + Qt::KeyboardModifiers state) { if (margin == 1) { @@ -614,7 +625,8 @@ } } -void file_editor_tab::update_lexer () +void +file_editor_tab::update_lexer () { // Create a new lexer QsciLexer *lexer = nullptr; @@ -725,7 +737,8 @@ // a) the lexer changes, // b) the settings have changed, or // c) a package was loaded/unloaded -void file_editor_tab::update_lexer_settings (bool update_apis_only) +void +file_editor_tab::update_lexer_settings (bool update_apis_only) { QsciLexer *lexer = m_edit_area->lexer (); @@ -938,9 +951,9 @@ QColor current_line_bg = settings.color_value (ed_highlight_current_line_color, mode); if (current_line_bg == settings_color_no_change) - bgm = interpolate_color (bg, fg, 0.5, 0.1); // It is the "auto" color - else - bgm = current_line_bg; // Specific color given + bgm = interpolate_color (bg, fg, 0.5, 0.1); // It is the "auto" color + else + bgm = current_line_bg; // Specific color given m_edit_area->setCaretLineBackgroundColor (bgm); @@ -972,7 +985,8 @@ } // function for adding entries to the octave lexer's APIs -void file_editor_tab::handle_add_octave_apis (const QStringList& api_entries) +void +file_editor_tab::handle_add_octave_apis (const QStringList& api_entries) { for (int idx = 0; idx < api_entries.size (); idx++) m_lexer_apis->add (api_entries.at (idx)); @@ -980,7 +994,8 @@ emit api_entries_added (); } -void file_editor_tab::handle_api_entries_added () +void +file_editor_tab::handle_api_entries_added () { // disconnect slot for saving prepared info if already connected disconnect (m_lexer_apis, &QsciAPIs::apiPreparationFinished, @@ -997,13 +1012,15 @@ m_lexer_apis->prepare (); // prepare apis info } -void file_editor_tab::save_apis_info () +void +file_editor_tab::save_apis_info () { m_lexer_apis->savePrepared (m_prep_apis_file); } // slot for fetab_set_focus: sets the focus to the current edit area -void file_editor_tab::set_focus (const QWidget *ID) +void +file_editor_tab::set_focus (const QWidget *ID) { if (ID != this) return; @@ -1011,7 +1028,8 @@ emit edit_area_changed (m_edit_area); // update the edit area in find dlg } -void file_editor_tab::context_help (const QWidget *ID, bool doc) +void +file_editor_tab::context_help (const QWidget *ID, bool doc) { if (ID != this) return; @@ -1019,7 +1037,8 @@ m_edit_area->context_help_doc (doc); } -void file_editor_tab::context_edit (const QWidget *ID) +void +file_editor_tab::context_edit (const QWidget *ID) { if (ID != this) return; @@ -1027,7 +1046,8 @@ m_edit_area->context_edit (); } -void file_editor_tab::save_file (const QWidget *ID) +void +file_editor_tab::save_file (const QWidget *ID) { if (ID != this) return; @@ -1035,8 +1055,9 @@ save_file (m_file_name); } -void file_editor_tab::save_file (const QWidget *ID, const QString& fileName, - bool remove_on_success) +void +file_editor_tab::save_file (const QWidget *ID, const QString& fileName, + bool remove_on_success) { if (ID != this) return; @@ -1044,7 +1065,8 @@ save_file (fileName, remove_on_success); } -void file_editor_tab::save_file_as (const QWidget *ID) +void +file_editor_tab::save_file_as (const QWidget *ID) { if (ID != this) return; @@ -1052,7 +1074,8 @@ save_file_as (); } -void file_editor_tab::print_file (const QWidget *ID) +void +file_editor_tab::print_file (const QWidget *ID) { if (ID != this) return; @@ -1067,7 +1090,8 @@ delete printer; } -void file_editor_tab::run_file (const QWidget *ID, bool step_into) +void +file_editor_tab::run_file (const QWidget *ID, bool step_into) { if (ID != this) return; @@ -1103,7 +1127,8 @@ emit run_file_signal (info); } -void file_editor_tab::context_run (const QWidget *ID) +void +file_editor_tab::context_run (const QWidget *ID) { if (ID != this) return; @@ -1111,7 +1136,8 @@ m_edit_area->context_run (); } -void file_editor_tab::toggle_bookmark (const QWidget *ID) +void +file_editor_tab::toggle_bookmark (const QWidget *ID) { if (ID != this) return; @@ -1127,7 +1153,8 @@ // Move the text cursor to the closest bookmark // after the current line. -void file_editor_tab::next_bookmark (const QWidget *ID) +void +file_editor_tab::next_bookmark (const QWidget *ID) { if (ID != this) return; @@ -1148,7 +1175,8 @@ // Move the text cursor to the closest bookmark // before the current line. -void file_editor_tab::previous_bookmark (const QWidget *ID) +void +file_editor_tab::previous_bookmark (const QWidget *ID) { if (ID != this) return; @@ -1168,7 +1196,8 @@ m_edit_area->setCursorPosition (prevline, 0); } -QString file_editor_tab::get_all_bookmarks () +QString +file_editor_tab::get_all_bookmarks () { QString bmlist; int line = 0; @@ -1188,7 +1217,8 @@ return bmlist; } -void file_editor_tab::remove_bookmark (const QWidget *ID) +void +file_editor_tab::remove_bookmark (const QWidget *ID) { if (ID != this) return; @@ -1206,7 +1236,8 @@ add_breakpoint_event (line, condition); } -void file_editor_tab::handle_request_remove_breakpoint (int line) +void +file_editor_tab::handle_request_remove_breakpoint (int line) { emit interpreter_event ([=] (interpreter& interp) @@ -1220,7 +1251,8 @@ }); } -void file_editor_tab::toggle_breakpoint (const QWidget *ID) +void +file_editor_tab::toggle_breakpoint (const QWidget *ID) { if (ID != this) return; @@ -1239,7 +1271,8 @@ // Move the text cursor to the closest breakpoint (conditional or unconditional) // after the current line. -void file_editor_tab::next_breakpoint (const QWidget *ID) +void +file_editor_tab::next_breakpoint (const QWidget *ID) { if (ID != this) return; @@ -1261,7 +1294,8 @@ // Move the text cursor to the closest breakpoint (conditional or unconditional) // before the current line. -void file_editor_tab::previous_breakpoint (const QWidget *ID) +void +file_editor_tab::previous_breakpoint (const QWidget *ID) { if (ID != this) return; @@ -1281,7 +1315,8 @@ m_edit_area->setCursorPosition (prevline, 0); } -void file_editor_tab::remove_all_breakpoints (const QWidget *ID) +void +file_editor_tab::remove_all_breakpoints (const QWidget *ID) { if (ID != this) return; @@ -1299,8 +1334,9 @@ }); } -void file_editor_tab::scintilla_command (const QWidget *ID, - unsigned int sci_msg) +void +file_editor_tab::scintilla_command (const QWidget *ID, + unsigned int sci_msg) { if (ID != this) return; @@ -1308,8 +1344,9 @@ m_edit_area->SendScintilla (sci_msg); } -void file_editor_tab::comment_selected_text (const QWidget *ID, - bool input_str) +void +file_editor_tab::comment_selected_text (const QWidget *ID, + bool input_str) { if (ID != this) return; @@ -1317,7 +1354,8 @@ do_comment_selected_text (true, input_str); } -void file_editor_tab::uncomment_selected_text (const QWidget *ID) +void +file_editor_tab::uncomment_selected_text (const QWidget *ID) { if (ID != this) return; @@ -1325,7 +1363,8 @@ do_comment_selected_text (false); } -void file_editor_tab::indent_selected_text (const QWidget *ID) +void +file_editor_tab::indent_selected_text (const QWidget *ID) { if (ID != this) return; @@ -1333,7 +1372,8 @@ do_indent_selected_text (true); } -void file_editor_tab::unindent_selected_text (const QWidget *ID) +void +file_editor_tab::unindent_selected_text (const QWidget *ID) { if (ID != this) return; @@ -1341,7 +1381,8 @@ do_indent_selected_text (false); } -void file_editor_tab::smart_indent_line_or_selected_text (const QWidget *ID) +void +file_editor_tab::smart_indent_line_or_selected_text (const QWidget *ID) { if (ID != this) return; @@ -1349,8 +1390,9 @@ do_smart_indent_line_or_selected_text (); } -void file_editor_tab::convert_eol (const QWidget *ID, - QsciScintilla::EolMode eol_mode) +void +file_editor_tab::convert_eol (const QWidget *ID, + QsciScintilla::EolMode eol_mode) { if (ID != this) return; @@ -1360,7 +1402,8 @@ update_eol_indicator (); } -void file_editor_tab::zoom_in (const QWidget *ID) +void +file_editor_tab::zoom_in (const QWidget *ID) { if (ID != this) return; @@ -1369,7 +1412,8 @@ auto_margin_width (); } -void file_editor_tab::zoom_out (const QWidget *ID) +void +file_editor_tab::zoom_out (const QWidget *ID) { if (ID != this) return; @@ -1378,7 +1422,8 @@ auto_margin_width (); } -void file_editor_tab::zoom_normal (const QWidget *ID) +void +file_editor_tab::zoom_normal (const QWidget *ID) { if (ID != this) return; @@ -1387,7 +1432,8 @@ auto_margin_width (); } -void file_editor_tab::add_breakpoint_event (int line, const QString& cond) +void +file_editor_tab::add_breakpoint_event (int line, const QString& cond) { // The interpreter_event callback function below emits a signal. // Because we don't control when that happens, use a guarded pointer @@ -1421,7 +1467,8 @@ }); } -void file_editor_tab::handle_remove_next (int remove_line) +void +file_editor_tab::handle_remove_next (int remove_line) { // Store some info breakpoint if (m_breakpoint_info.remove_next) @@ -1431,7 +1478,8 @@ } } -void file_editor_tab::goto_line (const QWidget *ID, int line) +void +file_editor_tab::goto_line (const QWidget *ID, int line) { if (ID != this) return; @@ -1461,7 +1509,8 @@ center_current_line (false); // only center line if at top or bottom } -void file_editor_tab::move_match_brace (const QWidget *ID, bool select) +void +file_editor_tab::move_match_brace (const QWidget *ID, bool select) { if (ID != this) return; @@ -1472,7 +1521,8 @@ m_edit_area->moveToMatchingBrace (); } -void file_editor_tab::show_auto_completion (const QWidget *ID) +void +file_editor_tab::show_auto_completion (const QWidget *ID) { if (ID != this) return; @@ -1499,7 +1549,8 @@ } } -void file_editor_tab::do_indent_selected_text (bool indent) +void +file_editor_tab::do_indent_selected_text (bool indent) { // FIXME: m_edit_area->beginUndoAction (); @@ -1536,7 +1587,8 @@ m_edit_area->endUndoAction (); } -void file_editor_tab::do_smart_indent_line_or_selected_text () +void +file_editor_tab::do_smart_indent_line_or_selected_text () { m_edit_area->beginUndoAction (); @@ -1563,7 +1615,8 @@ m_edit_area->endUndoAction (); } -void file_editor_tab::do_comment_selected_text (bool comment, bool input_str) +void +file_editor_tab::do_comment_selected_text (bool comment, bool input_str) { QRegularExpression rxc; QString ws = "^(?:[ \\t]*)"; @@ -1712,7 +1765,8 @@ m_edit_area->endUndoAction (); } -void file_editor_tab::update_window_title (bool modified) +void +file_editor_tab::update_window_title (bool modified) { QString title (""); QString tooltip (""); @@ -1729,7 +1783,8 @@ emit file_name_changed (title, tooltip, modified); } -void file_editor_tab::handle_copy_available (bool enableCopy) +void +file_editor_tab::handle_copy_available (bool enableCopy) { m_copy_available = enableCopy; emit editor_state_changed (m_copy_available, m_is_octave_file, @@ -1737,7 +1792,8 @@ } // show_dialog: shows a modal or non modal dialog depending on input arg -void file_editor_tab::show_dialog (QDialog *dlg, bool modal) +void +file_editor_tab::show_dialog (QDialog *dlg, bool modal) { dlg->setAttribute (Qt::WA_DeleteOnClose); if (modal) @@ -1749,7 +1805,8 @@ } } -int file_editor_tab::check_file_modified (bool remove) +int +file_editor_tab::check_file_modified (bool remove) { int decision = QMessageBox::Yes; if (m_edit_area->isModified ()) @@ -1802,12 +1859,14 @@ return decision; } -void file_editor_tab::set_modified (bool modified) +void +file_editor_tab::set_modified (bool modified) { m_edit_area->setModified (modified); } -void file_editor_tab::recover_from_exit () +void +file_editor_tab::recover_from_exit () { // reset the possibly still existing read only state m_edit_area->setReadOnly (false); @@ -1819,7 +1878,8 @@ check_restore_breakpoints (); } -void file_editor_tab::check_restore_breakpoints () +void +file_editor_tab::check_restore_breakpoints () { if (! m_bp_lines.isEmpty ()) { @@ -1839,7 +1899,8 @@ } } -QString file_editor_tab::load_file (const QString& fileName) +QString +file_editor_tab::load_file (const QString& fileName) { // get the absolute path QFileInfo file_info = QFileInfo (fileName); @@ -1977,7 +2038,8 @@ return QString (); } -void file_editor_tab::handle_decode_warning_answer (QAbstractButton *btn) +void +file_editor_tab::handle_decode_warning_answer (QAbstractButton *btn) { QString txt = btn->text (); @@ -2034,12 +2096,14 @@ m_edit_area->setReadOnly (false); } -void file_editor_tab::handle_current_enc_changed (const QString& enc) +void +file_editor_tab::handle_current_enc_changed (const QString& enc) { m_new_encoding = enc; } -QsciScintilla::EolMode file_editor_tab::detect_eol_mode () +QsciScintilla::EolMode +file_editor_tab::detect_eol_mode () { QByteArray text = m_edit_area->text ().toLatin1 (); @@ -2077,7 +2141,8 @@ return eol_mode; } -void file_editor_tab::update_eol_indicator () +void +file_editor_tab::update_eol_indicator () { switch (m_edit_area->eolMode ()) { @@ -2093,7 +2158,8 @@ } } -void file_editor_tab::update_breakpoints () +void +file_editor_tab::update_breakpoints () { if (m_file_name.isEmpty ()) return; @@ -2127,7 +2193,8 @@ }); } -void file_editor_tab::update_breakpoints_handler (const octave_value_list& argout) +void +file_editor_tab::update_breakpoints_handler (const octave_value_list& argout) { octave_map dbg = argout(0).map_value (); octave_idx_type n_dbg = dbg.numel (); @@ -2144,7 +2211,8 @@ } } -void file_editor_tab::new_file (const QString& commands) +void +file_editor_tab::new_file (const QString& commands) { update_window_title (false); // window title (no modification) @@ -2162,10 +2230,11 @@ m_edit_area->setModified (!commands.isEmpty ()); } -void file_editor_tab::confirm_dbquit_and_save (const QString& file_to_save, - const QString& base_name, - bool remove_on_success, - bool restore_breakpoints) +void +file_editor_tab::confirm_dbquit_and_save (const QString& file_to_save, + const QString& base_name, + bool remove_on_success, + bool restore_breakpoints) { int ans = QMessageBox::question (nullptr, tr ("Debug or Save"), tr ("This file is currently being executed.\n" @@ -2211,9 +2280,10 @@ } } -void file_editor_tab::save_file (const QString& saveFileName, - bool remove_on_success, - bool restore_breakpoints) +void +file_editor_tab::save_file (const QString& saveFileName, + bool remove_on_success, + bool restore_breakpoints) { // If it is a new file with no name, signal that saveFileAs // should be performed. @@ -2341,9 +2411,10 @@ restore_breakpoints); } -void file_editor_tab::do_save_file (const QString& file_to_save, - bool remove_on_success, - bool restore_breakpoints) +void +file_editor_tab::do_save_file (const QString& file_to_save, + bool remove_on_success, + bool restore_breakpoints) { QSaveFile file (file_to_save); @@ -2498,7 +2569,8 @@ } } -void file_editor_tab::save_file_as (bool remove_on_success) +void +file_editor_tab::save_file_as (bool remove_on_success) { // Simply put up the file chooser dialog box with a slot connection // then return control to the system waiting for a file selection. @@ -2590,7 +2662,8 @@ show_dialog (fileDialog, ! valid_file_name ()); } -void file_editor_tab::handle_save_as_filter_selected (const QString& filter) +void +file_editor_tab::handle_save_as_filter_selected (const QString& filter) { // On some systems, the filterSelected signal is emitted without user // action and with an empty filter string when the file dialog is shown. @@ -2610,7 +2683,8 @@ file_dialog->setDefaultSuffix (""); // not found, clear default } -bool file_editor_tab::check_valid_identifier (QString file_name) +bool +file_editor_tab::check_valid_identifier (QString file_name) { QFileInfo file = QFileInfo (file_name); QString base_name = file.baseName (); @@ -2633,7 +2707,8 @@ return false; } -bool file_editor_tab::check_valid_codec () +bool +file_editor_tab::check_valid_codec () { QString editor_text = m_edit_area->text (); @@ -2692,7 +2767,8 @@ return can_encode; } -void file_editor_tab::handle_save_file_as_answer (const QString& save_file_name) +void +file_editor_tab::handle_save_file_as_answer (const QString& save_file_name) { QString saveFileName = save_file_name; QFileInfo file (saveFileName); @@ -2713,10 +2789,10 @@ if (file_dialog->testOption (QFileDialog::DontConfirmOverwrite) && file.exists ()) { int ans = QMessageBox::question (file_dialog, - tr ("Octave Editor"), - tr ("%1\n already exists\n" - "Do you want to overwrite it?").arg (saveFileName), - QMessageBox::Yes | QMessageBox::No); + tr ("Octave Editor"), + tr ("%1\n already exists\n" + "Do you want to overwrite it?").arg (saveFileName), + QMessageBox::Yes | QMessageBox::No); if (ans != QMessageBox::Yes) { // Try again, if edit area is read only, remove on success @@ -2739,7 +2815,8 @@ } } -void file_editor_tab::handle_save_file_as_answer_close (const QString& saveFileName) +void +file_editor_tab::handle_save_file_as_answer_close (const QString& saveFileName) { // saveFileName == m_file_name can not happen, because we only can get here // when we close a tab and m_file_name is not a valid filename yet @@ -2751,13 +2828,15 @@ emit editor_check_conflict_save (saveFileName, true); } -void file_editor_tab::handle_save_file_as_answer_cancel () +void +file_editor_tab::handle_save_file_as_answer_cancel () { // User canceled, allow editing again. m_edit_area->setReadOnly (false); } -void file_editor_tab::file_has_changed (const QString&, bool do_close) +void +file_editor_tab::file_has_changed (const QString&, bool do_close) { bool file_exists = QFile::exists (m_file_name); @@ -2852,7 +2931,8 @@ } } -void file_editor_tab::notice_settings (bool init) +void +file_editor_tab::notice_settings (bool init) { gui_settings settings; @@ -2953,8 +3033,8 @@ m_edit_area->SendScintilla (QsciScintillaBase::SCI_SETHSCROLLBAR, settings.bool_value (ed_show_hscroll_bar)); - m_edit_area->SendScintilla (QsciScintillaBase::SCI_SETSCROLLWIDTH,-1); - m_edit_area->SendScintilla (QsciScintillaBase::SCI_SETSCROLLWIDTHTRACKING,true); + m_edit_area->SendScintilla (QsciScintillaBase::SCI_SETSCROLLWIDTH, -1); + m_edit_area->SendScintilla (QsciScintillaBase::SCI_SETSCROLLWIDTHTRACKING, true); update_window_title (m_edit_area->isModified ()); @@ -3021,7 +3101,8 @@ } -void file_editor_tab::auto_margin_width () +void +file_editor_tab::auto_margin_width () { m_edit_area->setMarginWidth (2, "1" + QString::number (m_edit_area->lines ())); } @@ -3031,12 +3112,14 @@ // the tab really was closed (for canceling exiting octave). // When emitting a signal, only the return value from the last slot // goes back to the sender -bool file_editor_tab::conditional_close () +bool +file_editor_tab::conditional_close () { return close (); } -void file_editor_tab::change_editor_state (const QWidget *ID) +void +file_editor_tab::change_editor_state (const QWidget *ID) { if (ID != this) return; @@ -3045,7 +3128,8 @@ m_edit_area->isModified ()); } -void file_editor_tab::handle_file_reload_answer (int decision) +void +file_editor_tab::handle_file_reload_answer (int decision) { if (decision == QMessageBox::Yes) { @@ -3059,7 +3143,8 @@ } } -void file_editor_tab::handle_file_resave_answer (int decision) +void +file_editor_tab::handle_file_resave_answer (int decision) { // check decision of user in dialog if (decision == QMessageBox::Save) @@ -3078,7 +3163,8 @@ } } -void file_editor_tab::insert_debugger_pointer (const QWidget *ID, int line) +void +file_editor_tab::insert_debugger_pointer (const QWidget *ID, int line) { if (ID != this || ID == nullptr) return; @@ -3152,7 +3238,8 @@ } } -void file_editor_tab::delete_debugger_pointer (const QWidget *ID, int line) +void +file_editor_tab::delete_debugger_pointer (const QWidget *ID, int line) { if (ID != this || ID == nullptr) return; @@ -3161,9 +3248,10 @@ emit remove_position_via_debugger_linenr (line); } -void file_editor_tab::do_breakpoint_marker (bool insert, - const QWidget *ID, int line, - const QString& cond) +void +file_editor_tab::do_breakpoint_marker (bool insert, + const QWidget *ID, int line, + const QString& cond) { if (ID != this || ID == nullptr) return; @@ -3217,7 +3305,8 @@ } } -void file_editor_tab::center_current_line (bool always) +void +file_editor_tab::center_current_line (bool always) { long int visible_lines = m_edit_area->SendScintilla (QsciScintillaBase::SCI_LINESONSCREEN); @@ -3244,13 +3333,15 @@ } } -void file_editor_tab::handle_lines_changed () +void +file_editor_tab::handle_lines_changed () { // the related signal is emitted before cursor-move-signal! m_lines_changed = true; } -void file_editor_tab::handle_cursor_moved (int line, int col) +void +file_editor_tab::handle_cursor_moved (int line, int col) { // Cursor has moved, first check wether an autocompletion list // is active or if it was closed. Scintilla provides signals for @@ -3281,7 +3372,8 @@ o_line, m_ind_char_width); } -void file_editor_tab::update_rowcol_indicator (int line, int col) +void +file_editor_tab::update_rowcol_indicator (int line, int col) { m_line = line; m_col = col; @@ -3293,7 +3385,8 @@ // It is used for handling line breaking if this is desired. // The related signal is emitted after the signal for a moved cursor // such that m_col and m_line can not be used for current position. -void file_editor_tab::handle_char_added (int) +void +file_editor_tab::handle_char_added (int) { if (m_line_break) { @@ -3357,7 +3450,8 @@ } // Slot handling a double click into the text area -void file_editor_tab::handle_double_click (int, int, int modifier) +void +file_editor_tab::handle_double_click (int, int, int modifier) { if (! modifier) { @@ -3431,7 +3525,8 @@ } } -QString file_editor_tab::get_function_name () +QString +file_editor_tab::get_function_name () { QRegularExpression rxfun1 {"^[\t ]*function[^=]+=([^\\(]+)\\([^\\)]*\\)[\t ]*$"}; QRegularExpression rxfun2 {"^[\t ]*function[\t ]+([^\\(]+)\\([^\\)]*\\)[\t ]*$"};
--- a/libgui/src/m-editor/file-editor.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/m-editor/file-editor.cc Fri Dec 22 12:14:08 2023 -0500 @@ -81,7 +81,8 @@ setMovable (true); } -tab_bar *file_editor_tab_widget::get_tab_bar () const +tab_bar * +file_editor_tab_widget::get_tab_bar () const { return qobject_cast<tab_bar *> (tabBar ()); } @@ -128,7 +129,8 @@ setFocusPolicy (Qt::StrongFocus); } -void file_editor::focusInEvent (QFocusEvent *e) +void +file_editor::focusInEvent (QFocusEvent *e) { // The focus is transferred to the active tab and its edit // area in this focus in event handler. This is to avoid @@ -142,7 +144,8 @@ // insert global actions, that should also be displayed in the editor window, // into the editor's menu and/or toolbar -void file_editor::insert_global_actions (QList<QAction *> shared_actions) +void +file_editor::insert_global_actions (QList<QAction *> shared_actions) { // actions/menus that have to be added to the toolbar or the menu QAction *open_action = shared_actions.at (OPEN_ACTION); @@ -177,7 +180,8 @@ m_edit_menu->insertAction (m_find_action, m_find_files_action); } -void file_editor::handle_enter_debug_mode () +void +file_editor::handle_enter_debug_mode () { gui_settings settings; @@ -192,7 +196,8 @@ emit enter_debug_mode_signal (); } -void file_editor::handle_exit_debug_mode () +void +file_editor::handle_exit_debug_mode () { gui_settings settings; settings.set_shortcut (m_run_action, sc_edit_run_run_file); @@ -201,7 +206,8 @@ emit exit_debug_mode_signal (); } -void file_editor::check_actions () +void +file_editor::check_actions () { // Do not include shared actions not only related to the editor bool have_tabs = m_tab_widget->count () > 0; @@ -252,7 +258,8 @@ // 1. At startup, when the editor has to be (really) visible // (Here we can not use the visibility changed signal) // 2. When the editor becomes visible when octave is running -void file_editor::empty_script (bool startup, bool visible) +void +file_editor::empty_script (bool startup, bool visible) { if (startup) @@ -316,7 +323,8 @@ request_new_file (""); } -void file_editor::restore_session () +void +file_editor::restore_session () { gui_settings settings; @@ -355,7 +363,8 @@ continue; session_data item = { 0, -1, sessionFileNames.at (n), - QString (), QString (), QString ()}; + QString (), QString (), QString () + }; if (do_lines) item.line = session_lines.at (n).toInt (); if (do_index) @@ -377,7 +386,8 @@ s_data.at (n).bookmarks); } -void file_editor::activate () +void +file_editor::activate () { if (m_no_focus) return; // No focus for the editor if external open/close request @@ -388,7 +398,8 @@ reset_focus (); } -void file_editor::set_focus (QWidget *fet) +void +file_editor::set_focus (QWidget *fet) { setFocus (); @@ -399,7 +410,8 @@ // function enabling/disabling the menu accelerators depending on the // focus of the editor -void file_editor::enable_menu_shortcuts (bool enable) +void +file_editor::enable_menu_shortcuts (bool enable) { // Hide or show the find dialog together with the focus of the // editor widget depending on the overall visibility of the find dialog. @@ -438,7 +450,8 @@ // Save open files for restoring in next session // (even if last session will not be restored next time) // together with encoding and the tab index -void file_editor::save_session () +void +file_editor::save_session () { gui_settings settings; @@ -481,7 +494,8 @@ settings.sync (); } -bool file_editor::check_closing () +bool +file_editor::check_closing () { // When the application or the editor is closing and the user wants to // close all files, in the latter case all editor tabs are checked whether @@ -531,7 +545,8 @@ return true; } -void file_editor::handle_tab_ready_to_close () +void +file_editor::handle_tab_ready_to_close () { if (m_closing_canceled) return; @@ -566,7 +581,8 @@ setVisible (vis); } -void file_editor::request_new_file (const QString& commands) +void +file_editor::request_new_file (const QString& commands) { // Custom editor? If yes, we can only call the editor without passing // some initial contents and even without being sure a new file is opened @@ -583,14 +599,16 @@ activate (); // focus editor and new tab } -void file_editor::request_close_file (bool) +void +file_editor::request_close_file (bool) { file_editor_tab *editor_tab = static_cast<file_editor_tab *> (m_tab_widget->currentWidget ()); editor_tab->conditional_close (); } -void file_editor::request_close_all_files (bool) +void +file_editor::request_close_all_files (bool) { file_editor_tab *editor_tab; @@ -602,7 +620,8 @@ } } -void file_editor::request_close_other_files (bool) +void +file_editor::request_close_other_files (bool) { file_editor_tab *editor_tab; QWidget *tabID = m_tab_widget->currentWidget (); @@ -619,7 +638,8 @@ } } -void file_editor::copy_full_file_path (bool) +void +file_editor::copy_full_file_path (bool) { file_editor_tab *editor_tab = static_cast<file_editor_tab *> (m_tab_widget->currentWidget ()); @@ -629,7 +649,8 @@ } // open a file from the mru list -void file_editor::request_mru_open_file (QAction *action) +void +file_editor::request_mru_open_file (QAction *action) { if (action) { @@ -638,49 +659,58 @@ } } -void file_editor::request_print_file (bool) +void +file_editor::request_print_file (bool) { emit fetab_print_file (m_tab_widget->currentWidget ()); } -void file_editor::request_redo (bool) +void +file_editor::request_redo (bool) { emit fetab_scintilla_command (m_tab_widget->currentWidget (), QsciScintillaBase::SCI_REDO); } -void file_editor::request_cut (bool) +void +file_editor::request_cut (bool) { emit fetab_scintilla_command (m_tab_widget->currentWidget (), QsciScintillaBase::SCI_CUT); } -void file_editor::request_context_help (bool) +void +file_editor::request_context_help (bool) { emit fetab_context_help (m_tab_widget->currentWidget (), false); } -void file_editor::request_context_doc (bool) +void +file_editor::request_context_doc (bool) { emit fetab_context_help (m_tab_widget->currentWidget (), true); } -void file_editor::request_context_edit (bool) +void +file_editor::request_context_edit (bool) { emit fetab_context_edit (m_tab_widget->currentWidget ()); } -void file_editor::request_save_file (bool) +void +file_editor::request_save_file (bool) { emit fetab_save_file (m_tab_widget->currentWidget ()); } -void file_editor::request_save_file_as (bool) +void +file_editor::request_save_file_as (bool) { emit fetab_save_file_as (m_tab_widget->currentWidget ()); } -void file_editor::request_run_file (bool) +void +file_editor::request_run_file (bool) { // The interpreter_event callback function below emits a signal. // Because we don't control when that happens, use a guarded pointer @@ -715,166 +745,196 @@ }); } -void file_editor::request_step_into_file () +void +file_editor::request_step_into_file () { emit fetab_run_file (m_tab_widget->currentWidget (), true); } -void file_editor::request_context_run (bool) +void +file_editor::request_context_run (bool) { emit fetab_context_run (m_tab_widget->currentWidget ()); } -void file_editor::request_toggle_bookmark (bool) +void +file_editor::request_toggle_bookmark (bool) { emit fetab_toggle_bookmark (m_tab_widget->currentWidget ()); } -void file_editor::request_next_bookmark (bool) +void +file_editor::request_next_bookmark (bool) { emit fetab_next_bookmark (m_tab_widget->currentWidget ()); } -void file_editor::request_previous_bookmark (bool) +void +file_editor::request_previous_bookmark (bool) { emit fetab_previous_bookmark (m_tab_widget->currentWidget ()); } -void file_editor::request_remove_bookmark (bool) +void +file_editor::request_remove_bookmark (bool) { emit fetab_remove_bookmark (m_tab_widget->currentWidget ()); } -void file_editor::request_move_match_brace (bool) +void +file_editor::request_move_match_brace (bool) { emit fetab_move_match_brace (m_tab_widget->currentWidget (), false); } -void file_editor::request_sel_match_brace (bool) +void +file_editor::request_sel_match_brace (bool) { emit fetab_move_match_brace (m_tab_widget->currentWidget (), true); } // FIXME: What should this do with conditional breakpoints? -void file_editor::request_toggle_breakpoint (bool) +void +file_editor::request_toggle_breakpoint (bool) { emit fetab_toggle_breakpoint (m_tab_widget->currentWidget ()); } -void file_editor::request_next_breakpoint (bool) +void +file_editor::request_next_breakpoint (bool) { emit fetab_next_breakpoint (m_tab_widget->currentWidget ()); } -void file_editor::request_previous_breakpoint (bool) +void +file_editor::request_previous_breakpoint (bool) { emit fetab_previous_breakpoint (m_tab_widget->currentWidget ()); } -void file_editor::request_remove_breakpoint (bool) +void +file_editor::request_remove_breakpoint (bool) { emit fetab_remove_all_breakpoints (m_tab_widget->currentWidget ()); } // slots for Edit->Commands actions -void file_editor::request_delete_start_word (bool) +void +file_editor::request_delete_start_word (bool) { emit fetab_scintilla_command (m_tab_widget->currentWidget (), QsciScintillaBase::SCI_DELWORDLEFT); } -void file_editor::request_delete_end_word (bool) +void +file_editor::request_delete_end_word (bool) { emit fetab_scintilla_command (m_tab_widget->currentWidget (), QsciScintillaBase::SCI_DELWORDRIGHT); } -void file_editor::request_delete_start_line (bool) +void +file_editor::request_delete_start_line (bool) { emit fetab_scintilla_command (m_tab_widget->currentWidget (), QsciScintillaBase::SCI_DELLINELEFT); } -void file_editor::request_delete_end_line (bool) +void +file_editor::request_delete_end_line (bool) { emit fetab_scintilla_command (m_tab_widget->currentWidget (), QsciScintillaBase::SCI_DELLINERIGHT); } -void file_editor::request_delete_line (bool) +void +file_editor::request_delete_line (bool) { emit fetab_scintilla_command (m_tab_widget->currentWidget (), QsciScintillaBase::SCI_LINEDELETE); } -void file_editor::request_copy_line (bool) +void +file_editor::request_copy_line (bool) { emit fetab_scintilla_command (m_tab_widget->currentWidget (), QsciScintillaBase::SCI_LINECOPY); } -void file_editor::request_cut_line (bool) +void +file_editor::request_cut_line (bool) { emit fetab_scintilla_command (m_tab_widget->currentWidget (), QsciScintillaBase::SCI_LINECUT); } -void file_editor::request_duplicate_selection (bool) +void +file_editor::request_duplicate_selection (bool) { emit fetab_scintilla_command (m_tab_widget->currentWidget (), QsciScintillaBase::SCI_SELECTIONDUPLICATE); } -void file_editor::request_transpose_line (bool) +void +file_editor::request_transpose_line (bool) { emit fetab_scintilla_command (m_tab_widget->currentWidget (), QsciScintillaBase::SCI_LINETRANSPOSE); } -void file_editor::request_comment_selected_text (bool) +void +file_editor::request_comment_selected_text (bool) { emit fetab_comment_selected_text (m_tab_widget->currentWidget (), false); } -void file_editor::request_uncomment_selected_text (bool) +void +file_editor::request_uncomment_selected_text (bool) { emit fetab_uncomment_selected_text (m_tab_widget->currentWidget ()); } -void file_editor::request_comment_var_selected_text (bool) +void +file_editor::request_comment_var_selected_text (bool) { emit fetab_comment_selected_text (m_tab_widget->currentWidget (), true); } // slots for Edit->Format actions -void file_editor::request_upper_case (bool) +void +file_editor::request_upper_case (bool) { emit fetab_scintilla_command (m_tab_widget->currentWidget (), QsciScintillaBase::SCI_UPPERCASE); } -void file_editor::request_lower_case (bool) +void +file_editor::request_lower_case (bool) { emit fetab_scintilla_command (m_tab_widget->currentWidget (), QsciScintillaBase::SCI_LOWERCASE); } -void file_editor::request_indent_selected_text (bool) +void +file_editor::request_indent_selected_text (bool) { emit fetab_indent_selected_text (m_tab_widget->currentWidget ()); } -void file_editor::request_unindent_selected_text (bool) +void +file_editor::request_unindent_selected_text (bool) { emit fetab_unindent_selected_text (m_tab_widget->currentWidget ()); } -void file_editor::request_smart_indent_line_or_selected_text () +void +file_editor::request_smart_indent_line_or_selected_text () { emit fetab_smart_indent_line_or_selected_text (m_tab_widget->currentWidget ()); } -void file_editor::request_conv_eol_windows (bool) +void +file_editor::request_conv_eol_windows (bool) { emit fetab_convert_eol (m_tab_widget->currentWidget (), QsciScintilla::EolWindows); @@ -886,14 +946,16 @@ QsciScintilla::EolUnix); } -void file_editor::request_conv_eol_mac (bool) +void +file_editor::request_conv_eol_mac (bool) { emit fetab_convert_eol (m_tab_widget->currentWidget (), QsciScintilla::EolMac); } // Slot for initially creating and showing the find dialog -void file_editor::request_find (bool) +void +file_editor::request_find (bool) { // Create the dialog find_create (); @@ -909,7 +971,8 @@ // This method creates the find dialog. -void file_editor::find_create () +void +file_editor::find_create () { if (m_find_dialog) m_find_dialog->close (); @@ -959,31 +1022,36 @@ m_find_dialog->set_visible (true); } -void file_editor::request_find_next (bool) +void +file_editor::request_find_next (bool) { if (m_find_dialog) m_find_dialog->find_next (); } -void file_editor::request_find_previous (bool) +void +file_editor::request_find_previous (bool) { if (m_find_dialog) m_find_dialog->find_prev (); } -void file_editor::request_goto_line (bool) +void +file_editor::request_goto_line (bool) { emit fetab_goto_line (m_tab_widget->currentWidget ()); } -void file_editor::request_completion (bool) +void +file_editor::request_completion (bool) { emit fetab_completion (m_tab_widget->currentWidget ()); } -void file_editor::handle_file_name_changed (const QString& fname, - const QString& tip, - bool modified) +void +file_editor::handle_file_name_changed (const QString& fname, + const QString& tip, + bool modified) { QObject *fileEditorTab = sender (); if (fileEditorTab) @@ -1009,7 +1077,8 @@ } } -void file_editor::handle_tab_close_request (int index) +void +file_editor::handle_tab_close_request (int index) { file_editor_tab *editor_tab = static_cast<file_editor_tab *> (m_tab_widget->widget (index)); @@ -1042,15 +1111,17 @@ } // context menu of edit area -void file_editor::active_tab_changed (int index) +void +file_editor::active_tab_changed (int index) { emit fetab_change_request (m_tab_widget->widget (index)); activate (); } -void file_editor::handle_editor_state_changed (bool copy_available, - bool is_octave_file, - bool is_modified) +void +file_editor::handle_editor_state_changed (bool copy_available, + bool is_octave_file, + bool is_modified) { // In case there is some scenario where traffic could be coming from // all the file editor tabs, just process info from the current active tab. @@ -1075,8 +1146,9 @@ m_undo_action_enabled = m_undo_action->isEnabled (); } -void file_editor::handle_mru_add_file (const QString& file_name, - const QString& encoding) +void +file_editor::handle_mru_add_file (const QString& file_name, + const QString& encoding) { int index; while ((index = m_mru_files.indexOf (file_name)) >= 0) @@ -1091,8 +1163,9 @@ mru_menu_update (); } -void file_editor::check_conflict_save (const QString& saveFileName, - bool remove_on_success) +void +file_editor::check_conflict_save (const QString& saveFileName, + bool remove_on_success) { // Check whether this file is already open in the editor. file_editor_tab *tab = find_tab_widget (saveFileName); @@ -1151,14 +1224,16 @@ emit fetab_save_file (saveFileWidget, saveFileName, remove_on_success); } -void file_editor::handle_insert_debugger_pointer_request (const QString& file, - int line) +void +file_editor::handle_insert_debugger_pointer_request (const QString& file, + int line) { request_open_file (file, QString (), line, true); // default encoding } -void file_editor::handle_delete_debugger_pointer_request (const QString& file, - int line) +void +file_editor::handle_delete_debugger_pointer_request (const QString& file, + int line) { if (! file.isEmpty ()) { @@ -1177,23 +1252,26 @@ } } -void file_editor::handle_update_breakpoint_marker_request (bool insert, - const QString& file, - int line, - const QString& cond) +void +file_editor::handle_update_breakpoint_marker_request (bool insert, + const QString& file, + int line, + const QString& cond) { request_open_file (file, QString (), line, false, true, insert, cond); } -void file_editor::handle_edit_file_request (const QString& file) +void +file_editor::handle_edit_file_request (const QString& file) { request_open_file (file); } // Slot used for signals indicating that a file was changed/renamed or // is going to be deleted/renamed -void file_editor::handle_file_remove (const QString& old_name, - const QString& new_name) +void +file_editor::handle_file_remove (const QString& old_name, + const QString& new_name) { // Clear old list of file data and declare a structure for file data m_tmp_closed_files.clear (); @@ -1255,7 +1333,8 @@ } // Slot for signal indicating that a file was renamed -void file_editor::handle_file_renamed (bool load_new) +void +file_editor::handle_file_renamed (bool load_new) { m_no_focus = true; // Remember for not focussing editor @@ -1286,7 +1365,8 @@ m_tmp_closed_files.clear (); } -void file_editor::notice_settings () +void +file_editor::notice_settings () { gui_settings settings; @@ -1393,7 +1473,8 @@ emit fetab_settings_changed (); } -void file_editor::set_shortcuts () +void +file_editor::set_shortcuts () { // Shortcuts also available in the main window, as well as the related // shortcuts, are defined in main_window and added to the editor @@ -1487,7 +1568,8 @@ // This slot is a reimplementation of the virtual slot in octave_dock_widget. // We need this for creating an empty script when the editor has no open // files and is made visible. -void file_editor::handle_visibility (bool visible) +void +file_editor::handle_visibility (bool visible) { octave_dock_widget::handle_visibility (visible); @@ -1506,7 +1588,8 @@ // This slot is a reimplementation of the virtual slot in octave_dock_widget. // We need this for updating the parent of the find dialog -void file_editor::toplevel_change (bool) +void +file_editor::toplevel_change (bool) { if (m_find_dialog) { @@ -1519,34 +1602,39 @@ } } -void file_editor::update_octave_directory (const QString& dir) +void +file_editor::update_octave_directory (const QString& dir) { m_ced = dir; emit fetab_set_directory (m_ced); // for save dialog } -void file_editor::copyClipboard () +void +file_editor::copyClipboard () { if (editor_tab_has_focus ()) emit fetab_scintilla_command (m_tab_widget->currentWidget (), QsciScintillaBase::SCI_COPY); } -void file_editor::pasteClipboard () +void +file_editor::pasteClipboard () { if (editor_tab_has_focus ()) emit fetab_scintilla_command (m_tab_widget->currentWidget (), QsciScintillaBase::SCI_PASTE); } -void file_editor::selectAll () +void +file_editor::selectAll () { if (editor_tab_has_focus ()) emit fetab_scintilla_command (m_tab_widget->currentWidget (), QsciScintillaBase::SCI_SELECTALL); } -void file_editor::do_undo () +void +file_editor::do_undo () { if (editor_tab_has_focus ()) emit fetab_scintilla_command (m_tab_widget->currentWidget (), @@ -1555,12 +1643,13 @@ // Open a file, if not already open, and mark the current execution location // and/or a breakpoint with condition cond. -void file_editor::request_open_file (const QString& openFileName, - const QString& encoding, - int line, bool debug_pointer, - bool breakpoint_marker, bool insert, - const QString& cond, int index, - const QString& bookmarks) +void +file_editor::request_open_file (const QString& openFileName, + const QString& encoding, + int line, bool debug_pointer, + bool breakpoint_marker, bool insert, + const QString& cond, int index, + const QString& bookmarks) { gui_settings settings; @@ -1761,72 +1850,86 @@ } } -void file_editor::request_preferences (bool) +void +file_editor::request_preferences (bool) { emit request_settings_dialog ("editor"); } -void file_editor::request_styles_preferences (bool) +void +file_editor::request_styles_preferences (bool) { emit request_settings_dialog ("editor_styles"); } -void file_editor::show_line_numbers (bool) +void +file_editor::show_line_numbers (bool) { toggle_preference (ed_show_line_numbers); } -void file_editor::show_white_space (bool) +void +file_editor::show_white_space (bool) { toggle_preference (ed_show_white_space); } -void file_editor::show_eol_chars (bool) +void +file_editor::show_eol_chars (bool) { toggle_preference (ed_show_eol_chars); } -void file_editor::show_indent_guides (bool) +void +file_editor::show_indent_guides (bool) { toggle_preference (ed_show_indent_guides); } -void file_editor::show_long_line (bool) +void +file_editor::show_long_line (bool) { toggle_preference (ed_long_line_marker); } -void file_editor::show_toolbar (bool) +void +file_editor::show_toolbar (bool) { toggle_preference (ed_show_toolbar); } -void file_editor::show_statusbar (bool) +void +file_editor::show_statusbar (bool) { toggle_preference (ed_show_edit_status_bar); } -void file_editor::show_hscrollbar (bool) +void +file_editor::show_hscrollbar (bool) { toggle_preference (ed_show_hscroll_bar); } -void file_editor::zoom_in (bool) +void +file_editor::zoom_in (bool) { emit fetab_zoom_in (m_tab_widget->currentWidget ()); } -void file_editor::zoom_out (bool) +void +file_editor::zoom_out (bool) { emit fetab_zoom_out (m_tab_widget->currentWidget ()); } -void file_editor::zoom_normal (bool) +void +file_editor::zoom_normal (bool) { emit fetab_zoom_normal (m_tab_widget->currentWidget ()); } -void file_editor::create_context_menu (QMenu *menu) +void +file_editor::create_context_menu (QMenu *menu) { // remove all standard actions from scintilla QList<QAction *> all_actions = menu->actions (); @@ -1853,7 +1956,8 @@ menu->addAction (m_run_selection_action); } -void file_editor::edit_status_update (bool undo, bool redo) +void +file_editor::edit_status_update (bool undo, bool redo) { if (m_undo_action) m_undo_action->setEnabled (undo); @@ -1861,7 +1965,8 @@ } // handler for the close event -void file_editor::closeEvent (QCloseEvent *e) +void +file_editor::closeEvent (QCloseEvent *e) { gui_settings settings; @@ -1887,7 +1992,8 @@ octave_dock_widget::closeEvent (e); } -void file_editor::dragEnterEvent (QDragEnterEvent *e) +void +file_editor::dragEnterEvent (QDragEnterEvent *e) { if (e->mimeData ()->hasUrls ()) { @@ -1895,7 +2001,8 @@ } } -void file_editor::dropEvent (QDropEvent *e) +void +file_editor::dropEvent (QDropEvent *e) { if (e->mimeData ()->hasUrls ()) { @@ -1904,7 +2011,8 @@ } } -bool file_editor::is_editor_console_tabbed () +bool +file_editor::is_editor_console_tabbed () { // FIXME: is there a way to do this job that doesn't require casting // the parent to a main_window object? @@ -1927,7 +2035,8 @@ return false; } -void file_editor::construct () +void +file_editor::construct () { QWidget *editor_widget = new QWidget (this); @@ -2417,7 +2526,8 @@ } // Slot when autocompletion list was cancelled -void file_editor::handle_autoc_cancelled () +void +file_editor::handle_autoc_cancelled () { // List was cancelled but somehow still active and blocking the // edit area from accepting shortcuts. Only after another keypress @@ -2441,7 +2551,8 @@ qsci->undo (); } -file_editor_tab *file_editor::reset_focus () +file_editor_tab * +file_editor::reset_focus () { // Reset the focus of the tab and the related edit area file_editor_tab *f @@ -2650,8 +2761,9 @@ return f; } -void file_editor::add_file_editor_tab (file_editor_tab *f, const QString& fn, - int index) +void +file_editor::add_file_editor_tab (file_editor_tab *f, const QString& fn, + int index) { if (index == -1) m_tab_widget->addTab (f, fn); @@ -2663,7 +2775,8 @@ check_actions (); } -void file_editor::mru_menu_update () +void +file_editor::mru_menu_update () { int num_files = qMin (m_mru_files.size (), int (MaxMRUFiles)); @@ -2702,14 +2815,15 @@ settings.sync (); } -bool file_editor::call_custom_editor (const QString& file_name, int line) +bool +file_editor::call_custom_editor (const QString& file_name, int line) { // Check if the user wants to use a custom file editor. gui_settings settings; if (settings.value (global_use_custom_editor.settings_key (), - global_use_custom_editor.def ()).toBool ()) + global_use_custom_editor.def ()).toBool ()) { // use the external editor interface for handling the call emit request_open_file_external (file_name, line); @@ -2724,7 +2838,8 @@ return false; } -void file_editor::toggle_preference (const gui_pref& preference) +void +file_editor::toggle_preference (const gui_pref& preference) { gui_settings settings; @@ -2734,8 +2849,9 @@ } // Function for closing the files in a removed directory -void file_editor::handle_dir_remove (const QString& old_name, - const QString& new_name) +void +file_editor::handle_dir_remove (const QString& old_name, + const QString& new_name) { QDir old_dir (old_name); removed_file_data f_data; @@ -2802,7 +2918,8 @@ } } -bool file_editor::editor_tab_has_focus () +bool +file_editor::editor_tab_has_focus () { QWidget *foc_w = focusWidget (); if (foc_w && foc_w->inherits ("octave::octave_qscintilla")) @@ -2811,7 +2928,8 @@ } // Check whether this file is already open in the editor. -file_editor_tab *file_editor::find_tab_widget (const QString& file) +file_editor_tab * +file_editor::find_tab_widget (const QString& file) { std::string std_file = file.toStdString (); @@ -2835,16 +2953,18 @@ return nullptr; } -QAction * file_editor::add_action (QMenu *menu, const QString& text, - const char *member, - QWidget *receiver) +QAction * +file_editor::add_action (QMenu *menu, const QString& text, + const char *member, + QWidget *receiver) { return add_action (menu, QIcon (), text, member, receiver); } -QAction * file_editor::add_action (QMenu *menu, const QIcon& icon, - const QString& text, const char *member, - QWidget *receiver) +QAction * +file_editor::add_action (QMenu *menu, const QIcon& icon, + const QString& text, const char *member, + QWidget *receiver) { QAction *a; QWidget *r = this; @@ -2866,7 +2986,8 @@ return a; } -QMenu* file_editor::add_menu (QMenuBar *p, QString name) +QMenu * +file_editor::add_menu (QMenuBar *p, QString name) { QMenu *menu = p->addMenu (name);
--- a/libgui/src/m-editor/find-dialog.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/m-editor/find-dialog.cc Fri Dec 22 12:14:08 2023 -0500 @@ -108,9 +108,9 @@ m_replace_line_edit->completer ()->setCaseSensitivity (Qt::CaseSensitive); m_replace_label->setBuddy (m_replace_line_edit); - int width = QFontMetrics (m_search_line_edit->font ()).averageCharWidth(); - m_search_line_edit->setFixedWidth (20*width); - m_replace_line_edit->setFixedWidth (20*width); + int width = QFontMetrics (m_search_line_edit->font ()).averageCharWidth(); + m_search_line_edit->setFixedWidth (20*width); + m_replace_line_edit->setFixedWidth (20*width); m_case_check_box = new QCheckBox (tr ("Match &case")); m_from_start_check_box = new QCheckBox (tr ("Search from &start")); @@ -203,7 +203,8 @@ } // The edit_area has changed: update relevant data of the file dialog -void find_dialog::update_edit_area (octave_qscintilla *edit_area) +void +find_dialog::update_edit_area (octave_qscintilla *edit_area) { m_edit_area = edit_area; m_search_selection_check_box->setEnabled (edit_area->hasSelectedText ()); @@ -213,7 +214,8 @@ Qt::UniqueConnection); } -void find_dialog::save_settings () +void +find_dialog::save_settings () { gui_settings settings; @@ -260,7 +262,8 @@ settings.sync (); } -void find_dialog::restore_settings (QPoint ed_bottom_right) +void +find_dialog::restore_settings (QPoint ed_bottom_right) { gui_settings settings; @@ -305,7 +308,8 @@ } // set text of "search from start" depending on backward search -void find_dialog::handle_backward_search_changed (int backward) +void +find_dialog::handle_backward_search_changed (int backward) { if (backward) m_from_start_check_box->setText (tr ("Search from end")); @@ -314,7 +318,8 @@ } // search text has changed: reset the search -void find_dialog::handle_search_text_changed () +void +find_dialog::handle_search_text_changed () { // Return if nothing has changed if (m_search_line_edit->currentText () == m_search_line_edit->itemText (0)) @@ -327,7 +332,8 @@ } // replaced text has changed: reset the search -void find_dialog::handle_replace_text_changed () +void +find_dialog::handle_replace_text_changed () { // Return if nothing has changed if (m_replace_line_edit->currentText () == m_replace_line_edit->itemText (0)) @@ -337,7 +343,8 @@ } // Update the mru list -void find_dialog::mru_update (QComboBox *mru) +void +find_dialog::mru_update (QComboBox *mru) { // Remove possible empty entries from the mru list int index; @@ -363,13 +370,15 @@ mru->setCurrentIndex (0); } -void find_dialog::handle_sel_search_changed (int selected) +void +find_dialog::handle_sel_search_changed (int selected) { m_from_start_check_box->setEnabled (! selected); m_find_result_available = false; } -void find_dialog::handle_selection_changed (bool has_selected) +void +find_dialog::handle_selection_changed (bool has_selected) { if (m_rep_active) return; @@ -379,7 +388,8 @@ } // initialize search text with selected text if this is in one single line -void find_dialog::init_search_text () +void +find_dialog::init_search_text () { if (m_edit_area && m_edit_area->hasSelectedText ()) { @@ -398,17 +408,20 @@ m_find_next_button->setDefault (true); } -void find_dialog::find_next () +void +find_dialog::find_next () { find (! m_backward_check_box->isChecked ()); } -void find_dialog::find_prev () +void +find_dialog::find_prev () { find (m_backward_check_box->isChecked ()); } -void find_dialog::find (bool forward) +void +find_dialog::find (bool forward) { if (! m_edit_area) return; @@ -561,7 +574,8 @@ } -void find_dialog::do_replace () +void +find_dialog::do_replace () { if (m_edit_area) { @@ -580,7 +594,8 @@ } } -void find_dialog::replace () +void +find_dialog::replace () { if (m_edit_area) { @@ -594,7 +609,8 @@ } } -void find_dialog::replace_all () +void +find_dialog::replace_all () { int line, col; @@ -629,19 +645,22 @@ } } -void find_dialog::no_matches_message () +void +find_dialog::no_matches_message () { QMessageBox msg_box (QMessageBox::Information, tr ("Find Result"), tr ("No more matches found"), QMessageBox::Ok, this); msg_box.exec (); } -void find_dialog::reject () +void +find_dialog::reject () { close (); } -void find_dialog::closeEvent (QCloseEvent *e) +void +find_dialog::closeEvent (QCloseEvent *e) { save_settings (); e->accept (); @@ -649,7 +668,8 @@ // Show and hide with (re-)storing position, otherwise there is always // a small shift each time the dialog is shown again -void find_dialog::set_visible (bool visible) +void +find_dialog::set_visible (bool visible) { if (visible) {
--- a/libgui/src/m-editor/marker.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/m-editor/marker.cc Fri Dec 22 12:14:08 2023 -0500 @@ -36,7 +36,7 @@ marker::marker (QsciScintilla *area, int original_linenr, editor_markers type, int editor_linenr, const QString& condition) -: QObject () + : QObject () { construct (area, original_linenr, type, editor_linenr, condition); } @@ -48,9 +48,10 @@ construct (area, original_linenr, type, original_linenr - 1, condition); } -void marker::construct (QsciScintilla *area, int original_linenr, - editor_markers type, int editor_linenr, - const QString& condition) +void +marker::construct (QsciScintilla *area, int original_linenr, + editor_markers type, int editor_linenr, + const QString& condition) { m_edit_area = area; m_original_linenr = original_linenr; @@ -59,7 +60,8 @@ m_condition = condition; } -void marker::handle_remove_via_original_linenr (int linenr) +void +marker::handle_remove_via_original_linenr (int linenr) { if (m_original_linenr == linenr) { @@ -68,7 +70,8 @@ } } -void marker::handle_request_remove_via_editor_linenr (int linenr) +void +marker::handle_request_remove_via_editor_linenr (int linenr) { // Get line number from the edit area and if it matches // the requested line number, remove. @@ -81,14 +84,16 @@ } } -void marker::handle_remove () +void +marker::handle_remove () { m_edit_area->markerDeleteHandle (m_mhandle); delete this; } -void marker::handle_find_translation (int linenr, int& translation_linenr, - marker *&bp) +void +marker::handle_find_translation (int linenr, int& translation_linenr, + marker *&bp) { if (m_original_linenr == linenr) { @@ -97,8 +102,9 @@ } } -void marker::handle_find_just_before (int linenr, int& original_linenr, - int& editor_linenr) +void +marker::handle_find_just_before (int linenr, int& original_linenr, + int& editor_linenr) { if (m_original_linenr < linenr && m_original_linenr >= original_linenr) { @@ -107,8 +113,9 @@ } } -void marker::handle_find_just_after (int linenr, int& original_linenr, - int& editor_linenr) +void +marker::handle_find_just_after (int linenr, int& original_linenr, + int& editor_linenr) { if (m_original_linenr > linenr && m_original_linenr <= original_linenr) { @@ -117,14 +124,15 @@ } } -void marker::handle_report_editor_linenr (QIntList& lines, - QStringList& conditions) +void +marker::handle_report_editor_linenr (QIntList& lines, QStringList& conditions) { lines << m_edit_area->markerLine (m_mhandle); conditions << m_condition; } -void marker::handle_marker_line_deleted (int mhandle) +void +marker::handle_marker_line_deleted (int mhandle) { // FUTURE SUPPORT: There really should be a signal in QsciScintilla // called markerLineDeleted (int mhandle) because there is no way @@ -144,7 +152,8 @@ } } -void marker::handle_marker_line_undeleted (int mhandle) +void +marker::handle_marker_line_undeleted (int mhandle) { // FUTURE SUPPORT: There really should be a signal in QsciScintilla // called markerLineUndeleted (int mhandle) because there is no way
--- a/libgui/src/m-editor/marker.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/m-editor/marker.h Fri Dec 22 12:14:08 2023 -0500 @@ -51,15 +51,15 @@ // If multiple markers are on the same line, the first one listed // is drawn at the back, so big ones should be first. enum editor_markers - { - breakpoint, - cond_break, - unsure_breakpoint, - bookmark, - debugger_position, - unsure_debugger_position, - selection - }; + { + breakpoint, + cond_break, + unsure_breakpoint, + bookmark, + debugger_position, + unsure_debugger_position, + selection + }; marker (QsciScintilla *edit_area, int original_linenr, editor_markers marker_type, const QString& condition = "");
--- a/libgui/src/m-editor/octave-qscintilla.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/m-editor/octave-qscintilla.cc Fri Dec 22 12:14:08 2023 -0500 @@ -232,13 +232,15 @@ emit status_update (isUndoAvailable (), isRedoAvailable ()); } -void octave_qscintilla::setCursorPosition (int line, int col) +void +octave_qscintilla::setCursorPosition (int line, int col) { QsciScintilla::setCursorPosition (line, col); emit update_rowcol_indicator_signal (line, col); } -void octave_qscintilla::set_selection_marker_color (const QColor& c) +void +octave_qscintilla::set_selection_marker_color (const QColor& c) { QColor ic = c; ic.setAlphaF (0.45); @@ -250,7 +252,8 @@ } // context menu requested -void octave_qscintilla::contextMenuEvent (QContextMenuEvent *e) +void +octave_qscintilla::contextMenuEvent (QContextMenuEvent *e) { #if defined (HAVE_QSCI_VERSION_2_6_0) QPoint global_pos, local_pos; // the menu's position @@ -333,7 +336,8 @@ } // common function with flag for documentation -void octave_qscintilla::contextmenu_help_doc (bool documentation) +void +octave_qscintilla::contextmenu_help_doc (bool documentation) { if (documentation) { @@ -352,14 +356,16 @@ } // call edit the function related to the current word -void octave_qscintilla::context_edit () +void +octave_qscintilla::context_edit () { if (get_actual_word ()) contextmenu_edit (true); } // call edit the function related to the current word -void octave_qscintilla::context_run () +void +octave_qscintilla::context_run () { if (hasSelectedText ()) { @@ -371,8 +377,9 @@ } } -void octave_qscintilla::get_global_textcursor_pos (QPoint *global_pos, - QPoint *local_pos) +void +octave_qscintilla::get_global_textcursor_pos (QPoint *global_pos, + QPoint *local_pos) { long position = SendScintilla (SCI_GETCURRENTPOS); long point_x = SendScintilla (SCI_POINTXFROMPOSITION, 0, position); @@ -382,7 +389,8 @@ } // determine the actual word and whether we are in an octave or matlab script -bool octave_qscintilla::get_actual_word () +bool +octave_qscintilla::get_actual_word () { QPoint global_pos, local_pos; get_global_textcursor_pos (&global_pos, &local_pos); @@ -393,7 +401,8 @@ } // helper function for clearing all indicators of a specific style -void octave_qscintilla::clear_selection_markers () +void +octave_qscintilla::clear_selection_markers () { int end_pos = text ().length (); int end_line, end_col; @@ -403,7 +412,8 @@ markerDeleteAll (marker::selection); } -QString octave_qscintilla::eol_string () +QString +octave_qscintilla::eol_string () { switch (eolMode ()) { @@ -421,7 +431,8 @@ // Function returning the true cursor position where the tab length // is taken into account. -void octave_qscintilla::get_current_position (int *pos, int *line, int *col) +void +octave_qscintilla::get_current_position (int *pos, int *line, int *col) { *pos = SendScintilla (QsciScintillaBase::SCI_GETCURRENTPOS); *line = SendScintilla (QsciScintillaBase::SCI_LINEFROMPOSITION, *pos); @@ -429,7 +440,8 @@ } // Function returning the comment string of the current lexer -QStringList octave_qscintilla::comment_string (bool comment) +QStringList +octave_qscintilla::comment_string (bool comment) { int lexer = SendScintilla (SCI_GETLEXER); @@ -494,7 +506,8 @@ } // provide the style at a specific position -int octave_qscintilla::get_style (int pos) +int +octave_qscintilla::get_style (int pos) { int position; if (pos < 0) @@ -507,7 +520,8 @@ } // Is a specific cursor position in a line or block comment? -int octave_qscintilla::is_style_comment (int pos) +int +octave_qscintilla::is_style_comment (int pos) { int lexer = SendScintilla (QsciScintillaBase::SCI_GETLEXER); int style = get_style (pos); @@ -549,8 +563,9 @@ } // Do smart indentation after if, for, ... -void octave_qscintilla::smart_indent (bool do_smart_indent, int do_auto_close, - int line, int ind_char_width) +void +octave_qscintilla::smart_indent (bool do_smart_indent, int do_auto_close, + int line, int ind_char_width) { QString prevline = text (line); @@ -665,8 +680,9 @@ } // Do smart indentation of current selection or line. -void octave_qscintilla::smart_indent_line_or_selected_text (int lineFrom, - int lineTo) +void +octave_qscintilla::smart_indent_line_or_selected_text (int lineFrom, + int lineTo) { QRegularExpression blank_line_regexp {"^[\t ]*$"}; @@ -787,7 +803,8 @@ } } -void octave_qscintilla::set_word_selection (const QString& word) +void +octave_qscintilla::set_word_selection (const QString& word) { m_selection = word; @@ -809,7 +826,8 @@ } } -void octave_qscintilla::show_selection_markers (int l1, int c1, int l2, int c2) +void +octave_qscintilla::show_selection_markers (int l1, int c1, int l2, int c2) { fillIndicatorRange (l1, c1, l2, c2, m_indicator_id); @@ -817,28 +835,33 @@ markerAdd (l1, marker::selection); } -void octave_qscintilla::contextmenu_help (bool) +void +octave_qscintilla::contextmenu_help (bool) { contextmenu_help_doc (false); } -void octave_qscintilla::contextmenu_doc (bool) +void +octave_qscintilla::contextmenu_doc (bool) { contextmenu_help_doc (true); } -void octave_qscintilla::context_help_doc (bool documentation) +void +octave_qscintilla::context_help_doc (bool documentation) { if (get_actual_word ()) contextmenu_help_doc (documentation); } -void octave_qscintilla::contextmenu_edit (bool) +void +octave_qscintilla::contextmenu_edit (bool) { emit context_menu_edit_signal (m_word_at_cursor); } -void octave_qscintilla::contextmenu_run_temp_error () +void +octave_qscintilla::contextmenu_run_temp_error () { QMessageBox::critical (this, tr ("Octave Editor"), tr ("Creating temporary files failed.\n" @@ -847,7 +870,8 @@ "\"Run Selection\" requires temporary files.").arg (QDir::tempPath ())); } -void octave_qscintilla::contextmenu_run (bool) +void +octave_qscintilla::contextmenu_run (bool) { // Take selected code and extend it by commands for echoing each // evaluated line and for adding the line to the history (use script) @@ -1090,7 +1114,8 @@ // wrappers for dbstop related context menu items // FIXME: Why can't the data be sent as the argument to the function??? -void octave_qscintilla::contextmenu_break_condition (bool) +void +octave_qscintilla::contextmenu_break_condition (bool) { #if defined (HAVE_QSCI_VERSION_2_6_0) QAction *action = qobject_cast<QAction *>(sender ()); @@ -1104,7 +1129,8 @@ #endif } -void octave_qscintilla::contextmenu_break_once (const QPoint& local_pos) +void +octave_qscintilla::contextmenu_break_once (const QPoint& local_pos) { #if defined (HAVE_QSCI_VERSION_2_6_0) emit context_menu_break_once (lineAt (local_pos)); @@ -1113,12 +1139,14 @@ #endif } -void octave_qscintilla::text_changed () +void +octave_qscintilla::text_changed () { emit status_update (isUndoAvailable (), isRedoAvailable ()); } -void octave_qscintilla::cursor_position_changed (int line, int col) +void +octave_qscintilla::cursor_position_changed (int line, int col) { // Clear the selection if we move away from it. We have to check the // position, because we allow entering text at the point of the @@ -1131,14 +1159,16 @@ } // when edit area gets focus update information on undo/redo actions -void octave_qscintilla::focusInEvent (QFocusEvent *focusEvent) +void +octave_qscintilla::focusInEvent (QFocusEvent *focusEvent) { emit status_update (isUndoAvailable (), isRedoAvailable ()); QsciScintilla::focusInEvent (focusEvent); } -void octave_qscintilla::show_replace_action_tooltip () +void +octave_qscintilla::show_replace_action_tooltip () { int pos; get_current_position (&pos, &m_selection_line, &m_selection_col); @@ -1167,8 +1197,9 @@ QToolTip::showText (global_pos, msg); } -void octave_qscintilla::replace_all (const QString& o_str, const QString& n_str, - bool re, bool cs, bool wo) +void +octave_qscintilla::replace_all (const QString& o_str, const QString& n_str, + bool re, bool cs, bool wo) { // get the resulting cursor position int pos, line, col, nline, ncol; @@ -1208,7 +1239,8 @@ setCursorPosition (line, col); } -bool octave_qscintilla::event (QEvent *e) +bool +octave_qscintilla::event (QEvent *e) { if (m_debug_mode && e->type() == QEvent::ToolTip) { @@ -1226,7 +1258,8 @@ return QsciScintilla::event(e); } -void octave_qscintilla::keyPressEvent (QKeyEvent *key_event) +void +octave_qscintilla::keyPressEvent (QKeyEvent *key_event) { if (m_selection.isEmpty ()) QsciScintilla::keyPressEvent (key_event); @@ -1283,8 +1316,9 @@ } } -void octave_qscintilla::auto_close (int auto_endif, int linenr, - const QString& line, QString& first_word) +void +octave_qscintilla::auto_close (int auto_endif, int linenr, + const QString& line, QString& first_word) { // Insert an "end" for an "if" etc., if needed. // (Use of "while" allows "return" to skip the rest. @@ -1367,7 +1401,8 @@ setIndentation (linenr + 2, indentation (linenr)); } -void octave_qscintilla::dragEnterEvent (QDragEnterEvent *e) +void +octave_qscintilla::dragEnterEvent (QDragEnterEvent *e) { // if is not dragging a url, pass to qscintilla to handle, // otherwise ignore it so that it will be handled by @@ -1382,12 +1417,14 @@ } } -void octave_qscintilla::handle_enter_debug_mode () +void +octave_qscintilla::handle_enter_debug_mode () { m_debug_mode = true; } -void octave_qscintilla::handle_exit_debug_mode () +void +octave_qscintilla::handle_exit_debug_mode () { m_debug_mode = false; }
--- a/libgui/src/m-editor/octave-qscintilla.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/m-editor/octave-qscintilla.h Fri Dec 22 12:14:08 2023 -0500 @@ -50,11 +50,11 @@ ~octave_qscintilla () = default; enum - { - ST_NONE = 0, - ST_LINE_COMMENT, - ST_BLOCK_COMMENT - }; + { + ST_NONE = 0, + ST_LINE_COMMENT, + ST_BLOCK_COMMENT + }; virtual void contextMenuEvent (QContextMenuEvent *e); virtual void setCursorPosition (int line, int col);
--- a/libgui/src/m-editor/octave-txt-lexer.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/m-editor/octave-txt-lexer.cc Fri Dec 22 12:14:08 2023 -0500 @@ -43,12 +43,14 @@ return QString (); }; -const char * octave_txt_lexer::language () const +const char * +octave_txt_lexer::language () const { return "Text"; } -const char * octave_txt_lexer::lexer () const +const char * +octave_txt_lexer::lexer () const { return "text"; }
--- a/libgui/src/main-window.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/main-window.cc Fri Dec 22 12:14:08 2023 -0500 @@ -200,7 +200,8 @@ main_window::~main_window () { } -void main_window::adopt_dock_widgets () +void +main_window::adopt_dock_widgets () { adopt_terminal_widget (); adopt_documentation_widget (); @@ -213,7 +214,8 @@ m_previous_dock = m_command_window; } -void main_window::adopt_terminal_widget () +void +main_window::adopt_terminal_widget () { m_command_window = m_octave_qobj.terminal_widget (this); @@ -271,14 +273,16 @@ } } -void main_window::adopt_documentation_widget () +void +main_window::adopt_documentation_widget () { m_doc_browser_window = m_octave_qobj.documentation_widget (this); make_dock_widget_connections (m_doc_browser_window); } -void main_window::adopt_file_browser_widget () +void +main_window::adopt_file_browser_widget () { m_file_browser_window = m_octave_qobj.file_browser_widget (this); @@ -306,7 +310,8 @@ this, &main_window::find_files); } -void main_window::adopt_history_widget () +void +main_window::adopt_history_widget () { m_history_window = m_octave_qobj.history_widget (this); @@ -319,7 +324,8 @@ this, &main_window::execute_command_in_terminal); } -void main_window::adopt_workspace_widget () +void +main_window::adopt_workspace_widget () { m_workspace_window = m_octave_qobj.workspace_widget (this); @@ -329,7 +335,8 @@ this, &main_window::execute_command_in_terminal); } -void main_window::adopt_editor_widget () +void +main_window::adopt_editor_widget () { interpreter_qobject *interp_qobj = m_octave_qobj.interpreter_qobj (); @@ -437,14 +444,16 @@ m_active_editor, SLOT (handle_edit_file_request (const QString&))); } -void main_window::adopt_variable_editor_widget () +void +main_window::adopt_variable_editor_widget () { m_variable_editor_window = m_octave_qobj.variable_editor_widget (this); make_dock_widget_connections (m_variable_editor_window); } -void main_window::make_dock_widget_connections (octave_dock_widget *dw) +void +main_window::make_dock_widget_connections (octave_dock_widget *dw) { connect (this, &main_window::init_window_menu, dw, &octave_dock_widget::init_window_menu_entry); @@ -468,17 +477,20 @@ dw, &octave_dock_widget::save_settings); } -bool main_window::command_window_has_focus () const +bool +main_window::command_window_has_focus () const { return m_command_window->has_focus (); } -void main_window::focus_command_window () +void +main_window::focus_command_window () { m_command_window->activate (); } -void main_window::focus_window (const QString& win_name) +void +main_window::focus_window (const QString& win_name) { if (win_name == "command") m_command_window->activate (); @@ -490,7 +502,8 @@ m_file_browser_window->activate (); } -bool main_window::confirm_shutdown () +bool +main_window::confirm_shutdown () { bool closenow = true; @@ -518,7 +531,8 @@ } // catch focus changes and determine the active dock widget -void main_window::focus_changed (QWidget *, QWidget *new_widget) +void +main_window::focus_changed (QWidget *, QWidget *new_widget) { // If there is no new widget or the new widget is a menu bar // (when pressing <alt>), we can return immediately and reset the @@ -631,17 +645,20 @@ } } -void main_window::request_reload_settings () +void +main_window::request_reload_settings () { emit settings_changed (); } -void main_window::report_status_message (const QString& statusMessage) +void +main_window::report_status_message (const QString& statusMessage) { m_status_bar->showMessage (statusMessage, 1000); } -void main_window::handle_save_workspace_request () +void +main_window::handle_save_workspace_request () { // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved. int opts = 0; // No options by default. @@ -667,7 +684,8 @@ } } -void main_window::handle_load_workspace_request (const QString& file_arg) +void +main_window::handle_load_workspace_request (const QString& file_arg) { // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved. int opts = 0; // No options by default. @@ -701,7 +719,8 @@ } } -void main_window::handle_open_any_request (const QString& file_arg) +void +main_window::handle_open_any_request (const QString& file_arg) { if (! file_arg.isEmpty ()) { @@ -725,7 +744,8 @@ } } -void main_window::handle_clear_workspace_request () +void +main_window::handle_clear_workspace_request () { emit interpreter_event ([] (interpreter& interp) @@ -736,7 +756,8 @@ }); } -void main_window::handle_clear_command_window_request () +void +main_window::handle_clear_command_window_request () { emit interpreter_event ([] () @@ -748,7 +769,8 @@ }); } -void main_window::handle_clear_history_request () +void +main_window::handle_clear_history_request () { emit interpreter_event ([] (interpreter& interp) @@ -761,7 +783,8 @@ }); } -void main_window::handle_undo_request () +void +main_window::handle_undo_request () { if (command_window_has_focus ()) { @@ -778,8 +801,9 @@ emit undo_signal (); } -void main_window::modify_path (const QStringList& dir_list, - bool rm, bool subdirs) +void +main_window::modify_path (const QStringList& dir_list, + bool rm, bool subdirs) { emit interpreter_event ([=] (interpreter& interp) @@ -806,12 +830,14 @@ }); } -void main_window::edit_mfile (const QString& name, int line) +void +main_window::edit_mfile (const QString& name, int line) { handle_edit_mfile_request (name, QString (), QString (), line); } -void main_window::file_remove_proxy (const QString& o, const QString& n) +void +main_window::file_remove_proxy (const QString& o, const QString& n) { interpreter_qobject *interp_qobj = m_octave_qobj.interpreter_qobj (); @@ -832,33 +858,39 @@ qt_link->wake_all (); } -void main_window::open_online_documentation_page () +void +main_window::open_online_documentation_page () { QDesktopServices::openUrl (QUrl ("https://octave.org/doc/interpreter/index.html")); } -void main_window::open_bug_tracker_page () +void +main_window::open_bug_tracker_page () { QDesktopServices::openUrl (QUrl ("https://octave.org/bugs.html")); } -void main_window::open_octave_packages_page () +void +main_window::open_octave_packages_page () { QDesktopServices::openUrl (QUrl ("https://packages.octave.org/index.html")); } -void main_window::open_contribute_page () +void +main_window::open_contribute_page () { QDesktopServices::openUrl (QUrl ("https://octave.org/contribute.html")); } -void main_window::open_donate_page () +void +main_window::open_donate_page () { QDesktopServices::openUrl (QUrl ("https://octave.org/donate.html")); } -void main_window::process_settings_dialog_request (const QString& desired_tab) +void +main_window::process_settings_dialog_request (const QString& desired_tab) { if (m_settings_dlg) // m_settings_dlg is a guarded pointer! { @@ -874,7 +906,8 @@ this, &main_window::request_reload_settings); } -void main_window::show_about_octave () +void +main_window::show_about_octave () { std::string message = octave_name_version_copyright_copying_warranty_and_bugs (true); @@ -883,7 +916,8 @@ QString::fromStdString (message)); } -void main_window::notice_settings (bool update_by_worker) +void +main_window::notice_settings (bool update_by_worker) { gui_settings settings; @@ -894,7 +928,7 @@ if (preferred_style == global_style.def ().toString ()) preferred_style = m_default_style; - QApplication* qapp = m_octave_qobj.qapplication(); + QApplication *qapp = m_octave_qobj.qapplication(); if (preferred_style == global_extra_styles.at (EXTRA_STYLE_FUSION_DARK)) { @@ -991,7 +1025,8 @@ } -QPalette main_window::getFusionDarkPalette() +QPalette +main_window::getFusionDarkPalette() { QPalette darkPalette; darkPalette.setColor(QPalette::Window, QColor(53, 53, 53)); @@ -1018,7 +1053,8 @@ return darkPalette; } -void main_window::prepare_to_exit () +void +main_window::prepare_to_exit () { // Find files dialog is constructed dynamically, not at time of main_window // construction. Connecting it to qApp aboutToQuit signal would have @@ -1036,12 +1072,14 @@ m_active_dock = nullptr; } -void main_window::go_to_previous_widget () +void +main_window::go_to_previous_widget () { m_previous_dock->activate (); } -void main_window::update_octave_directory (const QString& dir) +void +main_window::update_octave_directory (const QString& dir) { // Remove existing entry, if any, then add new directory at top and // mark it as the current directory. Finally, update the file list @@ -1056,7 +1094,8 @@ m_current_directory_combo_box->setCurrentIndex (0); } -void main_window::browse_for_directory () +void +main_window::browse_for_directory () { // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved. int opts = QFileDialog::ShowDirsOnly; @@ -1078,7 +1117,8 @@ focus_command_window (); } -void main_window::set_current_working_directory (const QString& dir) +void +main_window::set_current_working_directory (const QString& dir) { // Change to dir if it is an existing directory. @@ -1098,7 +1138,8 @@ } } -void main_window::change_directory_up () +void +main_window::change_directory_up () { set_current_working_directory (".."); } @@ -1107,7 +1148,8 @@ // combobox to change to a new directory or a directory that is already // in the drop down list. -void main_window::accept_directory_line_edit () +void +main_window::accept_directory_line_edit () { // Get new directory name, and change to it if it is new. Otherwise, // the combo box will trigger the "activated" signal to change to the @@ -1121,7 +1163,8 @@ set_current_working_directory (dir); } -void main_window::execute_command_in_terminal (const QString& command) +void +main_window::execute_command_in_terminal (const QString& command) { if (m_octave_qobj.experimental_terminal_widget ()) { @@ -1147,7 +1190,8 @@ focus_console_after_command (); } -void main_window::run_file_in_terminal (const QFileInfo& info) +void +main_window::run_file_in_terminal (const QFileInfo& info) { emit interpreter_event ([=] (interpreter& interp) @@ -1191,7 +1235,8 @@ focus_console_after_command (); } -void main_window::handle_new_figure_request () +void +main_window::handle_new_figure_request () { emit interpreter_event ([] (interpreter& interp) @@ -1203,7 +1248,8 @@ }); } -void main_window::handle_enter_debugger () +void +main_window::handle_enter_debugger () { setWindowTitle ("Octave (Debugging)"); @@ -1214,7 +1260,8 @@ m_debug_quit->setEnabled (true); } -void main_window::handle_exit_debugger () +void +main_window::handle_exit_debugger () { setWindowTitle ("Octave"); @@ -1225,7 +1272,8 @@ m_debug_quit->setEnabled (false); } -void main_window::debug_continue () +void +main_window::debug_continue () { emit interpreter_event ([=] (interpreter& interp) @@ -1239,7 +1287,8 @@ }); } -void main_window::debug_step_into () +void +main_window::debug_step_into () { emit interpreter_event ([=] (interpreter& interp) @@ -1253,7 +1302,8 @@ }); } -void main_window::debug_step_over () +void +main_window::debug_step_over () { if (m_debug_quit->isEnabled ()) { @@ -1278,7 +1328,8 @@ } } -void main_window::debug_step_out () +void +main_window::debug_step_out () { emit interpreter_event ([=] (interpreter& interp) @@ -1292,7 +1343,8 @@ }); } -void main_window::debug_quit () +void +main_window::debug_quit () { emit interpreter_event ([] (interpreter& interp) @@ -1311,7 +1363,8 @@ // These are moved from editor to here for also using them when octave // is built without qscintilla // -void main_window::request_open_file () +void +main_window::request_open_file () { // Open file isn't a file_editor_tab or editor function since the file // might be opened in an external editor. Hence, functionality is here. @@ -1320,7 +1373,7 @@ bool is_internal = m_editor_window && ! settings.value (global_use_custom_editor.settings_key (), - global_use_custom_editor.def ()).toBool (); + global_use_custom_editor.def ()).toBool (); // Create a NonModal message. QWidget *p = this; @@ -1347,13 +1400,15 @@ } // Create a new script -void main_window::request_new_script (const QString& commands) +void +main_window::request_new_script (const QString& commands) { emit new_file_signal (commands); } // Create a new function and open it -void main_window::request_new_function (bool) +void +main_window::request_new_function (bool) { bool ok; // Get the name of the new function: Parent of the input dialog is the @@ -1364,7 +1419,7 @@ gui_settings settings; if (! p || settings.value (global_use_custom_editor.settings_key (), - global_use_custom_editor.def ()).toBool ()) + global_use_custom_editor.def ()).toBool ()) p = this; QString new_name = QInputDialog::getText (p, tr ("New Function"), tr ("New function name:\n"), QLineEdit::Normal, "", &ok); @@ -1387,10 +1442,11 @@ } } -void main_window::handle_edit_mfile_request (const QString& fname, - const QString& ffile, - const QString& curr_dir, - int line) +void +main_window::handle_edit_mfile_request (const QString& fname, + const QString& ffile, + const QString& curr_dir, + int line) { // The interpreter_event callback function below emits a signal. // Because we don't control when that happens, use a guarded pointer @@ -1488,7 +1544,8 @@ }); } -void main_window::warning_function_not_found (const QString& message) +void +main_window::warning_function_not_found (const QString& message) { QMessageBox *msgBox = new QMessageBox (QMessageBox::Critical, tr ("Octave Editor"), @@ -1498,8 +1555,9 @@ msgBox->show (); } -void main_window::handle_insert_debugger_pointer_request (const QString& file, - int line) +void +main_window::handle_insert_debugger_pointer_request (const QString& file, + int line) { bool cmd_focus = command_window_has_focus (); @@ -1509,8 +1567,9 @@ focus_command_window (); } -void main_window::handle_delete_debugger_pointer_request (const QString& file, - int line) +void +main_window::handle_delete_debugger_pointer_request (const QString& file, + int line) { bool cmd_focus = command_window_has_focus (); @@ -1520,10 +1579,11 @@ focus_command_window (); } -void main_window::handle_update_breakpoint_marker_request (bool insert, - const QString& file, - int line, - const QString& cond) +void +main_window::handle_update_breakpoint_marker_request (bool insert, + const QString& file, + int line, + const QString& cond) { bool cmd_focus = command_window_has_focus (); @@ -1533,7 +1593,8 @@ focus_command_window (); } -void main_window::read_settings () +void +main_window::read_settings () { gui_settings settings; @@ -1549,12 +1610,14 @@ emit settings_changed (); } -void main_window::init_terminal_size () +void +main_window::init_terminal_size () { emit init_terminal_size_signal (); } -void main_window::set_window_layout () +void +main_window::set_window_layout () { gui_settings settings; @@ -1651,7 +1714,8 @@ show (); } -void main_window::write_settings () +void +main_window::write_settings () { gui_settings settings; @@ -1667,7 +1731,8 @@ settings.sync (); } -void main_window::copyClipboard () +void +main_window::copyClipboard () { if (m_current_directory_combo_box->hasFocus ()) { @@ -1682,7 +1747,8 @@ emit copyClipboard_signal (); } -void main_window::pasteClipboard () +void +main_window::pasteClipboard () { if (m_current_directory_combo_box->hasFocus ()) { @@ -1698,7 +1764,8 @@ emit pasteClipboard_signal (); } -void main_window::selectAll () +void +main_window::selectAll () { if (m_current_directory_combo_box->hasFocus ()) { @@ -1712,8 +1779,9 @@ emit selectAll_signal (); } -void main_window::handle_gui_status_update (const QString& feature, - const QString& status) +void +main_window::handle_gui_status_update (const QString& feature, + const QString& status) { // Put actions that are required for updating a gui features here @@ -1727,7 +1795,8 @@ } } -void main_window::handle_octave_ready () +void +main_window::handle_octave_ready () { // actions after the startup files are executed @@ -1807,7 +1876,8 @@ focus_command_window (); // make sure that the command window has focus } -void main_window::handle_set_path_dialog_request () +void +main_window::handle_set_path_dialog_request () { if (m_set_path_dlg) // m_set_path_dlg is a guarded pointer! return; @@ -1843,7 +1913,8 @@ m_set_path_dlg->update_model (); } -void main_window::find_files (const QString& start_dir) +void +main_window::find_files (const QString& start_dir) { if (! m_find_files_dlg) @@ -1873,7 +1944,8 @@ } -void main_window::set_screen_size (int ht, int wd) +void +main_window::set_screen_size (int ht, int wd) { emit interpreter_event ([=] () @@ -1884,7 +1956,8 @@ }); } -void main_window::clipboard_has_changed () +void +main_window::clipboard_has_changed () { if (m_clipboard->text ().isEmpty ()) { @@ -1898,12 +1971,14 @@ } } -void main_window::clear_clipboard () +void +main_window::clear_clipboard () { m_clipboard->clear (QClipboard::Clipboard); } -void main_window::disable_menu_shortcuts (bool disable) +void +main_window::disable_menu_shortcuts (bool disable) { QHash<QMenu *, QStringList>::const_iterator i = m_hash_menu_text.constBegin (); @@ -1914,7 +1989,8 @@ } } -void main_window::restore_create_file_setting () +void +main_window::restore_create_file_setting () { // restore the new files creation setting @@ -1925,7 +2001,8 @@ this, SLOT (restore_create_file_setting ())); } -void main_window::set_file_encoding (const QString& new_encoding) +void +main_window::set_file_encoding (const QString& new_encoding) { m_file_encoding = new_encoding; } @@ -1933,13 +2010,15 @@ // The following slot is called after files have been selected in the // open file dialog, possibly with a new selected encoding stored in // m_file_encoding -void main_window::request_open_files (const QStringList& open_file_names) +void +main_window::request_open_files (const QStringList& open_file_names) { for (int i = 0; i < open_file_names.count (); i++) emit open_file_signal (open_file_names.at (i), m_file_encoding, -1); } -void main_window::profiler_session () +void +main_window::profiler_session () { emit interpreter_event ([=] (interpreter& interp) @@ -1949,7 +2028,8 @@ }); } -void main_window::profiler_session_resume () +void +main_window::profiler_session_resume () { emit interpreter_event ([=] (interpreter& interp) @@ -1959,7 +2039,8 @@ }); } -void main_window::profiler_stop () +void +main_window::profiler_stop () { emit interpreter_event ([=] (interpreter& interp) @@ -1969,7 +2050,8 @@ }); } -void main_window::handle_profiler_status_update (bool active) +void +main_window::handle_profiler_status_update (bool active) { m_profiler_start->setEnabled (! active); m_profiler_resume->setEnabled (! active); @@ -1981,7 +2063,8 @@ m_profiler_status_indicator->set_state (state); } -void main_window::profiler_show () +void +main_window::profiler_show () { // Do not use a separate interpreter event as in the other // profiler slots since the output of the command "profshow" @@ -1990,7 +2073,8 @@ execute_command_in_terminal ("profshow"); } -void main_window::closeEvent (QCloseEvent *e) +void +main_window::closeEvent (QCloseEvent *e) { write_settings (); @@ -2023,7 +2107,8 @@ e->ignore (); } -void main_window::construct_central_widget () +void +main_window::construct_central_widget () { // Create and set the central widget. QMainWindow takes ownership of // the widget (pointer) so there is no need to delete the object upon @@ -2039,7 +2124,8 @@ // Main subroutine of the constructor -void main_window::construct () +void +main_window::construct () { setWindowIcon (QIcon (dw_icon_set_names["NONE"])); @@ -2086,7 +2172,8 @@ configure_shortcuts (); } -void main_window::construct_octave_qt_link () +void +main_window::construct_octave_qt_link () { interpreter_qobject *interp_qobj = m_octave_qobj.interpreter_qobj (); @@ -2129,9 +2216,10 @@ this, &main_window::update_gui_lexer_signal); } -QAction* main_window::add_action (QMenu *menu, const QIcon& icon, - const QString& text, const char *member, - const QWidget *receiver) +QAction * +main_window::add_action (QMenu *menu, const QIcon& icon, + const QString& text, const char *member, + const QWidget *receiver) { QAction *a; @@ -2145,7 +2233,8 @@ return a; } -QMenu* main_window::m_add_menu (QMenuBar *p, QString name) +QMenu * +main_window::m_add_menu (QMenuBar *p, QString name) { QMenu *menu = p->addMenu (name); @@ -2163,7 +2252,8 @@ return menu; } -void main_window::construct_menu_bar () +void +main_window::construct_menu_bar () { QMenuBar *menu_bar = menuBar (); @@ -2184,7 +2274,8 @@ #if defined (HAVE_QSCINTILLA) // call the editor to add actions which should also be available in the // editor's menu and tool bar - QList<QAction *> shared_actions = { + QList<QAction *> shared_actions = + { m_new_script_action, m_new_function_action, m_open_action, @@ -2198,7 +2289,8 @@ #endif } -void main_window::construct_file_menu (QMenuBar *p) +void +main_window::construct_file_menu (QMenuBar *p) { QMenu *file_menu = m_add_menu (p, tr ("&File")); @@ -2245,7 +2337,8 @@ SLOT (request_open_file (const QString&, const QString&, int))); } -void main_window::construct_new_menu (QMenu *p) +void +main_window::construct_new_menu (QMenu *p) { QMenu *new_menu = p->addMenu (tr ("New")); @@ -2264,7 +2357,8 @@ SLOT (handle_new_figure_request ()), this); } -void main_window::construct_edit_menu (QMenuBar *p) +void +main_window::construct_edit_menu (QMenuBar *p) { QMenu *edit_menu = m_add_menu (p, tr ("&Edit")); @@ -2352,9 +2446,10 @@ } -QAction * main_window::construct_debug_menu_item (const char *icon, - const QString& item, - const char *member) +QAction * +main_window::construct_debug_menu_item (const char *icon, + const QString& item, + const char *member) { gui_settings settings; @@ -2371,7 +2466,8 @@ return action; } -void main_window::construct_debug_menu (QMenuBar *p) +void +main_window::construct_debug_menu (QMenuBar *p) { m_debug_menu = m_add_menu (p, tr ("De&bug")); @@ -2401,25 +2497,27 @@ SLOT (debug_quit ())); } -void main_window::construct_tools_menu (QMenuBar *p) +void +main_window::construct_tools_menu (QMenuBar *p) { QMenu *tools_menu = m_add_menu (p, tr ("&Tools")); m_profiler_start = add_action (tools_menu, QIcon (), - tr ("Start &Profiler Session"), SLOT (profiler_session ())); + tr ("Start &Profiler Session"), SLOT (profiler_session ())); m_profiler_resume = add_action (tools_menu, QIcon (), - tr ("&Resume Profiler Session"), SLOT (profiler_session_resume ())); + tr ("&Resume Profiler Session"), SLOT (profiler_session_resume ())); m_profiler_stop = add_action (tools_menu, QIcon (), - tr ("&Stop Profiler"), SLOT (profiler_stop ())); + tr ("&Stop Profiler"), SLOT (profiler_stop ())); m_profiler_stop->setEnabled (false); m_profiler_show = add_action (tools_menu, QIcon (), - tr ("&Show Profiler Data"), SLOT (profiler_show ())); + tr ("&Show Profiler Data"), SLOT (profiler_show ())); } -void main_window::editor_tabs_changed (bool have_tabs, bool is_octave) +void +main_window::editor_tabs_changed (bool have_tabs, bool is_octave) { // Set state of actions which depend on the existence of editor tabs m_editor_has_tabs = have_tabs; @@ -2427,10 +2525,11 @@ m_debug_step_over->setEnabled (have_tabs && is_octave); } -QAction * main_window::construct_window_menu_item (QMenu *p, - const QString& item, - bool checkable, - QWidget *widget) +QAction * +main_window::construct_window_menu_item (QMenu *p, + const QString& item, + bool checkable, + QWidget *widget) { QAction *action = p->addAction (QIcon (), item); @@ -2464,7 +2563,8 @@ return action; } -void main_window::construct_window_menu (QMenuBar *p) +void +main_window::construct_window_menu (QMenuBar *p) { QMenu *window_menu = m_add_menu (p, tr ("&Window")); @@ -2515,7 +2615,7 @@ window_menu->addSeparator (); m_previous_dock_action = add_action (window_menu, QIcon (), - tr ("Previous Widget"), SLOT (go_to_previous_widget ())); + tr ("Previous Widget"), SLOT (go_to_previous_widget ())); window_menu->addSeparator (); @@ -2523,7 +2623,8 @@ tr ("Reset Default Window Layout"), SLOT (reset_windows ())); } -void main_window::construct_help_menu (QMenuBar *p) +void +main_window::construct_help_menu (QMenuBar *p) { QMenu *help_menu = m_add_menu (p, tr ("&Help")); @@ -2549,7 +2650,8 @@ tr ("About Octave"), SLOT (show_about_octave ())); } -void main_window::construct_documentation_menu (QMenu *p) +void +main_window::construct_documentation_menu (QMenu *p) { QMenu *doc_menu = p->addMenu (tr ("Documentation")); @@ -2560,7 +2662,8 @@ tr ("Online"), SLOT (open_online_documentation_page ())); } -void main_window::construct_news_menu (QMenuBar *p) +void +main_window::construct_news_menu (QMenuBar *p) { QMenu *news_menu = m_add_menu (p, tr ("&News")); @@ -2581,7 +2684,8 @@ m_current_news_action->setShortcutContext (Qt::ApplicationShortcut); } -void main_window::construct_tool_bar () +void +main_window::construct_tool_bar () { m_main_tool_bar = addToolBar (tr ("Toolbar")); m_main_tool_bar->setStyleSheet (m_main_tool_bar->styleSheet () @@ -2646,7 +2750,8 @@ this, &main_window::handle_undo_request); } -void main_window::focus_console_after_command () +void +main_window::focus_console_after_command () { gui_settings settings; @@ -2654,7 +2759,8 @@ focus_command_window (); } -void main_window::configure_shortcuts () +void +main_window::configure_shortcuts () { gui_settings settings; @@ -2729,7 +2835,8 @@ settings.set_shortcut (m_current_news_action, sc_main_news_community_news, enable); } -QList<octave_dock_widget *> main_window::dock_widget_list () +QList<octave_dock_widget *> +main_window::dock_widget_list () { QList<octave_dock_widget *> list = QList<octave_dock_widget *> (); list.append (static_cast<octave_dock_widget *> (m_command_window)); @@ -2744,7 +2851,8 @@ return list; } -void main_window::update_default_encoding (const QString& default_encoding) +void +main_window::update_default_encoding (const QString& default_encoding) { m_default_encoding = default_encoding; std::string mfile_encoding = m_default_encoding.toStdString (); @@ -2760,7 +2868,8 @@ }); } -void main_window::resize_dock (QDockWidget *dw, int width, int height) +void +main_window::resize_dock (QDockWidget *dw, int width, int height) { // resizeDockWidget was added to Qt in Qt 5.6 if (width >= 0) @@ -2770,7 +2879,8 @@ } // The default main window size relative to the desktop size -void main_window::set_default_geometry () +void +main_window::set_default_geometry () { int win_x, win_y; get_screen_geometry (win_x, win_y); @@ -2779,7 +2889,8 @@ resize (2*win_x/3, 7*win_y/8); } -void main_window::reset_windows () +void +main_window::reset_windows () { // Slot for resetting the window layout to the default one hide (); @@ -2802,7 +2913,8 @@ // Create the default layout of the main window. Do not use // restoreState () and restoreGeometry () with default values since // this might lead to problems when the Qt version changes -void main_window::do_reset_windows (bool show, bool save, bool force_all) +void +main_window::do_reset_windows (bool show, bool save, bool force_all) { // Set main window default geometry and store its width for // later resizing the command window
--- a/libgui/src/octave-dock-widget.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/octave-dock-widget.cc Fri Dec 22 12:14:08 2023 -0500 @@ -527,7 +527,7 @@ m_recent_float_geom = settings.value (dw_float_geometry.settings_key ().arg (objectName ()), - default_floating_size).toRect (); + default_floating_size).toRect (); adjust_to_screen (m_recent_float_geom, default_floating_size); @@ -601,7 +601,8 @@ settings.sync (); } -bool octave_dock_widget::eventFilter (QObject *obj, QEvent *e) +bool +octave_dock_widget::eventFilter (QObject *obj, QEvent *e) { // Ignore double clicks into window decoration elements if (e->type () == QEvent::NonClientAreaMouseButtonDblClick) @@ -657,7 +658,8 @@ emit active_changed (false); } -void octave_dock_widget::activate () +void +octave_dock_widget::activate () { if (! isVisible ()) setVisible (true); @@ -667,7 +669,8 @@ raise (); } -void octave_dock_widget::handle_visibility (bool visible) +void +octave_dock_widget::handle_visibility (bool visible) { if (visible) {
--- a/libgui/src/octave-qobject.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/octave-qobject.cc Fri Dec 22 12:14:08 2023 -0500 @@ -75,7 +75,8 @@ // Bug #55940 (Disable App Nap on Mac) #if defined (Q_OS_MAC) -static void disable_app_nap () +static void +disable_app_nap () { Class process_info_class; SEL process_info_selector; @@ -141,7 +142,8 @@ //! Reimplement QApplication::notify. Octave's own exceptions are //! caught and rethrown in the interpreter thread. -bool octave_qapplication::notify (QObject *receiver, QEvent *ev) +bool +octave_qapplication::notify (QObject *receiver, QEvent *ev) { try { @@ -386,7 +388,8 @@ string_vector::delete_c_str_vec (m_argv); } -void base_qobject::config_translators () +void +base_qobject::config_translators () { if (m_translators_installed) return; @@ -402,7 +405,8 @@ m_translators_installed = true; } -void base_qobject::start_main_thread () +void +base_qobject::start_main_thread () { // Note: if using the new experimental terminal widget, we defer // initializing and executing the interpreter until the main event @@ -422,7 +426,8 @@ m_main_thread->start (); } -int base_qobject::exec () +int +base_qobject::exec () { int status = m_qapplication->exec (); @@ -439,12 +444,14 @@ // Provided for convenience. Will be removed once we eliminate the // old terminal widget. -bool base_qobject::experimental_terminal_widget () const +bool +base_qobject::experimental_terminal_widget () const { return m_app_context.experimental_terminal_widget (); } -bool base_qobject::gui_running () const +bool +base_qobject::gui_running () const { return m_app_context.gui_running (); } @@ -725,7 +732,8 @@ return m_variable_editor_widget; } -QPointer<community_news> base_qobject::community_news_widget (int serial) +QPointer<community_news> +base_qobject::community_news_widget (int serial) { if (! m_community_news) m_community_news @@ -734,7 +742,8 @@ return m_community_news; } -QPointer<release_notes> base_qobject::release_notes_widget () +QPointer<release_notes> +base_qobject::release_notes_widget () { if (! m_release_notes) m_release_notes = QPointer<release_notes> (new release_notes ()); @@ -742,7 +751,8 @@ return m_release_notes; } -bool base_qobject::confirm_shutdown () +bool +base_qobject::confirm_shutdown () { // Currently, we forward to main_window::confirm_shutdown instead of // just displaying a dialog box here because the main_window also @@ -751,7 +761,8 @@ return m_main_window ? m_main_window->confirm_shutdown () : true; } -void base_qobject::start_gui (bool gui_app) +void +base_qobject::start_gui (bool gui_app) { if (m_app_context.experimental_terminal_widget ()) { @@ -795,7 +806,8 @@ } } -void base_qobject::show_terminal_window () +void +base_qobject::show_terminal_window () { terminal_dock_widget *widget = (m_terminal_widget @@ -808,7 +820,8 @@ } } -void base_qobject::show_documentation_window (const QString& file) +void +base_qobject::show_documentation_window (const QString& file) { documentation_dock_widget *widget = (m_documentation_widget @@ -823,7 +836,8 @@ } } -void base_qobject::show_file_browser_window () +void +base_qobject::show_file_browser_window () { files_dock_widget *widget = m_file_browser_widget ? m_file_browser_widget : file_browser_widget (); @@ -835,7 +849,8 @@ } } -void base_qobject::show_command_history_window () +void +base_qobject::show_command_history_window () { history_dock_widget *widget = m_history_widget ? m_history_widget : history_widget (); @@ -847,7 +862,8 @@ } } -void base_qobject::show_workspace_window () +void +base_qobject::show_workspace_window () { workspace_view *widget = m_workspace_widget ? m_workspace_widget : workspace_widget (); @@ -859,8 +875,9 @@ } } -void base_qobject::show_variable_editor_window (const QString& name, - const octave_value& value) +void +base_qobject::show_variable_editor_window (const QString& name, + const octave_value& value) { variable_editor *widget = (m_variable_editor_widget @@ -876,7 +893,8 @@ widget->edit_variable (name, value); } -void base_qobject::handle_variable_editor_update () +void +base_qobject::handle_variable_editor_update () { // Called when the variable editor emits the updated signal. The size // of a variable may have changed, so we refresh the workspace in the @@ -896,7 +914,8 @@ }); } -void base_qobject::show_community_news (int serial) +void +base_qobject::show_community_news (int serial) { // Ensure widget exists. community_news_widget (serial); @@ -904,7 +923,8 @@ m_community_news->display (); } -void base_qobject::show_release_notes () +void +base_qobject::show_release_notes () { // Ensure widget exists. release_notes_widget (); @@ -912,7 +932,8 @@ m_release_notes->display (); } -void base_qobject::execute_command (const QString& command) +void +base_qobject::execute_command (const QString& command) { emit interpreter_event ([=] (interpreter& interp) @@ -930,7 +951,8 @@ }); } -void base_qobject::close_gui () +void +base_qobject::close_gui () { if (m_app_context.experimental_terminal_widget ()) { @@ -964,12 +986,14 @@ } } -void base_qobject::interpreter_ready () +void +base_qobject::interpreter_ready () { m_interpreter_ready = true; } -void base_qobject::interpreter_event (const fcn_callback& fcn) +void +base_qobject::interpreter_event (const fcn_callback& fcn) { // The following is a direct function call across threads. It works // because it is accessing a thread-safe queue of events that @@ -981,7 +1005,8 @@ m_interpreter_qobj->interpreter_event (fcn); } -void base_qobject::interpreter_event (const meth_callback& meth) +void +base_qobject::interpreter_event (const meth_callback& meth) { // The following is a direct function call across threads. It works // because it is accessing a thread-safe queue of events that @@ -993,7 +1018,8 @@ m_interpreter_qobj->interpreter_event (meth); } -void base_qobject::interpreter_interrupt () +void +base_qobject::interpreter_interrupt () { m_interpreter_qobj->interrupt (); } @@ -1001,26 +1027,30 @@ // FIXME: Should we try to make the pause, stop, and resume actions // work for both the old and new terminal widget? -void base_qobject::interpreter_pause () +void +base_qobject::interpreter_pause () { if (m_app_context.experimental_terminal_widget ()) m_interpreter_qobj->pause (); } -void base_qobject::interpreter_stop () +void +base_qobject::interpreter_stop () { if (m_app_context.experimental_terminal_widget ()) m_interpreter_qobj->stop (); } -void base_qobject::interpreter_resume () +void +base_qobject::interpreter_resume () { if (m_app_context.experimental_terminal_widget ()) m_interpreter_qobj->resume (); } -void base_qobject::copy_image_to_clipboard (const QString& file, - bool remove_file) +void +base_qobject::copy_image_to_clipboard (const QString& file, + bool remove_file) { QClipboard *clipboard = QApplication::clipboard ();
--- a/libgui/src/qt-application.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/qt-application.cc Fri Dec 22 12:14:08 2023 -0500 @@ -78,7 +78,8 @@ sysdep_init (); } -bool qt_application::start_gui_p () const +bool +qt_application::start_gui_p () const { // Note: this function is not needed if using the experimental // terminal widget, so return a dummy value of false in that case. @@ -86,7 +87,8 @@ return experimental_terminal_widget () ? false : m_options.gui (); } -int qt_application::execute () +int +qt_application::execute () { octave_block_interrupt_signal ();
--- a/libgui/src/qt-interpreter-events.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/qt-interpreter-events.cc Fri Dec 22 12:14:08 2023 -0500 @@ -133,13 +133,15 @@ this, &qt_interpreter_events::gui_preference_slot); } -void qt_interpreter_events::start_gui (bool gui_app) +void +qt_interpreter_events::start_gui (bool gui_app) { if (m_octave_qobj.experimental_terminal_widget ()) emit start_gui_signal (gui_app); } -void qt_interpreter_events::close_gui () +void +qt_interpreter_events::close_gui () { if (m_octave_qobj.experimental_terminal_widget ()) emit close_gui_signal (); @@ -246,72 +248,85 @@ return answer.toStdString (); } -void qt_interpreter_events::update_path_dialog () +void +qt_interpreter_events::update_path_dialog () { emit update_path_dialog_signal (); } -void qt_interpreter_events::show_preferences () +void +qt_interpreter_events::show_preferences () { emit show_preferences_signal (); } -void qt_interpreter_events::apply_preferences () +void +qt_interpreter_events::apply_preferences () { emit apply_new_settings (); } -void qt_interpreter_events::show_terminal_window () +void +qt_interpreter_events::show_terminal_window () { emit show_terminal_window_signal (); } -bool qt_interpreter_events::show_documentation (const std::string& file) +bool +qt_interpreter_events::show_documentation (const std::string& file) { emit show_documentation_signal (QString::fromStdString (file)); return true; } -void qt_interpreter_events::show_file_browser () +void +qt_interpreter_events::show_file_browser () { emit show_file_browser_signal (); } -void qt_interpreter_events::show_command_history () +void +qt_interpreter_events::show_command_history () { emit show_command_history_signal (); } -void qt_interpreter_events::show_workspace () +void +qt_interpreter_events::show_workspace () { emit show_workspace_signal (); } -void qt_interpreter_events::show_community_news (int serial) +void +qt_interpreter_events::show_community_news (int serial) { emit show_community_news_signal (serial); } -void qt_interpreter_events::show_release_notes () +void +qt_interpreter_events::show_release_notes () { emit show_release_notes_signal (); } -bool qt_interpreter_events::edit_file (const std::string& file) +bool +qt_interpreter_events::edit_file (const std::string& file) { emit edit_file_signal (QString::fromStdString (file)); return true; } -void qt_interpreter_events::edit_variable (const std::string& expr, - const octave_value& val) +void +qt_interpreter_events::edit_variable (const std::string& expr, + const octave_value& val) { emit edit_variable_signal (QString::fromStdString (expr), val); } -bool qt_interpreter_events::confirm_shutdown () +bool +qt_interpreter_events::confirm_shutdown () { QMutexLocker autolock (&m_mutex); @@ -323,7 +338,8 @@ return m_result.toBool (); } -bool qt_interpreter_events::prompt_new_edit_file (const std::string& file) +bool +qt_interpreter_events::prompt_new_edit_file (const std::string& file) { gui_settings settings; @@ -392,7 +408,8 @@ return retval; } -uint8NDArray qt_interpreter_events::get_named_icon (const std::string& name) +uint8NDArray +qt_interpreter_events::get_named_icon (const std::string& name) { QMutexLocker autolock (&m_mutex); @@ -435,7 +452,8 @@ return retval; } -void qt_interpreter_events::get_named_icon_slot (const QString& name) +void +qt_interpreter_events::get_named_icon_slot (const QString& name) { QMutexLocker autolock (&m_mutex); @@ -466,14 +484,16 @@ return pref.toStdString (); } -bool qt_interpreter_events::copy_image_to_clipboard (const std::string& file) +bool +qt_interpreter_events::copy_image_to_clipboard (const std::string& file) { emit copy_image_to_clipboard_signal (QString::fromStdString (file), true); return true; } -void qt_interpreter_events::focus_window (const std::string win_name) +void +qt_interpreter_events::focus_window (const std::string win_name) { emit focus_window_signal (QString::fromStdString (win_name)); } @@ -484,17 +504,20 @@ emit execute_command_in_terminal_signal (QString::fromStdString (command)); } -void qt_interpreter_events::register_documentation (const std::string& file) +void +qt_interpreter_events::register_documentation (const std::string& file) { emit register_documentation_signal (QString::fromStdString (file)); } -void qt_interpreter_events::unregister_documentation (const std::string& file) +void +qt_interpreter_events::unregister_documentation (const std::string& file) { emit unregister_documentation_signal (QString::fromStdString (file)); } -void qt_interpreter_events::interpreter_output (const std::string& msg) +void +qt_interpreter_events::interpreter_output (const std::string& msg) { if (m_octave_qobj.experimental_terminal_widget () && m_octave_qobj.have_terminal_window ()) @@ -506,8 +529,9 @@ } } -void qt_interpreter_events::display_exception (const execution_exception& ee, - bool beep) +void +qt_interpreter_events::display_exception (const execution_exception& ee, + bool beep) { if (m_octave_qobj.experimental_terminal_widget () && m_octave_qobj.have_terminal_window ()) @@ -528,25 +552,29 @@ } } -void qt_interpreter_events::gui_status_update (const std::string& feature, - const std::string& status) +void +qt_interpreter_events::gui_status_update (const std::string& feature, + const std::string& status) { emit gui_status_update_signal (QString::fromStdString (feature), QString::fromStdString (status)); } -void qt_interpreter_events::update_gui_lexer () +void +qt_interpreter_events::update_gui_lexer () { emit update_gui_lexer_signal (true); } -void qt_interpreter_events::directory_changed (const std::string& dir) +void +qt_interpreter_events::directory_changed (const std::string& dir) { emit directory_changed_signal (QString::fromStdString (dir)); } -void qt_interpreter_events::file_remove (const std::string& old_name, - const std::string& new_name) +void +qt_interpreter_events::file_remove (const std::string& old_name, + const std::string& new_name) { QMutexLocker autolock (&m_mutex); @@ -558,14 +586,16 @@ wait (); } -void qt_interpreter_events::file_renamed (bool load_new) +void +qt_interpreter_events::file_renamed (bool load_new) { emit file_renamed_signal (load_new); } -void qt_interpreter_events::set_workspace (bool top_level, bool debug, - const symbol_info_list& syminfo, - bool update_variable_editor) +void +qt_interpreter_events::set_workspace (bool top_level, bool debug, + const symbol_info_list& syminfo, + bool update_variable_editor) { if (! top_level && ! debug) return; @@ -576,17 +606,20 @@ emit refresh_variable_editor_signal (); } -void qt_interpreter_events::clear_workspace () +void +qt_interpreter_events::clear_workspace () { emit clear_workspace_signal (); } -void qt_interpreter_events::update_prompt (const std::string& prompt) +void +qt_interpreter_events::update_prompt (const std::string& prompt) { emit update_prompt_signal (QString::fromStdString (prompt)); } -void qt_interpreter_events::set_history (const string_vector& hist) +void +qt_interpreter_events::set_history (const string_vector& hist) { QStringList qt_hist; @@ -596,25 +629,30 @@ emit set_history_signal (qt_hist); } -void qt_interpreter_events::append_history (const std::string& hist_entry) +void +qt_interpreter_events::append_history (const std::string& hist_entry) { emit append_history_signal (QString::fromStdString (hist_entry)); } -void qt_interpreter_events::clear_history () +void +qt_interpreter_events::clear_history () { emit clear_history_signal (); } -void qt_interpreter_events::pre_input_event () +void +qt_interpreter_events::pre_input_event () { } -void qt_interpreter_events::post_input_event () +void +qt_interpreter_events::post_input_event () { } -void qt_interpreter_events::enter_debugger_event (const std::string& /*fcn_name*/, - const std::string& fcn_file_name, - int line) +void +qt_interpreter_events::enter_debugger_event (const std::string& /*fcn_name*/, + const std::string& fcn_file_name, + int line) { if (fcn_file_name.empty ()) return; @@ -631,17 +669,19 @@ delete_debugger_pointer (file, line); } -void qt_interpreter_events::exit_debugger_event () +void +qt_interpreter_events::exit_debugger_event () { emit exit_debugger_signal (); } // Display (if @insert true) or remove the appropriate symbol for a breakpoint // in @file at @line with condition @cond. -void qt_interpreter_events::update_breakpoint (bool insert, - const std::string& file, - int line, - const std::string& cond) +void +qt_interpreter_events::update_breakpoint (bool insert, + const std::string& file, + int line, + const std::string& cond) { emit update_breakpoint_marker_signal (insert, QString::fromStdString (file), line, QString::fromStdString (cond));
--- a/libgui/src/release-notes.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/release-notes.cc Fri Dec 22 12:14:08 2023 -0500 @@ -106,7 +106,8 @@ move (20, 20); // move to the top left corner } -void release_notes::display () +void +release_notes::display () { if (! isVisible ()) show ();
--- a/libgui/src/set-path-dialog.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/set-path-dialog.cc Fri Dec 22 12:14:08 2023 -0500 @@ -172,13 +172,15 @@ restoreGeometry (settings.value(pd_geometry.settings_key ()).toByteArray()); } -void set_path_dialog::update_model () +void +set_path_dialog::update_model () { set_path_model *m = static_cast<set_path_model *> (m_path_list->model ()); m->path_to_model (); } -void set_path_dialog::add_dir_common (bool subdirs) +void +set_path_dialog::add_dir_common (bool subdirs) { QString dir = QFileDialog::getExistingDirectory (this, tr ("Open Directory"), @@ -203,17 +205,20 @@ } } -void set_path_dialog::add_dir() +void +set_path_dialog::add_dir() { add_dir_common (false); } -void set_path_dialog::add_dir_subdirs () +void +set_path_dialog::add_dir_subdirs () { add_dir_common (true); } -void set_path_dialog::rm_dir () +void +set_path_dialog::rm_dir () { set_path_model *m = static_cast<set_path_model *> (m_path_list->model ()); QItemSelectionModel *selmodel = m_path_list->selectionModel (); @@ -223,7 +228,8 @@ selmodel->clearSelection (); } -void set_path_dialog::move_dir_up () +void +set_path_dialog::move_dir_up () { set_path_model *m = static_cast<set_path_model *> (m_path_list->model ()); QItemSelectionModel *selmodel = m_path_list->selectionModel (); @@ -243,7 +249,8 @@ m_path_list->scrollTo (m->index (min_row)); } -void set_path_dialog::move_dir_down () +void +set_path_dialog::move_dir_down () { set_path_model *m = static_cast<set_path_model *> (m_path_list->model ()); QItemSelectionModel *selmodel = m_path_list->selectionModel (); @@ -263,7 +270,8 @@ m_path_list->scrollTo (m->index (max_row)); } -void set_path_dialog::move_dir_top () +void +set_path_dialog::move_dir_top () { set_path_model *m = static_cast<set_path_model *> (m_path_list->model ()); QItemSelectionModel *selmodel = m_path_list->selectionModel (); @@ -278,7 +286,8 @@ m_path_list->scrollTo (m->index (0)); } -void set_path_dialog::move_dir_bottom () +void +set_path_dialog::move_dir_bottom () { set_path_model *m = static_cast<set_path_model *> (m_path_list->model ()); QItemSelectionModel *selmodel = m_path_list->selectionModel (); @@ -295,14 +304,16 @@ m_path_list->scrollTo (m->index (row_count - 1)); } -void set_path_dialog::save_settings () +void +set_path_dialog::save_settings () { gui_settings settings; settings.setValue (pd_geometry.settings_key (), saveGeometry ()); } -void set_path_dialog::closeEvent (QCloseEvent *e) +void +set_path_dialog::closeEvent (QCloseEvent *e) { save_settings ();
--- a/libgui/src/set-path-model.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/set-path-model.cc Fri Dec 22 12:14:08 2023 -0500 @@ -46,7 +46,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) set_path_model::set_path_model (QObject *p) -: QAbstractListModel (p) + : QAbstractListModel (p) { connect (this, &set_path_model::update_data_signal, this, &set_path_model::update_data); @@ -54,7 +54,8 @@ m_revertible = false; } -std::string set_path_model::to_string () +std::string +set_path_model::to_string () { std::string path_sep = directory_path::path_sep_str (); @@ -73,7 +74,8 @@ return path_str; } -void set_path_model::model_to_path () +void +set_path_model::model_to_path () { std::string path_str = to_string (); @@ -88,7 +90,8 @@ }); } -void set_path_model::clear () +void +set_path_model::clear () { beginResetModel (); @@ -97,7 +100,8 @@ endResetModel (); } -void set_path_model::save () +void +set_path_model::save () { model_to_path (); @@ -110,7 +114,8 @@ }); } -void set_path_model::revert () +void +set_path_model::revert () { clear (); @@ -121,7 +126,8 @@ model_to_path (); } -void set_path_model::revert_last () +void +set_path_model::revert_last () { clear (); @@ -132,7 +138,8 @@ model_to_path (); } -void set_path_model::add_dir (const QString& p) +void +set_path_model::add_dir (const QString& p) { m_last_dirs = m_dirs; @@ -147,7 +154,8 @@ model_to_path (); } -void set_path_model::rm_dir (const QModelIndexList& indices) +void +set_path_model::rm_dir (const QModelIndexList& indices) { m_last_dirs = m_dirs; @@ -163,7 +171,8 @@ model_to_path (); } -void set_path_model::move_dir_up (const QModelIndexList& indices) +void +set_path_model::move_dir_up (const QModelIndexList& indices) { m_last_dirs = m_dirs; @@ -185,7 +194,8 @@ model_to_path (); } -void set_path_model::move_dir_down (const QModelIndexList& indices) +void +set_path_model::move_dir_down (const QModelIndexList& indices) { m_last_dirs = m_dirs; @@ -208,7 +218,8 @@ model_to_path (); } -void set_path_model::move_dir_top (const QModelIndexList& indices) +void +set_path_model::move_dir_top (const QModelIndexList& indices) { m_last_dirs = m_dirs; @@ -229,7 +240,8 @@ model_to_path (); } -void set_path_model::move_dir_bottom (const QModelIndexList& indices) +void +set_path_model::move_dir_bottom (const QModelIndexList& indices) { m_last_dirs = m_dirs; @@ -252,12 +264,14 @@ model_to_path (); } -int set_path_model::rowCount (const QModelIndex&) const +int +set_path_model::rowCount (const QModelIndex&) const { return m_dirs.size (); } -QVariant set_path_model::data (const QModelIndex& idx, int role) const +QVariant +set_path_model::data (const QModelIndex& idx, int role) const { QVariant retval; if (idx.isValid ()) @@ -281,7 +295,8 @@ return retval; } -void set_path_model::path_to_model () +void +set_path_model::path_to_model () { // The interpreter_event callback function below emits a signal. // Because we don't control when that happens, use a guarded pointer @@ -315,7 +330,8 @@ m_revertible = false; } -void set_path_model::update_data (const QStringList& dirs) +void +set_path_model::update_data (const QStringList& dirs) { m_dirs = dirs;
--- a/libgui/src/settings-dialog.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/settings-dialog.cc Fri Dec 22 12:14:08 2023 -0500 @@ -78,7 +78,7 @@ setupUi (this); QMessageBox *info = wait_message_box ( - tr ("Loading current preferences ... "), this); + tr ("Loading current preferences ... "), this); read_settings (true); // it's the first read, prepare everything @@ -105,7 +105,8 @@ show (); } -void settings_dialog::read_settings (bool first) +void +settings_dialog::read_settings (bool first) { gui_settings settings; @@ -490,7 +491,7 @@ varedit_columnWidth->setValue (settings.int_value (ve_column_width)); varedit_rowHeight->setValue (settings.int_value (ve_row_height)); varedit_font->setCurrentFont (QFont (settings.value (ve_font_name.settings_key (), - settings.value (cs_font.settings_key (), default_font)).toString ())); + settings.value (cs_font.settings_key (), default_font)).toString ())); varedit_fontSize->setValue (settings.int_value (ve_font_size)); varedit_useTerminalFont->setChecked (settings.bool_value (ve_use_terminal_font)); varedit_font->setDisabled (varedit_useTerminalFont->isChecked ()); @@ -603,7 +604,8 @@ #endif } -void settings_dialog::show_tab (const QString& tab) +void +settings_dialog::show_tab (const QString& tab) { gui_settings settings; @@ -620,17 +622,20 @@ } } -void settings_dialog::get_octave_dir () +void +settings_dialog::get_octave_dir () { get_dir (le_octave_dir, tr ("Set Octave Startup Directory")); } -void settings_dialog::get_file_browser_dir () +void +settings_dialog::get_file_browser_dir () { get_dir (le_file_browser_dir, tr ("Set File Browser Startup Directory")); } -void settings_dialog::get_dir (QLineEdit *line_edit, const QString& title) +void +settings_dialog::get_dir (QLineEdit *line_edit, const QString& title) { // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved. int opts = QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks; @@ -646,7 +651,8 @@ line_edit->setText (dir); } -void settings_dialog::button_clicked (QAbstractButton *button) +void +settings_dialog::button_clicked (QAbstractButton *button) { QDialogButtonBox::ButtonRole button_role = button_box->buttonRole (button); @@ -682,7 +688,8 @@ } } -void settings_dialog::set_disabled_pref_file_browser_dir (bool disable) +void +settings_dialog::set_disabled_pref_file_browser_dir (bool disable) { cb_restore_file_browser_dir->setDisabled (disable); @@ -699,7 +706,8 @@ } // slot for updating enabled state of proxy settings -void settings_dialog::proxy_items_update () +void +settings_dialog::proxy_items_update () { bool use_proxy = use_proxy_server->isChecked (); @@ -731,7 +739,8 @@ // gui_settings_object so that the user may choose to apply or cancel // the action. -void settings_dialog::import_shortcut_set () +void +settings_dialog::import_shortcut_set () { if (! overwrite_all_shortcuts ()) return; @@ -755,7 +764,8 @@ // choice to save current application settings or the modified values // in the dialog? -void settings_dialog::export_shortcut_set () +void +settings_dialog::export_shortcut_set () { QString file = get_shortcuts_file_name (OSC_EXPORT); @@ -772,7 +782,8 @@ // gui_settings object so that the user may choose to apply or cancel // the action. -void settings_dialog::default_shortcut_set () +void +settings_dialog::default_shortcut_set () { if (! overwrite_all_shortcuts ()) return; @@ -780,7 +791,8 @@ shortcuts_treewidget->set_default_shortcuts (); } -void settings_dialog::update_editor_lexers (int def) +void +settings_dialog::update_editor_lexers (int def) { #if defined (HAVE_QSCINTILLA) @@ -859,7 +871,8 @@ #if defined (HAVE_QSCINTILLA) -void settings_dialog::update_lexer (QsciLexer *lexer, int mode, int def) +void +settings_dialog::update_lexer (QsciLexer *lexer, int mode, int def) { // Get lexer settings and copy from default settings if not yet // available in normal settings file @@ -961,12 +974,13 @@ } -void settings_dialog::get_lexer_settings (QsciLexer *lexer) +void +settings_dialog::get_lexer_settings (QsciLexer *lexer) { gui_settings settings; int styles[ed_max_lexer_styles]; // array for saving valid styles - // (enum is not continuous) + // (enum is not continuous) int max_style = settings.get_valid_lexer_styles (lexer, styles); QGridLayout *style_grid = new QGridLayout (); QVector<QLabel *> description (max_style); @@ -1055,7 +1069,8 @@ tabs_editor_lexers->setCurrentIndex (settings.int_value (sd_last_editor_styles_tab)); } -void settings_dialog::write_lexer_settings (QsciLexer *lexer) +void +settings_dialog::write_lexer_settings (QsciLexer *lexer) { gui_settings settings; @@ -1070,7 +1085,7 @@ QWidget *tab = tabs_editor_lexers-> findChild <QWidget *> (QString (lexer->language ()) + "_styles"); int styles[ed_max_lexer_styles]; // array for saving valid styles - // (enum is not continuous) + // (enum is not continuous) int max_style = settings.get_valid_lexer_styles (lexer, styles); @@ -1084,7 +1099,7 @@ color = findChild <color_picker *> (ed_highlight_current_line_color.settings_key ()); if (color) settings.setValue (ed_highlight_current_line_color.settings_key () - + settings_color_modes_ext[mode], color->color ()); + + settings_color_modes_ext[mode], color->color ()); QString default_font_name = settings.string_value (global_mono_font); @@ -1161,7 +1176,8 @@ #endif -void settings_dialog::write_changed_settings () +void +settings_dialog::write_changed_settings () { gui_settings settings; @@ -1391,7 +1407,8 @@ settings.sync (); } -void settings_dialog::read_workspace_colors () +void +settings_dialog::read_workspace_colors () { gui_settings settings; @@ -1434,7 +1451,7 @@ for (int i = 0; i < ws_colors_count; i++) { description[i] = new QLabel (" " - + tr (ws_color_names.at (i).toStdString ().data ())); + + tr (ws_color_names.at (i).toStdString ().data ())); description[i]->setAlignment (Qt::AlignRight); description[i]->setEnabled (colors_enabled); connect (m_ws_enable_colors, &QCheckBox::toggled, @@ -1475,7 +1492,8 @@ [=] () { update_workspace_colors (settings_reload_default_colors_flag); }); } -void settings_dialog::update_workspace_colors (int def) +void +settings_dialog::update_workspace_colors (int def) { QCheckBox *cb_color_mode = workspace_colors_box->findChild <QCheckBox *> (ws_color_mode.settings_key ()); @@ -1507,7 +1525,8 @@ } } -void settings_dialog::write_workspace_colors () +void +settings_dialog::write_workspace_colors () { gui_settings settings; @@ -1535,7 +1554,8 @@ settings.sync (); } -void settings_dialog::read_terminal_colors () +void +settings_dialog::read_terminal_colors () { gui_settings settings; @@ -1561,7 +1581,7 @@ for (unsigned int i = 0; i < cs_colors_count; i++) { description[i] = new QLabel (" " - + tr (cs_color_names.at (i).toStdString ().data ())); + + tr (cs_color_names.at (i).toStdString ().data ())); description[i]->setAlignment (Qt::AlignRight); QColor setting_color = settings.color_value (cs_colors[i], mode); color[i] = new color_picker (setting_color); @@ -1587,7 +1607,8 @@ [=] () { update_terminal_colors (settings_reload_default_colors_flag); }); } -void settings_dialog::update_terminal_colors (int def) +void +settings_dialog::update_terminal_colors (int def) { QCheckBox *cb_color_mode = terminal_colors_box->findChild <QCheckBox *> (cs_color_mode.settings_key ()); @@ -1619,7 +1640,8 @@ } } -void settings_dialog::write_terminal_colors () +void +settings_dialog::write_terminal_colors () { QCheckBox *cb_color_mode = terminal_colors_box->findChild <QCheckBox *> (cs_color_mode.settings_key ()); @@ -1644,7 +1666,8 @@ settings.sync (); } -void settings_dialog::read_varedit_colors () +void +settings_dialog::read_varedit_colors () { gui_settings settings; @@ -1670,7 +1693,7 @@ for (int i = 0; i < ve_colors_count; i++) { description[i] = new QLabel (" " - + tr (ve_color_names.at (i).toStdString ().data ())); + + tr (ve_color_names.at (i).toStdString ().data ())); description[i]->setAlignment (Qt::AlignRight); QColor setting_color = settings.color_value (ve_colors[i], mode); @@ -1697,7 +1720,8 @@ [=] () { update_varedit_colors (settings_reload_default_colors_flag); }); } -void settings_dialog::update_varedit_colors (int def) +void +settings_dialog::update_varedit_colors (int def) { QCheckBox *cb_color_mode = varedit_colors_box->findChild <QCheckBox *> (ve_color_mode.settings_key ()); @@ -1729,7 +1753,8 @@ } } -void settings_dialog::write_varedit_colors () +void +settings_dialog::write_varedit_colors () { QCheckBox *cb_color_mode = varedit_colors_box->findChild <QCheckBox *> (ve_color_mode.settings_key ()); @@ -1754,7 +1779,8 @@ settings.sync (); } -QString settings_dialog::get_shortcuts_file_name (import_export_action action) +QString +settings_dialog::get_shortcuts_file_name (import_export_action action) { QString file; @@ -1801,7 +1827,8 @@ // (XX) - already possible (cancel operation, cancel settings // dialog, re-open settings dialog and export changes). -bool settings_dialog::overwrite_all_shortcuts () +bool +settings_dialog::overwrite_all_shortcuts () { QMessageBox msg_box; @@ -1840,7 +1867,8 @@ return false; } -QMessageBox* settings_dialog::wait_message_box (const QString& text, QWidget *p) +QMessageBox * +settings_dialog::wait_message_box (const QString& text, QWidget *p) { QMessageBox *info = new QMessageBox (p); @@ -1860,7 +1888,8 @@ return info; } -void settings_dialog::close_wait_message_box (QMessageBox *mbox) +void +settings_dialog::close_wait_message_box (QMessageBox *mbox) { QApplication::restoreOverrideCursor (); mbox->close ();
--- a/libgui/src/shortcuts-tree-widget.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/shortcuts-tree-widget.cc Fri Dec 22 12:14:08 2023 -0500 @@ -54,7 +54,8 @@ } // new keyPressEvent -void enter_shortcut::keyPressEvent (QKeyEvent *e) +void +enter_shortcut::keyPressEvent (QKeyEvent *e) { if (! m_direct_shortcut) { @@ -85,7 +86,8 @@ } // slot for checkbox whether the shortcut is directly entered or not -void enter_shortcut::handle_direct_shortcut (int state) +void +enter_shortcut::handle_direct_shortcut (int state) { if (state) m_direct_shortcut = true; // the shortcut is directly entered @@ -94,7 +96,8 @@ } // slot for checkbox whether the shift modifier should be added -void enter_shortcut::handle_shift_modifier (int state) +void +enter_shortcut::handle_shift_modifier (int state) { if (state) m_shift_modifier = true; // the shortcut is directly entered @@ -117,37 +120,44 @@ set_actual_text (actual_text); } -QString tree_widget_shortcut_item::settings_key () const +QString +tree_widget_shortcut_item::settings_key () const { return m_settings_key; } -QString tree_widget_shortcut_item::description () const +QString +tree_widget_shortcut_item::description () const { return text (DESCRIPTION_COLUMN); } -void tree_widget_shortcut_item::set_description (const QString& text) +void +tree_widget_shortcut_item::set_description (const QString& text) { setText (DESCRIPTION_COLUMN, text); } -QString tree_widget_shortcut_item::default_text () const +QString +tree_widget_shortcut_item::default_text () const { return text (DEFAULT_COLUMN); } -void tree_widget_shortcut_item::set_default_text (const QString& text) +void +tree_widget_shortcut_item::set_default_text (const QString& text) { setText (DEFAULT_COLUMN, text); } -QString tree_widget_shortcut_item::actual_text () const +QString +tree_widget_shortcut_item::actual_text () const { return text (ACTUAL_COLUMN); } -void tree_widget_shortcut_item::set_actual_text (const QString& text) +void +tree_widget_shortcut_item::set_actual_text (const QString& text) { setText (ACTUAL_COLUMN, text); } @@ -262,7 +272,8 @@ setFocusProxy (m_edit_actual); } -void shortcut_edit_dialog::finished (int result) +void +shortcut_edit_dialog::finished (int result) { if (result == QDialog::Rejected) return; @@ -273,7 +284,7 @@ // organized the sections as child groups instead of using a colon in // the settings key to separate the section from the shortcut name. - // Note that m_settings_key doesn't begin with the sc_group prefix. + // Note that m_settings_key doesn't begin with the sc_group prefix. QString my_section = get_shortcut_section (m_settings_key); QString actual_text = m_edit_actual->text (); @@ -333,7 +344,8 @@ m_shortcut_item->set_actual_text (actual_text); } -void shortcut_edit_dialog::set_default_shortcut () +void +shortcut_edit_dialog::set_default_shortcut () { // Just remove user-set value so that the default will be used. m_edit_actual->setText (""); @@ -504,8 +516,9 @@ dialog->show (); } -void shortcuts_tree_widget::update_widget_value (const QString& settings_key, - const QString& sc_text) +void +shortcuts_tree_widget::update_widget_value (const QString& settings_key, + const QString& sc_text) { tree_widget_shortcut_item *item = get_item (settings_key); @@ -546,8 +559,9 @@ return item; } -void shortcuts_tree_widget::update_settings_value (gui_settings& settings, - const QString& settings_key) +void +shortcuts_tree_widget::update_settings_value (gui_settings& settings, + const QString& settings_key) { tree_widget_shortcut_item *item = get_item (settings_key); @@ -557,7 +571,8 @@ // Refresh the tree view with values from the settings object. -void shortcuts_tree_widget::import_shortcuts (gui_settings& settings) +void +shortcuts_tree_widget::import_shortcuts (gui_settings& settings) { settings.beginGroup (sc_group); @@ -609,7 +624,8 @@ // Export all shortcuts from the tree view to the settings object. -void shortcuts_tree_widget::export_shortcuts (gui_settings& settings) +void +shortcuts_tree_widget::export_shortcuts (gui_settings& settings) { settings.beginGroup (sc_group); @@ -654,7 +670,8 @@ // Clear all user-defined settings from the tree widget and the // application settings. -void shortcuts_tree_widget::set_default_shortcuts () +void +shortcuts_tree_widget::set_default_shortcuts () { gui_settings settings; @@ -701,7 +718,8 @@ // For each key found in application settings object, transfer // corresponding setting to the application settings object. -void shortcuts_tree_widget::write_settings () +void +shortcuts_tree_widget::write_settings () { gui_settings settings;
--- a/libgui/src/tab-bar.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/tab-bar.cc Fri Dec 22 12:14:08 2023 -0500 @@ -39,36 +39,42 @@ // tab_bar::tab_bar (QWidget *p) -: QTabBar (p), m_context_menu (new QMenu (this)) + : QTabBar (p), m_context_menu (new QMenu (this)) { } -void tab_bar::set_rotated (int rotated) +void +tab_bar::set_rotated (int rotated) { m_rotated = rotated; } // slots for tab navigation -void tab_bar::switch_left_tab () +void +tab_bar::switch_left_tab () { switch_tab (-1); } -void tab_bar::switch_right_tab () +void +tab_bar::switch_right_tab () { switch_tab (1); } -void tab_bar::move_tab_left () +void +tab_bar::move_tab_left () { switch_tab (-1, true); } -void tab_bar::move_tab_right () +void +tab_bar::move_tab_right () { switch_tab (1, true); } -void tab_bar::switch_tab (int direction, bool movetab) +void +tab_bar::switch_tab (int direction, bool movetab) { int tabs = count (); @@ -91,7 +97,8 @@ setCurrentIndex (new_pos); } -void tab_bar::sort_tabs_alph () +void +tab_bar::sort_tabs_alph () { QString current_title = tabText (currentIndex ()); int tab_with_focus = 0; @@ -133,7 +140,8 @@ // https://stackoverflow.com/a/50579369 // Reimplemented size hint allowing rotated tabs -QSize tab_bar::tabSizeHint (int idx) const +QSize +tab_bar::tabSizeHint (int idx) const { QSize s = QTabBar::tabSizeHint (idx); if (m_rotated) @@ -143,7 +151,8 @@ } // Reimplemented paint event allowing rotated tabs -void tab_bar::paintEvent(QPaintEvent *e) +void +tab_bar::paintEvent(QPaintEvent *e) { // Just process the original event if not rotated if (! m_rotated) @@ -175,7 +184,8 @@ } // Reimplement mouse event for filtering out the desired mouse clicks -void tab_bar::mousePressEvent (QMouseEvent *me) +void +tab_bar::mousePressEvent (QMouseEvent *me) { QPoint click_pos; int clicked_idx = -1; @@ -273,7 +283,8 @@ } // Slot if a menu entry in the context menu is activated -void tab_bar::ctx_menu_activated (QAction *a) +void +tab_bar::ctx_menu_activated (QAction *a) { // If the index of the activated action is in the range of // the current tabs, set the related current tab. The basic actions
--- a/libgui/src/terminal-dock-widget.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/terminal-dock-widget.cc Fri Dec 22 12:14:08 2023 -0500 @@ -72,10 +72,10 @@ widget, &command_widget::insert_interpreter_output); connect (this, &terminal_dock_widget::execute_command_signal, - con, &console::execute_command); + con, &console::execute_command); connect (this, &terminal_dock_widget::new_command_line_signal, - con, &console::new_command_line); + con, &console::new_command_line); m_terminal = widget; #endif @@ -141,32 +141,37 @@ make_window (); } -bool terminal_dock_widget::has_focus () const +bool +terminal_dock_widget::has_focus () const { QWidget *w = widget (); return w->hasFocus (); } -QTerminal * terminal_dock_widget::get_qterminal () +QTerminal * +terminal_dock_widget::get_qterminal () { return (m_experimental_terminal_widget ? nullptr : dynamic_cast<QTerminal *> (m_terminal)); } #if defined (HAVE_QSCINTILLA) -command_widget * terminal_dock_widget::get_command_widget () +command_widget * +terminal_dock_widget::get_command_widget () { return (m_experimental_terminal_widget ? dynamic_cast<command_widget *> (m_terminal) : nullptr); } #endif -void terminal_dock_widget::notice_settings () +void +terminal_dock_widget::notice_settings () { emit settings_changed (); } -void terminal_dock_widget::init_command_prompt () +void +terminal_dock_widget::init_command_prompt () { if (m_experimental_terminal_widget) { @@ -178,7 +183,8 @@ } } -void terminal_dock_widget::init_control_d_shortcut_behavior () +void +terminal_dock_widget::init_control_d_shortcut_behavior () { gui_settings settings; @@ -210,7 +216,7 @@ break; } } - } + } } OCTAVE_END_NAMESPACE(octave)
--- a/libgui/src/variable-editor-model.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/variable-editor-model.cc Fri Dec 22 12:14:08 2023 -0500 @@ -179,7 +179,7 @@ } else { - dim_vector dv = elt.dims (); + const dim_vector& dv = elt.dims (); str = "[" + dv.str () + " " + elt.class_name () + "]"; } @@ -294,7 +294,7 @@ if (! lbl_txt.isEmpty ()) lbl_txt += " "; - dim_vector dv = m_value.dims (); + const dim_vector& dv = m_value.dims (); lbl_txt += ("[" + QString::fromStdString (dv.str ())
--- a/libgui/src/variable-editor.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/variable-editor.cc Fri Dec 22 12:14:08 2023 -0500 @@ -291,7 +291,8 @@ } } -void variable_dock_widget::resizeEvent (QResizeEvent *) +void +variable_dock_widget::resizeEvent (QResizeEvent *) { if (m_frame) m_frame->resize (size ()); @@ -1063,7 +1064,8 @@ installEventFilter (this); } -bool HoverToolButton::eventFilter (QObject *obj, QEvent *ev) +bool +HoverToolButton::eventFilter (QObject *obj, QEvent *ev) { if (ev->type () == QEvent::HoverEnter) emit hovered_signal (); @@ -1079,7 +1081,8 @@ installEventFilter (this); } -bool ReturnFocusToolButton::eventFilter (QObject *obj, QEvent *ev) +bool +ReturnFocusToolButton::eventFilter (QObject *obj, QEvent *ev) { if (ev->type () == QEvent::MouseButtonRelease && isDown ()) @@ -1103,7 +1106,8 @@ installEventFilter (this); } -bool ReturnFocusMenu::eventFilter (QObject *obj, QEvent *ev) +bool +ReturnFocusMenu::eventFilter (QObject *obj, QEvent *ev) { if (ev->type () == QEvent::MouseButtonRelease && underMouse ()) { @@ -1175,7 +1179,8 @@ make_window (); } -void variable_editor::focusInEvent (QFocusEvent *ev) +void +variable_editor::focusInEvent (QFocusEvent *ev) { octave_dock_widget::focusInEvent (ev); @@ -1222,7 +1227,7 @@ for (long long int i = 0; i < m_variables.size (); i++) { if (m_variables.at (i) != nullptr) - disconnect (m_variables.at (i), SIGNAL (destroyed (QObject*)), 0, 0); + disconnect (m_variables.at (i), SIGNAL (destroyed (QObject *)), 0, 0); } } @@ -1620,7 +1625,8 @@ // Also updates the font. -void variable_editor::update_colors () +void +variable_editor::update_colors () { m_stylesheet = "";
--- a/libgui/src/variable-editor.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/variable-editor.h Fri Dec 22 12:14:08 2023 -0500 @@ -394,7 +394,7 @@ void construct_tool_bar (); - QList<variable_dock_widget*> m_variables; + QList<variable_dock_widget *> m_variables; QString m_current_focus_vname;
--- a/libgui/src/welcome-wizard.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/welcome-wizard.cc Fri Dec 22 12:14:08 2023 -0500 @@ -33,8 +33,8 @@ #include <QVBoxLayout> #if defined (OCTAVE_USE_WINDOWS_API) - #define WIN32_LEAN_AND_MEAN - #include <windows.h> +#define WIN32_LEAN_AND_MEAN +#include <windows.h> #endif #include "gui-preferences-dw.h" @@ -91,7 +91,8 @@ #endif } -void welcome_wizard::adjust_size () +void +welcome_wizard::adjust_size () { // Get adjusted size for the current page adjustSize (); @@ -106,12 +107,14 @@ m_max_width = sz.width (); } -void welcome_wizard::handle_web_connect_option (int state) +void +welcome_wizard::handle_web_connect_option (int state) { m_allow_web_connect_state = state == Qt::Checked; } -void welcome_wizard::show_page () +void +welcome_wizard::show_page () { delete m_current_page; delete layout (); @@ -124,21 +127,24 @@ new_layout->addWidget (m_current_page); } -void welcome_wizard::previous_page () +void +welcome_wizard::previous_page () { --m_page_list_iterator; show_page (); } -void welcome_wizard::next_page () +void +welcome_wizard::next_page () { ++m_page_list_iterator; show_page (); } -void welcome_wizard::accept () +void +welcome_wizard::accept () { // Create default settings file.
--- a/libgui/src/workspace-view.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libgui/src/workspace-view.cc Fri Dec 22 12:14:08 2023 -0500 @@ -153,7 +153,8 @@ make_window (); } -void workspace_view::setModel (workspace_model *model) +void +workspace_view::setModel (workspace_model *model) { m_filter_model.setSourceModel (model); m_filter_model.setFilterKeyColumn(0); @@ -231,7 +232,8 @@ octave_dock_widget::save_settings (); } -void workspace_view::set_filter_focus (bool focus) +void +workspace_view::set_filter_focus (bool focus) { if (focus) {
--- a/libinterp/corefcn/Cell.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/Cell.h Fri Dec 22 12:14:08 2023 -0500 @@ -37,9 +37,7 @@ class octave_value_list; -class -OCTINTERP_API -Cell : public Array<octave_value> +class OCTINTERP_API Cell : public Array<octave_value> { public:
--- a/libinterp/corefcn/__betainc__.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/__betainc__.cc Fri Dec 22 12:14:08 2023 -0500 @@ -79,7 +79,7 @@ // Initialize variables used in algorithm static const float tiny = math::exp2 (-50.0f); - static const float eps = std::numeric_limits<float>::epsilon (); + static constexpr float eps = std::numeric_limits<float>::epsilon (); float xj, x2, y, Cj, Dj, aj, bj, Deltaj, alpha_j, beta_j; int j, maxit; maxit = 200; @@ -150,7 +150,7 @@ // Initialize variables used in algorithm static const double tiny = math::exp2 (-100.0); - static const double eps = std::numeric_limits<double>::epsilon (); + static constexpr double eps = std::numeric_limits<double>::epsilon (); double xj, x2, y, Cj, Dj, aj, bj, Deltaj, alpha_j, beta_j; int j, maxit; maxit = 200;
--- a/libinterp/corefcn/__expint__.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/__expint__.cc Fri Dec 22 12:14:08 2023 -0500 @@ -65,7 +65,7 @@ // Initialize variables used in algorithm static const FloatComplex tiny = math::exp2 (-50.0f); - static const float eps = std::numeric_limits<float>::epsilon (); + static constexpr float eps = std::numeric_limits<float>::epsilon (); const FloatComplex cone (1.0, 0.0); const FloatComplex czero (0.0, 0.0); const int maxit = 100; @@ -123,7 +123,7 @@ // Initialize variables used in algorithm static const Complex tiny = math::exp2 (-100.0); - static const double eps = std::numeric_limits<double>::epsilon (); + static constexpr double eps = std::numeric_limits<double>::epsilon (); const Complex cone (1.0, 0.0); const Complex czero (0.0, 0.0); const int maxit = 200;
--- a/libinterp/corefcn/__gammainc__.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/__gammainc__.cc Fri Dec 22 12:14:08 2023 -0500 @@ -71,7 +71,7 @@ // Initialize variables used in algorithm static const float tiny = math::exp2 (-50.0f); - static const float eps = std::numeric_limits<float>::epsilon(); + static constexpr float eps = std::numeric_limits<float>::epsilon(); float y, Cj, Dj, bj, aj, Deltaj; int j, maxit; maxit = 200; @@ -126,7 +126,7 @@ // Initialize variables used in algorithm static const double tiny = math::exp2 (-100.0); - static const double eps = std::numeric_limits<double>::epsilon(); + static constexpr double eps = std::numeric_limits<double>::epsilon(); double y, Cj, Dj, bj, aj, Deltaj; int j, maxit; maxit = 200;
--- a/libinterp/corefcn/__magick_read__.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/__magick_read__.cc Fri Dec 22 12:14:08 2023 -0500 @@ -176,8 +176,7 @@ return output; } -class -image_region +class image_region { public:
--- a/libinterp/corefcn/auto-shlib.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/auto-shlib.h Fri Dec 22 12:14:08 2023 -0500 @@ -37,9 +37,7 @@ // time. When deriving new classes, you can either use it as a field or // as a parent (with multiple inheritance). -class -OCTINTERP_API -auto_shlib : public dynamic_library +class OCTINTERP_API auto_shlib : public dynamic_library { public:
--- a/libinterp/corefcn/base-text-renderer.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/base-text-renderer.h Fri Dec 22 12:14:08 2023 -0500 @@ -40,8 +40,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) -class -base_text_renderer : public text_processor +class base_text_renderer : public text_processor { public:
--- a/libinterp/corefcn/besselj.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/besselj.cc Fri Dec 22 12:14:08 2023 -0500 @@ -153,8 +153,8 @@ } else { - dim_vector dv0 = args(0).dims (); - dim_vector dv1 = args(1).dims (); + const dim_vector& dv0 = args(0).dims (); + const dim_vector& dv1 = args(1).dims (); bool args0_is_row_vector = (dv0(1) == dv0.numel ()); bool args1_is_col_vector = (dv1(0) == dv1.numel ()); @@ -244,8 +244,8 @@ } else { - dim_vector dv0 = args(0).dims (); - dim_vector dv1 = args(1).dims (); + const dim_vector& dv0 = args(0).dims (); + const dim_vector& dv1 = args(1).dims (); bool args0_is_row_vector = (dv0(1) == dv0.numel ()); bool args1_is_col_vector = (dv1(0) == dv1.numel ());
--- a/libinterp/corefcn/bitfcns.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/bitfcns.cc Fri Dec 22 12:14:08 2023 -0500 @@ -89,8 +89,8 @@ bool is_scalar_op = (nelx == 1 || nely == 1); - dim_vector dvx = x.dims (); - dim_vector dvy = y.dims (); + const dim_vector& dvx = x.dims (); + const dim_vector& dvy = y.dims (); bool is_array_op = (dvx == dvy); @@ -475,8 +475,8 @@ \ bool is_scalar_op = (m_nel == 1 || n_nel == 1); \ \ - dim_vector m_dv = m.dims (); \ - dim_vector n_dv = n.dims (); \ + const dim_vector& m_dv = m.dims (); \ + const dim_vector& n_dv = n.dims (); \ \ bool is_array_op = (m_dv == n_dv); \ \
--- a/libinterp/corefcn/c-file-ptr-stream.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/c-file-ptr-stream.h Fri Dec 22 12:14:08 2023 -0500 @@ -37,8 +37,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) -class -c_file_ptr_buf : public std::streambuf +class c_file_ptr_buf : public std::streambuf { public: @@ -106,8 +105,7 @@ // FIXME: the following three classes could probably share some code... template <typename STREAM_T, typename FILE_T, typename BUF_T> -class -c_file_ptr_stream : public STREAM_T +class c_file_ptr_stream : public STREAM_T { public: @@ -148,8 +146,7 @@ #if defined (HAVE_ZLIB) -class -c_zfile_ptr_buf : public std::streambuf +class c_zfile_ptr_buf : public std::streambuf { public:
--- a/libinterp/corefcn/call-stack.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/call-stack.h Fri Dec 22 12:14:08 2023 -0500 @@ -50,9 +50,7 @@ class symbol_info_list; class unwind_protect; -class -OCTINTERP_API -call_stack +class OCTINTERP_API call_stack { public:
--- a/libinterp/corefcn/cellfun.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/cellfun.cc Fri Dec 22 12:14:08 2023 -0500 @@ -197,7 +197,7 @@ for (octave_idx_type count = 0; count < k; count++) { - dim_vector dv = f_args.elem (count).dims (); + const dim_vector& dv = f_args.elem (count).dims (); if (d < dv.ndims ()) result(count) = static_cast<double> (dv(d)); else @@ -1789,7 +1789,7 @@ if (! dimv.isempty ()) error ("num2cell (A, dim) not implemented for class objects"); - dim_vector dv = get_object_dims (array); + const dim_vector& dv = get_object_dims (array); retval.resize (dv);
--- a/libinterp/corefcn/chol.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/chol.cc Fri Dec 22 12:14:08 2023 -0500 @@ -1187,9 +1187,9 @@ positive definite matrix @w{@var{A} = @var{R}'*@var{R}}, @var{R}@tie{}upper triangular, return the Cholesky@tie{}factorization of @w{@var{A}(p,p)}, where @w{p} is the permutation @* -@code{p = [1:i-1, shift(i:j, 1), j+1:n]} if @w{@var{i} < @var{j}} @* +@code{p = [1:i-1, circshift(i:j, 1), j+1:n]} if @w{@var{i} < @var{j}} @* or @* -@code{p = [1:j-1, shift(j:i,-1), i+1:n]} if @w{@var{j} < @var{i}}. @* +@code{p = [1:j-1, circshift(j:i,-1), i+1:n]} if @w{@var{j} < @var{i}}. @* @seealso{chol, cholupdate, cholinsert, choldelete} @end deftypefn */) @@ -1276,13 +1276,13 @@ %!test %! R = chol (A); %! -%! i = 1; j = 3; p = [1:i-1, shift(i:j,-1), j+1:4]; +%! i = 1; j = 3; p = [1:i-1, circshift(i:j,-1), j+1:4]; %! R1 = cholshift (R, i, j); %! %! assert (norm (triu (R1)-R1, Inf), 0); %! assert (norm (R1'*R1 - A(p,p), Inf), 0, 1e1*eps); %! -%! j = 1; i = 3; p = [1:j-1, shift(j:i,+1), i+1:4]; +%! j = 1; i = 3; p = [1:j-1, circshift(j:i,+1), i+1:4]; %! R1 = cholshift (R, i, j); %! %! assert (norm (triu (R1) - R1, Inf), 0); @@ -1291,13 +1291,13 @@ %!test %! R = chol (Ac); %! -%! i = 1; j = 3; p = [1:i-1, shift(i:j,-1), j+1:4]; +%! i = 1; j = 3; p = [1:i-1, circshift(i:j,-1), j+1:4]; %! R1 = cholshift (R, i, j); %! %! assert (norm (triu (R1)-R1, Inf), 0); %! assert (norm (R1'*R1 - Ac(p,p), Inf), 0, 1e1*eps); %! -%! j = 1; i = 3; p = [1:j-1, shift(j:i,+1), i+1:4]; +%! j = 1; i = 3; p = [1:j-1, circshift(j:i,+1), i+1:4]; %! R1 = cholshift (R, i, j); %! %! assert (norm (triu (R1)-R1, Inf), 0); @@ -1306,13 +1306,13 @@ %!test %! R = chol (single (A)); %! -%! i = 1; j = 3; p = [1:i-1, shift(i:j,-1), j+1:4]; +%! i = 1; j = 3; p = [1:i-1, circshift(i:j,-1), j+1:4]; %! R1 = cholshift (R, i, j); %! %! assert (norm (triu (R1)-R1, Inf), 0); %! assert (norm (R1'*R1 - single (A(p,p)), Inf), 0, 1e1* eps ("single")); %! -%! j = 1; i = 3; p = [1:j-1, shift(j:i,+1), i+1:4]; +%! j = 1; i = 3; p = [1:j-1, circshift(j:i,+1), i+1:4]; %! R1 = cholshift (R, i, j); %! %! assert (norm (triu (R1)-R1, Inf), 0); @@ -1321,13 +1321,13 @@ %!test %! R = chol (single (Ac)); %! -%! i = 1; j = 3; p = [1:i-1, shift(i:j,-1), j+1:4]; +%! i = 1; j = 3; p = [1:i-1, circshift(i:j,-1), j+1:4]; %! R1 = cholshift (R, i, j); %! %! assert (norm (triu (R1)-R1, Inf), 0); %! assert (norm (R1'*R1 - single (Ac(p,p)), Inf), 0, 1e1* eps ("single")); %! -%! j = 1; i = 3; p = [1:j-1, shift(j:i,+1), i+1:4]; +%! j = 1; i = 3; p = [1:j-1, circshift(j:i,+1), i+1:4]; %! R1 = cholshift (R, i, j); %! %! assert (norm (triu (R1)-R1, Inf), 0);
--- a/libinterp/corefcn/data.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/data.cc Fri Dec 22 12:14:08 2023 -0500 @@ -2006,7 +2006,7 @@ // the right type. tmp = cat_op (tmp, args(j), ra_idx); - dim_vector dv_tmp = args(j).dims (); + const dim_vector& dv_tmp = args(j).dims (); if (dim >= dv_len) { @@ -2927,11 +2927,11 @@ if (nargin >= 1) { - dim_vector a_dims = args(0).dims (); + const dim_vector& a_dims = args(0).dims (); for (int i = 1; i < nargin; ++i) { - dim_vector b_dims = args(i).dims (); + const dim_vector& b_dims = args(i).dims (); if (a_dims != b_dims) return ovl (false); @@ -2993,9 +2993,14 @@ DEFUN (rows, args, , doc: /* -*- texinfo -*- @deftypefn {} {@var{nr} =} rows (@var{A}) +@deftypefnx () {@var{nr} =} height (@var{A}) Return the number of rows of @var{A}. This is equivalent to @code{size (@var{A}, 1)}. + +Programming Note: @code{height} is an alias for @code{rows} and can be +used interchangeably. + @seealso{columns, size, length, numel, isscalar, isvector, ismatrix} @end deftypefn */) { @@ -3008,6 +3013,8 @@ return ovl ((octave_value (args(0)).size ())(0)); } +DEFALIAS (height, rows); + /* %!assert (rows (ones (2,5)), 2) %!assert (rows (ones (5,2)), 5) @@ -3038,9 +3045,14 @@ DEFUN (columns, args, , doc: /* -*- texinfo -*- @deftypefn {} {@var{nc} =} columns (@var{A}) +@deftypefnx {} {@var{nc} =} width (@var{A}) Return the number of columns of @var{A}. This is equivalent to @code{size (@var{A}, 2)}. + +Programming Note: @code{width} is an alias for @code{columns} and can be +used interchangeably. + @seealso{rows, size, length, numel, isscalar, isvector, ismatrix} @end deftypefn */) { @@ -3053,6 +3065,8 @@ return ovl ((octave_value (args(0)).size ())(1)); } +DEFALIAS (width, columns); + DEFUN (sum, args, , doc: /* -*- texinfo -*- @deftypefn {} {@var{y} =} sum (@var{x}) @@ -5659,9 +5673,9 @@ octave_value arg_1 = args(0); octave_value arg_2 = args(1); - dim_vector sz1 = arg_1.dims (); + const dim_vector& sz1 = arg_1.dims (); bool isvector1 = sz1.ndims () == 2 && (sz1(0) == 1 || sz1(1) == 1); - dim_vector sz2 = arg_2.dims (); + const dim_vector& sz2 = arg_2.dims (); bool isvector2 = sz2.ndims () == 2 && (sz2(0) == 1 || sz2(1) == 1); if (! isvector1 || ! isvector2) @@ -7863,7 +7877,7 @@ else if (idx.extent (n) > n) error ("accumdim: index out of range"); - dim_vector vals_dim = vals.dims (); + const dim_vector& vals_dim = vals.dims (); dim_vector rdv = vals_dim; if (dim < 0) @@ -7947,7 +7961,7 @@ const NDT& tval, const NDT& fval) { typedef typename NDT::element_type T; - dim_vector dv = mask.dims (); + const dim_vector& dv = mask.dims (); NDT retval (dv); bool tscl = tval.numel () == 1;
--- a/libinterp/corefcn/dlmread.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/dlmread.cc Fri Dec 22 12:14:08 2023 -0500 @@ -47,10 +47,10 @@ #include "ovl.h" #include "utils.h" -static const octave_idx_type idx_max +static constexpr octave_idx_type idx_max = std::numeric_limits<octave_idx_type>::max () - 1; -static const double idx_max_dbl = double (idx_max); +static constexpr double idx_max_dbl = double (idx_max); static bool read_cell_spec (std::istream& is, octave_idx_type& row, octave_idx_type& col)
--- a/libinterp/corefcn/dynamic-ld.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/dynamic-ld.h Fri Dec 22 12:14:08 2023 -0500 @@ -39,13 +39,11 @@ class interpreter; -class -dynamic_loader +class dynamic_loader { private: - class - shlibs_list + class shlibs_list { public:
--- a/libinterp/corefcn/ellipj.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/ellipj.cc Fri Dec 22 12:14:08 2023 -0500 @@ -117,7 +117,7 @@ // u is matrix, m is scalar ComplexNDArray u = u_arg.xcomplex_array_value ("ellipj: U must be a scalar or matrix"); - dim_vector sz_u = u.dims (); + const dim_vector& sz_u = u.dims (); ComplexNDArray sn (sz_u), cn (sz_u), dn (sz_u); NDArray err (sz_u); @@ -139,7 +139,7 @@ { NDArray m = args(1).xarray_value ("ellipj: M must be a scalar or matrix"); - dim_vector sz_m = m.dims (); + const dim_vector& sz_m = m.dims (); if (u_arg.is_scalar_type ()) { @@ -193,7 +193,7 @@ // u is real array, m is array NDArray u = u_arg.xarray_value ("ellipj: U must be a scalar or matrix"); - dim_vector sz_u = u.dims (); + const dim_vector& sz_u = u.dims (); if (sz_u.ndims () == 2 && sz_m.ndims () == 2 && sz_u(1) == 1 && sz_m(0) == 1) @@ -241,7 +241,7 @@ // u is complex array, m is array ComplexNDArray u = u_arg.xcomplex_array_value ("ellipj: U must be a scalar or matrix"); - dim_vector sz_u = u.dims (); + const dim_vector& sz_u = u.dims (); if (sz_u.ndims () == 2 && sz_m.ndims () == 2 && sz_u(1) == 1 && sz_m(0) == 1)
--- a/libinterp/corefcn/event-manager.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/event-manager.h Fri Dec 22 12:14:08 2023 -0500 @@ -288,9 +288,7 @@ //! This class provides thread-safe communication between the //! interpreter and a GUI. -class -OCTINTERP_API -event_manager +class OCTINTERP_API event_manager { public:
--- a/libinterp/corefcn/event-queue.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/event-queue.h Fri Dec 22 12:14:08 2023 -0500 @@ -35,8 +35,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) -class -event_queue : public action_container +class event_queue : public action_container { public: @@ -88,8 +87,7 @@ // possibility of seeing an exception (or interrupt) in the cleanup actions. // Not that we can do much about it, but at least we won't crash. -class -event_queue_safe : public event_queue +class event_queue_safe : public event_queue { public:
--- a/libinterp/corefcn/filter.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/filter.cc Fri Dec 22 12:14:08 2023 -0500 @@ -68,13 +68,13 @@ if (norm == static_cast<T> (0.0)) error ("filter: the first element of A must be nonzero"); - dim_vector x_dims = x.dims (); + const dim_vector& x_dims = x.dims (); if (dim < 0 || dim > x_dims.ndims ()) error ("filter: DIM must be a valid dimension"); octave_idx_type x_len = x_dims(dim); - dim_vector si_dims = si.dims (); + const dim_vector& si_dims = si.dims (); octave_idx_type si_len = si_dims(0); if (si_len != ab_len - 1) @@ -239,7 +239,7 @@ MArray<T> filter (MArray<T>& b, MArray<T>& a, MArray<T>& x, int dim = -1) { - dim_vector x_dims = x.dims (); + const dim_vector& x_dims = x.dims (); if (dim < 0) dim = x_dims.first_non_singleton (); @@ -369,7 +369,7 @@ print_usage (); int dim; - dim_vector x_dims = args(2).dims (); + const dim_vector& x_dims = args(2).dims (); if (nargin == 5) {
--- a/libinterp/corefcn/find.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/find.cc Fri Dec 22 12:14:08 2023 -0500 @@ -451,7 +451,7 @@ octave_value result = arg.index_vector ().unmask (); - dim_vector dv = result.dims (); + const dim_vector& dv = result.dims (); retval(0) = (dv.all_zero () || dv.isvector () ? result : result.reshape (dv.as_column ()));
--- a/libinterp/corefcn/ft-text-renderer.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/ft-text-renderer.cc Fri Dec 22 12:14:08 2023 -0500 @@ -97,8 +97,7 @@ // Forward declaration static void ft_face_destroyed (void *object); -class -ft_manager +class ft_manager { private: @@ -450,9 +449,7 @@ ft_manager::font_destroyed (reinterpret_cast<FT_Face> (object)); } -class -OCTINTERP_API -ft_text_renderer : public base_text_renderer +class OCTINTERP_API ft_text_renderer : public base_text_renderer { public:
--- a/libinterp/corefcn/gl-render.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/gl-render.cc Fri Dec 22 12:14:08 2023 -0500 @@ -180,7 +180,7 @@ { opengl_texture retval (glfcns); - dim_vector dv (data.dims ()); + const dim_vector& dv = data.dims (); // Expect RGB data if (dv.ndims () == 3 && (dv(2) == 3 || dv(2) == 4)) @@ -339,8 +339,7 @@ return retval; } -class -opengl_tessellator +class opengl_tessellator { public: #if defined (HAVE_FRAMEWORK_OPENGL) && defined (HAVE_GLUTESSCALLBACK_THREEDOTS) @@ -508,8 +507,7 @@ std::shared_ptr<vertex_data_rep> m_rep; }; -class -opengl_renderer::patch_tessellator : public opengl_tessellator +class opengl_renderer::patch_tessellator : public opengl_tessellator { public: @@ -675,8 +673,7 @@ #else -class -opengl_renderer::patch_tessellator +class opengl_renderer::patch_tessellator { // Dummy class. }; @@ -2543,11 +2540,11 @@ NDArray c; const NDArray vn = props.get_vertexnormals ().array_value (); - dim_vector vn_dims = vn.dims (); + const dim_vector& vn_dims = vn.dims (); bool has_vertex_normals = (vn_dims(0) == zr && vn_dims(1) == zc && vn_dims(2) == 3); const NDArray fn = props.get_facenormals ().array_value (); - dim_vector fn_dims = fn.dims (); + const dim_vector& fn_dims = fn.dims (); bool has_face_normals = (fn_dims(0) == zr - 1 && fn_dims(1) == zc - 1 && fn_dims(2) == 3); @@ -4090,7 +4087,7 @@ { #if defined (HAVE_OPENGL) - dim_vector dv (cdata.dims ()); + const dim_vector& dv = cdata.dims (); int h = dv(0); int w = dv(1); double x0, x1, y0, y1;
--- a/libinterp/corefcn/gl-render.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/gl-render.h Fri Dec 22 12:14:08 2023 -0500 @@ -35,9 +35,7 @@ class opengl_functions; -class -OCTINTERP_API -opengl_renderer +class OCTINTERP_API opengl_renderer { public:
--- a/libinterp/corefcn/gl2ps-print.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/gl2ps-print.cc Fri Dec 22 12:14:08 2023 -0500 @@ -57,9 +57,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) -class -OCTINTERP_API -gl2ps_renderer : public opengl_renderer +class OCTINTERP_API gl2ps_renderer : public opengl_renderer { public: @@ -1236,7 +1234,7 @@ gl2ps_renderer::draw_image (const image::properties& props) { octave_value cdata = props.get_color_data (); - dim_vector dv (cdata.dims ()); + const dim_vector& dv = cdata.dims (); int h = dv(0); int w = dv(1); @@ -1522,10 +1520,10 @@ OCTAVE_LOCAL_BUFFER (float, tmp_data, static_cast<size_t> (3)*w*h); - static const float maxval = std::numeric_limits<uint8_t>::max (); + static constexpr float MAXVAL = std::numeric_limits<uint8_t>::max (); for (int i = 0; i < 3*w*h; i++) - tmp_data[i] = data[i] / maxval; + tmp_data[i] = data[i] / MAXVAL; draw_pixels (w, h, tmp_data); } @@ -1537,10 +1535,10 @@ OCTAVE_LOCAL_BUFFER (float, tmp_data, static_cast<size_t> (3)*w*h); - static const float maxval = std::numeric_limits<uint16_t>::max (); + static constexpr float MAXVAL = std::numeric_limits<uint16_t>::max (); for (int i = 0; i < 3*w*h; i++) - tmp_data[i] = data[i] / maxval; + tmp_data[i] = data[i] / MAXVAL; draw_pixels (w, h, tmp_data); }
--- a/libinterp/corefcn/graphics.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/graphics.cc Fri Dec 22 12:14:08 2023 -0500 @@ -1579,7 +1579,7 @@ if (xok && m_size_constraints.size () > 0) { - dim_vector vdims = v.dims (); + const dim_vector& vdims = v.dims (); int vlen = vdims.ndims (); xok = false; @@ -7364,20 +7364,20 @@ magform ((hi - lo) / ticint, a, b); - static const double sqrt_2 = sqrt (2.0); - static const double sqrt_10 = sqrt (10.0); - static const double sqrt_50 = sqrt (50.0); - - if (a < sqrt_2) + static const double SQRT_2 = sqrt (2.0); + static const double SQRT_10 = sqrt (10.0); + static const double SQRT_50 = sqrt (50.0); + + if (a < SQRT_2) x = 1; - else if (a < sqrt_10) + else if (a < SQRT_10) x = 2; - else if (a < sqrt_50) + else if (a < SQRT_50) x = 5; else x = 10; - return x * std::pow (10., b); + return x * std::pow (10.0, b); } // Attempt to make "nice" limits from the actual max and min of the data. @@ -11591,8 +11591,7 @@ return parent_go.get_factory_default (type () + name); } -class -callback_event : public base_graphics_event +class callback_event : public base_graphics_event { public: callback_event (const graphics_handle& h, const std::string& name, @@ -11628,8 +11627,7 @@ octave_value m_callback_data; }; -class -mcode_event : public base_graphics_event +class mcode_event : public base_graphics_event { public: mcode_event (const graphics_handle& h, const std::string& cmd, @@ -11662,8 +11660,7 @@ std::string m_mcode; }; -class -function_event : public base_graphics_event +class function_event : public base_graphics_event { public: @@ -11687,8 +11684,7 @@ void *m_function_data; }; -class -set_event : public base_graphics_event +class set_event : public base_graphics_event { public: set_event (const graphics_handle& h, const std::string& name,
--- a/libinterp/corefcn/graphics.in.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/graphics.in.h Fri Dec 22 12:14:08 2023 -0500 @@ -4899,7 +4899,7 @@ Matrix get_auto_xdata () { - dim_vector dv = get_cdata ().dims (); + const dim_vector& dv = get_cdata ().dims (); Matrix data; if (dv(1) > 0.) { @@ -4911,7 +4911,7 @@ Matrix get_auto_ydata () { - dim_vector dv = get_cdata ().dims (); + const dim_vector& dv = get_cdata ().dims (); Matrix data; if (dv(0) > 0.) { @@ -6681,9 +6681,7 @@ class graphics_event; -class -OCTINTERP_API -base_graphics_event +class OCTINTERP_API base_graphics_event { public: enum priority { INTERRUPT, QUEUE, CANCEL }; @@ -6710,9 +6708,7 @@ int m_busyaction; }; -class -OCTINTERP_API -graphics_event +class OCTINTERP_API graphics_event { public:
--- a/libinterp/corefcn/input.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/input.cc Fri Dec 22 12:14:08 2023 -0500 @@ -261,13 +261,13 @@ is_completing_dirfns () { static std::string dirfns_commands[] = {"cd", "isfile", "isfolder", "ls"}; - static const std::size_t dirfns_commands_length = 4; + static const std::size_t DIRFNS_COMMANDS_LENGTH = 4; bool retval = false; std::string line = command_editor::get_line_buffer (); - for (std::size_t i = 0; i < dirfns_commands_length; i++) + for (std::size_t i = 0; i < DIRFNS_COMMANDS_LENGTH; i++) { int index = line.find (dirfns_commands[i] + ' '); @@ -889,8 +889,7 @@ return retval; } -class -terminal_reader : public base_reader +class terminal_reader : public base_reader { public: @@ -912,8 +911,7 @@ static const std::string s_in_src; }; -class -file_reader : public base_reader +class file_reader : public base_reader { public: @@ -942,8 +940,7 @@ static const std::string s_in_src; }; -class -eval_string_reader : public base_reader +class eval_string_reader : public base_reader { public:
--- a/libinterp/corefcn/jsondecode.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/jsondecode.cc Fri Dec 22 12:14:08 2023 -0500 @@ -241,7 +241,7 @@ if (same_field_names) { octave_map struct_array; - dim_vector struct_array_dims = dim_vector (struct_cell.numel (), 1); + const dim_vector& struct_array_dims = dim_vector (struct_cell.numel (), 1); if (field_names.numel ()) { @@ -300,7 +300,7 @@ bool is_struct = cell(0).isstruct (); string_vector field_names = is_struct ? cell(0).map_value ().fieldnames () : string_vector (); - dim_vector sub_array_dims = cell(0).dims (); + const dim_vector& sub_array_dims = cell(0).dims (); octave_idx_type sub_array_ndims = cell(0).ndims (); octave_idx_type cell_numel = cell.numel (); for (octave_idx_type i = 0; i < cell_numel; ++i)
--- a/libinterp/corefcn/jsonencode.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/jsonencode.cc Fri Dec 22 12:14:08 2023 -0500 @@ -61,22 +61,26 @@ encode_numeric (T& writer, const octave_value& obj, const bool& ConvertInfAndNaN) { - double value = obj.scalar_value (); + if (obj.isfloat ()) + { + double value = obj.scalar_value (); - if (obj.is_bool_scalar ()) + // Any numeric input from the interpreter will be in double type so in + // order to detect ints, we will check if the floor of the input and the + // input are equal using fabs (A - B) < epsilon method as it is more + // accurate. If value > 999999, MATLAB will encode it in scientific + // notation (double). + if (fabs (floor (value) - value) < std::numeric_limits<double>::epsilon () + && fabs (value) <= 999999) + writer.Int64 (value); + // Possibly write NULL for non-finite values (-Inf, Inf, NaN, NA) + else if (ConvertInfAndNaN && ! octave::math::isfinite (value)) + writer.Null (); + else + writer.Double (value); + } + else if (obj.is_bool_scalar ()) writer.Bool (obj.bool_value ()); - // Any numeric input from the interpreter will be in double type so in order - // to detect ints, we will check if the floor of the input and the input are - // equal using fabs (A - B) < epsilon method as it is more accurate. - // If value > 999999, MATLAB will encode it in scientific notation (double) - else if (fabs (floor (value) - value) < std::numeric_limits<double>::epsilon () - && value <= 999999 && value >= -999999) - writer.Int64 (value); - // Possibly write NULL for non-finite values (-Inf, Inf, NaN, NA) - else if (ConvertInfAndNaN && ! octave::math::isfinite (value)) - writer.Null (); - else if (obj.is_double_type ()) - writer.Double (value); else error ("jsonencode: unsupported type"); } @@ -313,7 +317,7 @@ { octave_idx_type idx; octave_idx_type ndims = array.ndims (); - dim_vector dims = array.dims (); + const dim_vector& dims = array.dims (); // In this case, we already have a vector. So, we transform it to 2-D // vector in order to be detected by "isvector" in the recursive call
--- a/libinterp/corefcn/latex-text-renderer.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/latex-text-renderer.cc Fri Dec 22 12:14:08 2023 -0500 @@ -49,9 +49,7 @@ return ('"' + str + '"'); } -class -OCTINTERP_API -latex_renderer : public base_text_renderer +class OCTINTERP_API latex_renderer : public base_text_renderer { public:
--- a/libinterp/corefcn/load-path.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/load-path.h Fri Dec 22 12:14:08 2023 -0500 @@ -41,9 +41,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) -class -OCTINTERP_API -load_path +class OCTINTERP_API load_path { public:
--- a/libinterp/corefcn/ls-mat5.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/ls-mat5.cc Fri Dec 22 12:14:08 2023 -0500 @@ -2114,7 +2114,7 @@ maybe_convert_to_u16 (const charNDArray& chm, std::size_t& n16_str) { uint16_t *u16_str; - dim_vector dv = chm.dims (); + const dim_vector& dv = chm.dims (); if (chm.ndims () == 2 && dv(0) == 1) { @@ -2328,7 +2328,7 @@ std::string cname = tc.class_name (); std::size_t max_namelen = 63; - dim_vector dv = tc.dims (); + const dim_vector& dv = tc.dims (); int nd = tc.ndims (); int dim_len = 4*nd;
--- a/libinterp/corefcn/matrix_type.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/matrix_type.cc Fri Dec 22 12:14:08 2023 -0500 @@ -274,7 +274,7 @@ const ColumnVector perm = args(2).xvector_value ("matrix_type: Invalid permutation vector PERM"); octave_idx_type len = perm.numel (); - dim_vector dv = args(0).dims (); + const dim_vector& dv = args(0).dims (); if (len != dv(0)) error ("matrix_type: Invalid permutation vector PERM"); @@ -411,7 +411,7 @@ const ColumnVector perm = args(2).xvector_value ("matrix_type: Invalid permutation vector PERM"); octave_idx_type len = perm.numel (); - dim_vector dv = args(0).dims (); + const dim_vector& dv = args(0).dims (); if (len != dv(0)) error ("matrix_type: Invalid permutation vector PERM");
--- a/libinterp/corefcn/mex.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/mex.cc Fri Dec 22 12:14:08 2023 -0500 @@ -577,7 +577,7 @@ m_dims = static_cast<mwSize *> (mxArray::malloc (m_ndims * sizeof (mwSize))); - dim_vector dv = m_val.dims (); + const dim_vector& dv = m_val.dims (); for (mwIndex i = 0; i < m_ndims; i++) m_dims[i] = dv(i); @@ -1870,7 +1870,7 @@ { octave_value retval; - dim_vector dv = dims_to_dim_vector (); + const dim_vector& dv = dims_to_dim_vector (); switch (get_class_id ()) { @@ -2189,7 +2189,7 @@ octave_value retval; - dim_vector dv = dims_to_dim_vector (); + const dim_vector& dv = dims_to_dim_vector (); switch (get_class_id ()) { @@ -2361,7 +2361,7 @@ { octave_value retval; - dim_vector dv = dims_to_dim_vector (); + const dim_vector& dv = dims_to_dim_vector (); switch (get_class_id ()) { @@ -2545,7 +2545,7 @@ octave_value retval; - dim_vector dv = dims_to_dim_vector (); + const dim_vector& dv = dims_to_dim_vector (); switch (get_class_id ()) { @@ -2822,7 +2822,7 @@ octave_value as_octave_value (void) const { - dim_vector dv = dims_to_dim_vector (); + const dim_vector& dv = dims_to_dim_vector (); string_vector keys (m_fields, m_nfields); @@ -2925,7 +2925,7 @@ octave_value as_octave_value (void) const { - dim_vector dv = dims_to_dim_vector (); + const dim_vector& dv = dims_to_dim_vector (); Cell c (dv);
--- a/libinterp/corefcn/mx-type-traits.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/mx-type-traits.h Fri Dec 22 12:14:08 2023 -0500 @@ -32,8 +32,7 @@ #include "oct-inttypes-fwd.h" template <typename T> -class -mx_type_traits +class mx_type_traits { public: static const mxClassID mx_class; @@ -41,8 +40,7 @@ }; template <> -class -mx_type_traits<bool> +class mx_type_traits<bool> { public: static const mxClassID mx_class = mxLOGICAL_CLASS; @@ -50,8 +48,7 @@ }; template <> -class -mx_type_traits<char> +class mx_type_traits<char> { public: static const mxClassID mx_class = mxCHAR_CLASS; @@ -59,8 +56,7 @@ }; template <> -class -mx_type_traits<double> +class mx_type_traits<double> { public: static const mxClassID mx_class = mxDOUBLE_CLASS; @@ -68,8 +64,7 @@ }; template <> -class -mx_type_traits<float> +class mx_type_traits<float> { public: static const mxClassID mx_class = mxSINGLE_CLASS; @@ -77,8 +72,7 @@ }; template <> -class -mx_type_traits<octave_int8> +class mx_type_traits<octave_int8> { public: static const mxClassID mx_class = mxINT8_CLASS; @@ -86,8 +80,7 @@ }; template <> -class -mx_type_traits<octave_uint8> +class mx_type_traits<octave_uint8> { public: static const mxClassID mx_class = mxUINT8_CLASS; @@ -95,8 +88,7 @@ }; template <> -class -mx_type_traits<octave_int16> +class mx_type_traits<octave_int16> { public: static const mxClassID mx_class = mxINT16_CLASS; @@ -104,8 +96,7 @@ }; template <> -class -mx_type_traits<octave_uint16> +class mx_type_traits<octave_uint16> { public: static const mxClassID mx_class = mxUINT16_CLASS; @@ -113,8 +104,7 @@ }; template <> -class -mx_type_traits<octave_int32> +class mx_type_traits<octave_int32> { public: static const mxClassID mx_class = mxINT32_CLASS; @@ -122,8 +112,7 @@ }; template <> -class -mx_type_traits<octave_uint32> +class mx_type_traits<octave_uint32> { public: static const mxClassID mx_class = mxUINT32_CLASS; @@ -131,8 +120,7 @@ }; template <> -class -mx_type_traits<octave_int64> +class mx_type_traits<octave_int64> { public: static const mxClassID mx_class = mxINT64_CLASS; @@ -140,8 +128,7 @@ }; template <> -class -mx_type_traits<octave_uint64> +class mx_type_traits<octave_uint64> { public: static const mxClassID mx_class = mxUINT64_CLASS;
--- a/libinterp/corefcn/oct-errno.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/oct-errno.h Fri Dec 22 12:14:08 2023 -0500 @@ -34,8 +34,7 @@ #include "oct-map.h" -class -octave_errno +class octave_errno { protected:
--- a/libinterp/corefcn/oct-fstrm.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/oct-fstrm.h Fri Dec 22 12:14:08 2023 -0500 @@ -35,8 +35,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) -class -fstream : public base_stream +class fstream : public base_stream { public:
--- a/libinterp/corefcn/oct-iostrm.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/oct-iostrm.h Fri Dec 22 12:14:08 2023 -0500 @@ -34,8 +34,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) -class -base_iostream : public base_stream +class base_iostream : public base_stream { public: @@ -79,8 +78,7 @@ virtual const char * stream_type () const = 0; }; -class -istream : public base_iostream +class istream : public base_iostream { public: @@ -113,8 +111,7 @@ const char * stream_type () const { return "istream"; } }; -class -ostream : public base_iostream +class ostream : public base_iostream { public:
--- a/libinterp/corefcn/oct-map.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/oct-map.cc Fri Dec 22 12:14:08 2023 -0500 @@ -1334,7 +1334,7 @@ } else { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.all_zero ()) *this = rb;
--- a/libinterp/corefcn/oct-prcstrm.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/oct-prcstrm.h Fri Dec 22 12:14:08 2023 -0500 @@ -40,8 +40,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) -class -octave_iprocstream : public octave::stdiostream +class octave_iprocstream : public octave::stdiostream { public: @@ -64,8 +63,7 @@ ~octave_iprocstream (); }; -class -octave_oprocstream : public octave::stdiostream +class octave_oprocstream : public octave::stdiostream { public:
--- a/libinterp/corefcn/oct-procbuf.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/oct-procbuf.h Fri Dec 22 12:14:08 2023 -0500 @@ -37,8 +37,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) -class -procbuf : public c_file_ptr_buf +class procbuf : public c_file_ptr_buf { public:
--- a/libinterp/corefcn/oct-process.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/oct-process.h Fri Dec 22 12:14:08 2023 -0500 @@ -32,8 +32,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) -class -process_execution_result +class process_execution_result { public:
--- a/libinterp/corefcn/oct-stdstrm.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/oct-stdstrm.h Fri Dec 22 12:14:08 2023 -0500 @@ -36,8 +36,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) template <typename BUF_T, typename STREAM_T, typename FILE_T> -class -tstdiostream : public base_stream +class tstdiostream : public base_stream { public: @@ -119,8 +118,7 @@ int m_fnum; }; -class -stdiostream +class stdiostream : public tstdiostream<c_file_ptr_buf, io_c_file_ptr_stream, FILE *> { public: @@ -152,8 +150,7 @@ #if defined (HAVE_ZLIB) -class -zstdiostream +class zstdiostream : public tstdiostream<c_zfile_ptr_buf, io_c_zfile_ptr_stream, gzFile> { public:
--- a/libinterp/corefcn/oct-stream.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/oct-stream.cc Fri Dec 22 12:14:08 2023 -0500 @@ -142,9 +142,8 @@ ::error ("%s: negative value invalid as size specification", who.c_str ()); - static const double out_of_range_top - = static_cast<double> (std::numeric_limits<octave_idx_type>::max ()) - + 1.; + static constexpr double out_of_range_top + = static_cast<double> (std::numeric_limits<octave_idx_type>::max ()) + 1.0; if (d >= out_of_range_top) ::error ("%s: dimension too large for Octave's index type", who.c_str ()); @@ -240,8 +239,7 @@ return retval; } -class -scanf_format_elt +class scanf_format_elt { public: @@ -285,8 +283,7 @@ std::string char_class; }; -class -scanf_format_list +class scanf_format_list { public: @@ -748,8 +745,7 @@ return false; } -class -printf_format_elt +class printf_format_elt { public: @@ -789,8 +785,7 @@ char modifier; }; -class -printf_format_list +class printf_format_list { public: @@ -1214,8 +1209,7 @@ // of the buffer and the buffer is refilled. This also allows cheap // seek and tell operations within a "fast read" block. -class -delimited_stream +class delimited_stream { public: @@ -1637,8 +1631,7 @@ // A single conversion specifier, such as %f or %c. -class -textscan_format_elt +class textscan_format_elt { public: @@ -1692,8 +1685,7 @@ class textscan; -class -textscan_format_list +class textscan_format_list { public: @@ -1803,9 +1795,7 @@ // textscan scanner (); // scanner.scan (...); -class -OCTINTERP_API -textscan +class OCTINTERP_API textscan { public: @@ -5482,8 +5472,7 @@ return retval; } -class -printf_value_cache +class printf_value_cache { public:
--- a/libinterp/corefcn/oct-stream.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/oct-stream.h Fri Dec 22 12:14:08 2023 -0500 @@ -63,9 +63,7 @@ // Provide an interface for Octave streams. -class -OCTINTERP_API -base_stream +class OCTINTERP_API base_stream { friend class stream; @@ -297,9 +295,7 @@ invalid_operation (const std::string& who, const char *rw); }; -class -OCTINTERP_API -stream +class OCTINTERP_API stream { public: @@ -499,9 +495,7 @@ mach_info::float_format ffmt); }; -class -OCTINTERP_API -stream_list +class OCTINTERP_API stream_list { public:
--- a/libinterp/corefcn/oct-strstrm.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/oct-strstrm.h Fri Dec 22 12:14:08 2023 -0500 @@ -35,8 +35,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) -class -base_strstream : public base_stream +class base_strstream : public base_stream { public: @@ -73,8 +72,7 @@ virtual void clear () = 0; }; -class -istrstream : public base_strstream +class istrstream : public base_strstream { public: @@ -133,8 +131,7 @@ std::istringstream m_istream; }; -class -ostrstream : public base_strstream +class ostrstream : public base_strstream { public:
--- a/libinterp/corefcn/pager.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/pager.h Fri Dec 22 12:14:08 2023 -0500 @@ -41,9 +41,7 @@ class interpreter; class oprocstream; -class -OCTINTERP_API -pager_buf : public std::stringbuf +class OCTINTERP_API pager_buf : public std::stringbuf { public: @@ -66,9 +64,7 @@ std::size_t m_diary_skip; }; -class -OCTINTERP_API -pager_stream : public std::ostream +class OCTINTERP_API pager_stream : public std::ostream { public: @@ -91,9 +87,7 @@ pager_buf *m_pb; }; -class -OCTINTERP_API -diary_buf : public std::stringbuf +class OCTINTERP_API diary_buf : public std::stringbuf { public: @@ -105,9 +99,7 @@ int sync (); }; -class -OCTINTERP_API -diary_stream : public std::ostream +class OCTINTERP_API diary_stream : public std::ostream { public:
--- a/libinterp/corefcn/pr-flt-fmt.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/pr-flt-fmt.h Fri Dec 22 12:14:08 2023 -0500 @@ -44,9 +44,7 @@ extern OCTINTERP_API void set_output_prec (int prec); -class -OCTINTERP_API -float_format +class OCTINTERP_API float_format { public: @@ -205,9 +203,7 @@ int m_sp; }; -class -OCTINTERP_API -float_display_format +class OCTINTERP_API float_display_format { public:
--- a/libinterp/corefcn/pr-output.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/pr-output.cc Fri Dec 22 12:14:08 2023 -0500 @@ -2124,7 +2124,7 @@ int ndims = nda.ndims (); - dim_vector dims = nda.dims (); + const dim_vector& dims = nda.dims (); Array<octave_idx_type> ra_idx (dim_vector (ndims, 1), 0); @@ -2712,7 +2712,7 @@ { int ndims = nda.ndims (); - dim_vector dims = nda.dims (); + const dim_vector& dims = nda.dims (); Array<octave_idx_type> ra_idx (dim_vector (ndims, 1), 0); @@ -2784,8 +2784,7 @@ } template <typename T> -class -octave_print_conv +class octave_print_conv { public: typedef T print_conv_type; @@ -2954,7 +2953,7 @@ Array<octave_idx_type> ra_idx (dim_vector (ndims, 1), 0); - dim_vector dims = nda.dims (); + const dim_vector& dims = nda.dims (); octave_idx_type m = 1; @@ -3023,7 +3022,7 @@ { int ndims = nda.ndims (); - dim_vector dims = nda.dims (); + const dim_vector& dims = nda.dims (); Array<octave_idx_type> ra_idx (dim_vector (ndims, 1), 0);
--- a/libinterp/corefcn/pr-output.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/pr-output.h Fri Dec 22 12:14:08 2023 -0500 @@ -508,8 +508,7 @@ bool pr_as_read_syntax = false); template <typename T> -class -pr_engineering_float +class pr_engineering_float { public: @@ -529,8 +528,7 @@ }; template <typename T> -class -pr_formatted_float +class pr_formatted_float { public: @@ -546,8 +544,7 @@ }; template <typename T> -class -pr_rational_float +class pr_rational_float { public:
--- a/libinterp/corefcn/procstream.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/procstream.h Fri Dec 22 12:14:08 2023 -0500 @@ -37,9 +37,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) -class -OCTINTERP_API -procstreambase : virtual public std::ios +class OCTINTERP_API procstreambase : virtual public std::ios { public: @@ -80,9 +78,7 @@ } }; -class -OCTINTERP_API -iprocstream : public std::istream, public procstreambase +class OCTINTERP_API iprocstream : public std::istream, public procstreambase { public: @@ -111,9 +107,7 @@ } }; -class -OCTINTERP_API -oprocstream : public std::ostream, public procstreambase +class OCTINTERP_API oprocstream : public std::ostream, public procstreambase { public: @@ -140,9 +134,7 @@ } }; -class -OCTINTERP_API -procstream : public std::iostream, public procstreambase +class OCTINTERP_API procstream : public std::iostream, public procstreambase { public:
--- a/libinterp/corefcn/qr.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/qr.cc Fri Dec 22 12:14:08 2023 -0500 @@ -1925,9 +1925,9 @@ @w{@var{A} = @var{Q}*@var{R}}, @var{Q}@tie{}unitary and @var{R}@tie{}upper trapezoidal, return the QR@tie{}factorization of @w{@var{A}(:,p)}, where @w{p} is the permutation @* -@code{p = [1:i-1, shift(i:j, 1), j+1:n]} if @w{@var{i} < @var{j}} @* +@code{p = [1:i-1, circshift(i:j, 1), j+1:n]} if @w{@var{i} < @var{j}} @* or @* -@code{p = [1:j-1, shift(j:i,-1), i+1:n]} if @w{@var{j} < @var{i}}. @* +@code{p = [1:j-1, circshift(j:i,-1), i+1:n]} if @w{@var{j} < @var{i}}. @* @seealso{qr, qrupdate, qrinsert, qrdelete} @end deftypefn */) @@ -2011,7 +2011,7 @@ /* %!test %! AA = A.'; -%! i = 2; j = 4; p = [1:i-1, shift(i:j,-1), j+1:5]; +%! i = 2; j = 4; p = [1:i-1, circshift(i:j,-1), j+1:5]; %! %! [Q,R] = qr (AA); %! [Q,R] = qrshift (Q, R, i, j); @@ -2019,7 +2019,7 @@ %! assert (norm (vec (triu (R) - R), Inf), 0); %! assert (norm (vec (Q*R - AA(:,p)), Inf), 0, norm (AA)*1e1*eps); %! -%! j = 2; i = 4; p = [1:j-1, shift(j:i,+1), i+1:5]; +%! j = 2; i = 4; p = [1:j-1, circshift(j:i,+1), i+1:5]; %! %! [Q,R] = qr (AA); %! [Q,R] = qrshift (Q, R, i, j); @@ -2029,7 +2029,7 @@ %! %!test %! AA = Ac.'; -%! i = 2; j = 4; p = [1:i-1, shift(i:j,-1), j+1:5]; +%! i = 2; j = 4; p = [1:i-1, circshift(i:j,-1), j+1:5]; %! %! [Q,R] = qr (AA); %! [Q,R] = qrshift (Q, R, i, j); @@ -2037,7 +2037,7 @@ %! assert (norm (vec (triu (R) - R), Inf), 0); %! assert (norm (vec (Q*R - AA(:,p)), Inf), 0, norm (AA)*1e1*eps); %! -%! j = 2; i = 4; p = [1:j-1, shift(j:i,+1), i+1:5]; +%! j = 2; i = 4; p = [1:j-1, circshift(j:i,+1), i+1:5]; %! %! [Q,R] = qr (AA); %! [Q,R] = qrshift (Q, R, i, j); @@ -2047,7 +2047,7 @@ %!test %! AA = single (A).'; -%! i = 2; j = 4; p = [1:i-1, shift(i:j,-1), j+1:5]; +%! i = 2; j = 4; p = [1:i-1, circshift(i:j,-1), j+1:5]; %! %! [Q,R] = qr (AA); %! [Q,R] = qrshift (Q, R, i, j); @@ -2057,7 +2057,7 @@ %! assert (norm (vec (Q*R - AA(:,p)), Inf), single (0), ... %! norm (AA)*1e1 * eps ("single")); %! -%! j = 2; i = 4; p = [1:j-1, shift(j:i,+1), i+1:5]; +%! j = 2; i = 4; p = [1:j-1, circshift(j:i,+1), i+1:5]; %! %! [Q,R] = qr (AA); %! [Q,R] = qrshift (Q, R, i, j); @@ -2069,7 +2069,7 @@ %! %!test %! AA = single (Ac).'; -%! i = 2; j = 4; p = [1:i-1, shift(i:j,-1), j+1:5]; +%! i = 2; j = 4; p = [1:i-1, circshift(i:j,-1), j+1:5]; %! %! [Q,R] = qr (AA); %! [Q,R] = qrshift (Q, R, i, j); @@ -2079,7 +2079,7 @@ %! assert (norm (vec (Q*R - AA(:,p)), Inf), single (0), ... %! norm (AA)*1e1 * eps ("single")); %! -%! j = 2; i = 4; p = [1:j-1, shift(j:i,+1), i+1:5]; +%! j = 2; i = 4; p = [1:j-1, circshift(j:i,+1), i+1:5]; %! %! [Q,R] = qr (AA); %! [Q,R] = qrshift (Q, R, i, j);
--- a/libinterp/corefcn/quadcc.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/quadcc.cc Fri Dec 22 12:14:08 2023 -0500 @@ -61,7 +61,7 @@ }; // Define relative tolerance used when deciding to drop an interval. -static const double DROP_RELTOL = std::numeric_limits<double>::epsilon () * 10; +static constexpr double DROP_RELTOL = std::numeric_limits<double>::epsilon () * 10; // Some constants and matrices that we'll need.
--- a/libinterp/corefcn/sub2ind.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/sub2ind.cc Fri Dec 22 12:14:08 2023 -0500 @@ -117,7 +117,7 @@ if (nargin < 2) print_usage (); - dim_vector dv = get_dim_vector (args(0), "sub2ind"); + const dim_vector& dv = get_dim_vector (args(0), "sub2ind"); Array<idx_vector> idxa (dim_vector (nargin-1, 1));
--- a/libinterp/corefcn/syminfo.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/syminfo.h Fri Dec 22 12:14:08 2023 -0500 @@ -50,9 +50,7 @@ std::string line; }; -class -OCTINTERP_API -symbol_info +class OCTINTERP_API symbol_info { public: @@ -90,9 +88,7 @@ bool m_is_persistent; }; -class -OCTINTERP_API -symbol_info_list : public base_list<symbol_info> +class OCTINTERP_API symbol_info_list : public base_list<symbol_info> { public:
--- a/libinterp/corefcn/symrec.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/symrec.h Fri Dec 22 12:14:08 2023 -0500 @@ -125,11 +125,18 @@ | ADDED_STATIC); } + void mark_variable () + { + m_storage_class = static_cast<symrec_t> (m_storage_class | VARIABLE); + } + + OCTAVE_DEPRECATED (10, "symbol_record_rep::mark_as_variable is obsolete, use mark_variable") void mark_as_variable () { m_storage_class = static_cast<symrec_t> (m_storage_class | VARIABLE); } + void unmark_local () { m_storage_class = static_cast<symrec_t> (m_storage_class & ~LOCAL); @@ -146,6 +153,12 @@ & ~ADDED_STATIC); } + void unmark_variable () + { + m_storage_class = static_cast<symrec_t> (m_storage_class & ~VARIABLE); + } + + OCTAVE_DEPRECATED (10, "symbol_record_rep::unmark_as_variable is obsolete, use unmark_variable") void unmark_as_variable () { m_storage_class = static_cast<symrec_t> (m_storage_class & ~VARIABLE); @@ -216,12 +229,16 @@ void mark_local () { m_rep->mark_local (); } void mark_formal () { m_rep->mark_formal (); } void mark_added_static () { m_rep->mark_added_static (); } - void mark_as_variable () { m_rep->mark_as_variable (); } + void mark_variable () { m_rep->mark_variable (); } + OCTAVE_DEPRECATED (10, "symbol_record::mark_as_variable is obsolete, use mark_variable") + void mark_as_variable () { m_rep->mark_variable (); } void unmark_local () { m_rep->unmark_local (); } void unmark_formal () { m_rep->unmark_formal (); } void unmark_added_static () { m_rep->unmark_added_static (); } - void unmark_as_variable () { m_rep->unmark_as_variable (); } + void unmark_variable () { m_rep->unmark_variable (); } + OCTAVE_DEPRECATED (10, "symbol_record::unmark_as_variable is obsolete, use unmark_variable") + void unmark_as_variable () { m_rep->unmark_variable (); } unsigned int storage_class () const { return m_rep->storage_class (); }
--- a/libinterp/corefcn/symscope.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/symscope.cc Fri Dec 22 12:14:08 2023 -0500 @@ -281,7 +281,7 @@ table_iterator p = m_symbols.find (nm); if (p != m_symbols.end ()) - p->second.mark_as_variable (); + p->second.mark_variable (); } void
--- a/libinterp/corefcn/text-engine.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/text-engine.h Fri Dec 22 12:14:08 2023 -0500 @@ -51,9 +51,7 @@ class text_processor; -class -OCTINTERP_API -text_element +class OCTINTERP_API text_element { public: @@ -64,9 +62,7 @@ virtual void accept (text_processor& p) = 0; }; -class -OCTINTERP_API -text_element_string : public text_element +class OCTINTERP_API text_element_string : public text_element { public: @@ -84,9 +80,7 @@ std::string m_str; }; -class -OCTINTERP_API -text_element_symbol : public text_element +class OCTINTERP_API text_element_symbol : public text_element { public: @@ -109,9 +103,7 @@ int m_symbol; }; -class -OCTINTERP_API -text_element_list +class OCTINTERP_API text_element_list : public text_element, public base_list<text_element *> { public: @@ -137,9 +129,7 @@ void accept (text_processor& p); }; -class -OCTINTERP_API -text_element_subscript : public text_element +class OCTINTERP_API text_element_subscript : public text_element { public: @@ -164,9 +154,7 @@ text_element *m_elem; }; -class -OCTINTERP_API -text_element_superscript : public text_element +class OCTINTERP_API text_element_superscript : public text_element { public: @@ -191,9 +179,7 @@ text_element *m_elem; }; -class -OCTINTERP_API -text_element_combined : public text_element_list +class OCTINTERP_API text_element_combined : public text_element_list { public: @@ -209,9 +195,7 @@ void accept (text_processor& p); }; -class -OCTINTERP_API -text_element_fontstyle : public text_element +class OCTINTERP_API text_element_fontstyle : public text_element { public: @@ -239,9 +223,7 @@ fontstyle m_style; }; -class -OCTINTERP_API -text_element_fontname : public text_element +class OCTINTERP_API text_element_fontname : public text_element { public: @@ -261,9 +243,7 @@ std::string m_name; }; -class -OCTINTERP_API -text_element_fontsize : public text_element +class OCTINTERP_API text_element_fontsize : public text_element { public: @@ -283,9 +263,7 @@ double m_size; }; -class -OCTINTERP_API -text_element_color : public text_element +class OCTINTERP_API text_element_color : public text_element { public: @@ -328,9 +306,7 @@ Matrix m_rgb; }; -class -OCTINTERP_API -text_processor +class OCTINTERP_API text_processor { public: @@ -389,9 +365,7 @@ TEXT_ELEMENT_ACCEPT(text_element_fontsize) TEXT_ELEMENT_ACCEPT(text_element_color) -class -OCTINTERP_API -text_parser +class OCTINTERP_API text_parser { public: @@ -406,9 +380,7 @@ const caseless_str& interpreter); }; -class -OCTINTERP_API -text_parser_none : public text_parser +class OCTINTERP_API text_parser_none : public text_parser { public: @@ -425,9 +397,7 @@ } }; -class -OCTINTERP_API -text_parser_tex : public text_parser +class OCTINTERP_API text_parser_tex : public text_parser { public:
--- a/libinterp/corefcn/text-renderer.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/text-renderer.h Fri Dec 22 12:14:08 2023 -0500 @@ -41,9 +41,7 @@ class base_text_renderer; class text_element; -class -OCTINTERP_API -text_renderer +class OCTINTERP_API text_renderer { public:
--- a/libinterp/corefcn/tril.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/tril.cc Fri Dec 22 12:14:08 2023 -0500 @@ -208,7 +208,7 @@ octave_value arg = args(0); - dim_vector dims = arg.dims (); + const dim_vector& dims = arg.dims (); if (dims.ndims () != 2) error ("%s: need a 2-D matrix", name.c_str ()); else if (k < -dims(0))
--- a/libinterp/corefcn/utils.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/utils.h Fri Dec 22 12:14:08 2023 -0500 @@ -51,9 +51,7 @@ //! Extracting options separately for multiple (e.g. 1000+) function calls //! avoids expensive repetitive parsing of the very same options. -class -OCTINTERP_API -make_valid_name_options +class OCTINTERP_API make_valid_name_options { public:
--- a/libinterp/corefcn/xpow.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/corefcn/xpow.cc Fri Dec 22 12:14:08 2023 -0500 @@ -83,8 +83,9 @@ static inline bool xisint (float x) { - static const float out_of_range_top - = static_cast<float> (std::numeric_limits<int>::max ()) + 1.; + static constexpr float out_of_range_top + = static_cast<float> (std::numeric_limits<int>::max ()) + 1.0; + return (octave::math::x_nint (x) == x && x < out_of_range_top && x >= std::numeric_limits<int>::min ()); @@ -1259,8 +1260,8 @@ { octave_value retval; - dim_vector a_dims = a.dims (); - dim_vector b_dims = b.dims (); + const dim_vector& a_dims = a.dims (); + const dim_vector& b_dims = b.dims (); if (a_dims != b_dims) { @@ -1342,8 +1343,8 @@ octave_value elem_xpow (const NDArray& a, const ComplexNDArray& b) { - dim_vector a_dims = a.dims (); - dim_vector b_dims = b.dims (); + const dim_vector& a_dims = a.dims (); + const dim_vector& b_dims = b.dims (); if (a_dims != b_dims) { @@ -1437,8 +1438,8 @@ octave_value elem_xpow (const ComplexNDArray& a, const NDArray& b) { - dim_vector a_dims = a.dims (); - dim_vector b_dims = b.dims (); + const dim_vector& a_dims = a.dims (); + const dim_vector& b_dims = b.dims (); if (a_dims != b_dims) { @@ -1482,8 +1483,8 @@ octave_value elem_xpow (const ComplexNDArray& a, const ComplexNDArray& b) { - dim_vector a_dims = a.dims (); - dim_vector b_dims = b.dims (); + const dim_vector& a_dims = a.dims (); + const dim_vector& b_dims = b.dims (); if (a_dims != b_dims) { @@ -2579,8 +2580,8 @@ { octave_value retval; - dim_vector a_dims = a.dims (); - dim_vector b_dims = b.dims (); + const dim_vector& a_dims = a.dims (); + const dim_vector& b_dims = b.dims (); if (a_dims != b_dims) { @@ -2662,8 +2663,8 @@ octave_value elem_xpow (const FloatNDArray& a, const FloatComplexNDArray& b) { - dim_vector a_dims = a.dims (); - dim_vector b_dims = b.dims (); + const dim_vector& a_dims = a.dims (); + const dim_vector& b_dims = b.dims (); if (a_dims != b_dims) { @@ -2757,8 +2758,8 @@ octave_value elem_xpow (const FloatComplexNDArray& a, const FloatNDArray& b) { - dim_vector a_dims = a.dims (); - dim_vector b_dims = b.dims (); + const dim_vector& a_dims = a.dims (); + const dim_vector& b_dims = b.dims (); if (a_dims != b_dims) { @@ -2802,8 +2803,8 @@ octave_value elem_xpow (const FloatComplexNDArray& a, const FloatComplexNDArray& b) { - dim_vector a_dims = a.dims (); - dim_vector b_dims = b.dims (); + const dim_vector& a_dims = a.dims (); + const dim_vector& b_dims = b.dims (); if (a_dims != b_dims) {
--- a/libinterp/octave-value/cdef-class.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/cdef-class.h Fri Dec 22 12:14:08 2023 -0500 @@ -48,14 +48,11 @@ class interpreter; class tree_classdef; -class -OCTINTERP_API -cdef_class : public cdef_meta_object +class OCTINTERP_API cdef_class : public cdef_meta_object { private: - class - cdef_class_rep : public cdef_meta_object_rep + class cdef_class_rep : public cdef_meta_object_rep { public: cdef_class_rep ()
--- a/libinterp/octave-value/cdef-manager.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/cdef-manager.h Fri Dec 22 12:14:08 2023 -0500 @@ -39,9 +39,7 @@ class interpreter; -class -OCTINTERP_API -cdef_manager +class OCTINTERP_API cdef_manager { public:
--- a/libinterp/octave-value/cdef-method.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/cdef-method.h Fri Dec 22 12:14:08 2023 -0500 @@ -39,16 +39,13 @@ OCTAVE_BEGIN_NAMESPACE(octave) -class -OCTINTERP_API -cdef_method : public cdef_meta_object +class OCTINTERP_API cdef_method : public cdef_meta_object { friend class cdef_class; private: - class - cdef_method_rep : public cdef_meta_object_rep + class cdef_method_rep : public cdef_meta_object_rep { public:
--- a/libinterp/octave-value/cdef-object.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/cdef-object.h Fri Dec 22 12:14:08 2023 -0500 @@ -45,9 +45,7 @@ // The actual base class is cdef_class_base, which is declared after // cdef_object, such that it can contain cdef_object objects. -class -OCTINTERP_API -cdef_object_rep +class OCTINTERP_API cdef_object_rep { public: @@ -198,9 +196,7 @@ } }; -class -OCTINTERP_API -cdef_object +class OCTINTERP_API cdef_object { public: @@ -350,9 +346,7 @@ cdef_object_rep *m_rep; }; -class -OCTINTERP_API -cdef_object_base : public cdef_object_rep +class OCTINTERP_API cdef_object_base : public cdef_object_rep { public: @@ -388,9 +382,7 @@ cdef_object m_klass; }; -class -OCTINTERP_API -cdef_object_array : public cdef_object_base +class OCTINTERP_API cdef_object_array : public cdef_object_base { public: @@ -456,9 +448,7 @@ { } }; -class -OCTINTERP_API -cdef_object_scalar : public cdef_object_base +class OCTINTERP_API cdef_object_scalar : public cdef_object_base { public: @@ -543,9 +533,7 @@ { } }; -class -OCTINTERP_API -handle_cdef_object : public cdef_object_scalar +class OCTINTERP_API handle_cdef_object : public cdef_object_scalar { public: @@ -579,9 +567,7 @@ { } }; -class -OCTINTERP_API -value_cdef_object : public cdef_object_scalar +class OCTINTERP_API value_cdef_object : public cdef_object_scalar { public: @@ -610,9 +596,7 @@ { } }; -class -OCTINTERP_API -cdef_meta_object_rep : public handle_cdef_object +class OCTINTERP_API cdef_meta_object_rep : public handle_cdef_object { public: @@ -658,9 +642,7 @@ { } }; -class -OCTINTERP_API -cdef_meta_object : public cdef_object +class OCTINTERP_API cdef_meta_object : public cdef_object { public:
--- a/libinterp/octave-value/cdef-package.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/cdef-package.h Fri Dec 22 12:14:08 2023 -0500 @@ -42,16 +42,13 @@ class interpreter; -class -OCTINTERP_API -cdef_package : public cdef_meta_object +class OCTINTERP_API cdef_package : public cdef_meta_object { friend class cdef_class; private: - class - cdef_package_rep : public cdef_meta_object_rep + class cdef_package_rep : public cdef_meta_object_rep { public:
--- a/libinterp/octave-value/cdef-property.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/cdef-property.h Fri Dec 22 12:14:08 2023 -0500 @@ -40,16 +40,13 @@ OCTAVE_BEGIN_NAMESPACE(octave) -class -OCTINTERP_API -cdef_property : public cdef_meta_object +class OCTINTERP_API cdef_property : public cdef_meta_object { friend class cdef_class; private: - class - cdef_property_rep : public cdef_meta_object_rep + class cdef_property_rep : public cdef_meta_object_rep { public:
--- a/libinterp/octave-value/ov-base-diag.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-base-diag.cc Fri Dec 22 12:14:08 2023 -0500 @@ -553,7 +553,7 @@ bool octave_base_diag<DMT, MT>::print_as_scalar () const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); return (dv.all_ones () || dv.any_zero ()); }
--- a/libinterp/octave-value/ov-base-diag.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-base-diag.h Fri Dec 22 12:14:08 2023 -0500 @@ -43,9 +43,7 @@ // Real matrix values. template <typename DMT, typename MT> -class -OCTINTERP_API -octave_base_diag : public octave_base_value +class OCTINTERP_API octave_base_diag : public octave_base_value { public:
--- a/libinterp/octave-value/ov-base-int.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-base-int.cc Fri Dec 22 12:14:08 2023 -0500 @@ -160,7 +160,7 @@ octave_base_int_matrix<T>::convert_to_str_internal (bool, bool, char type) const { octave_value retval; - dim_vector dv = this->dims (); + const dim_vector& dv = this->dims (); octave_idx_type nel = dv.numel (); charNDArray chm (dv); @@ -177,8 +177,8 @@ val_type ival = tmp.value (); - static const bool is_signed = std::numeric_limits<val_type>::is_signed; - static const bool can_be_larger_than_uchar_max + static constexpr bool is_signed = std::numeric_limits<val_type>::is_signed; + static constexpr bool can_be_larger_than_uchar_max = octave_base_int_helper_traits<val_type>::can_be_larger_than_uchar_max; if (octave_base_int_helper<val_type, is_signed, @@ -288,7 +288,7 @@ bool octave_base_int_matrix<T>::save_ascii (std::ostream& os) { - dim_vector dv = this->dims (); + const dim_vector& dv = this->dims (); os << "# ndims: " << dv.ndims () << "\n"; @@ -334,7 +334,7 @@ bool octave_base_int_matrix<T>::save_binary (std::ostream& os, bool) { - dim_vector dv = this->dims (); + const dim_vector& dv = this->dims (); if (dv.ndims () < 1) return false; @@ -434,7 +434,7 @@ #if defined (HAVE_HDF5) hid_t save_type_hid = save_type; - dim_vector dv = this->dims (); + const dim_vector& dv = this->dims (); int empty = save_hdf5_empty (loc_id, name, dv); if (empty) return (empty > 0); @@ -578,8 +578,8 @@ val_type ival = tmp.value (); - static const bool is_signed = std::numeric_limits<val_type>::is_signed; - static const bool can_be_larger_than_uchar_max + static constexpr bool is_signed = std::numeric_limits<val_type>::is_signed; + static constexpr bool can_be_larger_than_uchar_max = octave_base_int_helper_traits<val_type>::can_be_larger_than_uchar_max; if (octave_base_int_helper<val_type, is_signed,
--- a/libinterp/octave-value/ov-base-int.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-base-int.h Fri Dec 22 12:14:08 2023 -0500 @@ -45,9 +45,7 @@ // base int matrix values. template <typename T> -class -OCTINTERP_API -octave_base_int_matrix : public octave_base_matrix<T> +class OCTINTERP_API octave_base_int_matrix : public octave_base_matrix<T> { public: @@ -117,9 +115,7 @@ // base int scalar values. template <typename T> -class -OCTINTERP_API -octave_base_int_scalar : public octave_base_scalar<T> +class OCTINTERP_API octave_base_int_scalar : public octave_base_scalar<T> { public:
--- a/libinterp/octave-value/ov-base-mat.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-base-mat.cc Fri Dec 22 12:14:08 2023 -0500 @@ -324,8 +324,6 @@ int nd = m_matrix.ndims (); - MT mrhs (dim_vector (1, 1), rhs); - // If we catch an indexing error in index_vector, we flag an error in // index k. Ensure it is the right value before each idx_vector call. // Same variable as used in the for loop in the default case. @@ -348,7 +346,10 @@ if (i.is_scalar () && i(0) < m_matrix.numel ()) m_matrix(i(0)) = rhs; else - m_matrix.assign (i, mrhs); + { + MT mrhs (dim_vector (1, 1), rhs); + m_matrix.assign (i, mrhs); + } } break; @@ -364,7 +365,10 @@ && i(0) < m_matrix.rows () && j(0) < m_matrix.columns ()) m_matrix(i(0), j(0)) = rhs; else - m_matrix.assign (i, j, mrhs); + { + MT mrhs (dim_vector (1, 1), rhs); + m_matrix.assign (i, j, mrhs); + } } break; @@ -396,7 +400,10 @@ m_matrix(j) = rhs; } else - m_matrix.assign (idx_vec, mrhs); + { + MT mrhs (dim_vector (1, 1), rhs); + m_matrix.assign (idx_vec, mrhs); + } } break; } @@ -447,7 +454,7 @@ octave_base_matrix<MT>::is_true () const { bool retval = false; - dim_vector dv = m_matrix.dims (); + const dim_vector& dv = m_matrix.dims (); int nel = dv.numel (); if (nel > 0) @@ -472,7 +479,7 @@ bool octave_base_matrix<MT>::print_as_scalar () const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); return (dv.all_ones () || dv.any_zero ()); }
--- a/libinterp/octave-value/ov-base-mat.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-base-mat.h Fri Dec 22 12:14:08 2023 -0500 @@ -45,9 +45,7 @@ // Real matrix values. template <typename MT> -class -OCTINTERP_API -octave_base_matrix : public octave_base_value +class OCTINTERP_API octave_base_matrix : public octave_base_value { public:
--- a/libinterp/octave-value/ov-base-scalar.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-base-scalar.h Fri Dec 22 12:14:08 2023 -0500 @@ -44,9 +44,7 @@ // Real scalar values. template <typename ST> -class -OCTINTERP_API -octave_base_scalar : public octave_base_value +class OCTINTERP_API octave_base_scalar : public octave_base_value { public:
--- a/libinterp/octave-value/ov-base-sparse.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-base-sparse.cc Fri Dec 22 12:14:08 2023 -0500 @@ -245,7 +245,7 @@ octave_base_sparse<T>::is_true () const { bool retval = false; - dim_vector dv = matrix.dims (); + const dim_vector& dv = matrix.dims (); octave_idx_type nel = dv.numel (); octave_idx_type nz = nnz (); @@ -274,7 +274,7 @@ bool octave_base_sparse<T>::print_as_scalar () const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); return (dv.all_ones () || dv.any_zero ()); } @@ -400,7 +400,7 @@ bool octave_base_sparse<T>::save_ascii (std::ostream& os) { - dim_vector dv = this->dims (); + const dim_vector& dv = this->dims (); // Ensure that additional memory is deallocated matrix.maybe_compress ();
--- a/libinterp/octave-value/ov-base-sparse.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-base-sparse.h Fri Dec 22 12:14:08 2023 -0500 @@ -46,9 +46,7 @@ class octave_sparse_bool_matrix; template <typename T> -class -OCTINTERP_API -octave_base_sparse : public octave_base_value +class OCTINTERP_API octave_base_sparse : public octave_base_value { public:
--- a/libinterp/octave-value/ov-base.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-base.cc Fri Dec 22 12:14:08 2023 -0500 @@ -100,9 +100,6 @@ DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_base_value, "<unknown type>", "unknown"); -// DEPRECATED in Octave 8. -bool Vsparse_auto_mutate = false; - #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC) // Disable this warning for the use of the "count" member variable in // the default constructor. Push the current state so we can restore @@ -532,8 +529,8 @@ err_wrong_type_arg (ee, "octave_base_value::" #F "_value ()", type_name ()); \ } \ \ - static const double out_of_range_top \ - = static_cast<double> (std::numeric_limits<T>::max ()) + 1.; \ + static constexpr double out_of_range_top \ + = static_cast<double> (std::numeric_limits<T>::max ()) + 1.0; \ if (require_int && octave::math::x_nint (d) != d) \ error_with_cfn ("conversion of %g to " #T " value failed", d); \ else if (d < std::numeric_limits<T>::min ()) \
--- a/libinterp/octave-value/ov-base.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-base.h Fri Dec 22 12:14:08 2023 -0500 @@ -233,9 +233,7 @@ // they need (if they are derived from octave_base_value instead of // octave_value). -class -OCTINTERP_API -octave_base_value +class OCTINTERP_API octave_base_value { public: @@ -948,9 +946,7 @@ DECLARE_OV_BASE_TYPEID_FUNCTIONS_AND_DATA }; -class -OCTINTERP_API -octave_base_dld_value : public octave_base_value +class OCTINTERP_API octave_base_dld_value : public octave_base_value { public: @@ -968,9 +964,6 @@ octave::auto_shlib m_containing_dynamic_library; }; -OCTAVE_DEPRECATED (8, "Vsparse_auto_mutate is obsolete and is now always false") -extern OCTINTERP_API bool Vsparse_auto_mutate; - // Utility function to convert C++ arguments used in subsref/subsasgn into an // octave_value_list object that can be used to call a function/method in the // interpreter.
--- a/libinterp/octave-value/ov-bool-mat.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-bool-mat.cc Fri Dec 22 12:14:08 2023 -0500 @@ -237,7 +237,7 @@ bool octave_bool_matrix::save_ascii (std::ostream& os) { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.ndims () > 2) { NDArray tmp = array_value (); @@ -348,7 +348,7 @@ octave_bool_matrix::save_binary (std::ostream& os, bool /* save_as_floats */) { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.ndims () < 1) return false; @@ -430,7 +430,7 @@ #if defined (HAVE_HDF5) - dim_vector dv = dims (); + const dim_vector& dv = dims (); int empty = save_hdf5_empty (loc_id, name, dv); if (empty) return (empty > 0);
--- a/libinterp/octave-value/ov-bool-mat.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-bool-mat.h Fri Dec 22 12:14:08 2023 -0500 @@ -48,8 +48,7 @@ // Character matrix values. -class -octave_bool_matrix : public octave_base_matrix<boolNDArray> +class octave_bool_matrix : public octave_base_matrix<boolNDArray> { public:
--- a/libinterp/octave-value/ov-bool-sparse.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-bool-sparse.cc Fri Dec 22 12:14:08 2023 -0500 @@ -180,7 +180,7 @@ bool octave_sparse_bool_matrix::save_binary (std::ostream& os, bool) { - dim_vector dv = this->dims (); + const dim_vector& dv = this->dims (); if (dv.ndims () < 1) return false; @@ -321,7 +321,7 @@ #if defined (HAVE_HDF5) - dim_vector dv = dims (); + const dim_vector& dv = dims (); int empty = save_hdf5_empty (loc_id, name, dv); if (empty) return (empty > 0);
--- a/libinterp/octave-value/ov-bool-sparse.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-bool-sparse.h Fri Dec 22 12:14:08 2023 -0500 @@ -47,9 +47,7 @@ class octave_value_list; -class -OCTINTERP_API -octave_sparse_bool_matrix : public octave_base_sparse<SparseBoolMatrix> +class OCTINTERP_API octave_sparse_bool_matrix : public octave_base_sparse<SparseBoolMatrix> { public:
--- a/libinterp/octave-value/ov-bool.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-bool.h Fri Dec 22 12:14:08 2023 -0500 @@ -48,9 +48,7 @@ // Real scalar values. -class -OCTINTERP_API -octave_bool : public octave_base_scalar<bool> +class OCTINTERP_API octave_bool : public octave_base_scalar<bool> { public:
--- a/libinterp/octave-value/ov-builtin.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-builtin.h Fri Dec 22 12:14:08 2023 -0500 @@ -47,9 +47,7 @@ // Builtin functions. -class -OCTINTERP_API -octave_builtin : public octave_function +class OCTINTERP_API octave_builtin : public octave_function { public:
--- a/libinterp/octave-value/ov-cell.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-cell.cc Fri Dec 22 12:14:08 2023 -0500 @@ -111,7 +111,7 @@ octave_value val = m_matrix(i, j); std::string tname = val.type_name (); - dim_vector dv = val.dims (); + const dim_vector& dv = val.dims (); std::string dimstr = dv.str (); return "[" + dimstr + " " + tname + "]"; } @@ -752,7 +752,7 @@ else { indent (os); - dim_vector dv = m_matrix.dims (); + const dim_vector& dv = m_matrix.dims (); os << '{' << dv.str () << " Cell Array}"; newline (os); } @@ -788,7 +788,7 @@ bool octave_cell::save_ascii (std::ostream& os) { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.ndims () > 2) { os << "# ndims: " << dv.ndims () << "\n"; @@ -941,7 +941,7 @@ bool octave_cell::save_binary (std::ostream& os, bool save_as_floats) { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.ndims () < 1) return false; @@ -1052,7 +1052,7 @@ { #if defined (HAVE_HDF5) - dim_vector dv = dims (); + const dim_vector& dv = dims (); int empty = save_hdf5_empty (loc_id, name, dv); if (empty) return (empty > 0);
--- a/libinterp/octave-value/ov-cell.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-cell.h Fri Dec 22 12:14:08 2023 -0500 @@ -46,8 +46,7 @@ // Cells. -class -octave_cell : public octave_base_matrix<Cell> +class octave_cell : public octave_base_matrix<Cell> { public:
--- a/libinterp/octave-value/ov-ch-mat.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-ch-mat.h Fri Dec 22 12:14:08 2023 -0500 @@ -48,8 +48,7 @@ // Character matrix values. -class -octave_char_matrix : public octave_base_matrix<charNDArray> +class octave_char_matrix : public octave_base_matrix<charNDArray> { protected:
--- a/libinterp/octave-value/ov-class.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-class.cc Fri Dec 22 12:14:08 2023 -0500 @@ -134,7 +134,7 @@ // distribute the elements of the parent object to // the elements of MAP. - dim_vector parent_dims = parent.dims (); + const dim_vector& parent_dims = parent.dims (); m_map.resize (parent_dims); @@ -331,7 +331,7 @@ } else { - dim_vector dv = dims (); + const dim_vector& dv = dims (); int nd = dv.ndims (); @@ -2090,8 +2090,7 @@ // The following class can be removed once the // octave_value::function_value method is removed. -class -octave_inline_fcn : public octave_function +class octave_inline_fcn : public octave_function { public: @@ -2129,8 +2128,7 @@ // return class_name () == "inline"; // } -class -octave_inline : public octave_class +class octave_inline : public octave_class { public:
--- a/libinterp/octave-value/ov-class.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-class.h Fri Dec 22 12:14:08 2023 -0500 @@ -50,8 +50,7 @@ // Data structures. -class -octave_class : public octave_base_value +class octave_class : public octave_base_value { public: @@ -139,7 +138,7 @@ // of elements is numel () * nfields (). octave_idx_type numel () const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); return dv.numel (); }
--- a/libinterp/octave-value/ov-classdef.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-classdef.cc Fri Dec 22 12:14:08 2023 -0500 @@ -396,7 +396,7 @@ else { octave_value val = prop.get_value (m_object, false); - dim_vector dims = val.dims (); + const dim_vector& dims = val.dims (); os << std::setw (max_len+2) << nm << ": "; if (val.is_string ())
--- a/libinterp/octave-value/ov-classdef.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-classdef.h Fri Dec 22 12:14:08 2023 -0500 @@ -43,8 +43,7 @@ OCTAVE_END_NAMESPACE(octave) -class -octave_classdef : public octave_base_value +class octave_classdef : public octave_base_value { public:
--- a/libinterp/octave-value/ov-colon.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-colon.h Fri Dec 22 12:14:08 2023 -0500 @@ -44,8 +44,7 @@ // A type to represent ':' as used for indexing. -class -octave_magic_colon : public octave_base_value +class octave_magic_colon : public octave_base_value { public:
--- a/libinterp/octave-value/ov-complex.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-complex.h Fri Dec 22 12:14:08 2023 -0500 @@ -48,9 +48,7 @@ // Complex scalar values. -class -OCTINTERP_API -octave_complex : public octave_base_scalar<Complex> +class OCTINTERP_API octave_complex : public octave_base_scalar<Complex> { public:
--- a/libinterp/octave-value/ov-cs-list.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-cs-list.h Fri Dec 22 12:14:08 2023 -0500 @@ -43,8 +43,7 @@ // Lists. -class -octave_cs_list : public octave_base_value +class octave_cs_list : public octave_base_value { public:
--- a/libinterp/octave-value/ov-cx-diag.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-cx-diag.h Fri Dec 22 12:14:08 2023 -0500 @@ -35,8 +35,7 @@ // Real diagonal matrix values. -class -octave_complex_diag_matrix +class octave_complex_diag_matrix : public octave_base_diag<ComplexDiagMatrix, ComplexMatrix> { public:
--- a/libinterp/octave-value/ov-cx-mat.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-cx-mat.cc Fri Dec 22 12:14:08 2023 -0500 @@ -320,7 +320,7 @@ bool octave_complex_matrix::save_ascii (std::ostream& os) { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.ndims () > 2) { ComplexNDArray tmp = complex_array_value (); @@ -424,7 +424,7 @@ bool octave_complex_matrix::save_binary (std::ostream& os, bool save_as_floats) { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.ndims () < 1) return false; @@ -544,7 +544,7 @@ { #if defined (HAVE_HDF5) - dim_vector dv = dims (); + const dim_vector& dv = dims (); int empty = save_hdf5_empty (loc_id, name, dv); if (empty) return (empty > 0);
--- a/libinterp/octave-value/ov-cx-mat.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-cx-mat.h Fri Dec 22 12:14:08 2023 -0500 @@ -48,9 +48,7 @@ // Complex matrix values. -class -OCTINTERP_API -octave_complex_matrix : public octave_base_matrix<ComplexNDArray> +class OCTINTERP_API octave_complex_matrix : public octave_base_matrix<ComplexNDArray> { public:
--- a/libinterp/octave-value/ov-cx-sparse.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-cx-sparse.cc Fri Dec 22 12:14:08 2023 -0500 @@ -182,7 +182,7 @@ octave_sparse_complex_matrix::save_binary (std::ostream& os, bool save_as_floats) { - dim_vector dv = this->dims (); + const dim_vector& dv = this->dims (); if (dv.ndims () < 1) return false; @@ -327,7 +327,7 @@ #if defined (HAVE_HDF5) - dim_vector dv = dims (); + const dim_vector& dv = dims (); int empty = save_hdf5_empty (loc_id, name, dv); if (empty) return (empty > 0);
--- a/libinterp/octave-value/ov-cx-sparse.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-cx-sparse.h Fri Dec 22 12:14:08 2023 -0500 @@ -47,9 +47,7 @@ class octave_value_list; -class -OCTINTERP_API -octave_sparse_complex_matrix : public octave_base_sparse<SparseComplexMatrix> +class OCTINTERP_API octave_sparse_complex_matrix : public octave_base_sparse<SparseComplexMatrix> { public:
--- a/libinterp/octave-value/ov-dld-fcn.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-dld-fcn.h Fri Dec 22 12:14:08 2023 -0500 @@ -41,9 +41,7 @@ // Dynamically-linked functions. -class -OCTINTERP_API -octave_dld_function : public octave_builtin +class OCTINTERP_API octave_dld_function : public octave_builtin { public:
--- a/libinterp/octave-value/ov-fcn-handle.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-fcn-handle.h Fri Dec 22 12:14:08 2023 -0500 @@ -182,9 +182,7 @@ OCTAVE_END_NAMESPACE(octave) -class -OCTINTERP_API -octave_fcn_handle : public octave_base_value +class OCTINTERP_API octave_fcn_handle : public octave_base_value { public:
--- a/libinterp/octave-value/ov-fcn.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-fcn.h Fri Dec 22 12:14:08 2023 -0500 @@ -48,9 +48,7 @@ // Functions. -class -OCTINTERP_API -octave_function : public octave_base_value +class OCTINTERP_API octave_function : public octave_base_value { public:
--- a/libinterp/octave-value/ov-float.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-float.h Fri Dec 22 12:14:08 2023 -0500 @@ -50,9 +50,7 @@ // Real scalar values. -class -OCTINTERP_API -octave_float_scalar : public octave_base_scalar<float> +class OCTINTERP_API octave_float_scalar : public octave_base_scalar<float> { public:
--- a/libinterp/octave-value/ov-flt-complex.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-flt-complex.h Fri Dec 22 12:14:08 2023 -0500 @@ -48,9 +48,7 @@ // Complex scalar values. -class -OCTINTERP_API -octave_float_complex : public octave_base_scalar<FloatComplex> +class OCTINTERP_API octave_float_complex : public octave_base_scalar<FloatComplex> { public:
--- a/libinterp/octave-value/ov-flt-cx-diag.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-flt-cx-diag.h Fri Dec 22 12:14:08 2023 -0500 @@ -35,9 +35,7 @@ // Real diagonal matrix values. -class -OCTINTERP_API -octave_float_complex_diag_matrix +class OCTINTERP_API octave_float_complex_diag_matrix : public octave_base_diag<FloatComplexDiagMatrix, FloatComplexMatrix> { public:
--- a/libinterp/octave-value/ov-flt-cx-mat.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-flt-cx-mat.cc Fri Dec 22 12:14:08 2023 -0500 @@ -294,7 +294,7 @@ bool octave_float_complex_matrix::save_ascii (std::ostream& os) { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.ndims () > 2) { @@ -399,7 +399,7 @@ bool octave_float_complex_matrix::save_binary (std::ostream& os, bool) { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.ndims () < 1) return false; @@ -511,7 +511,7 @@ #if defined (HAVE_HDF5) - dim_vector dv = dims (); + const dim_vector& dv = dims (); int empty = save_hdf5_empty (loc_id, name, dv); if (empty) return (empty > 0);
--- a/libinterp/octave-value/ov-flt-cx-mat.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-flt-cx-mat.h Fri Dec 22 12:14:08 2023 -0500 @@ -48,9 +48,7 @@ // Complex matrix values. -class -OCTINTERP_API -octave_float_complex_matrix : public octave_base_matrix<FloatComplexNDArray> +class OCTINTERP_API octave_float_complex_matrix : public octave_base_matrix<FloatComplexNDArray> { public:
--- a/libinterp/octave-value/ov-flt-re-diag.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-flt-re-diag.h Fri Dec 22 12:14:08 2023 -0500 @@ -35,9 +35,7 @@ // Real diagonal matrix values. -class -OCTINTERP_API -octave_float_diag_matrix +class OCTINTERP_API octave_float_diag_matrix : public octave_base_diag<FloatDiagMatrix, FloatMatrix> { public:
--- a/libinterp/octave-value/ov-flt-re-mat.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-flt-re-mat.cc Fri Dec 22 12:14:08 2023 -0500 @@ -328,7 +328,7 @@ octave_float_matrix::convert_to_str_internal (bool, bool, char type) const { octave_value retval; - dim_vector dv = dims (); + const dim_vector& dv = dims (); octave_idx_type nel = dv.numel (); charNDArray chm (dv); @@ -370,7 +370,7 @@ bool octave_float_matrix::save_ascii (std::ostream& os) { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.ndims () > 2) { @@ -475,7 +475,7 @@ bool octave_float_matrix::save_binary (std::ostream& os, bool) { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.ndims () < 1) return false; @@ -584,7 +584,7 @@ #if defined (HAVE_HDF5) - dim_vector dv = dims (); + const dim_vector& dv = dims (); int empty = save_hdf5_empty (loc_id, name, dv); if (empty) return (empty > 0);
--- a/libinterp/octave-value/ov-flt-re-mat.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-flt-re-mat.h Fri Dec 22 12:14:08 2023 -0500 @@ -48,9 +48,7 @@ // Real matrix values. -class -OCTINTERP_API -octave_float_matrix : public octave_base_matrix<FloatNDArray> +class OCTINTERP_API octave_float_matrix : public octave_base_matrix<FloatNDArray> { public:
--- a/libinterp/octave-value/ov-int-traits.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-int-traits.h Fri Dec 22 12:14:08 2023 -0500 @@ -39,8 +39,7 @@ #include "ov-uint64.h" template <typename T> -class -octave_value_int_traits +class octave_value_int_traits { public: typedef T scalar_type;
--- a/libinterp/octave-value/ov-intx.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-intx.h Fri Dec 22 12:14:08 2023 -0500 @@ -49,9 +49,7 @@ #include "ov-re-mat.h" #include "ov-scalar.h" -class -OCTINTERP_API -OCTAVE_VALUE_INT_MATRIX_T +class OCTINTERP_API OCTAVE_VALUE_INT_MATRIX_T : public octave_base_int_matrix<intNDArray<OCTAVE_INT_T>> { public: @@ -146,7 +144,7 @@ matrix_value (bool = false) const { Matrix retval; - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.ndims () > 2) error ("invalid conversion of %s to Matrix", type_name ().c_str ()); @@ -163,7 +161,7 @@ float_matrix_value (bool = false) const { FloatMatrix retval; - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.ndims () > 2) error ("invalid conversion of %s to FloatMatrix", type_name ().c_str ()); @@ -180,7 +178,7 @@ complex_matrix_value (bool = false) const { ComplexMatrix retval; - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.ndims () > 2) error ("invalid conversion of %s to Matrix", type_name ().c_str ()); @@ -197,7 +195,7 @@ float_complex_matrix_value (bool = false) const { FloatComplexMatrix retval; - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.ndims () > 2) error ("invalid conversion of %s to FloatMatrix", type_name ().c_str ()); @@ -386,9 +384,7 @@ DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA }; -class -OCTINTERP_API -OCTAVE_VALUE_INT_SCALAR_T +class OCTINTERP_API OCTAVE_VALUE_INT_SCALAR_T : public octave_base_int_scalar<OCTAVE_INT_T> { public:
--- a/libinterp/octave-value/ov-java.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-java.cc Fri Dec 22 12:14:08 2023 -0500 @@ -1835,7 +1835,7 @@ { jclass_ref mcls (jni_env, find_octave_class (jni_env, "org/octave/Matrix")); - dim_vector dims = val.dims (); + const dim_vector& dims = val.dims (); jintArray_ref iv (jni_env, jni_env->NewIntArray (dims.ndims ())); jint *iv_data = jni_env->GetIntArrayElements (jintArray (iv), nullptr);
--- a/libinterp/octave-value/ov-lazy-idx.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-lazy-idx.h Fri Dec 22 12:14:08 2023 -0500 @@ -33,9 +33,7 @@ // Lazy indices that stay in idx_vector form until the conversion to NDArray is // actually needed. -class -OCTINTERP_API -octave_lazy_index : public octave_base_value +class OCTINTERP_API octave_lazy_index : public octave_base_value { public:
--- a/libinterp/octave-value/ov-legacy-range.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-legacy-range.cc Fri Dec 22 12:14:08 2023 -0500 @@ -50,8 +50,7 @@ #include "ls-hdf5.h" #include "ls-utils.h" -class -Range +class Range { public:
--- a/libinterp/octave-value/ov-legacy-range.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-legacy-range.h Fri Dec 22 12:14:08 2023 -0500 @@ -57,8 +57,7 @@ // of this type used by the interpreter. The action of maybe_mutate is // performed by octave_legacy_range::try_narrowing_conversion. -class -octave_legacy_range : public octave_base_value +class octave_legacy_range : public octave_base_value { public:
--- a/libinterp/octave-value/ov-magic-int.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-magic-int.h Fri Dec 22 12:14:08 2023 -0500 @@ -47,8 +47,7 @@ // type conversion. template <typename T> -class -octave_base_magic_int : public octave_base_scalar<T> +class octave_base_magic_int : public octave_base_scalar<T> { public: @@ -275,9 +274,7 @@ octave_value map (octave_base_value::unary_mapper_t umap) const; }; -class -OCTINTERP_API -octave_magic_uint : public octave_base_magic_int<octave_uint64> +class OCTINTERP_API octave_magic_uint : public octave_base_magic_int<octave_uint64> { public: @@ -301,9 +298,7 @@ DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA }; -class -OCTINTERP_API -octave_magic_int : public octave_base_magic_int<octave_int64> +class OCTINTERP_API octave_magic_int : public octave_base_magic_int<octave_int64> { public:
--- a/libinterp/octave-value/ov-mex-fcn.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-mex-fcn.h Fri Dec 22 12:14:08 2023 -0500 @@ -47,8 +47,7 @@ // Dynamically-linked functions. -class -octave_mex_function : public octave_function +class octave_mex_function : public octave_function { public:
--- a/libinterp/octave-value/ov-null-mat.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-null-mat.h Fri Dec 22 12:14:08 2023 -0500 @@ -41,9 +41,7 @@ // The special [] value. -class -OCTINTERP_API -octave_null_matrix : public octave_matrix +class OCTINTERP_API octave_null_matrix : public octave_matrix { octave_null_matrix () : octave_matrix () { } @@ -63,9 +61,7 @@ // The special "" value -class -OCTINTERP_API -octave_null_str : public octave_char_matrix_str +class OCTINTERP_API octave_null_str : public octave_char_matrix_str { octave_null_str () : octave_char_matrix_str () { } @@ -87,9 +83,7 @@ // The special '' value -class -OCTINTERP_API -octave_null_sq_str : public octave_char_matrix_sq_str +class OCTINTERP_API octave_null_sq_str : public octave_char_matrix_sq_str { octave_null_sq_str () : octave_char_matrix_sq_str () { }
--- a/libinterp/octave-value/ov-perm.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-perm.cc Fri Dec 22 12:14:08 2023 -0500 @@ -442,7 +442,7 @@ bool octave_perm_matrix::print_as_scalar () const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); return (dv.all_ones () || dv.any_zero ()); }
--- a/libinterp/octave-value/ov-perm.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-perm.h Fri Dec 22 12:14:08 2023 -0500 @@ -35,9 +35,7 @@ #include "ov-typeinfo.h" #include "ovl.h" -class -OCTINTERP_API -octave_perm_matrix : public octave_base_value +class OCTINTERP_API octave_perm_matrix : public octave_base_value { public: octave_perm_matrix () : m_matrix (), m_dense_cache () { }
--- a/libinterp/octave-value/ov-range-traits.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-range-traits.h Fri Dec 22 12:14:08 2023 -0500 @@ -44,8 +44,7 @@ #include "ov-uint8.h" template <typename T> -class -octave_value_range_traits +class octave_value_range_traits { public: typedef T scalar_type; @@ -53,8 +52,7 @@ }; template <> -class -octave_value_range_traits<bool> +class octave_value_range_traits<bool> { public: typedef octave_bool scalar_type; @@ -62,8 +60,7 @@ }; template <> -class -octave_value_range_traits<float> +class octave_value_range_traits<float> { public: typedef octave_float_scalar scalar_type; @@ -71,8 +68,7 @@ }; template <> -class -octave_value_range_traits<double> +class octave_value_range_traits<double> { public: typedef octave_scalar scalar_type; @@ -80,8 +76,7 @@ }; template <> -class -octave_value_range_traits<octave_int8> +class octave_value_range_traits<octave_int8> { public: typedef octave_int8_scalar scalar_type; @@ -89,8 +84,7 @@ }; template <> -class -octave_value_range_traits<octave_int16> +class octave_value_range_traits<octave_int16> { public: typedef octave_int16_scalar scalar_type; @@ -98,8 +92,7 @@ }; template <> -class -octave_value_range_traits<octave_int32> +class octave_value_range_traits<octave_int32> { public: typedef octave_int32_scalar scalar_type; @@ -107,8 +100,7 @@ }; template <> -class -octave_value_range_traits<octave_int64> +class octave_value_range_traits<octave_int64> { public: typedef octave_int64_scalar scalar_type; @@ -116,8 +108,7 @@ }; template <> -class -octave_value_range_traits<octave_uint8> +class octave_value_range_traits<octave_uint8> { public: typedef octave_uint8_scalar scalar_type; @@ -125,8 +116,7 @@ }; template <> -class -octave_value_range_traits<octave_uint16> +class octave_value_range_traits<octave_uint16> { public: typedef octave_uint16_scalar scalar_type; @@ -134,8 +124,7 @@ }; template <> -class -octave_value_range_traits<octave_uint32> +class octave_value_range_traits<octave_uint32> { public: typedef octave_uint32_scalar scalar_type; @@ -143,8 +132,7 @@ }; template <> -class -octave_value_range_traits<octave_uint64> +class octave_value_range_traits<octave_uint64> { public: typedef octave_uint64_scalar scalar_type;
--- a/libinterp/octave-value/ov-range.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-range.h Fri Dec 22 12:14:08 2023 -0500 @@ -93,8 +93,7 @@ // enforce that restriction. template <typename T> -class -ov_range : public octave_base_value +class ov_range : public octave_base_value { public:
--- a/libinterp/octave-value/ov-re-diag.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-re-diag.h Fri Dec 22 12:14:08 2023 -0500 @@ -35,9 +35,7 @@ // Real diagonal matrix values. -class -OCTINTERP_API -octave_diag_matrix +class OCTINTERP_API octave_diag_matrix : public octave_base_diag<DiagMatrix, Matrix> { public:
--- a/libinterp/octave-value/ov-re-mat.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-re-mat.cc Fri Dec 22 12:14:08 2023 -0500 @@ -431,7 +431,7 @@ octave_matrix::convert_to_str_internal (bool, bool, char type) const { octave_value retval; - dim_vector dv = dims (); + const dim_vector& dv = dims (); octave_idx_type nel = dv.numel (); charNDArray chm (dv); @@ -473,7 +473,7 @@ bool octave_matrix::save_ascii (std::ostream& os) { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.ndims () > 2) { @@ -579,7 +579,7 @@ octave_matrix::save_binary (std::ostream& os, bool save_as_floats) { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.ndims () < 1) return false; @@ -699,7 +699,7 @@ #if defined (HAVE_HDF5) - dim_vector dv = dims (); + const dim_vector& dv = dims (); int empty = save_hdf5_empty (loc_id, name, dv); if (empty) return (empty > 0);
--- a/libinterp/octave-value/ov-re-mat.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-re-mat.h Fri Dec 22 12:14:08 2023 -0500 @@ -48,9 +48,7 @@ // Real matrix values. -class -OCTINTERP_API -octave_matrix : public octave_base_matrix<NDArray> +class OCTINTERP_API octave_matrix : public octave_base_matrix<NDArray> { public:
--- a/libinterp/octave-value/ov-re-sparse.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-re-sparse.cc Fri Dec 22 12:14:08 2023 -0500 @@ -162,7 +162,7 @@ octave_sparse_matrix::convert_to_str_internal (bool, bool, char type) const { octave_value retval; - dim_vector dv = dims (); + const dim_vector& dv = dims (); octave_idx_type nel = dv.numel (); if (nel == 0) @@ -222,7 +222,7 @@ bool octave_sparse_matrix::save_binary (std::ostream& os, bool save_as_floats) { - dim_vector dv = this->dims (); + const dim_vector& dv = this->dims (); if (dv.ndims () < 1) return false; @@ -364,7 +364,7 @@ #if defined (HAVE_HDF5) - dim_vector dv = dims (); + const dim_vector& dv = dims (); int empty = save_hdf5_empty (loc_id, name, dv); if (empty) return (empty > 0);
--- a/libinterp/octave-value/ov-re-sparse.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-re-sparse.h Fri Dec 22 12:14:08 2023 -0500 @@ -48,9 +48,7 @@ class octave_value_list; -class -OCTINTERP_API -octave_sparse_matrix : public octave_base_sparse<SparseMatrix> +class OCTINTERP_API octave_sparse_matrix : public octave_base_sparse<SparseMatrix> { public:
--- a/libinterp/octave-value/ov-scalar.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-scalar.h Fri Dec 22 12:14:08 2023 -0500 @@ -49,9 +49,7 @@ // Real scalar values. -class -OCTINTERP_API -octave_scalar : public octave_base_scalar<double> +class OCTINTERP_API octave_scalar : public octave_base_scalar<double> { public:
--- a/libinterp/octave-value/ov-str-mat.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-str-mat.cc Fri Dec 22 12:14:08 2023 -0500 @@ -312,7 +312,7 @@ } std::string tname = type_name (); - dim_vector dv = m_matrix.dims (); + const dim_vector& dv = m_matrix.dims (); std::string dimstr = dv.str (); return "[" + dimstr + " " + tname + "]"; } @@ -320,7 +320,7 @@ bool octave_char_matrix_str::save_ascii (std::ostream& os) { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.ndims () > 2) { charNDArray tmp = char_array_value (); @@ -472,7 +472,7 @@ octave_char_matrix_str::save_binary (std::ostream& os, bool /* save_as_floats */) { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.ndims () < 1) return false; @@ -572,7 +572,7 @@ #if defined (HAVE_HDF5) - dim_vector dv = dims (); + const dim_vector& dv = dims (); int empty = save_hdf5_empty (loc_id, name, dv); if (empty) return (empty > 0);
--- a/libinterp/octave-value/ov-str-mat.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-str-mat.h Fri Dec 22 12:14:08 2023 -0500 @@ -48,9 +48,7 @@ // Character matrix values with special properties for use as // strings. -class -OCTINTERP_API -octave_char_matrix_str : public octave_char_matrix +class OCTINTERP_API octave_char_matrix_str : public octave_char_matrix { public: @@ -186,8 +184,7 @@ typedef octave_char_matrix_str octave_char_matrix_dq_str; -class -octave_char_matrix_sq_str : public octave_char_matrix_str +class octave_char_matrix_sq_str : public octave_char_matrix_str { public:
--- a/libinterp/octave-value/ov-struct.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-struct.cc Fri Dec 22 12:14:08 2023 -0500 @@ -634,7 +634,7 @@ increment_indent_level (); indent (os); - dim_vector dv = dims (); + const dim_vector& dv = dims (); os << dv.str () << " struct array containing the fields:"; newline (os); @@ -727,7 +727,7 @@ } std::string tname = val.type_name (); - dim_vector dv = val.dims (); + const dim_vector& dv = val.dims (); std::string dimstr = dv.str (); return "[" + dimstr + " " + tname + "]"; } @@ -845,7 +845,7 @@ octave_idx_type nf = m.nfields (); - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.ndims () < 1) return false; @@ -1382,7 +1382,7 @@ { indent (os); os << key; - dim_vector dv = val.dims (); + const dim_vector& dv = val.dims (); os << ": " << dv.str () << ' ' << val.type_name (); newline (os); } @@ -1443,7 +1443,7 @@ octave_value val = m_map.contents (r); std::string tname = val.type_name (); - dim_vector dv = val.dims (); + const dim_vector& dv = val.dims (); std::string dimstr = dv.str (); return "[" + dimstr + " " + tname + "]"; } @@ -1860,7 +1860,7 @@ { if (args(i).iscell ()) { - dim_vector argdims (args(i).dims ()); + const dim_vector& argdims = args(i).dims (); if (! scalar (argdims)) {
--- a/libinterp/octave-value/ov-struct.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-struct.h Fri Dec 22 12:14:08 2023 -0500 @@ -45,8 +45,7 @@ // Data structures. -class -octave_struct : public octave_base_value +class octave_struct : public octave_base_value { public: @@ -173,8 +172,7 @@ DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA }; -class -octave_scalar_struct : public octave_base_value +class octave_scalar_struct : public octave_base_value { public:
--- a/libinterp/octave-value/ov-typeinfo.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-typeinfo.h Fri Dec 22 12:14:08 2023 -0500 @@ -39,9 +39,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) -class -OCTINTERP_API -type_info +class OCTINTERP_API type_info { public:
--- a/libinterp/octave-value/ov-usr-fcn.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov-usr-fcn.h Fri Dec 22 12:14:08 2023 -0500 @@ -53,8 +53,7 @@ OCTAVE_END_NAMESPACE(octave) -class -octave_user_code : public octave_function +class octave_user_code : public octave_function { protected: @@ -146,8 +145,7 @@ // Scripts. -class -octave_user_script : public octave_user_code +class octave_user_script : public octave_user_code { public: @@ -199,8 +197,7 @@ // User-defined functions. -class -octave_user_function : public octave_user_code +class octave_user_function : public octave_user_code { public:
--- a/libinterp/octave-value/ov.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov.cc Fri Dec 22 12:14:08 2023 -0500 @@ -2957,9 +2957,8 @@ double dval = val.double_value (); double intpart; - static const double out_of_range_top - = static_cast<double> (std::numeric_limits<typename T::val_type>::max ()) - + 1.; + static constexpr double out_of_range_top + = static_cast<double> (std::numeric_limits<typename T::val_type>::max ()) + 1.0; if (dval >= out_of_range_top || dval < std::numeric_limits<typename T::val_type>::min () @@ -2994,8 +2993,7 @@ // Map to unsigned. // Idea from https://stackoverflow.com/questions/10589559 - static const UT offset - = UT (0) - static_cast<UT> (std::numeric_limits<ST>::min ()); + static const UT offset = UT (0) - static_cast<UT> (std::numeric_limits<ST>::min ()); UT au = static_cast<UT> (a) + offset; UT bu = static_cast<UT> (b) + offset; @@ -3133,8 +3131,8 @@ || (increment < 0 && base < limit)) return 0; - static const double out_of_range_top - = static_cast<double> (std::numeric_limits<UT>::max ()) + 1.; + static constexpr double out_of_range_top + = static_cast<double> (std::numeric_limits<UT>::max ()) + 1.0; double abs_increment = std::abs (increment);
--- a/libinterp/octave-value/ov.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ov.h Fri Dec 22 12:14:08 2023 -0500 @@ -69,9 +69,7 @@ #include "oct-stream.h" #include "ov-base.h" -class -OCTINTERP_API -octave_value +class OCTINTERP_API octave_value { public:
--- a/libinterp/octave-value/ovl.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ovl.cc Fri Dec 22 12:14:08 2023 -0500 @@ -191,7 +191,7 @@ for (octave_idx_type i = 0; i < n; i++) { - dim_vector dv = elem(i).dims (); + const dim_vector& dv = elem(i).dims (); if (! dv.all_ones ()) return false; }
--- a/libinterp/octave-value/ovl.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/octave-value/ovl.h Fri Dec 22 12:14:08 2023 -0500 @@ -38,9 +38,7 @@ #include "ov.h" #include "Cell.h" -class -OCTINTERP_API -octave_value_list +class OCTINTERP_API octave_value_list { public:
--- a/libinterp/operators/op-int.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/operators/op-int.h Fri Dec 22 12:14:08 2023 -0500 @@ -702,8 +702,8 @@ static octave_value \ elem_xpow (const T1 ## NDArray& a, const T2 ## NDArray& b) \ { \ - dim_vector a_dims = a.dims (); \ - dim_vector b_dims = b.dims (); \ + const dim_vector& a_dims = a.dims (); \ + const dim_vector& b_dims = b.dims (); \ if (a_dims != b_dims) \ { \ if (! is_valid_bsxfun ("operator .^", a_dims, b_dims)) \ @@ -723,8 +723,8 @@ static octave_value \ elem_xpow (const T1 ## NDArray& a, const NDArray& b) \ { \ - dim_vector a_dims = a.dims (); \ - dim_vector b_dims = b.dims (); \ + const dim_vector& a_dims = a.dims (); \ + const dim_vector& b_dims = b.dims (); \ if (a_dims != b_dims) \ { \ if (! is_valid_bsxfun ("operator .^", a_dims, b_dims)) \ @@ -744,8 +744,8 @@ static octave_value \ elem_xpow (const NDArray& a, const T2 ## NDArray& b) \ { \ - dim_vector a_dims = a.dims (); \ - dim_vector b_dims = b.dims (); \ + const dim_vector& a_dims = a.dims (); \ + const dim_vector& b_dims = b.dims (); \ if (a_dims != b_dims) \ { \ if (! is_valid_bsxfun ("operator .^", a_dims, b_dims)) \ @@ -765,8 +765,8 @@ static octave_value \ elem_xpow (const T1 ## NDArray& a, const FloatNDArray& b) \ { \ - dim_vector a_dims = a.dims (); \ - dim_vector b_dims = b.dims (); \ + const dim_vector& a_dims = a.dims (); \ + const dim_vector& b_dims = b.dims (); \ if (a_dims != b_dims) \ { \ if (! is_valid_bsxfun ("operator .^", a_dims, b_dims)) \ @@ -786,8 +786,8 @@ static octave_value \ elem_xpow (const FloatNDArray& a, const T2 ## NDArray& b) \ { \ - dim_vector a_dims = a.dims (); \ - dim_vector b_dims = b.dims (); \ + const dim_vector& a_dims = a.dims (); \ + const dim_vector& b_dims = b.dims (); \ if (a_dims != b_dims) \ { \ if (! is_valid_bsxfun ("operator .^", a_dims, b_dims)) \
--- a/libinterp/operators/op-mi.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/operators/op-mi.cc Fri Dec 22 12:14:08 2023 -0500 @@ -67,10 +67,10 @@ uint64_t ival = val.value (); - static const uint64_t max_val + static constexpr uint64_t max_val = static_cast<uint64_t> (std::numeric_limits<int64_t>::max ()); - static const uint64_t max_val_p1 = max_val + 1; + static constexpr uint64_t max_val_p1 = max_val + 1; if (ival <= max_val) { @@ -84,7 +84,7 @@ // should return int8(-128) but converting directly to int8 and // negating will not return the correct result. - static const int64_t min_signed_ival + static constexpr int64_t min_signed_ival = std::numeric_limits<int64_t>::min (); return octave_value (new octave_magic_int (min_signed_ival));
--- a/libinterp/operators/op-str-str.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/operators/op-str-str.cc Fri Dec 22 12:14:08 2023 -0500 @@ -57,8 +57,8 @@ CONCAT2(oct_binop_, name) (const octave_base_value& a1, \ const octave_base_value& a2) \ { \ - dim_vector a1_dims = a1.dims (); \ - dim_vector a2_dims = a2.dims (); \ + const dim_vector& a1_dims = a1.dims (); \ + const dim_vector& a2_dims = a2.dims (); \ \ bool a1_is_scalar = a1_dims.all_ones (); \ bool a2_is_scalar = a2_dims.all_ones (); \
--- a/libinterp/operators/op-struct.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/operators/op-struct.cc Fri Dec 22 12:14:08 2023 -0500 @@ -70,7 +70,7 @@ OCTAVE_CAST_BASE_VALUE (const octave_matrix&, v2, a2); NDArray tmp = v2.array_value (); - dim_vector dv = tmp.dims (); + const dim_vector& dv = tmp.dims (); if (! dv.all_zero ()) error ("invalid concatenation of structure with matrix"); @@ -87,7 +87,7 @@ OCTAVE_CAST_BASE_VALUE (const octave_struct&, v2, a2); NDArray tmp = v1.array_value (); - dim_vector dv = tmp.dims (); + const dim_vector& dv = tmp.dims (); if (! dv.all_zero ()) error ("invalid concatenation of structure with matrix");
--- a/libinterp/parse-tree/comment-list.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/parse-tree/comment-list.h Fri Dec 22 12:14:08 2023 -0500 @@ -40,8 +40,7 @@ extern void save_comment_text (const std::string& text); -class -comment_elt +class comment_elt { public: @@ -93,8 +92,7 @@ comment_type m_type; }; -class -comment_list : public base_list<comment_elt> +class comment_list : public base_list<comment_elt> { public:
--- a/libinterp/parse-tree/lex.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/parse-tree/lex.h Fri Dec 22 12:14:08 2023 -0500 @@ -48,8 +48,7 @@ // For communication between the lexer and parser. -class -lexical_feedback +class lexical_feedback { public: @@ -522,8 +521,7 @@ // initialize if everything is grouped in a parent class rather than // listing all the members in the base_lexer class. -class -base_lexer : public lexical_feedback +class base_lexer : public lexical_feedback { public: @@ -558,8 +556,7 @@ // Collect comment text. - class - comment_buffer + class comment_buffer { public: @@ -751,8 +748,7 @@ std::stack<int> start_state_stack; }; -class -lexer : public base_lexer +class lexer : public base_lexer { public: @@ -821,8 +817,7 @@ template <> int base_lexer::handle_number<10> (); template <> int base_lexer::handle_number<16> (); -class -push_lexer : public base_lexer +class push_lexer : public base_lexer { public:
--- a/libinterp/parse-tree/profiler.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/parse-tree/profiler.h Fri Dec 22 12:14:08 2023 -0500 @@ -38,9 +38,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) -class -OCTINTERP_API -profiler +class OCTINTERP_API profiler { public:
--- a/libinterp/parse-tree/pt-anon-scopes.h Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/parse-tree/pt-anon-scopes.h Fri Dec 22 12:14:08 2023 -0500 @@ -36,8 +36,7 @@ // In possibly nested definitions of anonymous functions, collect // their scopes and the symbol records therein. -class -tree_anon_scopes : public tree_walker +class tree_anon_scopes : public tree_walker { public:
--- a/libinterp/parse-tree/pt-eval.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/parse-tree/pt-eval.cc Fri Dec 22 12:14:08 2023 -0500 @@ -3190,7 +3190,7 @@ // A matrix or cell is reshaped to 2 dimensions and iterated by // columns. - dim_vector dv = rhs.dims ().redim (2); + const dim_vector& dv = rhs.dims ().redim (2); octave_idx_type nrows = dv(0); octave_idx_type steps = dv(1);
--- a/libinterp/parse-tree/pt-tm-const.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/libinterp/parse-tree/pt-tm-const.cc Fri Dec 22 12:14:08 2023 -0500 @@ -88,7 +88,7 @@ { octave_quit (); - dim_vector this_elt_dv = val.dims (); + const dim_vector& this_elt_dv = val.dims (); if (! this_elt_dv.zero_by_zero ()) { @@ -111,7 +111,7 @@ m_class_name = get_concat_class (m_class_name, this_elt_class_name); - dim_vector this_elt_dv = val.dims (); + const dim_vector& this_elt_dv = val.dims (); if (! this_elt_dv.zero_by_zero ()) { @@ -207,7 +207,7 @@ { octave_quit (); - dim_vector this_elt_dv = val.dims (); + const dim_vector& this_elt_dv = val.dims (); if (! this_elt_dv.zero_by_zero ()) { @@ -399,7 +399,7 @@ std::string this_elt_class_name = elt.class_name (); m_class_name = get_concat_class (m_class_name, this_elt_class_name); - dim_vector this_elt_dv = elt.dims (); + const dim_vector& this_elt_dv = elt.dims (); m_all_empty = false;
--- a/liboctave/array/Array-base.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/Array-base.cc Fri Dec 22 12:14:08 2023 -0500 @@ -749,7 +749,7 @@ // Indexed object and index are both vectors. Set result size // and orientation as above. - dim_vector dv = dims (); + const dim_vector& dv = dims (); result_dims = dv.make_nd_vector (idx_len); } @@ -777,7 +777,7 @@ Array<T, Alloc>::index (const octave::idx_vector& i, const octave::idx_vector& j) const { // Get dimensions, allowing Fortran indexing in the 2nd dim. - dim_vector dv = m_dimensions.redim (2); + const dim_vector& dv = m_dimensions.redim (2); octave_idx_type r = dv(0); octave_idx_type c = dv(1); Array<T, Alloc> retval; @@ -951,8 +951,8 @@ } else { - static const octave_idx_type max_stack_chunk = 1024; - octave_idx_type nn = n + std::min (nx, max_stack_chunk); + static const octave_idx_type MAX_STACK_CHUNK = 1024; + octave_idx_type nn = n + std::min (nx, MAX_STACK_CHUNK); Array<T, Alloc> tmp (Array<T, Alloc> (dim_vector (nn, 1)), dv, 0, n); T *dest = tmp.fortran_vec (); @@ -1072,7 +1072,7 @@ Array<T, Alloc> tmp = *this; if (resize_ok) { - dim_vector dv = m_dimensions.redim (2); + const dim_vector& dv = m_dimensions.redim (2); octave_idx_type r = dv(0); octave_idx_type c = dv(1); octave_idx_type rx = i.extent (r); @@ -1101,7 +1101,7 @@ if (resize_ok) { int ial = ia.numel (); - dim_vector dv = m_dimensions.redim (ial); + const dim_vector& dv = m_dimensions.redim (ial); dim_vector dvx = dim_vector::alloc (ial); for (int i = 0; i < ial; i++) dvx(i) = ia(i).extent (dv(i)); @@ -1898,7 +1898,7 @@ Array<T, Alloc> m (dims ()); - dim_vector dv = m.dims (); + const dim_vector& dv = m.dims (); if (m.numel () < 1) { @@ -2196,11 +2196,11 @@ // This determines the split ratio between the O(M*log2(N)) and O(M+N) // algorithms. - static const double ratio = 1.0; + static const double RATIO = 1.0; sortmode vmode = UNSORTED; // Attempt the O(M+N) algorithm if M is large enough. - if (nval > ratio * n / octave::math::log2 (n + 1.0)) + if (nval > RATIO * n / octave::math::log2 (n + 1.0)) { vmode = values.issorted (); // The table must not contain a NaN. @@ -2540,7 +2540,7 @@ Array<T, Alloc> Array<T, Alloc>::diag (octave_idx_type k) const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); octave_idx_type nd = dv.ndims (); Array<T, Alloc> d; @@ -2685,7 +2685,7 @@ { for (octave_idx_type i = 0; i < n; i++) { - dim_vector dv = array_list[i].dims (); + const dim_vector& dv = array_list[i].dims (); if (dv.zero_by_zero ()) istart++; @@ -2791,7 +2791,7 @@ std::ostream& operator << (std::ostream& os, const Array<T, Alloc>& a) { - dim_vector a_dims = a.dims (); + const dim_vector& a_dims = a.dims (); int n_dims = a_dims.ndims ();
--- a/liboctave/array/Array-util.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/Array-util.cc Fri Dec 22 12:14:08 2023 -0500 @@ -617,7 +617,7 @@ { OCTAVE_LOCAL_BUFFER (Array<octave_idx_type>, rdata, n); - dim_vector odv = idx.orig_dimensions (); + const dim_vector& odv = idx.orig_dimensions (); for (octave_idx_type j = 0; j < n; j++) rdata[j] = Array<octave_idx_type> (odv);
--- a/liboctave/array/Array.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/Array.h Fri Dec 22 12:14:08 2023 -0500 @@ -124,9 +124,7 @@ //! - Cell: Array<octave_value>, equivalent to an Octave cell. template <typename T, typename Alloc> -class -OCTARRAY_TEMPLATE_API -Array +class OCTARRAY_TEMPLATE_API Array { protected:
--- a/liboctave/array/CColVector.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/CColVector.h Fri Dec 22 12:14:08 2023 -0500 @@ -31,9 +31,7 @@ #include "MArray.h" #include "mx-defs.h" -class -OCTAVE_API -ComplexColumnVector : public MArray<Complex> +class OCTAVE_API ComplexColumnVector : public MArray<Complex> { friend class ComplexMatrix; friend class ComplexRowVector;
--- a/liboctave/array/CDiagMatrix.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/CDiagMatrix.h Fri Dec 22 12:14:08 2023 -0500 @@ -36,9 +36,7 @@ #include "dRowVector.h" #include "mx-defs.h" -class -OCTAVE_API -ComplexDiagMatrix : public MDiagArray2<Complex> +class OCTAVE_API ComplexDiagMatrix : public MDiagArray2<Complex> { public:
--- a/liboctave/array/CMatrix.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/CMatrix.h Fri Dec 22 12:14:08 2023 -0500 @@ -37,9 +37,7 @@ #include "mx-op-decl.h" #include "oct-cmplx.h" -class -OCTAVE_API -ComplexMatrix : public ComplexNDArray +class OCTAVE_API ComplexMatrix : public ComplexNDArray { public:
--- a/liboctave/array/CNDArray.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/CNDArray.cc Fri Dec 22 12:14:08 2023 -0500 @@ -57,7 +57,7 @@ ComplexNDArray ComplexNDArray::fourier (int dim) const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dim > dv.ndims () || dim < 0) return ComplexNDArray (); @@ -88,7 +88,7 @@ ComplexNDArray ComplexNDArray::ifourier (int dim) const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dim > dv.ndims () || dim < 0) return ComplexNDArray (); @@ -119,7 +119,7 @@ ComplexNDArray ComplexNDArray::fourier2d () const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.ndims () < 2) return ComplexNDArray (); @@ -139,7 +139,7 @@ ComplexNDArray ComplexNDArray::ifourier2d () const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.ndims () < 2) return ComplexNDArray (); @@ -159,7 +159,7 @@ ComplexNDArray ComplexNDArray::fourierNd () const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); int rank = dv.ndims (); const Complex *in (data ()); @@ -174,7 +174,7 @@ ComplexNDArray ComplexNDArray::ifourierNd () const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); int rank = dv.ndims (); const Complex *in (data ()); @@ -507,8 +507,8 @@ ComplexNDArray& ComplexNDArray::insert (const NDArray& a, octave_idx_type r, octave_idx_type c) { - dim_vector a_dv = a.dims (); - dim_vector dv = dims (); + const dim_vector& a_dv = a.dims (); + const dim_vector& dv = dims (); int n = a_dv.ndims ();
--- a/liboctave/array/CNDArray.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/CNDArray.h Fri Dec 22 12:14:08 2023 -0500 @@ -33,9 +33,7 @@ #include "mx-defs.h" #include "mx-op-decl.h" -class -OCTAVE_API -ComplexNDArray : public MArray<Complex> +class OCTAVE_API ComplexNDArray : public MArray<Complex> { public:
--- a/liboctave/array/CRowVector.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/CRowVector.h Fri Dec 22 12:14:08 2023 -0500 @@ -32,9 +32,7 @@ #include "dRowVector.h" #include "mx-defs.h" -class -OCTAVE_API -ComplexRowVector : public MArray<Complex> +class OCTAVE_API ComplexRowVector : public MArray<Complex> { friend class ComplexColumnVector;
--- a/liboctave/array/CSparse.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/CSparse.cc Fri Dec 22 12:14:08 2023 -0500 @@ -193,7 +193,7 @@ SparseComplexMatrix::max (Array<octave_idx_type>& idx_arg, int dim) const { SparseComplexMatrix result; - dim_vector dv = dims (); + const dim_vector& dv = dims (); octave_idx_type nr = dv(0); octave_idx_type nc = dv(1); @@ -350,7 +350,7 @@ SparseComplexMatrix::min (Array<octave_idx_type>& idx_arg, int dim) const { SparseComplexMatrix result; - dim_vector dv = dims (); + const dim_vector& dv = dims (); octave_idx_type nr = dv(0); octave_idx_type nc = dv(1);
--- a/liboctave/array/CSparse.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/CSparse.h Fri Dec 22 12:14:08 2023 -0500 @@ -41,9 +41,7 @@ #include "oct-cmplx.h" #include "mx-fwd.h" -class -OCTAVE_API -SparseComplexMatrix : public MSparse<Complex> +class OCTAVE_API SparseComplexMatrix : public MSparse<Complex> { public:
--- a/liboctave/array/DiagArray2.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/DiagArray2.h Fri Dec 22 12:14:08 2023 -0500 @@ -37,9 +37,7 @@ // produce unexpected results. template <typename T> -class -OCTAVE_API -DiagArray2 : protected Array<T> +class OCTAVE_API DiagArray2 : protected Array<T> { protected: octave_idx_type m_d1, m_d2;
--- a/liboctave/array/MArray.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/MArray.h Fri Dec 22 12:14:08 2023 -0500 @@ -57,9 +57,7 @@ //! Template for N-dimensional array classes with like-type math operators. template <typename T> -class -OCTARRAY_API -MArray : public Array<T> +class OCTARRAY_API MArray : public Array<T> { public:
--- a/liboctave/array/MDiagArray2.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/MDiagArray2.h Fri Dec 22 12:14:08 2023 -0500 @@ -50,9 +50,7 @@ //! Template for two dimensional diagonal array with math operators. template <typename T> -class -OCTAVE_API -MDiagArray2 : public DiagArray2<T> +class OCTAVE_API MDiagArray2 : public DiagArray2<T> { public:
--- a/liboctave/array/MSparse.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/MSparse.h Fri Dec 22 12:14:08 2023 -0500 @@ -40,9 +40,7 @@ // Two dimensional sparse array with math ops. template <typename T> -class -OCTAVE_API -MSparse : public Sparse<T> +class OCTAVE_API MSparse : public Sparse<T> { public:
--- a/liboctave/array/MatrixType.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/MatrixType.h Fri Dec 22 12:14:08 2023 -0500 @@ -32,8 +32,7 @@ #include "MSparse.h" -class -MatrixType +class MatrixType { public: enum matrix_type
--- a/liboctave/array/Range.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/Range.h Fri Dec 22 12:14:08 2023 -0500 @@ -45,8 +45,7 @@ // in ov.cc. template <typename T> -class -range<T, typename std::enable_if<std::is_floating_point<T>::value>::type> +class range<T, typename std::enable_if<std::is_floating_point<T>::value>::type> { public:
--- a/liboctave/array/Sparse.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/Sparse.cc Fri Dec 22 12:14:08 2023 -0500 @@ -150,9 +150,9 @@ // Always preserve space for 1 element. nz = (nz > 0 ? nz : 1); - // Skip reallocation if we have less than 1/frac extra elements to discard. - static const int frac = 5; - if (nz > m_nzmax || nz < m_nzmax - m_nzmax/frac) + // Skip reallocation if we have less than 1/FRAC extra elements to discard. + static const int FRAC = 5; + if (nz > m_nzmax || nz < m_nzmax - m_nzmax/FRAC) { // Reallocate. octave_idx_type min_nzmax = std::min (nz, m_nzmax); @@ -271,7 +271,7 @@ (*current_liboctave_error_handler) ("Sparse::Sparse (const Sparse&, const dim_vector&): dimension mismatch"); - dim_vector old_dims = a.dims (); + const dim_vector& old_dims = a.dims (); octave_idx_type new_nzmax = a.nnz (); octave_idx_type new_nr = dv(0); octave_idx_type new_nc = dv(1);
--- a/liboctave/array/Sparse.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/Sparse.h Fri Dec 22 12:14:08 2023 -0500 @@ -43,9 +43,7 @@ // all the derived classes. template <typename T, typename Alloc> -class -OCTAVE_API -Sparse +class OCTAVE_API Sparse { public:
--- a/liboctave/array/boolMatrix.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/boolMatrix.h Fri Dec 22 12:14:08 2023 -0500 @@ -33,9 +33,7 @@ #include "mx-defs.h" #include "mx-op-decl.h" -class -OCTAVE_API -boolMatrix : public boolNDArray +class OCTAVE_API boolMatrix : public boolNDArray { public:
--- a/liboctave/array/boolNDArray.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/boolNDArray.h Fri Dec 22 12:14:08 2023 -0500 @@ -33,9 +33,7 @@ #include "mx-defs.h" #include "mx-op-decl.h" -class -OCTAVE_API -boolNDArray : public Array<bool> +class OCTAVE_API boolNDArray : public Array<bool> { public:
--- a/liboctave/array/boolSparse.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/boolSparse.h Fri Dec 22 12:14:08 2023 -0500 @@ -35,9 +35,7 @@ #include "boolNDArray.h" #include "mx-fwd.h" -class -OCTAVE_API -SparseBoolMatrix : public Sparse<bool> +class OCTAVE_API SparseBoolMatrix : public Sparse<bool> { public:
--- a/liboctave/array/chMatrix.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/chMatrix.h Fri Dec 22 12:14:08 2023 -0500 @@ -36,9 +36,7 @@ #include "mx-op-decl.h" #include "str-vec.h" -class -OCTAVE_API -charMatrix : public charNDArray +class OCTAVE_API charMatrix : public charNDArray { friend class ComplexMatrix;
--- a/liboctave/array/chNDArray.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/chNDArray.h Fri Dec 22 12:14:08 2023 -0500 @@ -34,9 +34,7 @@ #include "mx-op-decl.h" #include "str-vec.h" -class -OCTAVE_API -charNDArray : public Array<char> +class OCTAVE_API charNDArray : public Array<char> { public:
--- a/liboctave/array/dColVector.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/dColVector.h Fri Dec 22 12:14:08 2023 -0500 @@ -31,9 +31,7 @@ #include "MArray.h" #include "mx-defs.h" -class -OCTAVE_API -ColumnVector : public MArray<double> +class OCTAVE_API ColumnVector : public MArray<double> { public:
--- a/liboctave/array/dDiagMatrix.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/dDiagMatrix.h Fri Dec 22 12:14:08 2023 -0500 @@ -34,9 +34,7 @@ #include "dRowVector.h" #include "mx-defs.h" -class -OCTAVE_API -DiagMatrix : public MDiagArray2<double> +class OCTAVE_API DiagMatrix : public MDiagArray2<double> { public:
--- a/liboctave/array/dMatrix.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/dMatrix.h Fri Dec 22 12:14:08 2023 -0500 @@ -36,9 +36,7 @@ #include "mx-defs.h" #include "mx-op-decl.h" -class -OCTAVE_API -Matrix : public NDArray +class OCTAVE_API Matrix : public NDArray { public:
--- a/liboctave/array/dNDArray.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/dNDArray.cc Fri Dec 22 12:14:08 2023 -0500 @@ -99,7 +99,7 @@ ComplexNDArray NDArray::fourier (int dim) const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dim > dv.ndims () || dim < 0) return ComplexNDArray (); @@ -130,7 +130,7 @@ ComplexNDArray NDArray::ifourier (int dim) const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dim > dv.ndims () || dim < 0) return ComplexNDArray (); @@ -160,7 +160,7 @@ ComplexNDArray NDArray::fourier2d () const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.ndims () < 2) return ComplexNDArray (); @@ -180,7 +180,7 @@ ComplexNDArray NDArray::ifourier2d () const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.ndims () < 2) return ComplexNDArray (); @@ -199,7 +199,7 @@ ComplexNDArray NDArray::fourierNd () const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); int rank = dv.ndims (); const double *in (data ()); @@ -214,7 +214,7 @@ ComplexNDArray NDArray::ifourierNd () const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); int rank = dv.ndims (); ComplexNDArray tmp (*this);
--- a/liboctave/array/dNDArray.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/dNDArray.h Fri Dec 22 12:14:08 2023 -0500 @@ -34,9 +34,7 @@ #include "mx-defs.h" #include "mx-op-decl.h" -class -OCTAVE_API -NDArray : public MArray<double> +class OCTAVE_API NDArray : public MArray<double> { public:
--- a/liboctave/array/dRowVector.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/dRowVector.h Fri Dec 22 12:14:08 2023 -0500 @@ -31,9 +31,7 @@ #include "MArray.h" #include "mx-defs.h" -class -OCTAVE_API -RowVector : public MArray<double> +class OCTAVE_API RowVector : public MArray<double> { public:
--- a/liboctave/array/dSparse.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/dSparse.cc Fri Dec 22 12:14:08 2023 -0500 @@ -193,7 +193,7 @@ SparseMatrix::max (Array<octave_idx_type>& idx_arg, int dim) const { SparseMatrix result; - dim_vector dv = dims (); + const dim_vector& dv = dims (); octave_idx_type nr = dv(0); octave_idx_type nc = dv(1); @@ -344,7 +344,7 @@ SparseMatrix::min (Array<octave_idx_type>& idx_arg, int dim) const { SparseMatrix result; - dim_vector dv = dims (); + const dim_vector& dv = dims (); octave_idx_type nr = dv(0); octave_idx_type nc = dv(1);
--- a/liboctave/array/dSparse.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/dSparse.h Fri Dec 22 12:14:08 2023 -0500 @@ -40,8 +40,7 @@ #include "dMatrix.h" #include "dNDArray.h" -class -SparseMatrix : public MSparse<double> +class SparseMatrix : public MSparse<double> { public:
--- a/liboctave/array/dim-vector.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/dim-vector.h Fri Dec 22 12:14:08 2023 -0500 @@ -88,9 +88,7 @@ //! that rep points to the beginning of dims to grant faster access //! (reinterpret_cast is assumed to be an inexpensive operation). -class -OCTAVE_API -dim_vector +class OCTAVE_API dim_vector { private:
--- a/liboctave/array/fCColVector.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/fCColVector.h Fri Dec 22 12:14:08 2023 -0500 @@ -31,9 +31,7 @@ #include "MArray.h" #include "mx-defs.h" -class -OCTAVE_API -FloatComplexColumnVector : public MArray<FloatComplex> +class OCTAVE_API FloatComplexColumnVector : public MArray<FloatComplex> { friend class FloatComplexMatrix; friend class FloatComplexRowVector;
--- a/liboctave/array/fCDiagMatrix.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/fCDiagMatrix.h Fri Dec 22 12:14:08 2023 -0500 @@ -36,9 +36,7 @@ #include "fRowVector.h" #include "mx-defs.h" -class -OCTAVE_API -FloatComplexDiagMatrix : public MDiagArray2<FloatComplex> +class OCTAVE_API FloatComplexDiagMatrix : public MDiagArray2<FloatComplex> { public:
--- a/liboctave/array/fCMatrix.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/fCMatrix.h Fri Dec 22 12:14:08 2023 -0500 @@ -37,9 +37,7 @@ #include "mx-op-decl.h" #include "oct-cmplx.h" -class -OCTAVE_API -FloatComplexMatrix : public FloatComplexNDArray +class OCTAVE_API FloatComplexMatrix : public FloatComplexNDArray { public:
--- a/liboctave/array/fCNDArray.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/fCNDArray.cc Fri Dec 22 12:14:08 2023 -0500 @@ -57,7 +57,7 @@ FloatComplexNDArray FloatComplexNDArray::fourier (int dim) const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dim > dv.ndims () || dim < 0) return FloatComplexNDArray (); @@ -88,7 +88,7 @@ FloatComplexNDArray FloatComplexNDArray::ifourier (int dim) const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dim > dv.ndims () || dim < 0) return FloatComplexNDArray (); @@ -119,7 +119,7 @@ FloatComplexNDArray FloatComplexNDArray::fourier2d () const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.ndims () < 2) return FloatComplexNDArray (); @@ -139,7 +139,7 @@ FloatComplexNDArray FloatComplexNDArray::ifourier2d () const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.ndims () < 2) return FloatComplexNDArray (); @@ -159,7 +159,7 @@ FloatComplexNDArray FloatComplexNDArray::fourierNd () const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); int rank = dv.ndims (); const FloatComplex *in (data ()); @@ -174,7 +174,7 @@ FloatComplexNDArray FloatComplexNDArray::ifourierNd () const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); int rank = dv.ndims (); const FloatComplex *in (data ()); @@ -520,8 +520,8 @@ FloatComplexNDArray::insert (const NDArray& a, octave_idx_type r, octave_idx_type c) { - dim_vector a_dv = a.dims (); - dim_vector dv = dims (); + const dim_vector& a_dv = a.dims (); + const dim_vector& dv = dims (); int n = a_dv.ndims ();
--- a/liboctave/array/fCNDArray.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/fCNDArray.h Fri Dec 22 12:14:08 2023 -0500 @@ -33,9 +33,7 @@ #include "mx-defs.h" #include "mx-op-decl.h" -class -OCTAVE_API -FloatComplexNDArray : public MArray<FloatComplex> +class OCTAVE_API FloatComplexNDArray : public MArray<FloatComplex> { public:
--- a/liboctave/array/fCRowVector.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/fCRowVector.h Fri Dec 22 12:14:08 2023 -0500 @@ -32,9 +32,7 @@ #include "fRowVector.h" #include "mx-defs.h" -class -OCTAVE_API -FloatComplexRowVector : public MArray<FloatComplex> +class OCTAVE_API FloatComplexRowVector : public MArray<FloatComplex> { friend class FloatComplexColumnVector;
--- a/liboctave/array/fColVector.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/fColVector.h Fri Dec 22 12:14:08 2023 -0500 @@ -31,9 +31,7 @@ #include "MArray.h" #include "mx-defs.h" -class -OCTAVE_API -FloatColumnVector : public MArray<float> +class OCTAVE_API FloatColumnVector : public MArray<float> { public:
--- a/liboctave/array/fDiagMatrix.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/fDiagMatrix.h Fri Dec 22 12:14:08 2023 -0500 @@ -34,9 +34,7 @@ #include "fRowVector.h" #include "mx-defs.h" -class -OCTAVE_API -FloatDiagMatrix : public MDiagArray2<float> +class OCTAVE_API FloatDiagMatrix : public MDiagArray2<float> { public:
--- a/liboctave/array/fMatrix.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/fMatrix.h Fri Dec 22 12:14:08 2023 -0500 @@ -36,9 +36,7 @@ #include "mx-defs.h" #include "mx-op-decl.h" -class -OCTAVE_API -FloatMatrix : public FloatNDArray +class OCTAVE_API FloatMatrix : public FloatNDArray { public:
--- a/liboctave/array/fNDArray.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/fNDArray.cc Fri Dec 22 12:14:08 2023 -0500 @@ -57,7 +57,7 @@ FloatComplexNDArray FloatNDArray::fourier (int dim) const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dim > dv.ndims () || dim < 0) return FloatComplexNDArray (); @@ -88,7 +88,7 @@ FloatComplexNDArray FloatNDArray::ifourier (int dim) const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dim > dv.ndims () || dim < 0) return FloatComplexNDArray (); @@ -118,7 +118,7 @@ FloatComplexNDArray FloatNDArray::fourier2d () const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.ndims () < 2) return FloatComplexNDArray (); @@ -138,7 +138,7 @@ FloatComplexNDArray FloatNDArray::ifourier2d () const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); if (dv.ndims () < 2) return FloatComplexNDArray (); @@ -157,7 +157,7 @@ FloatComplexNDArray FloatNDArray::fourierNd () const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); int rank = dv.ndims (); const float *in (data ()); @@ -172,7 +172,7 @@ FloatComplexNDArray FloatNDArray::ifourierNd () const { - dim_vector dv = dims (); + const dim_vector& dv = dims (); int rank = dv.ndims (); FloatComplexNDArray tmp (*this);
--- a/liboctave/array/fNDArray.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/fNDArray.h Fri Dec 22 12:14:08 2023 -0500 @@ -34,9 +34,7 @@ #include "mx-defs.h" #include "mx-op-decl.h" -class -OCTAVE_API -FloatNDArray : public MArray<float> +class OCTAVE_API FloatNDArray : public MArray<float> { public:
--- a/liboctave/array/fRowVector.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/fRowVector.h Fri Dec 22 12:14:08 2023 -0500 @@ -31,9 +31,7 @@ #include "MArray.h" #include "mx-defs.h" -class -OCTAVE_API -FloatRowVector : public MArray<float> +class OCTAVE_API FloatRowVector : public MArray<float> { public:
--- a/liboctave/array/idx-vector.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/idx-vector.cc Fri Dec 22 12:14:08 2023 -0500 @@ -761,7 +761,7 @@ : m_rep (nullptr) { // Convert only if it means saving at least half the memory. - static const int factor = (2 * sizeof (octave_idx_type)); + static constexpr int factor = (2 * sizeof (octave_idx_type)); octave_idx_type nnz = bnda.nnz (); if (nnz <= bnda.numel () / factor) m_rep = new idx_vector_rep (bnda, nnz);
--- a/liboctave/array/idx-vector.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/idx-vector.h Fri Dec 22 12:14:08 2023 -0500 @@ -54,9 +54,7 @@ // as templates implementing "early dispatch", i.e., hoisting the checks // for index type out of loops. -class -OCTAVE_API -idx_vector +class OCTAVE_API idx_vector { public:
--- a/liboctave/array/intNDArray.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/array/intNDArray.h Fri Dec 22 12:14:08 2023 -0500 @@ -34,8 +34,7 @@ #include "boolNDArray.h" template <typename T> -class -intNDArray : public MArray<T> +class intNDArray : public MArray<T> { public:
--- a/liboctave/numeric/DAE.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/DAE.h Fri Dec 22 12:14:08 2023 -0500 @@ -31,9 +31,7 @@ #include "DAEFunc.h" #include "base-dae.h" -class -OCTAVE_API -DAE : public base_diff_alg_eqn, public DAEFunc +class OCTAVE_API DAE : public base_diff_alg_eqn, public DAEFunc { public:
--- a/liboctave/numeric/DAEFunc.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/DAEFunc.h Fri Dec 22 12:14:08 2023 -0500 @@ -30,8 +30,7 @@ #include "mx-fwd.h" -class -DAEFunc +class DAEFunc { public:
--- a/liboctave/numeric/DAERT.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/DAERT.h Fri Dec 22 12:14:08 2023 -0500 @@ -32,8 +32,7 @@ #include "DAERTFunc.h" #include "base-dae.h" -class -DAERT : public base_diff_alg_eqn, public DAERTFunc +class DAERT : public base_diff_alg_eqn, public DAERTFunc { public:
--- a/liboctave/numeric/DAERTFunc.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/DAERTFunc.h Fri Dec 22 12:14:08 2023 -0500 @@ -30,8 +30,7 @@ #include "DAEFunc.h" -class -DAERTFunc : public DAEFunc +class DAERTFunc : public DAEFunc { public:
--- a/liboctave/numeric/DASPK.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/DASPK.h Fri Dec 22 12:14:08 2023 -0500 @@ -35,9 +35,7 @@ #include "mx-fwd.h" -class -OCTAVE_API -DASPK : public DAE, public DASPK_options +class OCTAVE_API DASPK : public DAE, public DASPK_options { public:
--- a/liboctave/numeric/DASRT.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/DASRT.h Fri Dec 22 12:14:08 2023 -0500 @@ -34,8 +34,7 @@ #include "DASRT-opts.h" #include "dMatrix.h" -class -DASRT_result +class DASRT_result { public: @@ -72,9 +71,7 @@ ColumnVector m_t; }; -class -OCTAVE_API -DASRT : public DAERT, public DASRT_options +class OCTAVE_API DASRT : public DAERT, public DASRT_options { public:
--- a/liboctave/numeric/DASSL.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/DASSL.h Fri Dec 22 12:14:08 2023 -0500 @@ -35,9 +35,7 @@ #include "Array.h" #include "DASSL-opts.h" -class -OCTAVE_API -DASSL : public DAE, public DASSL_options +class OCTAVE_API DASSL : public DAE, public DASSL_options { public:
--- a/liboctave/numeric/DET.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/DET.h Fri Dec 22 12:14:08 2023 -0500 @@ -34,8 +34,7 @@ #include "oct-cmplx.h" template <typename T> -class -base_det +class base_det { public:
--- a/liboctave/numeric/EIG.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/EIG.h Fri Dec 22 12:14:08 2023 -0500 @@ -35,9 +35,7 @@ #include "CColVector.h" #include "CMatrix.h" -class -OCTAVE_API -EIG +class OCTAVE_API EIG { friend class Matrix; friend class ComplexMatrix;
--- a/liboctave/numeric/LSODE.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/LSODE.h Fri Dec 22 12:14:08 2023 -0500 @@ -33,9 +33,7 @@ #include "Array.h" #include "LSODE-opts.h" -class -OCTAVE_API -LSODE : public ODE, public LSODE_options +class OCTAVE_API LSODE : public ODE, public LSODE_options { public:
--- a/liboctave/numeric/ODE.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/ODE.h Fri Dec 22 12:14:08 2023 -0500 @@ -32,8 +32,7 @@ #include "base-de.h" #include "dMatrix.h" -class -ODE : public base_diff_eqn, public ODEFunc +class ODE : public base_diff_eqn, public ODEFunc { public:
--- a/liboctave/numeric/ODEFunc.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/ODEFunc.h Fri Dec 22 12:14:08 2023 -0500 @@ -30,8 +30,7 @@ #include "mx-fwd.h" -class -ODEFunc +class ODEFunc { public:
--- a/liboctave/numeric/ODES.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/ODES.h Fri Dec 22 12:14:08 2023 -0500 @@ -31,8 +31,7 @@ #include "ODESFunc.h" #include "base-de.h" -class -ODES : public base_diff_eqn, public ODESFunc +class ODES : public base_diff_eqn, public ODESFunc { public:
--- a/liboctave/numeric/ODESFunc.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/ODESFunc.h Fri Dec 22 12:14:08 2023 -0500 @@ -32,8 +32,7 @@ #include "dMatrix.h" -class -ODESFunc +class ODESFunc { public:
--- a/liboctave/numeric/Quad.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/Quad.h Fri Dec 22 12:14:08 2023 -0500 @@ -36,9 +36,7 @@ #include "Quad-opts.h" -class -OCTAVE_API -Quad : public Quad_options +class OCTAVE_API Quad : public Quad_options { public: @@ -118,9 +116,7 @@ float_integrand_fcn m_ff; }; -class -OCTAVE_API -DefQuad : public Quad +class OCTAVE_API DefQuad : public Quad { public: @@ -159,9 +155,7 @@ ColumnVector m_singularities; }; -class -OCTAVE_API -IndefQuad : public Quad +class OCTAVE_API IndefQuad : public Quad { public: @@ -189,9 +183,7 @@ IntegralType m_type; }; -class -OCTAVE_API -FloatDefQuad : public Quad +class OCTAVE_API FloatDefQuad : public Quad { public: @@ -230,9 +222,7 @@ FloatColumnVector m_singularities; }; -class -OCTAVE_API -FloatIndefQuad : public Quad +class OCTAVE_API FloatIndefQuad : public Quad { public:
--- a/liboctave/numeric/aepbalance.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/aepbalance.h Fri Dec 22 12:14:08 2023 -0500 @@ -35,8 +35,7 @@ OCTAVE_BEGIN_NAMESPACE(math) template <typename MT> -class -aepbalance +class aepbalance { public:
--- a/liboctave/numeric/base-dae.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/base-dae.h Fri Dec 22 12:14:08 2023 -0500 @@ -30,8 +30,7 @@ #include "base-de.h" -class -base_diff_alg_eqn : public base_diff_eqn +class base_diff_alg_eqn : public base_diff_eqn { public:
--- a/liboctave/numeric/base-de.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/base-de.h Fri Dec 22 12:14:08 2023 -0500 @@ -32,8 +32,7 @@ #include "dColVector.h" -class -base_diff_eqn +class base_diff_eqn { public:
--- a/liboctave/numeric/bsxfun-defs.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/bsxfun-defs.cc Fri Dec 22 12:14:08 2023 -0500 @@ -44,8 +44,8 @@ void (*op_vs) (std::size_t, R *, const X *, Y)) { int nd = std::max (x.ndims (), y.ndims ()); - dim_vector dvx = x.dims ().redim (nd); - dim_vector dvy = y.dims ().redim (nd); + const dim_vector& dvx = x.dims ().redim (nd); + const dim_vector& dvy = y.dims ().redim (nd); // Construct the result dimensions. dim_vector dvr; @@ -143,7 +143,7 @@ void (*op_vv) (std::size_t, R *, const X *), void (*op_vs) (std::size_t, R *, X)) { - dim_vector dvr = r.dims (); + const dim_vector& dvr = r.dims (); dim_vector dvx = x.dims (); octave_idx_type nd = r.ndims (); dvx = dvx.redim (nd);
--- a/liboctave/numeric/chol.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/chol.h Fri Dec 22 12:14:08 2023 -0500 @@ -33,8 +33,7 @@ OCTAVE_BEGIN_NAMESPACE(math) template <typename T> -class -chol +class chol { public:
--- a/liboctave/numeric/fEIG.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/fEIG.h Fri Dec 22 12:14:08 2023 -0500 @@ -35,9 +35,7 @@ #include "fCColVector.h" #include "fCMatrix.h" -class -OCTAVE_API -FloatEIG +class OCTAVE_API FloatEIG { friend class FloatMatrix; friend class FloatComplexMatrix;
--- a/liboctave/numeric/gepbalance.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/gepbalance.h Fri Dec 22 12:14:08 2023 -0500 @@ -35,8 +35,7 @@ OCTAVE_BEGIN_NAMESPACE(math) template <typename T> -class -gepbalance +class gepbalance { public:
--- a/liboctave/numeric/gsvd.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/gsvd.h Fri Dec 22 12:14:08 2023 -0500 @@ -33,9 +33,7 @@ OCTAVE_BEGIN_NAMESPACE(math) template <typename T> -class -OCTAVE_API -gsvd +class OCTAVE_API gsvd { public:
--- a/liboctave/numeric/hess.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/hess.h Fri Dec 22 12:14:08 2023 -0500 @@ -35,8 +35,7 @@ OCTAVE_BEGIN_NAMESPACE(math) template <typename T> -class -hess +class hess { public:
--- a/liboctave/numeric/lo-mappers.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/lo-mappers.cc Fri Dec 22 12:14:08 2023 -0500 @@ -187,29 +187,29 @@ octave_idx_type nint_big (double x) { - static const double out_of_range_top - = static_cast<double> (std::numeric_limits<octave_idx_type>::max ())+1.; + static constexpr double out_of_range_top + = static_cast<double> (std::numeric_limits<octave_idx_type>::max ()) + 1.0; + if (x >= out_of_range_top) return std::numeric_limits<octave_idx_type>::max (); else if (x < std::numeric_limits<octave_idx_type>::min ()) return std::numeric_limits<octave_idx_type>::min (); else - return static_cast<octave_idx_type> ((x > 0.0) ? (x + 0.5) - : (x - 0.5)); + return static_cast<octave_idx_type> ((x > 0.0) ? (x + 0.5) : (x - 0.5)); } octave_idx_type nint_big (float x) { - static const float out_of_range_top - = static_cast<float> (std::numeric_limits<octave_idx_type>::max ())+1.; + static constexpr float out_of_range_top + = static_cast<float> (std::numeric_limits<octave_idx_type>::max ()) + 1.0; + if (x >= out_of_range_top) return std::numeric_limits<octave_idx_type>::max (); else if (x < std::numeric_limits<octave_idx_type>::min ()) return std::numeric_limits<octave_idx_type>::min (); else - return static_cast<octave_idx_type> ((x > 0.0f) ? (x + 0.5f) - : (x - 0.5f)); + return static_cast<octave_idx_type> ((x > 0.0f) ? (x + 0.5f) : (x - 0.5f)); } int @@ -226,8 +226,9 @@ int nint (float x) { - static const float out_of_range_top - = static_cast<float> (std::numeric_limits<int>::max ()) + 1.; + static constexpr float out_of_range_top + = static_cast<float> (std::numeric_limits<int>::max ()) + 1.0; + if (x >= out_of_range_top) return std::numeric_limits<int>::max (); else if (x < std::numeric_limits<int>::min ())
--- a/liboctave/numeric/lo-specfun.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/lo-specfun.cc Fri Dec 22 12:14:08 2023 -0500 @@ -170,7 +170,7 @@ airy (const ComplexNDArray& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr) { - dim_vector dv = z.dims (); + const dim_vector& dv = z.dims (); octave_idx_type nel = dv.numel (); ComplexNDArray retval (dv); @@ -228,7 +228,7 @@ airy (const FloatComplexNDArray& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr) { - dim_vector dv = z.dims (); + const dim_vector& dv = z.dims (); octave_idx_type nel = dv.numel (); FloatComplexNDArray retval (dv); @@ -643,7 +643,7 @@ do_bessel (dptr f, const char *, double alpha, const ComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { - dim_vector dv = x.dims (); + const dim_vector& dv = x.dims (); octave_idx_type nel = dv.numel (); ComplexNDArray retval (dv); @@ -659,7 +659,7 @@ do_bessel (dptr f, const char *, const NDArray& alpha, const Complex& x, bool scaled, Array<octave_idx_type>& ierr) { - dim_vector dv = alpha.dims (); + const dim_vector& dv = alpha.dims (); octave_idx_type nel = dv.numel (); ComplexNDArray retval (dv); @@ -675,7 +675,7 @@ do_bessel (dptr f, const char *fn, const NDArray& alpha, const ComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { - dim_vector dv = x.dims (); + const dim_vector& dv = x.dims (); ComplexNDArray retval; if (dv != alpha.dims ()) @@ -1185,7 +1185,7 @@ do_bessel (fptr f, const char *, float alpha, const FloatComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { - dim_vector dv = x.dims (); + const dim_vector& dv = x.dims (); octave_idx_type nel = dv.numel (); FloatComplexNDArray retval (dv); @@ -1201,7 +1201,7 @@ do_bessel (fptr f, const char *, const FloatNDArray& alpha, const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr) { - dim_vector dv = alpha.dims (); + const dim_vector& dv = alpha.dims (); octave_idx_type nel = dv.numel (); FloatComplexNDArray retval (dv); @@ -1218,7 +1218,7 @@ const FloatComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { - dim_vector dv = x.dims (); + const dim_vector& dv = x.dims (); FloatComplexNDArray retval; if (dv != alpha.dims ()) @@ -1392,7 +1392,7 @@ biry (const ComplexNDArray& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr) { - dim_vector dv = z.dims (); + const dim_vector& dv = z.dims (); octave_idx_type nel = dv.numel (); ComplexNDArray retval (dv); @@ -1450,7 +1450,7 @@ biry (const FloatComplexNDArray& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr) { - dim_vector dv = z.dims (); + const dim_vector& dv = z.dims (); octave_idx_type nel = dv.numel (); FloatComplexNDArray retval (dv);
--- a/liboctave/numeric/lu.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/lu.h Fri Dec 22 12:14:08 2023 -0500 @@ -37,8 +37,7 @@ OCTAVE_BEGIN_NAMESPACE(math) template <typename T> -class -lu +class lu { public:
--- a/liboctave/numeric/oct-fftw.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/oct-fftw.h Fri Dec 22 12:14:08 2023 -0500 @@ -37,9 +37,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) -class -OCTAVE_API -fftw_planner +class OCTAVE_API fftw_planner { protected: @@ -179,9 +177,7 @@ int m_nthreads; }; -class -OCTAVE_API -float_fftw_planner +class OCTAVE_API float_fftw_planner { protected: @@ -321,9 +317,7 @@ int m_nthreads; }; -class -OCTAVE_API -fftw +class OCTAVE_API fftw { public:
--- a/liboctave/numeric/qr.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/qr.h Fri Dec 22 12:14:08 2023 -0500 @@ -35,8 +35,7 @@ OCTAVE_BEGIN_NAMESPACE(math) template <typename T> -class -qr +class qr { public:
--- a/liboctave/numeric/qrp.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/qrp.h Fri Dec 22 12:14:08 2023 -0500 @@ -36,8 +36,7 @@ OCTAVE_BEGIN_NAMESPACE(math) template <typename T> -class -qrp : public qr<T> +class qrp : public qr<T> { public:
--- a/liboctave/numeric/schur.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/schur.h Fri Dec 22 12:14:08 2023 -0500 @@ -42,8 +42,7 @@ OCTAVE_BEGIN_NAMESPACE(math) template <typename T> -class -schur +class schur { public:
--- a/liboctave/numeric/sparse-chol.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/sparse-chol.h Fri Dec 22 12:14:08 2023 -0500 @@ -44,9 +44,7 @@ // of the matrix type. template <typename chol_type> -class -OCTAVE_API -sparse_chol +class OCTAVE_API sparse_chol { public:
--- a/liboctave/numeric/sparse-lu.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/sparse-lu.h Fri Dec 22 12:14:08 2023 -0500 @@ -44,9 +44,7 @@ // of the matrix type. template <typename lu_type> -class -OCTAVE_API -sparse_lu +class OCTAVE_API sparse_lu { public:
--- a/liboctave/numeric/sparse-qr.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/sparse-qr.cc Fri Dec 22 12:14:08 2023 -0500 @@ -45,13 +45,11 @@ #if defined (HAVE_CXSPARSE) template <typename SPARSE_T> -class -cxsparse_types +class cxsparse_types { }; template <> -class -cxsparse_types<SparseMatrix> +class cxsparse_types<SparseMatrix> { public: typedef CXSPARSE_DNAME (s) symbolic_type; @@ -59,8 +57,7 @@ }; template <> -class -cxsparse_types<SparseComplexMatrix> +class cxsparse_types<SparseComplexMatrix> { public: typedef CXSPARSE_ZNAME (s) symbolic_type; @@ -3072,16 +3069,14 @@ // Bateman's original code. template <typename SPARSE_T> -class -cxsparse_defaults +class cxsparse_defaults { public: enum { order = -1 }; }; template <> -class -cxsparse_defaults<SparseMatrix> +class cxsparse_defaults<SparseMatrix> { public: #if (defined (HAVE_SPQR) && defined (HAVE_CHOLMOD)) @@ -3092,8 +3087,7 @@ }; template <> -class -cxsparse_defaults<SparseComplexMatrix> +class cxsparse_defaults<SparseComplexMatrix> { public: #if (defined (HAVE_SPQR) && defined (HAVE_CHOLMOD))
--- a/liboctave/numeric/sparse-qr.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/sparse-qr.h Fri Dec 22 12:14:08 2023 -0500 @@ -44,8 +44,7 @@ // of the matrix type. template <typename SPARSE_T> -class -sparse_qr +class sparse_qr { public:
--- a/liboctave/numeric/svd.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/svd.cc Fri Dec 22 12:14:08 2023 -0500 @@ -44,8 +44,7 @@ // class to compute optimal work space size (lwork) for DGEJSV and SGEJSV template<typename T> -class -gejsv_lwork +class gejsv_lwork { public:
--- a/liboctave/numeric/svd.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/numeric/svd.h Fri Dec 22 12:14:08 2023 -0500 @@ -35,9 +35,7 @@ OCTAVE_BEGIN_NAMESPACE(math) template <typename T> -class -OCTAVE_API -svd +class OCTAVE_API svd { public:
--- a/liboctave/operators/mx-inlines.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/operators/mx-inlines.cc Fri Dec 22 12:14:08 2023 -0500 @@ -508,8 +508,8 @@ void (*op2) (std::size_t, R *, const X *, Y), const char *opname) { - dim_vector dx = x.dims (); - dim_vector dy = y.dims (); + const dim_vector &dx = x.dims (); + const dim_vector &dy = y.dims (); if (dx == dy) { Array<R> r (dx); @@ -551,8 +551,8 @@ void (*op1) (std::size_t, R *, X), const char *opname) { - dim_vector dr = r.dims (); - dim_vector dx = x.dims (); + const dim_vector &dr = r.dims (); + const dim_vector &dx = x.dims (); if (dr == dx) op (r.numel (), r.fortran_vec (), x.data ()); else if (is_valid_inplace_bsxfun (opname, dr, dx)) @@ -1573,7 +1573,7 @@ octave_idx_type, octave_idx_type)) { octave_idx_type l, n, u; - dim_vector dims = src.dims (); + const dim_vector& dims = src.dims (); get_extent_triplet (dims, dim, l, n, u); // Cumulative operation doesn't reduce the array size. @@ -1633,7 +1633,7 @@ octave_idx_type, octave_idx_type)) { octave_idx_type l, n, u; - dim_vector dims = src.dims (); + const dim_vector& dims = src.dims (); get_extent_triplet (dims, dim, l, n, u); Array<R> ret (dims); @@ -1649,7 +1649,7 @@ octave_idx_type, octave_idx_type, octave_idx_type)) { octave_idx_type l, n, u; - dim_vector dims = src.dims (); + const dim_vector& dims = src.dims (); get_extent_triplet (dims, dim, l, n, u); Array<R> ret (dims);
--- a/liboctave/system/dir-ops.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/system/dir-ops.h Fri Dec 22 12:14:08 2023 -0500 @@ -36,9 +36,7 @@ OCTAVE_BEGIN_NAMESPACE(sys) -class -OCTAVE_API -dir_entry +class OCTAVE_API dir_entry { // NOTE: This class cannot be used safely cross-platform (Windows) with
--- a/liboctave/system/file-stat.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/system/file-stat.h Fri Dec 22 12:14:08 2023 -0500 @@ -38,9 +38,7 @@ OCTAVE_BEGIN_NAMESPACE(sys) -class -OCTAVE_API -base_file_stat +class OCTAVE_API base_file_stat { public: @@ -208,9 +206,7 @@ long m_blocks; }; -class -OCTAVE_API -file_stat : public base_file_stat +class OCTAVE_API file_stat : public base_file_stat { public: @@ -269,9 +265,7 @@ void update_internal (bool force = false); }; -class -OCTAVE_API -file_fstat : public base_file_stat +class OCTAVE_API file_fstat : public base_file_stat { public:
--- a/liboctave/system/oct-env.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/system/oct-env.h Fri Dec 22 12:14:08 2023 -0500 @@ -34,9 +34,7 @@ OCTAVE_BEGIN_NAMESPACE(sys) -class -OCTAVE_API -env +class OCTAVE_API env { protected:
--- a/liboctave/system/oct-group.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/system/oct-group.h Fri Dec 22 12:14:08 2023 -0500 @@ -38,9 +38,7 @@ OCTAVE_BEGIN_NAMESPACE(sys) -class -OCTAVE_API -group +class OCTAVE_API group { public:
--- a/liboctave/system/oct-password.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/system/oct-password.h Fri Dec 22 12:14:08 2023 -0500 @@ -36,9 +36,7 @@ OCTAVE_BEGIN_NAMESPACE(sys) -class -OCTAVE_API -password +class OCTAVE_API password { public:
--- a/liboctave/system/oct-time.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/system/oct-time.h Fri Dec 22 12:14:08 2023 -0500 @@ -59,8 +59,7 @@ class base_tm; -class -time +class time { public: @@ -193,8 +192,7 @@ t1.usec () + t2.usec ()); } -class -base_tm +class base_tm { public: @@ -306,8 +304,7 @@ OCTAVE_API void init (void *p); }; -class -localtime : public base_tm +class localtime : public base_tm { public: @@ -333,8 +330,7 @@ OCTAVE_API void init (const time& ot); }; -class -gmtime : public base_tm +class gmtime : public base_tm { public: @@ -351,8 +347,7 @@ OCTAVE_API void init (const time& ot); }; -class -strptime : public base_tm +class strptime : public base_tm { public: @@ -375,8 +370,7 @@ OCTAVE_API void init (const std::string& str, const std::string& fmt); }; -class -cpu_time +class cpu_time { public: @@ -422,8 +416,7 @@ { } }; -class -resource_usage +class resource_usage { public:
--- a/liboctave/system/oct-uname.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/system/oct-uname.h Fri Dec 22 12:14:08 2023 -0500 @@ -34,9 +34,7 @@ OCTAVE_BEGIN_NAMESPACE(sys) -class -OCTAVE_API -uname +class OCTAVE_API uname { public:
--- a/liboctave/util/action-container.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/util/action-container.h Fri Dec 22 12:14:08 2023 -0500 @@ -56,8 +56,7 @@ OCTAVE_END_NAMESPACE(util) -class -action_container +class action_container { public:
--- a/liboctave/util/base-list.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/util/base-list.h Fri Dec 22 12:14:08 2023 -0500 @@ -35,8 +35,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) template <typename elt_type> -class -base_list +class base_list { public:
--- a/liboctave/util/cmd-edit.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/util/cmd-edit.cc Fri Dec 22 12:14:08 2023 -0500 @@ -69,8 +69,7 @@ #if defined (USE_READLINE) -class -gnu_readline : public command_editor +class gnu_readline : public command_editor { public: @@ -929,8 +928,7 @@ #endif -class -default_command_editor : public command_editor +class default_command_editor : public command_editor { public:
--- a/liboctave/util/cmd-edit.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/util/cmd-edit.h Fri Dec 22 12:14:08 2023 -0500 @@ -37,9 +37,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) -class -OCTAVE_API -command_editor +class OCTAVE_API command_editor { protected:
--- a/liboctave/util/cmd-hist.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/util/cmd-hist.cc Fri Dec 22 12:14:08 2023 -0500 @@ -56,8 +56,7 @@ #if defined (USE_READLINE) -class -gnu_history : public command_history +class gnu_history : public command_history { public:
--- a/liboctave/util/cmd-hist.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/util/cmd-hist.h Fri Dec 22 12:14:08 2023 -0500 @@ -34,9 +34,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) -class -OCTAVE_API -command_history +class OCTAVE_API command_history { protected:
--- a/liboctave/util/data-conv.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/util/data-conv.h Fri Dec 22 12:14:08 2023 -0500 @@ -31,9 +31,7 @@ #include "mach-info.h" #include "oct-inttypes-fwd.h" -class -OCTAVE_API -oct_data_conv +class OCTAVE_API oct_data_conv { public:
--- a/liboctave/util/glob-match.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/util/glob-match.h Fri Dec 22 12:14:08 2023 -0500 @@ -33,9 +33,7 @@ #include "Array.h" #include "str-vec.h" -class -OCTAVE_API -glob_match +class OCTAVE_API glob_match { public: @@ -96,9 +94,7 @@ int opts_to_fnmatch_flags (unsigned int xopts) const; }; -class -OCTAVE_API -symbol_match +class OCTAVE_API symbol_match { // This class is meant to provide a performant implementation for symbol
--- a/liboctave/util/lo-regexp.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/util/lo-regexp.h Fri Dec 22 12:14:08 2023 -0500 @@ -39,9 +39,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) -class -OCTAVE_API -regexp +class OCTAVE_API regexp { public:
--- a/liboctave/util/oct-binmap.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/util/oct-binmap.h Fri Dec 22 12:14:08 2023 -0500 @@ -173,8 +173,8 @@ Array<U> binmap (const Array<T>& xa, const Array<R>& ya, F fcn, const char *name) { - dim_vector xad = xa.dims (); - dim_vector yad = ya.dims (); + const dim_vector& xad = xa.dims (); + const dim_vector& yad = ya.dims (); if (xa.numel () == 1) return binmap<U, T, R, F> (xa(0), ya, fcn); else if (ya.numel () == 1)
--- a/liboctave/util/oct-inttypes.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/util/oct-inttypes.cc Fri Dec 22 12:14:08 2023 -0500 @@ -538,8 +538,8 @@ OCTAVE_API octave_int64 operator - (const double& x, const octave_int64& y) { - static const bool twosc = (std::numeric_limits<int64_t>::min () - < -std::numeric_limits<int64_t>::max ()); + static constexpr bool twosc = (std::numeric_limits<int64_t>::min () + < -std::numeric_limits<int64_t>::max ()); // In case of symmetric integers (not two's complement), this will probably // be eliminated at compile time. if (twosc && y.value () == std::numeric_limits<int64_t>::min ())
--- a/liboctave/util/oct-inttypes.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/util/oct-inttypes.h Fri Dec 22 12:14:08 2023 -0500 @@ -123,16 +123,16 @@ class prom { // Promote to int? - static const bool s_pint = (sizeof (T1) < sizeof (int) - && sizeof (T2) < sizeof (int)); + static constexpr bool s_pint = (sizeof (T1) < sizeof (int) + && sizeof (T2) < sizeof (int)); - static const bool s_t1sig = std::numeric_limits<T1>::is_signed; - static const bool s_t2sig = std::numeric_limits<T2>::is_signed; + static constexpr bool s_t1sig = std::numeric_limits<T1>::is_signed; + static constexpr bool s_t2sig = std::numeric_limits<T2>::is_signed; - static const bool s_psig + static constexpr bool s_psig = (s_pint || (sizeof (T2) > sizeof (T1) && s_t2sig) || s_t1sig); - static const int s_psize + static constexpr int s_psize = (s_pint ? sizeof (int) : (sizeof (T2) > sizeof (T1) ? sizeof (T2) : sizeof (T1))); @@ -185,8 +185,8 @@ { \ public: \ \ - static const bool ltval = (0 OP 1); \ - static const bool gtval = (1 OP 0); \ + static constexpr bool ltval = (0 OP 1); \ + static constexpr bool gtval = (1 OP 0); \ \ template <typename T> \ static bool op (T x, T y) { return x OP y; } \ @@ -209,8 +209,8 @@ { \ public: \ \ - static const bool ltval = VALUE; \ - static const bool gtval = VALUE; \ + static constexpr bool ltval = VALUE; \ + static constexpr bool gtval = VALUE; \ \ template <typename T> \ static bool op (T, T) { return VALUE; } \ @@ -357,16 +357,16 @@ // An exhaustive test whether the max and/or min check can be // omitted. - static const bool t_is_signed = std::numeric_limits<T>::is_signed; - static const bool s_is_signed = std::numeric_limits<S>::is_signed; + static constexpr bool t_is_signed = std::numeric_limits<T>::is_signed; + static constexpr bool s_is_signed = std::numeric_limits<S>::is_signed; - static const int t_size = sizeof (T); - static const int s_size = sizeof (S); + static constexpr int t_size = sizeof (T); + static constexpr int s_size = sizeof (S); - static const bool omit_chk_min + static constexpr bool omit_chk_min = (! s_is_signed || (t_is_signed && t_size >= s_size)); - static const bool omit_chk_max + static constexpr bool omit_chk_max = (t_size > s_size || (t_size == s_size && (! t_is_signed || s_is_signed))); @@ -779,9 +779,7 @@ { }; template <typename T> -class -OCTAVE_TEMPLATE_API -octave_int : public octave_int_base<T> +class OCTAVE_TEMPLATE_API octave_int : public octave_int_base<T> { public:
--- a/liboctave/util/oct-mutex.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/util/oct-mutex.cc Fri Dec 22 12:14:08 2023 -0500 @@ -60,8 +60,7 @@ #if defined (OCTAVE_USE_WINDOWS_API) -class -w32_mutex : public base_mutex +class w32_mutex : public base_mutex { public: w32_mutex () @@ -110,8 +109,7 @@ #elif defined (HAVE_PTHREAD_H) -class -pthread_mutex : public base_mutex +class pthread_mutex : public base_mutex { public:
--- a/liboctave/util/oct-mutex.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/util/oct-mutex.h Fri Dec 22 12:14:08 2023 -0500 @@ -34,9 +34,7 @@ class mutex; -class -OCTAVE_API -base_mutex +class OCTAVE_API base_mutex { public: friend class mutex; @@ -52,9 +50,7 @@ virtual bool try_lock (); }; -class -OCTAVE_API -mutex +class OCTAVE_API mutex { public: mutex (); @@ -80,9 +76,7 @@ std::shared_ptr<base_mutex> m_rep; }; -class -OCTAVE_API -autolock +class OCTAVE_API autolock { public: autolock (const mutex& m, bool block = true) @@ -117,9 +111,7 @@ }; -class -OCTAVE_API -thread +class OCTAVE_API thread { public:
--- a/liboctave/util/oct-shlib.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/util/oct-shlib.cc Fri Dec 22 12:14:08 2023 -0500 @@ -173,8 +173,7 @@ #if defined (HAVE_DLOPEN_API) -class -octave_dlopen_shlib : public dynamic_library::dynlib_rep +class octave_dlopen_shlib : public dynamic_library::dynlib_rep { public: @@ -275,8 +274,7 @@ #elif defined (HAVE_LOADLIBRARY_API) -class -octave_w32_shlib: public dynamic_library::dynlib_rep +class octave_w32_shlib: public dynamic_library::dynlib_rep { public:
--- a/liboctave/util/oct-shlib.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/util/oct-shlib.h Fri Dec 22 12:14:08 2023 -0500 @@ -38,8 +38,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) -class -dynamic_library +class dynamic_library { public: // FIXME: make this class private?
--- a/liboctave/util/oct-sort.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/util/oct-sort.h Fri Dec 22 12:14:08 2023 -0500 @@ -97,9 +97,7 @@ enum sortmode { UNSORTED = 0, ASCENDING, DESCENDING }; template <typename T> -class -OCTAVE_TEMPLATE_API -octave_sort +class OCTAVE_TEMPLATE_API octave_sort { public: @@ -339,9 +337,7 @@ }; template <typename T> -class -OCTAVE_TEMPLATE_API -vec_index +class OCTAVE_TEMPLATE_API vec_index { public: T m_vec;
--- a/liboctave/util/oct-string.cc Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/util/oct-string.cc Fri Dec 22 12:14:08 2023 -0500 @@ -917,10 +917,11 @@ if (len <= 0) len = 10; - static const T out_of_range_top - = static_cast<T> (std::numeric_limits<int>::max ()) + 1.; - static const T out_of_range_bottom - = static_cast<T> (std::numeric_limits<int>::min ()) - 1.; + static constexpr T out_of_range_top + = static_cast<T> (std::numeric_limits<int>::max ()) + 1.0; + static constexpr T out_of_range_bottom + = static_cast<T> (std::numeric_limits<int>::min ()) - 1.0; + if (octave::math::isinf (val)) { if (val > 0)
--- a/liboctave/util/oct-string.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/util/oct-string.h Fri Dec 22 12:14:08 2023 -0500 @@ -179,9 +179,7 @@ OCTAVE_DEFAULT_COPY_MOVE_DELETE (deletable_facet) }; -class -OCTAVE_API -codecvt_u8 : public std::codecvt<char, char, std::mbstate_t> +class OCTAVE_API codecvt_u8 : public std::codecvt<char, char, std::mbstate_t> { public:
--- a/liboctave/util/octave-preserve-stream-state.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/util/octave-preserve-stream-state.h Fri Dec 22 12:14:08 2023 -0500 @@ -32,8 +32,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) -class -preserve_stream_state +class preserve_stream_state { public:
--- a/liboctave/util/pathsearch.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/util/pathsearch.h Fri Dec 22 12:14:08 2023 -0500 @@ -33,9 +33,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) -class -OCTAVE_API -directory_path +class OCTAVE_API directory_path { public:
--- a/liboctave/util/singleton-cleanup.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/util/singleton-cleanup.h Fri Dec 22 12:14:08 2023 -0500 @@ -30,9 +30,7 @@ #include <set> -class -OCTAVE_API -singleton_cleanup_list +class OCTAVE_API singleton_cleanup_list { protected:
--- a/liboctave/util/str-vec.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/util/str-vec.h Fri Dec 22 12:14:08 2023 -0500 @@ -34,9 +34,7 @@ #include "Array.h" -class -OCTAVE_API -string_vector +class OCTAVE_API string_vector { public:
--- a/liboctave/util/unwind-prot.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/util/unwind-prot.h Fri Dec 22 12:14:08 2023 -0500 @@ -37,9 +37,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) -class -OCTAVE_API -unwind_protect : public action_container +class OCTAVE_API unwind_protect : public action_container { public: @@ -92,9 +90,7 @@ // of seeing an exception (or interrupt) in the cleanup actions. // Not that we can do much about it, but at least we won't crash. -class -OCTAVE_API -unwind_protect_safe : public unwind_protect +class OCTAVE_API unwind_protect_safe : public unwind_protect { private:
--- a/liboctave/util/url-transfer.h Fri Dec 22 12:08:17 2023 -0500 +++ b/liboctave/util/url-transfer.h Fri Dec 22 12:14:08 2023 -0500 @@ -51,9 +51,7 @@ std::string CertificateFilename; }; -class -OCTAVE_API -base_url_transfer +class OCTAVE_API base_url_transfer { public: @@ -160,9 +158,7 @@ std::ostream *m_curr_ostream; }; -class -OCTAVE_API -url_transfer +class OCTAVE_API url_transfer { public:
--- a/scripts/deprecated/module.mk Fri Dec 22 12:08:17 2023 -0500 +++ b/scripts/deprecated/module.mk Fri Dec 22 12:14:08 2023 -0500 @@ -1,9 +1,7 @@ FCN_FILE_DIRS += %reldir% %canon_reldir%_FCN_FILES = \ - %reldir%/.oct-config \ - %reldir%/shift.m \ - %reldir%/sparse_auto_mutate.m + %reldir%/.oct-config %canon_reldir%dir = $(fcnfiledir)/deprecated
--- a/scripts/deprecated/shift.m Fri Dec 22 12:08:17 2023 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +0,0 @@ -######################################################################## -## -## Copyright (C) 1995-2024 The Octave Project Developers -## -## See the file COPYRIGHT.md in the top-level directory of this -## distribution or <https://octave.org/copyright/>. -## -## This file is part of Octave. -## -## Octave is free software: you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, see -## <https://www.gnu.org/licenses/>. -## -######################################################################## - -## -*- texinfo -*- -## @deftypefn {} {@var{y} =} shift (@var{x}, @var{b}) -## @deftypefnx {} {@var{y} =} shift (@var{x}, @var{b}, @var{dim}) -## -## @code{shift} is deprecated and will be removed in Octave version 10. Use -## @code{circshift} instead. -## -## If @var{x} is a vector, perform a circular shift of length @var{b} of -## the elements of @var{x}. -## -## If @var{x} is a matrix, do the same for each column of @var{x}. -## -## If the optional @var{dim} argument is given, operate along this dimension. -## @seealso{circshift} -## @end deftypefn - -## FIXME: DEPRECATED: Remove in version 10. - -function y = shift (x, b, dim) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "shift is deprecated and will be removed from a future version of Octave, please use circshift instead\n"); - endif - - if (nargin < 2) - print_usage (); - endif - - if (numel (x) < 1) - error ("shift: X must not be empty"); - elseif (! (isscalar (b) && b == fix (b))) - error ("shift: B must be an integer"); - endif - - nd = ndims (x); - sz = size (x); - - if (nargin == 3) - if (!(isscalar (dim) && dim == fix (dim)) - || !(1 <= dim && dim <= nd)) - error ("shift: DIM must be an integer and a valid dimension"); - endif - else - ## Find the first non-singleton dimension. - (dim = find (sz > 1, 1)) || (dim = 1); - endif - - d = sz(dim); - - idx = repmat ({':'}, nd, 1); - if (b > 0) - b = rem (b, d); - idx{dim} = [d-b+1:d, 1:d-b]; - elseif (b < 0) - b = rem (abs (b), d); - idx{dim} = [b+1:d, 1:b]; - endif - - y = x(idx{:}); - -endfunction - - -%!test -%! a = [1, 2, 3]; -%! b = [4, 5, 6]; -%! c = [7, 8, 9]; -%! -%! r = [a, b, c]; -%! m = [a; b; c]; -%! -%! assert (shift (r, 0), r); -%! assert (shift (r, 3), [c, a, b]); -%! assert (shift (r, -6), [c, a, b]); -%! assert (shift (r, -3), [b, c, a]); -%! assert (shift (m, 1), [c; a; b]); -%! assert (shift (m, -2), [c; a; b]); - -## Test input validation -%!error <Invalid call> shift () -%!error <Invalid call> shift (1) -%!error <X must not be empty> shift ([], 1) -%!error <B must be an integer> shift (ones (2), ones (2)) -%!error <B must be an integer> shift (ones (2), 1.5) -%!error <DIM must be an integer> shift (1, 1, 1.5) -%!error <DIM must be .* a valid dimension> shift (1, 1, 0) -%!error <DIM must be .* a valid dimension> shift (1, 1, 3)
--- a/scripts/deprecated/sparse_auto_mutate.m Fri Dec 22 12:08:17 2023 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -######################################################################## -## -## Copyright (C) 2022-2024 The Octave Project Developers -## -## See the file COPYRIGHT.md in the top-level directory of this -## distribution or <https://octave.org/copyright/>. -## -## This file is part of Octave. -## -## Octave is free software: you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, see -## <https://www.gnu.org/licenses/>. -## -######################################################################## - -## -*- texinfo -*- -## @deftypefn {} {@var{val} =} sparse_auto_mutate () -## @deftypefnx {} {@var{old_val} =} sparse_auto_mutate (@var{new_val}) -## @deftypefnx {} {@var{old_val} =} sparse_auto_mutate (@var{new_val}, "local") -## -## @code{sparse_auto_mutate} is deprecated and will be removed in Octave -## version 10. -## -## The @code{sparse_auto_mutate} function no longer has any effect on Octave's -## behavior. Previously, after calling @code{sparse_auto_mutate (true)}, -## Octave would automatically convert sparse matrices to full when a sparse -## matrix required more memory than simply using full matrix storage. This -## setting was false by default for compatibility with @sc{matlab}. Now you -## must manually convert to full storage when desired (use @code{full}). -## @seealso{full} -## @end deftypefn - -## FIXME: DEPRECATED: Remove in version 10. - -function retval = sparse_auto_mutate (val, opt) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "sparse_auto_mutate is obsolete, has no effect, and will be removed from a future version of Octave\n"); - endif - - if (nargin == 0 || nargout > 0) - retval = false; # Always false now. - return; - endif - - if (nargin == 2) - if (! (ischar (opt) && strcmp (opt, "local"))) - error ('sparse_auto_mutate: second argument must be "local"'); - endif - nargin = 1; - endif - - ## Don't bother warning that "local" is invalid outside of a function. - if (nargin > 1) - print_usage (); - endif - - if (! islogical (val)) - error ("sparse_auto_mutate: argument must be a logical value"); - endif - -endfunction
--- a/scripts/optimization/fminbnd.m Fri Dec 22 12:08:17 2023 -0500 +++ b/scripts/optimization/fminbnd.m Fri Dec 22 12:14:08 2023 -0500 @@ -102,7 +102,13 @@ print_usage (); endif - if (a > b) + if (! (isscalar (a) && isfloat (a) && isfinite (a))) + error ("Octave:invalid-input-arg", + "fminbnd: endpoint A must be a finite floating point scalar"); + elseif (! (isscalar (b) && isfloat (b) && isfinite (b))) + error ("Octave:invalid-input-arg", + "fminbnd: endpoint B must be a finite floating point scalar"); + elseif (a > b) error ("Octave:invalid-input-arg", "fminbnd: the lower bound cannot be greater than the upper one"); endif @@ -331,4 +337,12 @@ %!assert (fminbnd (@(x) x > 0.3, 0, 1) < 0.3) %!assert (fminbnd (@(x) sin (x), 0, 0), 0, eps) +## Test input validation +%!error <Invalid call> fminbnd (1) +%!error <A must be a finite floating point scalar> fminbnd (1, [2, 3], 4) +%!error <A must be a finite floating point scalar> fminbnd (1, int8 (2), 3) +%!error <A must be a finite floating point scalar> fminbnd (1, Inf, 3) +%!error <B must be a finite floating point scalar> fminbnd (1, 2, [3, 4]) +%!error <B must be a finite floating point scalar> fminbnd (1, 2, int8 (3)) +%!error <B must be a finite floating point scalar> fminbnd (1, 2, Inf) %!error <lower bound cannot be greater> fminbnd (@(x) sin (x), 0, -pi)
--- a/scripts/plot/appearance/module.mk Fri Dec 22 12:08:17 2023 -0500 +++ b/scripts/plot/appearance/module.mk Fri Dec 22 12:14:08 2023 -0500 @@ -38,10 +38,12 @@ %reldir%/orient.m \ %reldir%/pbaspect.m \ %reldir%/rticks.m \ + %reldir%/rticklabels.m \ %reldir%/shading.m \ %reldir%/specular.m \ %reldir%/text.m \ %reldir%/thetaticks.m \ + %reldir%/tticklabels.m \ %reldir%/title.m \ %reldir%/view.m \ %reldir%/whitebg.m \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/plot/appearance/rticklabels.m Fri Dec 22 12:14:08 2023 -0500 @@ -0,0 +1,258 @@ +######################################################################## +## +## Copyright (C) 2017-2023 The Octave Project Developers +## +## See the file COPYRIGHT.md in the top-level directory of this +## distribution or <https://octave.org/copyright/>. +## +## This file is part of Octave. +## +## Octave is free software: you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, see +## <https://www.gnu.org/licenses/>. +## +######################################################################## + +## -*- texinfo -*- +## @deftypefn {} {@var{labels} =} rticklabels +## @deftypefnx {} {} rticklabels (@var{tickval}) +## @deftypefnx {} {@dots{} =} rticklabels (@var{hax}, @dots{}) +## Query or set the tick labels on the r-axis of a polar plot. +## +## When called without an argument, return a cell array of strings of the +## current rtick labels. +## +## When called with the argument @var{tickval} being a vector of numbers or +## a cell array of strings and/or numbers, the labels will be changed to +## match these new values. Note that the center point of the plots made by +## @code{polar} are never labeled, so the first specified label will be +## applied to the second rtick location and subesquent labels will progress +## outward. +## +## If fewer labels are specified than the current number of tick marks, those +## labels will be applied starting with the innermost tick labels, and blank +## labels will be appended to the remainder. If the specified label count +## exceeds the number of tick labels, the excess labels are ignored. +## +## If the first argument @var{hax} is an axes handle, then operate on +## this axis rather than the current axes returned by @code{gca}. +## +## Requesting a return value when calling @code{rticklabels} to set a property +## value will result in an error. +## +## Compatability Note: The 'mode' property for rticklabels has not yet been +## implemented. +## +## @seealso{polar, rticks, tticklabels, xticklabels, yticklabels, zticklabels, +## get, set} +## @end deftypefn + +## FIXME: Octave's polar plot implementation does not currently create the +## properties rticklabel, rticklabelmode, and rtickmode. Fully +## implemented versions of those proporties could simplify much of the +## code below, which could then mimick much the behavior of the +## equivalent Cartesian functions. + +function labels = rticklabels (varargin) + [hax, varargin, nargs] = __plt_get_axis_arg__ ("rticklabels", varargin{:}); + + if (nargs > 1) + print_usage; + endif + + returnlabels = true; + + ## Check first input for axes handle and remove from argument list. + if (nargs > 0) + ## Single remaining input must be tick labels and should be a numeric + ## vector or a cell vector of numbers and strings. + + ## Error if trying to request and set values simultaneously. + if (nargout > 0) + error ("rticklabels: cannot set and return labels simultaneously"); + endif + + returnlabels = false; + arg = varargin{1}; + + if (isnumeric (arg)) + ## All inputs handled the same way as cells. (:) permits nonvectors. + cellarg_num = ones (1, numel (arg)); + cellarg_char = zeros (1, numel (arg)); + arg = num2cell (arg(:)); + + elseif (iscell (arg)) + + if (! all ((cellarg_num = cellfun ('isnumeric', arg)) + | (cellarg_char = cellfun ('ischar', arg)))) + error ("rticklabels: TICKVAL cell must contain numbers or strings"); + endif + + else + error (["rticklabels: TICKVAL must be numeric or a cell ", ... + "containing numbers and strings"]); + endif + + ## Finish converting TICVAL into a cellstr. + + ## Convert numeric elements to characters and make it a 1-D cell array. + arg(cellarg_num) = cellfun (@num2str, arg(cellarg_num), ... + "UniformOutput", false); + arg = arg(:); + endif + + if (isempty (hax)) + hax = gca (); + endif + + ## Error if the remaining input + polarhandle = findall (hax, "tag", "polar_grid"); + + ## Error if hax does not point to a polar plot with r elements. + if (isempty (polarhandle)) + error ("rticklabels: rticklabels can only be used on a polar plot"); + elseif (! isfield (get (hax), "rtick") ) + error ("rticklabels: rtick property not defined for current axes"); + endif + + ## Get count of radius and theta curves. + nr = numel (get (hax, "rtick")); # Must check if it includes unlabeled center. + nt = numel (get (hax, "ttick")); + rt_label_handles = get (polarhandle, "children"); + + ## Center is never labeled in polar plots. + ## If rtick does not include unlabled center, label_count = 2*nr+2*nt-1, + ## otherwise label_count = 2*nr+2*nt+1 and nr should be reduced by 1 + ## to prevent attempts to get label value from nonlabel handle. + if (2 * (nr + nt) + 1 > numel (rt_label_handles)) + nr--; + endif + + ## rtick and ttick object ordering: + ## 1:nt = text handles containing theta labels (reverse order) + ## nt+1:2*nt = line object handles for ttick radial grid lines + ## 2*nt+1:2*nt+nr = text handles containing nr rtick labels (reverse order) + ## 2*nt+nr+1:2*nt+2*nr = line object handles for rtick circles + ## end = patch object handle for darker outside border + + rlabelrange = 2*nt + [nr:-1:1]; # Flip back to increasing order. + + if (nargs == 0) + ## Get radius labels. + labels = get (rt_label_handles(rlabelrange), "string"); + + else + ## Set new label values. + + if isempty (arg) + ## If an empty cell or array is set, set all labels to "". + arg = cell (nr, 1); + arg(:) = {""}; + + else + ## Pad and trim arg as needed to match number of labels. + if (nr < numel (arg)) + arg (nr + 1 : end) = []; + else + arg(end + 1 : nr) = {""}; + endif + endif + + ## Replace labels with values from arg, ensure column vector. + set (rt_label_handles(rlabelrange), {"string"}, arg(:)); + endif + +endfunction + +%!test +%! t = [0:15:180] * pi / 180; +%! r = sin (t); +%! hf = figure ("visible", "off"); +%! unwind_protect +%! hp = polar (t, r); +%! hax = gca (); +%! rticks (hax, [0, 0.5, 1]); +%! assert (rticklabels (hax), {"0.5"; "1"}); +%! rticklabels (hax, [1 2]); +%! assert (rticklabels (hax), {"1"; "2"}); +%! rticklabels (hax, [3 4]'); +%! assert (rticklabels (hax), {"3"; "4"}); +%! rticklabels (hax, {5, 6}); +%! assert (rticklabels (hax), {"5"; "6"}); +%! rticklabels (hax, {"a", "bee"}); +%! assert (rticklabels (hax), {"a"; "bee"}); +%! rticklabels (hax, {1, "two"}); +%! assert (rticklabels (hax), {"1"; "two"}); +%! rticklabels (hax, {1, 2, 3, 4}); +%! assert (rticklabels (hax), {"1"; "2"}); +%! rticklabels (hax, [5, 6, 7, 8]); +%! assert (rticklabels (hax), {"5"; "6"}); +%! rticklabels (hax, {1}); +%! assert (rticklabels (hax), {"1"; ""}); +%! rticklabels (hax, {1,2}); +%! assert (rticklabels (hax), {"1"; "2"}); +%! rticklabels (hax, []); +%! assert (rticklabels (hax), {""; ""}); +%! rticklabels (hax, {1,2}); +%! assert (rticklabels (hax), {"1"; "2"}); +%! rticklabels (hax, {}); +%! assert (rticklabels (hax), {""; ""}); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect + + +## Test input validation +%!test +%! hf = figure ("visible", "off"); +%! unwind_protect +%! hax = gca (); +%! fail ("rticklabels (1,2,3)", "Invalid call"); +%! fail ("rticklabels (-1, 2)", "Invalid call"); +%! fail ("rticklabels (hax, 2, 3)", "Invalid call"); +%! fail ("rticklabels (hf, 2)", "Invalid call"); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect + +%!test +%! hf = figure ("visible", "off"); +%! unwind_protect +%! hax = gca (); +%! fail ("tmp = rticklabels ([1, 2, 3])", "cannot set and return labels simultaneously"); +%! fail ("tmp = rticklabels (hax, [1, 2, 3])", "cannot set and return labels simultaneously"); +%! fail ("rticklabels (hax, {{1}, 'two', 3})", "TICKVAL cell must contain numbers or strings"); +%! fail ("rticklabels (hax, {1, 'two', false})", "TICKVAL cell must contain numbers or strings"); +%! fail ("rticklabels (hax, {1, struct()})", "TICKVAL cell must contain numbers or strings"); +%! fail ("rticklabels (hax, struct())", "TICKVAL must be numeric or a cell containing"); +%! fail ("rticklabels (hax, [true false])", "TICKVAL must be numeric or a cell containing"); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect + +%!test +%! t = [0:45:180] * pi / 180; +%! r = sin (t); +%! hf = figure ("visible", "off"); +%! unwind_protect +%! hp = plot (t, r); +%! hax = gca (); +%! fail ("rticklabels (hax, 1)", "rticklabels can only be used on a polar plot"); +%! fail ("rticklabels ({1})", "rticklabels can only be used on a polar plot"); +%! hp = polar (t, r); +%! hax = gca (); +%! delete (findall (hax, "tag", "polar_grid")); +%! fail ("rticklabels (hax, 1)", "rticklabels can only be used on a polar plot"); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/plot/appearance/tticklabels.m Fri Dec 22 12:14:08 2023 -0500 @@ -0,0 +1,247 @@ +######################################################################## +## +## Copyright (C) 2017-2023 The Octave Project Developers +## +## See the file COPYRIGHT.md in the top-level directory of this +## distribution or <https://octave.org/copyright/>. +## +## This file is part of Octave. +## +## Octave is free software: you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, see +## <https://www.gnu.org/licenses/>. +## +######################################################################## + +## -*- texinfo -*- +## @deftypefn {} {@var{labels} =} tticklabels +## @deftypefnx {} {} tticklabels (@var{tickval}) +## @deftypefnx {} {@dots{} =} tticklabels (@var{hax}, @dots{}) +## Query or set the tick labels on the theta-axis of a polar plot. +## +## When called without an argument, return a cell array of strings of the +## current ttick labels. +## +## When called with the argument @var{tickval} being a vector of numbers or +## a cell array of strings and/or numbers, the labels will be changed to +## match these new values. Values will be applied starting with the +## zero-degree tick mark and will progress counter-clockwise. +## +## If fewer labels are specified than the current number of theta tick marks, +## those labels will be applied starting at the zero-degree tick mark and +## blank labels will be appended to the remainder. If the specified label +## count exceeds the number of tick labels, the excess labels are ignored. +## +## If the first argument @var{hax} is an axes handle, then operate on +## this axis rather than the current axes returned by @code{gca}. +## +## Requesting a return value when calling @code{tticklabels} to set a property +## value will result in an error. +## +## Compatability Note: The 'mode' property for tticklabels has not yet been +## implemented. +## +## @seealso{polar, thetaticks, rticklabels, xticklabels, yticklabels, +## zticklabels, get, set} +## @end deftypefn + +## FIXME: Octave's polar plot implementation does not currently create the +## properties tticklabel, tticklabelmode, and ttickmode. Fully +## implemented versions of those proporties could simplify much of the +## code below, which could then mimick much the behavior of the +## equivalent Cartesian functions. + +function labels = tticklabels (varargin) + [hax, varargin, nargs] = __plt_get_axis_arg__ ("tticklabels", varargin{:}); + + if (nargs > 1) + print_usage; + endif + + returnlabels = true; + + ## Check first input for axes handle and remove from argument list. + if (nargs > 0) + ## Single remaining input must be tick labels and should be a numeric + ## vector or a cell vector of numbers and strings. + + ## Error if trying to request and set values simultaneously. + if (nargout > 0) + error ("tticklabels: cannot set and return labels simultaneously"); + endif + + returnlabels = false; + arg = varargin{1}; + + if (isnumeric (arg)) + ## All inputs handled the same way as cells. (:) permits nonvectors. + cellarg_num = ones (1, numel (arg)); + cellarg_char = zeros (1, numel (arg)); + arg = num2cell (arg(:)); + + elseif (iscell (arg)) + + if (! all ((cellarg_num = cellfun ('isnumeric', arg)) + | (cellarg_char = cellfun ('ischar', arg)))) + error ("tticklabels: TICKVAL cell must contain numbers or strings"); + endif + + else + error (["tticklabels: TICKVAL must be numeric or a cell ", ... + "containing numbers and strings"]); + endif + + ## Finish converting TICVAL into a cellstr. + + ## Convert numeric elements to characters and make it a 1-D cell array. + arg(cellarg_num) = cellfun (@num2str, arg(cellarg_num), ... + "UniformOutput", false); + arg = arg(:); + endif + + if (isempty (hax)) + hax = gca (); + endif + + ## Error if the remaining input + polarhandle = findall (hax, "tag", "polar_grid"); + + ## Error if hax does not point to a polar plot with theta elements. + if (isempty (polarhandle)) + error ("tticklabels: tticklabels can only be used on a polar plot"); + elseif (! isfield (get (hax), "ttick") ) + error ("tticklabels: ttick property not defined for current axes"); + endif + + ## Get theta curves count. + nt = numel (get (hax, "ttick")); + + ## rtick and ttick object ordering: + ## 1:nt = text handles containing theta labels (reverse order) + ## nt+1:2*nt = line object handles for ttick radial grid lines + ## 2*nt+1:2*nt+nr = text handles containing nr rtick labels (reverse order) + ## 2*nt+nr+1:2*nt+2*nr = line object handles for rtick circles + ## end = patch object handle for darker outside border + + ## Get theta label handles, reverse order so output is in increasing. + tlabel_handles = get (polarhandle, "children")(nt:-1:1); + + if (nargs == 0) + ## Just return theta labels. + labels = get (tlabel_handles, "string"); + + else + ## Set new label values. + + if isempty (arg) + ## If an empty cell or array is set, set all labels to "". + arg = cell (nt, 1); + arg(:) = {""}; + + else + ## Pad and trim arg as needed to match number of labels. + if (nt < numel (arg)) + arg (nt + 1 : end) = []; + else + arg(end + 1 : nt) = {""}; + endif + endif + + ## Replace labels with values from arg, ensure column vector. + set (tlabel_handles, {"string"}, arg(:)); + endif + +endfunction + +%!test +%! t = [0:15:180] * pi / 180; +%! r = sin (t); +%! hf = figure ("visible", "off"); +%! unwind_protect +%! hp = polar (t, r); +%! hax = gca (); +%! thetaticks (hax, [0:60:300]); +%! assert (tticklabels (hax), {"0"; "60"; "120"; "180"; "240"; "300"}); +%! tticklabels (hax, [0:20:100]); +%! assert (tticklabels (hax), {"0"; "20"; "40"; "60"; "80"; "100"}); +%! tticklabels (hax, [0:-20:-100]'); +%! assert (tticklabels (hax), {"0"; "-20"; "-40"; "-60"; "-80"; "-100"}); +%! tticklabels (hax, {1, 2, 3, 4, 5 ,6}); +%! assert (tticklabels (hax), {"1"; "2"; "3"; "4"; "5"; "6"}); +%! tticklabels (hax, {"a", "bee", "c", "d", "eeee", "f"}); +%! assert (tticklabels (hax), {"a"; "bee"; "c"; "d"; "eeee"; "f"}); +%! tticklabels (hax, {1, "two", 3, "4", 5, "six"}'); +%! assert (tticklabels (hax), {"1"; "two"; "3"; "4"; "5"; "six"}); +%! tticklabels (hax, {1, 2, 3, 4, 5 ,6, 7}); +%! assert (tticklabels (hax), {"1"; "2"; "3"; "4"; "5"; "6"}); +%! tticklabels (hax, [5, 6, 7, 8, 9, 10, 11]); +%! assert (tticklabels (hax), {"5"; "6"; "7"; "8"; "9"; "10"}); +%! tticklabels (hax, {1}); +%! assert (tticklabels (hax), {"1"; ""; ""; ""; ""; ""}); +%! tticklabels (hax, {1, 2, 3, 4, 5 ,6}); +%! assert (tticklabels (hax), {"1"; "2"; "3"; "4"; "5"; "6"}); +%! tticklabels (hax, []); +%! assert (tticklabels (hax), {""; ""; ""; ""; ""; ""}); +%! tticklabels (hax, {1, 2, 3, 4, 5 ,6}); +%! assert (tticklabels (hax), {"1"; "2"; "3"; "4"; "5"; "6"}); +%! tticklabels (hax, {}); +%! assert (tticklabels (hax), {""; ""; ""; ""; ""; ""}); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect + + +## Test input validation +%!test +%! hf = figure ("visible", "off"); +%! unwind_protect +%! hax = gca (); +%! fail ("tticklabels (1,2,3)", "Invalid call"); +%! fail ("tticklabels (-1, 2)", "Invalid call"); +%! fail ("tticklabels (hax, 2, 3)", "Invalid call"); +%! fail ("tticklabels (hf, 2)", "Invalid call"); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect + +%!test +%! hf = figure ("visible", "off"); +%! unwind_protect +%! hax = gca (); +%! fail ("tmp = tticklabels ([1, 2, 3])", "cannot set and return labels simultaneously"); +%! fail ("tmp = tticklabels (hax, [1, 2, 3])", "cannot set and return labels simultaneously"); +%! fail ("tticklabels (hax, {{1}, 'two', 3})", "TICKVAL cell must contain numbers or strings"); +%! fail ("tticklabels (hax, {1, 'two', false})", "TICKVAL cell must contain numbers or strings"); +%! fail ("tticklabels (hax, {1, struct()})", "TICKVAL cell must contain numbers or strings"); +%! fail ("tticklabels (hax, struct())", "TICKVAL must be numeric or a cell containing"); +%! fail ("tticklabels (hax, [true false])", "TICKVAL must be numeric or a cell containing"); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect + +%!test +%! t = [0:45:180] * pi / 180; +%! r = sin (t); +%! hf = figure ("visible", "off"); +%! unwind_protect +%! hp = plot (t, r); +%! hax = gca (); +%! fail ("tticklabels (hax, 1)", "tticklabels can only be used on a polar plot"); +%! fail ("tticklabels ({1})", "tticklabels can only be used on a polar plot"); +%! hp = polar (t, r); +%! hax = gca (); +%! delete (findall (hax, "tag", "polar_grid")); +%! fail ("tticklabels (hax, 1)", "tticklabels can only be used on a polar plot"); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect
--- a/scripts/plot/draw/polar.m Fri Dec 22 12:08:17 2023 -0500 +++ b/scripts/plot/draw/polar.m Fri Dec 22 12:14:08 2023 -0500 @@ -173,7 +173,7 @@ set (hax, "xlim", [-maxr maxr], "ylim", [-maxr maxr]); xtick = get (hax, "xtick"); - minidx = find (xtick > 0, 1); + minidx = find (xtick >= 0, 1); maxidx = find (xtick >= maxr, 1); if (! isempty (maxidx)) rtick = xtick(minidx:maxidx); @@ -557,7 +557,7 @@ %! assert (vertcat (linedata.ydata)', rm .* sin (tv1'), eps); %! assert (isempty (vertcat (linedata.zdata))); %! -%! h = polar (hax, tv1', rm); # Verify orientation independence. +%! h = polar (hax, tv1', rm); # Verify orientation independence. %! linedata = get (h); %! assert (numel (linedata), 3); %! assert (vertcat (linedata.xdata)', rm .* cos (tv1'), eps); @@ -571,13 +571,13 @@ %! assert (vertcat (linedata.ydata), rm .* sin (tv2), eps); %! assert (isempty (vertcat (linedata.zdata))); %! -%! h = polar (hax, tv2', rm); # Verify orientation independence. +%! h = polar (hax, tv2', rm); # Verify orientation independence. %! linedata = get (h); %! assert (numel (linedata), 2); %! assert (vertcat (linedata.xdata), rm .* cos (tv2), eps); %! assert (vertcat (linedata.ydata), rm .* sin (tv2), eps); %! assert (isempty (vertcat (linedata.zdata))); - +%! %! h = polar (hax, tm, rv1); %! linedata = get (h); %! assert (numel (linedata), 3); @@ -585,7 +585,7 @@ %! assert (vertcat (linedata.ydata)', rv1' .* sin (tm), eps); %! assert (isempty (vertcat (linedata.zdata))); %! -%! h = polar (hax, tm, rv1'); # Verify orientation independence. +%! h = polar (hax, tm, rv1'); # Verify orientation independence. %! linedata = get (h); %! assert (vertcat (linedata.xdata)', rv1' .* cos (tm), eps); %! assert (vertcat (linedata.ydata)', rv1' .* sin (tm), eps); @@ -598,7 +598,7 @@ %! assert (vertcat (linedata.ydata), rv2 .* sin (tm), eps); %! assert (isempty (vertcat (linedata.zdata))); %! -%! h = polar (hax, tm, rv2'); # Verify orientation independence. +%! h = polar (hax, tm, rv2'); # Verify orientation independence. %! linedata = get (h); %! assert (numel (linedata), 2); %! assert (vertcat (linedata.xdata), rv2 .* cos (tm), eps); @@ -621,7 +621,7 @@ %! haxtr = get (hax); %! linetr = get (h); %! -%! haxtr.children = []; # Clear child handles that should be unique. +%! haxtr.children = []; # Clear child handles that should be unique. %! haxtr.xlabel= []; %! haxtr.ylabel= []; %! haxtr.zlabel= []; @@ -632,26 +632,26 @@ %! haxcplx.zlabel = []; %! haxcplx.title = []; %! -%! assert (isequaln (haxcplx, haxtr)); # Check parent objects. -%! assert (isequaln (linecplx, linetr)); # Check actual data objects. +%! assert (isequaln (haxcplx, haxtr)); # Check parent objects. +%! assert (isequaln (linecplx, linetr)); # Check actual data objects. %! unwind_protect_cleanup %! close (hf); %! end_unwind_protect -##Test rtick, ttick being properly set -%!test +##Test rtick, ttick being set - including the unlabeled 0 (bug #64991) +%!test <*64991> %! hf = figure ("visible", "off"); %! hax = gca (); %! unwind_protect %! polar (hax, [1 2 3], [4 5 6]); %! haxdata = get (hax); -%! assert (haxdata.rtick, [2 4 6]); +%! assert (haxdata.rtick, [0 2 4 6]); %! assert (haxdata.ttick, [0:30:330]); %! unwind_protect_cleanup %! close (hf); %! end_unwind_protect -##Test FMT string inputs +## Test FMT string inputs %!test %! hf = figure ("visible", "off"); %! hax = gca (); @@ -680,7 +680,7 @@ %! close (hf); %! end_unwind_protect -##Test input validation +## Test input validation %!error <Invalid call> polar () %!test %! hf = figure ("visible", "off"); @@ -695,7 +695,7 @@ %! fail ("polar (hax, [1 2 3], [1 2; 3 4])", "THETA vector and RHO matrix sizes must match"); %! fail ("polar (hax, [1 2; 3 4], [1 2 3])", "THETA matrix and RHO vector sizes must match"); %! fail ("polar (hax, [1 2; 3 4], [1 2 3; 4 5 6])", "THETA and RHO matrix dimensions must match"); -%! h = polar (hax, 1, 2); # Generates line object handle. +%! h = polar (hax, 1, 2); # Generates line object handle. %! fail ("polar (h, 1, 2)", "first argument must be axes handle"); %! unwind_protect_cleanup %! close (hf);
--- a/test/json/jsonencode_BIST.tst Fri Dec 22 12:08:17 2023 -0500 +++ b/test/json/jsonencode_BIST.tst Fri Dec 22 12:14:08 2023 -0500 @@ -15,6 +15,8 @@ %! assert (isequal (jsonencode (logical (1)), 'true')); %! assert (isequal (jsonencode (logical (0)), 'false')); %! assert (isequal (jsonencode (50.025), '50.025')); +%! %% FIXME: Uncomment when bug #64960 is fixed +%! %% assert (isequal (jsonencode (single (50.025)), '50.025')); %! assert (isequal (jsonencode (NaN), 'null')); %! assert (isequal (jsonencode (NA), 'null')); % Octave-only test %! assert (isequal (jsonencode (Inf), 'null'));