Mercurial > jwe > qt-gui-with-push-parser
comparison tty-main.cpp @ 4:0e154787183d
new interpreter and qt_interpreter objects
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 22 May 2019 17:30:46 -0400 |
parents | 08df60a01bc1 |
children | 1b575145197e |
comparison
equal
deleted
inserted
replaced
3:52c033864347 | 4:0e154787183d |
---|---|
8 #include <readline/history.h> | 8 #include <readline/history.h> |
9 | 9 |
10 #include "gui-main.h" | 10 #include "gui-main.h" |
11 #include "tty-main.h" | 11 #include "tty-main.h" |
12 | 12 |
13 #include "parse.h" | 13 #include "interpreter.h" |
14 #include "parser.h" | |
14 | 15 |
15 namespace tty | 16 namespace tty |
16 { | 17 { |
17 int main (int, char **) | 18 int main (int, char **) |
18 { | 19 { |
20 << "Example Calculator.\n" | 21 << "Example Calculator.\n" |
21 << "Available operations: + - * / ^ ()\n" | 22 << "Available operations: + - * / ^ ()\n" |
22 << "Semicolon terminates statement.\n" | 23 << "Semicolon terminates statement.\n" |
23 << "GNU Readline available for history editing.\n" << std::endl; | 24 << "GNU Readline available for history editing.\n" << std::endl; |
24 | 25 |
25 interpreter::parser_init (); | 26 interpreter::init (); |
26 | 27 |
27 for (;;) | 28 for (;;) |
28 { | 29 { |
29 char *tmp = readline (interpreter::beg_of_stmt ? ">> " : ""); | 30 char *tmp = readline (parser::beg_of_stmt ? ">> " : ""); |
30 | 31 |
31 if (! tmp) | 32 if (! tmp) |
32 break; | 33 break; |
33 | 34 |
34 if (*tmp) | 35 if (*tmp) |
45 | 46 |
46 if (status < 0) | 47 if (status < 0) |
47 break; | 48 break; |
48 } | 49 } |
49 | 50 |
50 interpreter::parser_fini (); | 51 interpreter::fini (); |
51 | 52 |
52 return 0; | 53 return 0; |
53 } | 54 } |
54 | 55 |
55 void emit_result (double value) | 56 void emit_result (double value) |