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 |
|
27 #include "oct-obj.h" |
|
28 #include "oct-lvalue.h" |
|
29 #include "ov.h" |
|
30 |
|
31 void |
|
32 octave_lvalue::assign (octave_value::assign_op op, const octave_value& rhs) |
|
33 { |
|
34 octave_value saved_val; |
|
35 |
|
36 if (chg_fcn) |
|
37 octave_value saved_val = *val; |
|
38 |
|
39 if (idx.empty ()) |
|
40 { |
|
41 if (struct_elt_name.empty ()) |
|
42 val->assign (op, rhs); |
|
43 else |
|
44 val->assign_struct_elt (op, struct_elt_name, rhs); |
|
45 } |
|
46 else |
|
47 { |
|
48 if (struct_elt_name.empty ()) |
|
49 val->assign (op, idx, rhs); |
|
50 else |
|
51 val->assign_struct_elt (op, struct_elt_name, idx, rhs); |
|
52 } |
|
53 |
|
54 if (chg_fcn && chg_fcn () < 0) |
|
55 *val = saved_val; |
|
56 } |
|
57 |
|
58 /* |
|
59 ;;; Local Variables: *** |
|
60 ;;; mode: C++ *** |
|
61 ;;; End: *** |
|
62 */ |