Mercurial > octave
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 |
rev | line source |
---|---|
2979 | 1 /* |
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 | 4 |
5 This file is part of Octave. | |
6 | |
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 | 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 | 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/>. | |
2979 | 20 |
21 */ | |
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 | 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 | 28 class octave_value; |
29 class octave_value_list; | |
30 | |
31 #include <string> | |
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 | 35 |
36 class | |
37 octave_lvalue | |
38 { | |
39 public: | |
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 | 45 |
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 | 49 |
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 | 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 | 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 | 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 | 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 | 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 | 83 |
84 void assign (octave_value::assign_op, const octave_value&); | |
85 | |
5846 | 86 void numel (octave_idx_type n) { nel = n; } |
87 | |
88 octave_idx_type numel (void) const { return nel; } | |
89 | |
4219 | 90 void set_index (const std::string& t, const std::list<octave_value_list>& i); |
2979 | 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 | 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 | 98 void do_unary_op (octave_value::unary_op op); |
2979 | 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 | 101 |
2979 | 102 private: |
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 | 107 |
3933 | 108 std::string type; |
2979 | 109 |
4219 | 110 std::list<octave_value_list> idx; |
3929 | 111 |
5846 | 112 octave_idx_type nel; |
2979 | 113 }; |
114 | |
115 #endif |