Mercurial > hg > octave-nkf
annotate gui/src/backend/OctaveLink.h @ 13674:c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Sun, 25 Sep 2011 10:52:42 +0200 |
parents | 56eb9348ff02 |
children | 25dc40d24a44 |
rev | line source |
---|---|
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13595
diff
changeset
|
1 /* OctaveGUI - A graphical user interface for Octave |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13595
diff
changeset
|
2 * Copyright (C) 2011 John P. Swensen, Jacob Dawid (jacob.dawid@googlemail.com) |
13501 | 3 * |
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13595
diff
changeset
|
4 * This program is free software: you can redistribute it and/or modify |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13595
diff
changeset
|
5 * it under the terms of the GNU Affero General Public License as |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13595
diff
changeset
|
6 * published by the Free Software Foundation, either version 3 of the |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13595
diff
changeset
|
7 * License, or (at your option) any later version. |
13501 | 8 * |
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13595
diff
changeset
|
9 * This program is distributed in the hope that it will be useful, |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13595
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13595
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13595
diff
changeset
|
12 * GNU Affero General Public License for more details. |
13501 | 13 * |
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13595
diff
changeset
|
14 * You should have received a copy of the GNU Affero General Public License |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13595
diff
changeset
|
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13595
diff
changeset
|
16 */ |
13501 | 17 |
18 #ifndef OCTAVELINK_H | |
19 #define OCTAVELINK_H | |
20 | |
21 // Octave includes | |
22 #undef PACKAGE_BUGREPORT | |
23 #undef PACKAGE_NAME | |
24 #undef PACKAGE_STRING | |
25 #undef PACKAGE_TARNAME | |
26 #undef PACKAGE_VERSION | |
27 #undef PACKAGE_URL | |
13595
56eb9348ff02
Added missing include flags.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13543
diff
changeset
|
28 #include "octave/config.h" |
13501 | 29 #include "octave/cmd-edit.h" |
30 #include "octave/error.h" | |
31 #include "octave/file-io.h" | |
32 #include "octave/input.h" | |
33 #include "octave/lex.h" | |
34 #include "octave/load-path.h" | |
35 #include "octave/octave.h" | |
36 #include "octave/oct-hist.h" | |
37 #include "octave/oct-map.h" | |
38 #include "octave/oct-obj.h" | |
39 #include "octave/ops.h" | |
40 #include "octave/ov.h" | |
41 #include "octave/ov-usr-fcn.h" | |
42 #include "octave/symtab.h" | |
43 #include "octave/pt.h" | |
44 #include "octave/pt-eval.h" | |
45 #include "octave/config.h" | |
46 #include "octave/Range.h" | |
47 #include "octave/toplev.h" | |
48 #include "octave/procstream.h" | |
49 #include "octave/sighandlers.h" | |
50 #include "octave/debug.h" | |
51 #include "octave/sysdep.h" | |
52 #include "octave/ov.h" | |
53 #include "octave/unwind-prot.h" | |
54 #include "octave/utils.h" | |
55 #include "octave/variables.h" | |
56 | |
57 // Standard includes | |
58 #include <iostream> | |
59 #include <string> | |
60 #include <vector> | |
61 #include <readline/readline.h> | |
62 | |
63 // Qt includes | |
64 #include <QMutexLocker> | |
65 #include <QMutex> | |
66 #include <QFileInfo> | |
67 #include <QList> | |
68 #include <QString> | |
13517
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
69 #include <QStringList> |
13501 | 70 #include <QVector> |
71 #include <QSemaphore> | |
72 #include <QObject> | |
13518
bace956a3724
Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
73 #include <QStringListModel> |
13501 | 74 |
13541
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13522
diff
changeset
|
75 #include "OctaveCallbackThread.h" |
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13522
diff
changeset
|
76 #include "OctaveMainThread.h" |
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13522
diff
changeset
|
77 |
13517
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
78 typedef symbol_table::symbol_record SymbolRecord; |
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
79 typedef octave_value OctaveValue; |
13501 | 80 |
81 /** | |
82 * \class OctaveLink | |
83 * Manages a link to an octave instance. | |
84 */ | |
13541
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13522
diff
changeset
|
85 class OctaveLink:public QObject |
13501 | 86 { |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
87 Q_OBJECT |
13501 | 88 public: |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
89 static OctaveLink * |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
90 instance () |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
91 { |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
92 return &m_singleton; |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
93 } |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
94 static QString |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
95 octaveValueAsQString (OctaveValue octaveValue); |
13501 | 96 |
13541
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13522
diff
changeset
|
97 void launchOctave (); |
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13522
diff
changeset
|
98 void terminateOctave (); |
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13522
diff
changeset
|
99 |
13517
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
100 /** |
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
101 * Returns a copy of the current symbol table buffer. |
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
102 * \return Copy of the current symbol table buffer. |
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
103 */ |
13521
16b33b7ef1b3
Raised update interval to 500ms.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13520
diff
changeset
|
104 QList < SymbolRecord > copyCurrentSymbolTable (); |
13501 | 105 |
13518
bace956a3724
Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
106 void |
bace956a3724
Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
107 updateHistoryModel (); |
bace956a3724
Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
108 |
bace956a3724
Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
109 QStringListModel * |
bace956a3724
Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
110 historyModel (); |
13501 | 111 |
13517
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
112 /** |
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
113 * Updates the current symbol table with new data |
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
114 * from octave. |
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
115 */ |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
116 void |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
117 fetchSymbolTable (); |
13501 | 118 |
119 signals: | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
120 void |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
121 symbolTableChanged (); |
13501 | 122 |
123 private: | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
124 OctaveLink (); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
125 ~OctaveLink (); |
13501 | 126 |
13517
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
127 /** Variable related member variables. */ |
13513
e19c454ed485
Added version script for Octave GUI.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13506
diff
changeset
|
128 QSemaphore * m_symbolTableSemaphore; |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
129 QList < SymbolRecord > m_symbolTableBuffer; |
13501 | 130 |
13517
86adc9c4ec4b
History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13513
diff
changeset
|
131 /** History related member variables. */ |
13518
bace956a3724
Put history model part into OctaveLink.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13517
diff
changeset
|
132 QStringListModel *m_historyModel; |
13519
35ecb6063c7b
Made the view connect with the history model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13518
diff
changeset
|
133 |
13541
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13522
diff
changeset
|
134 // Threads for running octave and managing the data interaction. |
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13522
diff
changeset
|
135 OctaveMainThread *m_octaveMainThread; |
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13522
diff
changeset
|
136 OctaveCallbackThread *m_octaveCallbackThread; |
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13522
diff
changeset
|
137 |
13513
e19c454ed485
Added version script for Octave GUI.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13506
diff
changeset
|
138 static OctaveLink m_singleton; |
13501 | 139 }; |
140 #endif // OCTAVELINK_H |