Mercurial > jwe > qt-gui-with-push-parser
comparison tty-main.cpp @ 9:822a2fe5bb51
move command window to separate file and other refactoring
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 23 May 2019 12:36:26 -0400 |
parents | 1b575145197e |
children | 69f5d5e42d2b |
comparison
equal
deleted
inserted
replaced
8:7c4b04a6346d | 9:822a2fe5bb51 |
---|---|
5 #include <cstdlib> | 5 #include <cstdlib> |
6 | 6 |
7 #include <readline/readline.h> | 7 #include <readline/readline.h> |
8 #include <readline/history.h> | 8 #include <readline/history.h> |
9 | 9 |
10 #include "gui-main.h" | |
11 #include "tty-main.h" | 10 #include "tty-main.h" |
12 | 11 |
13 #include "interpreter.h" | 12 #include "interpreter.h" |
14 #include "parser.h" | 13 #include "parser.h" |
15 | 14 |
16 namespace tty | 15 namespace calc |
17 { | 16 { |
18 int main (int, char **) | 17 int tty_main (int, char **) |
19 { | 18 { |
20 std::cout | 19 std::cout |
21 << "Example Calculator.\n" | 20 << "Example Calculator.\n" |
22 << "Available operations: + - * / ^ ()\n" | 21 << "Available operations: + - * / ^ ()\n" |
23 << "Semicolon terminates statement.\n" | 22 << "Semicolon terminates statement.\n" |
48 break; | 47 break; |
49 } | 48 } |
50 | 49 |
51 return 0; | 50 return 0; |
52 } | 51 } |
53 | |
54 void emit_result (double value) | |
55 { | |
56 std::cout << "ans = " << value << std::endl; | |
57 } | |
58 | |
59 void emit_error (const char *msg) | |
60 { | |
61 std::cerr << "parse error: " << msg << std::endl; | |
62 } | |
63 } | 52 } |