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