annotate qt-interpreter.cpp @ 14:1e5a1e15fa56

clean up header files, more small readline changes
author John W. Eaton <jwe@octave.org>
date Thu, 23 May 2019 18:41:04 -0400
parents 04867eba6428
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14
1e5a1e15fa56 clean up header files, more small readline changes
John W. Eaton <jwe@octave.org>
parents: 7
diff changeset
1 #include <string>
4
0e154787183d new interpreter and qt_interpreter objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
2
5
54edd85237ab use signal to send input to qt interpreter object
John W. Eaton <jwe@octave.org>
parents: 4
diff changeset
3 #include <QString>
54edd85237ab use signal to send input to qt interpreter object
John W. Eaton <jwe@octave.org>
parents: 4
diff changeset
4
4
0e154787183d new interpreter and qt_interpreter objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
5 #include "interpreter.h"
0e154787183d new interpreter and qt_interpreter objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
6 #include "qt-interpreter.h"
0e154787183d new interpreter and qt_interpreter objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
7
0e154787183d new interpreter and qt_interpreter objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
8 namespace calc
0e154787183d new interpreter and qt_interpreter objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
9 {
0e154787183d new interpreter and qt_interpreter objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
10 qt_interpreter::qt_interpreter (void)
6
1b575145197e interpreter is now a class instead of a namespace with functions
John W. Eaton <jwe@octave.org>
parents: 5
diff changeset
11 : m_interpreter ()
7
04867eba6428 function objects and signals/slots for errors and results
John W. Eaton <jwe@octave.org>
parents: 6
diff changeset
12 {
04867eba6428 function objects and signals/slots for errors and results
John W. Eaton <jwe@octave.org>
parents: 6
diff changeset
13 m_interpreter.set_error_handler ([this] (const char *msg)
04867eba6428 function objects and signals/slots for errors and results
John W. Eaton <jwe@octave.org>
parents: 6
diff changeset
14 { emit this->error_signal (msg); });
04867eba6428 function objects and signals/slots for errors and results
John W. Eaton <jwe@octave.org>
parents: 6
diff changeset
15
04867eba6428 function objects and signals/slots for errors and results
John W. Eaton <jwe@octave.org>
parents: 6
diff changeset
16 m_interpreter.set_result_handler ([this] (double value)
04867eba6428 function objects and signals/slots for errors and results
John W. Eaton <jwe@octave.org>
parents: 6
diff changeset
17 { emit this->result_ready (value); });
04867eba6428 function objects and signals/slots for errors and results
John W. Eaton <jwe@octave.org>
parents: 6
diff changeset
18 }
4
0e154787183d new interpreter and qt_interpreter objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
19
0e154787183d new interpreter and qt_interpreter objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
20 void qt_interpreter::execute (void)
0e154787183d new interpreter and qt_interpreter objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
21 {
5
54edd85237ab use signal to send input to qt interpreter object
John W. Eaton <jwe@octave.org>
parents: 4
diff changeset
22 }
54edd85237ab use signal to send input to qt interpreter object
John W. Eaton <jwe@octave.org>
parents: 4
diff changeset
23
54edd85237ab use signal to send input to qt interpreter object
John W. Eaton <jwe@octave.org>
parents: 4
diff changeset
24 void qt_interpreter::accept_input_line (const QString& line)
54edd85237ab use signal to send input to qt interpreter object
John W. Eaton <jwe@octave.org>
parents: 4
diff changeset
25 {
6
1b575145197e interpreter is now a class instead of a namespace with functions
John W. Eaton <jwe@octave.org>
parents: 5
diff changeset
26 m_interpreter.parse_and_execute (line.toStdString ());
4
0e154787183d new interpreter and qt_interpreter objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 }
0e154787183d new interpreter and qt_interpreter objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28 }