Mercurial > octave-nkf
annotate src/pt-loop.cc @ 11542:695141f1c05c ss-3-3-55
snapshot 3.3.55
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 15 Jan 2011 04:53:04 -0500 |
parents | fd0a3ac60b0e |
children | 027a2186cd90 |
rev | line source |
---|---|
2982 | 1 /* |
2 | |
11523 | 3 Copyright (C) 1996-2011 John W. Eaton |
2982 | 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 | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
2982 | 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 | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
2982 | 20 |
21 */ | |
22 | |
23 #ifdef HAVE_CONFIG_H | |
24 #include <config.h> | |
25 #endif | |
26 | |
4153 | 27 #include "quit.h" |
28 | |
2982 | 29 #include "error.h" |
30 #include "gripes.h" | |
31 #include "oct-map.h" | |
32 #include "oct-lvalue.h" | |
33 #include "ov.h" | |
34 #include "pt-arg-list.h" | |
3770 | 35 #include "pt-bp.h" |
2982 | 36 #include "pt-cmd.h" |
37 #include "pt-exp.h" | |
2985 | 38 #include "pt-jump.h" |
2982 | 39 #include "pt-loop.h" |
40 #include "pt-stmt.h" | |
41 #include "pt-walk.h" | |
3877 | 42 #include "unwind-prot.h" |
43 | |
2982 | 44 // While. |
45 | |
46 tree_while_command::~tree_while_command (void) | |
47 { | |
48 delete expr; | |
49 delete list; | |
3665 | 50 delete lead_comm; |
51 delete trail_comm; | |
2982 | 52 } |
53 | |
5861 | 54 tree_command * |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
55 tree_while_command::dup (symbol_table::scope_id scope, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
56 symbol_table::context_id context) const |
5861 | 57 { |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
58 return new tree_while_command (expr ? expr->dup (scope, context) : 0, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
59 list ? list->dup (scope, context) : 0, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
60 lead_comm ? lead_comm->dup () : 0, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
61 trail_comm ? trail_comm->dup (): 0, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
62 line (), column ()); |
5861 | 63 } |
64 | |
2982 | 65 void |
66 tree_while_command::accept (tree_walker& tw) | |
67 { | |
68 tw.visit_while_command (*this); | |
69 } | |
70 | |
3484 | 71 // Do-Until |
72 | |
5861 | 73 tree_command * |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
74 tree_do_until_command::dup (symbol_table::scope_id scope, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
75 symbol_table::context_id context) const |
5861 | 76 { |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
77 return new tree_do_until_command (expr ? expr->dup (scope, context) : 0, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
78 list ? list->dup (scope, context) : 0, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
79 lead_comm ? lead_comm->dup () : 0, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
80 trail_comm ? trail_comm->dup (): 0, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
81 line (), column ()); |
5861 | 82 } |
83 | |
3484 | 84 void |
85 tree_do_until_command::accept (tree_walker& tw) | |
86 { | |
87 tw.visit_do_until_command (*this); | |
88 } | |
89 | |
2982 | 90 // For. |
91 | |
92 tree_simple_for_command::~tree_simple_for_command (void) | |
93 { | |
94 delete expr; | |
95 delete list; | |
3665 | 96 delete lead_comm; |
97 delete trail_comm; | |
2982 | 98 } |
99 | |
5861 | 100 tree_command * |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
101 tree_simple_for_command::dup (symbol_table::scope_id scope, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
102 symbol_table::context_id context) const |
5861 | 103 { |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
104 return new tree_simple_for_command (lhs ? lhs->dup (scope, context) : 0, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
105 expr ? expr->dup (scope, context) : 0, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
106 list ? list->dup (scope, context) : 0, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
107 lead_comm ? lead_comm->dup () : 0, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
108 trail_comm ? trail_comm->dup () : 0, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
109 line (), column ()); |
5861 | 110 } |
111 | |
2982 | 112 void |
113 tree_simple_for_command::accept (tree_walker& tw) | |
114 { | |
115 tw.visit_simple_for_command (*this); | |
116 } | |
117 | |
118 tree_complex_for_command::~tree_complex_for_command (void) | |
119 { | |
120 delete expr; | |
121 delete list; | |
3665 | 122 delete lead_comm; |
123 delete trail_comm; | |
2982 | 124 } |
125 | |
5861 | 126 tree_command * |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
127 tree_complex_for_command::dup (symbol_table::scope_id scope, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
128 symbol_table::context_id context) const |
5861 | 129 { |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
130 return new tree_complex_for_command (lhs ? lhs->dup (scope, context) : 0, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
131 expr ? expr->dup (scope, context) : 0, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
132 list ? list->dup (scope, context) : 0, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
133 lead_comm ? lead_comm->dup () : 0, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
134 trail_comm ? trail_comm->dup () : 0, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
135 line (), column ()); |
5861 | 136 } |
137 | |
2982 | 138 void |
139 tree_complex_for_command::accept (tree_walker& tw) | |
140 { | |
141 tw.visit_complex_for_command (*this); | |
142 } |