494
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
494
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
5307
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
494
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_tree_cmd_h) |
|
25 #define octave_tree_cmd_h 1 |
|
26 |
2982
|
27 #include <string> |
494
|
28 |
2124
|
29 class tree_walker; |
|
30 |
2988
|
31 #include "pt.h" |
3770
|
32 #include "pt-bp.h" |
578
|
33 |
|
34 // A base class for commands. |
|
35 |
494
|
36 class |
|
37 tree_command : public tree |
|
38 { |
578
|
39 public: |
2124
|
40 |
2982
|
41 tree_command (int l = -1, int c = -1) |
|
42 : tree (l, c) { } |
578
|
43 |
1270
|
44 virtual ~tree_command (void) { } |
|
45 |
578
|
46 virtual void eval (void) = 0; |
2988
|
47 |
|
48 private: |
|
49 |
|
50 // No copying! |
|
51 |
|
52 tree_command (const tree_command&); |
|
53 |
|
54 tree_command& operator = (const tree_command&); |
494
|
55 }; |
|
56 |
2620
|
57 // No-op. |
|
58 |
|
59 class |
|
60 tree_no_op_command : public tree_command |
|
61 { |
|
62 public: |
|
63 |
3523
|
64 tree_no_op_command (const std::string& cmd = "no_op", int l = -1, int c = -1) |
2620
|
65 : tree_command (l, c), orig_cmd (cmd) { } |
|
66 |
|
67 ~tree_no_op_command (void) { } |
|
68 |
3770
|
69 void eval (void) { MAYBE_DO_BREAKPOINT; } |
2620
|
70 |
|
71 void accept (tree_walker& tw); |
|
72 |
3523
|
73 std::string original_command (void) { return orig_cmd; } |
2620
|
74 |
|
75 private: |
|
76 |
3523
|
77 std::string orig_cmd; |
2988
|
78 |
|
79 // No copying! |
|
80 |
|
81 tree_no_op_command (const tree_no_op_command&); |
|
82 |
|
83 tree_no_op_command& operator = (const tree_no_op_command&); |
2620
|
84 }; |
|
85 |
494
|
86 #endif |
|
87 |
|
88 /* |
|
89 ;;; Local Variables: *** |
|
90 ;;; mode: C++ *** |
|
91 ;;; End: *** |
|
92 */ |