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 |
1315
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
494
|
20 |
|
21 */ |
|
22 |
|
23 #if !defined (octave_tree_cmd_h) |
|
24 #define octave_tree_cmd_h 1 |
|
25 |
2982
|
26 #include <string> |
494
|
27 |
2124
|
28 class tree_walker; |
|
29 |
2988
|
30 #include "pt.h" |
3770
|
31 #include "pt-bp.h" |
578
|
32 |
|
33 // A base class for commands. |
|
34 |
494
|
35 class |
|
36 tree_command : public tree |
|
37 { |
578
|
38 public: |
2124
|
39 |
2982
|
40 tree_command (int l = -1, int c = -1) |
|
41 : tree (l, c) { } |
578
|
42 |
1270
|
43 virtual ~tree_command (void) { } |
|
44 |
578
|
45 virtual void eval (void) = 0; |
2988
|
46 |
|
47 private: |
|
48 |
|
49 // No copying! |
|
50 |
|
51 tree_command (const tree_command&); |
|
52 |
|
53 tree_command& operator = (const tree_command&); |
494
|
54 }; |
|
55 |
2620
|
56 // No-op. |
|
57 |
|
58 class |
|
59 tree_no_op_command : public tree_command |
|
60 { |
|
61 public: |
|
62 |
3523
|
63 tree_no_op_command (const std::string& cmd = "no_op", int l = -1, int c = -1) |
2620
|
64 : tree_command (l, c), orig_cmd (cmd) { } |
|
65 |
|
66 ~tree_no_op_command (void) { } |
|
67 |
3770
|
68 void eval (void) { MAYBE_DO_BREAKPOINT; } |
2620
|
69 |
|
70 void accept (tree_walker& tw); |
|
71 |
3523
|
72 std::string original_command (void) { return orig_cmd; } |
2620
|
73 |
|
74 private: |
|
75 |
3523
|
76 std::string orig_cmd; |
2988
|
77 |
|
78 // No copying! |
|
79 |
|
80 tree_no_op_command (const tree_no_op_command&); |
|
81 |
|
82 tree_no_op_command& operator = (const tree_no_op_command&); |
2620
|
83 }; |
|
84 |
494
|
85 #endif |
|
86 |
|
87 /* |
|
88 ;;; Local Variables: *** |
|
89 ;;; mode: C++ *** |
|
90 ;;; End: *** |
|
91 */ |