# HG changeset patch # User Rik # Date 1702451673 28800 # Node ID 60515d0cd023a5614754987c4fb3d57a6dd83424 # Parent a2be40ce8fec525febd0e0d92782c60517168271# Parent 094a296b3ba14f60fc7861e16852a183ba72cd67 maint: Merge default to bytecode-interpreter. * libgui/graphics/FigureWindow.cc, libgui/graphics/GenericEventNotify.h, libgui/graphics/KeyMap.cc, libgui/graphics/Object.cc, libgui/graphics/ObjectProxy.cc, libgui/graphics/PopupMenuControl.cc, libgui/graphics/QtHandlesUtils.cc, libgui/graphics/Table.cc, libgui/graphics/ToolBarButton.cc, libgui/graphics/annotation-dialog.cc, libgui/graphics/qt-graphics-toolkit.cc, libgui/qterminal/libqterminal/QTerminal.h, libgui/src/color-picker.cc, libgui/src/command-widget.cc, libgui/src/community-news.cc, libgui/src/dialog.cc, libgui/src/documentation-bookmarks.cc, libgui/src/documentation-dock-widget.cc, libgui/src/documentation.cc, libgui/src/dw-main-window.cc, libgui/src/external-editor-interface.cc, libgui/src/files-dock-widget.cc, libgui/src/find-files-dialog.cc, libgui/src/find-files-model.cc, libgui/src/gui-preferences-cs.h, libgui/src/gui-preferences-ed.h, libgui/src/gui-preferences-global.h, libgui/src/gui-preferences-sc.cc, libgui/src/gui-preferences-ve.h, libgui/src/gui-preferences-ws.h, libgui/src/gui-preferences.cc, libgui/src/gui-settings.cc, libgui/src/gui-utils.h, libgui/src/history-dock-widget.cc, libgui/src/interpreter-qobject.cc, libgui/src/led-indicator.cc, libgui/src/led-indicator.h, libgui/src/m-editor/file-editor-tab.cc, libgui/src/m-editor/file-editor.cc, libgui/src/m-editor/find-dialog.cc, libgui/src/m-editor/marker.cc, libgui/src/m-editor/marker.h, libgui/src/m-editor/octave-qscintilla.cc, libgui/src/m-editor/octave-qscintilla.h, libgui/src/m-editor/octave-txt-lexer.cc, libgui/src/main-window.cc, libgui/src/octave-dock-widget.cc, libgui/src/octave-qobject.cc, libgui/src/qt-application.cc, libgui/src/qt-interpreter-events.cc, libgui/src/release-notes.cc, libgui/src/set-path-dialog.cc, libgui/src/set-path-model.cc, libgui/src/settings-dialog.cc, libgui/src/shortcuts-tree-widget.cc, libgui/src/tab-bar.cc, libgui/src/terminal-dock-widget.cc, libgui/src/variable-editor.cc, libgui/src/variable-editor.h, libgui/src/welcome-wizard.cc, libgui/src/workspace-view.cc, libinterp/corefcn/__ichol__.cc, libinterp/corefcn/__ilu__.cc, libinterp/corefcn/bsxfun.cc, libinterp/corefcn/call-stack.cc, libinterp/corefcn/defaults.cc, libinterp/corefcn/environment.cc, libinterp/corefcn/error.cc, libinterp/corefcn/event-manager.cc, libinterp/corefcn/ft-text-renderer.cc, libinterp/corefcn/gl-render.cc, libinterp/corefcn/graphics-utils.cc, libinterp/corefcn/graphics.cc, libinterp/corefcn/graphics.in.h, libinterp/corefcn/help.cc, libinterp/corefcn/hook-fcn.cc, libinterp/corefcn/input.cc, libinterp/corefcn/interpreter-private.cc, libinterp/corefcn/interpreter.cc, libinterp/corefcn/load-path.cc, libinterp/corefcn/load-save.cc, libinterp/corefcn/ls-hdf5.cc, libinterp/corefcn/lu.cc, libinterp/corefcn/mex.cc, libinterp/corefcn/oct-hist.cc, libinterp/corefcn/oct-map.cc, libinterp/corefcn/oct-stream.cc, libinterp/corefcn/pager.cc, libinterp/corefcn/perms.cc, libinterp/corefcn/pr-output.cc, libinterp/corefcn/qr.cc, libinterp/corefcn/settings.cc, libinterp/corefcn/sparse-xdiv.cc, libinterp/corefcn/stack-frame.cc, libinterp/corefcn/syminfo.cc, libinterp/corefcn/symrcm.cc, libinterp/corefcn/symscope.cc, libinterp/corefcn/symtab.cc, libinterp/corefcn/sysdep.cc, libinterp/corefcn/tsearch.cc, libinterp/corefcn/url-handle-manager.cc, libinterp/corefcn/utils.cc, libinterp/corefcn/xnorm.cc, libinterp/dldfcn/__init_fltk__.cc, libinterp/octave-value/ov-base.cc, libinterp/octave-value/ov-bool-mat.cc, libinterp/octave-value/ov-cell.cc, libinterp/octave-value/ov-ch-mat.cc, libinterp/octave-value/ov-class.cc, libinterp/octave-value/ov-classdef.cc, libinterp/octave-value/ov-fcn-handle.cc, libinterp/octave-value/ov-fcn-handle.h, libinterp/octave-value/ov-fcn.h, libinterp/octave-value/ov-inline.h, libinterp/octave-value/ov-lazy-idx.cc, libinterp/octave-value/ov-range.cc, libinterp/octave-value/ov-range.h, libinterp/octave-value/ov-typeinfo.cc, libinterp/octave-value/ov-usr-fcn.cc, libinterp/octave-value/ov.cc, libinterp/octave.cc, libinterp/parse-tree/anon-fcn-validator.cc, libinterp/parse-tree/bp-table.cc, libinterp/parse-tree/oct-lvalue.cc, libinterp/parse-tree/pt-classdef.cc, libinterp/parse-tree/pt-colon.cc, libinterp/parse-tree/pt-eval.cc, libinterp/parse-tree/pt-eval.h, libinterp/parse-tree/pt-tm-const.cc, libinterp/parse-tree/pt-walk.cc, liboctave/array/Array-b.cc, liboctave/array/Array-base.cc, liboctave/array/CMatrix.cc, liboctave/array/CNDArray.cc, liboctave/array/CSparse.cc, liboctave/array/MArray.cc, liboctave/array/Range.cc, liboctave/array/Sparse.cc, liboctave/array/Sparse.h, liboctave/array/dMatrix.cc, liboctave/array/fCMatrix.cc, liboctave/array/fCNDArray.cc, liboctave/array/fMatrix.cc, liboctave/array/idx-vector.cc, liboctave/numeric/CollocWt.cc, liboctave/numeric/gsvd.cc, liboctave/numeric/lo-mappers.cc, liboctave/numeric/lo-specfun.cc, liboctave/numeric/oct-norm.cc, liboctave/numeric/oct-rand.cc, liboctave/numeric/oct-spparms.cc, liboctave/numeric/randmtzig.cc, liboctave/numeric/randpoisson.cc, liboctave/operators/mx-inlines.cc, liboctave/system/child-list.cc, liboctave/system/file-ops.cc, liboctave/system/lo-sysdep.cc, liboctave/system/lo-sysinfo.cc, liboctave/system/mach-info.cc, liboctave/util/file-info.cc, liboctave/util/glob-match.cc, liboctave/util/lo-error.h, liboctave/util/lo-utils.cc, liboctave/util/oct-inttypes.h, liboctave/util/oct-shlib.cc, liboctave/util/oct-sort.cc, liboctave/util/oct-string.cc, liboctave/util/pathsearch.cc, liboctave/util/quit.cc, liboctave/version.cc, src/main.in.cc, src/octave-svgconvert.cc: Merge default to bytecode-interpreter. diff -r a2be40ce8fec -r 60515d0cd023 libgui/graphics/FigureWindow.cc --- a/libgui/graphics/FigureWindow.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/graphics/FigureWindow.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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(); diff -r a2be40ce8fec -r 60515d0cd023 libgui/graphics/GenericEventNotify.h --- a/libgui/graphics/GenericEventNotify.h Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/graphics/GenericEventNotify.h Tue Dec 12 23:14:33 2023 -0800 @@ -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); diff -r a2be40ce8fec -r 60515d0cd023 libgui/graphics/KeyMap.cc --- a/libgui/graphics/KeyMap.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/graphics/KeyMap.cc Tue Dec 12 23:14:33 2023 -0800 @@ -250,7 +250,8 @@ return keyMapper; } - std::string qKeyToKeyString (int key) + std::string + qKeyToKeyString (int key) { static const QMap keyMapper = makeKeyMapper (); diff -r a2be40ce8fec -r 60515d0cd023 libgui/graphics/Object.cc --- a/libgui/graphics/Object.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/graphics/Object.cc Tue Dec 12 23:14:33 2023 -0800 @@ -189,7 +189,8 @@ Object::beingDeleted () { } -void Object::objectDestroyed (QObject *obj) +void +Object::objectDestroyed (QObject *obj) { if (obj && obj == m_qobject) m_qobject = nullptr; diff -r a2be40ce8fec -r 60515d0cd023 libgui/graphics/ObjectProxy.cc --- a/libgui/graphics/ObjectProxy.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/graphics/ObjectProxy.cc Tue Dec 12 23:14:33 2023 -0800 @@ -40,7 +40,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) ObjectProxy::ObjectProxy (Object *obj) -: QObject (), m_object (nullptr) + : QObject (), m_object (nullptr) { init (obj); } diff -r a2be40ce8fec -r 60515d0cd023 libgui/graphics/PopupMenuControl.cc --- a/libgui/graphics/PopupMenuControl.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/graphics/PopupMenuControl.cc Tue Dec 12 23:14:33 2023 -0800 @@ -71,7 +71,8 @@ PopupMenuControl::~PopupMenuControl () { } -void PopupMenuControl::update (int pId) +void +PopupMenuControl::update (int pId) { uicontrol::properties& up = properties (); QComboBox *box = qWidget (); diff -r a2be40ce8fec -r 60515d0cd023 libgui/graphics/QtHandlesUtils.cc --- a/libgui/graphics/QtHandlesUtils.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/graphics/QtHandlesUtils.cc Tue Dec 12 23:14:33 2023 -0800 @@ -85,7 +85,8 @@ return v; } - Cell toCellString (const QStringList& l) + Cell + toCellString (const QStringList& l) { QStringList tmp = l; @@ -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"); diff -r a2be40ce8fec -r 60515d0cd023 libgui/graphics/Table.cc --- a/libgui/graphics/Table.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/graphics/Table.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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 flag_and_text = diff -r a2be40ce8fec -r 60515d0cd023 libgui/graphics/ToolBarButton.cc --- a/libgui/graphics/ToolBarButton.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/graphics/ToolBarButton.cc Tue Dec 12 23:14:33 2023 -0800 @@ -153,7 +153,8 @@ } template -QIcon ToolBarButton::get_icon (const std::string& name) +QIcon +ToolBarButton::get_icon (const std::string& name) { return QIcon (global_icon_paths.at (ICON_THEME_OCTAVE) + QString::fromStdString (name) + ".png"); } diff -r a2be40ce8fec -r 60515d0cd023 libgui/graphics/annotation-dialog.cc --- a/libgui/graphics/annotation-dialog.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/graphics/annotation-dialog.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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. diff -r a2be40ce8fec -r 60515d0cd023 libgui/graphics/qt-graphics-toolkit.cc --- a/libgui/graphics/qt-graphics-toolkit.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/graphics/qt-graphics-toolkit.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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 (); diff -r a2be40ce8fec -r 60515d0cd023 libgui/qterminal/libqterminal/QTerminal.h --- a/libgui/qterminal/libqterminal/QTerminal.h Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/qterminal/libqterminal/QTerminal.h Tue Dec 12 23:14:33 2023 -0800 @@ -57,8 +57,8 @@ virtual void has_extra_interrupt (bool extra) = 0; - virtual QList get_hotspot_actions (const QPoint&) - { return QList (); } + virtual QList get_hotspot_actions (const QPoint&) + { return QList (); } enum CursorType { diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/color-picker.cc --- a/libgui/src/color-picker.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/color-picker.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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? diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/command-widget.cc --- a/libgui/src/command-widget.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/command-widget.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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 diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/community-news.cc --- a/libgui/src/community-news.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/community-news.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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 (); diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/dialog.cc --- a/libgui/src/dialog.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/dialog.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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; diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/documentation-bookmarks.cc --- a/libgui/src/documentation-bookmarks.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/documentation-bookmarks.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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 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 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 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) diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/documentation-dock-widget.cc --- a/libgui/src/documentation-dock-widget.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/documentation-dock-widget.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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); } diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/documentation.cc --- a/libgui/src/documentation.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/documentation.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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) { diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/dw-main-window.cc --- a/libgui/src/dw-main-window.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/dw-main-window.cc Tue Dec 12 23:14:33 2023 -0800 @@ -79,7 +79,8 @@ } // Re-implementing the popup menu of the main window -QMenu *dw_main_window::createPopupMenu () +QMenu * +dw_main_window::createPopupMenu () { QList new_actions = QList (); 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) diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/external-editor-interface.cc --- a/libgui/src/external-editor-interface.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/external-editor-interface.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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; diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/files-dock-widget.cc --- a/libgui/src/files-dock-widget.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/files-dock-widget.cc Tue Dec 12 23:14:33 2023 -0800 @@ -104,7 +104,7 @@ auto parent_dir = QDir(filePath (parent (idx))); - files_dock_widget *fdw = static_cast(parent()); + files_dock_widget *fdw = static_cast(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); @@ -613,7 +625,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); @@ -710,7 +723,8 @@ } } -void files_dock_widget::contextmenu_open (bool) +void +files_dock_widget::contextmenu_open (bool) { QItemSelectionModel *m = m_file_tree_view->selectionModel (); @@ -724,7 +738,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 (); @@ -738,7 +753,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 (); @@ -747,7 +763,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 (); @@ -765,7 +782,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 (); @@ -780,7 +798,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 (); @@ -794,7 +813,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 (); @@ -805,7 +825,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 (); @@ -835,10 +856,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) @@ -881,7 +902,8 @@ // Get the currently selected files/dirs and return their file info // in a list. -QList files_dock_widget::get_selected_items_info (bool dir) +QList +files_dock_widget::get_selected_items_info (bool dir) { QItemSelectionModel *m = m_file_tree_view->selectionModel (); QModelIndexList rows = m->selectedRows (); @@ -900,7 +922,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 (); @@ -916,7 +939,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 (); @@ -932,7 +956,8 @@ } } -void files_dock_widget::contextmenu_setcurrentdir (bool) +void +files_dock_widget::contextmenu_setcurrentdir (bool) { QList infos = get_selected_items_info (true); @@ -940,7 +965,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 infos = get_selected_items_info (true); @@ -953,22 +979,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 (); @@ -986,7 +1016,8 @@ } } -void files_dock_widget::notice_settings () +void +files_dock_widget::notice_settings () { gui_settings settings; @@ -1002,7 +1033,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 ()) @@ -1011,7 +1042,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 @@ -1031,7 +1062,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 ()); @@ -1041,7 +1073,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; @@ -1052,28 +1085,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; @@ -1091,7 +1128,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; @@ -1107,17 +1145,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); @@ -1133,7 +1174,8 @@ } } -void files_dock_widget::pasteClipboard () +void +files_dock_widget::pasteClipboard () { if (m_current_directory->hasFocus ()) { @@ -1145,7 +1187,8 @@ } } -void files_dock_widget::selectAll () +void +files_dock_widget::selectAll () { if (m_file_tree_view->hasFocus ()) m_file_tree_view->selectAll (); diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/find-files-dialog.cc --- a/libgui/src/find-files-dialog.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/find-files-dialog.cc Tue Dec 12 23:14:33 2023 -0800 @@ -129,8 +129,8 @@ m_file_list->sortByColumn (settings.int_value (ff_sort_files_by_column), static_cast (settings.uint_value (ff_sort_files_by_order))); - // FIXME: use value instead of static cast after - // dropping support of Qt 5.4 + // FIXME: use value 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 (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 ()) diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/find-files-model.cc --- a/libgui/src/find-files-model.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/find-files-model.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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; diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/gui-preferences-cs.h --- a/libgui/src/gui-preferences-cs.h Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/gui-preferences-cs.h Tue Dec 12 23:14:33 2023 -0800 @@ -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"), diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/gui-preferences-ed.h --- a/libgui/src/gui-preferences-ed.h Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/gui-preferences-ed.h Tue Dec 12 23:14:33 2023 -0800 @@ -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"), diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/gui-preferences-global.h --- a/libgui/src/gui-preferences-global.h Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/gui-preferences-global.h Tue Dec 12 23:14:33 2023 -0800 @@ -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") diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/gui-preferences-sc.cc --- a/libgui/src/gui-preferences-sc.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/gui-preferences-sc.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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; diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/gui-preferences-ve.h --- a/libgui/src/gui-preferences-ve.h Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/gui-preferences-ve.h Tue Dec 12 23:14:33 2023 -0800 @@ -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", diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/gui-preferences-ws.h --- a/libgui/src/gui-preferences-ws.h Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/gui-preferences-ws.h Tue Dec 12 23:14:33 2023 -0800 @@ -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") diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/gui-preferences.cc --- a/libgui/src/gui-preferences.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/gui-preferences.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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 (); diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/gui-settings.cc --- a/libgui/src/gui-settings.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/gui-settings.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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 (); } -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 (def.toInt ())); - // FIXME: use value instead of static cast after - // dropping support of Qt 5.4 + // FIXME: use value 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 (); } -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 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) { diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/gui-utils.h --- a/libgui/src/gui-utils.h Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/gui-utils.h Tue Dec 12 23:14:33 2023 -0800 @@ -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. diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/history-dock-widget.cc --- a/libgui/src/history-dock-widget.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/history-dock-widget.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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; diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/interpreter-qobject.cc --- a/libgui/src/interpreter-qobject.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/interpreter-qobject.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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 (); } diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/led-indicator.cc --- a/libgui/src/led-indicator.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/led-indicator.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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); diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/led-indicator.h --- a/libgui/src/led-indicator.h Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/led-indicator.h Tue Dec 12 23:14:33 2023 -0800 @@ -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); diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/m-editor/file-editor-tab.cc --- a/libgui/src/m-editor/file-editor-tab.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/m-editor/file-editor-tab.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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 ]*$"}; diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/m-editor/file-editor.cc --- a/libgui/src/m-editor/file-editor.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/m-editor/file-editor.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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 (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 shared_actions) +void +file_editor::insert_global_actions (QList 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 (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 (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 (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 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); diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/m-editor/find-dialog.cc --- a/libgui/src/m-editor/find-dialog.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/m-editor/find-dialog.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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) { diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/m-editor/marker.cc --- a/libgui/src/m-editor/marker.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/m-editor/marker.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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 diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/m-editor/marker.h --- a/libgui/src/m-editor/marker.h Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/m-editor/marker.h Tue Dec 12 23:14:33 2023 -0800 @@ -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 = ""); diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/m-editor/octave-qscintilla.cc --- a/libgui/src/m-editor/octave-qscintilla.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/m-editor/octave-qscintilla.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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(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; } diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/m-editor/octave-qscintilla.h --- a/libgui/src/m-editor/octave-qscintilla.h Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/m-editor/octave-qscintilla.h Tue Dec 12 23:14:33 2023 -0800 @@ -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); diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/m-editor/octave-txt-lexer.cc --- a/libgui/src/m-editor/octave-txt-lexer.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/m-editor/octave-txt-lexer.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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"; } diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/main-window.cc --- a/libgui/src/main-window.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/main-window.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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 ), 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::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 shared_actions = { + QList 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 main_window::dock_widget_list () +QList +main_window::dock_widget_list () { QList list = QList (); list.append (static_cast (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 diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/octave-dock-widget.cc --- a/libgui/src/octave-dock-widget.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/octave-dock-widget.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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) { diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/octave-qobject.cc --- a/libgui/src/octave-qobject.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/octave-qobject.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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 base_qobject::community_news_widget (int serial) +QPointer +base_qobject::community_news_widget (int serial) { if (! m_community_news) m_community_news @@ -734,7 +742,8 @@ return m_community_news; } -QPointer base_qobject::release_notes_widget () +QPointer +base_qobject::release_notes_widget () { if (! m_release_notes) m_release_notes = QPointer (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 (); diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/qt-application.cc --- a/libgui/src/qt-application.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/qt-application.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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 (); diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/qt-interpreter-events.cc --- a/libgui/src/qt-interpreter-events.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/qt-interpreter-events.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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)); diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/release-notes.cc --- a/libgui/src/release-notes.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/release-notes.cc Tue Dec 12 23:14:33 2023 -0800 @@ -106,7 +106,8 @@ move (20, 20); // move to the top left corner } -void release_notes::display () +void +release_notes::display () { if (! isVisible ()) show (); diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/set-path-dialog.cc --- a/libgui/src/set-path-dialog.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/set-path-dialog.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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 (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 (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 (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 (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 (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 (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 (); diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/set-path-model.cc --- a/libgui/src/set-path-model.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/set-path-model.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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; diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/settings-dialog.cc --- a/libgui/src/settings-dialog.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/settings-dialog.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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 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 (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 (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 (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 (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 (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 (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 (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 (); diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/shortcuts-tree-widget.cc --- a/libgui/src/shortcuts-tree-widget.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/shortcuts-tree-widget.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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; diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/tab-bar.cc --- a/libgui/src/tab-bar.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/tab-bar.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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 diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/terminal-dock-widget.cc --- a/libgui/src/terminal-dock-widget.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/terminal-dock-widget.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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 (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 (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) diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/variable-editor.cc --- a/libgui/src/variable-editor.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/variable-editor.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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 = ""; diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/variable-editor.h --- a/libgui/src/variable-editor.h Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/variable-editor.h Tue Dec 12 23:14:33 2023 -0800 @@ -394,7 +394,7 @@ void construct_tool_bar (); - QList m_variables; + QList m_variables; QString m_current_focus_vname; diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/welcome-wizard.cc --- a/libgui/src/welcome-wizard.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/welcome-wizard.cc Tue Dec 12 23:14:33 2023 -0800 @@ -33,8 +33,8 @@ #include #if defined (OCTAVE_USE_WINDOWS_API) - #define WIN32_LEAN_AND_MEAN - #include +#define WIN32_LEAN_AND_MEAN +#include #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. diff -r a2be40ce8fec -r 60515d0cd023 libgui/src/workspace-view.cc --- a/libgui/src/workspace-view.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libgui/src/workspace-view.cc Tue Dec 12 23:14:33 2023 -0800 @@ -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) { diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/__ichol__.cc --- a/libinterp/corefcn/__ichol__.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/__ichol__.cc Tue Dec 12 23:14:33 2023 -0800 @@ -52,12 +52,14 @@ return a * b; } -double ichol_mult_real (double a, double b) +double +ichol_mult_real (double a, double b) { return a * b; } -bool ichol_checkpivot_complex (Complex pivot) +bool +ichol_checkpivot_complex (Complex pivot) { if (fabs (pivot.imag ()) > std::numeric_limits::epsilon()) error ("ichol: non-real pivot encountered. The matrix must be Hermitian."); @@ -67,7 +69,8 @@ return true; } -bool ichol_checkpivot_real (double pivot) +bool +ichol_checkpivot_real (double pivot) { if (pivot < 0) error ("ichol: negative pivot encountered"); @@ -77,7 +80,8 @@ template -void ichol_0 (octave_matrix_t& sm, const std::string michol = "off") +void +ichol_0 (octave_matrix_t& sm, const std::string michol = "off") { const octave_idx_type n = sm.cols (); octave_idx_type j1, jend, j2, jrow, jjrow, j, jw, i, k, jj, r; @@ -220,8 +224,9 @@ template -void ichol_t (const octave_matrix_t& sm, octave_matrix_t& L, const T *cols_norm, - const T droptol, const std::string michol = "off") +void +ichol_t (const octave_matrix_t& sm, octave_matrix_t& L, const T *cols_norm, + const T droptol, const std::string michol = "off") { const octave_idx_type n = sm.cols (); diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/__ilu__.cc --- a/libinterp/corefcn/__ilu__.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/__ilu__.cc Tue Dec 12 23:14:33 2023 -0800 @@ -183,10 +183,11 @@ } template -void ilu_crout (octave_matrix_t& sm_l, octave_matrix_t& sm_u, - octave_matrix_t& L, octave_matrix_t& U, T *cols_norm, - T *rows_norm, const T droptol = 0, - const std::string milu = "off") +void +ilu_crout (octave_matrix_t& sm_l, octave_matrix_t& sm_u, + octave_matrix_t& L, octave_matrix_t& U, T *cols_norm, + T *rows_norm, const T droptol = 0, + const std::string milu = "off") { // Map the strings into chars for faster comparing inside loops char opt; @@ -523,11 +524,12 @@ // case IKJ version is used and column pivoting is performed. template -void ilu_tp (octave_matrix_t& sm, octave_matrix_t& L, octave_matrix_t& U, - octave_idx_type nnz_u, octave_idx_type nnz_l, T *cols_norm, - Array & perm_vec, const T droptol = T(0), - const T thresh = T(0), const std::string milu = "off", - const double udiag = 0) +void +ilu_tp (octave_matrix_t& sm, octave_matrix_t& L, octave_matrix_t& U, + octave_idx_type nnz_u, octave_idx_type nnz_l, T *cols_norm, + Array & perm_vec, const T droptol = T(0), + const T thresh = T(0), const std::string milu = "off", + const double udiag = 0) { char opt; enum {OFF, ROW, COL}; diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/bsxfun.cc --- a/libinterp/corefcn/bsxfun.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/bsxfun.cc Tue Dec 12 23:14:33 2023 -0800 @@ -130,7 +130,8 @@ return octave_value (bsxfun_pow (xa, ya)); } -static void maybe_fill_table () +static void +maybe_fill_table () { static bool filled = false; if (filled) diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/call-stack.cc --- a/libinterp/corefcn/call-stack.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/call-stack.cc Tue Dec 12 23:14:33 2023 -0800 @@ -66,7 +66,8 @@ push (symbol_scope ("top scope")); } -octave_function *call_stack::current_function (bool skip_first) const +octave_function * +call_stack::current_function (bool skip_first) const { if (m_cs.empty ()) error ("current_function: call stack is empty"); @@ -91,7 +92,8 @@ return fcn; } -int call_stack::current_line () const +int +call_stack::current_line () const { int retval = -1; @@ -104,7 +106,8 @@ return retval; } -int call_stack::current_column () const +int +call_stack::current_column () const { int retval = -1; @@ -117,7 +120,8 @@ return retval; } -octave_user_code *call_stack::current_user_code () const +octave_user_code * +call_stack::current_user_code () const { // Start at current frame. @@ -136,7 +140,8 @@ return nullptr; } -int call_stack::current_user_code_line () const +int +call_stack::current_user_code_line () const { // Start at current frame. @@ -160,7 +165,8 @@ return -1; } -int call_stack::current_user_code_column () const +int +call_stack::current_user_code_column () const { // Start at current frame. @@ -184,7 +190,8 @@ return -1; } -unwind_protect *call_stack::curr_fcn_unwind_protect_frame () +unwind_protect * +call_stack::curr_fcn_unwind_protect_frame () { // Start at current frame. @@ -203,7 +210,8 @@ return nullptr; } -octave_user_code *call_stack::debug_user_code () const +octave_user_code * +call_stack::debug_user_code () const { octave_user_code *retval = nullptr; @@ -229,7 +237,8 @@ return retval; } -int call_stack::debug_user_code_line () const +int +call_stack::debug_user_code_line () const { int retval = -1; @@ -258,7 +267,8 @@ return retval; } -int call_stack::debug_user_code_column () const +int +call_stack::debug_user_code_column () const { int retval = -1; @@ -288,17 +298,20 @@ return retval; } -std::string call_stack::get_dispatch_class () const +std::string +call_stack::get_dispatch_class () const { return m_cs[m_curr_frame]->get_dispatch_class (); } -void call_stack::set_dispatch_class (const std::string& class_name) +void +call_stack::set_dispatch_class (const std::string& class_name) { m_cs[m_curr_frame]->set_dispatch_class (class_name); } -bool call_stack::is_class_method_executing (std::string& dispatch_class) const +bool +call_stack::is_class_method_executing (std::string& dispatch_class) const { dispatch_class = ""; @@ -312,7 +325,8 @@ return retval; } -bool call_stack::is_class_constructor_executing (std::string& dispatch_class) const +bool +call_stack::is_class_constructor_executing (std::string& dispatch_class) const { dispatch_class = ""; @@ -326,7 +340,8 @@ return retval; } -bool call_stack::all_scripts () const +bool +call_stack::all_scripts () const { bool retval = true; @@ -378,7 +393,8 @@ : parent_link); } -void call_stack::push (const symbol_scope& scope) +void +call_stack::push (const symbol_scope& scope) { std::size_t new_frame_idx; std::shared_ptr parent_link; @@ -395,8 +411,9 @@ m_curr_frame = new_frame_idx; } -void call_stack::push (octave_user_function *fcn, - const std::shared_ptr& closure_frames) +void +call_stack::push (octave_user_function *fcn, + const std::shared_ptr& closure_frames) { std::size_t new_frame_idx; std::shared_ptr parent_link; @@ -414,9 +431,10 @@ m_curr_frame = new_frame_idx; } -void call_stack::push (octave_user_function *fcn, - const stack_frame::local_vars_map& local_vars, - const std::shared_ptr& closure_frames) +void +call_stack::push (octave_user_function *fcn, + const stack_frame::local_vars_map& local_vars, + const std::shared_ptr& closure_frames) { std::size_t new_frame_idx; std::shared_ptr parent_link; @@ -434,7 +452,8 @@ m_curr_frame = new_frame_idx; } -void call_stack::push (octave_user_script *script) +void +call_stack::push (octave_user_script *script) { std::size_t new_frame_idx; std::shared_ptr parent_link; @@ -518,7 +537,8 @@ #endif -void call_stack::push (octave_function *fcn) +void +call_stack::push (octave_function *fcn) { std::size_t new_frame_idx; std::shared_ptr parent_link; @@ -535,7 +555,8 @@ m_curr_frame = new_frame_idx; } -bool call_stack::goto_frame (std::size_t n, bool verbose) +bool +call_stack::goto_frame (std::size_t n, bool verbose) { bool retval = false; @@ -556,7 +577,8 @@ return retval; } -std::size_t call_stack::find_current_user_frame () const +std::size_t +call_stack::find_current_user_frame () const { std::size_t user_frame = m_curr_frame; @@ -573,7 +595,8 @@ return user_frame; } -std::shared_ptr call_stack::current_user_frame () const +std::shared_ptr +call_stack::current_user_frame () const { std::size_t frame = find_current_user_frame (); @@ -584,7 +607,8 @@ // the call stack that corresponds to a script, function, or scope // beginning with the frame indexed by START. -std::size_t call_stack::dbupdown (std::size_t start, int n, bool verbose) +std::size_t +call_stack::dbupdown (std::size_t start, int n, bool verbose) { if (start >= m_cs.size ()) error ("invalid stack frame"); @@ -675,7 +699,8 @@ // function, script or scope frame then there is an error in the // implementation. -std::size_t call_stack::dbupdown (int n, bool verbose) +std::size_t +call_stack::dbupdown (int n, bool verbose) { std::size_t start = find_current_user_frame (); @@ -687,7 +712,8 @@ // value of m_curr_frame would be wiped out when dbup returns and the // stack frame for dbup is popped. -void call_stack::goto_caller_frame () +void +call_stack::goto_caller_frame () { std::size_t start = find_current_user_frame (); @@ -699,7 +725,8 @@ m_curr_frame = caller_frame ? caller_frame->index () : 0; } -void call_stack::goto_base_frame () +void +call_stack::goto_base_frame () { if (m_curr_frame > 0) m_curr_frame = 0; @@ -770,15 +797,17 @@ return retval; } -std::list call_stack::backtrace_info () const +std::list +call_stack::backtrace_info () const { octave_idx_type curr_user_frame = -1; return backtrace_info (curr_user_frame, true); } -octave_map call_stack::backtrace (octave_idx_type& curr_user_frame, - bool print_subfn) const +octave_map +call_stack::backtrace (octave_idx_type& curr_user_frame, + bool print_subfn) const { std::list> frames = backtrace_frames (curr_user_frame); @@ -811,19 +840,22 @@ return retval; } -octave_map call_stack::backtrace () const +octave_map +call_stack::backtrace () const { octave_idx_type curr_user_frame = -1; return backtrace (curr_user_frame, true); } -octave_map call_stack::empty_backtrace () const +octave_map +call_stack::empty_backtrace () const { return octave_map (dim_vector (0, 1), bt_fields); } -void call_stack::pop () +void +call_stack::pop () { // Never pop top scope. // FIXME: is it possible for this case to happen? @@ -845,7 +877,8 @@ } } -std::shared_ptr call_stack::pop_return () +std::shared_ptr +call_stack::pop_return () { if (!m_cs.empty ()) { @@ -865,18 +898,21 @@ return nullptr; } -void call_stack::clear () +void +call_stack::clear () { while (! m_cs.empty ()) pop (); } -symbol_info_list call_stack::all_variables () +symbol_info_list +call_stack::all_variables () { return m_cs[m_curr_frame]->all_variables (); } -std::list call_stack::global_variable_names () const +std::list +call_stack::global_variable_names () const { std::list retval; @@ -891,17 +927,20 @@ return retval; } -std::list call_stack::top_level_variable_names () const +std::list +call_stack::top_level_variable_names () const { return m_cs[0]->variable_names (); } -std::list call_stack::variable_names () const +std::list +call_stack::variable_names () const { return m_cs[m_curr_frame]->variable_names (); } -void call_stack::clear_global_variable (const std::string& name) +void +call_stack::clear_global_variable (const std::string& name) { auto p = m_global_values.find (name); @@ -909,7 +948,8 @@ p->second = octave_value (); } -void call_stack::clear_global_variable_pattern (const std::string& pattern) +void +call_stack::clear_global_variable_pattern (const std::string& pattern) { symbol_match pat (pattern); @@ -920,7 +960,8 @@ } } -void call_stack::clear_global_variable_regexp (const std::string& pattern) +void +call_stack::clear_global_variable_regexp (const std::string& pattern) { regexp pat (pattern); @@ -931,7 +972,8 @@ } } -void call_stack::clear_global_variables () +void +call_stack::clear_global_variables () { for (auto& nm_ov : m_global_values) nm_ov.second = octave_value (); @@ -949,58 +991,68 @@ return m_cs[m_curr_frame]->regexp_symbol_info (pattern); } -symbol_info_list call_stack::get_symbol_info () +symbol_info_list +call_stack::get_symbol_info () { return m_cs[m_curr_frame]->get_symbol_info (); } -symbol_info_list call_stack::top_scope_symbol_info () const +symbol_info_list +call_stack::top_scope_symbol_info () const { return m_cs[0]->get_symbol_info (); } -octave_value call_stack::max_stack_depth (const octave_value_list& args, - int nargout) +octave_value +call_stack::max_stack_depth (const octave_value_list& args, + int nargout) { return set_internal_variable (m_max_stack_depth, args, nargout, "max_stack_depth", 0); } -void call_stack::make_persistent (const symbol_record& sym) +void +call_stack::make_persistent (const symbol_record& sym) { m_cs[m_curr_frame]->make_persistent (sym); } -void call_stack::make_global (const symbol_record& sym) +void +call_stack::make_global (const symbol_record& sym) { m_cs[m_curr_frame]->make_global (sym); } -octave_value call_stack::global_varval (const std::string& name) const +octave_value +call_stack::global_varval (const std::string& name) const { auto p = m_global_values.find (name); return p == m_global_values.end () ? octave_value () : p->second; } -octave_value& call_stack::global_varref (const std::string& name) +octave_value& +call_stack::global_varref (const std::string& name) { return m_global_values[name]; } -octave_value call_stack::get_top_level_value (const std::string& name) const +octave_value +call_stack::get_top_level_value (const std::string& name) const { return m_cs[0]->varval (name); } -void call_stack::set_top_level_value (const std::string& name, - const octave_value& value) +void +call_stack::set_top_level_value (const std::string& name, + const octave_value& value) { m_cs[0]->assign (name, value); } -octave_value call_stack::do_who (int argc, const string_vector& argv, - bool return_list, bool verbose) +octave_value +call_stack::do_who (int argc, const string_vector& argv, + bool return_list, bool verbose) { octave_value retval; @@ -1098,19 +1150,21 @@ } } -octave_value call_stack::do_who_two (const string_vector& patterns, - bool have_regexp, bool return_list, - bool verbose, const std::string& msg) +octave_value +call_stack::do_who_two (const string_vector& patterns, + bool have_regexp, bool return_list, + bool verbose, const std::string& msg) { return m_cs[m_curr_frame]->who (patterns, have_regexp, return_list, verbose, m_evaluator.whos_line_format (), msg); } -octave_value call_stack::do_global_who_two (const string_vector& patterns, - bool have_regexp, - bool return_list, bool verbose, - const std::string& msg) +octave_value +call_stack::do_global_who_two (const string_vector& patterns, + bool have_regexp, + bool return_list, bool verbose, + const std::string& msg) { symbol_info_list symbol_stats; std::list symbol_names; @@ -1204,7 +1258,8 @@ return octave_value (); } -void call_stack::display () const +void +call_stack::display () const { std::ostream& os = octave_stdout; @@ -1218,8 +1273,9 @@ } } -void call_stack::set_auto_fcn_var (stack_frame::auto_var_type avt, - const octave_value& val) +void +call_stack::set_auto_fcn_var (stack_frame::auto_var_type avt, + const octave_value& val) { m_cs[m_curr_frame]->set_auto_fcn_var (avt, val); } @@ -1242,7 +1298,8 @@ m_cs[m_curr_frame]->set_active_bytecode_ip (ip); } -octave_value call_stack::get_auto_fcn_var (stack_frame::auto_var_type avt) const +octave_value +call_stack::get_auto_fcn_var (stack_frame::auto_var_type avt) const { return m_cs[m_curr_frame]->get_auto_fcn_var (avt); } diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/defaults.cc --- a/libinterp/corefcn/defaults.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/defaults.cc Tue Dec 12 23:14:33 2023 -0800 @@ -74,7 +74,8 @@ return retval; } -static std::string get_octave_home () +static std::string +get_octave_home () { std::string op = OCTAVE_PREFIX; @@ -86,7 +87,8 @@ return oh.empty () ? op : oh; } -static std::string get_octave_exec_home () +static std::string +get_octave_exec_home () { std::string op = OCTAVE_PREFIX; std::string oep = OCTAVE_EXEC_PREFIX; @@ -108,31 +110,36 @@ return oep; } -static std::string get_local_site_defaults_file () +static std::string +get_local_site_defaults_file () { std::string lsf = sys::env::getenv ("OCTAVE_SITE_INITFILE"); return lsf.empty () ? local_startupfile_dir () + "/octaverc" : lsf; } -static std::string get_site_defaults_file () +static std::string +get_site_defaults_file () { std::string sf = sys::env::getenv ("OCTAVE_VERSION_INITFILE"); return sf.empty () ? startupfile_dir () + "/octaverc" : sf; } -std::string prepend_octave_home (const std::string& s) +std::string +prepend_octave_home (const std::string& s) { return prepend_home_dir (octave_home (), s); } -std::string prepend_octave_exec_home (const std::string& s) +std::string +prepend_octave_exec_home (const std::string& s) { return prepend_home_dir (octave_exec_home (), s); } -std::string canonical_host_type () +std::string +canonical_host_type () { static const std::string s_canonical_host_type = OCTAVE_CANONICAL_HOST_TYPE; @@ -140,35 +147,40 @@ return s_canonical_host_type; } -std::string release () +std::string +release () { static const std::string s_octave_release = OCTAVE_RELEASE; return s_octave_release; } -std::string default_pager () +std::string +default_pager () { static const std::string s_default_pager = OCTAVE_DEFAULT_PAGER; return s_default_pager; } -std::string octave_home () +std::string +octave_home () { static const std::string s_octave_home = get_octave_home (); return s_octave_home; } -std::string octave_exec_home () +std::string +octave_exec_home () { static const std::string s_octave_exec_home = get_octave_exec_home (); return s_octave_exec_home; } -std::string bin_dir () +std::string +bin_dir () { static const std::string s_bin_dir = prepend_octave_exec_home (OCTAVE_BINDIR); @@ -176,7 +188,8 @@ return s_bin_dir; } -std::string data_dir () +std::string +data_dir () { static const std::string s_data_dir = prepend_octave_home (OCTAVE_DATADIR); @@ -184,7 +197,8 @@ return s_data_dir; } -std::string dataroot_dir () +std::string +dataroot_dir () { static const std::string s_dataroot_dir = prepend_octave_home (OCTAVE_DATAROOTDIR); @@ -192,7 +206,8 @@ return s_dataroot_dir; } -std::string include_dir () +std::string +include_dir () { static const std::string s_include_dir = prepend_octave_home (OCTAVE_INCLUDEDIR); @@ -200,7 +215,8 @@ return s_include_dir; } -std::string lib_dir () +std::string +lib_dir () { static const std::string s_lib_dir = prepend_octave_exec_home (OCTAVE_LIBDIR); @@ -208,7 +224,8 @@ return s_lib_dir; } -std::string libexec_dir () +std::string +libexec_dir () { static const std::string s_libexec_dir = prepend_octave_exec_home (OCTAVE_LIBEXECDIR); @@ -216,7 +233,8 @@ return s_libexec_dir; } -std::string arch_lib_dir () +std::string +arch_lib_dir () { static const std::string s_arch_lib_dir = prepend_octave_exec_home (OCTAVE_ARCHLIBDIR); @@ -224,7 +242,8 @@ return s_arch_lib_dir; } -std::string info_dir () +std::string +info_dir () { static const std::string s_info_dir = prepend_octave_exec_home (OCTAVE_INFODIR); @@ -232,7 +251,8 @@ return s_info_dir; } -std::string local_ver_arch_lib_dir () +std::string +local_ver_arch_lib_dir () { static const std::string s_local_ver_arch_lib_dir = prepend_octave_exec_home (OCTAVE_LOCALVERARCHLIBDIR); @@ -240,7 +260,8 @@ return s_local_ver_arch_lib_dir; } -std::string local_api_arch_lib_dir () +std::string +local_api_arch_lib_dir () { static const std::string s_local_api_arch_lib_dir = prepend_octave_exec_home (OCTAVE_LOCALAPIARCHLIBDIR); @@ -248,7 +269,8 @@ return s_local_api_arch_lib_dir; } -std::string local_arch_lib_dir () +std::string +local_arch_lib_dir () { static const std::string s_local_arch_lib_dir = prepend_octave_exec_home (OCTAVE_LOCALARCHLIBDIR); @@ -256,7 +278,8 @@ return s_local_arch_lib_dir; } -std::string local_ver_oct_file_dir () +std::string +local_ver_oct_file_dir () { static const std::string s_local_ver_oct_file_dir = prepend_octave_exec_home (OCTAVE_LOCALVEROCTFILEDIR); @@ -264,7 +287,8 @@ return s_local_ver_oct_file_dir; } -std::string local_api_oct_file_dir () +std::string +local_api_oct_file_dir () { static const std::string s_local_api_oct_file_dir = prepend_octave_exec_home (OCTAVE_LOCALAPIOCTFILEDIR); @@ -272,7 +296,8 @@ return s_local_api_oct_file_dir; } -std::string local_oct_file_dir () +std::string +local_oct_file_dir () { static const std::string s_local_oct_file_dir = prepend_octave_exec_home (OCTAVE_LOCALOCTFILEDIR); @@ -280,7 +305,8 @@ return s_local_oct_file_dir; } -std::string oct_file_dir () +std::string +oct_file_dir () { static const std::string s_oct_file_dir = prepend_octave_exec_home (OCTAVE_OCTFILEDIR); @@ -288,7 +314,8 @@ return s_oct_file_dir; } -std::string local_ver_fcn_file_dir () +std::string +local_ver_fcn_file_dir () { static const std::string s_local_ver_fcn_file_dir = prepend_octave_home (OCTAVE_LOCALVERFCNFILEDIR); @@ -296,7 +323,8 @@ return s_local_ver_fcn_file_dir; } -std::string local_api_fcn_file_dir () +std::string +local_api_fcn_file_dir () { static const std::string s_local_api_fcn_file_dir = prepend_octave_home (OCTAVE_LOCALAPIFCNFILEDIR); @@ -304,7 +332,8 @@ return s_local_api_fcn_file_dir; } -std::string local_fcn_file_dir () +std::string +local_fcn_file_dir () { static const std::string s_local_fcn_file_dir = prepend_octave_home (OCTAVE_LOCALFCNFILEDIR); @@ -312,7 +341,8 @@ return s_local_fcn_file_dir; } -std::string fcn_file_dir () +std::string +fcn_file_dir () { static const std::string s_fcn_file_dir = prepend_octave_home (OCTAVE_FCNFILEDIR); @@ -320,7 +350,8 @@ return s_fcn_file_dir; } -std::string oct_data_dir () +std::string +oct_data_dir () { static const std::string s_oct_data_dir = prepend_octave_home (OCTAVE_OCTDATADIR); @@ -328,7 +359,8 @@ return s_oct_data_dir; } -std::string oct_doc_dir () +std::string +oct_doc_dir () { static const std::string s_oct_doc_dir = prepend_octave_home (OCTAVE_OCTDOCDIR); @@ -336,7 +368,8 @@ return s_oct_doc_dir; } -std::string oct_etc_dir () +std::string +oct_etc_dir () { static const std::string s_oct_etc_dir = prepend_octave_home (OCTAVE_OCTETCDIR); @@ -344,7 +377,8 @@ return s_oct_etc_dir; } -std::string oct_fonts_dir () +std::string +oct_fonts_dir () { static const std::string s_oct_fonts_dir = prepend_octave_home (OCTAVE_OCTFONTSDIR); @@ -352,7 +386,8 @@ return s_oct_fonts_dir; } -std::string oct_include_dir () +std::string +oct_include_dir () { static const std::string s_oct_include_dir = prepend_octave_home (OCTAVE_OCTINCLUDEDIR); @@ -360,7 +395,8 @@ return s_oct_include_dir; } -std::string oct_lib_dir () +std::string +oct_lib_dir () { static const std::string s_oct_lib_dir = prepend_octave_exec_home (OCTAVE_OCTLIBDIR); @@ -368,7 +404,8 @@ return s_oct_lib_dir; } -std::string oct_locale_dir () +std::string +oct_locale_dir () { static const std::string s_oct_locale_dir = prepend_octave_home (OCTAVE_OCTLOCALEDIR); @@ -376,7 +413,8 @@ return s_oct_locale_dir; } -std::string oct_tests_dir () +std::string +oct_tests_dir () { static const std::string s_oct_tests_dir = prepend_octave_home (OCTAVE_OCTTESTSDIR); @@ -384,7 +422,8 @@ return s_oct_tests_dir; } -std::string man_dir () +std::string +man_dir () { static const std::string s_man_dir = prepend_octave_home (OCTAVE_MANDIR); @@ -392,7 +431,8 @@ return s_man_dir; } -std::string man1_dir () +std::string +man1_dir () { static const std::string s_man1_dir = prepend_octave_home (OCTAVE_MAN1DIR); @@ -400,14 +440,16 @@ return s_man1_dir; } -std::string man1_ext () +std::string +man1_ext () { static const std::string s_man1_ext = OCTAVE_MAN1EXT; return s_man1_ext; } -std::string image_dir () +std::string +image_dir () { static const std::string s_image_dir = prepend_octave_home (OCTAVE_IMAGEDIR); @@ -415,7 +457,8 @@ return s_image_dir; } -std::string local_startupfile_dir () +std::string +local_startupfile_dir () { static const std::string s_local_startupfile_dir = prepend_octave_home (OCTAVE_LOCALSTARTUPFILEDIR); @@ -423,7 +466,8 @@ return s_local_startupfile_dir; } -std::string startupfile_dir () +std::string +startupfile_dir () { static const std::string s_startupfile_dir = prepend_octave_home (OCTAVE_STARTUPFILEDIR); @@ -431,7 +475,8 @@ return s_startupfile_dir; } -std::string local_site_defaults_file () +std::string +local_site_defaults_file () { static const std::string s_local_site_defaults_file = get_local_site_defaults_file (); @@ -439,7 +484,8 @@ return s_local_site_defaults_file; } -std::string site_defaults_file () +std::string +site_defaults_file () { static const std::string s_site_defaults_file = get_site_defaults_file (); diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/environment.cc --- a/libinterp/corefcn/environment.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/environment.cc Tue Dec 12 23:14:33 2023 -0800 @@ -88,7 +88,8 @@ return retval; } -std::string environment::exec_path (const std::string& path) +std::string +environment::exec_path (const std::string& path) { std::string old_val = set (m_exec_path, path); @@ -104,7 +105,8 @@ false); } -std::string environment::init_editor () +std::string +environment::init_editor () { std::string retval = "emacs"; @@ -116,7 +118,8 @@ return retval; } -std::string environment::init_exec_path () +std::string +environment::init_exec_path () { std::string exec_path = sys::env::getenv ("OCTAVE_EXEC_PATH"); @@ -134,7 +137,8 @@ return exec_path; } -std::string environment::init_image_path () +std::string +environment::init_image_path () { std::string image_path = "."; diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/error.cc --- a/libinterp/corefcn/error.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/error.cc Tue Dec 12 23:14:33 2023 -0800 @@ -420,7 +420,8 @@ // enabled, and 2 if the given ID should be an error instead of a // warning. -int error_system::warning_enabled (const std::string& id) +int +error_system::warning_enabled (const std::string& id) { int retval = 0; @@ -492,7 +493,8 @@ return retval; } -void error_system::vusage (const char *id, const char *fmt, va_list args) +void +error_system::vusage (const char *id, const char *fmt, va_list args) { std::string str_id = id ? id : ""; std::string message = format_message (fmt, args); @@ -500,8 +502,9 @@ throw_error ("usage", str_id, message); } -void error_system::vwarning (const char *name, const char *id, - const char *fmt, va_list args) +void +error_system::vwarning (const char *name, const char *id, + const char *fmt, va_list args) { flush_stdout (); @@ -561,8 +564,9 @@ } } -void error_system::error_1 (execution_exception& ee, const char *id, - const char *fmt, va_list args) +void +error_system::error_1 (execution_exception& ee, const char *id, + const char *fmt, va_list args) { ee.set_identifier (id); ee.set_message (format_message (fmt, args)); @@ -570,8 +574,9 @@ throw_error (ee); } -void error_system::error_1 (const char *id, const char *fmt, - va_list args) +void +error_system::error_1 (const char *id, const char *fmt, + va_list args) { std::string message = format_message (fmt, args); @@ -580,7 +585,8 @@ throw_error ("error", id, message); } -void error_system::vwarning (const char *id, const char *fmt, va_list args) +void +error_system::vwarning (const char *id, const char *fmt, va_list args) { int warn_opt = warning_enabled (id); @@ -594,9 +600,10 @@ vwarning ("warning", id, fmt, args); } -void error_system::rethrow_error (const std::string& id, - const std::string& msg, - const octave_map& stack) +void +error_system::rethrow_error (const std::string& id, + const std::string& msg, + const octave_map& stack) { std::list stack_info; @@ -623,7 +630,8 @@ throw_error (ee); } -void error_system::vpanic (const char *fmt, va_list args) +void +error_system::vpanic (const char *fmt, va_list args) { // Is there any point in trying to write the panic message to the // diary? @@ -633,7 +641,8 @@ abort (); } -void error_system::panic (const char *fmt, ...) +void +error_system::panic (const char *fmt, ...) { va_list args; va_start (args, fmt); @@ -641,7 +650,8 @@ va_end (args); } -octave_scalar_map error_system::warning_query (const std::string& id_arg) +octave_scalar_map +error_system::warning_query (const std::string& id_arg) { octave_scalar_map retval; @@ -697,7 +707,8 @@ return retval; } -std::string error_system::default_warning_state () +std::string +error_system::default_warning_state () { std::string retval = "on"; @@ -720,7 +731,8 @@ return retval; } -void error_system::display_warning_options (std::ostream& os) +void +error_system::display_warning_options (std::ostream& os) { octave_map opts = warning_options (); @@ -760,8 +772,9 @@ os << std::endl; } -void error_system::set_warning_option (const std::string& state, - const std::string& ident) +void +error_system::set_warning_option (const std::string& state, + const std::string& ident) { std::string all_state = default_warning_state (); @@ -824,12 +837,14 @@ warning_options (opts); } -void error_system::disable_warning (const std::string& id) +void +error_system::disable_warning (const std::string& id) { set_warning_option ("off", id); } -void error_system::initialize_default_warning_state () +void +error_system::initialize_default_warning_state () { warning_options (init_warning_options ("on")); @@ -849,7 +864,8 @@ disable_warning ("Octave:variable-switch-label"); } -void error_system::interpreter_try (unwind_protect& frame) +void +error_system::interpreter_try (unwind_protect& frame) { frame.protect_var (m_debug_on_error); m_debug_on_error = false; @@ -861,10 +877,11 @@ // caught. } -void error_system::throw_error (const std::string& err_type, - const std::string& id, - const std::string& message, - const std::list& stack_info_arg) +void +error_system::throw_error (const std::string& err_type, + const std::string& id, + const std::string& message, + const std::list& stack_info_arg) { std::list stack_info = stack_info_arg; @@ -885,12 +902,14 @@ throw_error (ex); } -void error_system::throw_error (execution_exception& ex) +void +error_system::throw_error (execution_exception& ex) { throw ex; } -void error_system::save_exception (const execution_exception& ee) +void +error_system::save_exception (const execution_exception& ee) { last_error_id (ee.identifier ()); std::string message = ee.message (); @@ -901,7 +920,8 @@ last_error_stack (make_stack_map (ee.stack_info ())); } -void error_system::display_exception (const execution_exception& ee) const +void +error_system::display_exception (const execution_exception& ee) const { // FIXME: How should we handle beep_on_error? diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/event-manager.cc --- a/libinterp/corefcn/event-manager.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/event-manager.cc Tue Dec 12 23:14:33 2023 -0800 @@ -55,8 +55,9 @@ return 0; } -void interpreter_events::display_exception (const execution_exception& ee, - bool beep) +void +interpreter_events::display_exception (const execution_exception& ee, + bool beep) { if (beep) std::cerr << "\a"; @@ -94,7 +95,8 @@ m_instance = obj; } -bool event_manager::enable () +bool +event_manager::enable () { bool retval = m_link_enabled; @@ -106,7 +108,8 @@ return retval; } -void event_manager::process_events (bool disable_flag) +void +event_manager::process_events (bool disable_flag) { if (enabled ()) { @@ -121,7 +124,8 @@ } } -void event_manager::discard_events () +void +event_manager::discard_events () { if (enabled ()) { @@ -133,13 +137,15 @@ } } -void event_manager::push_event_queue () +void +event_manager::push_event_queue () { std::shared_ptr evq (new event_queue ()); m_gui_event_queue.push (evq); } -void event_manager::pop_event_queue () +void +event_manager::pop_event_queue () { // FIXME: Should we worry about the possibility of events remaining // in the queue when we pop back to the previous queue? If so, then @@ -154,7 +160,8 @@ m_gui_event_queue.pop (); } -void event_manager::post_event (const fcn_callback& fcn) +void +event_manager::post_event (const fcn_callback& fcn) { if (enabled ()) { @@ -163,7 +170,8 @@ } } -void event_manager::post_event (const meth_callback& meth) +void +event_manager::post_event (const meth_callback& meth) { if (enabled ()) { @@ -172,7 +180,8 @@ } } -void event_manager::set_workspace () +void +event_manager::set_workspace () { if (enabled ()) { @@ -183,7 +192,8 @@ } } -void event_manager::set_history () +void +event_manager::set_history () { if (enabled ()) m_instance->set_history (command_history::list ()); diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/ft-text-renderer.cc --- a/libinterp/corefcn/ft-text-renderer.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/ft-text-renderer.cc Tue Dec 12 23:14:33 2023 -0800 @@ -812,7 +812,8 @@ } } -bool is_opaque (const FT_GlyphSlot& glyph, const int x, const int y) +bool +is_opaque (const FT_GlyphSlot& glyph, const int x, const int y) { // Borrowed from https://stackoverflow.com/questions/14800827/ // indexing-pixels-in-a-monochrome-freetype-glyph-buffer diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/gl-render.cc --- a/libinterp/corefcn/gl-render.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/gl-render.cc Tue Dec 12 23:14:33 2023 -0800 @@ -4167,7 +4167,8 @@ #endif } -void opengl_renderer::draw (const Matrix& hlist, bool toplevel) +void +opengl_renderer::draw (const Matrix& hlist, bool toplevel) { int len = hlist.numel (); @@ -4768,7 +4769,7 @@ m_glfcns.glBegin (GL_POLYGON); for (double ang = 0; ang < 2*M_PI; ang += ang_step) - m_glfcns.glVertex2d (sz/6* cos (ang), sz/6*sin (ang)); + m_glfcns.glVertex2d (sz/6*cos (ang), sz/6*sin (ang)); m_glfcns.glEnd (); } break; @@ -4790,7 +4791,7 @@ m_glfcns.glBegin (filled ? GL_POLYGON : GL_LINE_LOOP); for (double ang = 0; ang < 2*M_PI; ang += ang_step) - m_glfcns.glVertex2d (sz/2* cos (ang), sz/2*sin (ang)); + m_glfcns.glVertex2d (sz/2*cos (ang), sz/2*sin (ang)); m_glfcns.glEnd (); } break; @@ -4840,7 +4841,7 @@ { ang = (-0.5 + double (i+1) / 5) * M_PI; r = 1.0 - (dr * fmod (double (i+1), 2.0)); - m_glfcns.glVertex2d (sz/2*r* cos (ang), sz/2*r*sin (ang)); + m_glfcns.glVertex2d (sz/2*r*cos (ang), sz/2*r*sin (ang)); } m_glfcns.glEnd (); } @@ -4855,7 +4856,7 @@ { ang = (0.5 + double (i+1) / 6.0) * M_PI; r = 1.0 - (dr * fmod (double (i+1), 2.0)); - m_glfcns.glVertex2d (sz/2*r* cos (ang), sz/2*r*sin (ang)); + m_glfcns.glVertex2d (sz/2*r*cos (ang), sz/2*r*sin (ang)); } m_glfcns.glEnd (); } diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/graphics-utils.cc --- a/libinterp/corefcn/graphics-utils.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/graphics-utils.cc Tue Dec 12 23:14:33 2023 -0800 @@ -75,7 +75,8 @@ return go.get (pname); } -bool isfigure (double val) +bool +isfigure (double val) { gh_manager& gh_mgr = octave::__get_gh_manager__ (); diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/graphics.cc --- a/libinterp/corefcn/graphics.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/graphics.cc Tue Dec 12 23:14:33 2023 -0800 @@ -8611,8 +8611,8 @@ m_properties.update_transform (); } -inline -double force_in_range (double x, double lower, double upper) +inline double +force_in_range (double x, double lower, double upper) { if (x < lower) return lower; @@ -9503,7 +9503,8 @@ } // core coplanar tester -bool is_coplanar (const Matrix& cov) +bool +is_coplanar (const Matrix& cov) { // Accuracy note: this test will also accept single precision input (although // stored in double precision). This is because the error threshold is diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/graphics.in.h --- a/libinterp/corefcn/graphics.in.h Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/graphics.in.h Tue Dec 12 23:14:33 2023 -0800 @@ -2366,7 +2366,7 @@ OCTINTERP_API void get_children_of_type (const caseless_str& type, bool get_invisible, bool traverse, - std::list &children_list) const; + std::list& children_list) const; void set_modified (const octave_value& val) { set___modified__ (val); } @@ -3498,10 +3498,10 @@ for (int i = 0; i < r; i++) { - retval(i,0) = m_sx.scale (m(i,0)); - retval(i,1) = m_sy.scale (m(i,1)); + retval(i, 0) = m_sx.scale (m(i, 0)); + retval(i, 1) = m_sy.scale (m(i, 1)); if (has_z) - retval(i,2) = m_sz.scale (m(i,2)); + retval(i, 2) = m_sz.scale (m(i, 2)); } return retval; diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/help.cc --- a/libinterp/corefcn/help.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/help.cc Tue Dec 12 23:14:33 2023 -0800 @@ -232,8 +232,9 @@ return h; } -std::string help_system::which (const std::string& name, - std::string& type) const +std::string +help_system::which (const std::string& name, + std::string& type) const { std::string file; @@ -313,14 +314,16 @@ return file; } -std::string help_system::which (const std::string& name) const +std::string +help_system::which (const std::string& name) const { std::string type; return which (name, type); } -string_vector help_system::make_name_list () const +string_vector +help_system::make_name_list () const { const static string_vector keywords = Fiskeyword ()(0).string_vector_value (); @@ -383,8 +386,9 @@ return list; } -void help_system::get_help_text (const std::string& name, std::string& text, - std::string& format) const +void +help_system::get_help_text (const std::string& name, std::string& text, + std::string& format) const { bool symbol_found = false; text = raw_help (name, symbol_found); @@ -413,9 +417,10 @@ } } -void help_system::get_help_text_from_file (const std::string& fname, - std::string& text, - std::string& format) const +void +help_system::get_help_text_from_file (const std::string& fname, + std::string& text, + std::string& format) const { bool symbol_found = false; @@ -447,7 +452,8 @@ } } -std::string help_system::init_built_in_docstrings_file () +std::string +help_system::init_built_in_docstrings_file () { std::string df = sys::env::getenv ("OCTAVE_BUILT_IN_DOCSTRINGS_FILE"); @@ -459,7 +465,8 @@ return df; } -std::string help_system::init_doc_cache_file () +std::string +help_system::init_doc_cache_file () { std::string def_file = config::prepend_octave_home (OCTAVE_DOC_CACHE_FILE); @@ -468,7 +475,8 @@ return (env_file.empty () ? def_file : env_file); } -std::string help_system::init_info_file () +std::string +help_system::init_info_file () { std::string std_info_file = config::prepend_octave_home (OCTAVE_INFOFILE); @@ -477,7 +485,8 @@ return (oct_info_file.empty () ? std_info_file : oct_info_file); } -std::string help_system::init_info_program () +std::string +help_system::init_info_program () { std::string info_prog = sys::env::getenv ("OCTAVE_INFO_PROGRAM"); @@ -487,7 +496,8 @@ return info_prog; } -std::string help_system::init_texi_macros_file () +std::string +help_system::init_texi_macros_file () { std::string def_file = config::prepend_octave_home (OCTAVE_TEXI_MACROS_FILE); @@ -499,7 +509,8 @@ // Return a vector of all functions from this file, // for use in command line auto-completion. -string_vector help_system::local_functions () const +string_vector +help_system::local_functions () const { string_vector retval; @@ -534,7 +545,8 @@ return retval; } -bool help_system::raw_help_from_symbol_table (const std::string& nm, +bool +help_system::raw_help_from_symbol_table (const std::string& nm, std::string& h, std::string& w, bool& symbol_found) const { @@ -581,9 +593,10 @@ return false; } -bool help_system::raw_help_from_file (const std::string& nm, - std::string& h, std::string& file, - bool& symbol_found) const +bool +help_system::raw_help_from_file (const std::string& nm, + std::string& h, std::string& file, + bool& symbol_found) const { bool retval = false; @@ -725,7 +738,8 @@ // FIXME: It's not likely that this does the right thing now. -string_vector make_name_list () +string_vector +make_name_list () { help_system& help_sys = __get_help_system__ (); diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/hook-fcn.cc --- a/libinterp/corefcn/hook-fcn.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/hook-fcn.cc Tue Dec 12 23:14:33 2023 -0800 @@ -49,7 +49,8 @@ error ("invalid hook function"); } -void named_hook_function::eval (const octave_value_list& initial_args) +void +named_hook_function::eval (const octave_value_list& initial_args) { octave_value_list args = initial_args; @@ -61,7 +62,8 @@ interp.feval (m_name, args, 0); } -void fcn_handle_hook_function::eval (const octave_value_list& initial_args) +void +fcn_handle_hook_function::eval (const octave_value_list& initial_args) { octave_value_list args = initial_args; diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/input.cc --- a/libinterp/corefcn/input.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/input.cc Tue Dec 12 23:14:33 2023 -0800 @@ -385,7 +385,8 @@ return retval; } -static int internal_input_event_hook_fcn () +static int +internal_input_event_hook_fcn () { octave_quit (); @@ -408,7 +409,8 @@ m_initialized (false) { } -void input_system::initialize (bool line_editing) +void +input_system::initialize (bool line_editing) { if (m_initialized) return; @@ -534,7 +536,8 @@ } // Get part of the directory that would be added to the load path -static std::string load_path_dir (const std::string& dir) +static std::string +load_path_dir (const std::string& dir) { std::string lp_dir = dir; @@ -569,7 +572,8 @@ return lp_dir; } -std::string input_system::dir_encoding (const std::string& dir) +std::string +input_system::dir_encoding (const std::string& dir) { std::string enc = m_mfile_encoding; // use canonicalized path as key @@ -582,8 +586,9 @@ return enc; } -void input_system::set_dir_encoding (const std::string& dir, - std::string& enc) +void +input_system::set_dir_encoding (const std::string& dir, + std::string& enc) { // use lower case std::transform (enc.begin (), enc.end (), enc.begin (), ::tolower); @@ -629,7 +634,8 @@ "auto_repeat_debug_command"); } -bool input_system::yes_or_no (const std::string& prompt) +bool +input_system::yes_or_no (const std::string& prompt) { std::string prompt_string = prompt + "(yes or no) "; @@ -648,7 +654,8 @@ } } -std::string input_system::interactive_input (const std::string& s, bool& eof) +std::string +input_system::interactive_input (const std::string& s, bool& eof) { Vlast_prompt_time.stamp (); @@ -745,17 +752,20 @@ return retval; } -bool input_system::have_input_event_hooks () const +bool +input_system::have_input_event_hooks () const { return ! m_input_event_hook_functions.empty (); } -void input_system::add_input_event_hook (const hook_function& hook_fcn) +void +input_system::add_input_event_hook (const hook_function& hook_fcn) { m_input_event_hook_functions.insert (hook_fcn.id (), hook_fcn); } -bool input_system::remove_input_event_hook (const std::string& hook_fcn_id) +bool +input_system::remove_input_event_hook (const std::string& hook_fcn_id) { hook_function_list::iterator p = m_input_event_hook_functions.find (hook_fcn_id); @@ -767,12 +777,14 @@ return true; } -void input_system::clear_input_event_hooks () +void +input_system::clear_input_event_hooks () { m_input_event_hook_functions.clear (); } -void input_system::run_input_event_hooks () +void +input_system::run_input_event_hooks () { m_input_event_hook_functions.run (); } @@ -792,7 +804,8 @@ return retval; } -std::string base_reader::octave_gets (const std::string& prompt, bool& eof) +std::string +base_reader::octave_gets (const std::string& prompt, bool& eof) { octave_quit (); diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/interpreter-private.cc --- a/libinterp/corefcn/interpreter-private.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/interpreter-private.cc Tue Dec 12 23:14:33 2023 -0800 @@ -64,91 +64,104 @@ return *interp; } -dynamic_loader& __get_dynamic_loader__ () +dynamic_loader& +__get_dynamic_loader__ () { interpreter& interp = __get_interpreter__ (); return interp.get_dynamic_loader (); } -error_system& __get_error_system__ () +error_system& +__get_error_system__ () { interpreter& interp = __get_interpreter__ (); return interp.get_error_system (); } -gh_manager& __get_gh_manager__ () +gh_manager& +__get_gh_manager__ () { interpreter& interp = __get_interpreter__ (); return interp.get_gh_manager (); } -help_system& __get_help_system__ () +help_system& +__get_help_system__ () { interpreter& interp = __get_interpreter__ (); return interp.get_help_system (); } -input_system& __get_input_system__ () +input_system& +__get_input_system__ () { interpreter& interp = __get_interpreter__ (); return interp.get_input_system (); } -output_system& __get_output_system__ () +output_system& +__get_output_system__ () { interpreter& interp = __get_interpreter__ (); return interp.get_output_system (); } -load_path& __get_load_path__ () +load_path& +__get_load_path__ () { interpreter& interp = __get_interpreter__ (); return interp.get_load_path (); } -load_save_system& __get_load_save_system__ () +load_save_system& +__get_load_save_system__ () { interpreter& interp = __get_interpreter__ (); return interp.get_load_save_system (); } -event_manager& __get_event_manager__ () +event_manager& +__get_event_manager__ () { interpreter& interp = __get_interpreter__ (); return interp.get_event_manager (); } -type_info& __get_type_info__ () +type_info& +__get_type_info__ () { interpreter& interp = __get_interpreter__ (); return interp.get_type_info (); } -symbol_table& __get_symbol_table__ () +symbol_table& +__get_symbol_table__ () { interpreter& interp = __get_interpreter__ (); return interp.get_symbol_table (); } -symbol_scope __get_current_scope__ () +symbol_scope +__get_current_scope__ () { interpreter& interp = __get_interpreter__ (); return interp.get_current_scope (); } -symbol_scope __require_current_scope__ () +symbol_scope +__require_current_scope__ () { symbol_scope scope = __get_current_scope__ (); @@ -158,42 +171,48 @@ return scope; } -tree_evaluator& __get_evaluator__ () +tree_evaluator& +__get_evaluator__ () { interpreter& interp = __get_interpreter__ (); return interp.get_evaluator (); } -bp_table& __get_bp_table__ () +bp_table& +__get_bp_table__ () { tree_evaluator& tw = __get_evaluator__ (); return tw.get_bp_table (); } -child_list& __get_child_list__ () +child_list& +__get_child_list__ () { interpreter& interp = __get_interpreter__ (); return interp.get_child_list (); } -cdef_manager& __get_cdef_manager__ () +cdef_manager& +__get_cdef_manager__ () { interpreter& interp = __get_interpreter__ (); return interp.get_cdef_manager (); } -display_info& __get_display_info__ () +display_info& +__get_display_info__ () { interpreter& interp = __get_interpreter__ (); return interp.get_display_info (); } -gtk_manager& __get_gtk_manager__ () +gtk_manager& +__get_gtk_manager__ () { interpreter& interp = __get_interpreter__ (); diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/interpreter.cc --- a/libinterp/corefcn/interpreter.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/interpreter.cc Tue Dec 12 23:14:33 2023 -0800 @@ -322,12 +322,14 @@ cleanup (); } -void temporary_file_list::insert (const std::string& file) +void +temporary_file_list::insert (const std::string& file) { m_files.insert (file); } -void temporary_file_list::cleanup () +void +temporary_file_list::cleanup () { while (! m_files.empty ()) { @@ -342,7 +344,8 @@ // The time we last time we changed directories. sys::time Vlast_chdir_time = 0.0; -static void initialize_version_info () +static void +initialize_version_info () { octave_value_list args (4); @@ -354,12 +357,14 @@ F__version_info__ (args); } -static void xerbla_abort () +static void +xerbla_abort () { error ("Fortran procedure terminated by call to XERBLA"); } -static void initialize_xerbla_error_handler () +static void +initialize_xerbla_error_handler () { // The idea here is to force xerbla to be referenced so that we will // link to our own version instead of the one provided by the BLAS @@ -410,7 +415,8 @@ throw execution_exception (); } -static void initialize_error_handlers () +static void +initialize_error_handlers () { set_liboctave_error_handler (lo_error_handler); set_liboctave_error_with_id_handler (lo_error_with_id_handler); @@ -636,14 +642,16 @@ delete m_gh_manager; } -void interpreter::intern_nargin (octave_idx_type nargs) +void +interpreter::intern_nargin (octave_idx_type nargs) { m_evaluator.set_auto_fcn_var (stack_frame::NARGIN, nargs); } // Read the history file unless a command-line option inhibits that. -void interpreter::initialize_history (bool read_history_file) +void +interpreter::initialize_history (bool read_history_file) { if (! m_history_initialized) { @@ -671,7 +679,8 @@ // Set the initial path to the system default unless command-line // option says to leave it empty. -void interpreter::initialize_load_path (bool set_initial_path) +void +interpreter::initialize_load_path (bool set_initial_path) { if (! m_load_path_initialized) { @@ -707,7 +716,8 @@ // This may be called separately from execute -void interpreter::initialize () +void +interpreter::initialize () { if (m_initialized) return; @@ -760,7 +770,8 @@ // Note: this function is currently only used with the new // experimental terminal widget. -void interpreter::get_line_and_eval () +void +interpreter::get_line_and_eval () { m_evaluator.get_line_and_eval (); } @@ -798,8 +809,9 @@ std::thread m_thread; }; -void interpreter::parse_and_execute (const std::string& input, - bool& incomplete_parse) +void +interpreter::parse_and_execute (const std::string& input, + bool& incomplete_parse) { m_evaluator.parse_and_execute (input, incomplete_parse); } @@ -807,7 +819,8 @@ // FIXME: this function is intended to be executed only once. Should // we enforce that restriction? -int interpreter::execute () +int +interpreter::execute () { int exit_status = 0; @@ -934,7 +947,8 @@ } \ while (0) -void interpreter::shutdown () +void +interpreter::shutdown () { // Attempt to prevent more than one call to shutdown. @@ -1044,7 +1058,8 @@ // OCTAVE_SAFE_CALL (singleton_cleanup_list::cleanup, ()); } -void interpreter::execute_atexit_fcns () +void +interpreter::execute_atexit_fcns () { // Prevent atexit functions from adding new functions to the list. m_executing_atexit = true; @@ -1061,7 +1076,8 @@ } } -void interpreter::display_startup_message () const +void +interpreter::display_startup_message () const { bool inhibit_startup_message = false; @@ -1080,7 +1096,8 @@ // occurs when reading any of them, but don't exit early because of an // exception. -int interpreter::execute_startup_files () +int +interpreter::execute_startup_files () { bool read_site_files = m_read_site_files; bool read_init_files = m_read_init_files; @@ -1228,7 +1245,8 @@ // Execute any code specified with --eval 'CODE' -int interpreter::execute_eval_option_code () +int +interpreter::execute_eval_option_code () { if (! m_app_context) return 0; @@ -1261,7 +1279,8 @@ return parse_status; } -int interpreter::execute_command_line_file () +int +interpreter::execute_command_line_file () { if (! m_app_context) return 0; @@ -1310,29 +1329,34 @@ return safe_source_file (fname, context, verbose, require_file); } -int interpreter::main_loop () +int +interpreter::main_loop () { command_editor::add_event_hook (release_unreferenced_dynamic_libraries); return m_evaluator.repl (); } -int interpreter::server_loop () +int +interpreter::server_loop () { return m_evaluator.server_loop (); } -tree_evaluator& interpreter::get_evaluator () +tree_evaluator& +interpreter::get_evaluator () { return m_evaluator; } -stream_list& interpreter::get_stream_list () +stream_list& +interpreter::get_stream_list () { return m_stream_list; } -url_handle_manager& interpreter::get_url_handle_manager () +url_handle_manager& +interpreter::get_url_handle_manager () { return m_url_handle_manager; } @@ -1360,12 +1384,14 @@ return scope; } -profiler& interpreter::get_profiler () +profiler& +interpreter::get_profiler () { return m_evaluator.get_profiler (); } -int interpreter::chdir (const std::string& dir) +int +interpreter::chdir (const std::string& dir) { std::string xdir = sys::file_ops::tilde_expand (dir); @@ -1387,22 +1413,26 @@ return cd_ok; } -void interpreter::mlock (bool skip_first) const +void +interpreter::mlock (bool skip_first) const { m_evaluator.mlock (skip_first); } -void interpreter::munlock (bool skip_first) const +void +interpreter::munlock (bool skip_first) const { m_evaluator.munlock (skip_first); } -bool interpreter::mislocked (bool skip_first) const +bool +interpreter::mislocked (bool skip_first) const { return m_evaluator.mislocked (skip_first); } -void interpreter::munlock (const char *nm) +void +interpreter::munlock (const char *nm) { if (! nm) error ("munlock: invalid value for NAME"); @@ -1410,7 +1440,8 @@ munlock (std::string (nm)); } -void interpreter::munlock (const std::string& nm) +void +interpreter::munlock (const std::string& nm) { octave_value val = m_symbol_table.find_function (nm); @@ -1423,7 +1454,8 @@ } } -bool interpreter::mislocked (const char *nm) +bool +interpreter::mislocked (const char *nm) { if (! nm) error ("mislocked: invalid value for NAME"); @@ -1431,7 +1463,8 @@ return mislocked (std::string (nm)); } -bool interpreter::mislocked (const std::string& nm) +bool +interpreter::mislocked (const std::string& nm) { bool retval = false; @@ -1448,55 +1481,63 @@ return retval; } -std::string interpreter::mfilename (const std::string& opt) const +std::string +interpreter::mfilename (const std::string& opt) const { return m_evaluator.mfilename (opt); } -octave_value_list interpreter::eval_string (const std::string& eval_str, - bool silent, int& parse_status, - int nargout) +octave_value_list +interpreter::eval_string (const std::string& eval_str, + bool silent, int& parse_status, + int nargout) { return m_evaluator.eval_string (eval_str, silent, parse_status, nargout); } -octave_value interpreter::eval_string (const std::string& eval_str, - bool silent, int& parse_status) +octave_value +interpreter::eval_string (const std::string& eval_str, + bool silent, int& parse_status) { return m_evaluator.eval_string (eval_str, silent, parse_status); } -octave_value_list interpreter::eval_string (const octave_value& arg, - bool silent, int& parse_status, - int nargout) +octave_value_list +interpreter::eval_string (const octave_value& arg, + bool silent, int& parse_status, + int nargout) { return m_evaluator.eval_string (arg, silent, parse_status, nargout); } -octave_value_list interpreter::eval (const std::string& try_code, - int nargout) +octave_value_list +interpreter::eval (const std::string& try_code, + int nargout) { return m_evaluator.eval (try_code, nargout); } -octave_value_list interpreter::eval (const std::string& try_code, - const std::string& catch_code, - int nargout) +octave_value_list +interpreter::eval (const std::string& try_code, + const std::string& catch_code, + int nargout) { return m_evaluator.eval (try_code, catch_code, nargout); } -octave_value_list interpreter::evalin (const std::string& context, - const std::string& try_code, - int nargout) +octave_value_list +interpreter::evalin (const std::string& context, + const std::string& try_code, + int nargout) { return m_evaluator.evalin (context, try_code, nargout); } -octave_value_list interpreter::evalin (const std::string& context, - const std::string& try_code, - const std::string& catch_code, - int nargout) +octave_value_list +interpreter::evalin (const std::string& context, + const std::string& try_code, + const std::string& catch_code, + int nargout) { return m_evaluator.evalin (context, try_code, catch_code, nargout); } @@ -1510,16 +1551,18 @@ //! @return A list of output values. The length of the list is not //! necessarily the same as @c nargout. -octave_value_list interpreter::feval (const char *name, - const octave_value_list& args, - int nargout) +octave_value_list +interpreter::feval (const char *name, + const octave_value_list& args, + int nargout) { return feval (std::string (name), args, nargout); } -octave_value_list interpreter::feval (const std::string& name, - const octave_value_list& args, - int nargout) +octave_value_list +interpreter::feval (const std::string& name, + const octave_value_list& args, + int nargout) { octave_value fcn = m_symbol_table.find_function (name, args); @@ -1531,9 +1574,10 @@ return of->call (m_evaluator, nargout, args); } -octave_value_list interpreter::feval (octave_function *fcn, - const octave_value_list& args, - int nargout) +octave_value_list +interpreter::feval (octave_function *fcn, + const octave_value_list& args, + int nargout) { if (fcn) return fcn->call (m_evaluator, nargout, args); @@ -1541,9 +1585,10 @@ return octave_value_list (); } -octave_value_list interpreter::feval (const octave_value& val, - const octave_value_list& args, - int nargout) +octave_value_list +interpreter::feval (const octave_value& val, + const octave_value_list& args, + int nargout) { // FIXME: do we really want to silently return an empty ovl if // the function object is undefined? It's essentially what the @@ -1596,8 +1641,9 @@ //! @return A list of output values. The length of the list is not //! necessarily the same as @c nargout. -octave_value_list interpreter::feval (const octave_value_list& args, - int nargout) +octave_value_list +interpreter::feval (const octave_value_list& args, + int nargout) { if (args.length () == 0) error ("feval: first argument must be a string, inline function, or a function handle"); @@ -1609,195 +1655,232 @@ return feval (f_arg, tmp_args, nargout); } -octave_value interpreter::make_function_handle (const std::string& name) +octave_value +interpreter::make_function_handle (const std::string& name) { return m_evaluator.make_fcn_handle (name); } -void interpreter::install_variable (const std::string& name, - const octave_value& value, bool global) +void +interpreter::install_variable (const std::string& name, + const octave_value& value, bool global) { m_evaluator.install_variable (name, value, global); } -octave_value interpreter::global_varval (const std::string& name) const +octave_value +interpreter::global_varval (const std::string& name) const { return m_evaluator.global_varval (name); } -void interpreter::global_assign (const std::string& name, - const octave_value& val) +void +interpreter::global_assign (const std::string& name, + const octave_value& val) { m_evaluator.global_assign (name, val); } -octave_value interpreter::top_level_varval (const std::string& name) const +octave_value +interpreter::top_level_varval (const std::string& name) const { return m_evaluator.top_level_varval (name); } -void interpreter::top_level_assign (const std::string& name, - const octave_value& val) +void +interpreter::top_level_assign (const std::string& name, + const octave_value& val) { m_evaluator.top_level_assign (name, val); } -bool interpreter::is_variable (const std::string& name) const +bool +interpreter::is_variable (const std::string& name) const { return m_evaluator.is_variable (name); } -bool interpreter::is_local_variable (const std::string& name) const +bool +interpreter::is_local_variable (const std::string& name) const { return m_evaluator.is_local_variable (name); } -octave_value interpreter::varval (const std::string& name) const +octave_value +interpreter::varval (const std::string& name) const { return m_evaluator.varval (name); } -void interpreter::assign (const std::string& name, - const octave_value& val) +void +interpreter::assign (const std::string& name, + const octave_value& val) { m_evaluator.assign (name, val); } -void interpreter::assignin (const std::string& context, - const std::string& name, - const octave_value& val) +void +interpreter::assignin (const std::string& context, + const std::string& name, + const octave_value& val) { m_evaluator.assignin (context, name, val); } -void interpreter::source_file (const std::string& file_name, - const std::string& context, bool verbose, - bool require_file) +void +interpreter::source_file (const std::string& file_name, + const std::string& context, bool verbose, + bool require_file) { m_evaluator.source_file (file_name, context, verbose, require_file); } -bool interpreter::at_top_level () const +bool +interpreter::at_top_level () const { return m_evaluator.at_top_level (); } -bool interpreter::isglobal (const std::string& name) const +bool +interpreter::isglobal (const std::string& name) const { return m_evaluator.is_global (name); } -octave_value interpreter::find (const std::string& name) +octave_value +interpreter::find (const std::string& name) { return m_evaluator.find (name); } -void interpreter::clear_all (bool force) +void +interpreter::clear_all (bool force) { m_evaluator.clear_all (force); } -void interpreter::clear_objects () +void +interpreter::clear_objects () { m_evaluator.clear_objects (); } -void interpreter::clear_variable (const std::string& name) +void +interpreter::clear_variable (const std::string& name) { m_evaluator.clear_variable (name); } -void interpreter::clear_variable_pattern (const std::string& pattern) +void +interpreter::clear_variable_pattern (const std::string& pattern) { m_evaluator.clear_variable_pattern (pattern); } -void interpreter::clear_variable_regexp (const std::string& pattern) +void +interpreter::clear_variable_regexp (const std::string& pattern) { m_evaluator.clear_variable_regexp (pattern); } -void interpreter::clear_variables () +void +interpreter::clear_variables () { m_evaluator.clear_variables (); } -void interpreter::clear_global_variable (const std::string& name) +void +interpreter::clear_global_variable (const std::string& name) { m_evaluator.clear_global_variable (name); } -void interpreter::clear_global_variable_pattern (const std::string& pattern) +void +interpreter::clear_global_variable_pattern (const std::string& pattern) { m_evaluator.clear_global_variable_pattern (pattern); } -void interpreter::clear_global_variable_regexp (const std::string& pattern) +void +interpreter::clear_global_variable_regexp (const std::string& pattern) { m_evaluator.clear_global_variable_regexp (pattern); } -void interpreter::clear_global_variables () +void +interpreter::clear_global_variables () { m_evaluator.clear_global_variables (); } -void interpreter::clear_functions (bool force) +void +interpreter::clear_functions (bool force) { m_symbol_table.clear_functions (force); } -void interpreter::clear_function (const std::string& name) +void +interpreter::clear_function (const std::string& name) { m_symbol_table.clear_function (name); } -void interpreter::clear_symbol (const std::string& name) +void +interpreter::clear_symbol (const std::string& name) { m_evaluator.clear_symbol (name); } -void interpreter::clear_function_pattern (const std::string& pat) +void +interpreter::clear_function_pattern (const std::string& pat) { m_symbol_table.clear_function_pattern (pat); } -void interpreter::clear_function_regexp (const std::string& pat) +void +interpreter::clear_function_regexp (const std::string& pat) { m_symbol_table.clear_function_regexp (pat); } -void interpreter::clear_symbol_pattern (const std::string& pat) +void +interpreter::clear_symbol_pattern (const std::string& pat) { return m_evaluator.clear_symbol_pattern (pat); } -void interpreter::clear_symbol_regexp (const std::string& pat) +void +interpreter::clear_symbol_regexp (const std::string& pat) { return m_evaluator.clear_symbol_regexp (pat); } -std::list interpreter::global_variable_names () +std::list +interpreter::global_variable_names () { return m_evaluator.global_variable_names (); } -std::list interpreter::top_level_variable_names () +std::list +interpreter::top_level_variable_names () { return m_evaluator.top_level_variable_names (); } -std::list interpreter::variable_names () +std::list +interpreter::variable_names () { return m_evaluator.variable_names (); } -std::list interpreter::user_function_names () +std::list +interpreter::user_function_names () { return m_symbol_table.user_function_names (); } -std::list interpreter::autoloaded_functions () const +std::list +interpreter::autoloaded_functions () const { return m_evaluator.autoloaded_functions (); } @@ -1805,7 +1888,8 @@ // May be used to send an interrupt signal to the the interpreter from // another thread (for example, the GUI). -void interpreter::interrupt () +void +interpreter::interrupt () { static int sigint = 0; static bool first = true; @@ -1833,7 +1917,8 @@ octave_kill_wrapper (pid, sigint); } -void interpreter::pause () +void +interpreter::pause () { // FIXME: To be reliable, these tree_evaluator functions must be // made thread safe. @@ -1842,7 +1927,8 @@ m_evaluator.reset_debug_state (); } -void interpreter::stop () +void +interpreter::stop () { // FIXME: To be reliable, these tree_evaluator functions must be // made thread safe. @@ -1853,7 +1939,8 @@ interrupt (); } -void interpreter::resume () +void +interpreter::resume () { // FIXME: To be reliable, these tree_evaluator functions must be // made thread safe. @@ -1865,69 +1952,82 @@ m_evaluator.dbcont (); } -octave_value interpreter::PS1 (const octave_value_list& args, int nargout) +octave_value +interpreter::PS1 (const octave_value_list& args, int nargout) { return m_input_system.PS1 (args, nargout); } -std::string interpreter::PS1 () const +std::string +interpreter::PS1 () const { return m_input_system.PS1 (); } -std::string interpreter::PS1 (const std::string& s) +std::string +interpreter::PS1 (const std::string& s) { return m_input_system.PS1 (s); } -void interpreter::set_PS1 (const std::string& s) +void +interpreter::set_PS1 (const std::string& s) { m_input_system.set_PS1 (s); } -octave_value interpreter::PS2 (const octave_value_list& args, int nargout) +octave_value +interpreter::PS2 (const octave_value_list& args, int nargout) { return m_input_system.PS2 (args, nargout); } -std::string interpreter::PS2 () const +std::string +interpreter::PS2 () const { return m_input_system.PS2 (); } -std::string interpreter::PS2 (const std::string& s) +std::string +interpreter::PS2 (const std::string& s) { return m_input_system.PS2 (s); } -void interpreter::set_PS2 (const std::string& s) +void +interpreter::set_PS2 (const std::string& s) { m_input_system.set_PS2 (s); } -octave_value interpreter::PS4 (const octave_value_list& args, int nargout) +octave_value +interpreter::PS4 (const octave_value_list& args, int nargout) { return m_evaluator.PS4 (args, nargout); } -std::string interpreter::PS4 () const +std::string +interpreter::PS4 () const { return m_evaluator.PS4 (); } -std::string interpreter::PS4 (const std::string& s) +std::string +interpreter::PS4 (const std::string& s) { return m_evaluator.PS4 (s); } -void interpreter::set_PS4 (const std::string& s) +void +interpreter::set_PS4 (const std::string& s) { m_evaluator.set_PS4 (s); } // Provided for convenience. Will be removed once we eliminate the // old terminal widget. -bool interpreter::experimental_terminal_widget () const +bool +interpreter::experimental_terminal_widget () const { if (! m_app_context) return false; @@ -1938,27 +2038,32 @@ return options.experimental_terminal_widget (); } -void interpreter::add_debug_watch_expression (const std::string& expr) +void +interpreter::add_debug_watch_expression (const std::string& expr) { m_evaluator.add_debug_watch_expression (expr); } -void interpreter::remove_debug_watch_expression (const std::string& expr) +void +interpreter::remove_debug_watch_expression (const std::string& expr) { m_evaluator.remove_debug_watch_expression (expr); } -void interpreter::clear_debug_watch_expressions () +void +interpreter::clear_debug_watch_expressions () { m_evaluator.clear_debug_watch_expressions (); } -std::set interpreter::debug_watch_expressions () const +std::set +interpreter::debug_watch_expressions () const { return m_evaluator.debug_watch_expressions (); } -void interpreter::handle_exception (const execution_exception& ee) +void +interpreter::handle_exception (const execution_exception& ee) { m_error_system.save_exception (ee); @@ -1970,7 +2075,8 @@ recover_from_exception (); } -void interpreter::recover_from_exception () +void +interpreter::recover_from_exception () { if (octave_interrupt_state) m_event_manager.interpreter_interrupted (); @@ -1982,17 +2088,20 @@ catch_interrupts (); } -void interpreter::mark_for_deletion (const std::string& file) +void +interpreter::mark_for_deletion (const std::string& file) { m_tmp_files.insert (file); } -void interpreter::cleanup_tmp_files () +void +interpreter::cleanup_tmp_files () { m_tmp_files.cleanup (); } -void interpreter::quit (int exit_status, bool force, bool confirm) +void +interpreter::quit (int exit_status, bool force, bool confirm) { if (! force) { @@ -2034,7 +2143,8 @@ throw exit_exception (exit_status); } -void interpreter::add_atexit_fcn (const std::string& fname) +void +interpreter::add_atexit_fcn (const std::string& fname) { if (m_executing_atexit) return; @@ -2042,7 +2152,8 @@ m_atexit_fcns.push_front (fname); } -bool interpreter::remove_atexit_fcn (const std::string& fname) +bool +interpreter::remove_atexit_fcn (const std::string& fname) { bool found = false; @@ -2062,7 +2173,8 @@ // What internal options get configured by --traditional. -void interpreter::maximum_braindamage () +void +interpreter::maximum_braindamage () { PS1 (">> "); PS2 (""); @@ -2092,7 +2204,8 @@ m_error_system.disable_warning ("Octave:possible-matlab-short-circuit-operator"); } -void interpreter::execute_pkg_add (const std::string& dir) +void +interpreter::execute_pkg_add (const std::string& dir) { try { @@ -2113,9 +2226,10 @@ // commands from a file before we have entered the main loop in // toplev.cc. -int interpreter::safe_source_file (const std::string& file_name, - const std::string& context, - bool verbose, bool require_file) +int +interpreter::safe_source_file (const std::string& file_name, + const std::string& context, + bool verbose, bool require_file) { try { diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/load-path.cc --- a/libinterp/corefcn/load-path.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/load-path.cc Tue Dec 12 23:14:33 2023 -0800 @@ -969,7 +969,8 @@ execute_pkg_add_or_del (dir, "PKG_DEL"); } -void load_path::rehash () +void +load_path::rehash () { update (); @@ -986,8 +987,9 @@ Vlast_prompt_time.stamp (); } -void load_path::execute_pkg_add_or_del (const std::string& dir, - const std::string& script_file) +void +load_path::execute_pkg_add_or_del (const std::string& dir, + const std::string& script_file) { if (! octave_interpreter_ready) return; diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/load-save.cc --- a/libinterp/corefcn/load-save.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/load-save.cc Tue Dec 12 23:14:33 2023 -0800 @@ -670,11 +670,12 @@ return parse_save_options (argv, fmt, append, save_as_floats, use_zlib); } -void load_save_system::save_vars (const string_vector& argv, int argv_idx, - int argc, std::ostream& os, - const load_save_format& fmt, - bool save_as_floats, - bool write_header_info) +void +load_save_system::save_vars (const string_vector& argv, int argv_idx, + int argc, std::ostream& os, + const load_save_format& fmt, + bool save_as_floats, + bool write_header_info) { if (write_header_info) write_header (os, fmt); @@ -729,7 +730,8 @@ } } -void load_save_system::dump_octave_core () +void +load_save_system::dump_octave_core () { if (m_crash_dumps_octave_core) { @@ -822,8 +824,9 @@ } } -void load_save_system::write_header (std::ostream& os, - const load_save_format& fmt) +void +load_save_system::write_header (std::ostream& os, + const load_save_format& fmt) { switch (fmt.type ()) { @@ -907,10 +910,11 @@ // Save variables with names matching PATTERN on stream OS in the // format specified by FMT. -std::size_t load_save_system::save_vars (std::ostream& os, - const std::string& pattern, - const load_save_format& fmt, - bool save_as_floats) +std::size_t +load_save_system::save_vars (std::ostream& os, + const std::string& pattern, + const load_save_format& fmt, + bool save_as_floats) { tree_evaluator& tw = m_interpreter.get_evaluator (); @@ -928,11 +932,12 @@ return saved; } -void load_save_system::do_save (std::ostream& os, const octave_value& tc, - const std::string& name, - const std::string& help, - bool global, const load_save_format& fmt, - bool save_as_floats) +void +load_save_system::do_save (std::ostream& os, const octave_value& tc, + const std::string& name, + const std::string& help, + bool global, const load_save_format& fmt, + bool save_as_floats) { switch (fmt.type ()) { @@ -977,10 +982,11 @@ // Save the info from SR on stream OS in the format specified by FMT. -void load_save_system::do_save (std::ostream& os, - const symbol_info& syminfo, - const load_save_format& fmt, - bool save_as_floats) +void +load_save_system::do_save (std::ostream& os, + const symbol_info& syminfo, + const load_save_format& fmt, + bool save_as_floats) { octave_value val = syminfo.value (); @@ -997,11 +1003,12 @@ // save fields of a scalar structure STR matching PATTERN on stream OS // in the format specified by FMT. -std::size_t load_save_system::save_fields (std::ostream& os, - const octave_scalar_map& m, - const std::string& pattern, - const load_save_format& fmt, - bool save_as_floats) +std::size_t +load_save_system::save_fields (std::ostream& os, + const octave_scalar_map& m, + const std::string& pattern, + const load_save_format& fmt, + bool save_as_floats) { symbol_match pat (pattern); @@ -1023,10 +1030,11 @@ return saved; } -void load_save_system::dump_octave_core (std::ostream& os, - const char *fname, - const load_save_format& fmt, - bool save_as_floats) +void +load_save_system::dump_octave_core (std::ostream& os, + const char *fname, + const load_save_format& fmt, + bool save_as_floats) { write_header (os, fmt); @@ -1063,7 +1071,8 @@ // Install a variable with name NAME and the value VAL in the // symbol table. If GLOBAL is TRUE, make the variable global. -void load_save_system::install_loaded_variable (const std::string& name, +void +load_save_system::install_loaded_variable (const std::string& name, const octave_value& val, bool global, const std::string& /*doc*/) @@ -1071,7 +1080,8 @@ m_interpreter.install_variable (name, val, global); } -std::string load_save_system::init_save_header_format () +std::string +load_save_system::init_save_header_format () { return (std::string ("# Created by Octave " OCTAVE_VERSION diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/ls-hdf5.cc --- a/libinterp/corefcn/ls-hdf5.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/ls-hdf5.cc Tue Dec 12 23:14:33 2023 -0800 @@ -1433,7 +1433,8 @@ goto error_cleanup; // attach the type of the variable - type_id = H5Tcopy (H5T_C_S1); H5Tset_size (type_id, t.length () + 1); + type_id = H5Tcopy (H5T_C_S1); + H5Tset_size (type_id, t.length () + 1); if (type_id < 0) goto error_cleanup; diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/lu.cc --- a/libinterp/corefcn/lu.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/lu.cc Tue Dec 12 23:14:33 2023 -0800 @@ -569,9 +569,9 @@ */ -static -bool check_lu_dims (const octave_value& l, const octave_value& u, - const octave_value& p) +static bool +check_lu_dims (const octave_value& l, const octave_value& u, + const octave_value& p) { octave_idx_type m = l.rows (); octave_idx_type k = u.rows (); diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/mex.cc --- a/libinterp/corefcn/mex.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/mex.cc Tue Dec 12 23:14:33 2023 -0800 @@ -4125,62 +4125,74 @@ return ptr->get_imag_data (); } -mxDouble * mxGetDoubles (const mxArray *ptr) +mxDouble * +mxGetDoubles (const mxArray *ptr) { return ptr->get_doubles (); } -mxSingle * mxGetSingles (const mxArray *ptr) +mxSingle * +mxGetSingles (const mxArray *ptr) { return ptr->get_singles (); } -mxInt8 * mxGetInt8s (const mxArray *ptr) +mxInt8 * +mxGetInt8s (const mxArray *ptr) { return ptr->get_int8s (); } -mxInt16 * mxGetInt16s (const mxArray *ptr) +mxInt16 * +mxGetInt16s (const mxArray *ptr) { return ptr->get_int16s (); } -mxInt32 * mxGetInt32s (const mxArray *ptr) +mxInt32 * +mxGetInt32s (const mxArray *ptr) { return ptr->get_int32s (); } -mxInt64 * mxGetInt64s (const mxArray *ptr) +mxInt64 * +mxGetInt64s (const mxArray *ptr) { return ptr->get_int64s (); } -mxUint8 * mxGetUint8s (const mxArray *ptr) +mxUint8 * +mxGetUint8s (const mxArray *ptr) { return ptr->get_uint8s (); } -mxUint16 * mxGetUint16s (const mxArray *ptr) +mxUint16 * +mxGetUint16s (const mxArray *ptr) { return ptr->get_uint16s (); } -mxUint32 * mxGetUint32s (const mxArray *ptr) +mxUint32 * +mxGetUint32s (const mxArray *ptr) { return ptr->get_uint32s (); } -mxUint64 * mxGetUint64s (const mxArray *ptr) +mxUint64 * +mxGetUint64s (const mxArray *ptr) { return ptr->get_uint64s (); } -mxComplexDouble * mxGetComplexDoubles (const mxArray *ptr) +mxComplexDouble * +mxGetComplexDoubles (const mxArray *ptr) { return ptr->get_complex_doubles (); } -mxComplexSingle * mxGetComplexSingles (const mxArray *ptr) +mxComplexSingle * +mxGetComplexSingles (const mxArray *ptr) { return ptr->get_complex_singles (); } @@ -4198,62 +4210,74 @@ ptr->set_data (maybe_unmark (pr)); } -int mxSetDoubles (mxArray *ptr, mxDouble *data) +int +mxSetDoubles (mxArray *ptr, mxDouble *data) { return ptr->set_doubles (maybe_unmark (data)); } -int mxSetSingles (mxArray *ptr, mxSingle *data) +int +mxSetSingles (mxArray *ptr, mxSingle *data) { return ptr->set_singles (maybe_unmark (data)); } -int mxSetInt8s (mxArray *ptr, mxInt8 *data) +int +mxSetInt8s (mxArray *ptr, mxInt8 *data) { return ptr->set_int8s (maybe_unmark (data)); } -int mxSetInt16s (mxArray *ptr, mxInt16 *data) +int +mxSetInt16s (mxArray *ptr, mxInt16 *data) { return ptr->set_int16s (maybe_unmark (data)); } -int mxSetInt32s (mxArray *ptr, mxInt32 *data) +int +mxSetInt32s (mxArray *ptr, mxInt32 *data) { return ptr->set_int32s (maybe_unmark (data)); } -int mxSetInt64s (mxArray *ptr, mxInt64 *data) +int +mxSetInt64s (mxArray *ptr, mxInt64 *data) { return ptr->set_int64s (maybe_unmark (data)); } -int mxSetUint8s (mxArray *ptr, mxUint8 *data) +int +mxSetUint8s (mxArray *ptr, mxUint8 *data) { return ptr->set_uint8s (maybe_unmark (data)); } -int mxSetUint16s (mxArray *ptr, mxUint16 *data) +int +mxSetUint16s (mxArray *ptr, mxUint16 *data) { return ptr->set_uint16s (maybe_unmark (data)); } -int mxSetUint32s (mxArray *ptr, mxUint32 *data) +int +mxSetUint32s (mxArray *ptr, mxUint32 *data) { return ptr->set_uint32s (maybe_unmark (data)); } -int mxSetUint64s (mxArray *ptr, mxUint64 *data) +int +mxSetUint64s (mxArray *ptr, mxUint64 *data) { return ptr->set_uint64s (maybe_unmark (data)); } -int mxSetComplexDoubles (mxArray *ptr, mxComplexDouble *data) +int +mxSetComplexDoubles (mxArray *ptr, mxComplexDouble *data) { return ptr->set_complex_doubles (maybe_unmark (data)); } -int mxSetComplexSingles (mxArray *ptr, mxComplexSingle *data) +int +mxSetComplexSingles (mxArray *ptr, mxComplexSingle *data) { return ptr->set_complex_singles (maybe_unmark (data)); } diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/oct-hist.cc --- a/libinterp/corefcn/oct-hist.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/oct-hist.cc Tue Dec 12 23:14:33 2023 -0800 @@ -265,7 +265,8 @@ m_timestamp_format_string (default_timestamp_format ()) { } -void history_system::initialize (bool read_history_file) +void +history_system::initialize (bool read_history_file) { command_history::initialize (read_history_file, default_file (), default_size (), @@ -276,7 +277,8 @@ evmgr.set_history (command_history::list ()); } -void history_system::write_timestamp () +void +history_system::write_timestamp () { sys::localtime now; @@ -315,8 +317,9 @@ // means read file, arg of -q means don't number lines. Arg of N // means only display that many items. -string_vector history_system::do_history (const octave_value_list& args, - int nargout) +string_vector +history_system::do_history (const octave_value_list& args, + int nargout) { bool numbered_output = nargout == 0; @@ -443,7 +446,8 @@ return hlist; } -void history_system::do_edit_history (const octave_value_list& args) +void +history_system::do_edit_history (const octave_value_list& args) { std::string name = mk_tmp_hist_file (args, false, "edit_history"); @@ -506,7 +510,8 @@ source_file (name); } -void history_system::do_run_history (const octave_value_list& args) +void +history_system::do_run_history (const octave_value_list& args) { std::string name = mk_tmp_hist_file (args, false, "run_history"); @@ -524,7 +529,8 @@ source_file (name); } -std::string history_system::default_file () +std::string +history_system::default_file () { std::string file; @@ -550,7 +556,8 @@ return file; } -int history_system::default_size () +int +history_system::default_size () { int size = 1000; @@ -567,7 +574,8 @@ return size; } -std::string history_system::default_timestamp_format () +std::string +history_system::default_timestamp_format () { return "# Octave " OCTAVE_VERSION ", %a %b %d %H:%M:%S %Y %Z <" diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/oct-map.cc --- a/libinterp/corefcn/oct-map.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/oct-map.cc Tue Dec 12 23:14:33 2023 -0800 @@ -639,17 +639,19 @@ } // This is just a wrapper. -void permute_to_correct_order1 (const octave_scalar_map& ref, - const octave_scalar_map& src, - octave_scalar_map& dest, - Array& perm) +void +permute_to_correct_order1 (const octave_scalar_map& ref, + const octave_scalar_map& src, + octave_scalar_map& dest, + Array& perm) { dest = src.orderfields (ref, perm); } // In non-scalar case, we also promote empty structs without fields. -void permute_to_correct_order1 (const octave_map& ref, const octave_map& src, - octave_map& dest, Array& perm) +void +permute_to_correct_order1 (const octave_map& ref, const octave_map& src, + octave_map& dest, Array& perm) { if (src.nfields () == 0 && src.isempty ()) dest = octave_map (src.dims (), ref.keys ()); diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/oct-stream.cc --- a/libinterp/corefcn/oct-stream.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/oct-stream.cc Tue Dec 12 23:14:33 2023 -0800 @@ -4250,8 +4250,8 @@ { T value = T (); - is >> std::ws; // skip through whitespace and advance stream pointer - std::streampos pos = is.tellg (); + is >> std::ws; // skip through whitespace and advance stream pointer + std::streampos pos = is.tellg (); switch (fmt.type) { @@ -4266,7 +4266,7 @@ case 'i': { - int c1 = is.get (); + int c1 = is.get (); if (c1 != std::istream::traits_type::eof ()) { @@ -4315,33 +4315,33 @@ break; } - std::ios::iostate status = is.rdstate (); - if (! (status & std::ios::failbit)) - { - // Copy the converted value if the stream is in a good state - *valptr = value; - } - else - { - if (value != T ()) - { - // If conversion produces an integer that overflows, failbit is set - // but value is nonzero. We want to treat this case as success, - // so clear failbit from the stream state to keep going. - // FIXME: Maybe set error state on octave stream? Matlab does - // *not* indicate an error message on overflow. - is.clear (status & ~std::ios::failbit); - *valptr = value; - } - else - { - // True error. - // Reset stream to original position, clear eof bit, pass status on. - is.clear (); - is.seekg (pos); - is.setstate (status & ~std::ios_base::eofbit); - } - } + std::ios::iostate status = is.rdstate (); + if (! (status & std::ios::failbit)) + { + // Copy the converted value if the stream is in a good state + *valptr = value; + } + else + { + if (value != T ()) + { + // If conversion produces an integer that overflows, failbit is set + // but value is nonzero. We want to treat this case as success, + // so clear failbit from the stream state to keep going. + // FIXME: Maybe set error state on octave stream? Matlab does + // *not* indicate an error message on overflow. + is.clear (status & ~std::ios::failbit); + *valptr = value; + } + else + { + // True error. + // Reset stream to original position, clear eof bit, pass status on. + is.clear (); + is.seekg (pos); + is.setstate (status & ~std::ios_base::eofbit); + } + } return is; } @@ -4397,7 +4397,8 @@ template <> std::istream& -octave_scan<> (std::istream& is, const scanf_format_elt& fmt, double *valptr) +octave_scan<> +(std::istream& is, const scanf_format_elt& fmt, double *valptr) { double& ref = *valptr; @@ -4409,20 +4410,20 @@ case 'E': case 'G': { - is >> std::ws; // skip through whitespace and advance stream pointer - if (is.good ()) + is >> std::ws; // skip through whitespace and advance stream pointer + if (is.good ()) { - std::streampos pos = is.tellg (); + std::streampos pos = is.tellg (); ref = read_value (is); - std::ios::iostate status = is.rdstate (); - if (status & std::ios::failbit) - { - is.clear (); - is.seekg (pos); - is.setstate (status & ~std::ios_base::eofbit); - } + std::ios::iostate status = is.rdstate (); + if (status & std::ios::failbit) + { + is.clear (); + is.seekg (pos); + is.setstate (status & ~std::ios_base::eofbit); + } } } break; @@ -5040,10 +5041,10 @@ // If it looks like we have a matching failure, then // reset the failbit in the stream state. - if (is.rdstate () & std::ios::failbit) + if (is.rdstate () & std::ios::failbit) { is.clear (is.rdstate () & (~std::ios::failbit)); - error (who, "format failed to match"); + error (who, "format failed to match"); } // FIXME: is this the right thing to do? @@ -7405,7 +7406,8 @@ clear (); } -int stream_list::insert (stream& os) +int +stream_list::insert (stream& os) { // Insert item with key corresponding to file-descriptor. @@ -7445,7 +7447,8 @@ ::error ("%s: invalid stream number = %d", who.c_str (), fid); } -stream stream_list::lookup (int fid, const std::string& who) const +stream +stream_list::lookup (int fid, const std::string& who) const { stream retval; @@ -7468,15 +7471,17 @@ return retval; } -stream stream_list::lookup (const octave_value& fid, - const std::string& who) const +stream +stream_list::lookup (const octave_value& fid, + const std::string& who) const { int i = get_file_number (fid); return lookup (i, who); } -int stream_list::remove (int fid, const std::string& who) +int +stream_list::remove (int fid, const std::string& who) { // Can't remove stdin (std::cin), stdout (std::cout), or stderr (std::cerr). if (fid < 3) @@ -7500,7 +7505,8 @@ return 0; } -int stream_list::remove (const octave_value& fid, const std::string& who) +int +stream_list::remove (const octave_value& fid, const std::string& who) { int retval = -1; @@ -7520,7 +7526,8 @@ return retval; } -void stream_list::clear (bool flush) +void +stream_list::clear (bool flush) { if (flush) { @@ -7561,7 +7568,8 @@ m_lookup_cache = m_list.end (); } -string_vector stream_list::get_info (int fid) const +string_vector +stream_list::get_info (int fid) const { string_vector retval (4); @@ -7593,7 +7601,8 @@ return retval; } -string_vector stream_list::get_info (const octave_value& fid) const +string_vector +stream_list::get_info (const octave_value& fid) const { int conv_err = 0; @@ -7608,7 +7617,8 @@ return get_info (int_fid); } -std::string stream_list::list_open_files () const +std::string +stream_list::list_open_files () const { std::ostringstream buf; @@ -7640,7 +7650,8 @@ return buf.str (); } -octave_value stream_list::open_file_numbers () const +octave_value +stream_list::open_file_numbers () const { Matrix retval (1, m_list.size (), 0.0); @@ -7658,7 +7669,8 @@ return retval; } -int stream_list::get_file_number (const octave_value& fid) const +int +stream_list::get_file_number (const octave_value& fid) const { int retval = -1; @@ -7698,17 +7710,20 @@ return retval; } -octave_value stream_list::stdin_file () const +octave_value +stream_list::stdin_file () const { return octave_value (m_stdin_file); } -octave_value stream_list::stdout_file () const +octave_value +stream_list::stdout_file () const { return octave_value (m_stdout_file); } -octave_value stream_list::stderr_file () const +octave_value +stream_list::stderr_file () const { return octave_value (m_stderr_file); } diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/pager.cc --- a/libinterp/corefcn/pager.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/pager.cc Tue Dec 12 23:14:33 2023 -0800 @@ -114,7 +114,8 @@ return false; } -static std::string default_pager () +static std::string +default_pager () { std::string pager_binary = sys::env::getenv ("PAGER"); @@ -196,18 +197,21 @@ delete m_pb; } -std::ostream& pager_stream::stream () +std::ostream& +pager_stream::stream () { return *this; } -void pager_stream::flush_current_contents_to_diary () +void +pager_stream::flush_current_contents_to_diary () { if (m_pb) m_pb->flush_current_contents_to_diary (); } -void pager_stream::set_diary_skip () +void +pager_stream::set_diary_skip () { if (m_pb) m_pb->set_diary_skip (); @@ -218,7 +222,8 @@ // called when the pager is not in use. For example, just before // getting command-line input. -void pager_stream::reset () +void +pager_stream::reset () { delete m_pb; m_pb = new pager_buf (); @@ -239,7 +244,8 @@ delete m_db; } -std::ostream& diary_stream::stream () +std::ostream& +diary_stream::stream () { return *this; } @@ -249,7 +255,8 @@ // called when the pager is not in use. For example, just before // getting command-line input. -void diary_stream::reset () +void +diary_stream::reset () { delete m_db; m_db = new diary_buf (); @@ -257,7 +264,8 @@ setf (unitbuf); } -void flush_stdout () +void +flush_stdout () { output_system& output_sys = __get_output_system__ (); @@ -273,14 +281,16 @@ m_really_flush_to_pager (false), m_flushing_output_to_pager (false) { } -octave_value output_system::PAGER (const octave_value_list& args, - int nargout) +octave_value +output_system::PAGER (const octave_value_list& args, + int nargout) { return set_internal_variable (m_PAGER, args, nargout, "PAGER", false); } -octave_value output_system::PAGER_FLAGS (const octave_value_list& args, - int nargout) +octave_value +output_system::PAGER_FLAGS (const octave_value_list& args, + int nargout) { return set_internal_variable (m_PAGER_FLAGS, args, nargout, "PAGER_FLAGS", false); @@ -302,7 +312,8 @@ "page_screen_output"); } -std::string output_system::pager_command () const +std::string +output_system::pager_command () const { std::string cmd = m_PAGER; @@ -312,7 +323,8 @@ return cmd; } -void output_system::reset () +void +output_system::reset () { flush_stdout (); @@ -320,7 +332,8 @@ m_diary_stream.reset (); } -void output_system::flush_stdout () +void +output_system::flush_stdout () { if (! m_flushing_output_to_pager) { @@ -338,7 +351,8 @@ } } -void output_system::close_diary () +void +output_system::close_diary () { // Try to flush the current buffer to the diary now, so that things // like @@ -360,7 +374,8 @@ } } -void output_system::open_diary () +void +output_system::open_diary () { close_diary (); @@ -375,7 +390,8 @@ error ("diary: can't open diary file '%s'", m_diary_file_name.c_str ()); } -bool output_system::sync (const char *buf, int len) +bool +output_system::sync (const char *buf, int len) { // FIXME: The following seems to be a bit of a mess. @@ -406,7 +422,8 @@ return false; } -void output_system::clear_external_pager () +void +output_system::clear_external_pager () { if (m_external_pager) { @@ -419,7 +436,8 @@ } } -void output_system::start_external_pager () +void +output_system::start_external_pager () { if (m_external_pager) return; @@ -437,7 +455,8 @@ } } -void output_system::do_sync (const char *msg, int len, bool bypass_pager) +void +output_system::do_sync (const char *msg, int len, bool bypass_pager) { if (msg && len > 0) { @@ -489,14 +508,16 @@ } } -std::ostream& __stdout__ () +std::ostream& +__stdout__ () { output_system& output_sys = __get_output_system__ (); return output_sys.__stdout__ (); } -std::ostream& __diary__ () +std::ostream& +__diary__ () { output_system& output_sys = __get_output_system__ (); diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/perms.cc --- a/libinterp/corefcn/perms.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/perms.cc Tue Dec 12 23:14:33 2023 -0800 @@ -50,7 +50,7 @@ // template static inline Array -GetPerms (const Array &ar_in, bool uniq_v, bool do_sort = false) +GetPerms (const Array& ar_in, bool uniq_v, bool do_sort = false) { octave_idx_type m = ar_in.numel (); double nr = Factorial (m); @@ -123,7 +123,7 @@ template static inline Array -GetPermsNoSort (const Array &ar_in, bool uniq_v = false) +GetPermsNoSort (const Array& ar_in, bool uniq_v = false) { octave_idx_type m = ar_in.numel (); double nr = Factorial (m); @@ -256,8 +256,8 @@ } if (! (args (0).is_matrix_type () || args (0).is_range () - || args (0).iscell () || args (0).is_scalar_type () - || args (0).isstruct ())) + || args (0).iscell () || args (0).is_scalar_type () + || args (0).isstruct ())) { error ("perms: INPUT must be a matrix, a range, a cell array, " "a struct or a scalar."); diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/pr-output.cc --- a/libinterp/corefcn/pr-output.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/pr-output.cc Tue Dec 12 23:14:33 2023 -0800 @@ -2112,8 +2112,9 @@ } template -void print_nd_array (std::ostream& os, const NDA_T& nda, - bool pr_as_read_syntax) +void +print_nd_array (std::ostream& os, const NDA_T& nda, + bool pr_as_read_syntax) { if (nda.isempty ()) @@ -3449,7 +3450,7 @@ DEFMETHOD (display, interp, args, , classes: cell char double function_handle int8 int16 int32 int64 logical single struct uint8 uint16 uint32 uint64 - doc: /* -*- texinfo -*- + doc: /* -*- texinfo -*- @deftypefn {} {} display (@var{obj}) Display the contents of the object @var{obj} prepended by its name. diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/qr.cc --- a/libinterp/corefcn/qr.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/qr.cc Tue Dec 12 23:14:33 2023 -0800 @@ -1265,8 +1265,9 @@ */ static -bool check_qr_dims (const octave_value& q, const octave_value& r, - bool allow_ecf = false) +bool +check_qr_dims (const octave_value& q, const octave_value& r, + bool allow_ecf = false) { octave_idx_type m = q.rows (); octave_idx_type k = r.rows (); @@ -1276,7 +1277,8 @@ } static -bool check_index (const octave_value& i, bool vector_allowed = false) +bool +check_index (const octave_value& i, bool vector_allowed = false) { return ((i.isreal () || i.isinteger ()) && (i.is_scalar_type () || vector_allowed)); diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/settings.cc --- a/libinterp/corefcn/settings.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/settings.cc Tue Dec 12 23:14:33 2023 -0800 @@ -41,15 +41,17 @@ m_lexer_debug_flag (false) { } -octave_value settings::display_tokens (const octave_value_list& args, - int nargout) +octave_value +settings::display_tokens (const octave_value_list& args, + int nargout) { return set_internal_variable (m_display_tokens, args, nargout, "__display_tokens__"); } -octave_value settings::lexer_debug_flag (const octave_value_list& args, - int nargout) +octave_value +settings::lexer_debug_flag (const octave_value_list& args, + int nargout) { return set_internal_variable (m_lexer_debug_flag, args, nargout, "__lexer_debug_flag__"); diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/sparse-xdiv.cc --- a/libinterp/corefcn/sparse-xdiv.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/sparse-xdiv.cc Tue Dec 12 23:14:33 2023 -0800 @@ -294,7 +294,8 @@ } template -RT do_rightdiv_sm_dm (const SM& a, const DM& d) +RT +do_rightdiv_sm_dm (const SM& a, const DM& d) { const octave_idx_type d_nr = d.rows (); @@ -561,7 +562,8 @@ } template -RT do_leftdiv_dm_sm (const DM& d, const SM& a) +RT +do_leftdiv_dm_sm (const DM& d, const SM& a) { const octave_idx_type a_nr = a.rows (); const octave_idx_type a_nc = a.cols (); diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/stack-frame.cc --- a/libinterp/corefcn/stack-frame.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/stack-frame.cc Tue Dec 12 23:14:33 2023 -0800 @@ -2833,50 +2833,55 @@ std::set m_found_names; }; -stack_frame *stack_frame::create (tree_evaluator& tw, octave_function *fcn, - std::size_t index, - const std::shared_ptr& parent_link, - const std::shared_ptr& static_link) +stack_frame * +stack_frame::create (tree_evaluator& tw, octave_function *fcn, + std::size_t index, + const std::shared_ptr& parent_link, + const std::shared_ptr& static_link) { return new compiled_fcn_stack_frame (tw, fcn, index, parent_link, static_link); } -stack_frame *stack_frame::create (tree_evaluator& tw, - octave_user_script *script, - std::size_t index, - const std::shared_ptr& parent_link, - const std::shared_ptr& static_link) +stack_frame * +stack_frame::create (tree_evaluator& tw, + octave_user_script *script, + std::size_t index, + const std::shared_ptr& parent_link, + const std::shared_ptr& static_link) { return new script_stack_frame (tw, script, index, parent_link, static_link); } -stack_frame *stack_frame::create (tree_evaluator& tw, - octave_user_function *fcn, std::size_t index, - const std::shared_ptr& parent_link, - const std::shared_ptr& static_link, - const std::shared_ptr& access_link) +stack_frame * +stack_frame::create (tree_evaluator& tw, + octave_user_function *fcn, std::size_t index, + const std::shared_ptr& parent_link, + const std::shared_ptr& static_link, + const std::shared_ptr& access_link) { return new user_fcn_stack_frame (tw, fcn, index, parent_link, static_link, access_link); } -stack_frame *stack_frame::create (tree_evaluator& tw, - octave_user_function *fcn, std::size_t index, - const std::shared_ptr& parent_link, - const std::shared_ptr& static_link, - const local_vars_map& local_vars, - const std::shared_ptr& access_link) +stack_frame * +stack_frame::create (tree_evaluator& tw, + octave_user_function *fcn, std::size_t index, + const std::shared_ptr& parent_link, + const std::shared_ptr& static_link, + const local_vars_map& local_vars, + const std::shared_ptr& access_link) { return new user_fcn_stack_frame (tw, fcn, index, parent_link, static_link, local_vars, access_link); } -stack_frame *stack_frame::create (tree_evaluator& tw, - const symbol_scope& scope, std::size_t index, - const std::shared_ptr& parent_link, - const std::shared_ptr& static_link) +stack_frame * +stack_frame::create (tree_evaluator& tw, + const symbol_scope& scope, std::size_t index, + const std::shared_ptr& parent_link, + const std::shared_ptr& static_link) { return new scope_stack_frame (tw, scope, index, parent_link, static_link); } @@ -3013,7 +3018,8 @@ // user_fcn stack frames. Anything else indicates an error in the // implementation, but we'll simply warn if that happens. -void stack_frame::clear_values () +void +stack_frame::clear_values () { warning ("invalid call to stack_frame::clear_values; please report"); } @@ -3040,10 +3046,11 @@ return symbol_stats; } -octave_value stack_frame::who (const string_vector& patterns, - bool have_regexp, bool return_list, - bool verbose, const std::string& whos_line_fmt, - const std::string& msg) +octave_value +stack_frame::who (const string_vector& patterns, + bool have_regexp, bool return_list, + bool verbose, const std::string& whos_line_fmt, + const std::string& msg) { symbol_info_accumulator sym_inf_accum (patterns, have_regexp); @@ -3082,7 +3089,8 @@ // Return first occurrence of variables in current stack frame and any // parent frames reachable through access links. -symbol_info_list stack_frame::all_variables () +symbol_info_list +stack_frame::all_variables () { symbol_info_accumulator sia (true, true); @@ -3091,7 +3099,8 @@ return sia.symbol_info (); } -octave_value stack_frame::workspace () +octave_value +stack_frame::workspace () { std::list ws_list; @@ -3129,7 +3138,8 @@ // FIXME: Should this function also find any variables in parent // scopes accessible through access_links? -std::list stack_frame::variable_names () const +std::list +stack_frame::variable_names () const { std::list retval; @@ -3148,7 +3158,8 @@ return retval; } -symbol_info_list stack_frame::glob_symbol_info (const std::string& pattern) +symbol_info_list +stack_frame::glob_symbol_info (const std::string& pattern) { symbol_info_accumulator sia (pattern, false); @@ -3157,7 +3168,8 @@ return sia.symbol_info (); } -symbol_info_list stack_frame::regexp_symbol_info (const std::string& pattern) +symbol_info_list +stack_frame::regexp_symbol_info (const std::string& pattern) { symbol_info_accumulator sia (pattern, true); @@ -3166,7 +3178,8 @@ return sia.symbol_info (); } -std::size_t stack_frame::size () const +std::size_t +stack_frame::size () const { // This function should only be called for user_fcn_stack_frame or // scope_stack_frame objects. Anything else indicates an error in @@ -3175,7 +3188,8 @@ panic_impossible (); } -void stack_frame::resize (std::size_t) +void +stack_frame::resize (std::size_t) { // This function should only be called for user_fcn_stack_frame or // scope_stack_frame objects. Anything else indicates an error in @@ -3184,7 +3198,8 @@ panic_impossible (); } -stack_frame::scope_flags stack_frame::get_scope_flag (std::size_t) const +stack_frame::scope_flags +stack_frame::get_scope_flag (std::size_t) const { // This function should only be called for user_fcn_stack_frame or // scope_stack_frame objects. Anything else indicates an error in @@ -3193,7 +3208,8 @@ panic_impossible (); } -void stack_frame::set_scope_flag (std::size_t, scope_flags) +void +stack_frame::set_scope_flag (std::size_t, scope_flags) { // This function should only be called for user_fcn_stack_frame or // scope_stack_frame objects. Anything else indicates an error in @@ -3202,8 +3218,9 @@ panic_impossible (); } -void stack_frame::install_variable (const symbol_record& sym, - const octave_value& value, bool global) +void +stack_frame::install_variable (const symbol_record& sym, + const octave_value& value, bool global) { if (global && ! is_global (sym)) { @@ -3248,7 +3265,8 @@ assign (sym, value); } -octave_value stack_frame::varval (std::size_t) const +octave_value +stack_frame::varval (std::size_t) const { // This function should only be called for user_fcn_stack_frame or // scope_stack_frame objects. Anything else indicates an error in @@ -3257,7 +3275,8 @@ panic_impossible (); } -octave_value& stack_frame::varref (std::size_t +octave_value& +stack_frame::varref (std::size_t #if defined (OCTAVE_ENABLE_BYTECODE_EVALUATOR) , bool #endif @@ -3270,56 +3289,64 @@ panic_impossible (); } -void stack_frame::clear_objects () +void +stack_frame::clear_objects () { symbol_cleaner sc (true, true); accept (sc); } -void stack_frame::clear_variable (const std::string& name) +void +stack_frame::clear_variable (const std::string& name) { symbol_cleaner sc (name); accept (sc); } -void stack_frame::clear_variable_pattern (const std::string& pattern) +void +stack_frame::clear_variable_pattern (const std::string& pattern) { symbol_cleaner sc (pattern); accept (sc); } -void stack_frame::clear_variable_pattern (const string_vector& patterns) +void +stack_frame::clear_variable_pattern (const string_vector& patterns) { symbol_cleaner sc (patterns); accept (sc); } -void stack_frame::clear_variable_regexp (const std::string& pattern) +void +stack_frame::clear_variable_regexp (const std::string& pattern) { symbol_cleaner sc (pattern, true); accept (sc); } -void stack_frame::clear_variable_regexp (const string_vector& patterns) +void +stack_frame::clear_variable_regexp (const string_vector& patterns) { symbol_cleaner sc (patterns, true); accept (sc); } -void stack_frame::clear_variables () +void +stack_frame::clear_variables () { symbol_cleaner sc; accept (sc); } -void stack_frame::display_stopped_in_message (std::ostream& os) const +void +stack_frame::display_stopped_in_message (std::ostream& os) const { if (index () == 0) os << "at top level" << std::endl; @@ -3335,7 +3362,8 @@ } } -void stack_frame::display (bool follow) const +void +stack_frame::display (bool follow) const { std::ostream& os = octave_stdout; @@ -3382,7 +3410,8 @@ } } -void compiled_fcn_stack_frame::display (bool follow) const +void +compiled_fcn_stack_frame::display (bool follow) const { std::ostream& os = octave_stdout; @@ -3393,7 +3422,8 @@ << " (" << m_fcn->type_name () << ")" << std::endl; } -void compiled_fcn_stack_frame::accept (stack_frame_walker& sfw) +void +compiled_fcn_stack_frame::accept (stack_frame_walker& sfw) { sfw.visit_compiled_fcn_stack_frame (*this); } @@ -3412,14 +3442,16 @@ set_script_offsets (); } -std::size_t script_stack_frame::get_num_symbols (octave_user_script *script) +std::size_t +script_stack_frame::get_num_symbols (octave_user_script *script) { symbol_scope script_scope = script->scope (); return script_scope.num_symbols (); } -void script_stack_frame::set_script_offsets () +void +script_stack_frame::set_script_offsets () { // Set frame and data offsets inside stack frame based on enclosing // scope(s). @@ -3524,7 +3556,8 @@ } } -void script_stack_frame::resize_and_update_script_offsets (const symbol_record& sym) +void +script_stack_frame::resize_and_update_script_offsets (const symbol_record& sym) { std::size_t data_offset = sym.data_offset (); @@ -3567,7 +3600,8 @@ return alink; } -unwind_protect *script_stack_frame::unwind_protect_frame () +unwind_protect * +script_stack_frame::unwind_protect_frame () { if (! m_unwind_protect_frame) m_unwind_protect_frame = new unwind_protect (); @@ -3575,7 +3609,8 @@ return m_unwind_protect_frame; } -symbol_record script_stack_frame::lookup_symbol (const std::string& name) const +symbol_record +script_stack_frame::lookup_symbol (const std::string& name) const { symbol_scope scope = get_scope (); @@ -3598,7 +3633,8 @@ return new_sym; } -symbol_record script_stack_frame::insert_symbol (const std::string& name) +symbol_record +script_stack_frame::insert_symbol (const std::string& name) { // If the symbols is already in the immediate scope, there is // nothing more to do. @@ -3706,9 +3742,10 @@ return found; } -bool script_stack_frame::get_val_offsets (const symbol_record& sym, - std::size_t& frame_offset, - std::size_t& data_offset) const +bool +script_stack_frame::get_val_offsets (const symbol_record& sym, + std::size_t& frame_offset, + std::size_t& data_offset) const { data_offset = sym.data_offset (); frame_offset = sym.frame_offset (); @@ -3755,7 +3792,8 @@ return true; } -void script_stack_frame::get_val_offsets_with_insert (const symbol_record& sym, +void +script_stack_frame::get_val_offsets_with_insert (const symbol_record& sym, std::size_t& frame_offset, std::size_t& data_offset) { @@ -3848,7 +3886,8 @@ return frame->get_scope_flag (data_offset); } -octave_value script_stack_frame::varval (const symbol_record& sym) const +octave_value +script_stack_frame::varval (const symbol_record& sym) const { std::size_t frame_offset; std::size_t data_offset; @@ -3894,7 +3933,8 @@ error ("internal error: invalid switch case"); } -octave_value& script_stack_frame::varref (const symbol_record& sym +octave_value& +script_stack_frame::varref (const symbol_record& sym #if defined (OCTAVE_ENABLE_BYTECODE_EVALUATOR) , bool deref_refs #endif @@ -3941,8 +3981,9 @@ error ("internal error: invalid switch case"); } -void script_stack_frame::mark_scope (const symbol_record& sym, - scope_flags flag) +void +script_stack_frame::mark_scope (const symbol_record& sym, + scope_flags flag) { std::size_t data_offset = sym.data_offset (); @@ -3965,7 +4006,8 @@ frame->set_scope_flag (data_offset, flag); } -void script_stack_frame::display (bool follow) const +void +script_stack_frame::display (bool follow) const { std::ostream& os = octave_stdout; @@ -3990,12 +4032,14 @@ display_scope (os, get_scope ()); } -void script_stack_frame::accept (stack_frame_walker& sfw) +void +script_stack_frame::accept (stack_frame_walker& sfw) { sfw.visit_script_stack_frame (*this); } -void base_value_stack_frame::display (bool follow) const +void +base_value_stack_frame::display (bool follow) const { std::ostream& os = octave_stdout; @@ -4067,7 +4111,8 @@ return alink; } -void user_fcn_stack_frame::clear_values () +void +user_fcn_stack_frame::clear_values () { symbol_scope fcn_scope = m_fcn->scope (); @@ -4101,7 +4146,8 @@ } } -unwind_protect *user_fcn_stack_frame::unwind_protect_frame () +unwind_protect * +user_fcn_stack_frame::unwind_protect_frame () { if (! m_unwind_protect_frame) m_unwind_protect_frame = new unwind_protect (); @@ -4109,7 +4155,8 @@ return m_unwind_protect_frame; } -symbol_record user_fcn_stack_frame::lookup_symbol (const std::string& name) const +symbol_record +user_fcn_stack_frame::lookup_symbol (const std::string& name) const { const stack_frame *frame = this; @@ -4129,7 +4176,8 @@ return symbol_record (); } -symbol_record user_fcn_stack_frame::insert_symbol (const std::string& name) +symbol_record +user_fcn_stack_frame::insert_symbol (const std::string& name) { // If the symbols is already in the immediate scope, there is // nothing more to do. @@ -4193,7 +4241,8 @@ return frame->get_scope_flag (data_offset); } -octave_value user_fcn_stack_frame::varval (const symbol_record& sym) const +octave_value +user_fcn_stack_frame::varval (const symbol_record& sym) const { std::size_t frame_offset = sym.frame_offset (); std::size_t data_offset = sym.data_offset (); @@ -4234,7 +4283,8 @@ error ("internal error: invalid switch case"); } -octave_value& user_fcn_stack_frame::varref (const symbol_record& sym +octave_value& +user_fcn_stack_frame::varref (const symbol_record& sym #if defined (OCTAVE_ENABLE_BYTECODE_EVALUATOR) , bool deref_refs #endif @@ -4280,7 +4330,8 @@ error ("internal error: invalid switch case"); } -void user_fcn_stack_frame::mark_scope (const symbol_record& sym, scope_flags flag) +void +user_fcn_stack_frame::mark_scope (const symbol_record& sym, scope_flags flag) { std::size_t frame_offset = sym.frame_offset (); @@ -4295,7 +4346,8 @@ set_scope_flag (data_offset, flag); } -void user_fcn_stack_frame::display (bool follow) const +void +user_fcn_stack_frame::display (bool follow) const { std::ostream& os = octave_stdout; @@ -4308,12 +4360,14 @@ display_scope (os, get_scope ()); } -void user_fcn_stack_frame::accept (stack_frame_walker& sfw) +void +user_fcn_stack_frame::accept (stack_frame_walker& sfw) { sfw.visit_user_fcn_stack_frame (*this); } -void user_fcn_stack_frame::break_closure_cycles (const std::shared_ptr& frame) +void +user_fcn_stack_frame::break_closure_cycles (const std::shared_ptr& frame) { for (auto& val : m_values) val.break_closure_cycles (frame); @@ -4322,7 +4376,8 @@ m_access_link->break_closure_cycles (frame); } -symbol_record scope_stack_frame::insert_symbol (const std::string& name) +symbol_record +scope_stack_frame::insert_symbol (const std::string& name) { // There is no access link for scope frames, so there is no other // frame to search in and the offset must be zero. @@ -4356,7 +4411,8 @@ return get_scope_flag (data_offset); } -octave_value scope_stack_frame::varval (const symbol_record& sym) const +octave_value +scope_stack_frame::varval (const symbol_record& sym) const { // There is no access link for scope frames, so the frame // offset must be zero. @@ -4389,7 +4445,8 @@ error ("internal error: invalid switch case"); } -octave_value& scope_stack_frame::varref (const symbol_record& sym +octave_value& +scope_stack_frame::varref (const symbol_record& sym #if defined (OCTAVE_ENABLE_BYTECODE_EVALUATOR) , bool deref_refs #endif @@ -4426,8 +4483,9 @@ error ("internal error: invalid switch case"); } -void scope_stack_frame::mark_scope (const symbol_record& sym, - scope_flags flag) +void +scope_stack_frame::mark_scope (const symbol_record& sym, + scope_flags flag) { // There is no access link for scope frames, so the frame // offset must be zero. @@ -4440,7 +4498,8 @@ set_scope_flag (data_offset, flag); } -void scope_stack_frame::display (bool follow) const +void +scope_stack_frame::display (bool follow) const { std::ostream& os = octave_stdout; @@ -4450,7 +4509,8 @@ display_scope (os, m_scope); } -void scope_stack_frame::accept (stack_frame_walker& sfw) +void +scope_stack_frame::accept (stack_frame_walker& sfw) { sfw.visit_scope_stack_frame (*this); } diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/syminfo.cc --- a/libinterp/corefcn/syminfo.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/syminfo.cc Tue Dec 12 23:14:33 2023 -0800 @@ -166,7 +166,8 @@ // FIXME: should we be using std::map instead of a list? -octave_value symbol_info_list::varval (const std::string& name) const +octave_value +symbol_info_list::varval (const std::string& name) const { for (const auto& syminfo : m_lst) { @@ -177,7 +178,8 @@ return octave_value (); } -std::list symbol_info_list::names () const +std::list +symbol_info_list::names () const { std::list retval; @@ -328,8 +330,9 @@ os << param_buf.str (); } -void symbol_info_list::display (std::ostream& os, - const std::string& format) const +void +symbol_info_list::display (std::ostream& os, + const std::string& format) const { if (! m_lst.empty ()) { diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/symrcm.cc --- a/libinterp/corefcn/symrcm.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/symrcm.cc Tue Dec 12 23:14:33 2023 -0800 @@ -334,7 +334,7 @@ static octave_idx_type calc_degrees (octave_idx_type N, octave_idx_type *cidx, octave_idx_type *ridx, - octave_idx_type *cidx2, octave_idx_type *ridx2, octave_idx_type *D) + octave_idx_type *cidx2, octave_idx_type *ridx2, octave_idx_type *D) { octave_idx_type max_deg = 0; for (octave_idx_type i = 0; i < N; i++) diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/symscope.cc --- a/libinterp/corefcn/symscope.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/symscope.cc Tue Dec 12 23:14:33 2023 -0800 @@ -51,7 +51,8 @@ return sym; } -void symbol_scope_rep::insert_symbol_record (symbol_record& sr) +void +symbol_scope_rep::insert_symbol_record (symbol_record& sr) { std::size_t data_offset = num_symbols (); std::string name = sr.name (); @@ -61,7 +62,8 @@ m_symbols[name] = sr; } -symbol_record symbol_scope_rep::insert (const std::string& name) +symbol_record +symbol_scope_rep::insert (const std::string& name) { table_iterator p = m_symbols.find (name); @@ -92,7 +94,8 @@ return p->second; } -std::list symbol_scope_rep::localfunctions () const +std::list +symbol_scope_rep::localfunctions () const { std::list retval; @@ -159,7 +162,8 @@ return octave_value (info_map); } -std::list symbol_scope_rep::symbol_list () const +std::list +symbol_scope_rep::symbol_list () const { std::list retval; @@ -271,7 +275,8 @@ return false; } -void symbol_scope_rep::mark_as_variable (const std::string& nm) +void +symbol_scope_rep::mark_as_variable (const std::string& nm) { table_iterator p = m_symbols.find (nm); @@ -279,13 +284,15 @@ p->second.mark_as_variable (); } -void symbol_scope_rep::mark_as_variables (const std::list& lst) +void +symbol_scope_rep::mark_as_variables (const std::list& lst) { for (const auto& nm : lst) mark_as_variable (nm); } -bool symbol_scope_rep::is_variable (const std::string& nm) const +bool +symbol_scope_rep::is_variable (const std::string& nm) const { table_const_iterator p = m_symbols.find (nm); @@ -304,7 +311,8 @@ return false; } -void symbol_scope_rep::update_nest () +void +symbol_scope_rep::update_nest () { auto t_parent = m_parent.lock (); @@ -335,9 +343,10 @@ scope_obj.update_nest (); } -bool symbol_scope_rep::look_nonlocal (const std::string& name, - std::size_t offset, - symbol_record& result) +bool +symbol_scope_rep::look_nonlocal (const std::string& name, + std::size_t offset, + symbol_record& result) { offset++; @@ -370,7 +379,8 @@ return false; } -std::list symbol_scope::localfunctions () const +std::list +symbol_scope::localfunctions () const { if (! m_rep) return std::list (); diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/symtab.cc --- a/libinterp/corefcn/symtab.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/symtab.cc Tue Dec 12 23:14:33 2023 -0800 @@ -57,14 +57,16 @@ install_builtins (); } -symbol_scope symbol_table::current_scope () const +symbol_scope +symbol_table::current_scope () const { tree_evaluator& tw = m_interpreter.get_evaluator (); return tw.get_current_scope (); } -bool symbol_table::is_built_in_function_name (const std::string& name) +bool +symbol_table::is_built_in_function_name (const std::string& name) { octave_value val = find_built_in_function (name); @@ -122,8 +124,9 @@ // FIXME: this function only finds legacy class methods, not // classdef methods. -octave_value symbol_table::find_method (const std::string& name, - const std::string& dispatch_type) +octave_value +symbol_table::find_method (const std::string& name, + const std::string& dispatch_type) { if (name.empty ()) return octave_value (); @@ -145,7 +148,8 @@ } } -octave_value symbol_table::find_built_in_function (const std::string& name) +octave_value +symbol_table::find_built_in_function (const std::string& name) { fcn_table_const_iterator p = m_fcn_table.find (name); @@ -164,7 +168,8 @@ } } -octave_value symbol_table::find_autoload (const std::string& name) +octave_value +symbol_table::find_autoload (const std::string& name) { if (name.empty ()) return octave_value (); @@ -307,7 +312,8 @@ } } -octave_value symbol_table::find_cmdline_function (const std::string& name) +octave_value +symbol_table::find_cmdline_function (const std::string& name) { if (name.empty ()) return octave_value (); @@ -329,8 +335,9 @@ } } -void symbol_table::install_cmdline_function (const std::string& name, - const octave_value& fcn) +void +symbol_table::install_cmdline_function (const std::string& name, + const octave_value& fcn) { auto p = m_fcn_table.find (name); @@ -353,9 +360,10 @@ // Install local function FCN named NAME. FILE_NAME is the name of // the file containing the local function. -void symbol_table::install_local_function (const std::string& name, - const octave_value& fcn, - const std::string& file_name) +void +symbol_table::install_local_function (const std::string& name, + const octave_value& fcn, + const std::string& file_name) { auto p = m_fcn_table.find (name); @@ -375,8 +383,9 @@ } } -void symbol_table::install_user_function (const std::string& name, - const octave_value& fcn) +void +symbol_table::install_user_function (const std::string& name, + const octave_value& fcn) { auto p = m_fcn_table.find (name); @@ -398,7 +407,8 @@ // FIXME: should we ensure that FCN really is a built-in function // object? -void symbol_table::install_built_in_function (const std::string& name, +void +symbol_table::install_built_in_function (const std::string& name, const octave_value& fcn) { auto p = m_fcn_table.find (name); @@ -423,7 +433,8 @@ // function with default values so that it will work properly with // unwind_protect. -void symbol_table::clear_functions (bool force) +void +symbol_table::clear_functions (bool force) { auto p = m_fcn_table.begin (); @@ -431,12 +442,14 @@ (p++)->second.clear (force); } -void symbol_table::clear_function (const std::string& name) +void +symbol_table::clear_function (const std::string& name) { clear_user_function (name); } -void symbol_table::clear_function_pattern (const std::string& pat) +void +symbol_table::clear_function_pattern (const std::string& pat) { symbol_match pattern (pat); @@ -451,7 +464,8 @@ } } -void symbol_table::clear_function_regexp (const std::string& pat) +void +symbol_table::clear_function_regexp (const std::string& pat) { regexp pattern (pat); @@ -466,7 +480,8 @@ } } -void symbol_table::clear_user_function (const std::string& name) +void +symbol_table::clear_user_function (const std::string& name) { auto p = m_fcn_table.find (name); @@ -482,7 +497,8 @@ } // This clears oct and mex files, including autoloads. -void symbol_table::clear_dld_function (const std::string& name) +void +symbol_table::clear_dld_function (const std::string& name) { auto p = m_fcn_table.find (name); @@ -495,7 +511,8 @@ } } -void symbol_table::clear_mex_functions () +void +symbol_table::clear_mex_functions () { auto p = m_fcn_table.begin (); @@ -507,8 +524,9 @@ // inferior to SUP_CLASS. Return FALSE if INF_CLASS is currently // marked as superior to SUP_CLASS. -bool symbol_table::set_class_relationship (const std::string& sup_class, - const std::string& inf_class) +bool +symbol_table::set_class_relationship (const std::string& sup_class, + const std::string& inf_class) { if (is_superiorto (inf_class, sup_class)) return false; @@ -534,7 +552,8 @@ // else // // No relation. -bool symbol_table::is_superiorto (const std::string& a, const std::string& b) +bool +symbol_table::is_superiorto (const std::string& a, const std::string& b) { class_precedence_table_const_iterator p = m_class_precedence_table.find (a); // If a has no entry in the precedence table, return false @@ -546,8 +565,9 @@ return (q != inferior_classes.end ()); } -void symbol_table::alias_built_in_function (const std::string& alias, - const std::string& name) +void +symbol_table::alias_built_in_function (const std::string& alias, + const std::string& name) { octave_value fcn = find_built_in_function (name); @@ -563,7 +583,8 @@ panic ("alias: '%s' is undefined", name.c_str ()); } -void symbol_table::install_built_in_dispatch (const std::string& name, +void +symbol_table::install_built_in_dispatch (const std::string& name, const std::string& klass) { auto p = m_fcn_table.find (name); @@ -578,7 +599,8 @@ error ("install_built_in_dispatch: '%s' is undefined", name.c_str ()); } -std::list symbol_table::user_function_names () +std::list +symbol_table::user_function_names () { std::list retval; @@ -594,7 +616,8 @@ return retval; } -std::list symbol_table::built_in_function_names () +std::list +symbol_table::built_in_function_names () { std::list retval; @@ -612,7 +635,8 @@ return retval; } -std::list symbol_table::cmdline_function_names () +std::list +symbol_table::cmdline_function_names () { std::list retval; @@ -650,7 +674,8 @@ return octave_value (info_map); } -octave_value symbol_table::dump () const +octave_value +symbol_table::dump () const { std::map m = {{ "function_info", dump_fcn_table_map () }, @@ -661,13 +686,15 @@ return octave_value (m); } -void symbol_table::add_to_parent_map (const std::string& classname, - const std::list& parent_list) +void +symbol_table::add_to_parent_map (const std::string& classname, + const std::list& parent_list) { m_parent_map[classname] = parent_list; } -std::list symbol_table::parent_classes (const std::string& dispatch_type) +std::list +symbol_table::parent_classes (const std::string& dispatch_type) { std::list retval; @@ -691,7 +718,8 @@ return retval; } -void symbol_table::cleanup () +void +symbol_table::cleanup () { clear_functions (); @@ -700,13 +728,15 @@ m_parent_map.clear (); } -fcn_info *symbol_table::get_fcn_info (const std::string& name) +fcn_info * +symbol_table::get_fcn_info (const std::string& name) { auto p = m_fcn_table.find (name); return p != m_fcn_table.end () ? &p->second : nullptr; } -octave_value symbol_table::dump_fcn_table_map () const +octave_value +symbol_table::dump_fcn_table_map () const { if (m_fcn_table.empty ()) return octave_value (Matrix ()); diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/sysdep.cc --- a/libinterp/corefcn/sysdep.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/sysdep.cc Tue Dec 12 23:14:33 2023 -0800 @@ -180,7 +180,8 @@ #endif -void set_application_id () +void +set_application_id () { #if defined (__MINGW32__) || defined (_MSC_VER) @@ -382,7 +383,8 @@ // Return TRUE if NAME refers to an existing drive letter or UNC share -bool drive_or_unc_share (const std::string& name) +bool +drive_or_unc_share (const std::string& name) { #if defined (OCTAVE_USE_WINDOWS_API) std::size_t len = name.length (); @@ -431,7 +433,8 @@ #endif } -void sysdep_init () +void +sysdep_init () { // Use a function from libgomp to force loading of OpenMP library. // Otherwise, a dynamically loaded library making use of OpenMP such @@ -449,7 +452,8 @@ #endif } -void sysdep_cleanup () +void +sysdep_cleanup () { #if defined (OCTAVE_USE_WINDOWS_API) // Let us fail immediately without displaying any dialog. @@ -469,7 +473,8 @@ // etc. are NOT disabled. // It doesn't matter whether an input \n is mapped to \r, or vice versa. -void raw_mode (bool on, bool wait) +void +raw_mode (bool on, bool wait) { static bool curr_on = false; @@ -617,7 +622,8 @@ curr_on = on; } -FILE * popen (const char *command, const char *mode) +FILE * +popen (const char *command, const char *mode) { #if defined (__MINGW32__) || defined (_MSC_VER) std::wstring wcommand = sys::u8_to_wstring (command); @@ -633,7 +639,8 @@ #endif } -int pclose (FILE *f) +int +pclose (FILE *f) { #if defined (__MINGW32__) || defined (_MSC_VER) return ::_pclose (f); @@ -644,7 +651,8 @@ // Read one character from the terminal. -int kbhit (bool wait) +int +kbhit (bool wait) { #if defined (HAVE__KBHIT) && defined (HAVE__GETCH) // This essentially means we are on a Windows system. @@ -688,7 +696,8 @@ return c; } -std::string get_P_tmpdir () +std::string +get_P_tmpdir () { #if defined (OCTAVE_USE_WINDOWS_API) diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/tsearch.cc --- a/libinterp/corefcn/tsearch.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/tsearch.cc Tue Dec 12 23:14:33 2023 -0800 @@ -37,12 +37,14 @@ OCTAVE_BEGIN_NAMESPACE(octave) -inline double max (double a, double b, double c) +inline double +max (double a, double b, double c) { return (a > b) ? (a > c ? a : c) : (b > c ? b : c); } -inline double min (double a, double b, double c) +inline double +min (double a, double b, double c) { return (a < b) ? (a < c ? a : c) : (b < c ? b : c); } diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/url-handle-manager.cc --- a/libinterp/corefcn/url-handle-manager.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/url-handle-manager.cc Tue Dec 12 23:14:33 2023 -0800 @@ -43,7 +43,8 @@ return (rand () + 1.0) / maxrand; } -url_handle url_handle_manager::get_handle () +url_handle +url_handle_manager::get_handle () { url_handle retval; @@ -68,7 +69,8 @@ return retval; } -void url_handle_manager::free (const url_handle& h) +void +url_handle_manager::free (const url_handle& h) { if (h.ok ()) { diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/utils.cc --- a/libinterp/corefcn/utils.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/utils.cc Tue Dec 12 23:14:33 2023 -0800 @@ -88,7 +88,8 @@ return true; } -bool valid_identifier (const std::string& s) +bool +valid_identifier (const std::string& s) { return valid_identifier (s.c_str ()); } @@ -292,7 +293,8 @@ // Return TRUE if F and G are both names for the same file. -bool same_file (const std::string& f, const std::string& g) +bool +same_file (const std::string& f, const std::string& g) { return sys::same_file (f, g); } @@ -406,8 +408,9 @@ %!error is_same_file ({"1", "2"}, {"1"; "2"}) */ -int almost_match (const std::string& std, const std::string& s, - int min_match_len, int case_sens) +int +almost_match (const std::string& std, const std::string& s, + int min_match_len, int case_sens) { int stdlen = std.length (); int slen = s.length (); @@ -421,9 +424,10 @@ // Ugh. -int keyword_almost_match (const char *const *std, int *min_len, - const std::string& s, - int min_toks_to_match, int max_toks) +int +keyword_almost_match (const char *const *std, int *min_len, + const std::string& s, + int min_toks_to_match, int max_toks) { int status = 0; int tok_count = 0; @@ -509,8 +513,9 @@ // See if the given file is in the path. -std::string search_path_for_file (const std::string& path, - const string_vector& names) +std::string +search_path_for_file (const std::string& path, + const string_vector& names) { directory_path p (path); @@ -519,8 +524,9 @@ // Find all locations of the given file in the path. -string_vector search_path_for_all_files (const std::string& path, - const string_vector& names) +string_vector +search_path_for_all_files (const std::string& path, + const string_vector& names) { directory_path p (path); @@ -534,7 +540,8 @@ return sv; } -static string_vector make_absolute (const string_vector& sv) +static string_vector +make_absolute (const string_vector& sv) { octave_idx_type len = sv.numel (); @@ -687,7 +694,8 @@ %!error file_in_path (path (), "plot.m", "bar") */ -std::string file_in_path (const std::string& name, const std::string& suffix) +std::string +file_in_path (const std::string& name, const std::string& suffix) { std::string nm = name; @@ -699,9 +707,10 @@ return sys::env::make_absolute (lp.find_file (nm)); } -std::string find_data_file_in_load_path (const std::string& fcn, - const std::string& file, - bool require_regular_file) +std::string +find_data_file_in_load_path (const std::string& fcn, + const std::string& file, + bool require_regular_file) { std::string fname = file; @@ -736,7 +745,8 @@ // See if there is a function file in the path. // If so, return the full path to the file. -std::string fcn_file_in_path (const std::string& name) +std::string +fcn_file_in_path (const std::string& name) { std::string retval; @@ -774,7 +784,8 @@ // See if there is a directory called "name" in the path and if it // contains a Contents.m file. If so, return the full path to this file. -std::string contents_file_in_path (const std::string& dir) +std::string +contents_file_in_path (const std::string& dir) { std::string retval; @@ -794,7 +805,8 @@ // Replace backslash escapes in a string with the real values. -std::string do_string_escapes (const std::string& s) +std::string +do_string_escapes (const std::string& s) { std::string retval; @@ -975,7 +987,8 @@ %!warning do_string_escapes ('\G'); */ -const char * undo_string_escape (char c) +const char * +undo_string_escape (char c) { switch (c) { @@ -1019,7 +1032,8 @@ } } -std::string undo_string_escapes (const std::string& s) +std::string +undo_string_escapes (const std::string& s) { std::string retval; @@ -1297,8 +1311,9 @@ %!error errno_list ("foo") */ -static void check_dimensions (octave_idx_type& nr, octave_idx_type& nc, - const char *warnfor) +static void +check_dimensions (octave_idx_type& nr, octave_idx_type& nc, + const char *warnfor) { if (nr < 0 || nc < 0) { @@ -1310,7 +1325,8 @@ } } -void check_dimensions (dim_vector& dim, const char *warnfor) +void +check_dimensions (dim_vector& dim, const char *warnfor) { bool neg = false; @@ -1328,8 +1344,9 @@ "%s: converting negative dimension to zero", warnfor); } -void get_dimensions (const octave_value& a, const char *warn_for, - dim_vector& dim) +void +get_dimensions (const octave_value& a, const char *warn_for, + dim_vector& dim) { // We support dimensions to be specified by a vector, even if it's empty. // If the vector is empty, the final dimensions end up being 0x0. @@ -1357,8 +1374,9 @@ check_dimensions (dim, warn_for); } -void get_dimensions (const octave_value& a, const char *warn_for, - octave_idx_type& nr, octave_idx_type& nc) +void +get_dimensions (const octave_value& a, const char *warn_for, + octave_idx_type& nr, octave_idx_type& nc) { if (a.is_scalar_type ()) { @@ -1380,9 +1398,10 @@ check_dimensions (nr, nc, warn_for); } -void get_dimensions (const octave_value& a, const octave_value& b, - const char *warn_for, octave_idx_type& nr, - octave_idx_type& nc) +void +get_dimensions (const octave_value& a, const octave_value& b, + const char *warn_for, octave_idx_type& nr, + octave_idx_type& nc) { nr = (a.isempty () ? 0 : a.idx_type_value (true)); nc = (b.isempty () ? 0 : b.idx_type_value (true)); @@ -1390,8 +1409,9 @@ check_dimensions (nr, nc, warn_for); } -octave_idx_type dims_to_numel (const dim_vector& dims, - const octave_value_list& idx_arg) +octave_idx_type +dims_to_numel (const dim_vector& dims, + const octave_value_list& idx_arg) { octave_idx_type retval; @@ -1429,7 +1449,8 @@ return retval; } -Matrix identity_matrix (octave_idx_type nr, octave_idx_type nc) +Matrix +identity_matrix (octave_idx_type nr, octave_idx_type nc) { Matrix m (nr, nc, 0.0); @@ -1444,7 +1465,8 @@ return m; } -FloatMatrix float_identity_matrix (octave_idx_type nr, octave_idx_type nc) +FloatMatrix +float_identity_matrix (octave_idx_type nr, octave_idx_type nc) { FloatMatrix m (nr, nc, 0.0); @@ -1459,7 +1481,8 @@ return m; } -std::size_t format (std::ostream& os, const char *fmt, ...) +std::size_t +format (std::ostream& os, const char *fmt, ...) { std::size_t retval; @@ -1473,7 +1496,8 @@ return retval; } -std::size_t vformat (std::ostream& os, const char *fmt, va_list args) +std::size_t +vformat (std::ostream& os, const char *fmt, va_list args) { std::string s = vasprintf (fmt, args); @@ -1482,7 +1506,8 @@ return s.length (); } -std::string vasprintf (const char *fmt, va_list args) +std::string +vasprintf (const char *fmt, va_list args) { std::string retval; @@ -1499,7 +1524,8 @@ return retval; } -std::string asprintf (const char *fmt, ...) +std::string +asprintf (const char *fmt, ...) { std::string retval; @@ -1518,7 +1544,8 @@ // won't respond to SIGINT. Maybe there is a better way than // breaking this up into multiple shorter intervals? -void sleep (double seconds, bool do_graphics_events) +void +sleep (double seconds, bool do_graphics_events) { if (seconds <= 0) return; diff -r a2be40ce8fec -r 60515d0cd023 libinterp/corefcn/xnorm.cc --- a/libinterp/corefcn/xnorm.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/corefcn/xnorm.cc Tue Dec 12 23:14:33 2023 -0800 @@ -92,7 +92,8 @@ return retval; } -octave_value xcolnorms (const octave_value& x, const octave_value& p) +octave_value +xcolnorms (const octave_value& x, const octave_value& p) { octave_value retval; @@ -131,7 +132,8 @@ return retval; } -octave_value xrownorms (const octave_value& x, const octave_value& p) +octave_value +xrownorms (const octave_value& x, const octave_value& p) { octave_value retval; @@ -170,7 +172,8 @@ return retval; } -octave_value xfrobnorm (const octave_value& x) +octave_value +xfrobnorm (const octave_value& x) { octave_value retval; diff -r a2be40ce8fec -r 60515d0cd023 libinterp/dldfcn/__init_fltk__.cc --- a/libinterp/dldfcn/__init_fltk__.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/dldfcn/__init_fltk__.cc Tue Dec 12 23:14:33 2023 -0800 @@ -296,7 +296,8 @@ } }; -static void script_cb (Fl_Widget *, void *data) +static void +script_cb (Fl_Widget *, void *data) { static_cast (data)->execute_menuselectedfcn (); } diff -r a2be40ce8fec -r 60515d0cd023 libinterp/octave-value/ov-base.cc --- a/libinterp/octave-value/ov-base.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/octave-value/ov-base.cc Tue Dec 12 23:14:33 2023 -0800 @@ -63,7 +63,8 @@ #include "variables.h" #include "ov-inline.h" -builtin_type_t btyp_mixed_numeric (builtin_type_t x, builtin_type_t y) +builtin_type_t +btyp_mixed_numeric (builtin_type_t x, builtin_type_t y) { builtin_type_t retval = btyp_unknown; diff -r a2be40ce8fec -r 60515d0cd023 libinterp/octave-value/ov-bool-mat.cc --- a/libinterp/octave-value/ov-bool-mat.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/octave-value/ov-bool-mat.cc Tue Dec 12 23:14:33 2023 -0800 @@ -363,7 +363,7 @@ const bool *mtmp = m_matrix.data (); octave_idx_type nel = m_matrix.numel (); - os.write (reinterpret_cast (mtmp), nel); + os.write (reinterpret_cast (mtmp), nel); return true; } @@ -465,7 +465,7 @@ retval = H5Dwrite (data_hid, H5T_NATIVE_HBOOL, octave_H5S_ALL, octave_H5S_ALL, octave_H5P_DEFAULT, - reinterpret_cast (mtmp)) >= 0; + reinterpret_cast (mtmp)) >= 0; H5Dclose (data_hid); H5Sclose (space_hid); diff -r a2be40ce8fec -r 60515d0cd023 libinterp/octave-value/ov-cell.cc --- a/libinterp/octave-value/ov-cell.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/octave-value/ov-cell.cc Tue Dec 12 23:14:33 2023 -0800 @@ -144,7 +144,8 @@ DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_cell, "cell", "cell"); -void octave_cell::break_closure_cycles (const std::shared_ptr& frame) +void +octave_cell::break_closure_cycles (const std::shared_ptr& frame) { for (octave_idx_type i = 0; i < m_matrix.numel (); i++) m_matrix(i).break_closure_cycles (frame); diff -r a2be40ce8fec -r 60515d0cd023 libinterp/octave-value/ov-ch-mat.cc --- a/libinterp/octave-value/ov-ch-mat.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/octave-value/ov-ch-mat.cc Tue Dec 12 23:14:33 2023 -0800 @@ -243,7 +243,8 @@ // there's no need to fuck around. The exceptions are isascii and // toascii, which are not C++. Oddly enough, all those character // functions are int (*) (int), even in C++. Wicked! -static inline int xisascii (int c) +static inline int +xisascii (int c) { #if defined (HAVE_ISASCII) return isascii (c); diff -r a2be40ce8fec -r 60515d0cd023 libinterp/octave-value/ov-class.cc --- a/libinterp/octave-value/ov-class.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/octave-value/ov-class.cc Tue Dec 12 23:14:33 2023 -0800 @@ -69,7 +69,7 @@ octave_class::register_type (octave::type_info& ti) { s_t_id = ti.register_type (octave_class::s_t_name, "", - octave_value (new octave_class ())); + octave_value (new octave_class ())); } octave_class::octave_class (const octave_map& m, const std::string& id, @@ -494,14 +494,14 @@ // and the caller to subsref accepts more that one output, return // the elements as a comma-separated list so that we can pass it to the // evaluator - if (retval.length () > 1 && (nargout < 0 || nargout >1)) + if (retval.length () > 1 && (nargout < 0 || nargout > 1)) { - if (nargout <= 0 || nargout>=retval.length()) + if (nargout <= 0 || nargout >= retval.length ()) // Take the whole list retval = octave_value (retval); else // Take nargout elements of the list - retval = octave_value(retval.slice(0,nargout)); + retval = octave_value (retval.slice (0, nargout)); } } else @@ -1446,7 +1446,8 @@ goto error_cleanup; // Add the class name to the group - type_hid = H5Tcopy (H5T_C_S1); H5Tset_size (type_hid, m_c_name.length () + 1); + type_hid = H5Tcopy (H5T_C_S1); + H5Tset_size (type_hid, m_c_name.length () + 1); if (type_hid < 0) goto error_cleanup; diff -r a2be40ce8fec -r 60515d0cd023 libinterp/octave-value/ov-classdef.cc --- a/libinterp/octave-value/ov-classdef.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/octave-value/ov-classdef.cc Tue Dec 12 23:14:33 2023 -0800 @@ -65,7 +65,7 @@ octave_classdef::register_type (octave::type_info& ti) { s_t_id = ti.register_type (octave_classdef::s_t_name, "", - octave_value (new octave_classdef ())); + octave_value (new octave_classdef ())); } octave_value_list @@ -120,14 +120,14 @@ // and the caller to subsref accepts more that one output, return // the elements as a comma-separated list so that we can pass it to the // evaluator - if (retval.length () > 1 && (nargout < 0 || nargout >1)) + if (retval.length () > 1 && (nargout < 0 || nargout > 1)) { - if (nargout <= 0 || nargout>=retval.length()) + if (nargout <= 0 || nargout >= retval.length ()) // Take the whole list retval = octave_value (retval); else // Take nargout elements of the list - retval = octave_value(retval.slice(0,nargout)); + retval = octave_value (retval.slice (0, nargout)); } return retval; @@ -439,7 +439,8 @@ return octave::to_ov (octave::lookup_class (cls)); } -bool octave_classdef_meta::is_classdef_method (const std::string& cname) const +bool +octave_classdef_meta::is_classdef_method (const std::string& cname) const { bool retval = false; @@ -458,7 +459,8 @@ return retval; } -bool octave_classdef_meta::is_classdef_constructor (const std::string& cname) const +bool +octave_classdef_meta::is_classdef_constructor (const std::string& cname) const { bool retval = false; @@ -478,7 +480,8 @@ return retval; } -std::string octave_classdef_meta::doc_string (const std::string& meth_name) const +std::string +octave_classdef_meta::doc_string (const std::string& meth_name) const { if (m_object.is_class ()) { @@ -496,7 +499,8 @@ return ""; } -std::string octave_classdef_meta::file_name () const +std::string +octave_classdef_meta::file_name () const { if (m_object.is_class ()) { @@ -615,7 +619,8 @@ return retval; } -bool octave_classdef_superclass_ref::is_constructed_object (octave::tree_evaluator& tw, +bool +octave_classdef_superclass_ref::is_constructed_object (octave::tree_evaluator& tw, const std::string& nm) { octave_function *of = tw.current_function (); diff -r a2be40ce8fec -r 60515d0cd023 libinterp/octave-value/ov-fcn-handle.cc --- a/libinterp/octave-value/ov-fcn-handle.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/octave-value/ov-fcn-handle.cc Tue Dec 12 23:14:33 2023 -0800 @@ -829,20 +829,23 @@ extern bool is_equal_to (const anonymous_fcn_handle& fh1, const anonymous_fcn_handle& fh2); -static void err_invalid_fcn_handle (const std::string& name) +static void +err_invalid_fcn_handle (const std::string& name) { error ("invalid function handle, unable to find function for @%s", name.c_str ()); } -octave_value base_fcn_handle::make_weak_nested_handle () const +octave_value +base_fcn_handle::make_weak_nested_handle () const { std::string type_str = type (); error ("invalid conversion from %s handle to weak nestead handle", type_str.c_str ()); } -octave_value base_fcn_handle::make_weak_anonymous_handle () const +octave_value +base_fcn_handle::make_weak_anonymous_handle () const { std::string type_str = type (); error ("invalid conversion from %s handle to weak anonymous handle", @@ -940,7 +943,8 @@ return true; } -void base_fcn_handle::warn_load (const char *file_type) const +void +base_fcn_handle::warn_load (const char *file_type) const { std::string obj_type = type (); @@ -950,7 +954,8 @@ obj_type.c_str (), file_type); } -void base_fcn_handle::warn_save (const char *file_type) const +void +base_fcn_handle::warn_save (const char *file_type) const { std::string obj_type = type (); @@ -960,7 +965,8 @@ obj_type.c_str (), file_type); } -void base_fcn_handle::unimplemented (const char *op, const char *fmt) const +void +base_fcn_handle::unimplemented (const char *op, const char *fmt) const { std::string htype = type (); @@ -982,7 +988,8 @@ return interp.feval (m_fcn, args, nargout); } -octave_scalar_map internal_fcn_handle::info () +octave_scalar_map +internal_fcn_handle::info () { octave_scalar_map m; @@ -993,8 +1000,9 @@ return m; } -bool is_equal_to (const internal_fcn_handle& fh1, - const internal_fcn_handle& fh2) +bool +is_equal_to (const internal_fcn_handle& fh1, + const internal_fcn_handle& fh2) { if (fh1.m_name == fh2.m_name && fh1.m_fcn.is_defined () && fh2.m_fcn.is_defined ()) @@ -1410,7 +1418,8 @@ return interp.feval (fcn_to_call, args, nargout); } -octave_function *simple_fcn_handle::function_value (bool) +octave_function * +simple_fcn_handle::function_value (bool) { // FIXME: Shouldn't the lookup rules here match those used in the // call method? @@ -1429,7 +1438,8 @@ return m_fcn.is_defined () ? m_fcn.function_value () : nullptr; } -octave_user_function *simple_fcn_handle::user_function_value (bool) +octave_user_function * +simple_fcn_handle::user_function_value (bool) { // FIXME: Shouldn't the lookup rules here match those used in the // call method? @@ -1448,7 +1458,8 @@ return m_fcn.is_defined () ? m_fcn.user_function_value () : nullptr; } -octave_value simple_fcn_handle::fcn_val () +octave_value +simple_fcn_handle::fcn_val () { if (m_fcn.is_defined ()) return m_fcn; @@ -1464,7 +1475,8 @@ return m_fcn; } -octave_scalar_map simple_fcn_handle::info () +octave_scalar_map +simple_fcn_handle::info () { octave_scalar_map m; @@ -1476,7 +1488,8 @@ return m; } -bool simple_fcn_handle::save_ascii (std::ostream& os) +bool +simple_fcn_handle::save_ascii (std::ostream& os) { os << "# octaveroot: " << config::octave_exec_home () << "\n"; @@ -1491,7 +1504,8 @@ return true; } -bool simple_fcn_handle::load_ascii (std::istream& is) +bool +simple_fcn_handle::load_ascii (std::istream& is) { // FIXME: If m_file is not empty, try to load the file and define // the function? Is it an error if that fails? Or should this job @@ -1500,7 +1514,8 @@ return is.good (); } -bool simple_fcn_handle::save_binary (std::ostream& os, bool) +bool +simple_fcn_handle::save_binary (std::ostream& os, bool) { std::ostringstream nmbuf; @@ -1518,14 +1533,16 @@ return true; } -bool simple_fcn_handle::load_binary (std::istream& is, bool, - mach_info::float_format) +bool +simple_fcn_handle::load_binary (std::istream& is, bool, + mach_info::float_format) { return is.good (); } -bool simple_fcn_handle::save_hdf5 (octave_hdf5_id loc_id, const char *name, - bool) +bool +simple_fcn_handle::save_hdf5 (octave_hdf5_id loc_id, const char *name, + bool) { #if defined (HAVE_HDF5) @@ -1674,9 +1691,10 @@ #endif } -bool simple_fcn_handle::load_hdf5 (octave_hdf5_id& group_hid, - octave_hdf5_id& space_hid, - octave_hdf5_id& type_hid) +bool +simple_fcn_handle::load_hdf5 (octave_hdf5_id& group_hid, + octave_hdf5_id& space_hid, + octave_hdf5_id& type_hid) { #if defined (HAVE_HDF5) @@ -1699,14 +1717,16 @@ #endif } -void simple_fcn_handle::print_raw (std::ostream& os, bool pr_as_read_syntax, - int current_print_indent_level) const +void +simple_fcn_handle::print_raw (std::ostream& os, bool pr_as_read_syntax, + int current_print_indent_level) const { octave_print_internal (os, '@' + m_name, pr_as_read_syntax, current_print_indent_level); } -bool is_equal_to (const simple_fcn_handle& fh1, const simple_fcn_handle& fh2) +bool +is_equal_to (const simple_fcn_handle& fh1, const simple_fcn_handle& fh2) { if (fh1.m_name == fh2.m_name) { @@ -1758,7 +1778,8 @@ return interp.feval (m_fcn, args, nargout); } -octave_scalar_map scoped_fcn_handle::info () +octave_scalar_map +scoped_fcn_handle::info () { octave_scalar_map m; @@ -1771,7 +1792,8 @@ return m; } -bool scoped_fcn_handle::save_ascii (std::ostream& os) +bool +scoped_fcn_handle::save_ascii (std::ostream& os) { os << "# octaveroot: " << config::octave_exec_home () << "\n"; @@ -1789,7 +1811,8 @@ return os.good (); } -bool scoped_fcn_handle::load_ascii (std::istream& is) +bool +scoped_fcn_handle::load_ascii (std::istream& is) { octave_cell ov_cell; ov_cell.load_ascii (is); @@ -1805,7 +1828,8 @@ return is.good (); } -bool scoped_fcn_handle::save_binary (std::ostream& os, bool save_as_floats) +bool +scoped_fcn_handle::save_binary (std::ostream& os, bool save_as_floats) { std::ostringstream nmbuf; @@ -1825,8 +1849,9 @@ return os.good (); } -bool scoped_fcn_handle::load_binary (std::istream& is, bool swap, - mach_info::float_format fmt) +bool +scoped_fcn_handle::load_binary (std::istream& is, bool swap, + mach_info::float_format fmt) { octave_cell ov_cell; ov_cell.load_binary (is, swap, fmt); @@ -1842,8 +1867,9 @@ return is.good (); } -bool scoped_fcn_handle::save_hdf5 (octave_hdf5_id loc_id, const char *name, - bool) +bool +scoped_fcn_handle::save_hdf5 (octave_hdf5_id loc_id, const char *name, + bool) { #if defined (HAVE_HDF5) @@ -1868,9 +1894,10 @@ #endif } -bool scoped_fcn_handle::load_hdf5 (octave_hdf5_id& group_hid, - octave_hdf5_id& space_hid, - octave_hdf5_id& type_hid) +bool +scoped_fcn_handle::load_hdf5 (octave_hdf5_id& group_hid, + octave_hdf5_id& space_hid, + octave_hdf5_id& type_hid) { #if defined (HAVE_HDF5) @@ -1895,15 +1922,17 @@ #endif } -void scoped_fcn_handle::print_raw (std::ostream& os, - bool pr_as_read_syntax, - int current_print_indent_level) const +void +scoped_fcn_handle::print_raw (std::ostream& os, + bool pr_as_read_syntax, + int current_print_indent_level) const { octave_print_internal (os, '@' + m_name, pr_as_read_syntax, current_print_indent_level); } -bool is_equal_to (const scoped_fcn_handle& fh1, const scoped_fcn_handle& fh2) +bool +is_equal_to (const scoped_fcn_handle& fh1, const scoped_fcn_handle& fh2) { if (fh1.m_name == fh2.m_name && fh2.m_parentage == fh2.m_parentage @@ -1913,7 +1942,8 @@ return false; } -void scoped_fcn_handle::find_function () +void +scoped_fcn_handle::find_function () { // Since a scoped function is not visible by itself, try to load the // file named in m_file then find and define the scoped function. @@ -1970,7 +2000,8 @@ } } -octave_scalar_map base_nested_fcn_handle::info () +octave_scalar_map +base_nested_fcn_handle::info () { octave_scalar_map m; @@ -1991,7 +2022,8 @@ // Is it an error if that fails? Or should this job always be // deferred until the handle is used? -bool base_nested_fcn_handle::save_ascii (std::ostream& os) +bool +base_nested_fcn_handle::save_ascii (std::ostream& os) { unimplemented ("save", "text"); @@ -2000,7 +2032,8 @@ return true; } -bool base_nested_fcn_handle::load_ascii (std::istream& is) +bool +base_nested_fcn_handle::load_ascii (std::istream& is) { unimplemented ("load", "text"); @@ -2009,8 +2042,9 @@ return true; } -bool base_nested_fcn_handle::save_binary (std::ostream& os, - bool save_as_floats) +bool +base_nested_fcn_handle::save_binary (std::ostream& os, + bool save_as_floats) { unimplemented ("save", "binary"); @@ -2020,8 +2054,9 @@ return true; } -bool base_nested_fcn_handle::load_binary (std::istream& is, bool swap, - mach_info::float_format fmt) +bool +base_nested_fcn_handle::load_binary (std::istream& is, bool swap, + mach_info::float_format fmt) { unimplemented ("load", "binary"); @@ -2032,8 +2067,9 @@ return true; } -bool base_nested_fcn_handle::save_hdf5 (octave_hdf5_id loc_id, - const char *name, bool) +bool +base_nested_fcn_handle::save_hdf5 (octave_hdf5_id loc_id, + const char *name, bool) { #if defined (HAVE_HDF5) @@ -2056,9 +2092,10 @@ #endif } -bool base_nested_fcn_handle::load_hdf5 (octave_hdf5_id& group_hid, - octave_hdf5_id& space_hid, - octave_hdf5_id& type_hid) +bool +base_nested_fcn_handle::load_hdf5 (octave_hdf5_id& group_hid, + octave_hdf5_id& space_hid, + octave_hdf5_id& type_hid) { #if defined (HAVE_HDF5) @@ -2081,15 +2118,17 @@ #endif } -void base_nested_fcn_handle::print_raw (std::ostream& os, - bool pr_as_read_syntax, - int current_print_indent_level) const +void +base_nested_fcn_handle::print_raw (std::ostream& os, + bool pr_as_read_syntax, + int current_print_indent_level) const { octave_print_internal (os, '@' + m_name, pr_as_read_syntax, current_print_indent_level); } -octave_value nested_fcn_handle::make_weak_nested_handle () const +octave_value +nested_fcn_handle::make_weak_nested_handle () const { return octave_value (new octave_fcn_handle (new weak_nested_fcn_handle (*this))); @@ -2114,12 +2153,14 @@ return oct_usr_fcn->execute (tw, nargout, args); } -octave_value nested_fcn_handle::workspace () const +octave_value +nested_fcn_handle::workspace () const { return m_stack_context->workspace (); } -bool is_equal_to (const nested_fcn_handle& fh1, const nested_fcn_handle& fh2) +bool +is_equal_to (const nested_fcn_handle& fh1, const nested_fcn_handle& fh2) { if (fh1.m_name == fh2.m_name && fh1.m_fcn.is_defined () && fh2.m_fcn.is_defined ()) @@ -2144,15 +2185,17 @@ return oct_usr_fcn->execute (tw, nargout, args); } -octave_value weak_nested_fcn_handle::workspace () const +octave_value +weak_nested_fcn_handle::workspace () const { std::shared_ptr frames = m_stack_context.lock (); return frames ? frames->workspace () : octave_value (); } -bool is_equal_to (const weak_nested_fcn_handle& fh1, - const weak_nested_fcn_handle& fh2) +bool +is_equal_to (const weak_nested_fcn_handle& fh1, + const weak_nested_fcn_handle& fh2) { if (fh1.m_name == fh2.m_name && fh1.m_fcn.is_defined () && fh2.m_fcn.is_defined ()) @@ -2212,7 +2255,8 @@ return interp.feval (fcn_name (), args, nargout); } -octave_scalar_map class_simple_fcn_handle::info () +octave_scalar_map +class_simple_fcn_handle::info () { octave_scalar_map m; @@ -2229,7 +2273,8 @@ // function? Is it an error if that fails? Or should this job always // be deferred until the handle is used? -bool class_simple_fcn_handle::save_ascii (std::ostream& os) +bool +class_simple_fcn_handle::save_ascii (std::ostream& os) { unimplemented ("save", "text"); @@ -2238,7 +2283,8 @@ return true; } -bool class_simple_fcn_handle::load_ascii (std::istream& is) +bool +class_simple_fcn_handle::load_ascii (std::istream& is) { unimplemented ("load", "text"); @@ -2247,8 +2293,9 @@ return true; } -bool class_simple_fcn_handle::save_binary (std::ostream& os, - bool save_as_floats) +bool +class_simple_fcn_handle::save_binary (std::ostream& os, + bool save_as_floats) { unimplemented ("save", "binary"); @@ -2258,8 +2305,9 @@ return true; } -bool class_simple_fcn_handle::load_binary (std::istream& is, bool swap, - mach_info::float_format fmt) +bool +class_simple_fcn_handle::load_binary (std::istream& is, bool swap, + mach_info::float_format fmt) { unimplemented ("load", "binary"); @@ -2270,8 +2318,9 @@ return true; } -bool class_simple_fcn_handle::save_hdf5 (octave_hdf5_id loc_id, - const char *name, bool) +bool +class_simple_fcn_handle::save_hdf5 (octave_hdf5_id loc_id, + const char *name, bool) { #if defined (HAVE_HDF5) @@ -2294,9 +2343,10 @@ #endif } -bool class_simple_fcn_handle::load_hdf5 (octave_hdf5_id& group_hid, - octave_hdf5_id& space_hid, - octave_hdf5_id& type_hid) +bool +class_simple_fcn_handle::load_hdf5 (octave_hdf5_id& group_hid, + octave_hdf5_id& space_hid, + octave_hdf5_id& type_hid) { #if defined (HAVE_HDF5) @@ -2319,16 +2369,18 @@ #endif } -void class_simple_fcn_handle::print_raw (std::ostream& os, - bool pr_as_read_syntax, - int current_print_indent_level) const +void +class_simple_fcn_handle::print_raw (std::ostream& os, + bool pr_as_read_syntax, + int current_print_indent_level) const { octave_print_internal (os, '@' + m_name, pr_as_read_syntax, current_print_indent_level); } -bool is_equal_to (const class_simple_fcn_handle& fh1, - const class_simple_fcn_handle& fh2) +bool +is_equal_to (const class_simple_fcn_handle& fh1, + const class_simple_fcn_handle& fh2) { // FIXME: Also need to check object values are equivalent? @@ -2341,7 +2393,8 @@ const std::string base_anonymous_fcn_handle::anonymous ("@"); -octave_scalar_map base_anonymous_fcn_handle::info () +octave_scalar_map +base_anonymous_fcn_handle::info () { octave_scalar_map m; @@ -2357,7 +2410,8 @@ return m; } -bool base_anonymous_fcn_handle::save_ascii (std::ostream& os) +bool +base_anonymous_fcn_handle::save_ascii (std::ostream& os) { // FIXME: can we ensure that m_fcn is always defined? @@ -2385,7 +2439,8 @@ return true; } -bool base_anonymous_fcn_handle::load_ascii (std::istream& is) +bool +base_anonymous_fcn_handle::load_ascii (std::istream& is) { octave::skip_preceeding_newline (is); @@ -2443,8 +2498,9 @@ return false; } -bool base_anonymous_fcn_handle::save_binary (std::ostream& os, - bool save_as_floats) +bool +base_anonymous_fcn_handle::save_binary (std::ostream& os, + bool save_as_floats) { // FIXME: can we ensure that m_fcn is always defined? @@ -2484,8 +2540,9 @@ return true; } -bool base_anonymous_fcn_handle::load_binary (std::istream& is, bool swap, - mach_info::float_format fmt) +bool +base_anonymous_fcn_handle::load_binary (std::istream& is, bool swap, + mach_info::float_format fmt) { // Read extra characters in m_name as the number of local variable // values in this anonymous function. @@ -2551,9 +2608,10 @@ return false; } -bool base_anonymous_fcn_handle::save_hdf5 (octave_hdf5_id loc_id, - const char *name, - bool save_as_floats) +bool +base_anonymous_fcn_handle::save_hdf5 (octave_hdf5_id loc_id, + const char *name, + bool save_as_floats) { #if defined (HAVE_HDF5) @@ -2718,9 +2776,10 @@ #endif } -bool base_anonymous_fcn_handle::load_hdf5 (octave_hdf5_id& group_hid, - octave_hdf5_id& space_hid, - octave_hdf5_id& type_hid) +bool +base_anonymous_fcn_handle::load_hdf5 (octave_hdf5_id& group_hid, + octave_hdf5_id& space_hid, + octave_hdf5_id& type_hid) { #if defined (HAVE_HDF5) @@ -2884,7 +2943,8 @@ #endif } -void base_anonymous_fcn_handle::print_raw (std::ostream& os, bool, int) const +void +base_anonymous_fcn_handle::print_raw (std::ostream& os, bool, int) const { tree_print_code tpc (os); @@ -2925,7 +2985,8 @@ tpc.print_fcn_handle_body (e); } -bool base_anonymous_fcn_handle::parse (const std::string& fcn_text) +bool +base_anonymous_fcn_handle::parse (const std::string& fcn_text) { // FIXME: If evaluation of the string gives us an anonymous function // handle object, then why extract the function and create a new @@ -2981,7 +3042,8 @@ m_stack_context->mark_closure_context (); } -octave_value anonymous_fcn_handle::make_weak_anonymous_handle () const +octave_value +anonymous_fcn_handle::make_weak_anonymous_handle () const { return octave_value (new octave_fcn_handle (new weak_anonymous_fcn_handle (*this))); @@ -3025,7 +3087,8 @@ #endif -octave_value anonymous_fcn_handle::workspace () const +octave_value +anonymous_fcn_handle::workspace () const { octave_scalar_map local_vars_map; @@ -3054,8 +3117,9 @@ return retval; } -bool is_equal_to (const anonymous_fcn_handle& fh1, - const anonymous_fcn_handle& fh2) +bool +is_equal_to (const anonymous_fcn_handle& fh1, + const anonymous_fcn_handle& fh2) { if (fh1.m_fcn.is_defined () && fh2.m_fcn.is_defined ()) return fh1.m_fcn.is_copy_of (fh2.m_fcn); @@ -3079,7 +3143,8 @@ return oct_usr_fcn->execute (tw, nargout, args); } -octave_value weak_anonymous_fcn_handle::workspace () const +octave_value +weak_anonymous_fcn_handle::workspace () const { octave_scalar_map local_vars_map; @@ -3112,8 +3177,9 @@ return retval; } -bool is_equal_to (const weak_anonymous_fcn_handle& fh1, - const weak_anonymous_fcn_handle& fh2) +bool +is_equal_to (const weak_anonymous_fcn_handle& fh1, + const weak_anonymous_fcn_handle& fh2) { if (fh1.m_name == fh2.m_name && fh1.m_fcn.is_defined () && fh2.m_fcn.is_defined ()) diff -r a2be40ce8fec -r 60515d0cd023 libinterp/octave-value/ov-fcn-handle.h --- a/libinterp/octave-value/ov-fcn-handle.h Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/octave-value/ov-fcn-handle.h Tue Dec 12 23:14:33 2023 -0800 @@ -163,7 +163,7 @@ virtual bool has_function_cache () const { return false; } - virtual void compile () {} + virtual void compile () { } protected: diff -r a2be40ce8fec -r 60515d0cd023 libinterp/octave-value/ov-fcn.h --- a/libinterp/octave-value/ov-fcn.h Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/octave-value/ov-fcn.h Tue Dec 12 23:14:33 2023 -0800 @@ -340,7 +340,7 @@ bool has_function_cache () const { return true; } #endif - protected: +protected: octave_function (const std::string& nm, const std::string& ds = "") diff -r a2be40ce8fec -r 60515d0cd023 libinterp/octave-value/ov-inline.h --- a/libinterp/octave-value/ov-inline.h Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/octave-value/ov-inline.h Tue Dec 12 23:14:33 2023 -0800 @@ -42,7 +42,7 @@ class octave_value_factory { - public: +public: static octave_value make (double d) { diff -r a2be40ce8fec -r 60515d0cd023 libinterp/octave-value/ov-lazy-idx.cc --- a/libinterp/octave-value/ov-lazy-idx.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/octave-value/ov-lazy-idx.cc Tue Dec 12 23:14:33 2023 -0800 @@ -222,12 +222,14 @@ static const std::string value_save_tag ("index_value"); -bool octave_lazy_index::save_ascii (std::ostream& os) +bool +octave_lazy_index::save_ascii (std::ostream& os) { return save_text_data (os, make_value (), value_save_tag, false, 0); } -bool octave_lazy_index::load_ascii (std::istream& is) +bool +octave_lazy_index::load_ascii (std::istream& is) { bool dummy; @@ -240,14 +242,16 @@ return true; } -bool octave_lazy_index::save_binary (std::ostream& os, bool save_as_floats) +bool +octave_lazy_index::save_binary (std::ostream& os, bool save_as_floats) { return save_binary_data (os, make_value (), value_save_tag, "", false, save_as_floats); } -bool octave_lazy_index::load_binary (std::istream& is, bool swap, - octave::mach_info::float_format fmt) +bool +octave_lazy_index::load_binary (std::istream& is, bool swap, + octave::mach_info::float_format fmt) { bool dummy; std::string doc; diff -r a2be40ce8fec -r 60515d0cd023 libinterp/octave-value/ov-range.cc --- a/libinterp/octave-value/ov-range.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/octave-value/ov-range.cc Tue Dec 12 23:14:33 2023 -0800 @@ -979,7 +979,7 @@ } DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_trivial_range, - "trivial range", "double"); + "trivial range", "double"); template bool diff -r a2be40ce8fec -r 60515d0cd023 libinterp/octave-value/ov-range.h --- a/libinterp/octave-value/ov-range.h Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/octave-value/ov-range.h Tue Dec 12 23:14:33 2023 -0800 @@ -57,7 +57,7 @@ public: octave_trivial_range (octave_idx_type numel, int base, int incr) - : m_numel (numel), m_base (base), m_increment(incr) { } + : m_numel (numel), m_base (base), m_increment(incr) { } octave_trivial_range () {}; diff -r a2be40ce8fec -r 60515d0cd023 libinterp/octave-value/ov-typeinfo.cc --- a/libinterp/octave-value/ov-typeinfo.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/octave-value/ov-typeinfo.cc Tue Dec 12 23:14:33 2023 -0800 @@ -45,7 +45,8 @@ // FIXME: we should also store all class names and provide a // way to list them (calling class with nargin == 0?). -static NDArray as_nd_array (const Array& x) +static NDArray +as_nd_array (const Array& x) { NDArray retval (x.dims ()); @@ -55,7 +56,8 @@ return retval; } -static boolNDArray as_bool_nd_array (const Array& x) +static boolNDArray +as_bool_nd_array (const Array& x) { boolNDArray retval (x.dims ()); @@ -87,10 +89,11 @@ install_ops (*this); } -int type_info::register_type (const std::string& t_name, - const std::string& /* c_name */, - const octave_value& val, - bool abort_on_duplicate) +int +type_info::register_type (const std::string& t_name, + const std::string& /* c_name */, + const octave_value& val, + bool abort_on_duplicate) { int i = 0; @@ -161,9 +164,10 @@ return i; } -bool type_info::register_unary_class_op (octave_value::unary_op op, - type_info::unary_class_op_fcn f, - bool abort_on_duplicate) +bool +type_info::register_unary_class_op (octave_value::unary_op op, + type_info::unary_class_op_fcn f, + bool abort_on_duplicate) { if (lookup_unary_class_op (op)) { @@ -186,8 +190,9 @@ return false; } -bool type_info::register_unary_op (octave_value::unary_op op, int t, - unary_op_fcn f, bool abort_on_duplicate) +bool +type_info::register_unary_op (octave_value::unary_op op, int t, + unary_op_fcn f, bool abort_on_duplicate) { if (lookup_unary_op (op, t)) { @@ -264,10 +269,11 @@ return false; } -bool type_info::register_binary_op (octave_value::binary_op op, - int t1, int t2, - type_info::binary_op_fcn f, - bool abort_on_duplicate) +bool +type_info::register_binary_op (octave_value::binary_op op, + int t1, int t2, + type_info::binary_op_fcn f, + bool abort_on_duplicate) { if (lookup_binary_op (op, t1, t2)) { @@ -319,10 +325,11 @@ return false; } -bool type_info::register_binary_op (octave_value::compound_binary_op op, - int t1, int t2, - type_info::binary_op_fcn f, - bool abort_on_duplicate) +bool +type_info::register_binary_op (octave_value::compound_binary_op op, + int t1, int t2, + type_info::binary_op_fcn f, + bool abort_on_duplicate) { if (lookup_binary_op (op, t1, t2)) { @@ -348,8 +355,9 @@ return false; } -bool type_info::register_cat_op (int t1, int t2, type_info::cat_op_fcn f, - bool abort_on_duplicate) +bool +type_info::register_cat_op (int t1, int t2, type_info::cat_op_fcn f, + bool abort_on_duplicate) { if (lookup_cat_op (t1, t2)) { @@ -372,10 +380,11 @@ return false; } -bool type_info::register_assign_op (octave_value::assign_op op, - int t_lhs, int t_rhs, - type_info::assign_op_fcn f, - bool abort_on_duplicate) +bool +type_info::register_assign_op (octave_value::assign_op op, + int t_lhs, int t_rhs, + type_info::assign_op_fcn f, + bool abort_on_duplicate) { if (lookup_assign_op (op, t_lhs, t_rhs)) { @@ -401,9 +410,10 @@ return false; } -bool type_info::register_assignany_op (octave_value::assign_op op, int t_lhs, - type_info::assignany_op_fcn f, - bool abort_on_duplicate) +bool +type_info::register_assignany_op (octave_value::assign_op op, int t_lhs, + type_info::assignany_op_fcn f, + bool abort_on_duplicate) { if (lookup_assignany_op (op, t_lhs)) { @@ -427,9 +437,10 @@ return false; } -bool type_info::register_pref_assign_conv (int t_lhs, int t_rhs, - int t_result, - bool abort_on_duplicate) +bool +type_info::register_pref_assign_conv (int t_lhs, int t_rhs, + int t_result, + bool abort_on_duplicate) { if (lookup_pref_assign_conv (t_lhs, t_rhs) >= 0) { @@ -453,9 +464,10 @@ return false; } -bool type_info::register_widening_op (int t, int t_result, - octave_base_value::type_conv_fcn f, - bool abort_on_duplicate) +bool +type_info::register_widening_op (int t, int t_result, + octave_base_value::type_conv_fcn f, + bool abort_on_duplicate) { if (lookup_widening_op (t, t_result)) { @@ -478,7 +490,8 @@ return false; } -octave_value type_info::lookup_type (const std::string& nm) +octave_value +type_info::lookup_type (const std::string& nm) { octave_value retval; @@ -776,21 +789,24 @@ return type_info.register_type (t_name, c_name, val); } -octave_value lookup_type (const std::string& nm) +octave_value +lookup_type (const std::string& nm) { octave::type_info& type_info = octave::__get_type_info__ (); return type_info.lookup_type (nm); } -unary_class_op_fcn lookup_unary_class_op (octave_value::unary_op op) +unary_class_op_fcn +lookup_unary_class_op (octave_value::unary_op op) { octave::type_info& type_info = octave::__get_type_info__ (); return type_info.lookup_unary_class_op (op); } -unary_op_fcn lookup_unary_op (octave_value::unary_op op, int t) +unary_op_fcn +lookup_unary_op (octave_value::unary_op op, int t) { octave::type_info& type_info = octave::__get_type_info__ (); @@ -837,7 +853,8 @@ return type_info.lookup_binary_op (op, t1, t2); } -cat_op_fcn lookup_cat_op (int t1, int t2) +cat_op_fcn +lookup_cat_op (int t1, int t2) { octave::type_info& type_info = octave::__get_type_info__ (); @@ -860,7 +877,8 @@ return type_info.lookup_assignany_op (op, t_lhs); } -int lookup_pref_assign_conv (int t_lhs, int t_rhs) +int +lookup_pref_assign_conv (int t_lhs, int t_rhs) { octave::type_info& type_info = octave::__get_type_info__ (); @@ -875,14 +893,16 @@ return type_info.lookup_widening_op (t, t_result); } -string_vector installed_type_names () +string_vector +installed_type_names () { octave::type_info& type_info = octave::__get_type_info__ (); return type_info.installed_type_names (); } -octave_scalar_map installed_type_info () +octave_scalar_map +installed_type_info () { octave::type_info& type_info = octave::__get_type_info__ (); diff -r a2be40ce8fec -r 60515d0cd023 libinterp/octave-value/ov-usr-fcn.cc --- a/libinterp/octave-value/ov-usr-fcn.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/octave-value/ov-usr-fcn.cc Tue Dec 12 23:14:33 2023 -0800 @@ -939,7 +939,8 @@ "optimize_subsasgn_calls"); } -static bool val_in_table (const Matrix& table, double val) +static bool +val_in_table (const Matrix& table, double val) { if (table.isempty ()) return false; @@ -948,7 +949,8 @@ return (i > 0 && table(i-1) == val); } -static bool isargout1 (int nargout, const Matrix& ignored, double k) +static bool +isargout1 (int nargout, const Matrix& ignored, double k) { if (k != math::fix (k) || k <= 0) error ("isargout: K must be a positive integer"); diff -r a2be40ce8fec -r 60515d0cd023 libinterp/octave-value/ov.cc --- a/libinterp/octave-value/ov.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/octave-value/ov.cc Tue Dec 12 23:14:33 2023 -0800 @@ -2261,7 +2261,8 @@ m_rep->print_info (os, prefix + ' '); } -bool octave_value::load_ascii (std::istream& is) +bool +octave_value::load_ascii (std::istream& is) { bool status = m_rep->load_ascii (is); @@ -2271,8 +2272,9 @@ return status; } -bool octave_value::load_binary (std::istream& is, bool swap, - octave::mach_info::float_format fmt) +bool +octave_value::load_binary (std::istream& is, bool swap, + octave::mach_info::float_format fmt) { bool status = m_rep->load_binary (is, swap, fmt); @@ -2283,7 +2285,8 @@ return status; } -bool octave_value::load_hdf5 (octave_hdf5_id loc_id, const char *name) +bool +octave_value::load_hdf5 (octave_hdf5_id loc_id, const char *name) { bool status = m_rep->load_hdf5 (loc_id, name); diff -r a2be40ce8fec -r 60515d0cd023 libinterp/octave.cc --- a/libinterp/octave.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/octave.cc Tue Dec 12 23:14:33 2023 -0800 @@ -239,7 +239,8 @@ argc-octave_optind_wrapper ()); } -octave_value cmdline_options::as_octave_value () const +octave_value +cmdline_options::as_octave_value () const { octave_scalar_map m; @@ -324,25 +325,29 @@ } } -bool application::forced_interactive () +bool +application::forced_interactive () { return s_instance ? s_instance->m_options.forced_interactive () : false; } // Provided for convenience. Will be removed once we eliminate the // old terminal widget. -bool application::experimental_terminal_widget () const +bool +application::experimental_terminal_widget () const { return (s_instance ? s_instance->m_options.experimental_terminal_widget () : false); } -bool application::interpreter_initialized () +bool +application::interpreter_initialized () { return m_interpreter ? m_interpreter->initialized () : false; } -interpreter& application::create_interpreter () +interpreter& +application::create_interpreter () { if (! m_interpreter) m_interpreter = std::unique_ptr (new interpreter (this)); @@ -350,23 +355,27 @@ return *m_interpreter; } -void application::initialize_interpreter () +void +application::initialize_interpreter () { if (m_interpreter) m_interpreter->initialize (); } -int application::execute_interpreter () +int +application::execute_interpreter () { return m_interpreter ? m_interpreter->execute () : -1; } -void application::delete_interpreter () +void +application::delete_interpreter () { m_interpreter.reset (); } -void application::init () +void +application::init () { if (s_instance) throw std::runtime_error @@ -420,7 +429,8 @@ sysdep_init (); } -int cli_application::execute () +int +cli_application::execute () { interpreter& interp = create_interpreter (); diff -r a2be40ce8fec -r 60515d0cd023 libinterp/parse-tree/anon-fcn-validator.cc --- a/libinterp/parse-tree/anon-fcn-validator.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/parse-tree/anon-fcn-validator.cc Tue Dec 12 23:14:33 2023 -0800 @@ -42,7 +42,8 @@ expr->accept (*this); } -void anon_fcn_validator::visit_postfix_expression (tree_postfix_expression& expr) +void +anon_fcn_validator::visit_postfix_expression (tree_postfix_expression& expr) { octave_value::unary_op op = expr.op_type (); @@ -52,7 +53,8 @@ tree_walker::visit_postfix_expression (expr); } -void anon_fcn_validator::visit_prefix_expression (tree_prefix_expression& expr) +void +anon_fcn_validator::visit_prefix_expression (tree_prefix_expression& expr) { octave_value::unary_op op = expr.op_type (); @@ -62,17 +64,20 @@ tree_walker::visit_prefix_expression (expr); } -void anon_fcn_validator::visit_multi_assignment (tree_multi_assignment& expr) +void +anon_fcn_validator::visit_multi_assignment (tree_multi_assignment& expr) { error (expr); } -void anon_fcn_validator::visit_simple_assignment (tree_simple_assignment& expr) +void +anon_fcn_validator::visit_simple_assignment (tree_simple_assignment& expr) { error (expr); } -void anon_fcn_validator::error (tree_expression& expr) +void +anon_fcn_validator::error (tree_expression& expr) { m_ok = false; m_line = expr.line (); diff -r a2be40ce8fec -r 60515d0cd023 libinterp/parse-tree/bp-table.cc --- a/libinterp/parse-tree/bp-table.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/parse-tree/bp-table.cc Tue Dec 12 23:14:33 2023 -0800 @@ -116,7 +116,8 @@ // Clear all reasons to stop, other than breakpoints. -void bp_table::dbclear_all_signals () +void +bp_table::dbclear_all_signals () { interpreter& interp = m_evaluator.get_interpreter (); error_system& es = interp.get_error_system (); @@ -136,7 +137,8 @@ // Process the "warn", "errs", "caught" and "intr" fields for a call of // "dbstop (p)". -void bp_table::dbstop_process_map_args (const octave_map& mv) +void +bp_table::dbstop_process_map_args (const octave_map& mv) { interpreter& interp = m_evaluator.get_interpreter (); error_system& es = interp.get_error_system (); @@ -231,11 +233,12 @@ // to stop only when condition is true. // Record in m_bp_set that fname contains a breakpoint. -bool bp_table::add_breakpoint_1 (octave_user_code *fcn, - const std::string& fcn_ident, - const bp_table::bp_lines& line, - const std::string& condition, - bp_table::bp_lines& retval) +bool +bp_table::add_breakpoint_1 (octave_user_code *fcn, + const std::string& fcn_ident, + const bp_table::bp_lines& line, + const std::string& condition, + bp_table::bp_lines& retval) { bool found = false; @@ -279,7 +282,8 @@ // it is odd that the former is not flagged by "is_assignment_expression". // Throws an exception if not valid. -bool bp_table::condition_valid (const std::string& cond) +bool +bp_table::condition_valid (const std::string& cond) { if (cond.length () > 0) { @@ -339,12 +343,13 @@ // be a class name. Otherwise it should be a function name. // Also execute "if [error|warning|interrupt|naninf]" clauses. -void bp_table::parse_dbfunction_params (const char *who, - const octave_value_list& args, - std::string& fcn_name, - std::string& class_name, - bp_table::bp_lines& lines, - std::string& cond) +void +bp_table::parse_dbfunction_params (const char *who, + const octave_value_list& args, + std::string& fcn_name, + std::string& class_name, + bp_table::bp_lines& lines, + std::string& cond) { int nargin = args.length (); fcn_name = ""; @@ -552,8 +557,9 @@ %! assert (s.errs, {"Octave:undefined-function"}); */ -void bp_table::set_stop_flag (const char *who, const std::string& condition, - bool on_off) +void +bp_table::set_stop_flag (const char *who, const std::string& condition, + bool on_off) { interpreter& interp = m_evaluator.get_interpreter (); error_system& es = interp.get_error_system (); @@ -568,11 +574,12 @@ error ("%s: internal error in set_stop_flag", who); } -void bp_table::process_id_list (const char *who, - const std::string& condition, - const octave_value_list& args, - int nargin, int& pos, bool on_off, - std::set& id_list) +void +bp_table::process_id_list (const char *who, + const std::string& condition, + const octave_value_list& args, + int nargin, int& pos, bool on_off, + std::set& id_list) { pos++; @@ -609,9 +616,10 @@ // line number LINENO of the source file. // If END_LINE != 0, *END_LINE is set to last line of the returned function. -static octave_user_code * find_fcn_by_line (octave_user_code *main_fcn, - int lineno, - int *end_line = nullptr) +static octave_user_code * +find_fcn_by_line (octave_user_code *main_fcn, + int lineno, + int *end_line = nullptr) { octave_user_code *retval = nullptr; octave_user_code *next_fcn = nullptr; // 1st function starting after lineno @@ -671,9 +679,10 @@ // Given function identifier fcn_ident, find the subfunction at line and create // a breakpoint there. Put the system into debug_mode. -int bp_table::add_breakpoint_in_function (const std::string& fcn_ident, - int line, - const std::string& condition) +int +bp_table::add_breakpoint_in_function (const std::string& fcn_ident, + int line, + const std::string& condition) { bp_lines line_info; line_info.insert (line); @@ -692,7 +701,7 @@ { public: user_code_provider (const std::string& who, const std::string& fcn_ident, - octave_user_code* pfcn, bool silent = false) + octave_user_code *pfcn, bool silent = false) : m_fcn (nullptr), m_is_valid (false) { m_fcn = pfcn; @@ -837,9 +846,10 @@ return retval; } -int bp_table::add_breakpoint_in_file (const std::string& file, - int line, - const std::string& condition) +int +bp_table::add_breakpoint_in_file (const std::string& file, + int line, + const std::string& condition) { // Duplicates what the GUI was doing previously, but this action // should not be specific to the GUI. @@ -880,9 +890,10 @@ return add_breakpoints_in_function (fcn_ident, lines, condition); } -int bp_table::remove_breakpoint_1 (octave_user_code *fcn, - const std::string& fcn_ident, - const bp_table::bp_lines& lines) +int +bp_table::remove_breakpoint_1 (octave_user_code *fcn, + const std::string& fcn_ident, + const bp_table::bp_lines& lines) { int retval = 0; @@ -1096,7 +1107,8 @@ return remove_all_breakpoints_from_function (info.fcn (), silent); } -void bp_table::remove_all_breakpoints () +void +bp_table::remove_all_breakpoints () { // Odd loop structure required because delete will invalidate // m_bp_set iterators. @@ -1111,7 +1123,8 @@ m_evaluator.reset_debug_state (); } -std::string find_bkpt_list (octave_value_list slist, std::string match) +std::string +find_bkpt_list (octave_value_list slist, std::string match) { std::string retval; @@ -1158,7 +1171,7 @@ { const std::list& bp = cmds->breakpoints_and_conds (); - if(!bp.empty()) + if (!bp.empty()) it = all_bkpts.insert (it, bp.cbegin (), bp.cend ()); } @@ -1218,7 +1231,8 @@ // "errs" field will have a row per ID. If dbstop if error is false, there // is no "errs" field. The "warn" field is set similarly by dbstop if warning -octave_map bp_table::stop_on_err_warn_status (bool to_screen) +octave_map +bp_table::stop_on_err_warn_status (bool to_screen) { octave_map retval; diff -r a2be40ce8fec -r 60515d0cd023 libinterp/parse-tree/oct-lvalue.cc --- a/libinterp/parse-tree/oct-lvalue.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/parse-tree/oct-lvalue.cc Tue Dec 12 23:14:33 2023 -0800 @@ -42,24 +42,28 @@ return ! is_black_hole () && m_frame->is_defined (m_sym); } -bool octave_lvalue::is_undefined () const +bool +octave_lvalue::is_undefined () const { return ! is_defined (); } -void octave_lvalue::define (const octave_value& v) +void +octave_lvalue::define (const octave_value& v) { m_frame->assign (m_sym, v); } -void octave_lvalue::assign (octave_value::assign_op op, - const octave_value& rhs) +void +octave_lvalue::assign (octave_value::assign_op op, + const octave_value& rhs) { if (! is_black_hole ()) m_frame->assign (op, m_sym, m_type, m_idx, rhs); } -octave_idx_type octave_lvalue::numel () const +octave_idx_type +octave_lvalue::numel () const { // Return 1 if there is no index because without an index there // should be no way to have a cs-list here. Cs-lists may be passed @@ -168,8 +172,9 @@ } } -void octave_lvalue::set_index (const std::string& t, - const std::list& i) +void +octave_lvalue::set_index (const std::string& t, + const std::list& i) { if (! m_idx.empty ()) error ("invalid index expression in assignment"); @@ -178,7 +183,8 @@ m_idx = i; } -bool octave_lvalue::index_is_empty () const +bool +octave_lvalue::index_is_empty () const { bool retval = false; @@ -192,7 +198,8 @@ return retval; } -bool octave_lvalue::index_is_colon () const +bool +octave_lvalue::index_is_colon () const { bool retval = false; @@ -206,13 +213,15 @@ return retval; } -void octave_lvalue::unary_op (octave_value::unary_op op) +void +octave_lvalue::unary_op (octave_value::unary_op op) { if (! is_black_hole ()) m_frame->non_const_unary_op (op, m_sym, m_type, m_idx); } -octave_value octave_lvalue::value () const +octave_value +octave_lvalue::value () const { return (is_black_hole () ? octave_value () : m_frame->value (m_sym, m_type, m_idx)); diff -r a2be40ce8fec -r 60515d0cd023 libinterp/parse-tree/pt-classdef.cc --- a/libinterp/parse-tree/pt-classdef.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/parse-tree/pt-classdef.cc Tue Dec 12 23:14:33 2023 -0800 @@ -121,7 +121,8 @@ // Classdef property -std::string check_for_doc_string (comment_list *comments) +std::string +check_for_doc_string (comment_list *comments) { // If the comment list ends in a block comment or full-line comment, // then it is the doc string for this property. @@ -149,14 +150,16 @@ delete m_comments; } -tree_identifier *tree_classdef_property::ident () +tree_identifier * +tree_classdef_property::ident () { tree_expression *id_expr = m_av->identifier_expression (); return dynamic_cast (id_expr); } -tree_expression *tree_classdef_property::expression () +tree_expression * +tree_classdef_property::expression () { return m_av->initializer_expression (); } diff -r a2be40ce8fec -r 60515d0cd023 libinterp/parse-tree/pt-colon.cc --- a/libinterp/parse-tree/pt-colon.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/parse-tree/pt-colon.cc Tue Dec 12 23:14:33 2023 -0800 @@ -51,7 +51,8 @@ return new_ce; } -octave_value tree_colon_expression::evaluate (tree_evaluator& tw, int) +octave_value +tree_colon_expression::evaluate (tree_evaluator& tw, int) { octave_value val; diff -r a2be40ce8fec -r 60515d0cd023 libinterp/parse-tree/pt-eval.cc --- a/libinterp/parse-tree/pt-eval.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/parse-tree/pt-eval.cc Tue Dec 12 23:14:33 2023 -0800 @@ -148,7 +148,8 @@ // with the corresponding tree_evaluator functions or do they need to // remain separate? They perform nearly the same functions. -int debugger::server_loop () +int +debugger::server_loop () { // Process events from the event queue. @@ -261,7 +262,8 @@ return exit_status; } -void debugger::repl (const std::string& prompt_arg) +void +debugger::repl (const std::string& prompt_arg) { unwind_protect frame; @@ -507,7 +509,8 @@ } } -bool debugger::quitting_debugger () const +bool +debugger::quitting_debugger () const { if (m_execution_mode == EX_QUIT) { @@ -535,7 +538,8 @@ return false; } -bool tree_evaluator::at_top_level () const +bool +tree_evaluator::at_top_level () const { return m_call_stack.at_top_level (); } @@ -576,8 +580,9 @@ return fname; } -void tree_evaluator::parse_and_execute (const std::string& input, - bool& incomplete_parse) +void +tree_evaluator::parse_and_execute (const std::string& input, + bool& incomplete_parse) { incomplete_parse = false; @@ -640,7 +645,8 @@ evmgr.pre_input_event (); } -void tree_evaluator::get_line_and_eval () +void +tree_evaluator::get_line_and_eval () { std::mutex mtx; std::unique_lock lock (mtx); @@ -732,7 +738,8 @@ } } -int tree_evaluator::repl () +int +tree_evaluator::repl () { // The big loop. Read, Eval, Print, Loop. Normally user // interaction at the command line in a terminal session, but we may @@ -873,7 +880,8 @@ return exit_status; } -int tree_evaluator::server_loop () +int +tree_evaluator::server_loop () { // Process events from the event queue. @@ -981,8 +989,9 @@ return m_exit_status; } -void tree_evaluator::eval (std::shared_ptr& stmt_list, - bool interactive) +void +tree_evaluator::eval (std::shared_ptr& stmt_list, + bool interactive) { try { @@ -1086,8 +1095,9 @@ return retval; } -octave_value tree_evaluator::eval_string (const std::string& eval_str, - bool silent, int& parse_status) +octave_value +tree_evaluator::eval_string (const std::string& eval_str, + bool silent, int& parse_status) { octave_value retval; @@ -1099,26 +1109,29 @@ return retval; } -octave_value_list tree_evaluator::eval_string (const octave_value& arg, - bool silent, int& parse_status, - int nargout) +octave_value_list +tree_evaluator::eval_string (const octave_value& arg, + bool silent, int& parse_status, + int nargout) { std::string s = arg.xstring_value ("eval: expecting string argument"); return eval_string (s, silent, parse_status, nargout); } -octave_value_list tree_evaluator::eval (const std::string& try_code, - int nargout) +octave_value_list +tree_evaluator::eval (const std::string& try_code, + int nargout) { int parse_status = 0; return eval_string (try_code, nargout > 0, parse_status, nargout); } -octave_value_list tree_evaluator::eval (const std::string& try_code, - const std::string& catch_code, - int nargout) +octave_value_list +tree_evaluator::eval (const std::string& try_code, + const std::string& catch_code, + int nargout) { octave_value_list retval; @@ -1163,9 +1176,10 @@ return retval; } -octave_value_list tree_evaluator::evalin (const std::string& context, - const std::string& try_code, - int nargout) +octave_value_list +tree_evaluator::evalin (const std::string& context, + const std::string& try_code, + int nargout) { unwind_action act ([=] (std::size_t frm) { @@ -1184,10 +1198,11 @@ return eval_string (try_code, nargout > 0, parse_status, nargout); } -octave_value_list tree_evaluator::evalin (const std::string& context, - const std::string& try_code, - const std::string& catch_code, - int nargout) +octave_value_list +tree_evaluator::evalin (const std::string& context, + const std::string& try_code, + const std::string& catch_code, + int nargout) { octave_value_list retval; @@ -1919,7 +1934,8 @@ return frame->is_defined (sym); } -bool tree_evaluator::is_global (const std::string& name) const +bool +tree_evaluator::is_global (const std::string& name) const { std::shared_ptr frame = m_call_stack.get_current_stack_frame (); @@ -1945,9 +1961,10 @@ return frame->varval (name); } -void tree_evaluator::install_variable (const std::string& name, - const octave_value& value, - bool global) +void +tree_evaluator::install_variable (const std::string& name, + const octave_value& value, + bool global) { std::shared_ptr frame = m_call_stack.get_current_stack_frame (); @@ -2258,7 +2275,7 @@ // END is documented in op-kw-docs. DEFMETHOD (end, interp, args, , - doc: /* -*- texinfo -*- + doc: /* -*- texinfo -*- @deftypefn {} {} end Last element of an array or the end of any @code{for}, @code{parfor}, @code{if}, @code{do}, @code{while}, @code{function}, @code{switch}, @@ -2283,9 +2300,9 @@ @seealso{for, parfor, if, do, while, function, switch, try, unwind_protect} @end deftypefn */) { -tree_evaluator& tw = interp.get_evaluator (); - -return tw.evaluate_end_expression (args); + tree_evaluator& tw = interp.get_evaluator (); + + return tw.evaluate_end_expression (args); } /* @@ -2450,30 +2467,35 @@ return false; } -void tree_evaluator::push_stack_frame (const symbol_scope& scope) +void +tree_evaluator::push_stack_frame (const symbol_scope& scope) { m_call_stack.push (scope); } -void tree_evaluator::push_stack_frame (octave_user_function *fcn, - const std::shared_ptr& closure_frames) +void +tree_evaluator::push_stack_frame (octave_user_function *fcn, + const std::shared_ptr& closure_frames) { m_call_stack.push (fcn, closure_frames); } -void tree_evaluator::push_stack_frame (octave_user_function *fcn, - const stack_frame::local_vars_map& local_vars, - const std::shared_ptr& closure_frames) +void +tree_evaluator::push_stack_frame (octave_user_function *fcn, + const stack_frame::local_vars_map& local_vars, + const std::shared_ptr& closure_frames) { m_call_stack.push (fcn, local_vars, closure_frames); } -void tree_evaluator::push_stack_frame (octave_user_script *script) +void +tree_evaluator::push_stack_frame (octave_user_script *script) { m_call_stack.push (script); } -void tree_evaluator::push_stack_frame (octave_function *fcn) +void +tree_evaluator::push_stack_frame (octave_function *fcn) { m_call_stack.push (fcn); } @@ -2508,7 +2530,8 @@ #endif -void tree_evaluator::pop_stack_frame () +void +tree_evaluator::pop_stack_frame () { m_call_stack.pop (); } @@ -2519,84 +2542,100 @@ return m_call_stack.pop_return (); } -int tree_evaluator::current_line () const +int +tree_evaluator::current_line () const { return m_call_stack.current_line (); } -int tree_evaluator::current_column () const +int +tree_evaluator::current_column () const { return m_call_stack.current_column (); } -int tree_evaluator::debug_user_code_line () const +int +tree_evaluator::debug_user_code_line () const { return m_call_stack.debug_user_code_line (); } -int tree_evaluator::debug_user_code_column () const +int +tree_evaluator::debug_user_code_column () const { return m_call_stack.debug_user_code_column (); } -void tree_evaluator::debug_where (std::ostream& os) const +void +tree_evaluator::debug_where (std::ostream& os) const { std::shared_ptr frm = m_call_stack.current_user_frame (); frm->display_stopped_in_message (os); } -octave_user_code * tree_evaluator::current_user_code () const +octave_user_code * +tree_evaluator::current_user_code () const { return m_call_stack.current_user_code (); } -unwind_protect * tree_evaluator::curr_fcn_unwind_protect_frame () +unwind_protect * +tree_evaluator::curr_fcn_unwind_protect_frame () { return m_call_stack.curr_fcn_unwind_protect_frame (); } -octave_user_code * tree_evaluator::debug_user_code () const +octave_user_code * +tree_evaluator::debug_user_code () const { return m_call_stack.debug_user_code (); } -octave_function * tree_evaluator::current_function (bool skip_first) const +octave_function * +tree_evaluator::current_function (bool skip_first) const { return m_call_stack.current_function (skip_first); } -octave_function * tree_evaluator::caller_function () const +octave_function * +tree_evaluator::caller_function () const { return m_call_stack.current_function (true); } -bool tree_evaluator::goto_frame (std::size_t n, bool verbose) +bool +tree_evaluator::goto_frame (std::size_t n, bool verbose) { return m_call_stack.goto_frame (n, verbose); } -void tree_evaluator::goto_caller_frame () +void +tree_evaluator::goto_caller_frame () { m_call_stack.goto_caller_frame (); } -void tree_evaluator::goto_base_frame () +void +tree_evaluator::goto_base_frame () { m_call_stack.goto_base_frame (); } -void tree_evaluator::restore_frame (std::size_t n) +void +tree_evaluator::restore_frame (std::size_t n) { return m_call_stack.restore_frame (n); } -std::string tree_evaluator::get_dispatch_class () const +std::string +tree_evaluator::get_dispatch_class () const { return m_call_stack.get_dispatch_class (); } -void tree_evaluator::set_dispatch_class (const std::string& class_name) +void +tree_evaluator::set_dispatch_class (const std::string& class_name) { m_call_stack.set_dispatch_class (class_name); } @@ -2632,7 +2671,8 @@ return m_call_stack.backtrace_info (curr_user_frame, print_subfn); } -std::list tree_evaluator::backtrace_info () const +std::list +tree_evaluator::backtrace_info () const { return m_call_stack.backtrace_info (); } @@ -2644,17 +2684,20 @@ return m_call_stack.backtrace (curr_user_frame, print_subfn); } -octave_map tree_evaluator::backtrace () const +octave_map +tree_evaluator::backtrace () const { return m_call_stack.backtrace (); } -octave_map tree_evaluator::empty_backtrace () const +octave_map +tree_evaluator::empty_backtrace () const { return m_call_stack.empty_backtrace (); } -std::string tree_evaluator::backtrace_message () const +std::string +tree_evaluator::backtrace_message () const { std::list frames = backtrace_info (); @@ -2682,29 +2725,34 @@ return buf.str (); } -void tree_evaluator::push_dummy_scope (const std::string& name) +void +tree_evaluator::push_dummy_scope (const std::string& name) { symbol_scope dummy_scope (name + "$dummy"); m_call_stack.push (dummy_scope); } -void tree_evaluator::pop_scope () +void +tree_evaluator::pop_scope () { m_call_stack.pop (); } -symbol_scope tree_evaluator::get_top_scope () const +symbol_scope +tree_evaluator::get_top_scope () const { return m_call_stack.top_scope (); } -symbol_scope tree_evaluator::get_current_scope () const +symbol_scope +tree_evaluator::get_current_scope () const { return m_call_stack.current_scope (); } -void tree_evaluator::mlock (bool skip_first) const +void +tree_evaluator::mlock (bool skip_first) const { octave_function *fcn = m_call_stack.current_function (skip_first); @@ -2720,7 +2768,8 @@ fcn->lock (); } -void tree_evaluator::munlock (bool skip_first) const +void +tree_evaluator::munlock (bool skip_first) const { octave_function *fcn = m_call_stack.current_function (skip_first); @@ -2736,7 +2785,8 @@ fcn->unlock (); } -bool tree_evaluator::mislocked (bool skip_first) const +bool +tree_evaluator::mislocked (bool skip_first) const { octave_function *fcn = m_call_stack.current_function (skip_first); @@ -2752,12 +2802,14 @@ return m_call_stack.max_stack_depth (args, nargout); } -void tree_evaluator::display_call_stack () const +void +tree_evaluator::display_call_stack () const { m_call_stack.display (); } -octave_value tree_evaluator::find (const std::string& name) +octave_value +tree_evaluator::find (const std::string& name) { std::shared_ptr frame = m_call_stack.get_current_stack_frame (); @@ -2781,7 +2833,8 @@ return symtab.fcn_table_find (name, ovl ()); } -void tree_evaluator::clear_objects () +void +tree_evaluator::clear_objects () { std::shared_ptr frame = m_call_stack.get_current_stack_frame (); @@ -2789,7 +2842,8 @@ frame->clear_objects (); } -void tree_evaluator::clear_variable (const std::string& name) +void +tree_evaluator::clear_variable (const std::string& name) { std::shared_ptr frame = m_call_stack.get_current_stack_frame (); @@ -2797,7 +2851,8 @@ frame->clear_variable (name); } -void tree_evaluator::clear_variable_pattern (const std::string& pattern) +void +tree_evaluator::clear_variable_pattern (const std::string& pattern) { std::shared_ptr frame = m_call_stack.get_current_stack_frame (); @@ -2805,7 +2860,8 @@ frame->clear_variable_pattern (pattern); } -void tree_evaluator::clear_variable_regexp (const std::string& pattern) +void +tree_evaluator::clear_variable_regexp (const std::string& pattern) { std::shared_ptr frame = m_call_stack.get_current_stack_frame (); @@ -2813,7 +2869,8 @@ frame->clear_variable_regexp (pattern); } -void tree_evaluator::clear_variables () +void +tree_evaluator::clear_variables () { std::shared_ptr frame = m_call_stack.get_current_stack_frame (); @@ -2821,7 +2878,8 @@ frame->clear_variables (); } -void tree_evaluator::clear_global_variable (const std::string& name) +void +tree_evaluator::clear_global_variable (const std::string& name) { m_call_stack.clear_global_variable (name); } @@ -2832,17 +2890,20 @@ m_call_stack.clear_global_variable_pattern (pattern); } -void tree_evaluator::clear_global_variable_regexp(const std::string& pattern) +void +tree_evaluator::clear_global_variable_regexp(const std::string& pattern) { m_call_stack.clear_global_variable_regexp (pattern); } -void tree_evaluator::clear_global_variables () +void +tree_evaluator::clear_global_variables () { m_call_stack.clear_global_variables (); } -void tree_evaluator::clear_all (bool force) +void +tree_evaluator::clear_all (bool force) { // FIXME: should this also clear objects? @@ -2854,7 +2915,8 @@ symtab.clear_functions (force); } -void tree_evaluator::clear_symbol (const std::string& name) +void +tree_evaluator::clear_symbol (const std::string& name) { // FIXME: are we supposed to do both here? @@ -2865,7 +2927,8 @@ symtab.clear_function (name); } -void tree_evaluator::clear_symbol_pattern (const std::string& pattern) +void +tree_evaluator::clear_symbol_pattern (const std::string& pattern) { // FIXME: are we supposed to do both here? @@ -2876,7 +2939,8 @@ symtab.clear_function_pattern (pattern); } -void tree_evaluator::clear_symbol_regexp (const std::string& pattern) +void +tree_evaluator::clear_symbol_regexp (const std::string& pattern) { // FIXME: are we supposed to do both here? @@ -2887,17 +2951,20 @@ symtab.clear_function_regexp (pattern); } -std::list tree_evaluator::global_variable_names () const +std::list +tree_evaluator::global_variable_names () const { return m_call_stack.global_variable_names (); } -std::list tree_evaluator::top_level_variable_names () const +std::list +tree_evaluator::top_level_variable_names () const { return m_call_stack.top_level_variable_names (); } -std::list tree_evaluator::variable_names () const +std::list +tree_evaluator::variable_names () const { return m_call_stack.variable_names (); } @@ -3304,7 +3371,8 @@ } } -void tree_evaluator::visit_spmd_command (tree_spmd_command& cmd) +void +tree_evaluator::visit_spmd_command (tree_spmd_command& cmd) { // For now, we just execute the commands serially. @@ -4418,7 +4486,8 @@ panic_impossible (); } -void tree_evaluator::bind_ans (const octave_value& val, bool print) +void +tree_evaluator::bind_ans (const octave_value& val, bool print) { static std::string ans = "ans"; @@ -4583,7 +4652,8 @@ return m_call_stack.top_scope_symbol_info (); } -octave_map tree_evaluator::get_autoload_map () const +octave_map +tree_evaluator::get_autoload_map () const { Cell fcn_names (dim_vector (m_autoload_map.size (), 1)); Cell file_names (dim_vector (m_autoload_map.size (), 1)); @@ -4605,7 +4675,8 @@ return m; } -std::string tree_evaluator::lookup_autoload (const std::string& nm) const +std::string +tree_evaluator::lookup_autoload (const std::string& nm) const { std::string retval; @@ -4621,7 +4692,8 @@ return retval; } -std::list tree_evaluator::autoloaded_functions () const +std::list +tree_evaluator::autoloaded_functions () const { std::list names; @@ -4643,8 +4715,9 @@ return names; } -void tree_evaluator::add_autoload (const std::string& fcn, - const std::string& nm) +void +tree_evaluator::add_autoload (const std::string& fcn, + const std::string& nm) { std::string file_name = check_autoload_file (nm); @@ -4654,8 +4727,9 @@ m_autoload_map[fcn] = file_name; } -void tree_evaluator::remove_autoload (const std::string& fcn, - const std::string& nm) +void +tree_evaluator::remove_autoload (const std::string& fcn, + const std::string& nm) { check_autoload_file (nm); @@ -4695,8 +4769,9 @@ // variable being indexed, if any, then issue an error. (Will this also // be needed by pt-lvalue, which calls subsref?) -void tree_evaluator::final_index_error (index_exception& ie, - const tree_expression *expr) +void +tree_evaluator::final_index_error (index_exception& ie, + const tree_expression *expr) { std::string extra_message; @@ -4865,7 +4940,8 @@ m_echo_state, m_echo_file_name, m_echo_file_pos); } -bool tree_evaluator::maybe_push_echo_state_cleanup () +bool +tree_evaluator::maybe_push_echo_state_cleanup () { // This function is expected to be called from ECHO, which would be // the top of the call stack. If the caller of ECHO is a @@ -5017,19 +5093,22 @@ return octave_value (); } -bool tree_evaluator::in_debug_repl () const +bool +tree_evaluator::in_debug_repl () const { return (m_debugger_stack.empty () ? false : m_debugger_stack.top()->in_debug_repl ()); } -void tree_evaluator::dbcont () +void +tree_evaluator::dbcont () { if (! m_debugger_stack.empty ()) m_debugger_stack.top()->dbcont (); } -void tree_evaluator::dbquit (bool all) +void +tree_evaluator::dbquit (bool all) { if (! m_debugger_stack.empty ()) m_debugger_stack.top()->dbquit (all); @@ -5138,7 +5217,8 @@ return set_internal_variable (m_PS4, args, nargout, "PS4"); } -bool tree_evaluator::echo_this_file (const std::string& file, int type) const +bool +tree_evaluator::echo_this_file (const std::string& file, int type) const { if ((type & m_echo) == ECHO_SCRIPTS) { @@ -5171,7 +5251,8 @@ return false; } -void tree_evaluator::echo_code (int line) +void +tree_evaluator::echo_code (int line) { std::string prefix = command_editor::decode_prompt_string (m_PS4); @@ -5192,7 +5273,8 @@ } // Decide if it's time to quit a for or while loop. -bool tree_evaluator::quit_loop_now () +bool +tree_evaluator::quit_loop_now () { octave_quit (); @@ -5209,11 +5291,12 @@ return quit; } -void tree_evaluator::bind_auto_fcn_vars (const string_vector& arg_names, - const Matrix& ignored_outputs, - int nargin, int nargout, - bool takes_varargs, - const octave_value_list& va_args) +void +tree_evaluator::bind_auto_fcn_vars (const string_vector& arg_names, + const Matrix& ignored_outputs, + int nargin, int nargout, + bool takes_varargs, + const octave_value_list& va_args) { set_auto_fcn_var (stack_frame::ARG_NAMES, Cell (arg_names)); set_auto_fcn_var (stack_frame::IGNORED, ignored_outputs); @@ -5265,7 +5348,7 @@ } DEFMETHOD (max_recursion_depth, interp, args, nargout, - doc: /* -*- texinfo -*- + doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} max_recursion_depth () @deftypefnx {} {@var{old_val} =} max_recursion_depth (@var{new_val}) @deftypefnx {} {@var{old_val} =} max_recursion_depth (@var{new_val}, "local") @@ -5282,9 +5365,9 @@ @seealso{max_stack_depth} @end deftypefn */) { -tree_evaluator& tw = interp.get_evaluator (); - -return tw.max_recursion_depth (args, nargout); + tree_evaluator& tw = interp.get_evaluator (); + + return tw.max_recursion_depth (args, nargout); } /* @@ -5300,7 +5383,7 @@ */ DEFMETHOD (whos_line_format, interp, args, nargout, - doc: /* -*- texinfo -*- + doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} whos_line_format () @deftypefnx {} {@var{old_val} =} whos_line_format (@var{new_val}) @deftypefnx {} {@var{old_val} =} whos_line_format (@var{new_val}, "local") @@ -5375,13 +5458,13 @@ @seealso{whos} @end deftypefn */) { -tree_evaluator& tw = interp.get_evaluator (); - -return tw.whos_line_format (args, nargout); + tree_evaluator& tw = interp.get_evaluator (); + + return tw.whos_line_format (args, nargout); } DEFMETHOD (silent_functions, interp, args, nargout, - doc: /* -*- texinfo -*- + doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} silent_functions () @deftypefnx {} {@var{old_val} =} silent_functions (@var{new_val}) @deftypefnx {} {@var{old_val} =} silent_functions (@var{new_val}, "local") @@ -5397,9 +5480,9 @@ The original variable value is restored when exiting the function. @end deftypefn */) { -tree_evaluator& tw = interp.get_evaluator (); - -return tw.silent_functions (args, nargout); + tree_evaluator& tw = interp.get_evaluator (); + + return tw.silent_functions (args, nargout); } /* @@ -5415,7 +5498,7 @@ */ DEFMETHOD (string_fill_char, interp, args, nargout, - doc: /* -*- texinfo -*- + doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} string_fill_char () @deftypefnx {} {@var{old_val} =} string_fill_char (@var{new_val}) @deftypefnx {} {@var{old_val} =} string_fill_char (@var{new_val}, "local") @@ -5440,9 +5523,9 @@ The original variable value is restored when exiting the function. @end deftypefn */) { -tree_evaluator& tw = interp.get_evaluator (); - -return tw.string_fill_char (args, nargout); + tree_evaluator& tw = interp.get_evaluator (); + + return tw.string_fill_char (args, nargout); } /* @@ -5464,7 +5547,7 @@ */ DEFMETHOD (PS4, interp, args, nargout, - doc: /* -*- texinfo -*- + doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} PS4 () @deftypefnx {} {@var{old_val} =} PS4 (@var{new_val}) @deftypefnx {} {@var{old_val} =} PS4 (@var{new_val}, "local") @@ -5480,11 +5563,11 @@ @seealso{echo, PS1, PS2} @end deftypefn */) { -return interp.PS4 (args, nargout); + return interp.PS4 (args, nargout); } DEFMETHOD (echo, interp, args, nargout, - doc: /* -*- texinfo -*- + doc: /* -*- texinfo -*- @deftypefn {} {} echo @deftypefnx {} {} echo on @deftypefnx {} {} echo off @@ -5524,9 +5607,9 @@ @seealso{PS4} @end deftypefn */) { -tree_evaluator& tw = interp.get_evaluator (); - -return tw.echo (args, nargout); + tree_evaluator& tw = interp.get_evaluator (); + + return tw.echo (args, nargout); } /* diff -r a2be40ce8fec -r 60515d0cd023 libinterp/parse-tree/pt-eval.h --- a/libinterp/parse-tree/pt-eval.h Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/parse-tree/pt-eval.h Tue Dec 12 23:14:33 2023 -0800 @@ -893,7 +893,7 @@ bool vm_dbgprofecho_flag () { return m_vm_dbg_profile_echo; } #endif - private: +private: template void execute_range_loop (const range& rng, int line, diff -r a2be40ce8fec -r 60515d0cd023 libinterp/parse-tree/pt-tm-const.cc --- a/libinterp/parse-tree/pt-tm-const.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/parse-tree/pt-tm-const.cc Tue Dec 12 23:14:33 2023 -0800 @@ -114,7 +114,8 @@ } } -void tm_row_const::init_element (const octave_value& val, bool& first_elem) +void +tm_row_const::init_element (const octave_value& val, bool& first_elem) { std::string this_elt_class_name = val.isobject () ? "class" : val.class_name (); @@ -178,7 +179,8 @@ // The common parts should be factored out into a single function that // is used by the others. -void tm_row_const::init (const tree_argument_list& row, tree_evaluator& tw) +void +tm_row_const::init (const tree_argument_list& row, tree_evaluator& tw) { bool first_elem = true; @@ -312,7 +314,8 @@ #endif -octave_value tm_const::concat (char string_fill_char) const +octave_value +tm_const::concat (char string_fill_char) const { if (m_tm_rows.empty ()) return Matrix (); @@ -403,7 +406,8 @@ // The common parts should be factored out into a single function that // is used by the others. -void tm_const::init (const tree_matrix& tm) +void +tm_const::init (const tree_matrix& tm) { bool first_elem = true; bool first_elem_is_struct = false; @@ -777,7 +781,8 @@ #endif -octave_value tm_const::char_array_concat (char string_fill_char) const +octave_value +tm_const::char_array_concat (char string_fill_char) const { char type = (m_all_dq_strings ? '"' : '\''); @@ -788,7 +793,8 @@ return octave_value (result, type); } -octave_value tm_const::class_concat () const +octave_value +tm_const::class_concat () const { octave_value retval; @@ -821,7 +827,8 @@ return retval; } -octave_value tm_const::generic_concat () const +octave_value +tm_const::generic_concat () const { // The line below might seem crazy, since we take a copy of the // first argument, resize it to be empty and then resize it to be @@ -924,7 +931,8 @@ // character arrays just to handle string_fill_char. template -void tm_const::array_concat_internal (TYPE& result) const +void +tm_const::array_concat_internal (TYPE& result) const { octave_idx_type r = 0; octave_idx_type c = 0; @@ -957,7 +965,8 @@ } template -TYPE tm_const::array_concat () const +TYPE +tm_const::array_concat () const { typedef typename TYPE::element_type ELT_T; @@ -1006,7 +1015,8 @@ } template -TYPE tm_const::sparse_array_concat () const +TYPE +tm_const::sparse_array_concat () const { if (m_dv.any_zero ()) return TYPE (m_dv); @@ -1040,7 +1050,8 @@ } template -octave_map tm_const::map_concat () const +octave_map +tm_const::map_concat () const { if (m_dv.any_zero ()) return octave_map (m_dv); diff -r a2be40ce8fec -r 60515d0cd023 libinterp/parse-tree/pt-walk.cc --- a/libinterp/parse-tree/pt-walk.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/libinterp/parse-tree/pt-walk.cc Tue Dec 12 23:14:33 2023 -0800 @@ -44,7 +44,8 @@ expression->accept (*this); } -void tree_walker::visit_argument_list (tree_argument_list& lst) +void +tree_walker::visit_argument_list (tree_argument_list& lst) { auto p = lst.begin (); @@ -57,7 +58,8 @@ } } -void tree_walker::visit_arguments_block (tree_arguments_block& blk) +void +tree_walker::visit_arguments_block (tree_arguments_block& blk) { tree_args_block_attribute_list *attribute_list = blk.attribute_list (); @@ -70,7 +72,8 @@ validation_list->accept (*this); } -void tree_walker::visit_args_block_attribute_list (tree_args_block_attribute_list& lst) +void +tree_walker::visit_args_block_attribute_list (tree_args_block_attribute_list& lst) { tree_identifier *attribute = lst.attribute (); @@ -78,7 +81,8 @@ attribute->accept (*this); } -void tree_walker::visit_args_block_validation_list (tree_args_block_validation_list& lst) +void +tree_walker::visit_args_block_validation_list (tree_args_block_validation_list& lst) { for (auto *elt : lst) { @@ -87,7 +91,8 @@ } } -void tree_walker::visit_arg_validation (tree_arg_validation& val) +void +tree_walker::visit_arg_validation (tree_arg_validation& val) { tree_expression *arg_name = val.identifier_expression (); @@ -115,7 +120,8 @@ default_value->accept (*this); } -void tree_walker::visit_arg_size_spec (tree_arg_size_spec& spec) +void +tree_walker::visit_arg_size_spec (tree_arg_size_spec& spec) { tree_argument_list *size_args = spec.size_args (); @@ -123,7 +129,8 @@ size_args->accept (*this); } -void tree_walker::visit_arg_validation_fcns (tree_arg_validation_fcns& spec) +void +tree_walker::visit_arg_validation_fcns (tree_arg_validation_fcns& spec) { tree_argument_list *fcn_args = spec.fcn_args (); @@ -131,7 +138,8 @@ fcn_args->accept (*this); } -void tree_walker::visit_binary_expression (tree_binary_expression& expr) +void +tree_walker::visit_binary_expression (tree_binary_expression& expr) { tree_expression *op1 = expr.lhs (); @@ -144,22 +152,26 @@ op2->accept (*this); } -void tree_walker::visit_boolean_expression (tree_boolean_expression& expr) +void +tree_walker::visit_boolean_expression (tree_boolean_expression& expr) { visit_binary_expression (expr); } -void tree_walker::visit_compound_binary_expression (tree_compound_binary_expression& expr) +void +tree_walker::visit_compound_binary_expression (tree_compound_binary_expression& expr) { visit_binary_expression (expr); } -void tree_walker::visit_break_command (tree_break_command&) +void +tree_walker::visit_break_command (tree_break_command&) { // Nothing to do. } -void tree_walker::visit_colon_expression (tree_colon_expression& expr) +void +tree_walker::visit_colon_expression (tree_colon_expression& expr) { tree_expression *op1 = expr.base (); @@ -177,12 +189,14 @@ op2->accept (*this); } -void tree_walker::visit_continue_command (tree_continue_command&) +void +tree_walker::visit_continue_command (tree_continue_command&) { // Nothing to do. } -void tree_walker::visit_decl_command (tree_decl_command& cmd) +void +tree_walker::visit_decl_command (tree_decl_command& cmd) { tree_decl_init_list *init_list = cmd.initializer_list (); @@ -190,7 +204,8 @@ init_list->accept (*this); } -void tree_walker::visit_decl_elt (tree_decl_elt& cmd) +void +tree_walker::visit_decl_elt (tree_decl_elt& cmd) { tree_identifier *id = cmd.ident (); @@ -203,7 +218,8 @@ expr->accept (*this); } -void tree_walker::visit_decl_init_list (tree_decl_init_list& lst) +void +tree_walker::visit_decl_init_list (tree_decl_init_list& lst) { // FIXME: tree_decl_elt is not derived from tree, so should it // really have an accept method? @@ -215,7 +231,8 @@ } } -void tree_walker::visit_simple_for_command (tree_simple_for_command& cmd) +void +tree_walker::visit_simple_for_command (tree_simple_for_command& cmd) { tree_expression *lhs = cmd.left_hand_side (); @@ -238,7 +255,8 @@ list->accept (*this); } -void tree_walker::visit_complex_for_command (tree_complex_for_command& cmd) +void +tree_walker::visit_complex_for_command (tree_complex_for_command& cmd) { tree_argument_list *lhs = cmd.left_hand_side (); @@ -256,7 +274,8 @@ list->accept (*this); } -void tree_walker::visit_spmd_command (tree_spmd_command& cmd) +void +tree_walker::visit_spmd_command (tree_spmd_command& cmd) { tree_statement_list *body = cmd.body (); @@ -264,7 +283,8 @@ body->accept (*this); } -void tree_walker::visit_octave_user_script (octave_user_script& fcn) +void +tree_walker::visit_octave_user_script (octave_user_script& fcn) { tree_statement_list *cmd_list = fcn.body (); @@ -272,7 +292,8 @@ cmd_list->accept (*this); } -void tree_walker::visit_octave_user_function (octave_user_function& fcn) +void +tree_walker::visit_octave_user_function (octave_user_function& fcn) { tree_statement_list *cmd_list = fcn.body (); @@ -280,7 +301,8 @@ cmd_list->accept (*this); } -void tree_walker::visit_function_def (tree_function_def& fdef) +void +tree_walker::visit_function_def (tree_function_def& fdef) { octave_value fcn = fdef.function (); @@ -290,12 +312,14 @@ f->accept (*this); } -void tree_walker::visit_identifier (tree_identifier&) +void +tree_walker::visit_identifier (tree_identifier&) { // Nothing to do. } -void tree_walker::visit_if_clause (tree_if_clause& cmd) +void +tree_walker::visit_if_clause (tree_if_clause& cmd) { tree_expression *expr = cmd.condition (); @@ -308,7 +332,8 @@ list->accept (*this); } -void tree_walker::visit_if_command (tree_if_command& cmd) +void +tree_walker::visit_if_command (tree_if_command& cmd) { tree_if_command_list *list = cmd.cmd_list (); @@ -316,7 +341,8 @@ list->accept (*this); } -void tree_walker::visit_if_command_list (tree_if_command_list& lst) +void +tree_walker::visit_if_command_list (tree_if_command_list& lst) { auto p = lst.begin (); @@ -329,7 +355,8 @@ } } -void tree_walker::visit_switch_case (tree_switch_case& cs) +void +tree_walker::visit_switch_case (tree_switch_case& cs) { tree_expression *label = cs.case_label (); @@ -342,7 +369,8 @@ list->accept (*this); } -void tree_walker::visit_switch_case_list (tree_switch_case_list& lst) +void +tree_walker::visit_switch_case_list (tree_switch_case_list& lst) { auto p = lst.begin (); @@ -355,7 +383,8 @@ } } -void tree_walker::visit_switch_command (tree_switch_command& cmd) +void +tree_walker::visit_switch_command (tree_switch_command& cmd) { tree_expression *expr = cmd.switch_value (); @@ -368,7 +397,8 @@ list->accept (*this); } -void tree_walker::visit_index_expression (tree_index_expression& expr) +void +tree_walker::visit_index_expression (tree_index_expression& expr) { tree_expression *e = expr.expression (); @@ -421,7 +451,8 @@ } } -void tree_walker::visit_matrix (tree_matrix& lst) +void +tree_walker::visit_matrix (tree_matrix& lst) { auto p = lst.begin (); @@ -434,7 +465,8 @@ } } -void tree_walker::visit_cell (tree_cell& lst) +void +tree_walker::visit_cell (tree_cell& lst) { auto p = lst.begin (); @@ -447,7 +479,8 @@ } } -void tree_walker::visit_multi_assignment (tree_multi_assignment& expr) +void +tree_walker::visit_multi_assignment (tree_multi_assignment& expr) { tree_argument_list *lhs = expr.left_hand_side (); @@ -460,22 +493,26 @@ rhs->accept (*this); } -void tree_walker::visit_no_op_command (tree_no_op_command&) +void +tree_walker::visit_no_op_command (tree_no_op_command&) { // Nothing to do. } -void tree_walker::visit_constant (tree_constant&) +void +tree_walker::visit_constant (tree_constant&) { // Nothing to do. } -void tree_walker::visit_fcn_handle (tree_fcn_handle&) +void +tree_walker::visit_fcn_handle (tree_fcn_handle&) { // Nothing to do. } -void tree_walker::visit_parameter_list (tree_parameter_list& lst) +void +tree_walker::visit_parameter_list (tree_parameter_list& lst) { auto p = lst.begin (); @@ -488,7 +525,8 @@ } } -void tree_walker::visit_postfix_expression (tree_postfix_expression& expr) +void +tree_walker::visit_postfix_expression (tree_postfix_expression& expr) { tree_expression *e = expr.operand (); @@ -496,7 +534,8 @@ e->accept (*this); } -void tree_walker::visit_prefix_expression (tree_prefix_expression& expr) +void +tree_walker::visit_prefix_expression (tree_prefix_expression& expr) { tree_expression *e = expr.operand (); @@ -504,12 +543,14 @@ e->accept (*this); } -void tree_walker::visit_return_command (tree_return_command&) +void +tree_walker::visit_return_command (tree_return_command&) { // Nothing to do. } -void tree_walker::visit_simple_assignment (tree_simple_assignment& expr) +void +tree_walker::visit_simple_assignment (tree_simple_assignment& expr) { tree_expression *lhs = expr.left_hand_side (); @@ -522,7 +563,8 @@ rhs->accept (*this); } -void tree_walker::visit_statement (tree_statement& stmt) +void +tree_walker::visit_statement (tree_statement& stmt) { tree_command *cmd = stmt.command (); @@ -537,7 +579,8 @@ } } -void tree_walker::visit_statement_list (tree_statement_list& lst) +void +tree_walker::visit_statement_list (tree_statement_list& lst) { for (tree_statement *elt : lst) { @@ -546,7 +589,8 @@ } } -void tree_walker::visit_try_catch_command (tree_try_catch_command& cmd) +void +tree_walker::visit_try_catch_command (tree_try_catch_command& cmd) { tree_statement_list *try_code = cmd.body (); @@ -564,7 +608,8 @@ catch_code->accept (*this); } -void tree_walker::visit_unwind_protect_command (tree_unwind_protect_command& cmd) +void +tree_walker::visit_unwind_protect_command (tree_unwind_protect_command& cmd) { tree_statement_list *unwind_protect_code = cmd.body (); @@ -577,7 +622,8 @@ cleanup_code->accept (*this); } -void tree_walker::visit_while_command (tree_while_command& cmd) +void +tree_walker::visit_while_command (tree_while_command& cmd) { tree_expression *expr = cmd.condition (); @@ -590,7 +636,8 @@ list->accept (*this); } -void tree_walker::visit_do_until_command (tree_do_until_command& cmd) +void +tree_walker::visit_do_until_command (tree_do_until_command& cmd) { tree_statement_list *list = cmd.body (); @@ -603,17 +650,20 @@ expr->accept (*this); } -void tree_walker::visit_superclass_ref (tree_superclass_ref&) +void +tree_walker::visit_superclass_ref (tree_superclass_ref&) { // Nothing to do. } -void tree_walker::visit_metaclass_query (tree_metaclass_query&) +void +tree_walker::visit_metaclass_query (tree_metaclass_query&) { // Nothing to do. } -void tree_walker::visit_classdef_attribute (tree_classdef_attribute& attr) +void +tree_walker::visit_classdef_attribute (tree_classdef_attribute& attr) { tree_identifier *id = attr.ident (); @@ -626,7 +676,8 @@ expr->accept (*this); } -void tree_walker::visit_classdef_attribute_list (tree_classdef_attribute_list& lst) +void +tree_walker::visit_classdef_attribute_list (tree_classdef_attribute_list& lst) { for (auto *elt : lst) { @@ -635,12 +686,14 @@ } } -void tree_walker::visit_classdef_superclass (tree_classdef_superclass&) +void +tree_walker::visit_classdef_superclass (tree_classdef_superclass&) { // Nothing to do. } -void tree_walker::visit_classdef_superclass_list (tree_classdef_superclass_list& lst) +void +tree_walker::visit_classdef_superclass_list (tree_classdef_superclass_list& lst) { for (auto *elt : lst) { @@ -649,13 +702,15 @@ } } -void tree_walker::visit_classdef_property (tree_classdef_property&) +void +tree_walker::visit_classdef_property (tree_classdef_property&) { // FIXME: Should we operate on the tree_arg_validation object or the // identifier and expression parts separately? } -void tree_walker::visit_classdef_property_list (tree_classdef_property_list& lst) +void +tree_walker::visit_classdef_property_list (tree_classdef_property_list& lst) { for (auto *elt : lst) { @@ -664,7 +719,8 @@ } } -void tree_walker::visit_classdef_properties_block (tree_classdef_properties_block& blk) +void +tree_walker::visit_classdef_properties_block (tree_classdef_properties_block& blk) { tree_classdef_property_list *property_list = blk.element_list (); @@ -672,7 +728,8 @@ property_list->accept (*this); } -void tree_walker::visit_classdef_methods_list (tree_classdef_methods_list& lst) +void +tree_walker::visit_classdef_methods_list (tree_classdef_methods_list& lst) { for (auto ov_meth : lst) { @@ -683,7 +740,8 @@ } } -void tree_walker::visit_classdef_methods_block (tree_classdef_methods_block& blk) +void +tree_walker::visit_classdef_methods_block (tree_classdef_methods_block& blk) { tree_classdef_methods_list *methods_list = blk.element_list (); @@ -691,12 +749,14 @@ methods_list->accept (*this); } -void tree_walker::visit_classdef_event (tree_classdef_event&) +void +tree_walker::visit_classdef_event (tree_classdef_event&) { // Nothing to do. } -void tree_walker::visit_classdef_events_list (tree_classdef_events_list& lst) +void +tree_walker::visit_classdef_events_list (tree_classdef_events_list& lst) { for (auto *elt : lst) { @@ -705,7 +765,8 @@ } } -void tree_walker::visit_classdef_events_block (tree_classdef_events_block& blk) +void +tree_walker::visit_classdef_events_block (tree_classdef_events_block& blk) { tree_classdef_events_list *events_list = blk.element_list (); @@ -713,12 +774,14 @@ events_list->accept (*this); } -void tree_walker::visit_classdef_enum (tree_classdef_enum&) +void +tree_walker::visit_classdef_enum (tree_classdef_enum&) { // Nothing to do. } -void tree_walker::visit_classdef_enum_list (tree_classdef_enum_list& lst) +void +tree_walker::visit_classdef_enum_list (tree_classdef_enum_list& lst) { for (auto *elt : lst) { @@ -727,7 +790,8 @@ } } -void tree_walker::visit_classdef_enum_block (tree_classdef_enum_block& blk) +void +tree_walker::visit_classdef_enum_block (tree_classdef_enum_block& blk) { tree_classdef_enum_list *enum_list = blk.element_list (); @@ -735,7 +799,8 @@ enum_list->accept (*this); } -void tree_walker::visit_classdef_body (tree_classdef_body& body) +void +tree_walker::visit_classdef_body (tree_classdef_body& body) { for (auto *elt : body.properties_list ()) { @@ -763,7 +828,8 @@ } } -void tree_walker::visit_classdef (tree_classdef& cdef) +void +tree_walker::visit_classdef (tree_classdef& cdef) { tree_classdef_attribute_list *attribute_list = cdef.attribute_list (); diff -r a2be40ce8fec -r 60515d0cd023 liboctave/array/Array-b.cc --- a/liboctave/array/Array-b.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/array/Array-b.cc Tue Dec 12 23:14:33 2023 -0800 @@ -46,7 +46,8 @@ // Specialize bool sorting (aka stable partitioning). template -static void do_bool_partition (bool *data, octave_idx_type nel) +static void +do_bool_partition (bool *data, octave_idx_type nel) { octave_idx_type k = 0; for (octave_idx_type i = 0; i < nel; i++) @@ -57,8 +58,9 @@ } template -static void do_bool_partition (bool *data, octave_idx_type *idx, - octave_idx_type nel) +static void +do_bool_partition (bool *data, octave_idx_type *idx, + octave_idx_type nel) { // FIXME: This is essentially a simple bucket sort. // Can it be efficiently done by std::partition? diff -r a2be40ce8fec -r 60515d0cd023 liboctave/array/Array-base.cc --- a/liboctave/array/Array-base.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/array/Array-base.cc Tue Dec 12 23:14:33 2023 -0800 @@ -197,7 +197,7 @@ template octave_idx_type Array::compute_index (octave_idx_type i, octave_idx_type j, - octave_idx_type k) const + octave_idx_type k) const { return ::compute_index (i, j, k, m_dimensions); } @@ -266,7 +266,7 @@ template typename Array::crefT Array::checkelem (octave_idx_type i, octave_idx_type j, - octave_idx_type k) const + octave_idx_type k) const { return elem (compute_index (i, j, k)); } @@ -1067,7 +1067,7 @@ template Array Array::index (const octave::idx_vector& i, const octave::idx_vector& j, - bool resize_ok, const T& rfv) const + bool resize_ok, const T& rfv) const { Array tmp = *this; if (resize_ok) @@ -1095,7 +1095,7 @@ template Array Array::index (const Array& ia, - bool resize_ok, const T& rfv) const + bool resize_ok, const T& rfv) const { Array tmp = *this; if (resize_ok) @@ -1173,7 +1173,7 @@ template void Array::assign (const octave::idx_vector& i, const octave::idx_vector& j, - const Array& rhs, const T& rfv) + const Array& rhs, const T& rfv) { bool initial_dims_all_zero = m_dimensions.all_zero (); @@ -1277,7 +1277,7 @@ template void Array::assign (const Array& ia, - const Array& rhs, const T& rfv) + const Array& rhs, const T& rfv) { int ial = ia.numel (); @@ -2760,7 +2760,8 @@ } template -bool Array::optimize_dimensions (const dim_vector& dv) +bool +Array::optimize_dimensions (const dim_vector& dv) { bool retval = m_dimensions == dv; if (retval) @@ -2770,7 +2771,8 @@ } template -void Array::instantiation_guard () +void +Array::instantiation_guard () { // This guards against accidental implicit instantiations. // Array instances should always be explicit and use INSTANTIATE_ARRAY. diff -r a2be40ce8fec -r 60515d0cd023 liboctave/array/CMatrix.cc --- a/liboctave/array/CMatrix.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/array/CMatrix.cc Tue Dec 12 23:14:33 2023 -0800 @@ -3625,9 +3625,10 @@ return result; } -ComplexMatrix linspace (const ComplexColumnVector& x1, - const ComplexColumnVector& x2, - octave_idx_type n) +ComplexMatrix +linspace (const ComplexColumnVector& x1, + const ComplexColumnVector& x2, + octave_idx_type n) { octave_idx_type m = x1.numel (); diff -r a2be40ce8fec -r 60515d0cd023 liboctave/array/CNDArray.cc --- a/liboctave/array/CNDArray.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/array/CNDArray.cc Tue Dec 12 23:14:33 2023 -0800 @@ -649,7 +649,8 @@ return a; } -ComplexNDArray& operator /= (ComplexNDArray& a, double s) +ComplexNDArray& +operator /= (ComplexNDArray& a, double s) { if (a.is_shared ()) return a = a / s; diff -r a2be40ce8fec -r 60515d0cd023 liboctave/array/CSparse.cc --- a/liboctave/array/CSparse.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/array/CSparse.cc Tue Dec 12 23:14:33 2023 -0800 @@ -7421,7 +7421,8 @@ #undef COL_EXPR } -SparseMatrix SparseComplexMatrix::abs () const +SparseMatrix +SparseComplexMatrix::abs () const { octave_idx_type nz = nnz (); octave_idx_type nc = cols (); diff -r a2be40ce8fec -r 60515d0cd023 liboctave/array/MArray.cc --- a/liboctave/array/MArray.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/array/MArray.cc Tue Dec 12 23:14:33 2023 -0800 @@ -149,8 +149,9 @@ } template -void MArray::idx_add_nd (const octave::idx_vector& idx, - const MArray& vals, int dim) +void +MArray::idx_add_nd (const octave::idx_vector& idx, + const MArray& vals, int dim) { int nd = std::max (this->ndims (), vals.ndims ()); if (dim < 0) @@ -373,7 +374,8 @@ } template -void MArray::instantiation_guard () +void +MArray::instantiation_guard () { // This guards against accidental implicit instantiations. // Array instances should always be explicit and use INSTANTIATE_ARRAY. diff -r a2be40ce8fec -r 60515d0cd023 liboctave/array/Range.cc --- a/liboctave/array/Range.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/array/Range.cc Tue Dec 12 23:14:33 2023 -0800 @@ -72,7 +72,8 @@ } template -bool xteq (T u, T v, T ct = 3 * std::numeric_limits::epsilon ()) +bool +xteq (T u, T v, T ct = 3 * std::numeric_limits::epsilon ()) { T tu = std::abs (u); T tv = std::abs (v); @@ -81,7 +82,8 @@ } template -octave_idx_type xnumel_internal (T base, T limit, T inc) +octave_idx_type +xnumel_internal (T base, T limit, T inc) { octave_idx_type retval = -1; if (! math::isfinite (base) || ! math::isfinite (inc) @@ -133,7 +135,8 @@ } template -bool xall_elements_are_ints (T base, T inc, T final_val, octave_idx_type nel) +bool +xall_elements_are_ints (T base, T inc, T final_val, octave_idx_type nel) { // If the range is empty or NaN then there are no elements so there // can be no int elements. diff -r a2be40ce8fec -r 60515d0cd023 liboctave/array/Sparse.cc --- a/liboctave/array/Sparse.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/array/Sparse.cc Tue Dec 12 23:14:33 2023 -0800 @@ -197,8 +197,7 @@ template OCTAVE_API -Sparse::Sparse (octave_idx_type nr, octave_idx_type nc, - T val) +Sparse::Sparse (octave_idx_type nr, octave_idx_type nc, T val) : m_rep (nullptr), m_dimensions (dim_vector (nr, nc)) { if (val != T ()) @@ -774,8 +773,8 @@ template OCTAVE_API T -Sparse::range_error (const char *fcn, octave_idx_type i, - octave_idx_type j) const +Sparse::range_error (const char *fcn, + octave_idx_type i, octave_idx_type j) const { (*current_liboctave_error_handler) ("%s (%" OCTAVE_IDX_TYPE_FORMAT ", %" OCTAVE_IDX_TYPE_FORMAT "): " @@ -785,8 +784,8 @@ template OCTAVE_API T& -Sparse::range_error (const char *fcn, octave_idx_type i, - octave_idx_type j) +Sparse::range_error (const char *fcn, + octave_idx_type i, octave_idx_type j) { (*current_liboctave_error_handler) ("%s (%" OCTAVE_IDX_TYPE_FORMAT ", %" OCTAVE_IDX_TYPE_FORMAT "): " @@ -797,7 +796,7 @@ OCTAVE_API T Sparse::range_error (const char *fcn, - const Array& ra_idx) const + const Array& ra_idx) const { std::ostringstream buf; @@ -2031,8 +2030,7 @@ template OCTAVE_API void -Sparse::assign (const octave::idx_vector& idx, - const T& rhs) +Sparse::assign (const octave::idx_vector& idx, const T& rhs) { // FIXME: Converting the RHS and forwarding to the sparse matrix // assignment function is simpler, but it might be good to have a diff -r a2be40ce8fec -r 60515d0cd023 liboctave/array/Sparse.h --- a/liboctave/array/Sparse.h Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/array/Sparse.h Tue Dec 12 23:14:33 2023 -0800 @@ -56,7 +56,7 @@ // The real representation of all Sparse arrays. //-------------------------------------------------------------------- -class SparseRep : public Alloc + class SparseRep : public Alloc { public: @@ -290,8 +290,8 @@ Sparse (const dim_vector& dv, octave_idx_type nz, T *ptr, octave_idx_type *ridx, octave_idx_type *cidx, const Alloc& xallocator = Alloc ()) - : m_rep (new typename Sparse::SparseRep (dv, nz, ptr, ridx, cidx, xallocator)), - m_dimensions (dv) + : m_rep (new typename Sparse::SparseRep (dv, nz, ptr, ridx, cidx, xallocator)), + m_dimensions (dv) { } // Both SparseMatrix and SparseBoolMatrix need this ctor, and this diff -r a2be40ce8fec -r 60515d0cd023 liboctave/array/dMatrix.cc --- a/liboctave/array/dMatrix.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/array/dMatrix.cc Tue Dec 12 23:14:33 2023 -0800 @@ -3008,9 +3008,10 @@ return result; } -Matrix linspace (const ColumnVector& x1, - const ColumnVector& x2, - octave_idx_type n) +Matrix +linspace (const ColumnVector& x1, + const ColumnVector& x2, + octave_idx_type n) { octave_idx_type m = x1.numel (); diff -r a2be40ce8fec -r 60515d0cd023 liboctave/array/fCMatrix.cc --- a/liboctave/array/fCMatrix.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/array/fCMatrix.cc Tue Dec 12 23:14:33 2023 -0800 @@ -2849,7 +2849,8 @@ return FloatComplexNDArray::sumsq (dim); } -FloatMatrix FloatComplexMatrix::abs () const +FloatMatrix +FloatComplexMatrix::abs () const { return FloatComplexNDArray::abs (); } @@ -3655,9 +3656,10 @@ return result; } -FloatComplexMatrix linspace (const FloatComplexColumnVector& x1, - const FloatComplexColumnVector& x2, - octave_idx_type n) +FloatComplexMatrix +linspace (const FloatComplexColumnVector& x1, + const FloatComplexColumnVector& x2, + octave_idx_type n) { octave_idx_type m = x1.numel (); diff -r a2be40ce8fec -r 60515d0cd023 liboctave/array/fCNDArray.cc --- a/liboctave/array/fCNDArray.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/array/fCNDArray.cc Tue Dec 12 23:14:33 2023 -0800 @@ -664,7 +664,8 @@ return a; } -FloatComplexNDArray& operator /= (FloatComplexNDArray& a, float s) +FloatComplexNDArray& +operator /= (FloatComplexNDArray& a, float s) { if (a.is_shared ()) a = a / s; diff -r a2be40ce8fec -r 60515d0cd023 liboctave/array/fMatrix.cc --- a/liboctave/array/fMatrix.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/array/fMatrix.cc Tue Dec 12 23:14:33 2023 -0800 @@ -3014,9 +3014,10 @@ return result; } -FloatMatrix linspace (const FloatColumnVector& x1, - const FloatColumnVector& x2, - octave_idx_type n) +FloatMatrix +linspace (const FloatColumnVector& x1, + const FloatColumnVector& x2, + octave_idx_type n) { octave_idx_type m = x1.numel (); diff -r a2be40ce8fec -r 60515d0cd023 liboctave/array/idx-vector.cc --- a/liboctave/array/idx-vector.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/array/idx-vector.cc Tue Dec 12 23:14:33 2023 -0800 @@ -49,19 +49,22 @@ (*current_liboctave_error_handler) ("invalid range used as index"); } -OCTAVE_NORETURN static void err_index_out_of_range () +OCTAVE_NORETURN static void +err_index_out_of_range () { (*current_liboctave_error_handler) ("internal error: idx_vector index out of range"); } -idx_vector::idx_vector_rep *idx_vector::nil_rep () +idx_vector::idx_vector_rep * +idx_vector::nil_rep () { static idx_vector_rep ivr; return &ivr; } -Array idx_vector::idx_base_rep::as_array () +Array +idx_vector::idx_base_rep::as_array () { (*current_liboctave_error_handler) ("internal error: as_array not allowed for this index class"); @@ -94,7 +97,8 @@ ("internal error: idx_colon_rep::sort_idx"); } -std::ostream& idx_vector::idx_colon_rep::print (std::ostream& os) const +std::ostream& +idx_vector::idx_colon_rep::print (std::ostream& os) const { return os << ':'; } @@ -154,7 +158,8 @@ return m_start + i*m_step; } -idx_vector::idx_base_rep *idx_vector::idx_range_rep::sort_uniq_clone (bool) +idx_vector::idx_base_rep * +idx_vector::idx_range_rep::sort_uniq_clone (bool) { if (m_step < 0) return new idx_range_rep (m_start + (m_len - 1)*m_step, m_len, -m_step, DIRECT); @@ -185,19 +190,22 @@ } } -std::ostream& idx_vector::idx_range_rep::print (std::ostream& os) const +std::ostream& +idx_vector::idx_range_rep::print (std::ostream& os) const { os << m_start << ':' << m_step << ':' << m_start + m_len *m_step; return os; } -range idx_vector::idx_range_rep::unconvert () const +range +idx_vector::idx_range_rep::unconvert () const { return range::make_n_element_range (static_cast (m_start+1), static_cast (m_step), m_len); } -Array idx_vector::idx_range_rep::as_array () +Array +idx_vector::idx_range_rep::as_array () { Array retval (dim_vector (1, m_len)); for (octave_idx_type i = 0; i < m_len; i++) @@ -206,7 +214,8 @@ return retval; } -inline octave_idx_type convert_index (octave_idx_type i, octave_idx_type& ext) +inline octave_idx_type +convert_index (octave_idx_type i, octave_idx_type& ext) { if (i <= 0) err_invalid_index (i-1); @@ -217,7 +226,8 @@ return i - 1; } -inline octave_idx_type convert_index (double x, octave_idx_type& ext) +inline octave_idx_type +convert_index (double x, octave_idx_type& ext) { octave_idx_type i = static_cast (x); @@ -227,13 +237,15 @@ return convert_index (i, ext); } -inline octave_idx_type convert_index (float x, octave_idx_type& ext) +inline octave_idx_type +convert_index (float x, octave_idx_type& ext) { return convert_index (static_cast (x), ext); } template -inline octave_idx_type convert_index (octave_int x, octave_idx_type& ext) +inline octave_idx_type +convert_index (octave_int x, octave_idx_type& ext) { octave_idx_type i = octave_int (x).value (); @@ -274,17 +286,20 @@ return this; } -std::ostream& idx_vector::idx_scalar_rep::print (std::ostream& os) const +std::ostream& +idx_vector::idx_scalar_rep::print (std::ostream& os) const { return os << m_data; } -double idx_vector::idx_scalar_rep::unconvert () const +double +idx_vector::idx_scalar_rep::unconvert () const { return m_data + 1; } -Array idx_vector::idx_scalar_rep::as_array () +Array +idx_vector::idx_scalar_rep::as_array () { return Array (dim_vector (1, 1), m_data); } @@ -566,7 +581,8 @@ return new_rep.release (); } -std::ostream& idx_vector::idx_vector_rep::print (std::ostream& os) const +std::ostream& +idx_vector::idx_vector_rep::print (std::ostream& os) const { os << '['; @@ -581,7 +597,8 @@ return os; } -Array idx_vector::idx_vector_rep::unconvert () const +Array +idx_vector::idx_vector_rep::unconvert () const { Array retval (m_orig_dims); for (octave_idx_type i = 0; i < m_len; i++) @@ -589,7 +606,8 @@ return retval; } -Array idx_vector::idx_vector_rep::as_array () +Array +idx_vector::idx_vector_rep::as_array () { if (m_aowner) return *m_aowner; @@ -653,7 +671,8 @@ delete [] m_data; } -octave_idx_type idx_vector::idx_mask_rep::xelem (octave_idx_type n) const +octave_idx_type +idx_vector::idx_mask_rep::xelem (octave_idx_type n) const { if (n == m_lsti + 1) { @@ -670,7 +689,8 @@ return m_lste; } -octave_idx_type idx_vector::idx_mask_rep::checkelem (octave_idx_type n) const +octave_idx_type +idx_vector::idx_mask_rep::checkelem (octave_idx_type n) const { if (n < 0 || n >= m_len) err_invalid_index (n); @@ -678,7 +698,8 @@ return xelem (n); } -std::ostream& idx_vector::idx_mask_rep::print (std::ostream& os) const +std::ostream& +idx_vector::idx_mask_rep::print (std::ostream& os) const { os << '['; @@ -693,7 +714,8 @@ return os; } -Array idx_vector::idx_mask_rep::unconvert () const +Array +idx_vector::idx_mask_rep::unconvert () const { if (m_aowner) return *m_aowner; @@ -706,7 +728,8 @@ } } -Array idx_vector::idx_mask_rep::as_array () +Array +idx_vector::idx_mask_rep::as_array () { if (m_aowner) return m_aowner->find ().reshape (m_orig_dims); @@ -746,8 +769,9 @@ m_rep = new idx_mask_rep (bnda, nnz); } -bool idx_vector::maybe_reduce (octave_idx_type n, const idx_vector& j, - octave_idx_type nj) +bool +idx_vector::maybe_reduce (octave_idx_type n, const idx_vector& j, + octave_idx_type nj) { bool reduced = false; @@ -914,8 +938,9 @@ return reduced; } -bool idx_vector::is_cont_range (octave_idx_type n, octave_idx_type& l, - octave_idx_type& u) const +bool +idx_vector::is_cont_range (octave_idx_type n, octave_idx_type& l, + octave_idx_type& u) const { bool res = false; @@ -967,7 +992,8 @@ return res; } -octave_idx_type idx_vector::increment () const +octave_idx_type +idx_vector::increment () const { octave_idx_type retval = 0; @@ -996,7 +1022,8 @@ return retval; } -const octave_idx_type *idx_vector::raw () +const octave_idx_type * +idx_vector::raw () { if (m_rep->idx_class () != class_vector) *this = idx_vector (as_array (), extent (0)); @@ -1008,7 +1035,8 @@ return r->get_data (); } -void idx_vector::copy_data (octave_idx_type *m_data) const +void +idx_vector::copy_data (octave_idx_type *m_data) const { octave_idx_type m_len = m_rep->length (0); @@ -1065,7 +1093,8 @@ } } -idx_vector idx_vector::complement (octave_idx_type n) const +idx_vector +idx_vector::complement (octave_idx_type n) const { idx_vector retval; if (extent (n) > n) @@ -1095,7 +1124,8 @@ return retval; } -bool idx_vector::is_permutation (octave_idx_type n) const +bool +idx_vector::is_permutation (octave_idx_type n) const { bool retval = false; @@ -1123,7 +1153,8 @@ return retval; } -idx_vector idx_vector::inverse_permutation (octave_idx_type n) const +idx_vector +idx_vector::inverse_permutation (octave_idx_type n) const { assert (n == length (n)); @@ -1157,7 +1188,8 @@ return retval; } -idx_vector idx_vector::unmask () const +idx_vector +idx_vector::unmask () const { if (idx_class () == class_mask) { @@ -1180,9 +1212,10 @@ return *this; } -void idx_vector::unconvert (idx_class_type& iclass, - double& scalar, range& range, - Array& array, Array& mask) const +void +idx_vector::unconvert (idx_class_type& iclass, + double& scalar, range& range, + Array& array, Array& mask) const { iclass = idx_class (); switch (iclass) @@ -1224,12 +1257,14 @@ } } -Array idx_vector::as_array () const +Array +idx_vector::as_array () const { return m_rep->as_array (); } -bool idx_vector::isvector () const +bool +idx_vector::isvector () const { return idx_class () != class_vector || orig_dimensions ().isvector (); } @@ -1244,7 +1279,8 @@ return length (z_len); } -octave_idx_type idx_vector::ones_count () const +octave_idx_type +idx_vector::ones_count () const { octave_idx_type n = 0; diff -r a2be40ce8fec -r 60515d0cd023 liboctave/numeric/CollocWt.cc --- a/liboctave/numeric/CollocWt.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/numeric/CollocWt.cc Tue Dec 12 23:14:33 2023 -0800 @@ -147,9 +147,10 @@ // dif3 : one dimensional vector containing the third derivative // of the node polynomial at the zeros -static bool jcobi (octave_idx_type n, octave_idx_type n0, octave_idx_type n1, - double alpha, double beta, double *dif1, double *dif2, - double *dif3, double *root) +static bool +jcobi (octave_idx_type n, octave_idx_type n0, octave_idx_type n1, + double alpha, double beta, double *dif1, double *dif2, + double *dif3, double *root) { assert (n0 == 0 || n0 == 1); assert (n1 == 0 || n1 == 1); @@ -308,9 +309,10 @@ // // vect : one dimensional vector of computed weights -static void dfopr (octave_idx_type n, octave_idx_type n0, octave_idx_type n1, - octave_idx_type i, octave_idx_type id, double *dif1, - double *dif2, double *dif3, double *root, double *vect) +static void +dfopr (octave_idx_type n, octave_idx_type n0, octave_idx_type n1, + octave_idx_type i, octave_idx_type id, double *dif1, + double *dif2, double *dif3, double *root, double *vect) { assert (n0 == 0 || n0 == 1); assert (n1 == 0 || n1 == 1); @@ -377,12 +379,14 @@ // Error handling. -void CollocWt::error (const char *msg) +void +CollocWt::error (const char *msg) { (*current_liboctave_error_handler) ("CollocWt: fatal error '%s'", msg); } -CollocWt& CollocWt::set_left (double val) +CollocWt& +CollocWt::set_left (double val) { if (val >= m_rb) error ("CollocWt: left bound greater than right bound"); @@ -392,7 +396,8 @@ return *this; } -CollocWt& CollocWt::set_right (double val) +CollocWt& +CollocWt::set_right (double val) { if (val <= m_lb) error ("CollocWt: right bound less than left bound"); @@ -402,7 +407,8 @@ return *this; } -void CollocWt::init () +void +CollocWt::init () { // Check for possible errors. @@ -479,7 +485,8 @@ m_initialized = 1; } -std::ostream& operator << (std::ostream& os, const CollocWt& a) +std::ostream& +operator << (std::ostream& os, const CollocWt& a) { if (a.left_included ()) os << "left boundary is included\n"; diff -r a2be40ce8fec -r 60515d0cd023 liboctave/numeric/gsvd.cc --- a/liboctave/numeric/gsvd.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/numeric/gsvd.cc Tue Dec 12 23:14:33 2023 -0800 @@ -53,7 +53,8 @@ #define xSTRINGIZE(x) #x #define STRINGIZE(x) xSTRINGIZE(x) -static void initialize_gsvd () +static void +initialize_gsvd () { if (gsvd_initialized) return; diff -r a2be40ce8fec -r 60515d0cd023 liboctave/numeric/lo-mappers.cc --- a/liboctave/numeric/lo-mappers.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/numeric/lo-mappers.cc Tue Dec 12 23:14:33 2023 -0800 @@ -125,12 +125,14 @@ return y; } -double frexp (double x, int *expptr) +double +frexp (double x, int *expptr) { return octave_frexp_wrapper (x, expptr); } -float frexp (float x, int *expptr) +float +frexp (float x, int *expptr) { return octave_frexpf_wrapper (x, expptr); } @@ -175,8 +177,10 @@ return (ax != lax) ? (x / ax) * lax : x; } -bool negative_sign (double x) { return __lo_ieee_signbit (x); } -bool negative_sign (float x) { return __lo_ieee_float_signbit (x); } +bool +negative_sign (double x) { return __lo_ieee_signbit (x); } +bool +negative_sign (float x) { return __lo_ieee_float_signbit (x); } // Sometimes you need a large integer, but not always. diff -r a2be40ce8fec -r 60515d0cd023 liboctave/numeric/lo-specfun.cc --- a/liboctave/numeric/lo-specfun.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/numeric/lo-specfun.cc Tue Dec 12 23:14:33 2023 -0800 @@ -1463,8 +1463,10 @@ } // Real and complex Dawson function (= scaled erfi) from Faddeeva package -double dawson (double x) { return Faddeeva::Dawson (x); } -float dawson (float x) { return Faddeeva::Dawson (x); } +double +dawson (double x) { return Faddeeva::Dawson (x); } +float +dawson (float x) { return Faddeeva::Dawson (x); } Complex dawson (const Complex& x) @@ -1616,7 +1618,8 @@ // different input domain of erfcinv. See the notes for erfinv for an // explanation. -static double do_erfcinv (double x, bool refine) +static double +do_erfcinv (double x, bool refine) { // Coefficients of rational approximation. static const double a[] = @@ -1690,19 +1693,23 @@ return y; } -double erfcinv (double x) +double +erfcinv (double x) { return do_erfcinv (x, true); } -float erfcinv (float x) +float +erfcinv (float x) { return do_erfcinv (x, false); } // Real and complex scaled complementary error function from Faddeeva pkg. -double erfcx (double x) { return Faddeeva::erfcx (x); } -float erfcx (float x) { return Faddeeva::erfcx (x); } +double +erfcx (double x) { return Faddeeva::erfcx (x); } +float +erfcx (float x) { return Faddeeva::erfcx (x); } Complex erfcx (const Complex& x) @@ -1720,8 +1727,10 @@ } // Real and complex imaginary error function from Faddeeva package -double erfi (double x) { return Faddeeva::erfi (x); } -float erfi (float x) { return Faddeeva::erfi (x); } +double +erfi (double x) { return Faddeeva::erfi (x); } +float +erfi (float x) { return Faddeeva::erfi (x); } Complex erfi (const Complex& x) @@ -1746,7 +1755,8 @@ // order method. For single precision, the accuracy is already OK, so // we skip it to get faster evaluation. -static double do_erfinv (double x, bool refine) +static double +do_erfinv (double x, bool refine) { // Coefficients of rational approximation. static const double a[] = @@ -1809,12 +1819,14 @@ return y; } -double erfinv (double x) +double +erfinv (double x) { return do_erfinv (x, true); } -float erfinv (float x) +float +erfinv (float x) { return do_erfinv (x, false); } @@ -2045,8 +2057,10 @@ } // explicit instantiations -double psi (double z) { return xpsi (z); } -float psi (float z) { return xpsi (z); } +double +psi (double z) { return xpsi (z); } +float +psi (float z) { return xpsi (z); } template std::complex @@ -2094,8 +2108,10 @@ } // explicit instantiations -Complex psi (const Complex& z) { return xpsi (z); } -FloatComplex psi (const FloatComplex& z) { return xpsi (z); } +Complex +psi (const Complex& z) { return xpsi (z); } +FloatComplex +psi (const FloatComplex& z) { return xpsi (z); } template static inline void @@ -2152,8 +2168,10 @@ return ans; } -double psi (octave_idx_type n, double z) { return xpsi (n, z); } -float psi (octave_idx_type n, float z) { return xpsi (n, z); } +double +psi (octave_idx_type n, double z) { return xpsi (n, z); } +float +psi (octave_idx_type n, float z) { return xpsi (n, z); } Complex rc_lgamma (double x) @@ -2193,14 +2211,16 @@ return result; } -Complex rc_log1p (double x) +Complex +rc_log1p (double x) { return (x < -1.0 ? Complex (std::log (-(1.0 + x)), M_PI) : Complex (log1p (x))); } -FloatComplex rc_log1p (float x) +FloatComplex +rc_log1p (float x) { return (x < -1.0f ? FloatComplex (std::log (-(1.0f + x)), M_PI) diff -r a2be40ce8fec -r 60515d0cd023 liboctave/numeric/oct-norm.cc --- a/liboctave/numeric/oct-norm.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/numeric/oct-norm.cc Tue Dec 12 23:14:33 2023 -0800 @@ -274,7 +274,8 @@ // OK, we're armed :) Now let's go for the fun template -inline void vector_norm (const Array& v, R& res, ACC acc) +inline void +vector_norm (const Array& v, R& res, ACC acc) { for (octave_idx_type i = 0; i < v.numel (); i++) acc.accum (v(i)); @@ -284,7 +285,8 @@ // dense versions template -void column_norms (const MArray& m, MArray& res, ACC acc) +void +column_norms (const MArray& m, MArray& res, ACC acc) { res = MArray (dim_vector (1, m.columns ())); for (octave_idx_type j = 0; j < m.columns (); j++) @@ -298,7 +300,8 @@ } template -void row_norms (const MArray& m, MArray& res, ACC acc) +void +row_norms (const MArray& m, MArray& res, ACC acc) { res = MArray (dim_vector (m.rows (), 1)); std::vector acci (m.rows (), acc); @@ -314,7 +317,8 @@ // sparse versions template -void column_norms (const MSparse& m, MArray& res, ACC acc) +void +column_norms (const MSparse& m, MArray& res, ACC acc) { res = MArray (dim_vector (1, m.columns ())); for (octave_idx_type j = 0; j < m.columns (); j++) @@ -328,7 +332,8 @@ } template -void row_norms (const MSparse& m, MArray& res, ACC acc) +void +row_norms (const MSparse& m, MArray& res, ACC acc) { res = MArray (dim_vector (m.rows (), 1)); std::vector acci (m.rows (), acc); @@ -452,7 +457,8 @@ // the p-dual element (should work for both real and complex) template -inline T elem_dual_p (T x, R p) +inline T +elem_dual_p (T x, R p) { return math::signum (x) * std::pow (std::abs (x), p-1); } @@ -462,7 +468,8 @@ // does not support multiplication with column/row vectors. // the dual vector template -VectorT dual_p (const VectorT& x, R p, R q) +VectorT +dual_p (const VectorT& x, R p, R q) { VectorT res (x.dims ()); for (octave_idx_type i = 0; i < x.numel (); i++) @@ -472,8 +479,9 @@ // Higham's hybrid method template -R higham (const MatrixT& m, R p, R tol, int maxiter, - VectorT& x) +R +higham (const MatrixT& m, R p, R tol, int maxiter, + VectorT& x) { x.resize (m.columns (), 1); // the OSE part @@ -532,7 +540,8 @@ // version with SVD for dense matrices template -R svd_matrix_norm (const MatrixT& m, R p, VectorT) +R +svd_matrix_norm (const MatrixT& m, R p, VectorT) { R res = 0; if (p == 2) @@ -558,7 +567,8 @@ // SVD-free version for sparse matrices template -R matrix_norm (const MatrixT& m, R p, VectorT) +R +matrix_norm (const MatrixT& m, R p, VectorT) { R res = 0; if (p == 1) diff -r a2be40ce8fec -r 60515d0cd023 liboctave/numeric/oct-rand.cc --- a/liboctave/numeric/oct-rand.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/numeric/oct-rand.cc Tue Dec 12 23:14:33 2023 -0800 @@ -59,7 +59,8 @@ initialize_mersenne_twister (); } -bool rand::instance_ok () +bool +rand::instance_ok () { bool retval = true; @@ -72,7 +73,8 @@ return retval; } -double rand::do_seed () +double +rand::do_seed () { union d2i { double d; int32_t i[2]; }; union d2i u; @@ -108,7 +110,8 @@ return i; } -void rand::do_seed (double s) +void +rand::do_seed (double s) { m_use_old_generators = true; @@ -135,18 +138,21 @@ F77_FUNC (setsd, SETSD) (i0, i1); } -void rand::do_reset () +void +rand::do_reset () { m_use_old_generators = true; initialize_ranlib_generators (); } -uint32NDArray rand::do_state (const std::string& d) +uint32NDArray +rand::do_state (const std::string& d) { return m_rand_states[d.empty () ? m_current_distribution : get_dist_id (d)]; } -void rand::do_state (const uint32NDArray& s, const std::string& d) +void +rand::do_state (const uint32NDArray& s, const std::string& d) { m_use_old_generators = false; @@ -167,7 +173,8 @@ m_rand_states[old_dist] = saved_state; } -void rand::do_reset (const std::string& d) +void +rand::do_reset (const std::string& d) { m_use_old_generators = false; @@ -187,7 +194,8 @@ m_rand_states[old_dist] = saved_state; } -std::string rand::do_distribution () +std::string +rand::do_distribution () { std::string retval; @@ -222,7 +230,8 @@ return retval; } -void rand::do_distribution (const std::string& d) +void +rand::do_distribution (const std::string& d) { int id = get_dist_id (d); @@ -255,35 +264,40 @@ } } -void rand::do_uniform_distribution () +void +rand::do_uniform_distribution () { switch_to_generator (uniform_dist); F77_FUNC (setcgn, SETCGN) (uniform_dist); } -void rand::do_normal_distribution () +void +rand::do_normal_distribution () { switch_to_generator (normal_dist); F77_FUNC (setcgn, SETCGN) (normal_dist); } -void rand::do_exponential_distribution () +void +rand::do_exponential_distribution () { switch_to_generator (expon_dist); F77_FUNC (setcgn, SETCGN) (expon_dist); } -void rand::do_poisson_distribution () +void +rand::do_poisson_distribution () { switch_to_generator (poisson_dist); F77_FUNC (setcgn, SETCGN) (poisson_dist); } -void rand::do_gamma_distribution () +void +rand::do_gamma_distribution () { switch_to_generator (gamma_dist); @@ -291,7 +305,8 @@ } template <> -OCTAVE_API double rand::uniform () +OCTAVE_API double +rand::uniform () { double retval; @@ -304,7 +319,8 @@ } template <> -OCTAVE_API double rand::normal () +OCTAVE_API double +rand::normal () { double retval; @@ -317,7 +333,8 @@ } template <> -OCTAVE_API double rand::exponential () +OCTAVE_API double +rand::exponential () { double retval; @@ -330,7 +347,8 @@ } template <> -OCTAVE_API double rand::poisson (double a) +OCTAVE_API double +rand::poisson (double a) { double retval; @@ -352,7 +370,8 @@ } template <> -OCTAVE_API double rand::gamma (double a) +OCTAVE_API double +rand::gamma (double a) { double retval; @@ -452,7 +471,8 @@ } template -T rand::do_scalar (T a) +T +rand::do_scalar (T a) { T retval = 0; @@ -516,7 +536,8 @@ template OCTAVE_API Array rand::do_vector (octave_idx_type, float); -NDArray rand::do_nd_array (const dim_vector& dims, double a) +NDArray +rand::do_nd_array (const dim_vector& dims, double a) { NDArray retval; @@ -530,7 +551,8 @@ return retval; } -FloatNDArray rand::do_float_nd_array (const dim_vector& dims, float a) +FloatNDArray +rand::do_float_nd_array (const dim_vector& dims, float a) { FloatNDArray retval; @@ -549,7 +571,8 @@ // technique used below will cycle monthly, but it does seem to // work ok to give fairly different seeds each time Octave starts. -void rand::initialize_ranlib_generators () +void +rand::initialize_ranlib_generators () { sys::localtime tm; int stored_distribution = m_current_distribution; @@ -569,7 +592,8 @@ F77_FUNC (setcgn, SETCGN) (stored_distribution); } -void rand::initialize_mersenne_twister () +void +rand::initialize_mersenne_twister () { uint32NDArray s; @@ -598,7 +622,8 @@ set_internal_state (m_rand_states[m_current_distribution]); } -uint32NDArray rand::get_internal_state () +uint32NDArray +rand::get_internal_state () { uint32NDArray s (dim_vector (MT_N + 1, 1)); @@ -607,12 +632,14 @@ return s; } -void rand::save_state () +void +rand::save_state () { m_rand_states[m_current_distribution] = get_internal_state (); } -int rand::get_dist_id (const std::string& d) +int +rand::get_dist_id (const std::string& d) { int retval = unknown_dist; @@ -633,7 +660,8 @@ return retval; } -void rand::set_internal_state (const uint32NDArray& s) +void +rand::set_internal_state (const uint32NDArray& s) { octave_idx_type len = s.numel (); @@ -645,7 +673,8 @@ init_mersenne_twister (sdata, len); } -void rand::switch_to_generator (int dist) +void +rand::switch_to_generator (int dist) { if (dist != m_current_distribution) { @@ -655,7 +684,8 @@ } } -void rand::fill (octave_idx_type len, double *v, double a) +void +rand::fill (octave_idx_type len, double *v, double a) { if (len < 1) return; @@ -723,7 +753,8 @@ return; } -void rand::fill (octave_idx_type len, float *v, float a) +void +rand::fill (octave_idx_type len, float *v, float a) { if (len < 1) return; diff -r a2be40ce8fec -r 60515d0cd023 liboctave/numeric/oct-spparms.cc --- a/liboctave/numeric/oct-spparms.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/numeric/oct-spparms.cc Tue Dec 12 23:14:33 2023 -0800 @@ -39,7 +39,8 @@ sparse_params *sparse_params::s_instance = nullptr; -bool sparse_params::instance_ok () +bool +sparse_params::instance_ok () { bool retval = true; @@ -52,56 +53,66 @@ return retval; } -void sparse_params::defaults () +void +sparse_params::defaults () { if (instance_ok ()) s_instance->do_defaults (); } -void sparse_params::tight () +void +sparse_params::tight () { if (instance_ok ()) s_instance->do_tight (); } -string_vector sparse_params::get_keys () +string_vector +sparse_params::get_keys () { return instance_ok () ? s_instance->do_get_keys () : string_vector (); } -ColumnVector sparse_params::get_vals () +ColumnVector +sparse_params::get_vals () { return instance_ok () ? s_instance->do_get_vals () : ColumnVector (); } -bool sparse_params::set_vals (const Array& vals) +bool +sparse_params::set_vals (const Array& vals) { return instance_ok () ? s_instance->do_set_vals (vals) : false; } -bool sparse_params::set_key (const std::string& key, const double& val) +bool +sparse_params::set_key (const std::string& key, const double& val) { return instance_ok () ? s_instance->do_set_key (key, val) : false; } -double sparse_params::get_key (const std::string& key) +double +sparse_params::get_key (const std::string& key) { return (instance_ok () ? s_instance->do_get_key (key) : numeric_limits::NaN ()); } -double sparse_params::get_bandden () +double +sparse_params::get_bandden () { return instance_ok () ? s_instance->do_get_bandden () : 0.0; } -void sparse_params::print_info (std::ostream& os, const std::string& prefix) +void +sparse_params::print_info (std::ostream& os, const std::string& prefix) { if (instance_ok ()) s_instance->do_print_info (os, prefix); } -void sparse_params::do_defaults () +void +sparse_params::do_defaults () { m_params(0) = 0; // spumoni m_params(1) = 1; // ths_rel @@ -118,7 +129,8 @@ m_params(12) = 0.001; // sym_tol } -void sparse_params::do_tight () +void +sparse_params::do_tight () { m_params(0) = 0; // spumoni m_params(1) = 1; // ths_rel @@ -135,7 +147,8 @@ m_params(12) = 0.001; // sym_tol } -void sparse_params::init_keys () +void +sparse_params::init_keys () { m_keys(0) = "spumoni"; m_keys(1) = "ths_rel"; @@ -152,12 +165,14 @@ m_keys(12) = "sym_tol"; } -double sparse_params::do_get_bandden () +double +sparse_params::do_get_bandden () { return m_params(10); } -bool sparse_params::do_set_vals (const Array& vals) +bool +sparse_params::do_set_vals (const Array& vals) { octave_idx_type len = vals.numel (); @@ -171,7 +186,8 @@ return true; } -bool sparse_params::do_set_key (const std::string& key, const double& val) +bool +sparse_params::do_set_key (const std::string& key, const double& val) { for (int i = 0; i < OCTAVE_SPARSE_CONTROLS_SIZE; i++) { @@ -185,7 +201,8 @@ return false; } -double sparse_params::do_get_key (const std::string& key) +double +sparse_params::do_get_key (const std::string& key) { for (int i = 0; i < OCTAVE_SPARSE_CONTROLS_SIZE; i++) { @@ -196,8 +213,9 @@ return numeric_limits::NaN (); } -void sparse_params::do_print_info (std::ostream& os, - const std::string& prefix) const +void +sparse_params::do_print_info (std::ostream& os, + const std::string& prefix) const { for (int i = 0; i < OCTAVE_SPARSE_CONTROLS_SIZE; i++) os << prefix << m_keys(i) << ": " << m_params(i) << "\n"; diff -r a2be40ce8fec -r 60515d0cd023 liboctave/numeric/randmtzig.cc --- a/liboctave/numeric/randmtzig.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/numeric/randmtzig.cc Tue Dec 12 23:14:33 2023 -0800 @@ -197,7 +197,8 @@ static int inittf = 1; /* initializes state[MT_N] with a seed */ -void init_mersenne_twister (const uint32_t s) +void +init_mersenne_twister (const uint32_t s) { int j; state[0] = s & 0xffffffffUL; @@ -217,7 +218,8 @@ /* initialize by an array with array-length */ /* init_key is the array for initializing keys */ /* key_length is its length */ -void init_mersenne_twister (const uint32_t *init_key, const int key_length) +void +init_mersenne_twister (const uint32_t *init_key, const int key_length) { int i, j, k; init_mersenne_twister (19650218UL); @@ -257,7 +259,8 @@ initf = 1; } -void init_mersenne_twister () +void +init_mersenne_twister () { uint32_t entropy[MT_N]; int n = 0; @@ -308,20 +311,23 @@ init_mersenne_twister (entropy, n); } -void set_mersenne_twister_state (const uint32_t *save) +void +set_mersenne_twister_state (const uint32_t *save) { std::copy_n (save, MT_N, state); left = save[MT_N]; next = state + (MT_N - left + 1); } -void get_mersenne_twister_state (uint32_t *save) +void +get_mersenne_twister_state (uint32_t *save) { std::copy_n (state, MT_N, save); save[MT_N] = left; } -static void next_state () +static void +next_state () { uint32_t *p = state; int j; @@ -346,7 +352,8 @@ } /* generates a random number on [0,0xffffffff]-interval */ -static uint32_t randmt () +static uint32_t +randmt () { uint32_t y; @@ -366,7 +373,8 @@ /* Select which 32 bit generator to use */ #define randi32 randmt -static uint64_t randi53 () +static uint64_t +randi53 () { const uint32_t lo = randi32 (); const uint32_t hi = randi32 () & 0x1FFFFF; @@ -381,7 +389,8 @@ #endif } -static uint64_t randi54 () +static uint64_t +randi54 () { const uint32_t lo = randi32 (); const uint32_t hi = randi32 () & 0x3FFFFF; @@ -397,7 +406,8 @@ } /* generates a random number on (0,1)-real-interval */ -static float randu24 () +static float +randu24 () { uint32_t i; @@ -411,7 +421,8 @@ } /* generates a random number on (0,1) with 53-bit resolution */ -static double randu53 () +static double +randu53 () { int32_t a, b; @@ -503,7 +514,8 @@ so I'm not going to try and optimize further. */ -void create_ziggurat_tables () +void +create_ziggurat_tables () { int i; double x, x1; @@ -582,10 +594,12 @@ */ -template <> OCTAVE_API double rand_normal () +template <> +OCTAVE_API double +rand_normal () { - if (initt) - create_ziggurat_tables (); + if (initt) + create_ziggurat_tables (); while (1) { @@ -646,10 +660,12 @@ } } -template <> OCTAVE_API double rand_exponential () +template <> +OCTAVE_API double +rand_exponential () { - if (initt) - create_ziggurat_tables (); + if (initt) + create_ziggurat_tables (); while (1) { @@ -674,17 +690,17 @@ template <> OCTAVE_API void rand_uniform (octave_idx_type n, double *p) { - std::generate_n (p, n, []() { return rand_uniform (); }); + std::generate_n (p, n, []() { return rand_uniform (); }); } template <> OCTAVE_API void rand_normal (octave_idx_type n, double *p) { - std::generate_n (p, n, []() { return rand_normal (); }); + std::generate_n (p, n, []() { return rand_normal (); }); } template <> OCTAVE_API void rand_exponential (octave_idx_type n, double *p) { - std::generate_n (p, n, []() { return rand_exponential (); }); + std::generate_n (p, n, []() { return rand_exponential (); }); } #undef ZIGINT @@ -706,7 +722,8 @@ static ZIGINT fke[ZIGGURAT_TABLE_SIZE]; static float fwe[ZIGGURAT_TABLE_SIZE], ffe[ZIGGURAT_TABLE_SIZE]; -static void create_ziggurat_float_tables () +static void +create_ziggurat_float_tables () { int i; float x, x1; @@ -784,10 +801,12 @@ * distribution is exp(-0.5*x*x) */ -template <> OCTAVE_API float rand_normal () +template <> +OCTAVE_API float +rand_normal () { - if (inittf) - create_ziggurat_float_tables (); + if (inittf) + create_ziggurat_float_tables (); while (1) { @@ -824,10 +843,12 @@ } } -template <> OCTAVE_API float rand_exponential () +template <> +OCTAVE_API float +rand_exponential () { - if (inittf) - create_ziggurat_float_tables (); + if (inittf) + create_ziggurat_float_tables (); while (1) { @@ -852,17 +873,17 @@ template <> OCTAVE_API void rand_uniform (octave_idx_type n, float *p) { - std::generate_n (p, n, []() { return rand_uniform (); }); + std::generate_n (p, n, []() { return rand_uniform (); }); } template <> OCTAVE_API void rand_normal (octave_idx_type n, float *p) { - std::generate_n (p, n, []() { return rand_normal (); }); + std::generate_n (p, n, []() { return rand_normal (); }); } template <> OCTAVE_API void rand_exponential (octave_idx_type n, float *p) { - std::generate_n (p, n, []() { return rand_exponential (); }); + std::generate_n (p, n, []() { return rand_exponential (); }); } OCTAVE_END_NAMESPACE(octave) diff -r a2be40ce8fec -r 60515d0cd023 liboctave/numeric/randpoisson.cc --- a/liboctave/numeric/randpoisson.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/numeric/randpoisson.cc Tue Dec 12 23:14:33 2023 -0800 @@ -49,7 +49,8 @@ /* ---- pprsc.c from Stadloeber's winrand --- */ /* flogfak(k) = ln(k!) */ -static double flogfak (double k) +static double +flogfak (double k) { #define C0 9.18938533204672742e-01 #define C1 8.33333333333333333e-02 @@ -115,12 +116,14 @@ * * ******************************************************************/ -static double f (double k, double l_nu, double c_pm) +static double +f (double k, double l_nu, double c_pm) { return exp (k * l_nu - flogfak (k) - c_pm); } -static double pprsc (double my) +static double +pprsc (double my) { static double my_last = -1.0; static double m, k2, k4, k1, k5; @@ -395,7 +398,9 @@ * and large enough. */ /* Generate a set of poisson numbers with the same distribution */ -template void rand_poisson (T L_arg, octave_idx_type n, T *p) +template +void +rand_poisson (T L_arg, octave_idx_type n, T *p) { double L = L_arg; octave_idx_type i; @@ -430,7 +435,9 @@ template void rand_poisson (float, octave_idx_type, float *); /* Generate one poisson variate */ -template T rand_poisson (T L_arg) +template +T +rand_poisson (T L_arg) { double L = L_arg; T ret; diff -r a2be40ce8fec -r 60515d0cd023 liboctave/operators/mx-inlines.cc --- a/liboctave/operators/mx-inlines.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/operators/mx-inlines.cc Tue Dec 12 23:14:33 2023 -0800 @@ -44,7 +44,8 @@ // Provides some commonly repeated, basic loop templates. template -inline void mx_inline_fill (std::size_t n, R *r, S s) +inline void +mx_inline_fill (std::size_t n, R *r, S s) { for (std::size_t i = 0; i < n; i++) r[i] = s; @@ -178,13 +179,15 @@ } template -void mx_inline_not (std::size_t n, bool *r, const X *x) +void +mx_inline_not (std::size_t n, bool *r, const X *x) { for (std::size_t i = 0; i < n; i++) r[i] = ! logical_value (x[i]); } -inline void mx_inline_not2 (std::size_t n, bool *r) +inline void +mx_inline_not2 (std::size_t n, bool *r) { for (std::size_t i = 0; i < n; i++) r[i] = ! r[i]; @@ -306,7 +309,7 @@ template inline bool -mx_inline_all_real (std::size_t n, const std::complex* x) +mx_inline_all_real (std::size_t n, const std::complex *x) { for (std::size_t i = 0; i < n; i++) { @@ -318,14 +321,16 @@ } template -inline void mx_inline_real (std::size_t n, T *r, const std::complex* x) +inline void +mx_inline_real (std::size_t n, T *r, const std::complex *x) { for (std::size_t i = 0; i < n; i++) r[i] = x[i].real (); } template -inline void mx_inline_imag (std::size_t n, T *r, const std::complex* x) +inline void +mx_inline_imag (std::size_t n, T *r, const std::complex *x) { for (std::size_t i = 0; i < n; i++) r[i] = x[i].imag (); @@ -442,14 +447,16 @@ // Arbitrary function appliers. // The function is a template parameter to enable inlining. template -inline void mx_inline_map (std::size_t n, R *r, const X *x) +inline void +mx_inline_map (std::size_t n, R *r, const X *x) { for (std::size_t i = 0; i < n; i++) r[i] = fcn (x[i]); } template -inline void mx_inline_map (std::size_t n, R *r, const X *x) +inline void +mx_inline_map (std::size_t n, R *r, const X *x) { for (std::size_t i = 0; i < n; i++) r[i] = fcn (x[i]); @@ -586,7 +593,8 @@ // NOTE: we don't use std::norm because it typically does some heavyweight // magic to avoid underflows, which we don't need here. template -inline T cabsq (const std::complex& c) +inline T +cabsq (const std::complex& c) { return c.real () * c.real () + c.imag () * c.imag (); } @@ -1436,9 +1444,10 @@ } template -void mx_inline_diff (const T *v, T *r, - octave_idx_type m, octave_idx_type n, - octave_idx_type order) +void +mx_inline_diff (const T *v, T *r, + octave_idx_type m, octave_idx_type n, + octave_idx_type order) { switch (order) { @@ -1691,8 +1700,9 @@ // SIAM J. Sci. Computing, Vol. 26, 2005 template -inline void twosum_accum (T& s, T& e, - const T& x) +inline void +twosum_accum (T& s, T& e, + const T& x) { T s1 = s + x; T t = s1 - s; diff -r a2be40ce8fec -r 60515d0cd023 liboctave/system/child-list.cc --- a/liboctave/system/child-list.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/system/child-list.cc Tue Dec 12 23:14:33 2023 -0800 @@ -37,12 +37,14 @@ m_list.remove_if ([pid] (const child& oc) { return oc.m_pid == pid; }); } -void child_list::child_list::insert (pid_t pid, child::child_event_handler f) +void +child_list::child_list::insert (pid_t pid, child::child_event_handler f) { m_list.append (child (pid, f)); } -void child_list::reap () +void +child_list::reap () { // Mark the record for PID invalid. @@ -70,7 +72,8 @@ // Wait on our children and record any changes in their status. -bool child_list::wait () +bool +child_list::wait () { bool retval = false; diff -r a2be40ce8fec -r 60515d0cd023 liboctave/system/file-ops.cc --- a/liboctave/system/file-ops.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/system/file-ops.cc Tue Dec 12 23:14:33 2023 -0800 @@ -228,7 +228,8 @@ #endif } -char dir_sep_char () +char +dir_sep_char () { #if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM)) return '\\'; @@ -237,7 +238,8 @@ #endif } -std::string dir_sep_str () +std::string +dir_sep_str () { #if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM)) return R"(\)"; @@ -246,7 +248,8 @@ #endif } -std::string dir_sep_chars () +std::string +dir_sep_chars () { #if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) return R"(/\)"; @@ -263,7 +266,8 @@ string_vector tilde_additional_suffixes = default_suffixes; -bool is_dev_sep (char c) +bool +is_dev_sep (char c) { #if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM)) return c == dev_sep_char (); @@ -274,13 +278,15 @@ #endif } -bool is_dir_sep (char c) +bool +is_dir_sep (char c) { std::string tmp = dir_sep_chars (); return tmp.find (c) != std::string::npos; } -std::string tilde_expand (const std::string& name) +std::string +tilde_expand (const std::string& name) { if (name.find ('~') == std::string::npos) return std::string (name); @@ -336,7 +342,8 @@ } } -string_vector tilde_expand (const string_vector& names) +string_vector +tilde_expand (const string_vector& names) { int n = names.numel (); @@ -348,7 +355,8 @@ return retval; } -std::string concat (const std::string& dir, const std::string& file) +std::string +concat (const std::string& dir, const std::string& file) { return dir.empty () ? file @@ -357,14 +365,16 @@ : dir + dir_sep_char () + file); } -std::string dirname (const std::string& path) +std::string +dirname (const std::string& path) { std::size_t ipos = path.find_last_of (dir_sep_chars ()); return (ipos != std::string::npos) ? path.substr (0, ipos) : ""; } -std::string tail (const std::string& path) +std::string +tail (const std::string& path) { std::size_t ipos = path.find_last_of (dir_sep_chars ()); @@ -376,7 +386,8 @@ return path.substr (ipos); } -std::string native_separator_path (const std::string& path) +std::string +native_separator_path (const std::string& path) { std::string retval; @@ -405,7 +416,8 @@ return mkdir (nm, md, msg); } -int mkdir (const std::string& name, mode_t mode, std::string& msg) +int +mkdir (const std::string& name, mode_t mode, std::string& msg) { msg = ""; @@ -417,13 +429,15 @@ return status; } -int recursive_mkdir (const std::string& name, mode_t mode) +int +recursive_mkdir (const std::string& name, mode_t mode) { std::string msg; return recursive_mkdir (name, mode, msg); } -int recursive_mkdir (const std::string& name, mode_t mode, std::string& msg) +int +recursive_mkdir (const std::string& name, mode_t mode, std::string& msg) { int status; @@ -470,13 +484,15 @@ return mkdir (name, mode, msg); } -int mkfifo (const std::string& nm, mode_t md) +int +mkfifo (const std::string& nm, mode_t md) { std::string msg; return mkfifo (nm, md, msg); } -int mkfifo (const std::string& name, mode_t mode, std::string& msg) +int +mkfifo (const std::string& name, mode_t mode, std::string& msg) { msg = ""; @@ -488,14 +504,16 @@ return status; } -int link (const std::string& old_name, const std::string& new_name) +int +link (const std::string& old_name, const std::string& new_name) { std::string msg; return link (old_name, new_name, msg); } -int link (const std::string& old_name, const std::string& new_name, - std::string& msg) +int +link (const std::string& old_name, const std::string& new_name, + std::string& msg) { msg = ""; @@ -509,14 +527,16 @@ return status; } -int symlink (const std::string& old_name, const std::string& new_name) +int +symlink (const std::string& old_name, const std::string& new_name) { std::string msg; return symlink (old_name, new_name, msg); } -int symlink (const std::string& old_name, const std::string& new_name, - std::string& msg) +int +symlink (const std::string& old_name, const std::string& new_name, + std::string& msg) { msg = ""; @@ -530,13 +550,15 @@ return status; } -int readlink (const std::string& path, std::string& result) +int +readlink (const std::string& path, std::string& result) { std::string msg; return readlink (path, result, msg); } -int readlink (const std::string& path, std::string& result, std::string& msg) +int +readlink (const std::string& path, std::string& result, std::string& msg) { int status = -1; @@ -556,14 +578,16 @@ return status; } -int rename (const std::string& from, const std::string& to) +int +rename (const std::string& from, const std::string& to) { std::string msg; return rename (from, to, msg); } -int rename (const std::string& from, const std::string& to, - std::string& msg) +int +rename (const std::string& from, const std::string& to, + std::string& msg) { int status = -1; @@ -603,13 +627,15 @@ return status; } -int rmdir (const std::string& name) +int +rmdir (const std::string& name) { std::string msg; return rmdir (name, msg); } -int rmdir (const std::string& name, std::string& msg) +int +rmdir (const std::string& name, std::string& msg) { msg = ""; @@ -625,13 +651,15 @@ // And a version that works recursively. -int recursive_rmdir (const std::string& name) +int +recursive_rmdir (const std::string& name) { std::string msg; return recursive_rmdir (name, msg); } -int recursive_rmdir (const std::string& name, std::string& msg) +int +recursive_rmdir (const std::string& name, std::string& msg) { msg = ""; @@ -689,18 +717,21 @@ return status; } -int umask (mode_t mode) +int +umask (mode_t mode) { return octave_umask_wrapper (mode); } -int unlink (const std::string& name) +int +unlink (const std::string& name) { std::string msg; return unlink (name, msg); } -int unlink (const std::string& name, std::string& msg) +int +unlink (const std::string& name, std::string& msg) { msg = ""; @@ -714,14 +745,16 @@ return status; } -std::string tempnam (const std::string& dir, const std::string& pfx) +std::string +tempnam (const std::string& dir, const std::string& pfx) { std::string msg; return tempnam (dir, pfx, msg); } -std::string tempnam (const std::string& dir, const std::string& pfx, - std::string& msg) +std::string +tempnam (const std::string& dir, const std::string& pfx, + std::string& msg) { msg = ""; @@ -761,13 +794,15 @@ return retval; } -std::string canonicalize_file_name (const std::string& name) +std::string +canonicalize_file_name (const std::string& name) { std::string msg; return canonicalize_file_name (name, msg); } -std::string canonicalize_file_name (const std::string& name, std::string& msg) +std::string +canonicalize_file_name (const std::string& name, std::string& msg) { msg = ""; diff -r a2be40ce8fec -r 60515d0cd023 liboctave/system/lo-sysdep.cc --- a/liboctave/system/lo-sysdep.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/system/lo-sysdep.cc Tue Dec 12 23:14:33 2023 -0800 @@ -184,7 +184,8 @@ #if defined (OCTAVE_USE_WINDOWS_API) -static bool check_fseek_ftell_workaround_needed (bool set_nonbuffered_mode) +static bool +check_fseek_ftell_workaround_needed (bool set_nonbuffered_mode) { // To check whether the workaround is needed: // @@ -432,7 +433,8 @@ // Return TRUE if FILE1 and FILE2 refer to the same (physical) file. -bool same_file (const std::string& file1, const std::string& file2) +bool +same_file (const std::string& file1, const std::string& file2) { #if defined (OCTAVE_USE_WINDOWS_API) diff -r a2be40ce8fec -r 60515d0cd023 liboctave/system/lo-sysinfo.cc --- a/liboctave/system/lo-sysinfo.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/system/lo-sysinfo.cc Tue Dec 12 23:14:33 2023 -0800 @@ -160,7 +160,8 @@ return retval; } -std::string lapack_version () +std::string +lapack_version () { std::string retval = "unknown LAPACK"; diff -r a2be40ce8fec -r 60515d0cd023 liboctave/system/mach-info.cc --- a/liboctave/system/mach-info.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/system/mach-info.cc Tue Dec 12 23:14:33 2023 -0800 @@ -57,33 +57,38 @@ } } -static bool is_big_endian () +static bool +is_big_endian () { return octave_is_big_endian (); } -float_format native_float_format () +float_format +native_float_format () { static float_format fmt = get_float_format (); return fmt; } -bool words_big_endian () +bool +words_big_endian () { static bool big_endian = is_big_endian (); return big_endian; } -bool words_little_endian () +bool +words_little_endian () { static bool little_endian = ! is_big_endian (); return little_endian; } -float_format string_to_float_format (const std::string& s) +float_format +string_to_float_format (const std::string& s) { float_format retval = flt_fmt_unknown; @@ -102,7 +107,8 @@ return retval; } -std::string float_format_as_string (float_format flt_fmt) +std::string +float_format_as_string (float_format flt_fmt) { std::string retval = "unknown"; diff -r a2be40ce8fec -r 60515d0cd023 liboctave/util/file-info.cc --- a/liboctave/util/file-info.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/util/file-info.cc Tue Dec 12 23:14:33 2023 -0800 @@ -72,7 +72,8 @@ // Read entire file called fname and return the contents as a string -std::string file_info::snarf_file (const std::string& fname) +std::string +file_info::snarf_file (const std::string& fname) { std::string retval; @@ -103,7 +104,8 @@ return retval; } -std::vector file_info::get_line_offsets (const std::string& buf) +std::vector +file_info::get_line_offsets (const std::string& buf) { std::deque tmp_offsets; diff -r a2be40ce8fec -r 60515d0cd023 liboctave/util/glob-match.cc --- a/liboctave/util/glob-match.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/util/glob-match.cc Tue Dec 12 23:14:33 2023 -0800 @@ -71,7 +71,8 @@ #endif } -bool symbol_match::match (const std::string& sym) +bool +symbol_match::match (const std::string& sym) { #if defined (OCTAVE_USE_WINDOWS_API) diff -r a2be40ce8fec -r 60515d0cd023 liboctave/util/lo-error.h --- a/liboctave/util/lo-error.h Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/util/lo-error.h Tue Dec 12 23:14:33 2023 -0800 @@ -46,13 +46,11 @@ typedef void (*liboctave_error_handler) (const char *, ...); -typedef void (*liboctave_error_with_id_handler) (const char *, const char *, - ...); +typedef void (*liboctave_error_with_id_handler) (const char *, const char *, ...); typedef void (*liboctave_warning_handler) (const char *, ...); -typedef void (*liboctave_warning_with_id_handler) (const char *, const char *, - ...); +typedef void (*liboctave_warning_with_id_handler) (const char *, const char *, ...); /* Would be nice to make these pointers private, but we want to share them among all the liboctave classes. */ diff -r a2be40ce8fec -r 60515d0cd023 liboctave/util/lo-utils.cc --- a/liboctave/util/lo-utils.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/util/lo-utils.cc Tue Dec 12 23:14:33 2023 -0800 @@ -52,26 +52,30 @@ return math::isnan (x) || math::x_nint (x) == x; } -bool too_large_for_float (double x) +bool +too_large_for_float (double x) { return (math::isfinite (x) && fabs (x) > std::numeric_limits::max ()); } -bool too_large_for_float (const Complex& x) +bool +too_large_for_float (const Complex& x) { return (too_large_for_float (x.real ()) || too_large_for_float (x.imag ())); } -bool is_int_or_inf_or_nan (float x) +bool +is_int_or_inf_or_nan (float x) { return math::isnan (x) || math::x_nint (x) == x; } // Save a string. -char * strsave (const char *s) +char * +strsave (const char *s) { if (! s) return nullptr; @@ -82,13 +86,15 @@ return tmp; } -std::string fgets (FILE *f) +std::string +fgets (FILE *f) { bool eof; return fgets (f, eof); } -std::string fgets (FILE *f, bool& eof) +std::string +fgets (FILE *f, bool& eof) { eof = false; @@ -162,13 +168,15 @@ return retval; } -std::string fgetl (FILE *f) +std::string +fgetl (FILE *f) { bool eof; return fgetl (f, eof); } -std::string fgetl (FILE *f, bool& eof) +std::string +fgetl (FILE *f, bool& eof) { std::string retval = fgets (f, eof); @@ -432,7 +440,8 @@ // Note: precision is supposed to be managed outside of this function by // setting stream parameters. -template <> OCTAVE_API void +template <> +OCTAVE_API void write_value (std::ostream& os, const double& value) { if (lo_ieee_is_NA (value)) @@ -445,7 +454,8 @@ os << value; } -template <> OCTAVE_API void +template <> +OCTAVE_API void write_value (std::ostream& os, const Complex& value) { os << '('; @@ -458,7 +468,8 @@ // Note: precision is supposed to be managed outside of this function by // setting stream parameters. -template <> OCTAVE_API void +template <> +OCTAVE_API void write_value (std::ostream& os, const float& value) { if (lo_ieee_is_NA (value)) @@ -471,7 +482,8 @@ os << value; } -template <> OCTAVE_API void +template <> +OCTAVE_API void write_value (std::ostream& os, const FloatComplex& value) { os << '('; @@ -483,40 +495,43 @@ OCTAVE_BEGIN_NAMESPACE(math) - bool int_multiply_overflow (int a, int b, int *r) + bool + int_multiply_overflow (int a, int b, int *r) { return octave_i_multiply_overflow_wrapper (a, b, r); } - bool int_multiply_overflow (long int a, long int b, long int *r) + bool + int_multiply_overflow (long int a, long int b, long int *r) { return octave_li_multiply_overflow_wrapper (a, b, r); } #if defined (OCTAVE_HAVE_LONG_LONG_INT) - bool int_multiply_overflow (long long int a, long long int b, - long long int *r) + bool + int_multiply_overflow (long long int a, long long int b, long long int *r) { return octave_lli_multiply_overflow_wrapper (a, b, r); } #endif - bool int_multiply_overflow (unsigned int a, unsigned int b, - unsigned int *r) + bool + int_multiply_overflow (unsigned int a, unsigned int b, unsigned int *r) { return octave_ui_multiply_overflow_wrapper (a, b, r); } - bool int_multiply_overflow (unsigned long int a, unsigned long int b, - unsigned long int *r) + bool + int_multiply_overflow (unsigned long int a, unsigned long int b, + unsigned long int *r) { return octave_uli_multiply_overflow_wrapper (a, b, r); } #if defined (OCTAVE_HAVE_UNSIGNED_LONG_LONG_INT) - bool int_multiply_overflow (unsigned long long int a, - unsigned long long int b, - unsigned long long int *r) + bool + int_multiply_overflow (unsigned long long int a, unsigned long long int b, + unsigned long long int *r) { return octave_ulli_multiply_overflow_wrapper (a, b, r); } diff -r a2be40ce8fec -r 60515d0cd023 liboctave/util/oct-inttypes.h --- a/liboctave/util/oct-inttypes.h Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/util/oct-inttypes.h Tue Dec 12 23:14:33 2023 -0800 @@ -124,7 +124,7 @@ { // Promote to int? static const bool s_pint = (sizeof (T1) < sizeof (int) - && sizeof (T2) < sizeof (int)); + && sizeof (T2) < sizeof (int)); static const bool s_t1sig = std::numeric_limits::is_signed; static const bool s_t2sig = std::numeric_limits::is_signed; @@ -258,7 +258,8 @@ \ template \ static OCTAVE_API bool external_mop (T, double) - OCTAVE_DECLARE_EXTERNAL_LONG_DOUBLE_INT_CMP_OPS (int64_t); + + OCTAVE_DECLARE_EXTERNAL_LONG_DOUBLE_INT_CMP_OPS (int64_t); OCTAVE_DECLARE_EXTERNAL_LONG_DOUBLE_INT_CMP_OPS (uint64_t); #endif diff -r a2be40ce8fec -r 60515d0cd023 liboctave/util/oct-shlib.cc --- a/liboctave/util/oct-shlib.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/util/oct-shlib.cc Tue Dec 12 23:14:33 2023 -0800 @@ -62,12 +62,14 @@ std::list possibly_unreferenced_dynamic_libraries; -void dynamic_library::delete_later () +void +dynamic_library::delete_later () { possibly_unreferenced_dynamic_libraries.push_back (*this); } -int release_unreferenced_dynamic_libraries () +int +release_unreferenced_dynamic_libraries () { possibly_unreferenced_dynamic_libraries.clear (); diff -r a2be40ce8fec -r 60515d0cd023 liboctave/util/oct-sort.cc --- a/liboctave/util/oct-sort.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/util/oct-sort.cc Tue Dec 12 23:14:33 2023 -0800 @@ -982,7 +982,8 @@ --na; if (na == 0) goto Succeed; - } while (acount >= MIN_GALLOP || bcount >= MIN_GALLOP); + } + while (acount >= MIN_GALLOP || bcount >= MIN_GALLOP); ++min_gallop; /* penalize it for leaving galloping mode */ m_ms->m_min_gallop = min_gallop; } @@ -1125,7 +1126,8 @@ --na; if (na == 0) goto Succeed; - } while (acount >= MIN_GALLOP || bcount >= MIN_GALLOP); + } + while (acount >= MIN_GALLOP || bcount >= MIN_GALLOP); ++min_gallop; /* penalize it for leaving galloping mode */ m_ms->m_min_gallop = min_gallop; } diff -r a2be40ce8fec -r 60515d0cd023 liboctave/util/oct-string.cc --- a/liboctave/util/oct-string.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/util/oct-string.cc Tue Dec 12 23:14:33 2023 -0800 @@ -898,11 +898,11 @@ &lengthp); std::size_t ext_char; for (ext_char = 0; ext_char < srclen; ext_char++) - { - if (offsets[ext_char] != static_cast (-1) - && offsets[ext_char] >= max) - break; - } + { + if (offsets[ext_char] != static_cast (-1) + && offsets[ext_char] >= max) + break; + } return ext_char; } diff -r a2be40ce8fec -r 60515d0cd023 liboctave/util/pathsearch.cc --- a/liboctave/util/pathsearch.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/util/pathsearch.cc Tue Dec 12 23:14:33 2023 -0800 @@ -47,12 +47,14 @@ init (); } -std::list directory_path::elements () +std::list +directory_path::elements () { return m_initialized ? m_path_elements : std::list (); } -std::list directory_path::all_directories () +std::list +directory_path::all_directories () { std::list retval; @@ -70,12 +72,14 @@ return retval; } -std::string directory_path::find_first (const std::string& nm) +std::string +directory_path::find_first (const std::string& nm) { return m_initialized ? kpse_path_search (m_expanded_path, nm) : ""; } -std::list directory_path::find_all (const std::string& nm) +std::list +directory_path::find_all (const std::string& nm) { return (m_initialized ? kpse_all_path_search (m_expanded_path, nm) @@ -97,7 +101,8 @@ : std::list ()); } -void directory_path::init () +void +directory_path::init () { static bool octave_kpse_initialized = false; @@ -119,12 +124,14 @@ m_initialized = true; } -char directory_path::path_sep_char () +char +directory_path::path_sep_char () { return SEPCHAR; } -std::string directory_path::path_sep_str () +std::string +directory_path::path_sep_str () { return SEPCHAR_STR; } diff -r a2be40ce8fec -r 60515d0cd023 liboctave/util/quit.cc --- a/liboctave/util/quit.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/util/quit.cc Tue Dec 12 23:14:33 2023 -0800 @@ -78,7 +78,8 @@ return buf.str (); } -void execution_exception::display (std::ostream& os) const +void +execution_exception::display (std::ostream& os) const { if (! m_message.empty ()) { @@ -113,7 +114,7 @@ sig_atomic_t curr_interrupt_state = octave_interrupt_state.load (); while (curr_interrupt_state > 0 && - ! octave_interrupt_state.compare_exchange_weak (curr_interrupt_state, -1)) + ! octave_interrupt_state.compare_exchange_weak (curr_interrupt_state, -1)) ; if (curr_interrupt_state > 0) diff -r a2be40ce8fec -r 60515d0cd023 liboctave/version.cc --- a/liboctave/version.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/liboctave/version.cc Tue Dec 12 23:14:33 2023 -0800 @@ -103,13 +103,13 @@ { std::string sep = (html ? "\n

\n

\n" : "\n"); std::string msg = - (html ? "

\n" : "") - + octave_name_version_copyright_copying_and_warranty (html, extra_info) - + (html ? "" : "\n") + sep - + octave_www_statement (html) + sep - + octave_bugs_statement (html) + sep - + octave_contrib_statement (html) + sep - + (html ? "\n

" : ""); + (html ? "

\n" : "") + + octave_name_version_copyright_copying_and_warranty (html, extra_info) + + (html ? "" : "\n") + sep + + octave_www_statement (html) + sep + + octave_bugs_statement (html) + sep + + octave_contrib_statement (html) + sep + + (html ? "\n

" : ""); return msg; } diff -r a2be40ce8fec -r 60515d0cd023 src/main.in.cc --- a/src/main.in.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/src/main.in.cc Tue Dec 12 23:14:33 2023 -0800 @@ -304,78 +304,78 @@ switch (optc) { - case NO_GUI_LIBS_OPTION: - // Run the version of Octave that is not linked with any GUI - // libraries. It may not be possible to do plotting or any ui* - // calls, but it will be a little faster to start and require less - // memory. Don't pass the --no-gui-libs option on as that option - // is not recognized by Octave. - gui_libs = false; - file = octave_cli; - break; + case NO_GUI_LIBS_OPTION: + // Run the version of Octave that is not linked with any GUI + // libraries. It may not be possible to do plotting or any ui* + // calls, but it will be a little faster to start and require less + // memory. Don't pass the --no-gui-libs option on as that option + // is not recognized by Octave. + gui_libs = false; + file = octave_cli; + break; - case NO_GUI_OPTION: - // If we see this option, then we can just exec octave; we don't - // have to create a child process and wait for it to exit. But do - // exec "octave-gui", not "octave-cli", because even if the - // --no-gui option is given, we may be asked to do some plotting or - // ui* calls. - start_gui = false; - new_argv[k++] = argv[old_optind]; - break; + case NO_GUI_OPTION: + // If we see this option, then we can just exec octave; we don't + // have to create a child process and wait for it to exit. But do + // exec "octave-gui", not "octave-cli", because even if the + // --no-gui option is given, we may be asked to do some plotting or + // ui* calls. + start_gui = false; + new_argv[k++] = argv[old_optind]; + break; - case GUI_OPTION: - // If we see this option, then we fork and exec octave with the - // --gui option, while continuing to handle signals in the - // terminal. - // Do not copy the arg now, since we still not know if the gui - // should really be launched. Just store the index. - start_gui = true; - idx_gui = old_optind; - break; + case GUI_OPTION: + // If we see this option, then we fork and exec octave with the + // --gui option, while continuing to handle signals in the + // terminal. + // Do not copy the arg now, since we still not know if the gui + // should really be launched. Just store the index. + start_gui = true; + idx_gui = old_optind; + break; - case EXPERIMENTAL_TERMINAL_WIDGET_OPTION: - // If we see this option, then we don't fork and exec. - fork_and_exec = false; - new_argv[k++] = argv[old_optind]; - break; + case EXPERIMENTAL_TERMINAL_WIDGET_OPTION: + // If we see this option, then we don't fork and exec. + fork_and_exec = false; + new_argv[k++] = argv[old_optind]; + break; - case PERSIST_OPTION: - // FIXME: How can we reliably detect if this option appears after - // a FILE argument. In this case octave ignores the option, - // but the GUI might still be launched if --gui is also - // given. - persist_octave = true; - new_argv[k++] = argv[old_optind]; - break; + case PERSIST_OPTION: + // FIXME: How can we reliably detect if this option appears after + // a FILE argument. In this case octave ignores the option, + // but the GUI might still be launched if --gui is also + // given. + persist_octave = true; + new_argv[k++] = argv[old_optind]; + break; - case SERVER_OPTION: - server = true; - new_argv[k++] = argv[old_optind]; - break; + case SERVER_OPTION: + server = true; + new_argv[k++] = argv[old_optind]; + break; - case EVAL_OPTION: - eval_code = true; - for (int i = old_optind; i < next_optind; i++) - new_argv[k++] = argv[i]; - break; + case EVAL_OPTION: + eval_code = true; + for (int i = old_optind; i < next_optind; i++) + new_argv[k++] = argv[i]; + break; - case 'q': - // options "--silent" or "--quiet" - warn_display = false; - new_argv[k++] = argv[old_optind]; - break; + case 'q': + // options "--silent" or "--quiet" + warn_display = false; + new_argv[k++] = argv[old_optind]; + break; - case 'W': - // option "--no-window-system" - no_display = true; - new_argv[k++] = argv[old_optind]; - break; + case 'W': + // option "--no-window-system" + no_display = true; + new_argv[k++] = argv[old_optind]; + break; - default: - for (int i = old_optind; i < next_optind; i++) - new_argv[k++] = argv[i]; - break; + default: + for (int i = old_optind; i < next_optind; i++) + new_argv[k++] = argv[i]; + break; } } diff -r a2be40ce8fec -r 60515d0cd023 src/octave-svgconvert.cc --- a/src/octave-svgconvert.cc Tue Dec 12 16:15:23 2023 -0500 +++ b/src/octave-svgconvert.cc Tue Dec 12 23:14:33 2023 -0800 @@ -83,7 +83,8 @@ }; // String conversion functions+QVector qstr2vectorf (QString str) -QVector qstr2vectorf (QString str) +QVector +qstr2vectorf (QString str) { QVector pts; QStringList coords = str.split (","); @@ -95,7 +96,8 @@ // FIXME: What's the difference between qstr2vectorf and qstr2vectord? // Can one be called from the other to avoid code duplication, or deleted? -QVector qstr2vectord (QString str) +QVector +qstr2vectord (QString str) { QVector pts; QStringList coords = str.split (","); @@ -105,7 +107,8 @@ return pts; } -QVector qstr2ptsvector (QString str) +QVector +qstr2ptsvector (QString str) { QVector pts; str = str.trimmed (); @@ -121,7 +124,8 @@ // FIXME: What's the difference between qstr2ptsvector and qstr2ptsvectord? // Can one be called from the other to avoid code duplication, or deleted? -QVector qstr2ptsvectord (QString str) +QVector +qstr2ptsvectord (QString str) { QVector pts; str = str.trimmed (); @@ -136,7 +140,8 @@ } // Extract field arguments in a style-like string, e.g. "bla field(1,34,56) bla" -QString get_field (QString str, QString field) +QString +get_field (QString str, QString field) { QRegularExpression rx (field + "\\(([^\\)]*)\\)"); QRegularExpressionMatch match = rx.match (str); @@ -331,12 +336,13 @@ QList m_polygons; }; -void draw (QDomElement& parent_elt, pdfpainter& painter) +void +draw (QDomElement& parent_elt, pdfpainter& painter) { QDomNodeList nodes = parent_elt.childNodes (); static QString clippath_id; - static QMap< QString, QVector > clippath; + static QMap< QString, QVector> clippath; // tspan elements must have access to the font and position extracted from // their parent text element @@ -726,8 +732,9 @@ // Append a list of reconstructed child polygons to a QDomElement and remove // the original nodes -void replace_polygons (QDomElement& parent_elt, QList orig, - QList polygons) +void +replace_polygons (QDomElement& parent_elt, QList orig, + QList polygons) { if (! orig.count () || (orig.count () == polygons.count ())) return; @@ -757,7 +764,8 @@ parent_elt.removeChild (orig.at (ii)); } -void reconstruct_polygons (QDomElement& parent_elt, int reconstruct_level) +void +reconstruct_polygons (QDomElement& parent_elt, int reconstruct_level) { QDomNodeList nodes = parent_elt.childNodes (); QColor current_color; @@ -765,7 +773,7 @@ octave_polygon current_polygon; // Collection of child nodes to be removed and polygons to be added - QList< QPair,QList > > collection; + QList< QPair, QList>> collection; for (int ii = 0; ii < nodes.count (); ii++) { @@ -797,7 +805,7 @@ // Reconstruct the previous series of triangles QList polygons = current_polygon.reconstruct (reconstruct_level); - collection.push_back (QPair,QList > + collection.push_back (QPair, QList> (replaced_nodes, polygons)); replaced_nodes.clear (); @@ -816,7 +824,7 @@ if (current_polygon.count ()) { QList polygons = current_polygon.reconstruct (reconstruct_level); - collection.push_back (QPair,QList > + collection.push_back (QPair, QList> (replaced_nodes, polygons)); replaced_nodes.clear (); current_polygon.reset (); @@ -826,15 +834,16 @@ } // Finish - collection.push_back (QPair,QList > - (replaced_nodes, - current_polygon.reconstruct (reconstruct_level))); + collection.push_back (QPair, QList> + (replaced_nodes, + current_polygon.reconstruct (reconstruct_level))); for (int ii = 0; ii < collection.count (); ii++) replace_polygons (parent_elt, collection[ii].first, collection[ii].second); } -void add_custom_properties (QDomElement& parent_elt) +void +add_custom_properties (QDomElement& parent_elt) { QDomNodeList nodes = parent_elt.childNodes ();