Mercurial > hg > octave-lyh
annotate libinterp/parse-tree/pt-assign.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-assign.h@46b19589b593 |
children | 8fbc09eded8c |
rev | line source |
---|---|
2980 | 1 /* |
2 | |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
3 Copyright (C) 1996-2012 John W. Eaton |
2980 | 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. | |
2980 | 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/>. | |
2980 | 20 |
21 */ | |
22 | |
23 #if !defined (octave_tree_assign_h) | |
24 #define octave_tree_assign_h 1 | |
25 | |
8950
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
26 #include <iosfwd> |
2980 | 27 #include <string> |
28 | |
29 class tree_argument_list; | |
30 class tree_walker; | |
31 | |
32 class octave_value; | |
33 class octave_value_list; | |
34 class octave_lvalue; | |
35 | |
36 #include "ov.h" | |
37 #include "pt-exp.h" | |
7336 | 38 #include "symtab.h" |
2980 | 39 |
40 // Simple assignment expressions. | |
41 | |
42 class | |
43 tree_simple_assignment : public tree_expression | |
44 { | |
45 public: | |
46 | |
47 tree_simple_assignment (bool plhs = false, int l = -1, int c = -1, | |
10313 | 48 octave_value::assign_op t = octave_value::op_asn_eq) |
11584
cda4aa780d58
Another round of initialising members in the constructor initialisation list
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
11523
diff
changeset
|
49 : tree_expression (l, c), lhs (0), rhs (0), preserve (plhs), ans_ass (), |
cda4aa780d58
Another round of initialising members in the constructor initialisation list
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
11523
diff
changeset
|
50 etype (t), first_execution (true) { } |
2980 | 51 |
52 tree_simple_assignment (tree_expression *le, tree_expression *re, | |
10313 | 53 bool plhs = false, int l = -1, int c = -1, |
54 octave_value::assign_op t = octave_value::op_asn_eq); | |
2980 | 55 |
56 ~tree_simple_assignment (void); | |
57 | |
4267 | 58 bool has_magic_end (void) const { return (rhs && rhs->has_magic_end ()); } |
59 | |
3933 | 60 bool rvalue_ok (void) const { return true; } |
2980 | 61 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8037
diff
changeset
|
62 octave_value rvalue1 (int nargout = 1); |
2980 | 63 |
64 octave_value_list rvalue (int nargout); | |
65 | |
3933 | 66 bool is_assignment_expression (void) const { return true; } |
2980 | 67 |
3523 | 68 std::string oper (void) const; |
2980 | 69 |
70 tree_expression *left_hand_side (void) { return lhs; } | |
71 | |
72 tree_expression *right_hand_side (void) { return rhs; } | |
73 | |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
74 tree_expression *dup (symbol_table::scope_id scope, |
10313 | 75 symbol_table::context_id context) const; |
5861 | 76 |
2980 | 77 void accept (tree_walker& tw); |
78 | |
7087 | 79 octave_value::assign_op op_type (void) const { return etype; } |
80 | |
2980 | 81 private: |
82 | |
83 void do_assign (octave_lvalue& ult, const octave_value_list& args, | |
10313 | 84 const octave_value& rhs_val); |
2980 | 85 |
86 void do_assign (octave_lvalue& ult, const octave_value& rhs_val); | |
87 | |
88 // The left hand side of the assignment. | |
89 tree_expression *lhs; | |
90 | |
91 // The right hand side of the assignment. | |
92 tree_expression *rhs; | |
93 | |
94 // True if we should not delete the lhs. | |
95 bool preserve; | |
96 | |
5794 | 97 // True if this is an assignment to the automatic variable ans. |
2980 | 98 bool ans_ass; |
99 | |
100 // The type of the expression. | |
101 octave_value::assign_op etype; | |
2988 | 102 |
8037
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
103 // true only on first rvalue() call. |
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
104 bool first_execution; |
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
105 |
2988 | 106 // No copying! |
107 | |
2989 | 108 tree_simple_assignment (const tree_simple_assignment&); |
2988 | 109 |
2989 | 110 tree_simple_assignment& operator = (const tree_simple_assignment&); |
2980 | 111 }; |
112 | |
113 // Multi-valued assignment expressions. | |
114 | |
115 class | |
116 tree_multi_assignment : public tree_expression | |
117 { | |
118 public: | |
119 | |
10230
0a5a769b8fc0
disallow computed multiple assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10160
diff
changeset
|
120 tree_multi_assignment (bool plhs = false, int l = -1, int c = -1) |
0a5a769b8fc0
disallow computed multiple assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10160
diff
changeset
|
121 : tree_expression (l, c), lhs (0), rhs (0), preserve (plhs), |
8037
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
122 first_execution (true) { } |
2980 | 123 |
124 tree_multi_assignment (tree_argument_list *lst, tree_expression *r, | |
10313 | 125 bool plhs = false, int l = -1, int c = -1); |
2980 | 126 |
127 ~tree_multi_assignment (void); | |
128 | |
4267 | 129 bool has_magic_end (void) const { return (rhs && rhs->has_magic_end ()); } |
130 | |
3933 | 131 bool is_assignment_expression (void) const { return true; } |
2980 | 132 |
3933 | 133 bool rvalue_ok (void) const { return true; } |
2980 | 134 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8037
diff
changeset
|
135 octave_value rvalue1 (int nargout = 1); |
2980 | 136 |
137 octave_value_list rvalue (int nargout); | |
138 | |
3523 | 139 std::string oper (void) const; |
3208 | 140 |
2980 | 141 tree_argument_list *left_hand_side (void) { return lhs; } |
142 | |
143 tree_expression *right_hand_side (void) { return rhs; } | |
144 | |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
145 tree_expression *dup (symbol_table::scope_id scope, |
10313 | 146 symbol_table::context_id context) const; |
5861 | 147 |
2980 | 148 void accept (tree_walker& tw); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11584
diff
changeset
|
149 |
10230
0a5a769b8fc0
disallow computed multiple assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10160
diff
changeset
|
150 octave_value::assign_op op_type (void) const { return octave_value::op_asn_eq; } |
2980 | 151 |
152 private: | |
153 | |
3208 | 154 // The left hand side of the assignment. |
2980 | 155 tree_argument_list *lhs; |
3208 | 156 |
157 // The right hand side of the assignment. | |
2980 | 158 tree_expression *rhs; |
2988 | 159 |
3208 | 160 // True if we should not delete the lhs. |
161 bool preserve; | |
162 | |
8037
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
163 // true only on first rvalue() call. |
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
164 bool first_execution; |
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
165 |
2988 | 166 // No copying! |
167 | |
2989 | 168 tree_multi_assignment (const tree_multi_assignment&); |
2988 | 169 |
2989 | 170 tree_multi_assignment& operator = (const tree_multi_assignment&); |
2980 | 171 }; |
172 | |
173 #endif |