529
|
1 // tree-cmd.cc -*- C++ -*- |
494
|
2 /* |
|
3 |
1009
|
4 Copyright (C) 1992, 1993, 1994, 1995 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 |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
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 |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
1315
|
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
494
|
21 |
|
22 */ |
|
23 |
1297
|
24 #if defined (__GNUG__) |
|
25 #pragma implementation |
|
26 #endif |
|
27 |
494
|
28 #ifdef HAVE_CONFIG_H |
1192
|
29 #include <config.h> |
494
|
30 #endif |
|
31 |
|
32 #include <iostream.h> |
|
33 |
1059
|
34 // Nonzero means we're breaking out of a loop or function body. |
578
|
35 int breaking = 0; |
|
36 |
|
37 // Nonzero means we're jumping to the end of a loop. |
|
38 int continuing = 0; |
|
39 |
|
40 // Nonzero means we're returning from a function. Global because it |
|
41 // is also needed in tree-expr.cc. |
|
42 int returning = 0; |
|
43 |
494
|
44 #include "user-prefs.h" |
|
45 #include "variables.h" |
1228
|
46 #include "oct-map.h" |
494
|
47 #include "symtab.h" |
|
48 #include "error.h" |
|
49 #include "gripes.h" |
584
|
50 #include "tree-base.h" |
578
|
51 #include "tree-expr.h" |
494
|
52 #include "tree-cmd.h" |
578
|
53 #include "tree-misc.h" |
494
|
54 #include "tree-const.h" |
916
|
55 #include "unwind-prot.h" |
494
|
56 |
|
57 // Decide if it's time to quit a for or while loop. |
1168
|
58 static inline int |
494
|
59 quit_loop_now (void) |
|
60 { |
1228
|
61 // Maybe handle `continue N' someday... |
494
|
62 |
|
63 if (continuing) |
|
64 continuing--; |
|
65 |
|
66 int quit = (returning || breaking || continuing); |
|
67 |
|
68 if (breaking) |
|
69 breaking--; |
|
70 |
|
71 return quit; |
|
72 } |
|
73 |
|
74 // But first, some extra functions used by the tree classes. |
|
75 |
|
76 // We seem to have no use for this now. Maybe it will be needed at |
|
77 // some future date, so here it is. |
|
78 #if 0 |
578
|
79 |
|
80 // Convert a linked list of trees to a vector of pointers to trees. |
|
81 |
494
|
82 static tree ** |
|
83 list_to_vector (tree *list, int& len) |
|
84 { |
|
85 len = list->length () + 1; |
|
86 |
|
87 tree **args = new tree * [len]; |
|
88 |
1228
|
89 // args[0] may eventually hold something useful, like the function |
|
90 // name. |
|
91 |
494
|
92 tree *tmp_list = list; |
|
93 for (int k = 1; k < len; k++) |
|
94 { |
|
95 args[k] = tmp_list; |
|
96 tmp_list = tmp_list->next_elem (); |
|
97 } |
|
98 return args; |
|
99 } |
|
100 #endif |
|
101 |
578
|
102 // Global. |
494
|
103 |
578
|
104 tree_global_command::~tree_global_command (void) |
494
|
105 { |
578
|
106 delete init_list; |
494
|
107 } |
|
108 |
|
109 void |
578
|
110 tree_global_command::eval (void) |
494
|
111 { |
578
|
112 if (init_list) |
|
113 init_list->eval (); |
494
|
114 |
|
115 if (error_state > 0) |
|
116 ::error ("evaluating global command near line %d, column %d", |
|
117 line (), column ()); |
|
118 } |
|
119 |
581
|
120 void |
|
121 tree_global_command::print_code (ostream& os) |
|
122 { |
|
123 print_code_indent (os); |
|
124 |
|
125 os << "global "; |
|
126 |
|
127 if (init_list) |
|
128 init_list->print_code (os); |
|
129 } |
|
130 |
578
|
131 // While. |
494
|
132 |
|
133 tree_while_command::~tree_while_command (void) |
|
134 { |
|
135 delete expr; |
|
136 delete list; |
|
137 } |
|
138 |
578
|
139 void |
|
140 tree_while_command::eval (void) |
494
|
141 { |
|
142 if (error_state) |
578
|
143 return; |
494
|
144 |
|
145 for (;;) |
|
146 { |
|
147 int expr_value = 0; |
529
|
148 if (! expr) |
578
|
149 return; |
494
|
150 tree_constant t1 = expr->eval (0); |
|
151 |
|
152 if (error_state) |
|
153 { |
|
154 eval_error (); |
578
|
155 return; |
494
|
156 } |
|
157 |
|
158 if (t1.rows () == 0 || t1.columns () == 0) |
|
159 { |
|
160 int flag = user_pref.propagate_empty_matrices; |
|
161 if (flag < 0) |
|
162 warning ("while: empty matrix used in conditional"); |
|
163 else if (flag == 0) |
|
164 { |
620
|
165 ::error ("empty matrix used in while condition near line\ |
|
166 %d, column %d", line (), column ()); |
578
|
167 return; |
494
|
168 } |
|
169 t1 = tree_constant (0.0); |
|
170 } |
|
171 else if (! t1.is_scalar_type ()) |
|
172 { |
|
173 tree_constant t2 = t1.all (); |
|
174 t1 = t2.all (); |
|
175 } |
|
176 |
620
|
177 if (t1.is_real_scalar ()) |
494
|
178 expr_value = (int) t1.double_value (); |
620
|
179 else if (t1.is_complex_scalar ()) |
494
|
180 expr_value = t1.complex_value () != 0.0; |
|
181 else |
620
|
182 { |
|
183 ::error ("invalid type used in while condition near line %d,\ |
|
184 column %d", line (), column ()); |
|
185 return; |
|
186 } |
494
|
187 |
|
188 if (expr_value) |
|
189 { |
529
|
190 if (list) |
494
|
191 { |
578
|
192 list->eval (1); |
494
|
193 if (error_state) |
|
194 { |
|
195 eval_error (); |
578
|
196 return; |
494
|
197 } |
|
198 } |
|
199 |
|
200 if (quit_loop_now ()) |
|
201 break; |
|
202 } |
|
203 else |
|
204 break; |
|
205 } |
|
206 } |
|
207 |
|
208 void |
|
209 tree_while_command::eval_error (void) |
|
210 { |
|
211 if (error_state > 0) |
|
212 ::error ("evaluating while command near line %d, column %d", |
|
213 line (), column ()); |
|
214 } |
|
215 |
581
|
216 void |
|
217 tree_while_command::print_code (ostream& os) |
|
218 { |
|
219 print_code_indent (os); |
|
220 |
|
221 os << "while "; |
|
222 |
|
223 if (expr) |
|
224 expr->print_code (os); |
|
225 |
|
226 print_code_new_line (os); |
|
227 |
|
228 if (list) |
|
229 { |
|
230 increment_indent_level (); |
|
231 list->print_code (os); |
|
232 decrement_indent_level (); |
|
233 } |
|
234 |
|
235 print_code_indent (os); |
|
236 |
|
237 os << "endwhile"; |
|
238 } |
|
239 |
578
|
240 // For. |
494
|
241 |
|
242 tree_for_command::~tree_for_command (void) |
|
243 { |
|
244 delete id; |
1228
|
245 delete id_list; |
494
|
246 delete expr; |
|
247 delete list; |
|
248 } |
|
249 |
1168
|
250 inline void |
1228
|
251 tree_for_command::do_for_loop_once (tree_return_list *lst, |
|
252 const Octave_object& rhs, int& quit) |
|
253 { |
|
254 quit = 0; |
|
255 |
|
256 tree_oct_obj *tmp = new tree_oct_obj (rhs); |
|
257 tree_multi_assignment_expression tmp_ass (lst, tmp, 1); |
|
258 tmp_ass.eval (0); |
|
259 |
|
260 if (error_state) |
|
261 { |
|
262 eval_error (); |
|
263 return; |
|
264 } |
|
265 |
|
266 if (list) |
|
267 { |
|
268 list->eval (1); |
|
269 if (error_state) |
|
270 { |
|
271 eval_error (); |
|
272 quit = 1; |
|
273 return; |
|
274 } |
|
275 } |
|
276 |
|
277 quit = quit_loop_now (); |
|
278 } |
|
279 |
|
280 inline void |
|
281 tree_for_command::do_for_loop_once (tree_index_expression *idx_expr, |
|
282 const tree_constant& rhs, int& quit) |
1168
|
283 { |
|
284 quit = 0; |
|
285 |
|
286 tree_constant *tmp = new tree_constant (rhs); |
1228
|
287 tree_simple_assignment_expression tmp_ass (idx_expr, tmp, 1); |
1168
|
288 tmp_ass.eval (0); |
|
289 |
|
290 if (error_state) |
|
291 { |
|
292 eval_error (); |
|
293 return; |
|
294 } |
|
295 |
|
296 if (list) |
|
297 { |
|
298 list->eval (1); |
|
299 if (error_state) |
|
300 { |
|
301 eval_error (); |
|
302 quit = 1; |
|
303 return; |
|
304 } |
|
305 } |
|
306 |
|
307 quit = quit_loop_now (); |
|
308 } |
|
309 |
|
310 inline void |
|
311 tree_for_command::do_for_loop_once (tree_identifier *ident, |
|
312 tree_constant& rhs, int& quit) |
|
313 { |
|
314 quit = 0; |
|
315 |
|
316 ident->assign (rhs); |
|
317 |
|
318 if (error_state) |
|
319 { |
|
320 eval_error (); |
|
321 return; |
|
322 } |
|
323 |
|
324 if (list) |
|
325 { |
|
326 list->eval (1); |
|
327 if (error_state) |
|
328 { |
|
329 eval_error (); |
|
330 quit = 1; |
|
331 return; |
|
332 } |
|
333 } |
|
334 |
|
335 quit = quit_loop_now (); |
|
336 } |
|
337 |
|
338 #define DO_LOOP(val) \ |
|
339 do \ |
|
340 { \ |
|
341 if (ident) \ |
|
342 for (int i = 0; i < steps; i++) \ |
|
343 { \ |
|
344 tree_constant rhs (val); \ |
|
345 int quit = 0; \ |
|
346 do_for_loop_once (ident, rhs, quit); \ |
|
347 if (quit) \ |
|
348 break; \ |
|
349 } \ |
1228
|
350 else if (id_list) \ |
|
351 for (int i = 0; i < steps; i++) \ |
|
352 { \ |
|
353 Octave_object rhs (val); \ |
|
354 int quit = 0; \ |
|
355 do_for_loop_once (id_list, rhs, quit); \ |
|
356 if (quit) \ |
|
357 break; \ |
|
358 } \ |
1168
|
359 else \ |
|
360 for (int i = 0; i < steps; i++) \ |
|
361 { \ |
|
362 tree_constant rhs (val); \ |
|
363 int quit = 0; \ |
1228
|
364 do_for_loop_once (tmp_id, rhs, quit); \ |
1168
|
365 if (quit) \ |
|
366 break; \ |
|
367 } \ |
|
368 } \ |
|
369 while (0) |
|
370 |
578
|
371 void |
|
372 tree_for_command::eval (void) |
494
|
373 { |
529
|
374 if (error_state || ! expr) |
578
|
375 return; |
494
|
376 |
|
377 tree_constant tmp_expr = expr->eval (0); |
|
378 |
|
379 if (error_state || tmp_expr.is_undefined ()) |
|
380 { |
|
381 eval_error (); |
578
|
382 return; |
494
|
383 } |
|
384 |
1228
|
385 tree_index_expression *tmp_id = id; |
|
386 if (id_list && id_list->length () == 1) |
|
387 tmp_id = id_list->front (); |
|
388 |
1168
|
389 tree_identifier *ident = 0; |
1228
|
390 if (tmp_id && ! tmp_id->arg_list ()) |
1168
|
391 { |
1228
|
392 tree_indirect_ref *idr = tmp_id->ident (); |
1168
|
393 if (idr->is_identifier_only ()) |
|
394 ident = idr->ident (); |
|
395 } |
|
396 |
1234
|
397 if (id_list && ! ident && ! tmp_expr.is_map ()) |
1228
|
398 { |
|
399 error ("in statement `for [X, Y] = VAL', VAL must be a structure"); |
|
400 return; |
|
401 } |
|
402 |
620
|
403 if (tmp_expr.is_scalar_type ()) |
|
404 { |
|
405 int quit = 0; |
1168
|
406 if (ident) |
|
407 do_for_loop_once (ident, tmp_expr, quit); |
1228
|
408 else if (id_list) |
|
409 { |
|
410 Octave_object rhs (tmp_expr); |
|
411 do_for_loop_once (id_list, rhs, quit); |
|
412 } |
1168
|
413 else |
1228
|
414 do_for_loop_once (tmp_id, tmp_expr, quit); |
620
|
415 } |
|
416 else if (tmp_expr.is_matrix_type ()) |
494
|
417 { |
620
|
418 Matrix m_tmp; |
|
419 ComplexMatrix cm_tmp; |
|
420 int nr; |
|
421 int steps; |
|
422 if (tmp_expr.is_real_matrix ()) |
|
423 { |
|
424 m_tmp = tmp_expr.matrix_value (); |
|
425 nr = m_tmp.rows (); |
|
426 steps = m_tmp.columns (); |
|
427 } |
|
428 else |
|
429 { |
|
430 cm_tmp = tmp_expr.complex_matrix_value (); |
|
431 nr = cm_tmp.rows (); |
|
432 steps = cm_tmp.columns (); |
|
433 } |
494
|
434 |
1168
|
435 if (tmp_expr.is_real_matrix ()) |
620
|
436 { |
|
437 if (nr == 1) |
1168
|
438 DO_LOOP(m_tmp (0, i)); |
620
|
439 else |
1168
|
440 DO_LOOP(m_tmp.extract (0, i, nr-1, i)); |
|
441 } |
|
442 else |
|
443 { |
|
444 if (nr == 1) |
|
445 DO_LOOP(cm_tmp (0, i)); |
|
446 else |
|
447 DO_LOOP(cm_tmp.extract (0, i, nr-1, i)); |
620
|
448 } |
|
449 } |
|
450 else if (tmp_expr.is_string ()) |
|
451 { |
494
|
452 gripe_string_invalid (); |
620
|
453 } |
|
454 else if (tmp_expr.is_range ()) |
|
455 { |
|
456 Range rng = tmp_expr.range_value (); |
494
|
457 |
620
|
458 int steps = rng.nelem (); |
|
459 double b = rng.base (); |
|
460 double increment = rng.inc (); |
494
|
461 |
1168
|
462 if (ident) |
620
|
463 { |
1168
|
464 for (int i = 0; i < steps; i++) |
|
465 { |
|
466 double tmp_val = b + i * increment; |
|
467 |
|
468 tree_constant rhs (tmp_val); |
|
469 |
|
470 int quit = 0; |
|
471 do_for_loop_once (ident, rhs, quit); |
494
|
472 |
1168
|
473 if (quit) |
|
474 break; |
|
475 } |
|
476 } |
1228
|
477 else if (id_list) |
|
478 { |
|
479 for (int i = 0; i < steps; i++) |
|
480 { |
|
481 double tmp_val = b + i * increment; |
|
482 |
|
483 Octave_object rhs (tmp_val); |
|
484 |
|
485 int quit = 0; |
|
486 do_for_loop_once (id_list, rhs, quit); |
|
487 |
|
488 if (quit) |
|
489 break; |
|
490 } |
|
491 } |
1168
|
492 else |
|
493 { |
|
494 for (int i = 0; i < steps; i++) |
|
495 { |
|
496 double tmp_val = b + i * increment; |
494
|
497 |
1168
|
498 tree_constant rhs (tmp_val); |
|
499 |
|
500 int quit = 0; |
1228
|
501 do_for_loop_once (tmp_id, rhs, quit); |
|
502 |
|
503 if (quit) |
|
504 break; |
|
505 } |
|
506 } |
|
507 } |
|
508 else if (tmp_expr.is_map ()) |
|
509 { |
|
510 if (ident) |
|
511 { |
|
512 Octave_map tmp_val (tmp_expr.map_value ()); |
|
513 |
|
514 for (Pix p = tmp_val.first (); p != 0; tmp_val.next (p)) |
|
515 { |
|
516 tree_constant rhs (tmp_val.contents (p)); |
|
517 |
|
518 int quit; |
|
519 do_for_loop_once (ident, rhs, quit); |
|
520 |
|
521 if (quit) |
|
522 break; |
|
523 } |
|
524 } |
|
525 else if (id_list) |
|
526 { |
|
527 // Cycle through structure elements. First element of |
|
528 // id_list is set to value and the second is set to the name |
|
529 // of the structure element. |
|
530 |
|
531 Octave_map tmp_val (tmp_expr.map_value ()); |
|
532 |
|
533 for (Pix p = tmp_val.first (); p != 0; tmp_val.next (p)) |
|
534 { |
|
535 Octave_object tmp; |
|
536 tmp (1) = tmp_val.key (p); |
|
537 tmp (0) = tmp_val.contents (p); |
|
538 |
|
539 int quit; |
|
540 do_for_loop_once (id_list, tmp, quit); |
|
541 |
|
542 if (quit) |
|
543 break; |
|
544 } |
|
545 } |
|
546 else |
|
547 { |
|
548 Octave_map tmp_val (tmp_expr.map_value ()); |
|
549 |
|
550 for (Pix p = tmp_val.first (); p != 0; tmp_val.next (p)) |
|
551 { |
|
552 tree_constant rhs = tmp_val.contents (p); |
|
553 |
|
554 int quit; |
|
555 do_for_loop_once (tmp_id, rhs, quit); |
1168
|
556 |
|
557 if (quit) |
|
558 break; |
|
559 } |
620
|
560 } |
|
561 } |
|
562 else |
|
563 { |
|
564 ::error ("invalid type in for loop expression near line %d, column %d", |
|
565 line (), column ()); |
494
|
566 } |
|
567 } |
|
568 |
|
569 void |
|
570 tree_for_command::eval_error (void) |
|
571 { |
|
572 if (error_state > 0) |
|
573 ::error ("evaluating for command near line %d, column %d", |
|
574 line (), column ()); |
|
575 } |
|
576 |
578
|
577 void |
581
|
578 tree_for_command::print_code (ostream& os) |
|
579 { |
|
580 print_code_indent (os); |
|
581 |
|
582 os << "for "; |
|
583 |
|
584 if (id) |
|
585 id->print_code (os); |
|
586 |
|
587 os << " = "; |
|
588 |
|
589 if (expr) |
|
590 expr->print_code (os); |
|
591 |
|
592 print_code_new_line (os); |
|
593 |
|
594 if (list) |
|
595 { |
|
596 increment_indent_level (); |
|
597 list->print_code (os); |
|
598 decrement_indent_level (); |
|
599 } |
|
600 |
|
601 print_code_indent (os); |
|
602 |
|
603 os << "endfor"; |
|
604 } |
|
605 |
578
|
606 // If. |
494
|
607 |
|
608 tree_if_command::~tree_if_command (void) |
|
609 { |
|
610 delete list; |
|
611 } |
|
612 |
|
613 void |
578
|
614 tree_if_command::eval (void) |
494
|
615 { |
578
|
616 if (list) |
|
617 list->eval (); |
|
618 |
494
|
619 if (error_state > 0) |
|
620 ::error ("evaluating if command near line %d, column %d", |
|
621 line (), column ()); |
|
622 } |
|
623 |
581
|
624 void |
|
625 tree_if_command::print_code (ostream& os) |
|
626 { |
|
627 print_code_indent (os); |
|
628 |
|
629 os << "if "; |
|
630 |
|
631 if (list) |
|
632 list->print_code (os); |
|
633 |
|
634 print_code_indent (os); |
|
635 |
|
636 os << "endif"; |
|
637 } |
|
638 |
916
|
639 // Simple exception handling. |
|
640 |
|
641 tree_unwind_protect_command::~tree_unwind_protect_command (void) |
|
642 { |
|
643 delete unwind_protect_code; |
|
644 delete cleanup_code; |
|
645 } |
|
646 |
|
647 static void |
|
648 do_unwind_protect_cleanup_code (void *ptr) |
|
649 { |
|
650 tree_statement_list *list = (tree_statement_list *) ptr; |
|
651 |
1228
|
652 // We want to run the cleanup code without error_state being set, |
|
653 // but we need to restore its value, so that any errors encountered |
|
654 // in the first part of the unwind_protect are not completely |
|
655 // ignored. |
916
|
656 |
|
657 unwind_protect_int (error_state); |
1266
|
658 error_state = 0; |
916
|
659 |
1266
|
660 // Similarly, if we have seen a return or break statement, allow all |
|
661 // the cleanup code to run before returning or handling the break. |
|
662 // We don't have to worry about continue statements because they can |
|
663 // only occur in loops. |
|
664 |
|
665 unwind_protect_int (returning); |
|
666 returning = 0; |
|
667 |
|
668 unwind_protect_int (breaking); |
|
669 breaking = 0; |
916
|
670 |
|
671 if (list) |
|
672 list->eval (1); |
|
673 |
1266
|
674 // This is the one for breaking. (The unwind_protects are popped |
|
675 // off the stack in the reverse of the order they are pushed on). |
|
676 |
|
677 // XXX FIXME XXX -- inside an unwind_protect, should break work like |
|
678 // a return, or just jump to the end of the unwind_protect block? |
|
679 // The following code makes it just jump to the end of the block. |
|
680 |
|
681 run_unwind_protect (); |
|
682 if (breaking) |
|
683 breaking--; |
|
684 |
|
685 // This is the one for returning. |
|
686 |
|
687 if (returning) |
|
688 discard_unwind_protect (); |
|
689 else |
|
690 run_unwind_protect (); |
|
691 |
1228
|
692 // We don't want to ignore errors that occur in the cleanup code, so |
|
693 // if an error is encountered there, leave error_state alone. |
|
694 // Otherwise, set it back to what it was before. |
916
|
695 |
|
696 if (error_state) |
|
697 discard_unwind_protect (); |
|
698 else |
|
699 run_unwind_protect (); |
|
700 } |
|
701 |
|
702 void |
|
703 tree_unwind_protect_command::eval (void) |
|
704 { |
|
705 add_unwind_protect (do_unwind_protect_cleanup_code, cleanup_code); |
|
706 |
|
707 if (unwind_protect_code) |
|
708 unwind_protect_code->eval (1); |
|
709 |
|
710 run_unwind_protect (); |
|
711 } |
|
712 |
|
713 void |
|
714 tree_unwind_protect_command::print_code (ostream& os) |
|
715 { |
|
716 print_code_indent (os); |
|
717 |
|
718 os << "unwind_protect"; |
|
719 |
|
720 print_code_new_line (os); |
|
721 |
|
722 if (unwind_protect_code) |
|
723 { |
|
724 increment_indent_level (); |
|
725 unwind_protect_code->print_code (os); |
|
726 decrement_indent_level (); |
|
727 } |
|
728 |
|
729 print_code_indent (os); |
|
730 |
|
731 os << "cleanup_code"; |
|
732 |
|
733 print_code_new_line (os); |
|
734 |
|
735 if (cleanup_code) |
|
736 { |
|
737 increment_indent_level (); |
|
738 cleanup_code->print_code (os); |
|
739 decrement_indent_level (); |
|
740 } |
|
741 |
|
742 print_code_indent (os); |
|
743 |
|
744 os << "end_unwind_protect"; |
|
745 } |
|
746 |
578
|
747 // Break. |
494
|
748 |
578
|
749 void |
|
750 tree_break_command::eval (void) |
494
|
751 { |
|
752 if (! error_state) |
|
753 breaking = 1; |
|
754 } |
|
755 |
581
|
756 void |
|
757 tree_break_command::print_code (ostream& os) |
|
758 { |
|
759 print_code_indent (os); |
|
760 |
|
761 os << "break"; |
|
762 } |
|
763 |
578
|
764 // Continue. |
494
|
765 |
578
|
766 void |
|
767 tree_continue_command::eval (void) |
494
|
768 { |
|
769 if (! error_state) |
|
770 continuing = 1; |
|
771 } |
|
772 |
581
|
773 void |
|
774 tree_continue_command::print_code (ostream& os) |
|
775 { |
|
776 print_code_indent (os); |
|
777 |
|
778 os << "continue"; |
|
779 } |
|
780 |
578
|
781 // Return. |
494
|
782 |
578
|
783 void |
|
784 tree_return_command::eval (void) |
494
|
785 { |
|
786 if (! error_state) |
|
787 returning = 1; |
|
788 } |
|
789 |
581
|
790 void |
|
791 tree_return_command::print_code (ostream& os) |
|
792 { |
|
793 print_code_indent (os); |
|
794 |
|
795 os << "return"; |
|
796 } |
|
797 |
494
|
798 /* |
|
799 ;;; Local Variables: *** |
|
800 ;;; mode: C++ *** |
|
801 ;;; page-delimiter: "^/\\*" *** |
|
802 ;;; End: *** |
|
803 */ |