comparison 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
comparison
equal deleted inserted replaced
15194:0f0b795044c3 15195:2fc554ffbc28
1 /*
2
3 Copyright (C) 1996-2012 John W. Eaton
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
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
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
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20
21 */
22
23 #if !defined (octave_tree_assign_h)
24 #define octave_tree_assign_h 1
25
26 #include <iosfwd>
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"
38 #include "symtab.h"
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,
48 octave_value::assign_op t = octave_value::op_asn_eq)
49 : tree_expression (l, c), lhs (0), rhs (0), preserve (plhs), ans_ass (),
50 etype (t), first_execution (true) { }
51
52 tree_simple_assignment (tree_expression *le, tree_expression *re,
53 bool plhs = false, int l = -1, int c = -1,
54 octave_value::assign_op t = octave_value::op_asn_eq);
55
56 ~tree_simple_assignment (void);
57
58 bool has_magic_end (void) const { return (rhs && rhs->has_magic_end ()); }
59
60 bool rvalue_ok (void) const { return true; }
61
62 octave_value rvalue1 (int nargout = 1);
63
64 octave_value_list rvalue (int nargout);
65
66 bool is_assignment_expression (void) const { return true; }
67
68 std::string oper (void) const;
69
70 tree_expression *left_hand_side (void) { return lhs; }
71
72 tree_expression *right_hand_side (void) { return rhs; }
73
74 tree_expression *dup (symbol_table::scope_id scope,
75 symbol_table::context_id context) const;
76
77 void accept (tree_walker& tw);
78
79 octave_value::assign_op op_type (void) const { return etype; }
80
81 private:
82
83 void do_assign (octave_lvalue& ult, const octave_value_list& args,
84 const octave_value& rhs_val);
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
97 // True if this is an assignment to the automatic variable ans.
98 bool ans_ass;
99
100 // The type of the expression.
101 octave_value::assign_op etype;
102
103 // true only on first rvalue() call.
104 bool first_execution;
105
106 // No copying!
107
108 tree_simple_assignment (const tree_simple_assignment&);
109
110 tree_simple_assignment& operator = (const tree_simple_assignment&);
111 };
112
113 // Multi-valued assignment expressions.
114
115 class
116 tree_multi_assignment : public tree_expression
117 {
118 public:
119
120 tree_multi_assignment (bool plhs = false, int l = -1, int c = -1)
121 : tree_expression (l, c), lhs (0), rhs (0), preserve (plhs),
122 first_execution (true) { }
123
124 tree_multi_assignment (tree_argument_list *lst, tree_expression *r,
125 bool plhs = false, int l = -1, int c = -1);
126
127 ~tree_multi_assignment (void);
128
129 bool has_magic_end (void) const { return (rhs && rhs->has_magic_end ()); }
130
131 bool is_assignment_expression (void) const { return true; }
132
133 bool rvalue_ok (void) const { return true; }
134
135 octave_value rvalue1 (int nargout = 1);
136
137 octave_value_list rvalue (int nargout);
138
139 std::string oper (void) const;
140
141 tree_argument_list *left_hand_side (void) { return lhs; }
142
143 tree_expression *right_hand_side (void) { return rhs; }
144
145 tree_expression *dup (symbol_table::scope_id scope,
146 symbol_table::context_id context) const;
147
148 void accept (tree_walker& tw);
149
150 octave_value::assign_op op_type (void) const { return octave_value::op_asn_eq; }
151
152 private:
153
154 // The left hand side of the assignment.
155 tree_argument_list *lhs;
156
157 // The right hand side of the assignment.
158 tree_expression *rhs;
159
160 // True if we should not delete the lhs.
161 bool preserve;
162
163 // true only on first rvalue() call.
164 bool first_execution;
165
166 // No copying!
167
168 tree_multi_assignment (const tree_multi_assignment&);
169
170 tree_multi_assignment& operator = (const tree_multi_assignment&);
171 };
172
173 #endif