Mercurial > hg > octave-nkf
annotate libinterp/octave-value/ov-ch-mat.h @ 19954:c913247c85a8
make colon function work (bug #44290)
* colon.m: Delete.
* scripts/miscellaneous/module.mk: Update.
* data.cc (Fcolon): New function.
* ov.h, ov.cc (do_colon_op): New functions.
* pt-colon.h, pt-colon.cc (tree_colon_expression::make_range): Delete.
(tree_colon_expression::rvalue1): Use do_colon_op instead of make_range.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 18 Feb 2015 17:02:13 -0500 |
parents | 4197fc428c7d |
children | 7fa170cc14fe |
rev | line source |
---|---|
2376 | 1 /* |
2 | |
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19795
diff
changeset
|
3 Copyright (C) 1996-2015 John W. Eaton |
11523 | 4 Copyright (C) 2009-2010 VZLU Prague |
2376 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
2376 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
2376 | 21 |
22 */ | |
23 | |
17822
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
24 #if !defined (octave_ov_ch_mat_h) |
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
25 #define octave_ov_ch_mat_h 1 |
2376 | 26 |
27 #include <cstdlib> | |
28 | |
8950
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
29 #include <iosfwd> |
2376 | 30 #include <string> |
31 | |
32 #include "mx-base.h" | |
33 #include "str-vec.h" | |
34 | |
35 #include "error.h" | |
9689
34d6f005db4b
eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents:
9685
diff
changeset
|
36 #include "ov.h" |
2376 | 37 #include "ov-base.h" |
3219 | 38 #include "ov-base-mat.h" |
9689
34d6f005db4b
eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents:
9685
diff
changeset
|
39 #include "ov-re-mat.h" |
2376 | 40 #include "ov-typeinfo.h" |
41 | |
42 class octave_value_list; | |
43 | |
44 class tree_walker; | |
45 | |
2477 | 46 // Character matrix values. |
2376 | 47 |
48 class | |
4513 | 49 octave_char_matrix : public octave_base_matrix<charNDArray> |
2376 | 50 { |
9689
34d6f005db4b
eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents:
9685
diff
changeset
|
51 protected: |
2376 | 52 |
53 octave_char_matrix (void) | |
4513 | 54 : octave_base_matrix<charNDArray> () { } |
2376 | 55 |
9689
34d6f005db4b
eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents:
9685
diff
changeset
|
56 octave_char_matrix (const charMatrix& chm) |
4513 | 57 : octave_base_matrix<charNDArray> (chm) { } |
58 | |
9689
34d6f005db4b
eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents:
9685
diff
changeset
|
59 octave_char_matrix (const charNDArray& chm) |
4513 | 60 : octave_base_matrix<charNDArray> (chm) { } |
2376 | 61 |
10351
5150ceb4dbb4
base charMatrix and boolMatrix on Array<char>
Jaroslav Hajek <highegg@gmail.com>
parents:
10160
diff
changeset
|
62 octave_char_matrix (const Array<char>& chm) |
5150ceb4dbb4
base charMatrix and boolMatrix on Array<char>
Jaroslav Hajek <highegg@gmail.com>
parents:
10160
diff
changeset
|
63 : octave_base_matrix<charNDArray> (chm) { } |
5150ceb4dbb4
base charMatrix and boolMatrix on Array<char>
Jaroslav Hajek <highegg@gmail.com>
parents:
10160
diff
changeset
|
64 |
3189 | 65 octave_char_matrix (char c) |
4513 | 66 : octave_base_matrix<charNDArray> (c) { } |
3189 | 67 |
2376 | 68 octave_char_matrix (const char *s) |
4513 | 69 : octave_base_matrix<charNDArray> (s) { } |
2376 | 70 |
3523 | 71 octave_char_matrix (const std::string& s) |
4513 | 72 : octave_base_matrix<charNDArray> (s) { } |
2376 | 73 |
74 octave_char_matrix (const string_vector& s) | |
4513 | 75 : octave_base_matrix<charNDArray> (s) { } |
2376 | 76 |
77 octave_char_matrix (const octave_char_matrix& chm) | |
4513 | 78 : octave_base_matrix<charNDArray> (chm) { } |
2376 | 79 |
9689
34d6f005db4b
eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents:
9685
diff
changeset
|
80 public: |
34d6f005db4b
eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents:
9685
diff
changeset
|
81 |
2376 | 82 ~octave_char_matrix (void) { } |
83 | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
84 octave_base_value *clone (void) const |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
85 { return new octave_char_matrix (*this); } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
86 octave_base_value *empty_clone (void) const |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
87 { return new octave_char_matrix (); } |
2376 | 88 |
18129
e473c4853afc
enable non-integer ranges as indices by default and deprecate preference
John W. Eaton <jwe@octave.org>
parents:
17822
diff
changeset
|
89 idx_vector index_vector (bool require_integers = false) const; |
5267 | 90 |
9685 | 91 builtin_type_t builtin_type (void) const { return btyp_char; } |
92 | |
2376 | 93 bool is_char_matrix (void) const { return true; } |
3180 | 94 bool is_real_matrix (void) const { return true; } |
2376 | 95 |
96 bool is_real_type (void) const { return true; } | |
97 | |
98 double double_value (bool = false) const; | |
99 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
100 float float_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
101 |
3145 | 102 double scalar_value (bool frc_str_conv = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
103 { return double_value (frc_str_conv); } |
2916 | 104 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
105 float float_scalar_value (bool frc_str_conv = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
106 { return float_value (frc_str_conv); } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
107 |
4513 | 108 Matrix matrix_value (bool = false) const |
19508
6c9ea5be96bf
Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents:
18129
diff
changeset
|
109 { return Matrix (charMatrix (matrix)); } |
2376 | 110 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
111 FloatMatrix float_matrix_value (bool = false) const |
19508
6c9ea5be96bf
Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents:
18129
diff
changeset
|
112 { return FloatMatrix (charMatrix (matrix)); } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
113 |
4668 | 114 NDArray array_value (bool = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
115 { return NDArray (matrix); } |
4668 | 116 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
117 FloatNDArray float_array_value (bool = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
118 { return FloatNDArray (matrix); } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
119 |
2376 | 120 Complex complex_value (bool = false) const; |
121 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
122 FloatComplex float_complex_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
123 |
3145 | 124 ComplexMatrix complex_matrix_value (bool = false) const |
19508
6c9ea5be96bf
Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents:
18129
diff
changeset
|
125 { return ComplexMatrix (charMatrix (matrix)); } |
2376 | 126 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
127 FloatComplexMatrix float_complex_matrix_value (bool = false) const |
19508
6c9ea5be96bf
Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents:
18129
diff
changeset
|
128 { return FloatComplexMatrix (charMatrix (matrix)); } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
129 |
4668 | 130 ComplexNDArray complex_array_value (bool = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
131 { return ComplexNDArray (matrix); } |
4668 | 132 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
133 FloatComplexNDArray float_complex_array_value (bool = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
134 { return FloatComplexNDArray (matrix); } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
135 |
3145 | 136 charMatrix char_matrix_value (bool = false) const |
19508
6c9ea5be96bf
Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents:
18129
diff
changeset
|
137 { return charMatrix (matrix); } |
2376 | 138 |
4550 | 139 charNDArray char_array_value (bool = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
140 { return matrix; } |
4543 | 141 |
5279 | 142 octave_value convert_to_str_internal (bool, bool, char type) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
143 { return octave_value (matrix, type); } |
2449 | 144 |
4643 | 145 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; |
146 | |
10503
fcf6341a8cab
octave_char_matrix::mex_get_data: new function
John W. Eaton <jwe@octave.org>
parents:
10351
diff
changeset
|
147 // Unsafe. This function exists to support the MEX interface. |
fcf6341a8cab
octave_char_matrix::mex_get_data: new function
John W. Eaton <jwe@octave.org>
parents:
10351
diff
changeset
|
148 // You should not use it anywhere else. |
fcf6341a8cab
octave_char_matrix::mex_get_data: new function
John W. Eaton <jwe@octave.org>
parents:
10351
diff
changeset
|
149 void *mex_get_data (void) const { return matrix.mex_get_data (); } |
fcf6341a8cab
octave_char_matrix::mex_get_data: new function
John W. Eaton <jwe@octave.org>
parents:
10351
diff
changeset
|
150 |
5900 | 151 mxArray *as_mxArray (void) const; |
152 | |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9690
diff
changeset
|
153 octave_value map (unary_mapper_t umap) const; |
2376 | 154 }; |
155 | |
156 #endif |