annotate src/pt-loop.h @ 13245:027a2186cd90

parfor keyword and infrastructure, but handle parfor as normal for loop for now * octave.gperf (octave_kw_id): New keyword ids, parfor_kw and end_parfor_kw. (octave_kw): Add parfor and end_parfor to the struct. * lex.ll (is_keyword_token): Handle parfor and end_parfor. * token.h (token::parfor_end): New end_tok_type enum value. * oct-parse.yy (PARFOR): New token. (loop_command): Handle PARFOR statements. (make_for_command): New args tok_id and maxproc. Handle PARFOR loops. * pt-loop.h (tree_simple_for_command::parallel, tree_simple_for_command:maxproc): New data members. (tree_simple_for_command::tree_simple_for_command): New args parallel_arg and maxproc_arg. Initialize new data members. (tree_simple_for_command::parallel): New function. (tree_simple_for_command::maxproc_expr): New function. * pt-loop.cc (tree_simple_for_command::~tree_simple_for_command): Delete maxproc. (tree_simple_for_command::dup): Pass parallel and maxproc to constructor for duplicate object. * pt-pr-code.cc (tree_print_code::visit_simple_for_command): Handle parallel form. * pt-check.cc (tree_checker::visit_simple_for_command): Likewise. * pt-eval.cc (tree_evaluator::visit_simple_for_command): Note that this is where parallel loops need to be handled.
author John W. Eaton <jwe@octave.org>
date Thu, 29 Sep 2011 02:50:53 -0400
parents fd0a3ac60b0e
children 72c96de7a403
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
1 /*
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
2
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 10313
diff changeset
3 Copyright (C) 1996-2011 John W. Eaton
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
4
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
6
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5861
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5861
diff changeset
10 option) any later version.
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
11
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
15 for more details.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
16
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5861
diff changeset
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5861
diff changeset
19 <http://www.gnu.org/licenses/>.
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
20
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
21 */
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
22
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
23 #if !defined (octave_tree_loop_h)
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
24 #define octave_tree_loop_h 1
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
25
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
26 class octave_value;
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
27 class octave_lvalue;
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
28
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
29 class tree_argument_list;
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
30 class tree_expression;
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
31 class tree_statement_list;
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
32
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
33 class tree_walker;
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
34
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
35 #include "comment-list.h"
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
36 #include "pt-cmd.h"
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
37 #include "symtab.h"
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
38
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
39 // While.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
40
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
41 class
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
42 tree_while_command : public tree_command
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
43 {
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
44 public:
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
45
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
46 tree_while_command (int l = -1, int c = -1)
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
47 : tree_command (l, c), expr (0), list (0), lead_comm (0),
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
48 trail_comm (0) { }
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
49
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
50 tree_while_command (tree_expression *e,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
51 octave_comment_list *lc = 0,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
52 octave_comment_list *tc = 0,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
53 int l = -1, int c = -1)
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
54 : tree_command (l, c), expr (e), list (0), lead_comm (lc),
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
55 trail_comm (tc) { }
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
56
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
57 tree_while_command (tree_expression *e, tree_statement_list *lst,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
58 octave_comment_list *lc = 0,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
59 octave_comment_list *tc = 0,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
60 int l = -1, int c = -1)
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
61 : tree_command (l, c), expr (e), list (lst), lead_comm (lc),
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
62 trail_comm (tc) { }
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
63
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
64 ~tree_while_command (void);
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
65
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
66 tree_expression *condition (void) { return expr; }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
67
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
68 tree_statement_list *body (void) { return list; }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
69
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
70 octave_comment_list *leading_comment (void) { return lead_comm; }
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
71
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
72 octave_comment_list *trailing_comment (void) { return trail_comm; }
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
73
7767
71f068b22fcc scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents: 7336
diff changeset
74 tree_command *dup (symbol_table::scope_id scope,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
75 symbol_table::context_id context) const;
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5307
diff changeset
76
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
77 void accept (tree_walker& tw);
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
78
3484
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
79 protected:
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
80
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
81 // Expression to test.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
82 tree_expression *expr;
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
83
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
84 // List of commands to execute.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
85 tree_statement_list *list;
2988
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
86
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
87 // Comment preceding WHILE token.
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
88 octave_comment_list *lead_comm;
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
89
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
90 // Comment preceding ENDWHILE token.
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
91 octave_comment_list *trail_comm;
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
92
3484
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
93 private:
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
94
2988
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
95 // No copying!
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
96
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
97 tree_while_command (const tree_while_command&);
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
98
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
99 tree_while_command& operator = (const tree_while_command&);
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
100 };
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
101
3484
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
102 // Do-Until.
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
103
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
104 class
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
105 tree_do_until_command : public tree_while_command
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
106 {
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
107 public:
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
108
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
109 tree_do_until_command (int l = -1, int c = -1)
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
110 : tree_while_command (l, c) { }
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
111
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
112 tree_do_until_command (tree_expression *e,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
113 octave_comment_list *lc = 0,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
114 octave_comment_list *tc = 0,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
115 int l = -1, int c = -1)
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
116 : tree_while_command (e, lc, tc, l, c) { }
3484
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
117
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
118 tree_do_until_command (tree_expression *e, tree_statement_list *lst,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
119 octave_comment_list *lc = 0,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
120 octave_comment_list *tc = 0,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
121 int l = -1, int c = -1)
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
122 : tree_while_command (e, lst, lc, tc, l, c) { }
3484
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
123
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
124 ~tree_do_until_command (void) { }
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
125
7767
71f068b22fcc scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents: 7336
diff changeset
126 tree_command *dup (symbol_table::scope_id scope,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
127 symbol_table::context_id context) const;
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5307
diff changeset
128
3484
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
129 void accept (tree_walker& tw);
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
130
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
131 private:
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
132
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
133 // No copying!
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
134
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
135 tree_do_until_command (const tree_do_until_command&);
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
136
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
137 tree_do_until_command& operator = (const tree_do_until_command&);
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
138 };
8b1f46ac2b64 [project @ 2000-01-27 23:30:45 by jwe]
jwe
parents: 2988
diff changeset
139
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
140 // For.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
141
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
142 class
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
143 tree_simple_for_command : public tree_command
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
144 {
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
145 public:
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
146
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
147 tree_simple_for_command (int l = -1, int c = -1)
13245
027a2186cd90 parfor keyword and infrastructure, but handle parfor as normal for loop for now
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
148 : tree_command (l, c), parallel (false), lhs (0), expr (0),
027a2186cd90 parfor keyword and infrastructure, but handle parfor as normal for loop for now
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
149 maxproc (0), list (0), lead_comm (0), trail_comm (0) { }
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
150
13245
027a2186cd90 parfor keyword and infrastructure, but handle parfor as normal for loop for now
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
151 tree_simple_for_command (bool parallel_arg, tree_expression *le,
027a2186cd90 parfor keyword and infrastructure, but handle parfor as normal for loop for now
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
152 tree_expression *re,
027a2186cd90 parfor keyword and infrastructure, but handle parfor as normal for loop for now
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
153 tree_expression *maxproc_arg,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
154 tree_statement_list *lst,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
155 octave_comment_list *lc = 0,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
156 octave_comment_list *tc = 0,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
157 int l = -1, int c = -1)
13245
027a2186cd90 parfor keyword and infrastructure, but handle parfor as normal for loop for now
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
158 : tree_command (l, c), parallel (parallel_arg), lhs (le),
027a2186cd90 parfor keyword and infrastructure, but handle parfor as normal for loop for now
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
159 expr (re), maxproc (maxproc_arg), list (lst),
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
160 lead_comm (lc), trail_comm (tc) { }
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
161
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
162 ~tree_simple_for_command (void);
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
163
13245
027a2186cd90 parfor keyword and infrastructure, but handle parfor as normal for loop for now
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
164 bool in_parallel (void) { return parallel; }
027a2186cd90 parfor keyword and infrastructure, but handle parfor as normal for loop for now
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
165
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
166 tree_expression *left_hand_side (void) { return lhs; }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
167
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
168 tree_expression *control_expr (void) { return expr; }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
169
13245
027a2186cd90 parfor keyword and infrastructure, but handle parfor as normal for loop for now
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
170 tree_expression *maxproc_expr (void) { return maxproc; }
027a2186cd90 parfor keyword and infrastructure, but handle parfor as normal for loop for now
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
171
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
172 tree_statement_list *body (void) { return list; }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
173
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
174 octave_comment_list *leading_comment (void) { return lead_comm; }
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
175
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
176 octave_comment_list *trailing_comment (void) { return trail_comm; }
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
177
7767
71f068b22fcc scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents: 7336
diff changeset
178 tree_command *dup (symbol_table::scope_id scope,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
179 symbol_table::context_id context) const;
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5307
diff changeset
180
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
181 void accept (tree_walker& tw);
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
182
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
183 private:
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
184
13245
027a2186cd90 parfor keyword and infrastructure, but handle parfor as normal for loop for now
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
185 // TRUE means operate in parallel (subject to the value of the
027a2186cd90 parfor keyword and infrastructure, but handle parfor as normal for loop for now
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
186 // maxproc expression).
027a2186cd90 parfor keyword and infrastructure, but handle parfor as normal for loop for now
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
187 bool parallel;
027a2186cd90 parfor keyword and infrastructure, but handle parfor as normal for loop for now
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
188
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
189 // Expression to modify.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
190 tree_expression *lhs;
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
191
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
192 // Expression to evaluate.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
193 tree_expression *expr;
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
194
13245
027a2186cd90 parfor keyword and infrastructure, but handle parfor as normal for loop for now
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
195 // Expression to tell how many processors should be used (only valid
027a2186cd90 parfor keyword and infrastructure, but handle parfor as normal for loop for now
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
196 // if parallel is TRUE).
027a2186cd90 parfor keyword and infrastructure, but handle parfor as normal for loop for now
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
197 tree_expression *maxproc;
027a2186cd90 parfor keyword and infrastructure, but handle parfor as normal for loop for now
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
198
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
199 // List of commands to execute.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
200 tree_statement_list *list;
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
201
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
202 // Comment preceding FOR token.
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
203 octave_comment_list *lead_comm;
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
204
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
205 // Comment preceding ENDFOR token.
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
206 octave_comment_list *trail_comm;
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
207
2988
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
208 // No copying!
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
209
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
210 tree_simple_for_command (const tree_simple_for_command&);
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
211
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
212 tree_simple_for_command& operator = (const tree_simple_for_command&);
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
213 };
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
214
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
215 class
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
216 tree_complex_for_command : public tree_command
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
217 {
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
218 public:
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
219
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
220 tree_complex_for_command (int l = -1, int c = -1)
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
221 : tree_command (l, c), lhs (0), expr (0), list (0), lead_comm (0),
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
222 trail_comm (0) { }
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
223
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
224 tree_complex_for_command (tree_argument_list *le, tree_expression *re,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
225 tree_statement_list *lst,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
226 octave_comment_list *lc = 0,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
227 octave_comment_list *tc = 0,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
228 int l = -1, int c = -1)
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
229 : tree_command (l, c), lhs (le), expr (re), list (lst),
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
230 lead_comm (lc), trail_comm (tc) { }
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
231
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
232 ~tree_complex_for_command (void);
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
233
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
234 tree_argument_list *left_hand_side (void) { return lhs; }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
235
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
236 tree_expression *control_expr (void) { return expr; }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
237
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
238 tree_statement_list *body (void) { return list; }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
239
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
240 octave_comment_list *leading_comment (void) { return lead_comm; }
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
241
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
242 octave_comment_list *trailing_comment (void) { return trail_comm; }
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
243
7767
71f068b22fcc scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents: 7336
diff changeset
244 tree_command *dup (symbol_table::scope_id scope,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
245 symbol_table::context_id context) const;
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5307
diff changeset
246
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
247 void accept (tree_walker& tw);
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
248
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
249 private:
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
250
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
251 // Expression to modify.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
252 tree_argument_list *lhs;
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
253
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
254 // Expression to evaluate.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
255 tree_expression *expr;
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
256
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
257 // List of commands to execute.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
258 tree_statement_list *list;
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
259
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
260 // Comment preceding FOR token.
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
261 octave_comment_list *lead_comm;
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
262
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
263 // Comment preceding ENDFOR token.
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
264 octave_comment_list *trail_comm;
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3485
diff changeset
265
2988
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
266 // No copying!
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
267
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
268 tree_complex_for_command (const tree_complex_for_command&);
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
269
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
270 tree_complex_for_command& operator = (const tree_complex_for_command&);
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
271 };
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
272
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
273 #endif