Mercurial > hg > octave-nkf
annotate src/pt-cmd.h @ 7926:d74f996e005d
__magick_read__.cc: configuration and style fixes
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 14 Jul 2008 16:00:09 -0400 |
parents | 71f068b22fcc |
children | 73c4516fae10 |
rev | line source |
---|---|
494 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2004, 2005, |
4 2006, 2007 John W. Eaton | |
494 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
494 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
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 | |
7715
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
31 #include "ov-fcn.h" |
2988 | 32 #include "pt.h" |
3770 | 33 #include "pt-bp.h" |
7336 | 34 #include "symtab.h" |
578 | 35 |
36 // A base class for commands. | |
37 | |
494 | 38 class |
39 tree_command : public tree | |
40 { | |
578 | 41 public: |
2124 | 42 |
2982 | 43 tree_command (int l = -1, int c = -1) |
44 : tree (l, c) { } | |
578 | 45 |
1270 | 46 virtual ~tree_command (void) { } |
47 | |
578 | 48 virtual void eval (void) = 0; |
2988 | 49 |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
50 virtual tree_command *dup (symbol_table::scope_id, |
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
51 symbol_table::context_id context) = 0; |
5861 | 52 |
2988 | 53 private: |
54 | |
55 // No copying! | |
56 | |
57 tree_command (const tree_command&); | |
58 | |
59 tree_command& operator = (const tree_command&); | |
494 | 60 }; |
61 | |
2620 | 62 // No-op. |
63 | |
64 class | |
65 tree_no_op_command : public tree_command | |
66 { | |
67 public: | |
68 | |
3523 | 69 tree_no_op_command (const std::string& cmd = "no_op", int l = -1, int c = -1) |
2620 | 70 : tree_command (l, c), orig_cmd (cmd) { } |
71 | |
72 ~tree_no_op_command (void) { } | |
73 | |
3770 | 74 void eval (void) { MAYBE_DO_BREAKPOINT; } |
2620 | 75 |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
76 tree_command *dup (symbol_table::scope_id scope, |
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
77 symbol_table::context_id context); |
5861 | 78 |
2620 | 79 void accept (tree_walker& tw); |
80 | |
3523 | 81 std::string original_command (void) { return orig_cmd; } |
2620 | 82 |
83 private: | |
84 | |
3523 | 85 std::string orig_cmd; |
2988 | 86 |
87 // No copying! | |
88 | |
89 tree_no_op_command (const tree_no_op_command&); | |
90 | |
91 tree_no_op_command& operator = (const tree_no_op_command&); | |
2620 | 92 }; |
93 | |
7715
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
94 // Function definition. |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
95 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
96 class |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
97 tree_function_def : public tree_command |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
98 { |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
99 public: |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
100 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
101 tree_function_def (octave_function *f, int l = -1, int c = -1) |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
102 : tree_command (l, c), fcn (f) { } |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
103 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
104 ~tree_function_def (void) { } |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
105 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
106 void eval (void); |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
107 |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
108 tree_command *dup (symbol_table::scope_id scope, |
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
109 symbol_table::context_id context); |
7715
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
110 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
111 void accept (tree_walker& tw); |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
112 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
113 octave_function *function (void) { return fcn.function_value (); } |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
114 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
115 private: |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
116 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
117 octave_value fcn; |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
118 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
119 tree_function_def (const octave_value& v, int l = -1, int c = -1) |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
120 : tree_command (l, c), fcn (v) { } |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
121 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
122 // No copying! |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
123 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
124 tree_function_def (const tree_function_def&); |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
125 |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
126 tree_function_def& operator = (const tree_function_def&); |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
127 }; |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
128 |
494 | 129 #endif |
130 | |
131 /* | |
132 ;;; Local Variables: *** | |
133 ;;; mode: C++ *** | |
134 ;;; End: *** | |
135 */ |