Mercurial > hg > octave-lyh
comparison libinterp/parse-tree/pt-select.h @ 15195:2fc554ffbc28
split libinterp from src
* libinterp: New directory. Move all files from src directory here
except Makefile.am, main.cc, main-cli.cc, mkoctfile.in.cc,
mkoctfilr.in.sh, octave-config.in.cc, octave-config.in.sh.
* libinterp/Makefile.am: New file, extracted from src/Makefile.am.
* src/Makefile.am: Delete everything except targets and definitions
needed to build and link main and utility programs.
* Makefile.am (SUBDIRS): Include libinterp in the list.
* autogen.sh: Run config-module.sh in libinterp/dldfcn directory, not
src/dldfcn directory.
* configure.ac (AC_CONFIG_SRCDIR): Use libinterp/octave.cc, not
src/octave.cc.
(DL_LDFLAGS, LIBOCTINTERP): Use libinterp, not src.
(AC_CONFIG_FILES): Include libinterp/Makefile in the list.
* find-docstring-files.sh: Look in libinterp, not src.
* gui/src/Makefile.am (liboctgui_la_CPPFLAGS): Find header files in
libinterp, not src.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 18 Aug 2012 16:23:39 -0400 |
parents | src/parse-tree/pt-select.h@46b19589b593 |
children |
comparison
equal
deleted
inserted
replaced
15194:0f0b795044c3 | 15195:2fc554ffbc28 |
---|---|
1 /* | |
2 | |
3 Copyright (C) 1996-2012 John W. Eaton | |
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 3 of the License, or (at your | |
10 option) any 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, see | |
19 <http://www.gnu.org/licenses/>. | |
20 | |
21 */ | |
22 | |
23 #if !defined (octave_tree_select_h) | |
24 #define octave_tree_select_h 1 | |
25 | |
26 class expression; | |
27 class tree_statement_list; | |
28 | |
29 class tree_walker; | |
30 | |
31 #include "base-list.h" | |
32 #include "comment-list.h" | |
33 #include "pt-cmd.h" | |
34 #include "symtab.h" | |
35 | |
36 // If. | |
37 | |
38 class | |
39 tree_if_clause : public tree | |
40 { | |
41 public: | |
42 | |
43 tree_if_clause (int l = -1, int c = -1) | |
44 : tree (l, c), expr (0), list (0), lead_comm (0) { } | |
45 | |
46 tree_if_clause (tree_statement_list *sl, octave_comment_list *lc = 0, | |
47 int l = -1, int c = -1) | |
48 : tree (l, c), expr (0), list (sl), lead_comm (lc) { } | |
49 | |
50 tree_if_clause (tree_expression *e, tree_statement_list *sl, | |
51 octave_comment_list *lc = 0, | |
52 int l = -1, int c = -1) | |
53 : tree (l, c), expr (e), list (sl), lead_comm (lc) { } | |
54 | |
55 ~tree_if_clause (void); | |
56 | |
57 bool is_else_clause (void) { return ! expr; } | |
58 | |
59 tree_expression *condition (void) { return expr; } | |
60 | |
61 tree_statement_list *commands (void) { return list; } | |
62 | |
63 octave_comment_list *leading_comment (void) { return lead_comm; } | |
64 | |
65 tree_if_clause *dup (symbol_table::scope_id scope, | |
66 symbol_table::context_id context) const; | |
67 | |
68 void accept (tree_walker& tw); | |
69 | |
70 private: | |
71 | |
72 // The condition to test. | |
73 tree_expression *expr; | |
74 | |
75 // The list of statements to evaluate if expr is true. | |
76 tree_statement_list *list; | |
77 | |
78 // Comment preceding ELSE or ELSEIF token. | |
79 octave_comment_list *lead_comm; | |
80 | |
81 // No copying! | |
82 | |
83 tree_if_clause (const tree_if_clause&); | |
84 | |
85 tree_if_clause& operator = (const tree_if_clause&); | |
86 }; | |
87 | |
88 class | |
89 tree_if_command_list : public octave_base_list<tree_if_clause *> | |
90 { | |
91 public: | |
92 | |
93 tree_if_command_list (void) { } | |
94 | |
95 tree_if_command_list (tree_if_clause *t) { append (t); } | |
96 | |
97 ~tree_if_command_list (void) | |
98 { | |
99 while (! empty ()) | |
100 { | |
101 iterator p = begin (); | |
102 delete *p; | |
103 erase (p); | |
104 } | |
105 } | |
106 | |
107 tree_if_command_list *dup (symbol_table::scope_id scope, | |
108 symbol_table::context_id context) const; | |
109 | |
110 void accept (tree_walker& tw); | |
111 | |
112 private: | |
113 | |
114 // No copying! | |
115 | |
116 tree_if_command_list (const tree_if_command_list&); | |
117 | |
118 tree_if_command_list& operator = (const tree_if_command_list&); | |
119 }; | |
120 | |
121 class | |
122 tree_if_command : public tree_command | |
123 { | |
124 public: | |
125 | |
126 tree_if_command (int l = -1, int c = -1) | |
127 : tree_command (l, c), list (0), lead_comm (0), trail_comm (0) { } | |
128 | |
129 tree_if_command (tree_if_command_list *lst, octave_comment_list *lc, | |
130 octave_comment_list *tc, int l = -1, int c = -1) | |
131 : tree_command (l, c), list (lst), lead_comm (lc), trail_comm (tc) { } | |
132 | |
133 ~tree_if_command (void); | |
134 | |
135 tree_if_command_list *cmd_list (void) { return list; } | |
136 | |
137 octave_comment_list *leading_comment (void) { return lead_comm; } | |
138 | |
139 octave_comment_list *trailing_comment (void) { return trail_comm; } | |
140 | |
141 tree_command *dup (symbol_table::scope_id scope, | |
142 symbol_table::context_id context) const; | |
143 | |
144 void accept (tree_walker& tw); | |
145 | |
146 private: | |
147 | |
148 // List of if commands (if, elseif, elseif, ... else, endif) | |
149 tree_if_command_list *list; | |
150 | |
151 // Comment preceding IF token. | |
152 octave_comment_list *lead_comm; | |
153 | |
154 // Comment preceding ENDIF token. | |
155 octave_comment_list *trail_comm; | |
156 | |
157 // No copying! | |
158 | |
159 tree_if_command (const tree_if_command&); | |
160 | |
161 tree_if_command& operator = (const tree_if_command&); | |
162 }; | |
163 | |
164 // Switch. | |
165 | |
166 class | |
167 tree_switch_case : public tree | |
168 { | |
169 public: | |
170 | |
171 tree_switch_case (int l = -1, int c = -1) | |
172 : tree (l, c), label (0), list (0), lead_comm (0) { } | |
173 | |
174 tree_switch_case (tree_statement_list *sl, octave_comment_list *lc = 0, | |
175 int l = -1, int c = -1) | |
176 : tree (l, c), label (0), list (sl), lead_comm (lc) { } | |
177 | |
178 tree_switch_case (tree_expression *e, tree_statement_list *sl, | |
179 octave_comment_list *lc = 0, | |
180 int l = -1, int c = -1) | |
181 : tree (l, c), label (e), list (sl), lead_comm (lc) { } | |
182 | |
183 ~tree_switch_case (void); | |
184 | |
185 bool is_default_case (void) { return ! label; } | |
186 | |
187 bool label_matches (const octave_value& val); | |
188 | |
189 tree_expression *case_label (void) { return label; } | |
190 | |
191 tree_statement_list *commands (void) { return list; } | |
192 | |
193 octave_comment_list *leading_comment (void) { return lead_comm; } | |
194 | |
195 tree_switch_case *dup (symbol_table::scope_id scope, | |
196 symbol_table::context_id context) const; | |
197 | |
198 void accept (tree_walker& tw); | |
199 | |
200 private: | |
201 | |
202 // The case label. | |
203 tree_expression *label; | |
204 | |
205 // The list of statements to evaluate if the label matches. | |
206 tree_statement_list *list; | |
207 | |
208 // Comment preceding CASE or OTHERWISE token. | |
209 octave_comment_list *lead_comm; | |
210 | |
211 // No copying! | |
212 | |
213 tree_switch_case (const tree_switch_case&); | |
214 | |
215 tree_switch_case& operator = (const tree_switch_case&); | |
216 }; | |
217 | |
218 class | |
219 tree_switch_case_list : public octave_base_list<tree_switch_case *> | |
220 { | |
221 public: | |
222 | |
223 tree_switch_case_list (void) { } | |
224 | |
225 tree_switch_case_list (tree_switch_case *t) { append (t); } | |
226 | |
227 ~tree_switch_case_list (void) | |
228 { | |
229 while (! empty ()) | |
230 { | |
231 iterator p = begin (); | |
232 delete *p; | |
233 erase (p); | |
234 } | |
235 } | |
236 | |
237 tree_switch_case_list *dup (symbol_table::scope_id scope, | |
238 symbol_table::context_id context) const; | |
239 | |
240 void accept (tree_walker& tw); | |
241 | |
242 private: | |
243 | |
244 // No copying! | |
245 | |
246 tree_switch_case_list (const tree_switch_case_list&); | |
247 | |
248 tree_switch_case_list& operator = (const tree_switch_case_list&); | |
249 }; | |
250 | |
251 class | |
252 tree_switch_command : public tree_command | |
253 { | |
254 public: | |
255 | |
256 tree_switch_command (int l = -1, int c = -1) | |
257 : tree_command (l, c), expr (0), list (0), lead_comm (0), | |
258 trail_comm (0) { } | |
259 | |
260 tree_switch_command (tree_expression *e, tree_switch_case_list *lst, | |
261 octave_comment_list *lc, octave_comment_list *tc, | |
262 int l = -1, int c = -1) | |
263 : tree_command (l, c), expr (e), list (lst), lead_comm (lc), | |
264 trail_comm (tc) { } | |
265 | |
266 ~tree_switch_command (void); | |
267 | |
268 tree_expression *switch_value (void) { return expr; } | |
269 | |
270 tree_switch_case_list *case_list (void) { return list; } | |
271 | |
272 octave_comment_list *leading_comment (void) { return lead_comm; } | |
273 | |
274 octave_comment_list *trailing_comment (void) { return trail_comm; } | |
275 | |
276 tree_command *dup (symbol_table::scope_id scope, | |
277 symbol_table::context_id context) const; | |
278 | |
279 void accept (tree_walker& tw); | |
280 | |
281 private: | |
282 | |
283 // Value on which to switch. | |
284 tree_expression *expr; | |
285 | |
286 // List of cases (case 1, case 2, ..., default) | |
287 tree_switch_case_list *list; | |
288 | |
289 // Comment preceding SWITCH token. | |
290 octave_comment_list *lead_comm; | |
291 | |
292 // Comment preceding ENDSWITCH token. | |
293 octave_comment_list *trail_comm; | |
294 | |
295 // No copying! | |
296 | |
297 tree_switch_command (const tree_switch_command&); | |
298 | |
299 tree_switch_command& operator = (const tree_switch_command&); | |
300 }; | |
301 | |
302 #endif |