2979
|
1 /* |
|
2 |
|
3 Copyright (C) 1996, 1997 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 2, or (at your option) any |
|
10 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, write to the Free |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
20 |
|
21 */ |
|
22 |
|
23 #ifdef HAVE_CONFIG_H |
|
24 #include <config.h> |
|
25 #endif |
|
26 |
3203
|
27 #include "error.h" |
2979
|
28 #include "oct-obj.h" |
|
29 #include "oct-lvalue.h" |
|
30 #include "ov.h" |
|
31 |
|
32 void |
|
33 octave_lvalue::assign (octave_value::assign_op op, const octave_value& rhs) |
|
34 { |
3933
|
35 octave_value tmp (idx.empty () |
|
36 ? val->assign (op, rhs) |
|
37 : val->assign (op, type, idx, rhs)); |
2979
|
38 |
3940
|
39 if (! (error_state || (chg_fcn && chg_fcn () < 0))) |
3933
|
40 *val = tmp; |
3203
|
41 } |
|
42 |
|
43 void |
3933
|
44 octave_lvalue::set_index (const std::string& t, |
4219
|
45 const std::list<octave_value_list>& i) |
3357
|
46 { |
|
47 if (! index_set) |
|
48 { |
3933
|
49 type = t; |
3357
|
50 idx = i; |
|
51 index_set = true; |
|
52 } |
|
53 else |
|
54 error ("invalid index expression in assignment"); |
|
55 } |
|
56 |
|
57 void |
3203
|
58 octave_lvalue::do_unary_op (octave_value::unary_op op) |
|
59 { |
3933
|
60 octave_value tmp (idx.empty () |
|
61 ? val->do_non_const_unary_op (op) |
|
62 : val->do_non_const_unary_op (op, type, idx)); |
3203
|
63 |
3940
|
64 if (! (error_state || (chg_fcn && chg_fcn () < 0))) |
3933
|
65 *val = tmp; |
2979
|
66 } |
|
67 |
|
68 /* |
|
69 ;;; Local Variables: *** |
|
70 ;;; mode: C++ *** |
|
71 ;;; End: *** |
|
72 */ |