annotate libinterp/parse-tree/oct-lvalue.h @ 24350:b991accccd4c

move oct-lvalue files from corefcn to parse-tree directory * ov-base.h, ov.h: Delete unnecessary forward declarations for octave_lvalue. * oct-lvalue.h, oct-lvalue.cc: Move from libinterp/corefcn to libinterp/parse-tree directory. * libinterp/corefcn/module.mk, libinterp/parse-tree/module.mk: Update.
author John W. Eaton <jwe@octave.org>
date Wed, 29 Nov 2017 15:18:52 -0500
parents libinterp/corefcn/oct-lvalue.h@bc3819b7cca1
children cc3b3ceb155c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2979
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
1 /*
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
2
23219
3ac9f9ecfae5 maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents: 23083
diff changeset
3 Copyright (C) 1996-2017 John W. Eaton
2979
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
4
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
6
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
8 under the terms of the GNU General Public License as published by
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
9 the Free Software Foundation; either version 3 of the License, or
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
10 (at your option) any later version.
2979
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
11
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
12 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
13 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
15 GNU General Public License for more details.
2979
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
16
a3556d2adec9 [project @ 1997-05-15 22:35:37 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: 5846
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: 5846
diff changeset
19 <http://www.gnu.org/licenses/>.
2979
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
20
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
21 */
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
22
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 20248
diff changeset
23 #if ! defined (octave_oct_lvalue_h)
17822
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17787
diff changeset
24 #define octave_oct_lvalue_h 1
2979
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
25
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21017
diff changeset
26 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21017
diff changeset
27
2979
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
28 class octave_value;
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
29 class octave_value_list;
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
30
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
31 #include <string>
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
32
20940
48b2ad5ee801 maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents: 20791
diff changeset
33 #include "ovl.h"
16442
302157614308 deprecate symbol_table::varref functions
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
34 #include "symtab.h"
2979
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
35
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
36 class
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
37 octave_lvalue
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
38 {
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
39 public:
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
40
24270
bc3819b7cca1 don't use symbol_table:: nesting for symbol_record, symbol_scope, or fcn_info
John W. Eaton <jwe@octave.org>
parents: 24037
diff changeset
41 octave_lvalue (const octave::symbol_record& s
bc3819b7cca1 don't use symbol_table:: nesting for symbol_record, symbol_scope, or fcn_info
John W. Eaton <jwe@octave.org>
parents: 24037
diff changeset
42 = octave::symbol_record ())
24037
21915520ac7b use more direct method for non-local symbol access (bug #38236)
John W. Eaton <jwe@octave.org>
parents: 23693
diff changeset
43 : sym (s), black_hole (false), type (), idx (), nel (1)
16442
302157614308 deprecate symbol_table::varref functions
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
44 { }
2979
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
45
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
46 octave_lvalue (const octave_lvalue& vr)
24037
21915520ac7b use more direct method for non-local symbol access (bug #38236)
John W. Eaton <jwe@octave.org>
parents: 23693
diff changeset
47 : sym (vr.sym), black_hole (vr.black_hole), type (vr.type), idx (vr.idx), nel (vr.nel)
16442
302157614308 deprecate symbol_table::varref functions
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
48 { }
2979
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
49
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
50 octave_lvalue& operator = (const octave_lvalue& vr)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
51 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
52 if (this != &vr)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
53 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
54 sym = vr.sym;
24037
21915520ac7b use more direct method for non-local symbol access (bug #38236)
John W. Eaton <jwe@octave.org>
parents: 23693
diff changeset
55 black_hole = vr.black_hole;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
56 type = vr.type;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
57 idx = vr.idx;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
58 nel = vr.nel;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
59 }
2979
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
60
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
61 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
62 }
2979
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
63
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
64 ~octave_lvalue (void) = default;
2979
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
65
24037
21915520ac7b use more direct method for non-local symbol access (bug #38236)
John W. Eaton <jwe@octave.org>
parents: 23693
diff changeset
66 bool is_black_hole (void) const { return black_hole; }
21915520ac7b use more direct method for non-local symbol access (bug #38236)
John W. Eaton <jwe@octave.org>
parents: 23693
diff changeset
67
21915520ac7b use more direct method for non-local symbol access (bug #38236)
John W. Eaton <jwe@octave.org>
parents: 23693
diff changeset
68 void mark_black_hole (void) { black_hole = true; }
10206
37a08e0ce2dc support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
69
16442
302157614308 deprecate symbol_table::varref functions
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
70 bool is_defined (void) const
302157614308 deprecate symbol_table::varref functions
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
71 {
24037
21915520ac7b use more direct method for non-local symbol access (bug #38236)
John W. Eaton <jwe@octave.org>
parents: 23693
diff changeset
72 return ! is_black_hole () && sym.is_defined ();
16442
302157614308 deprecate symbol_table::varref functions
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
73 }
2979
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
74
16442
302157614308 deprecate symbol_table::varref functions
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
75 bool is_undefined (void) const
302157614308 deprecate symbol_table::varref functions
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
76 {
24037
21915520ac7b use more direct method for non-local symbol access (bug #38236)
John W. Eaton <jwe@octave.org>
parents: 23693
diff changeset
77 return is_black_hole () || sym.is_undefined ();
16442
302157614308 deprecate symbol_table::varref functions
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
78 }
2979
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
79
23603
18bd46c4b79a make symbol table context info mostly local to symbol table scopes
John W. Eaton <jwe@octave.org>
parents: 23602
diff changeset
80 bool isstruct (void) const { return value().isstruct (); }
16442
302157614308 deprecate symbol_table::varref functions
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
81
24037
21915520ac7b use more direct method for non-local symbol access (bug #38236)
John W. Eaton <jwe@octave.org>
parents: 23693
diff changeset
82 void define (const octave_value& v) { sym.assign (v); }
2979
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
83
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
84 void assign (octave_value::assign_op, const octave_value&);
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
85
5846
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
86 void numel (octave_idx_type n) { nel = n; }
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
87
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
88 octave_idx_type numel (void) const { return nel; }
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
89
4219
23d06c9e1edd [project @ 2002-12-06 21:29:17 by jwe]
jwe
parents: 3933
diff changeset
90 void set_index (const std::string& t, const std::list<octave_value_list>& i);
2979
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
91
21017
93748bcaec17 maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents: 20940
diff changeset
92 void clear_index (void) { type = ""; idx.clear (); }
2984
84c33881d0bc [project @ 1997-05-16 05:14:33 by jwe]
jwe
parents: 2979
diff changeset
93
20248
011a364b4d78 improve compatibility of indexed assignment (bug #43813)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
94 std::string index_type (void) const { return type; }
011a364b4d78 improve compatibility of indexed assignment (bug #43813)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
95
011a364b4d78 improve compatibility of indexed assignment (bug #43813)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
96 bool index_is_empty (void) const;
011a364b4d78 improve compatibility of indexed assignment (bug #43813)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
97
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3060
diff changeset
98 void do_unary_op (octave_value::unary_op op);
2979
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
99
16442
302157614308 deprecate symbol_table::varref functions
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
100 octave_value value (void) const;
4234
90e44267e8cf [project @ 2002-12-21 17:15:25 by jwe]
jwe
parents: 4219
diff changeset
101
2979
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
102 private:
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
103
24270
bc3819b7cca1 don't use symbol_table:: nesting for symbol_record, symbol_scope, or fcn_info
John W. Eaton <jwe@octave.org>
parents: 24037
diff changeset
104 octave::symbol_record sym;
24037
21915520ac7b use more direct method for non-local symbol access (bug #38236)
John W. Eaton <jwe@octave.org>
parents: 23693
diff changeset
105
21915520ac7b use more direct method for non-local symbol access (bug #38236)
John W. Eaton <jwe@octave.org>
parents: 23693
diff changeset
106 bool black_hole;
2979
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
107
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3929
diff changeset
108 std::string type;
2979
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
109
4219
23d06c9e1edd [project @ 2002-12-06 21:29:17 by jwe]
jwe
parents: 3933
diff changeset
110 std::list<octave_value_list> idx;
3929
cc8ae49d6e79 [project @ 2002-05-04 02:47:14 by jwe]
jwe
parents: 3618
diff changeset
111
5846
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
112 octave_idx_type nel;
2979
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
113 };
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
114
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents:
diff changeset
115 #endif