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