GNU Octave 7.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
interpreter-qobject.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 2011-2022 The Octave Project Developers
4//
5// See the file COPYRIGHT.md in the top-level directory of this
6// distribution or <https://octave.org/copyright/>.
7//
8// This file is part of Octave.
9//
10// Octave is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// Octave is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with Octave; see the file COPYING. If not, see
22// <https://www.gnu.org/licenses/>.
23//
24////////////////////////////////////////////////////////////////////////
25
26#if ! defined (octave_interpreter_qobject_h)
27#define octave_interpreter_qobject_h 1
28
29#include <QObject>
30
32
33namespace octave
34{
35 class interpreter;
36
37 class base_qobject;
38
40 {
41 Q_OBJECT
42
43 public:
44
46
47 ~interpreter_qobject (void) = default;
48
50
51 void interpreter_event (const fcn_callback& fcn);
52
53 void interpreter_event (const meth_callback& meth);
54
55 void interrupt (void);
56
57 // Note: PAUSE, STOP, and RESUME are currently only used by the new
58 // experimental terminal widget.
59 void pause (void);
60 void stop (void);
61 void resume (void);
62
63 signals:
64
65 void ready (void);
66
68
69 public slots:
70
71 // Programming Note: With the current design of the interpreter,
72 // additional signals will not be noticed because the execute
73 // function starts the Octave interpreter and it doesn't return
74 // until the interpreter exits. So the Qt event loop running in the
75 // thread where the interpreter_qobject object lives never has a
76 // chance to see another signal. Changing the design of the
77 // terminal widget as proposed and discussed here:
78 //
79 // https://lists.gnu.org/archive/html/octave-maintainers/2019-05/msg00115.html
80 // https://lists.gnu.org/archive/html/octave-maintainers/2019-06/msg00009.html
81 //
82 // coulld solve that problem. Briefly, instead of having the Octave
83 // interpreter block and wait for keyboard input, the terminal
84 // widget would be in charge of accepting keyboard events and use
85 // readline in callback mode. Then the terminal widget and the
86 // interpreter will not block except when executing code. Then we
87 // could have the interpreter qobject directly accept signals.
88
89 //! Initialize and execute the octave interpreter.
90
91 void execute (void);
92
93 private:
94
96
98 };
99}
100
101#endif
Base class for Octave interfaces that use Qt.
~interpreter_qobject(void)=default
interpreter_qobject(base_qobject &oct_qobj)
void interpreter_event(const fcn_callback &fcn)
qt_interpreter_events * qt_link(void)
void execute(void)
Initialize and execute the octave interpreter.
OCTAVE_NAMESPACE_BEGIN typedef std::function< void(void)> fcn_callback
Definition: event-manager.h:47
std::function< void(interpreter &)> meth_callback
Definition: event-manager.h:48