Mercurial > octave
annotate libinterp/corefcn/mex.cc @ 30769:822649f5f193 stable
don't mix operator new and free (bug #61813)
* mex.cc (fp_to_ov<T>): Only allow octave_value to borrow mxArray data
if using std::pmr::polymorphic_allocator.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 21 Feb 2022 12:41:12 -0500 |
parents | 6bc535476d5f |
children | 2aff9dda08f1 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
30501
diff
changeset
|
3 // Copyright (C) 2006-2022 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
7016 | 25 |
22003
2d3972b802ff
use consistent style for including config.h in source files
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
2d3972b802ff
use consistent style for including config.h in source files
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
27 # include "config.h" |
2d3972b802ff
use consistent style for including config.h in source files
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
28 #endif |
5864 | 29 |
30501
79a7f3e3cf54
Use consistent name for OCTAVE_HAVE_STD_PMR_POLYMORPHIC_ALLOCATOR (bug #61472).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30494
diff
changeset
|
30 // #define DEBUG 1 |
30488
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
31 |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
32 #if defined (DEBUG) |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
33 # include <iostream> |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
34 #endif |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
35 |
5900 | 36 #include <cstdarg> |
10463
bbe99b2a5ba7
undo recent gnulib-related changes
John W. Eaton <jwe@octave.org>
parents:
10447
diff
changeset
|
37 #include <cstdlib> |
5900 | 38 #include <cstring> |
39 #include <cctype> | |
40 | |
23455
73ff72d3d603
maint: Eliminate <cfloat.h> header from libinterp files
Rik <rik@octave.org>
parents:
23450
diff
changeset
|
41 #include <limits> |
73ff72d3d603
maint: Eliminate <cfloat.h> header from libinterp files
Rik <rik@octave.org>
parents:
23450
diff
changeset
|
42 #include <map> |
30501
79a7f3e3cf54
Use consistent name for OCTAVE_HAVE_STD_PMR_POLYMORPHIC_ALLOCATOR (bug #61472).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30494
diff
changeset
|
43 #if defined (OCTAVE_HAVE_STD_PMR_POLYMORPHIC_ALLOCATOR) |
30494
ba5370c670d5
make use of <memory_resource> conditional on HAVE_STD_PMR_POLYMORPHIC_ALLOCATOR
John W. Eaton <jwe@octave.org>
parents:
30488
diff
changeset
|
44 # include <memory_resource> |
ba5370c670d5
make use of <memory_resource> conditional on HAVE_STD_PMR_POLYMORPHIC_ALLOCATOR
John W. Eaton <jwe@octave.org>
parents:
30488
diff
changeset
|
45 #endif |
5864 | 46 #include <set> |
23455
73ff72d3d603
maint: Eliminate <cfloat.h> header from libinterp files
Rik <rik@octave.org>
parents:
23450
diff
changeset
|
47 #include <string> |
5900 | 48 |
30488
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
49 // Needed to instantiate Array objects with custom allocator. |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
50 #include "Array.cc" |
5900 | 51 #include "f77-fcn.h" |
52 #include "lo-ieee.h" | |
8377
25bc2d31e1bf
improve OCTAVE_LOCAL_BUFFER
Jaroslav Hajek <highegg@gmail.com>
parents:
7901
diff
changeset
|
53 #include "oct-locbuf.h" |
23455
73ff72d3d603
maint: Eliminate <cfloat.h> header from libinterp files
Rik <rik@octave.org>
parents:
23450
diff
changeset
|
54 #include "quit.h" |
5900 | 55 |
15149
62a35ae7d6a2
use forward decls for mxArray in ov.h and ov-base.h
John W. Eaton <jwe@octave.org>
parents:
15096
diff
changeset
|
56 #include "Cell.h" |
21151
bfd5e48c41a1
Rename local error in mex I/F from invalid_type_error to err_invalid_type.
Rik <rik@octave.org>
parents:
20940
diff
changeset
|
57 #include "error.h" |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23499
diff
changeset
|
58 #include "interpreter-private.h" |
22094
9203833cab7d
move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
22091
diff
changeset
|
59 #include "interpreter.h" |
5900 | 60 // mxArray must be declared as a class before including mexproto.h. |
15149
62a35ae7d6a2
use forward decls for mxArray in ov.h and ov-base.h
John W. Eaton <jwe@octave.org>
parents:
15096
diff
changeset
|
61 #include "mxarray.h" |
5900 | 62 #include "mexproto.h" |
63 #include "oct-map.h" | |
20940
48b2ad5ee801
maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents:
20771
diff
changeset
|
64 #include "ovl.h" |
5900 | 65 #include "ov.h" |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
66 #include "ov-classdef.h" |
6068 | 67 #include "ov-mex-fcn.h" |
5900 | 68 #include "ov-usr-fcn.h" |
5864 | 69 #include "pager.h" |
70 #include "parse.h" | |
5900 | 71 #include "unwind-prot.h" |
72 #include "utils.h" | |
5864 | 73 #include "variables.h" |
6595 | 74 #include "graphics.h" |
5900 | 75 |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
76 // These must be declared extern "C" but may be omitted from the set of |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
77 // symbols declared in mexproto.h, so we declare them here as well. |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
78 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
79 extern "C" |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
80 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
81 extern OCTINTERP_API const mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
82 mexGet_interleaved (double handle, const char *property); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
83 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
84 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
85 mxCreateCellArray (mwSize ndims, const mwSize *dims); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
86 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
87 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
88 mxCreateCellMatrix (mwSize m, mwSize n); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
89 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
90 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
91 mxCreateCharArray (mwSize ndims, const mwSize *dims); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
92 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
93 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
94 mxCreateCharMatrixFromStrings (mwSize m, const char **str); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
95 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
96 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
97 mxCreateDoubleMatrix (mwSize nr, mwSize nc, mxComplexity flag); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
98 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
99 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
100 mxCreateDoubleScalar (double val); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
101 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
102 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
103 mxCreateLogicalArray (mwSize ndims, const mwSize *dims); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
104 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
105 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
106 mxCreateLogicalMatrix (mwSize m, mwSize n); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
107 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
108 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
109 mxCreateLogicalScalar (mxLogical val); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
110 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
111 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
112 mxCreateNumericArray (mwSize ndims, const mwSize *dims, mxClassID class_id, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
113 mxComplexity flag); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
114 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
115 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
116 mxCreateNumericMatrix (mwSize m, mwSize n, mxClassID class_id, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
117 mxComplexity flag); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
118 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
119 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
120 mxCreateUninitNumericArray (mwSize ndims, const mwSize *dims, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
121 mxClassID class_id, mxComplexity flag); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
122 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
123 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
124 mxCreateUninitNumericMatrix (mwSize m, mwSize n, mxClassID class_id, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
125 mxComplexity flag); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
126 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
127 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
128 mxCreateSparse (mwSize m, mwSize n, mwSize nzmax, mxComplexity flag); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
129 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
130 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
131 mxCreateSparseLogicalMatrix (mwSize m, mwSize n, mwSize nzmax); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
132 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
133 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
134 mxCreateString (const char *str); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
135 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
136 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
137 mxCreateStructArray (mwSize ndims, const mwSize *dims, int num_keys, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
138 const char **keys); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
139 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
140 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
141 mxCreateStructMatrix (mwSize rows, mwSize cols, int num_keys, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
142 const char **keys); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
143 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
144 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
145 mxCreateCellArray_interleaved (mwSize ndims, const mwSize *dims); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
146 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
147 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
148 mxCreateCellMatrix_interleaved (mwSize m, mwSize n); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
149 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
150 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
151 mxCreateCharArray_interleaved (mwSize ndims, const mwSize *dims); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
152 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
153 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
154 mxCreateCharMatrixFromStrings_interleaved (mwSize m, const char **str); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
155 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
156 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
157 mxCreateDoubleMatrix_interleaved (mwSize nr, mwSize nc, mxComplexity flag); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
158 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
159 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
160 mxCreateDoubleScalar_interleaved (double val); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
161 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
162 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
163 mxCreateLogicalArray_interleaved (mwSize ndims, const mwSize *dims); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
164 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
165 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
166 mxCreateLogicalMatrix_interleaved (mwSize m, mwSize n); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
167 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
168 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
169 mxCreateLogicalScalar_interleaved (mxLogical val); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
170 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
171 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
172 mxCreateNumericArray_interleaved (mwSize ndims, const mwSize *dims, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
173 mxClassID class_id, mxComplexity flag); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
174 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
175 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
176 mxCreateNumericMatrix_interleaved (mwSize m, mwSize n, mxClassID class_id, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
177 mxComplexity flag); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
178 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
179 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
180 mxCreateUninitNumericArray_interleaved (mwSize ndims, const mwSize *dims, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
181 mxClassID class_id, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
182 mxComplexity flag); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
183 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
184 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
185 mxCreateUninitNumericMatrix_interleaved (mwSize m, mwSize n, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
186 mxClassID class_id, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
187 mxComplexity flag); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
188 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
189 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
190 mxCreateSparse_interleaved (mwSize m, mwSize n, mwSize nzmax, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
191 mxComplexity flag); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
192 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
193 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
194 mxCreateSparseLogicalMatrix_interleaved (mwSize m, mwSize n, mwSize nzmax); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
195 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
196 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
197 mxCreateString_interleaved (const char *str); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
198 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
199 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
200 mxCreateStructArray_interleaved (mwSize ndims, const mwSize *dims, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
201 int num_keys, const char **keys); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
202 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
203 extern OCTINTERP_API mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
204 mxCreateStructMatrix_interleaved (mwSize rows, mwSize cols, int num_keys, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
205 const char **keys); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
206 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
207 extern OCTINTERP_API int mxMakeArrayReal (mxArray *ptr); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
208 extern OCTINTERP_API int mxMakeArrayComplex (mxArray *ptr); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
209 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
210 extern OCTINTERP_API mxDouble * mxGetDoubles (const mxArray *p); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
211 extern OCTINTERP_API mxSingle * mxGetSingles (const mxArray *p); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
212 extern OCTINTERP_API mxInt8 * mxGetInt8s (const mxArray *p); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
213 extern OCTINTERP_API mxInt16 * mxGetInt16s (const mxArray *p); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
214 extern OCTINTERP_API mxInt32 * mxGetInt32s (const mxArray *p); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
215 extern OCTINTERP_API mxInt64 * mxGetInt64s (const mxArray *p); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
216 extern OCTINTERP_API mxUint8 * mxGetUint8s (const mxArray *p); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
217 extern OCTINTERP_API mxUint16 * mxGetUint16s (const mxArray *p); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
218 extern OCTINTERP_API mxUint32 * mxGetUint32s (const mxArray *p); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
219 extern OCTINTERP_API mxUint64 * mxGetUint64s (const mxArray *p); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
220 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
221 extern OCTINTERP_API mxComplexDouble * mxGetComplexDoubles (const mxArray *p); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
222 extern OCTINTERP_API mxComplexSingle * mxGetComplexSingles (const mxArray *p); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
223 #if 0 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
224 /* We don't have these yet. */ |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
225 extern OCTINTERP_API mxComplexInt8 * mxGetComplexInt8s (const mxArray *p); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
226 extern OCTINTERP_API mxComplexInt16 * mxGetComplexInt16s (const mxArray *p); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
227 extern OCTINTERP_API mxComplexInt32 * mxGetComplexInt32s (const mxArray *p); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
228 extern OCTINTERP_API mxComplexInt64 * mxGetComplexInt64s (const mxArray *p); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
229 extern OCTINTERP_API mxComplexUint8 * mxGetComplexUint8s (const mxArray *p); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
230 extern OCTINTERP_API mxComplexUint16 * mxGetComplexUint16s (const mxArray *p); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
231 extern OCTINTERP_API mxComplexUint32 * mxGetComplexUint32s (const mxArray *p); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
232 extern OCTINTERP_API mxComplexUint64 * mxGetComplexUint64s (const mxArray *p); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
233 #endif |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
234 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
235 extern OCTINTERP_API double * mxGetPi (const mxArray *ptr); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
236 extern OCTINTERP_API void * mxGetImagData (const mxArray *ptr); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
237 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
238 extern OCTINTERP_API int mxSetDoubles (mxArray *p, mxDouble *d); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
239 extern OCTINTERP_API int mxSetSingles (mxArray *p, mxSingle *d); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
240 extern OCTINTERP_API int mxSetInt8s (mxArray *p, mxInt8 *d); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
241 extern OCTINTERP_API int mxSetInt16s (mxArray *p, mxInt16 *d); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
242 extern OCTINTERP_API int mxSetInt32s (mxArray *p, mxInt32 *d); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
243 extern OCTINTERP_API int mxSetInt64s (mxArray *p, mxInt64 *d); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
244 extern OCTINTERP_API int mxSetUint8s (mxArray *p, mxUint8 *d); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
245 extern OCTINTERP_API int mxSetUint16s (mxArray *p, mxUint16 *d); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
246 extern OCTINTERP_API int mxSetUint32s (mxArray *p, mxUint32 *d); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
247 extern OCTINTERP_API int mxSetUint64s (mxArray *p, mxUint64 *d); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
248 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
249 extern OCTINTERP_API int mxSetComplexDoubles (mxArray *p, mxComplexDouble *d); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
250 extern OCTINTERP_API int mxSetComplexSingles (mxArray *p, mxComplexSingle *d); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
251 #if 0 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
252 /* We don't have these yet. */ |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
253 extern OCTINTERP_API int mxSetComplexInt8s (mxArray *p, mxComplexInt8 *d); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
254 extern OCTINTERP_API int mxSetComplexInt16s (mxArray *p, mxComplexInt16 *d); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
255 extern OCTINTERP_API int mxSetComplexInt32s (mxArray *p, mxComplexInt32 *d); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
256 extern OCTINTERP_API int mxSetComplexInt64s (mxArray *p, mxComplexInt64 *d); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
257 extern OCTINTERP_API int mxSetComplexUint8s (mxArray *p, mxComplexUint8 *d); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
258 extern OCTINTERP_API int mxSetComplexUint16s (mxArray *p, mxComplexUint16 *d); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
259 extern OCTINTERP_API int mxSetComplexUint32s (mxArray *p, mxComplexUint32 *d); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
260 extern OCTINTERP_API int mxSetComplexUint64s (mxArray *p, mxComplexUint64 *d); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
261 #endif |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
262 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
263 extern OCTINTERP_API void mxSetPi (mxArray *ptr, double *pi); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
264 extern OCTINTERP_API void mxSetImagData (mxArray *ptr, void *pi); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
265 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
266 |
30428
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
267 static void * |
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
268 xmalloc (size_t n) |
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
269 { |
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
270 void *ptr = std::malloc (n); |
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
271 |
30488
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
272 #if defined (DEBUG) |
30428
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
273 std::cerr << "xmalloc (" << n << ") = " << ptr << std::endl; |
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
274 #endif |
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
275 |
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
276 return ptr; |
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
277 } |
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
278 |
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
279 static void * |
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
280 xrealloc (void *ptr, size_t n) |
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
281 { |
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
282 void *newptr = std::realloc (ptr, n); |
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
283 |
30488
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
284 #if defined (DEBUG) |
30428
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
285 std::cerr << "xrealloc (" << ptr << ", " << n << ") = " << newptr |
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
286 << std::endl; |
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
287 #endif |
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
288 |
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
289 return newptr; |
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
290 } |
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
291 |
5905 | 292 static void |
293 xfree (void *ptr) | |
294 { | |
30488
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
295 #if defined (DEBUG) |
30428
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
296 std::cerr << "xfree (" << ptr << ")" << std::endl; |
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
297 #endif |
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
298 |
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
299 std::free (ptr); |
5905 | 300 } |
301 | |
6806 | 302 static mwSize |
303 max_str_len (mwSize m, const char **str) | |
5900 | 304 { |
305 int max_len = 0; | |
306 | |
6806 | 307 for (mwSize i = 0; i < m; i++) |
5900 | 308 { |
6806 | 309 mwSize tmp = strlen (str[i]); |
5900 | 310 |
311 if (tmp > max_len) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
312 max_len = tmp; |
5900 | 313 } |
314 | |
315 return max_len; | |
316 } | |
317 | |
30488
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
318 // FIXME: Is there a better/standard way to do this job? |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
319 |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
320 template <typename T> |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
321 class fp_type_traits |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
322 { |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
323 public: |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
324 static const bool is_complex = false; |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
325 }; |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
326 |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
327 template <> |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
328 class fp_type_traits<Complex> |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
329 { |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
330 public: |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
331 static const bool is_complex = true; |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
332 }; |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
333 |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
334 template <> |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
335 class fp_type_traits <FloatComplex> |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
336 { |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
337 public: |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
338 static const bool is_complex = true; |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
339 }; |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
340 |
30501
79a7f3e3cf54
Use consistent name for OCTAVE_HAVE_STD_PMR_POLYMORPHIC_ALLOCATOR (bug #61472).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30494
diff
changeset
|
341 #if defined (OCTAVE_HAVE_STD_PMR_POLYMORPHIC_ALLOCATOR) |
30488
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
342 |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
343 class mx_memory_resource : public std::pmr::memory_resource |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
344 { |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
345 private: |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
346 |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
347 void * do_allocate (std::size_t bytes, size_t /*alignment*/) |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
348 { |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
349 void *ptr = xmalloc (bytes); |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
350 |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
351 if (! ptr) |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
352 throw std::bad_alloc (); |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
353 |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
354 return ptr; |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
355 } |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
356 |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
357 void do_deallocate (void* ptr, std::size_t /*bytes*/, |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
358 std::size_t /*alignment*/) |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
359 { |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
360 xfree (ptr); |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
361 } |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
362 |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
363 bool do_is_equal (const std::pmr::memory_resource& other) const noexcept |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
364 { |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
365 return this == dynamic_cast<const mx_memory_resource *> (&other); |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
366 } |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
367 }; |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
368 |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
369 // FIXME: Is it OK for the memory resource object to be defined this |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
370 // way? |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
371 static mx_memory_resource the_mx_memory_resource; |
30494
ba5370c670d5
make use of <memory_resource> conditional on HAVE_STD_PMR_POLYMORPHIC_ALLOCATOR
John W. Eaton <jwe@octave.org>
parents:
30488
diff
changeset
|
372 |
30488
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
373 #endif |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
374 |
5900 | 375 // ------------------------------------------------------------------ |
376 | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
377 mxArray_base::mxArray_base (bool interleaved) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
378 : m_interleaved (interleaved) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
379 { } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
380 |
7357 | 381 static mwIndex |
382 calc_single_subscript_internal (mwSize ndims, const mwSize *dims, | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
383 mwSize nsubs, const mwIndex *subs) |
7357 | 384 { |
385 mwIndex retval = 0; | |
386 | |
387 switch (nsubs) | |
388 { | |
389 case 0: | |
390 break; | |
391 | |
392 case 1: | |
393 retval = subs[0]; | |
394 break; | |
395 | |
396 default: | |
397 { | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
398 // Both nsubs and ndims should be at least 2 here. |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
399 |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
400 mwSize n = (nsubs <= ndims ? nsubs : ndims); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
401 |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
402 retval = subs[--n]; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
403 |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
404 while (--n >= 0) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
405 retval = dims[n] * retval + subs[n]; |
7357 | 406 } |
407 break; | |
408 } | |
409 | |
410 return retval; | |
411 } | |
412 | |
5900 | 413 // The object that handles values pass to MEX files from Octave. Some |
414 // methods in this class may set mutate_flag to TRUE to tell the | |
415 // mxArray class to convert to the Matlab-style representation and | |
416 // then invoke the method on that object instead (for example, getting | |
417 // a pointer to real or imaginary data from a complex object requires | |
418 // a mutation but getting a pointer to real data from a real object | |
419 // does not). Changing the representation causes a copy so we try to | |
420 // avoid it unless it is really necessary. Once the conversion | |
421 // happens, we delete this representation, so the conversion can only | |
422 // happen once per call to a MEX file. | |
423 | |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
424 static inline void * maybe_mark_foreign (void *ptr); |
7179 | 425 |
30227
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
426 static inline void maybe_disown_ptr (void *ptr); |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
427 |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
428 #define VOID_MUTATION_METHOD(FCN_NAME, ARG_LIST) \ |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
429 void FCN_NAME ARG_LIST { request_mutation (); } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
430 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
431 #define CONST_VOID_MUTATION_METHOD(FCN_NAME, ARG_LIST) \ |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
432 void FCN_NAME ARG_LIST const { request_mutation (); } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
433 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
434 #define MUTATION_METHOD(RET_TYPE, FCN_NAME, ARG_LIST, RET_VAL) \ |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
435 RET_TYPE FCN_NAME ARG_LIST { request_mutation (); return RET_VAL; } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
436 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
437 #define CONST_MUTATION_METHOD(RET_TYPE, FCN_NAME, ARG_LIST, RET_VAL) \ |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
438 RET_TYPE FCN_NAME ARG_LIST const { request_mutation (); return RET_VAL; } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
439 |
29869
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
440 #define GET_DATA_METHOD(RT, FCN_NAME, ID, COMPLEXITY) \ |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
441 RT * FCN_NAME (void) const { return get_data<RT> (ID, COMPLEXITY); } |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
442 |
5900 | 443 class mxArray_octave_value : public mxArray_base |
444 { | |
445 public: | |
446 | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
447 mxArray_octave_value (bool interleaved, const octave_value& ov) |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
448 : mxArray_base (interleaved), m_val (ov), m_mutate_flag (false), |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
449 m_id (mxUNKNOWN_CLASS), m_class_name (nullptr), m_ndims (-1), |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
450 m_dims (nullptr) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
451 { } |
5900 | 452 |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
453 // No assignment! FIXME: should this be implemented? Note that we |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
454 // do have a copy constructor. |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
455 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
456 mxArray_octave_value& operator = (const mxArray_octave_value&) = delete; |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
457 |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
458 mxArray_base * dup (void) const { return new mxArray_octave_value (*this); } |
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
459 |
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
460 mxArray * as_mxArray (void) const |
12331
f39436e14734
mex.cc (mxArray_octave_value::dup): if value can't be converted to mxArray object, create a clone of the mxArray_octave_value container
John W. Eaton <jwe@octave.org>
parents:
12123
diff
changeset
|
461 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
462 mxArray *retval = m_val.as_mxArray (m_interleaved); |
17810
6da521da1c70
preserve cached mxArray_octave_value data while it's still in use (bug #40429)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
463 |
6da521da1c70
preserve cached mxArray_octave_value data while it's still in use (bug #40429)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
464 // RETVAL is assumed to be an mxArray_matlab object. Should we |
6da521da1c70
preserve cached mxArray_octave_value data while it's still in use (bug #40429)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
465 // assert that condition here? |
6da521da1c70
preserve cached mxArray_octave_value data while it's still in use (bug #40429)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
466 |
6da521da1c70
preserve cached mxArray_octave_value data while it's still in use (bug #40429)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
467 if (retval) |
6da521da1c70
preserve cached mxArray_octave_value data while it's still in use (bug #40429)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
468 { |
6da521da1c70
preserve cached mxArray_octave_value data while it's still in use (bug #40429)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
469 // Preserve cached values of class name and dimensions in case |
6da521da1c70
preserve cached mxArray_octave_value data while it's still in use (bug #40429)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
470 // they will be used after we mutate. |
6da521da1c70
preserve cached mxArray_octave_value data while it's still in use (bug #40429)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
471 |
6da521da1c70
preserve cached mxArray_octave_value data while it's still in use (bug #40429)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
472 // set_class_name will handle deleting class name that comes |
6da521da1c70
preserve cached mxArray_octave_value data while it's still in use (bug #40429)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
473 // from as_mxArray conversion function. |
6da521da1c70
preserve cached mxArray_octave_value data while it's still in use (bug #40429)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
474 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
475 if (m_class_name) |
17810
6da521da1c70
preserve cached mxArray_octave_value data while it's still in use (bug #40429)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
476 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
477 retval->set_class_name (m_class_name); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
478 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
479 m_class_name = nullptr; |
17810
6da521da1c70
preserve cached mxArray_octave_value data while it's still in use (bug #40429)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
480 } |
6da521da1c70
preserve cached mxArray_octave_value data while it's still in use (bug #40429)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
481 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
482 if (m_dims) |
17810
6da521da1c70
preserve cached mxArray_octave_value data while it's still in use (bug #40429)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
483 { |
6da521da1c70
preserve cached mxArray_octave_value data while it's still in use (bug #40429)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
484 mwSize *xdims = retval->get_dimensions (); |
6da521da1c70
preserve cached mxArray_octave_value data while it's still in use (bug #40429)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
485 |
6da521da1c70
preserve cached mxArray_octave_value data while it's still in use (bug #40429)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
486 mxFree (xdims); |
6da521da1c70
preserve cached mxArray_octave_value data while it's still in use (bug #40429)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
487 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
488 retval->set_dimensions (m_dims, m_ndims); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
489 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
490 m_dims = nullptr; |
17810
6da521da1c70
preserve cached mxArray_octave_value data while it's still in use (bug #40429)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
491 } |
6da521da1c70
preserve cached mxArray_octave_value data while it's still in use (bug #40429)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
492 } |
6da521da1c70
preserve cached mxArray_octave_value data while it's still in use (bug #40429)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
493 |
6da521da1c70
preserve cached mxArray_octave_value data while it's still in use (bug #40429)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
494 return retval; |
12331
f39436e14734
mex.cc (mxArray_octave_value::dup): if value can't be converted to mxArray object, create a clone of the mxArray_octave_value container
John W. Eaton <jwe@octave.org>
parents:
12123
diff
changeset
|
495 } |
5900 | 496 |
497 ~mxArray_octave_value (void) | |
498 { | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
499 mxFree (m_class_name); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
500 mxFree (m_dims); |
5900 | 501 } |
502 | |
503 bool is_octave_value (void) const { return true; } | |
504 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
505 int iscell (void) const { return m_val.iscell (); } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
506 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
507 int is_char (void) const { return m_val.is_string (); } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
508 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
509 int is_complex (void) const { return m_val.iscomplex (); } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
510 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
511 int is_double (void) const { return m_val.is_double_type (); } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
512 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
513 int is_function_handle (void) const { return m_val.is_function_handle (); } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
514 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
515 int is_int16 (void) const { return m_val.is_int16_type (); } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
516 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
517 int is_int32 (void) const { return m_val.is_int32_type (); } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
518 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
519 int is_int64 (void) const { return m_val.is_int64_type (); } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
520 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
521 int is_int8 (void) const { return m_val.is_int8_type (); } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
522 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
523 int is_logical (void) const { return m_val.islogical (); } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
524 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
525 int is_numeric (void) const { return m_val.isnumeric (); } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
526 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
527 int is_single (void) const { return m_val.is_single_type (); } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
528 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
529 int is_sparse (void) const { return m_val.issparse (); } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
530 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
531 int is_struct (void) const { return m_val.isstruct (); } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
532 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
533 int is_uint16 (void) const { return m_val.is_uint16_type (); } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
534 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
535 int is_uint32 (void) const { return m_val.is_uint32_type (); } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
536 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
537 int is_uint64 (void) const { return m_val.is_uint64_type (); } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
538 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
539 int is_uint8 (void) const { return m_val.is_uint8_type (); } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
540 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
541 int is_range (void) const { return m_val.is_range (); } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
542 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
543 int isreal (void) const { return m_val.isreal (); } |
5900 | 544 |
545 int is_logical_scalar_true (void) const | |
546 { | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
547 return (is_logical_scalar () && m_val.is_true ()); |
5900 | 548 } |
549 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
550 mwSize get_m (void) const { return m_val.rows (); } |
6686 | 551 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
552 mwSize get_n (void) const |
6187 | 553 { |
6686 | 554 mwSize n = 1; |
6187 | 555 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
556 // Force m_dims and m_ndims to be cached. |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14840
diff
changeset
|
557 get_dimensions (); |
6187 | 558 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
559 for (mwIndex i = m_ndims - 1; i > 0; i--) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
560 n *= m_dims[i]; |
6187 | 561 |
562 return n; | |
563 } | |
5900 | 564 |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
565 mwSize * get_dimensions (void) const |
5900 | 566 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
567 if (! m_dims) |
5900 | 568 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
569 m_ndims = m_val.ndims (); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
570 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
571 m_dims = static_cast<mwSize *> (mxArray::malloc (m_ndims |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
572 * sizeof (mwSize))); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
573 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
574 dim_vector dv = m_val.dims (); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
575 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
576 for (mwIndex i = 0; i < m_ndims; i++) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
577 m_dims[i] = dv(i); |
5900 | 578 } |
579 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
580 return m_dims; |
5900 | 581 } |
582 | |
6686 | 583 mwSize get_number_of_dimensions (void) const |
5900 | 584 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
585 // Force m_dims and m_ndims to be cached. |
6332 | 586 get_dimensions (); |
5900 | 587 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
588 return m_ndims; |
5900 | 589 } |
590 | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
591 VOID_MUTATION_METHOD (set_m, (mwSize)) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
592 VOID_MUTATION_METHOD (set_n, (mwSize)) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
593 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
594 MUTATION_METHOD (int, set_dimensions, (mwSize *, mwSize), 0) |
5900 | 595 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
596 mwSize get_number_of_elements (void) const { return m_val.numel (); } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
597 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
598 int isempty (void) const { return m_val.isempty (); } |
5900 | 599 |
22462
6cb7813e5b2f
Add new mxIsScalar function for MEX API.
Rik <rik@octave.org>
parents:
22454
diff
changeset
|
600 bool is_scalar (void) const |
6cb7813e5b2f
Add new mxIsScalar function for MEX API.
Rik <rik@octave.org>
parents:
22454
diff
changeset
|
601 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
602 // Force m_dims and m_ndims to be cached. |
22462
6cb7813e5b2f
Add new mxIsScalar function for MEX API.
Rik <rik@octave.org>
parents:
22454
diff
changeset
|
603 get_dimensions (); |
6cb7813e5b2f
Add new mxIsScalar function for MEX API.
Rik <rik@octave.org>
parents:
22454
diff
changeset
|
604 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
605 return m_ndims == 2 && m_dims[0] == 1 && m_dims[1] == 1; |
22599
51b395d24782
maint: strip tabs and trailing whitespace from C++ sources.
John W. Eaton <jwe@octave.org>
parents:
22480
diff
changeset
|
606 } |
22462
6cb7813e5b2f
Add new mxIsScalar function for MEX API.
Rik <rik@octave.org>
parents:
22454
diff
changeset
|
607 |
5900 | 608 mxClassID get_class_id (void) const |
609 { | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
610 m_id = mxUNKNOWN_CLASS; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
611 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
612 std::string cn = m_val.class_name (); |
5900 | 613 |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
614 if (cn == "double") |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
615 m_id = mxDOUBLE_CLASS; |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
616 else if (cn == "single") |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
617 m_id = mxSINGLE_CLASS; |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
618 else if (cn == "char") |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
619 m_id = mxCHAR_CLASS; |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
620 else if (cn == "logical") |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
621 m_id = mxLOGICAL_CLASS; |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
622 else if (cn == "cell") |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
623 m_id = mxCELL_CLASS; |
5900 | 624 else if (cn == "struct") |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
625 m_id = mxSTRUCT_CLASS; |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
626 else if (cn == "function_handle") |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
627 m_id = mxFUNCTION_CLASS; |
5900 | 628 else if (cn == "int8") |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
629 m_id = mxINT8_CLASS; |
5900 | 630 else if (cn == "uint8") |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
631 m_id = mxUINT8_CLASS; |
5900 | 632 else if (cn == "int16") |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
633 m_id = mxINT16_CLASS; |
5900 | 634 else if (cn == "uint16") |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
635 m_id = mxUINT16_CLASS; |
5900 | 636 else if (cn == "int32") |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
637 m_id = mxINT32_CLASS; |
5900 | 638 else if (cn == "uint32") |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
639 m_id = mxUINT32_CLASS; |
5900 | 640 else if (cn == "int64") |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
641 m_id = mxINT64_CLASS; |
5900 | 642 else if (cn == "uint64") |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
643 m_id = mxUINT64_CLASS; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
644 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
645 return m_id; |
5900 | 646 } |
647 | |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
648 const char * get_class_name (void) const |
5900 | 649 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
650 if (! m_class_name) |
5900 | 651 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
652 std::string s = m_val.class_name (); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
653 m_class_name = mxArray::strsave (s.c_str ()); |
5900 | 654 } |
655 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
656 return m_class_name; |
5900 | 657 } |
658 | |
659 // Not allowed. | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
660 VOID_MUTATION_METHOD (set_class_name, (const char *)) |
5900 | 661 |
23893
75eff5b667b3
new mxSetProperty function for MEX API
John W. Eaton <jwe@octave.org>
parents:
23891
diff
changeset
|
662 mxArray * get_property (mwIndex idx, const char *pname) const |
23884
bd9e719f04cc
new mxGetProperty function for MEX API
Piotr Held <pjheld@gmail.com>
parents:
23795
diff
changeset
|
663 { |
bd9e719f04cc
new mxGetProperty function for MEX API
Piotr Held <pjheld@gmail.com>
parents:
23795
diff
changeset
|
664 mxArray *retval = nullptr; |
bd9e719f04cc
new mxGetProperty function for MEX API
Piotr Held <pjheld@gmail.com>
parents:
23795
diff
changeset
|
665 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
666 if (m_val.is_classdef_object ()) |
23884
bd9e719f04cc
new mxGetProperty function for MEX API
Piotr Held <pjheld@gmail.com>
parents:
23795
diff
changeset
|
667 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
668 octave_classdef *ov_cdef = m_val.classdef_object_value (); |
23884
bd9e719f04cc
new mxGetProperty function for MEX API
Piotr Held <pjheld@gmail.com>
parents:
23795
diff
changeset
|
669 |
bd9e719f04cc
new mxGetProperty function for MEX API
Piotr Held <pjheld@gmail.com>
parents:
23795
diff
changeset
|
670 if (ov_cdef) |
bd9e719f04cc
new mxGetProperty function for MEX API
Piotr Held <pjheld@gmail.com>
parents:
23795
diff
changeset
|
671 { |
23893
75eff5b667b3
new mxSetProperty function for MEX API
John W. Eaton <jwe@octave.org>
parents:
23891
diff
changeset
|
672 octave_value pval = ov_cdef->get_property (idx, pname); |
75eff5b667b3
new mxSetProperty function for MEX API
John W. Eaton <jwe@octave.org>
parents:
23891
diff
changeset
|
673 |
23898
a490e729f2f2
correctly return NULL for unknown properties in mxGetProperty (bug #51725)
John W. Eaton <jwe@octave.org>
parents:
23893
diff
changeset
|
674 if (pval.is_defined()) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
675 retval = new mxArray (m_interleaved, pval); |
23884
bd9e719f04cc
new mxGetProperty function for MEX API
Piotr Held <pjheld@gmail.com>
parents:
23795
diff
changeset
|
676 } |
bd9e719f04cc
new mxGetProperty function for MEX API
Piotr Held <pjheld@gmail.com>
parents:
23795
diff
changeset
|
677 } |
bd9e719f04cc
new mxGetProperty function for MEX API
Piotr Held <pjheld@gmail.com>
parents:
23795
diff
changeset
|
678 |
bd9e719f04cc
new mxGetProperty function for MEX API
Piotr Held <pjheld@gmail.com>
parents:
23795
diff
changeset
|
679 return retval; |
bd9e719f04cc
new mxGetProperty function for MEX API
Piotr Held <pjheld@gmail.com>
parents:
23795
diff
changeset
|
680 } |
bd9e719f04cc
new mxGetProperty function for MEX API
Piotr Held <pjheld@gmail.com>
parents:
23795
diff
changeset
|
681 |
23893
75eff5b667b3
new mxSetProperty function for MEX API
John W. Eaton <jwe@octave.org>
parents:
23891
diff
changeset
|
682 void set_property (mwIndex idx, const char *pname, const mxArray *pval) |
75eff5b667b3
new mxSetProperty function for MEX API
John W. Eaton <jwe@octave.org>
parents:
23891
diff
changeset
|
683 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
684 if (m_val.is_classdef_object ()) |
23893
75eff5b667b3
new mxSetProperty function for MEX API
John W. Eaton <jwe@octave.org>
parents:
23891
diff
changeset
|
685 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
686 octave_classdef *ov_cdef = m_val.classdef_object_value (); |
23893
75eff5b667b3
new mxSetProperty function for MEX API
John W. Eaton <jwe@octave.org>
parents:
23891
diff
changeset
|
687 |
75eff5b667b3
new mxSetProperty function for MEX API
John W. Eaton <jwe@octave.org>
parents:
23891
diff
changeset
|
688 if (ov_cdef) |
75eff5b667b3
new mxSetProperty function for MEX API
John W. Eaton <jwe@octave.org>
parents:
23891
diff
changeset
|
689 ov_cdef->set_property (idx, pname, pval->as_octave_value ()); |
75eff5b667b3
new mxSetProperty function for MEX API
John W. Eaton <jwe@octave.org>
parents:
23891
diff
changeset
|
690 } |
75eff5b667b3
new mxSetProperty function for MEX API
John W. Eaton <jwe@octave.org>
parents:
23891
diff
changeset
|
691 else |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
692 err_invalid_type ("set_property"); |
23893
75eff5b667b3
new mxSetProperty function for MEX API
John W. Eaton <jwe@octave.org>
parents:
23891
diff
changeset
|
693 } |
75eff5b667b3
new mxSetProperty function for MEX API
John W. Eaton <jwe@octave.org>
parents:
23891
diff
changeset
|
694 |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
695 CONST_MUTATION_METHOD (mxArray *, get_cell, (mwIndex), nullptr) |
5900 | 696 |
697 // Not allowed. | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
698 VOID_MUTATION_METHOD (set_cell, (mwIndex, mxArray *)) |
5900 | 699 |
22480
9263b2889003
Change mxGetScalar to return the first non-zero element of sparse array.
Rik <rik@octave.org>
parents:
22471
diff
changeset
|
700 double get_scalar (void) const |
9263b2889003
Change mxGetScalar to return the first non-zero element of sparse array.
Rik <rik@octave.org>
parents:
22471
diff
changeset
|
701 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
702 if (m_val.issparse ()) |
22480
9263b2889003
Change mxGetScalar to return the first non-zero element of sparse array.
Rik <rik@octave.org>
parents:
22471
diff
changeset
|
703 { |
22599
51b395d24782
maint: strip tabs and trailing whitespace from C++ sources.
John W. Eaton <jwe@octave.org>
parents:
22480
diff
changeset
|
704 // For sparse arrays, return the first non-zero value. |
30232
a2936935c7c8
attempt to limit possible const_cast damage
John W. Eaton <jwe@octave.org>
parents:
30227
diff
changeset
|
705 const void *m_data = m_val.mex_get_data (); |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
706 if (m_data == nullptr) |
22480
9263b2889003
Change mxGetScalar to return the first non-zero element of sparse array.
Rik <rik@octave.org>
parents:
22471
diff
changeset
|
707 return 0.0; |
9263b2889003
Change mxGetScalar to return the first non-zero element of sparse array.
Rik <rik@octave.org>
parents:
22471
diff
changeset
|
708 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
709 if (m_val.islogical ()) |
30232
a2936935c7c8
attempt to limit possible const_cast damage
John W. Eaton <jwe@octave.org>
parents:
30227
diff
changeset
|
710 return *static_cast<const bool *> (m_data); |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
711 else if (m_val.isreal ()) |
30232
a2936935c7c8
attempt to limit possible const_cast damage
John W. Eaton <jwe@octave.org>
parents:
30227
diff
changeset
|
712 return *static_cast<const double *> (m_data); |
22480
9263b2889003
Change mxGetScalar to return the first non-zero element of sparse array.
Rik <rik@octave.org>
parents:
22471
diff
changeset
|
713 else // Complex type, only return real part |
30232
a2936935c7c8
attempt to limit possible const_cast damage
John W. Eaton <jwe@octave.org>
parents:
30227
diff
changeset
|
714 return *static_cast<const double *> (m_data); |
22480
9263b2889003
Change mxGetScalar to return the first non-zero element of sparse array.
Rik <rik@octave.org>
parents:
22471
diff
changeset
|
715 } |
9263b2889003
Change mxGetScalar to return the first non-zero element of sparse array.
Rik <rik@octave.org>
parents:
22471
diff
changeset
|
716 else |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
717 return m_val.scalar_value (true); |
22480
9263b2889003
Change mxGetScalar to return the first non-zero element of sparse array.
Rik <rik@octave.org>
parents:
22471
diff
changeset
|
718 } |
6332 | 719 |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
720 void * get_data (void) const |
5900 | 721 { |
30232
a2936935c7c8
attempt to limit possible const_cast damage
John W. Eaton <jwe@octave.org>
parents:
30227
diff
changeset
|
722 // Casting away const required for MEX interface. |
a2936935c7c8
attempt to limit possible const_cast damage
John W. Eaton <jwe@octave.org>
parents:
30227
diff
changeset
|
723 |
a2936935c7c8
attempt to limit possible const_cast damage
John W. Eaton <jwe@octave.org>
parents:
30227
diff
changeset
|
724 void *retval = const_cast<void *> (m_val.mex_get_data ()); |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
725 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
726 if (retval && (m_val.isreal () || m_interleaved)) |
29870
79fe39e852db
mxArray_octave_value::get_data: fix mutation for non-interleaved complex data
John W. Eaton <jwe@octave.org>
parents:
29869
diff
changeset
|
727 { |
79fe39e852db
mxArray_octave_value::get_data: fix mutation for non-interleaved complex data
John W. Eaton <jwe@octave.org>
parents:
29869
diff
changeset
|
728 maybe_mark_foreign (retval); |
79fe39e852db
mxArray_octave_value::get_data: fix mutation for non-interleaved complex data
John W. Eaton <jwe@octave.org>
parents:
29869
diff
changeset
|
729 return retval; |
79fe39e852db
mxArray_octave_value::get_data: fix mutation for non-interleaved complex data
John W. Eaton <jwe@octave.org>
parents:
29869
diff
changeset
|
730 } |
79fe39e852db
mxArray_octave_value::get_data: fix mutation for non-interleaved complex data
John W. Eaton <jwe@octave.org>
parents:
29869
diff
changeset
|
731 |
79fe39e852db
mxArray_octave_value::get_data: fix mutation for non-interleaved complex data
John W. Eaton <jwe@octave.org>
parents:
29869
diff
changeset
|
732 request_mutation (); |
79fe39e852db
mxArray_octave_value::get_data: fix mutation for non-interleaved complex data
John W. Eaton <jwe@octave.org>
parents:
29869
diff
changeset
|
733 return nullptr; |
5900 | 734 } |
735 | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
736 template <typename T> |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
737 T * get_data (mxClassID class_id, mxComplexity complexity) const |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
738 { |
30232
a2936935c7c8
attempt to limit possible const_cast damage
John W. Eaton <jwe@octave.org>
parents:
30227
diff
changeset
|
739 // Casting away const required for MEX interface. |
a2936935c7c8
attempt to limit possible const_cast damage
John W. Eaton <jwe@octave.org>
parents:
30227
diff
changeset
|
740 |
a2936935c7c8
attempt to limit possible const_cast damage
John W. Eaton <jwe@octave.org>
parents:
30227
diff
changeset
|
741 void *ptr = const_cast<void *> (m_val.mex_get_data (class_id, complexity)); |
a2936935c7c8
attempt to limit possible const_cast damage
John W. Eaton <jwe@octave.org>
parents:
30227
diff
changeset
|
742 |
a2936935c7c8
attempt to limit possible const_cast damage
John W. Eaton <jwe@octave.org>
parents:
30227
diff
changeset
|
743 T *retval = static_cast<T *> (ptr); |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
744 |
29869
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
745 if (retval && (complexity == mxREAL || m_interleaved)) |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
746 { |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
747 maybe_mark_foreign (retval); |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
748 return retval; |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
749 } |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
750 |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
751 request_mutation (); |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
752 return nullptr; |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
753 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
754 |
29869
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
755 GET_DATA_METHOD (mxDouble, get_doubles, mxDOUBLE_CLASS, mxREAL); |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
756 |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
757 GET_DATA_METHOD (mxSingle, get_singles, mxSINGLE_CLASS, mxREAL); |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
758 |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
759 GET_DATA_METHOD (mxInt8, get_int8s, mxINT8_CLASS, mxREAL); |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
760 |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
761 GET_DATA_METHOD (mxInt16, get_int16s, mxINT16_CLASS, mxREAL); |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
762 |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
763 GET_DATA_METHOD (mxInt32, get_int32s, mxINT32_CLASS, mxREAL); |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
764 |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
765 GET_DATA_METHOD (mxInt64, get_int64s, mxINT64_CLASS, mxREAL); |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
766 |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
767 GET_DATA_METHOD (mxUint8, get_uint8s, mxUINT8_CLASS, mxREAL); |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
768 |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
769 GET_DATA_METHOD (mxUint16, get_uint16s, mxUINT16_CLASS, mxREAL); |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
770 |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
771 GET_DATA_METHOD (mxUint32, get_uint32s, mxUINT32_CLASS, mxREAL); |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
772 |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
773 GET_DATA_METHOD (mxUint64, get_uint64s, mxUINT64_CLASS, mxREAL); |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
774 |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
775 GET_DATA_METHOD (mxComplexDouble, get_complex_doubles, mxDOUBLE_CLASS, mxCOMPLEX); |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
776 |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
777 GET_DATA_METHOD (mxComplexSingle, get_complex_singles, mxDOUBLE_CLASS, mxCOMPLEX); |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
778 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
779 #if 0 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
780 /* We don't have these yet. */ |
29869
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
781 GET_DATA_METHOD (mxComplexInt8 *, get_complex_int8s, (void), nullptr); |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
782 |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
783 GET_DATA_METHOD (mxComplexInt16 *, get_complex_int16s, (void), nullptr); |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
784 |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
785 GET_DATA_METHOD (mxComplexInt32 *, get_complex_int32s, (void), nullptr); |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
786 |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
787 GET_DATA_METHOD (mxComplexInt64 *, get_complex_int64s, (void), nullptr); |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
788 |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
789 GET_DATA_METHOD (mxComplexUint8 *, get_complex_uint8s, (void), nullptr); |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
790 |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
791 GET_DATA_METHOD (mxComplexUint16 *, get_complex_uint16s, (void), nullptr); |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
792 |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
793 GET_DATA_METHOD (mxComplexUint32 *, get_complex_uint32s, (void), nullptr); |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
794 |
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
795 GET_DATA_METHOD (mxComplexUint64 *, get_complex_uint64s, (void), nullptr); |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
796 #endif |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
797 |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
798 void * get_imag_data (void) const |
5900 | 799 { |
23457
21baad6b35c4
maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents:
23455
diff
changeset
|
800 void *retval = nullptr; |
5900 | 801 |
23582
0cc2011d800e
maint: Deprecate is_real_type and replace with isreal.
Rik <rik@octave.org>
parents:
23581
diff
changeset
|
802 if (is_numeric () && isreal ()) |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23703
diff
changeset
|
803 retval = nullptr; |
5900 | 804 else |
805 request_mutation (); | |
806 | |
807 return retval; | |
808 } | |
809 | |
810 // Not allowed. | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
811 VOID_MUTATION_METHOD (set_data, (void *)) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
812 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
813 MUTATION_METHOD (int, set_doubles, (mxDouble *), 0) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
814 MUTATION_METHOD (int, set_singles, (mxSingle *), 0) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
815 MUTATION_METHOD (int, set_int8s, (mxInt8 *), 0) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
816 MUTATION_METHOD (int, set_int16s, (mxInt16 *), 0) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
817 MUTATION_METHOD (int, set_int32s, (mxInt32 *), 0) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
818 MUTATION_METHOD (int, set_int64s, (mxInt64 *), 0) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
819 MUTATION_METHOD (int, set_uint8s, (mxUint8 *), 0) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
820 MUTATION_METHOD (int, set_uint16s, (mxUint16 *), 0) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
821 MUTATION_METHOD (int, set_uint32s, (mxUint32 *), 0) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
822 MUTATION_METHOD (int, set_uint64s, (mxUint64 *), 0) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
823 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
824 MUTATION_METHOD (int, set_complex_doubles, (mxComplexDouble *), 0) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
825 MUTATION_METHOD (int, set_complex_singles, (mxComplexSingle *), 0) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
826 #if 0 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
827 /* We don't have these yet. */ |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
828 MUTATION_METHOD (int, set_complex_int8s, (mxComplexInt8 *), 0) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
829 MUTATION_METHOD (int, set_complex_int16s, (mxComplexInt16 *), 0) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
830 MUTATION_METHOD (int, set_complex_int32s, (mxComplexInt32 *), 0) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
831 MUTATION_METHOD (int, set_complex_int64s, (mxComplexInt64 *), 0) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
832 MUTATION_METHOD (int, set_complex_uint8s, (mxComplexUint8 *), 0) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
833 MUTATION_METHOD (int, set_complex_uint16s, (mxComplexUint16 *), 0) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
834 MUTATION_METHOD (int, set_complex_uint32s, (mxComplexUint32 *), 0) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
835 MUTATION_METHOD (int, set_complex_uint64s, (mxComplexUint64 *), 0) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
836 #endif |
5900 | 837 |
838 // Not allowed. | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
839 VOID_MUTATION_METHOD (set_imag_data, (void *)) |
5900 | 840 |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
841 mwIndex * get_ir (void) const |
5900 | 842 { |
30232
a2936935c7c8
attempt to limit possible const_cast damage
John W. Eaton <jwe@octave.org>
parents:
30227
diff
changeset
|
843 // Casting away const required for MEX interface. |
a2936935c7c8
attempt to limit possible const_cast damage
John W. Eaton <jwe@octave.org>
parents:
30227
diff
changeset
|
844 |
a2936935c7c8
attempt to limit possible const_cast damage
John W. Eaton <jwe@octave.org>
parents:
30227
diff
changeset
|
845 octave_idx_type *ptr = const_cast<octave_idx_type *> (m_val.mex_get_ir ()); |
a2936935c7c8
attempt to limit possible const_cast damage
John W. Eaton <jwe@octave.org>
parents:
30227
diff
changeset
|
846 return static_cast<mwIndex *> (maybe_mark_foreign (ptr)); |
5900 | 847 } |
848 | |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
849 mwIndex * get_jc (void) const |
5900 | 850 { |
30232
a2936935c7c8
attempt to limit possible const_cast damage
John W. Eaton <jwe@octave.org>
parents:
30227
diff
changeset
|
851 // Casting away const required for MEX interface. |
a2936935c7c8
attempt to limit possible const_cast damage
John W. Eaton <jwe@octave.org>
parents:
30227
diff
changeset
|
852 |
a2936935c7c8
attempt to limit possible const_cast damage
John W. Eaton <jwe@octave.org>
parents:
30227
diff
changeset
|
853 octave_idx_type *ptr = const_cast<octave_idx_type *> (m_val.mex_get_jc ()); |
a2936935c7c8
attempt to limit possible const_cast damage
John W. Eaton <jwe@octave.org>
parents:
30227
diff
changeset
|
854 return static_cast<mwIndex *> (maybe_mark_foreign (ptr)); |
5900 | 855 } |
856 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
857 mwSize get_nzmax (void) const { return m_val.nzmax (); } |
5900 | 858 |
859 // Not allowed. | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
860 VOID_MUTATION_METHOD (set_ir, (mwIndex *)) |
5900 | 861 |
862 // Not allowed. | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
863 VOID_MUTATION_METHOD (set_jc, (mwIndex *)) |
5900 | 864 |
865 // Not allowed. | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
866 VOID_MUTATION_METHOD (set_nzmax, (mwSize)) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
867 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
868 // Not allowed. |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
869 MUTATION_METHOD (int, add_field, (const char *), 0) |
5900 | 870 |
871 // Not allowed. | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
872 VOID_MUTATION_METHOD (remove_field, (int)) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
873 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
874 CONST_MUTATION_METHOD (mxArray *, get_field_by_number, (mwIndex, int), nullptr) |
5900 | 875 |
876 // Not allowed. | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
877 VOID_MUTATION_METHOD (set_field_by_number, (mwIndex, int, mxArray *)) |
5900 | 878 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
879 int get_number_of_fields (void) const { return m_val.nfields (); } |
5900 | 880 |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
881 CONST_MUTATION_METHOD (const char *, get_field_name_by_number, (int), nullptr) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
882 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
883 CONST_MUTATION_METHOD (int, get_field_number, (const char *), 0) |
5900 | 884 |
6686 | 885 int get_string (char *buf, mwSize buflen) const |
5900 | 886 { |
887 int retval = 1; | |
888 | |
6686 | 889 mwSize nel = get_number_of_elements (); |
5900 | 890 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
891 if (m_val.is_string () && nel < buflen) |
5900 | 892 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
893 charNDArray tmp = m_val.char_array_value (); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
894 |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
895 const char *p = tmp.data (); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
896 |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
897 for (mwIndex i = 0; i < nel; i++) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
898 buf[i] = p[i]; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
899 |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
900 buf[nel] = 0; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
901 |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
902 retval = 0; |
5900 | 903 } |
904 | |
905 return retval; | |
906 } | |
907 | |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
908 char * array_to_string (void) const |
5900 | 909 { |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
910 // FIXME: this is supposed to handle multi-byte character strings. |
5900 | 911 |
23457
21baad6b35c4
maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents:
23455
diff
changeset
|
912 char *buf = nullptr; |
5900 | 913 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
914 if (m_val.is_string ()) |
5900 | 915 { |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
916 mwSize nel = get_number_of_elements (); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
917 |
15354
93dff6435fe1
tag calls to mxArray::malloc, mxArray::calloc, and mxArray::strsave with class name
John W. Eaton <jwe@octave.org>
parents:
15353
diff
changeset
|
918 buf = static_cast<char *> (mxArray::malloc (nel + 1)); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
919 |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
920 if (buf) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
921 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
922 charNDArray tmp = m_val.char_array_value (); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
923 |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
924 const char *p = tmp.data (); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
925 |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
926 for (mwIndex i = 0; i < nel; i++) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
927 buf[i] = p[i]; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
928 |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
929 buf[nel] = '\0'; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
930 } |
5900 | 931 } |
932 | |
933 return buf; | |
934 } | |
935 | |
6686 | 936 mwIndex calc_single_subscript (mwSize nsubs, mwIndex *subs) const |
5900 | 937 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
938 // Force m_ndims, n_dims to be cached. |
5900 | 939 get_dimensions (); |
940 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
941 return calc_single_subscript_internal (m_ndims, m_dims, nsubs, subs); |
5900 | 942 } |
943 | |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
944 std::size_t get_element_size (void) const |
5900 | 945 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
946 // Force m_id to be cached. |
5900 | 947 get_class_id (); |
948 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
949 switch (m_id) |
5900 | 950 { |
951 case mxCELL_CLASS: return sizeof (mxArray *); | |
952 case mxSTRUCT_CLASS: return sizeof (mxArray *); | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
953 case mxLOGICAL_CLASS: return sizeof (mxLogical); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
954 case mxCHAR_CLASS: return sizeof (mxChar); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
955 case mxDOUBLE_CLASS: return get_numeric_element_size (sizeof (mxDouble)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
956 case mxSINGLE_CLASS: return get_numeric_element_size (sizeof (mxSingle)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
957 case mxINT8_CLASS: return get_numeric_element_size (sizeof (mxInt8)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
958 case mxUINT8_CLASS: return get_numeric_element_size (sizeof (mxUint8)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
959 case mxINT16_CLASS: return get_numeric_element_size (sizeof (mxInt16)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
960 case mxUINT16_CLASS: return get_numeric_element_size (sizeof (mxUint16)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
961 case mxINT32_CLASS: return get_numeric_element_size (sizeof (mxInt32)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
962 case mxUINT32_CLASS: return get_numeric_element_size (sizeof (mxUint32)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
963 case mxINT64_CLASS: return get_numeric_element_size (sizeof (mxInt64)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
964 case mxUINT64_CLASS: return get_numeric_element_size (sizeof (mxUint64)); |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
965 case mxFUNCTION_CLASS: return 0; |
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
966 // FIXME: user-defined objects need their own class ID. |
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
967 // What should they return, size of pointer? |
5900 | 968 default: return 0; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
969 } |
5900 | 970 } |
971 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
972 bool mutation_needed (void) const { return m_mutate_flag; } |
5900 | 973 |
974 void request_mutation (void) const | |
975 { | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
976 if (m_mutate_flag) |
5900 | 977 panic_impossible (); |
978 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
979 m_mutate_flag = true; |
5900 | 980 } |
981 | |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
982 mxArray * mutate (void) const { return as_mxArray (); } |
5900 | 983 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
984 octave_value as_octave_value (void) const { return m_val; } |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
985 |
5900 | 986 protected: |
987 | |
988 mxArray_octave_value (const mxArray_octave_value& arg) | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
989 : mxArray_base (arg), m_val (arg.m_val), m_mutate_flag (arg.m_mutate_flag), |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
990 m_id (arg.m_id), m_class_name (mxArray::strsave (arg.m_class_name)), |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
991 m_ndims (arg.m_ndims), |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
992 m_dims (m_ndims > 0 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
993 ? static_cast<mwSize *> (mxArray::malloc (m_ndims * sizeof (mwSize))) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
994 : nullptr) |
5900 | 995 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
996 if (m_dims) |
5900 | 997 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
998 for (mwIndex i = 0; i < m_ndims; i++) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
999 m_dims[i] = arg.m_dims[i]; |
5900 | 1000 } |
1001 } | |
1002 | |
1003 private: | |
1004 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1005 octave_value m_val; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1006 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1007 mutable bool m_mutate_flag; |
5900 | 1008 |
1009 // Caching these does not cost much or lead to much duplicated | |
1010 // code. For other things, we just request mutation to a | |
1011 // Matlab-style mxArray object. | |
1012 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1013 mutable mxClassID m_id; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1014 mutable char *m_class_name; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1015 mutable mwSize m_ndims; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1016 mutable mwSize *m_dims; |
5900 | 1017 }; |
1018 | |
1019 // The base class for the Matlab-style representation, used to handle | |
1020 // things that are common to all Matlab-style objects. | |
1021 | |
1022 class mxArray_matlab : public mxArray_base | |
1023 { | |
1024 public: | |
1025 | |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
1026 // No assignment! |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
1027 // FIXME: should this be implemented? |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
1028 // Note that we *do* have a copy constructor. |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
1029 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
1030 mxArray_matlab& operator = (const mxArray_matlab&); |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
1031 |
5900 | 1032 ~mxArray_matlab (void) |
1033 { | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1034 mxFree (m_class_name); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1035 mxFree (m_dims); |
5900 | 1036 } |
1037 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1038 int iscell (void) const { return m_id == mxCELL_CLASS; } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1039 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1040 int is_char (void) const { return m_id == mxCHAR_CLASS; } |
5900 | 1041 |
1042 int is_complex (void) const { return 0; } | |
1043 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1044 int is_double (void) const { return m_id == mxDOUBLE_CLASS; } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1045 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1046 int is_function_handle (void) const { return m_id == mxFUNCTION_CLASS; } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1047 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1048 int is_int16 (void) const { return m_id == mxINT16_CLASS; } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1049 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1050 int is_int32 (void) const { return m_id == mxINT32_CLASS; } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1051 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1052 int is_int64 (void) const { return m_id == mxINT64_CLASS; } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1053 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1054 int is_int8 (void) const { return m_id == mxINT8_CLASS; } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1055 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1056 int is_logical (void) const { return m_id == mxLOGICAL_CLASS; } |
5900 | 1057 |
1058 int is_numeric (void) const | |
1059 { | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1060 return (m_id == mxDOUBLE_CLASS || m_id == mxSINGLE_CLASS |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1061 || m_id == mxINT8_CLASS || m_id == mxUINT8_CLASS |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1062 || m_id == mxINT16_CLASS || m_id == mxUINT16_CLASS |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1063 || m_id == mxINT32_CLASS || m_id == mxUINT32_CLASS |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1064 || m_id == mxINT64_CLASS || m_id == mxUINT64_CLASS); |
5900 | 1065 } |
1066 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1067 int is_single (void) const { return m_id == mxSINGLE_CLASS; } |
5900 | 1068 |
1069 int is_sparse (void) const { return 0; } | |
1070 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1071 int is_struct (void) const { return m_id == mxSTRUCT_CLASS; } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1072 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1073 int is_uint16 (void) const { return m_id == mxUINT16_CLASS; } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1074 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1075 int is_uint32 (void) const { return m_id == mxUINT32_CLASS; } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1076 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1077 int is_uint64 (void) const { return m_id == mxUINT64_CLASS; } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1078 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1079 int is_uint8 (void) const { return m_id == mxUINT8_CLASS; } |
5900 | 1080 |
1081 int is_logical_scalar_true (void) const | |
1082 { | |
1083 return (is_logical_scalar () | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
1084 && static_cast<mxLogical *> (get_data ())[0] != 0); |
5900 | 1085 } |
1086 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1087 mwSize get_m (void) const { return m_dims[0]; } |
6686 | 1088 |
1089 mwSize get_n (void) const | |
6187 | 1090 { |
6686 | 1091 mwSize n = 1; |
1092 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1093 for (mwSize i = m_ndims - 1 ; i > 0 ; i--) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1094 n *= m_dims[i]; |
6187 | 1095 |
1096 return n; | |
1097 } | |
5900 | 1098 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1099 mwSize * get_dimensions (void) const { return m_dims; } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1100 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1101 mwSize get_number_of_dimensions (void) const { return m_ndims; } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1102 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1103 void set_m (mwSize m) { m_dims[0] = m; } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1104 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1105 void set_n (mwSize n) { m_dims[1] = n; } |
6686 | 1106 |
30213
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
1107 int set_dimensions (mwSize *dims, mwSize ndims) |
5900 | 1108 { |
30213
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
1109 m_ndims = ndims; |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1110 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1111 mxFree (m_dims); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1112 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1113 if (m_ndims > 0) |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
1114 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1115 m_dims |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1116 = static_cast<mwSize *> (mxArray::malloc (m_ndims * sizeof (mwSize))); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1117 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1118 if (m_dims == nullptr) |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
1119 return 1; |
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
1120 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1121 for (int i = 0; i < m_ndims; i++) |
30213
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
1122 m_dims[i] = dims[i]; |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
1123 |
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
1124 return 0; |
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
1125 } |
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
1126 else |
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
1127 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1128 m_dims = nullptr; |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
1129 return 0; |
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
1130 } |
5900 | 1131 } |
1132 | |
6686 | 1133 mwSize get_number_of_elements (void) const |
5900 | 1134 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1135 mwSize retval = m_dims[0]; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1136 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1137 for (mwIndex i = 1; i < m_ndims; i++) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1138 retval *= m_dims[i]; |
5900 | 1139 |
1140 return retval; | |
1141 } | |
1142 | |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23576
diff
changeset
|
1143 int isempty (void) const { return get_number_of_elements () == 0; } |
5900 | 1144 |
22462
6cb7813e5b2f
Add new mxIsScalar function for MEX API.
Rik <rik@octave.org>
parents:
22454
diff
changeset
|
1145 bool is_scalar (void) const |
6cb7813e5b2f
Add new mxIsScalar function for MEX API.
Rik <rik@octave.org>
parents:
22454
diff
changeset
|
1146 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1147 return m_ndims == 2 && m_dims[0] == 1 && m_dims[1] == 1; |
22462
6cb7813e5b2f
Add new mxIsScalar function for MEX API.
Rik <rik@octave.org>
parents:
22454
diff
changeset
|
1148 } |
6cb7813e5b2f
Add new mxIsScalar function for MEX API.
Rik <rik@octave.org>
parents:
22454
diff
changeset
|
1149 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1150 mxClassID get_class_id (void) const { return m_id; } |
5900 | 1151 |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
1152 const char * get_class_name (void) const |
5900 | 1153 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1154 switch (m_id) |
5900 | 1155 { |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
1156 case mxDOUBLE_CLASS: return "double"; |
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
1157 case mxSINGLE_CLASS: return "single"; |
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
1158 case mxCHAR_CLASS: return "char"; |
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
1159 case mxLOGICAL_CLASS: return "logical"; |
5900 | 1160 case mxCELL_CLASS: return "cell"; |
1161 case mxSTRUCT_CLASS: return "struct"; | |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
1162 case mxFUNCTION_CLASS: return "function_handle"; |
5900 | 1163 case mxINT8_CLASS: return "int8"; |
1164 case mxUINT8_CLASS: return "uint8"; | |
1165 case mxINT16_CLASS: return "int16"; | |
1166 case mxUINT16_CLASS: return "uint16"; | |
1167 case mxINT32_CLASS: return "int32"; | |
1168 case mxUINT32_CLASS: return "uint32"; | |
1169 case mxINT64_CLASS: return "int64"; | |
1170 case mxUINT64_CLASS: return "uint64"; | |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
1171 case mxUNKNOWN_CLASS: return "unknown"; |
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
1172 // FIXME: should return the classname of user-defined objects |
5900 | 1173 default: return "unknown"; |
1174 } | |
1175 } | |
1176 | |
30213
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
1177 void set_class_name (const char *name) |
5900 | 1178 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1179 mxFree (m_class_name); |
30213
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
1180 m_class_name = static_cast<char *> (mxArray::malloc (strlen (name) + 1)); |
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
1181 strcpy (m_class_name, name); |
5900 | 1182 } |
1183 | |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
1184 mxArray * get_cell (mwIndex /*idx*/) const |
5900 | 1185 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1186 err_invalid_type ("get_cell"); |
5900 | 1187 } |
1188 | |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
1189 void set_cell (mwIndex /*idx*/, mxArray * /*val*/) |
5900 | 1190 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1191 err_invalid_type ("set_cell"); |
5900 | 1192 } |
1193 | |
6332 | 1194 double get_scalar (void) const |
1195 { | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1196 err_invalid_type ("get_scalar"); |
6332 | 1197 } |
1198 | |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
1199 void * get_data (void) const |
5900 | 1200 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1201 err_invalid_type ("get_data"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1202 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1203 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1204 mxDouble * get_doubles (void) const |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1205 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1206 err_invalid_type ("get_doubles"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1207 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1208 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1209 mxSingle * get_singles (void) const |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1210 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1211 err_invalid_type ("get_singles"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1212 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1213 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1214 mxInt8 * get_int8s (void) const |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1215 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1216 err_invalid_type ("get_int8s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1217 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1218 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1219 mxInt16 * get_int16s (void) const |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1220 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1221 err_invalid_type ("get_int16s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1222 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1223 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1224 mxInt32 * get_int32s (void) const |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1225 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1226 err_invalid_type ("get_int32s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1227 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1228 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1229 mxInt64 * get_int64s (void) const |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1230 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1231 err_invalid_type ("get_int64s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1232 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1233 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1234 mxUint8 * get_uint8s (void) const |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1235 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1236 err_invalid_type ("get_uint8s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1237 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1238 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1239 mxUint16 * get_uint16s (void) const |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1240 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1241 err_invalid_type ("get_uint16s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1242 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1243 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1244 mxUint32 * get_uint32s (void) const |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1245 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1246 err_invalid_type ("get_uint32s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1247 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1248 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1249 mxUint64 * get_uint64s (void) const |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1250 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1251 err_invalid_type ("get_uint64s"); |
5900 | 1252 } |
1253 | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1254 mxComplexDouble * get_complex_doubles (void) const |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1255 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1256 err_invalid_type ("get_complex_doubles"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1257 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1258 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1259 mxComplexSingle * get_complex_singles (void) const |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1260 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1261 err_invalid_type ("get_complex_singles"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1262 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1263 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1264 #if 0 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1265 /* We don't have these yet. */ |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1266 mxComplexInt8 * get_complex_int8s (void) const |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1267 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1268 err_invalid_type ("get_complex_int8s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1269 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1270 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1271 mxComplexInt16 * get_complex_int16s (void) const |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1272 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1273 err_invalid_type ("get_complex_int16s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1274 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1275 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1276 mxComplexInt32 * get_complex_int32s (void) const |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1277 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1278 err_invalid_type ("get_complex_int32s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1279 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1280 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1281 mxComplexInt64 * get_complex_int64s (void) const |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1282 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1283 err_invalid_type ("get_complex_int64s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1284 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1285 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1286 mxComplexUint8 * get_complex_uint8s (void) const |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1287 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1288 err_invalid_type ("get_complex_uint8s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1289 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1290 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1291 mxComplexUint16 * get_complex_uint16s (void) const |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1292 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1293 err_invalid_type ("get_complex_uint16s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1294 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1295 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1296 mxComplexUint32 * get_complex_uint32s (void) const |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1297 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1298 err_invalid_type ("get_complex_uint32s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1299 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1300 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1301 mxComplexUint64 * get_complex_uint64s (void) const |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1302 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1303 err_invalid_type ("get_complex_uint64s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1304 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1305 #endif |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1306 |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
1307 void * get_imag_data (void) const |
5900 | 1308 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1309 err_invalid_type ("get_imag_data"); |
5900 | 1310 } |
1311 | |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
1312 void set_data (void * /*pr*/) |
5900 | 1313 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1314 err_invalid_type ("set_data"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1315 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1316 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1317 int set_doubles (mxDouble *) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1318 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1319 err_invalid_type ("set_doubles"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1320 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1321 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1322 int set_singles (mxSingle *) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1323 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1324 err_invalid_type ("set_singles"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1325 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1326 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1327 int set_int8s (mxInt8 *) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1328 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1329 err_invalid_type ("set_int8s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1330 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1331 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1332 int set_int16s (mxInt16 *) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1333 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1334 err_invalid_type ("set_int16s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1335 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1336 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1337 int set_int32s (mxInt32 *) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1338 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1339 err_invalid_type ("set_int32s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1340 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1341 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1342 int set_int64s (mxInt64 *) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1343 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1344 err_invalid_type ("set_int64s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1345 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1346 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1347 int set_uint8s (mxUint8 *) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1348 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1349 err_invalid_type ("set_uint8s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1350 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1351 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1352 int set_uint16s (mxUint16 *) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1353 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1354 err_invalid_type ("set_uint16s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1355 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1356 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1357 int set_uint32s (mxUint32 *) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1358 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1359 err_invalid_type ("set_uint32s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1360 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1361 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1362 int set_uint64s (mxUint64 *) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1363 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1364 err_invalid_type ("set_uint64s"); |
5900 | 1365 } |
1366 | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1367 int set_complex_doubles (mxComplexDouble *) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1368 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1369 err_invalid_type ("set_complex_doubles"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1370 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1371 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1372 int set_complex_singles (mxComplexSingle *) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1373 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1374 err_invalid_type ("set_complex_singles"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1375 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1376 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1377 #if 0 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1378 /* We don't have these yet. */ |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1379 int set_complex_int8s (mxComplexInt8 *) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1380 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1381 err_invalid_type ("set_complex_int8s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1382 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1383 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1384 int set_complex_int16s (mxComplexInt16 *) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1385 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1386 err_invalid_type ("set_complex_int16s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1387 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1388 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1389 int set_complex_int32s (mxComplexInt32 *) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1390 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1391 err_invalid_type ("set_complex_int32s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1392 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1393 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1394 int set_complex_int64s (mxComplexInt64 *) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1395 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1396 err_invalid_type ("set_complex_int64s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1397 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1398 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1399 int set_complex_uint8s (mxComplexUint8 *) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1400 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1401 err_invalid_type ("set_complex_uint8s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1402 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1403 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1404 int set_complex_uint16s (mxComplexUint16 *) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1405 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1406 err_invalid_type ("set_complex_uint16s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1407 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1408 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1409 int set_complex_uint32s (mxComplexUint32 *) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1410 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1411 err_invalid_type ("set_complex_uint32s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1412 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1413 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1414 int set_complex_uint64s (mxComplexUint64 *) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1415 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1416 err_invalid_type ("set_complex_uint64s"); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1417 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1418 #endif |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1419 |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
1420 void set_imag_data (void * /*pi*/) |
5900 | 1421 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1422 err_invalid_type ("set_imag_data"); |
5900 | 1423 } |
1424 | |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
1425 mwIndex * get_ir (void) const |
5900 | 1426 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1427 err_invalid_type ("get_ir"); |
5900 | 1428 } |
1429 | |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
1430 mwIndex * get_jc (void) const |
5900 | 1431 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1432 err_invalid_type ("get_jc"); |
5900 | 1433 } |
1434 | |
6686 | 1435 mwSize get_nzmax (void) const |
5900 | 1436 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1437 err_invalid_type ("get_nzmax"); |
5900 | 1438 } |
1439 | |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
1440 void set_ir (mwIndex * /*ir*/) |
5900 | 1441 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1442 err_invalid_type ("set_ir"); |
5900 | 1443 } |
1444 | |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
1445 void set_jc (mwIndex * /*jc*/) |
5900 | 1446 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1447 err_invalid_type ("set_jc"); |
5900 | 1448 } |
1449 | |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
1450 void set_nzmax (mwSize /*nzmax*/) |
5900 | 1451 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1452 err_invalid_type ("set_nzmax"); |
5900 | 1453 } |
1454 | |
22449
e337b8e3592c
Fix double free causing segfault in mxSetDimensions (bug #49010).
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
1455 int add_field (const char * /*key*/) |
5900 | 1456 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1457 err_invalid_type ("add_field"); |
5900 | 1458 } |
1459 | |
1460 void remove_field (int /*key_num*/) | |
1461 { | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1462 err_invalid_type ("remove_field"); |
5900 | 1463 } |
1464 | |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
1465 mxArray * get_field_by_number (mwIndex /*index*/, int /*key_num*/) const |
5900 | 1466 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1467 err_invalid_type ("get_field_by_number"); |
5900 | 1468 } |
1469 | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1470 void set_field_by_number (mwIndex /*index*/, int /*key_num*/, |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
1471 mxArray * /*val*/) |
5900 | 1472 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1473 err_invalid_type ("set_field_by_number"); |
5900 | 1474 } |
1475 | |
1476 int get_number_of_fields (void) const | |
1477 { | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1478 err_invalid_type ("get_number_of_fields"); |
5900 | 1479 } |
1480 | |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
1481 const char * get_field_name_by_number (int /*key_num*/) const |
5900 | 1482 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1483 err_invalid_type ("get_field_name_by_number"); |
5900 | 1484 } |
1485 | |
22449
e337b8e3592c
Fix double free causing segfault in mxSetDimensions (bug #49010).
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
1486 int get_field_number (const char * /*key*/) const |
5900 | 1487 { |
1488 return -1; | |
1489 } | |
1490 | |
22449
e337b8e3592c
Fix double free causing segfault in mxSetDimensions (bug #49010).
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
1491 int get_string (char * /*buf*/, mwSize /*buflen*/) const |
5900 | 1492 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1493 err_invalid_type ("get_string"); |
5900 | 1494 } |
1495 | |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
1496 char * array_to_string (void) const |
5900 | 1497 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1498 err_invalid_type ("array_to_string"); |
5900 | 1499 } |
1500 | |
6686 | 1501 mwIndex calc_single_subscript (mwSize nsubs, mwIndex *subs) const |
5900 | 1502 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1503 return calc_single_subscript_internal (m_ndims, m_dims, nsubs, subs); |
5900 | 1504 } |
1505 | |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
1506 std::size_t get_element_size (void) const |
5900 | 1507 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1508 switch (m_id) |
5900 | 1509 { |
1510 case mxCELL_CLASS: return sizeof (mxArray *); | |
1511 case mxSTRUCT_CLASS: return sizeof (mxArray *); | |
1512 case mxLOGICAL_CLASS: return sizeof (mxLogical); | |
1513 case mxCHAR_CLASS: return sizeof (mxChar); | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1514 case mxDOUBLE_CLASS: return get_numeric_element_size (sizeof (mxDouble)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1515 case mxSINGLE_CLASS: return get_numeric_element_size (sizeof (mxSingle)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1516 case mxINT8_CLASS: return get_numeric_element_size (sizeof (mxInt8)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1517 case mxUINT8_CLASS: return get_numeric_element_size (sizeof (mxUint8)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1518 case mxINT16_CLASS: return get_numeric_element_size (sizeof (mxInt16)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1519 case mxUINT16_CLASS: return get_numeric_element_size (sizeof (mxUint16)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1520 case mxINT32_CLASS: return get_numeric_element_size (sizeof (mxInt32)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1521 case mxUINT32_CLASS: return get_numeric_element_size (sizeof (mxUint32)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1522 case mxINT64_CLASS: return get_numeric_element_size (sizeof (mxInt64)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1523 case mxUINT64_CLASS: return get_numeric_element_size (sizeof (mxUint64)); |
5900 | 1524 case mxFUNCTION_CLASS: return 0; |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
1525 // FIXME: user-defined objects need their own class ID. |
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
1526 // What should they return, size of pointer? |
5900 | 1527 default: return 0; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
1528 } |
5900 | 1529 } |
1530 | |
1531 protected: | |
1532 | |
30213
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
1533 mxArray_matlab (bool interleaved, mxClassID id = mxUNKNOWN_CLASS) |
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
1534 : mxArray_base (interleaved), m_class_name (nullptr), m_id (id), m_ndims (0), |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1535 m_dims (nullptr) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1536 { } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1537 |
30213
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
1538 mxArray_matlab (bool interleaved, mxClassID id, mwSize ndims, |
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
1539 const mwSize *dims) |
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
1540 : mxArray_base (interleaved), m_class_name (nullptr), m_id (id), |
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
1541 m_ndims (ndims < 2 ? 2 : ndims), |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1542 m_dims (static_cast<mwSize *> (mxArray::malloc (m_ndims * sizeof (mwSize)))) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1543 { |
30213
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
1544 if (ndims == 0) |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1545 { |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1546 m_dims[0] = 0; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1547 m_dims[1] = 0; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1548 } |
30213
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
1549 else if (ndims < 2) |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1550 { |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1551 m_dims[0] = 1; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1552 m_dims[1] = 1; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1553 } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1554 |
30213
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
1555 for (mwIndex i = 0; i < ndims; i++) |
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
1556 m_dims[i] = dims[i]; |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1557 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1558 for (mwIndex i = m_ndims - 1; i > 1; i--) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1559 { |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1560 if (m_dims[i] == 1) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1561 m_ndims--; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1562 else |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1563 break; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1564 } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1565 } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1566 |
30213
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
1567 mxArray_matlab (bool interleaved, mxClassID id, const dim_vector& dv) |
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
1568 : mxArray_base (interleaved), m_class_name (nullptr), m_id (id), |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1569 m_ndims (dv.ndims ()), |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1570 m_dims (static_cast<mwSize *> (mxArray::malloc (m_ndims * sizeof (mwSize)))) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1571 { |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1572 for (mwIndex i = 0; i < m_ndims; i++) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1573 m_dims[i] = dv(i); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1574 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1575 for (mwIndex i = m_ndims - 1; i > 1; i--) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1576 { |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1577 if (m_dims[i] == 1) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1578 m_ndims--; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1579 else |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1580 break; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1581 } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1582 } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1583 |
30213
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
1584 mxArray_matlab (bool interleaved, mxClassID id, mwSize m, mwSize n) |
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
1585 : mxArray_base (interleaved), m_class_name (nullptr), m_id (id), m_ndims (2), |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1586 m_dims (static_cast<mwSize *> (mxArray::malloc (m_ndims * sizeof (mwSize)))) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1587 { |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1588 m_dims[0] = m; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1589 m_dims[1] = n; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1590 } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1591 |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
1592 mxArray_matlab (const mxArray_matlab& val) |
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
1593 : mxArray_base (val), m_class_name (mxArray::strsave (val.m_class_name)), |
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
1594 m_id (val.m_id), m_ndims (val.m_ndims), |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1595 m_dims (static_cast<mwSize *> (mxArray::malloc (m_ndims * sizeof (mwSize)))) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1596 { |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1597 for (mwIndex i = 0; i < m_ndims; i++) |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
1598 m_dims[i] = val.m_dims[i]; |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1599 } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1600 |
5900 | 1601 dim_vector |
1602 dims_to_dim_vector (void) const | |
1603 { | |
6686 | 1604 mwSize nd = get_number_of_dimensions (); |
1605 | |
1606 mwSize *d = get_dimensions (); | |
5900 | 1607 |
1608 dim_vector dv; | |
1609 dv.resize (nd); | |
1610 | |
6686 | 1611 for (mwIndex i = 0; i < nd; i++) |
5900 | 1612 dv(i) = d[i]; |
1613 | |
1614 return dv; | |
1615 } | |
1616 | |
1617 private: | |
1618 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1619 char *m_class_name; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1620 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1621 mxClassID m_id; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1622 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1623 mwSize m_ndims; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1624 mwSize *m_dims; |
5900 | 1625 }; |
1626 | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1627 |
5900 | 1628 // Matlab-style numeric, character, and logical data. |
1629 | |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
1630 class mxArray_base_full : public mxArray_matlab |
5900 | 1631 { |
1632 public: | |
1633 | |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
1634 mxArray_base_full (bool interleaved, mxClassID id, mwSize ndims, |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
1635 const mwSize *dims, bool init = true) |
30213
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
1636 : mxArray_matlab (interleaved, id, ndims, dims), |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
1637 m_pr (mxArray::alloc (init, get_number_of_elements (), get_element_size ())) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1638 { } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1639 |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
1640 mxArray_base_full (bool interleaved, mxClassID id, const dim_vector& dv) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
1641 : mxArray_matlab (interleaved, id, dv), |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
1642 m_pr (mxArray::calloc (get_number_of_elements (), get_element_size ())) |
22464
1d2960b5efe6
Add new MEX fcns mxCreateUninitNumericArray, mxCreateUninitNumericMatrix.
Rik <rik@octave.org>
parents:
22462
diff
changeset
|
1643 { } |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1644 |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
1645 mxArray_base_full (bool interleaved, mxClassID id, mwSize m, mwSize n, |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
1646 bool init = true) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
1647 : mxArray_matlab (interleaved, id, m, n), |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
1648 m_pr (mxArray::alloc (init, get_number_of_elements (), get_element_size ())) |
22464
1d2960b5efe6
Add new MEX fcns mxCreateUninitNumericArray, mxCreateUninitNumericMatrix.
Rik <rik@octave.org>
parents:
22462
diff
changeset
|
1649 { } |
5900 | 1650 |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
1651 mxArray_base_full (bool interleaved, mxClassID id, double val) |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
1652 : mxArray_matlab (interleaved, id, 1, 1), |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
1653 m_pr (mxArray::calloc (get_number_of_elements (), get_element_size ())) |
5900 | 1654 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1655 double *dpr = static_cast<double *> (m_pr); |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
1656 dpr[0] = val; |
5900 | 1657 } |
1658 | |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
1659 mxArray_base_full (bool interleaved, mxClassID id, mxLogical val) |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
1660 : mxArray_matlab (interleaved, id, 1, 1), |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
1661 m_pr (mxArray::calloc (get_number_of_elements (), get_element_size ())) |
5900 | 1662 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1663 mxLogical *lpr = static_cast<mxLogical *> (m_pr); |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
1664 lpr[0] = val; |
5900 | 1665 } |
1666 | |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
1667 mxArray_base_full (bool interleaved, const char *str) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1668 : mxArray_matlab (interleaved, mxCHAR_CLASS, |
10853
c3813056f94f
mxArray_number (const char *): create empty string if given NULL arg
John W. Eaton <jwe@octave.org>
parents:
10463
diff
changeset
|
1669 str ? (strlen (str) ? 1 : 0) : 0, |
c3813056f94f
mxArray_number (const char *): create empty string if given NULL arg
John W. Eaton <jwe@octave.org>
parents:
10463
diff
changeset
|
1670 str ? strlen (str) : 0), |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
1671 m_pr (mxArray::calloc (get_number_of_elements (), get_element_size ())) |
5900 | 1672 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1673 mxChar *cpr = static_cast<mxChar *> (m_pr); |
6686 | 1674 mwSize nel = get_number_of_elements (); |
1675 for (mwIndex i = 0; i < nel; i++) | |
5900 | 1676 cpr[i] = str[i]; |
1677 } | |
1678 | |
17861
870f3e12e163
maint: Use phrase "FIXME:" for problem areas in code.
Rik <rik@octave.org>
parents:
17810
diff
changeset
|
1679 // FIXME: ??? |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
1680 mxArray_base_full (bool interleaved, mwSize m, const char **str) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1681 : mxArray_matlab (interleaved, mxCHAR_CLASS, m, max_str_len (m, str)), |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
1682 m_pr (mxArray::calloc (get_number_of_elements (), get_element_size ())) |
5900 | 1683 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1684 mxChar *cpr = static_cast<mxChar *> (m_pr); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
1685 |
6686 | 1686 mwSize *dv = get_dimensions (); |
1687 | |
1688 mwSize nc = dv[1]; | |
1689 | |
1690 for (mwIndex j = 0; j < m; j++) | |
5900 | 1691 { |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
1692 const char *ptr = str[j]; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
1693 |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
1694 std::size_t tmp_len = strlen (ptr); |
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
1695 |
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
1696 for (std::size_t i = 0; i < tmp_len; i++) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
1697 cpr[m*i+j] = static_cast<mxChar> (ptr[i]); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
1698 |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
1699 for (std::size_t i = tmp_len; i < static_cast<std::size_t> (nc); i++) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
1700 cpr[m*i+j] = static_cast<mxChar> (' '); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
1701 } |
5900 | 1702 } |
1703 | |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
1704 // No assignment! FIXME: should this be implemented? Note that we |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
1705 // do have a copy constructor. |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
1706 |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
1707 mxArray_base_full& operator = (const mxArray_base_full&); |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
1708 |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1709 mxArray_base * dup (void) const |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1710 { |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
1711 return new mxArray_base_full (*this); |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1712 } |
5900 | 1713 |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
1714 ~mxArray_base_full (void) |
5900 | 1715 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1716 mxFree (m_pr); |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1717 } |
5907 | 1718 |
6332 | 1719 double get_scalar (void) const |
1720 { | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1721 // FIXME: how does this work for interleaved complex arrays? |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1722 |
6332 | 1723 double retval = 0; |
1724 | |
1725 switch (get_class_id ()) | |
1726 { | |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
1727 case mxDOUBLE_CLASS: |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1728 retval = *(static_cast<double *> (m_pr)); |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
1729 break; |
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
1730 |
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
1731 case mxSINGLE_CLASS: |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1732 retval = *(static_cast<float *> (m_pr)); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
1733 break; |
6332 | 1734 |
1735 case mxCHAR_CLASS: | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1736 retval = *(static_cast<mxChar *> (m_pr)); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
1737 break; |
6332 | 1738 |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
1739 case mxLOGICAL_CLASS: |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1740 retval = *(static_cast<bool *> (m_pr)); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
1741 break; |
6332 | 1742 |
1743 case mxINT8_CLASS: | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1744 retval = *(static_cast<int8_t *> (m_pr)); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
1745 break; |
6332 | 1746 |
1747 case mxUINT8_CLASS: | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1748 retval = *(static_cast<uint8_t *> (m_pr)); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
1749 break; |
6332 | 1750 |
1751 case mxINT16_CLASS: | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1752 retval = *(static_cast<int16_t *> (m_pr)); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
1753 break; |
6332 | 1754 |
1755 case mxUINT16_CLASS: | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1756 retval = *(static_cast<uint16_t *> (m_pr)); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
1757 break; |
6332 | 1758 |
1759 case mxINT32_CLASS: | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1760 retval = *(static_cast<int32_t *> (m_pr)); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
1761 break; |
6332 | 1762 |
1763 case mxUINT32_CLASS: | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1764 retval = *(static_cast<uint32_t *> (m_pr)); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
1765 break; |
6332 | 1766 |
1767 case mxINT64_CLASS: | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1768 retval = *(static_cast<int64_t *> (m_pr)); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
1769 break; |
6332 | 1770 |
1771 case mxUINT64_CLASS: | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1772 retval = *(static_cast<uint64_t *> (m_pr)); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
1773 break; |
6332 | 1774 |
1775 default: | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
1776 panic_impossible (); |
6332 | 1777 } |
1778 | |
1779 return retval; | |
1780 } | |
1781 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1782 void * get_data (void) const { return m_pr; } |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
1783 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1784 void set_data (void *pr) { m_pr = pr; } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
1785 |
30225
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1786 // The typed get and set functions only work for interleaved data but |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1787 // they are defined here because this class owns PR. There are |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1788 // definitions in the mxArray_separate_full class that override these |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1789 // functions. |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1790 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1791 mxDouble * get_doubles (void) const |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1792 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1793 return static_cast<mxDouble *> (m_pr); |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1794 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1795 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1796 mxSingle * get_singles (void) const |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1797 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1798 return static_cast<mxSingle *> (m_pr); |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1799 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1800 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1801 mxInt8 * get_int8s (void) const |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1802 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1803 return static_cast<mxInt8 *> (m_pr); |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1804 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1805 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1806 mxInt16 * get_int16s (void) const |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1807 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1808 return static_cast<mxInt16 *> (m_pr); |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1809 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1810 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1811 mxInt32 * get_int32s (void) const |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1812 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1813 return static_cast<mxInt32 *> (m_pr); |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1814 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1815 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1816 mxInt64 * get_int64s (void) const |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1817 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1818 return static_cast<mxInt64 *> (m_pr); |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1819 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1820 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1821 mxUint8 * get_uint8s (void) const |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1822 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1823 return static_cast<mxUint8 *> (m_pr); |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1824 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1825 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1826 mxUint16 * get_uint16s (void) const |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1827 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1828 return static_cast<mxUint16 *> (m_pr); |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1829 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1830 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1831 mxUint32 * get_uint32s (void) const |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1832 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1833 return static_cast<mxUint32 *> (m_pr); |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1834 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1835 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1836 mxUint64 * get_uint64s (void) const |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1837 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1838 return static_cast<mxUint64 *> (m_pr); |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1839 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1840 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1841 mxComplexDouble * get_complex_doubles (void) const |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1842 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1843 return static_cast<mxComplexDouble *> (m_pr); |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1844 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1845 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1846 mxComplexSingle * get_complex_singles (void) const |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1847 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1848 return static_cast<mxComplexSingle *> (m_pr); |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1849 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1850 |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1851 #if 0 |
30225
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1852 // We don't have these data types. |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1853 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1854 int get_complex_int8s (mxComplexInt8 *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1855 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1856 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1857 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1858 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1859 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1860 int get_complex_int16s (mxComplexInt16 *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1861 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1862 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1863 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1864 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1865 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1866 int get_complex_int32s (mxComplexInt32 *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1867 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1868 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1869 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1870 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1871 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1872 int get_complex_int64s (mxComplexInt64 *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1873 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1874 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1875 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1876 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1877 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1878 int get_complex_uint8s (mxComplexUint8 *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1879 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1880 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1881 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1882 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1883 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1884 int get_complex_uint16s (mxComplexUint16 *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1885 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1886 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1887 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1888 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1889 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1890 int get_complex_uint32s (mxComplexUint32 *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1891 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1892 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1893 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1894 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1895 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1896 int get_complex_uint64s (mxComplexUint64 *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1897 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1898 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1899 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1900 } |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1901 #endif |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1902 |
30225
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1903 int set_doubles (mxDouble *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1904 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1905 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1906 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1907 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1908 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1909 int set_singles (mxSingle *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1910 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1911 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1912 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1913 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1914 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1915 int set_int8s (mxInt8 *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1916 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1917 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1918 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1919 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1920 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1921 int set_int16s (mxInt16 *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1922 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1923 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1924 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1925 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1926 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1927 int set_int32s (mxInt32 *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1928 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1929 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1930 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1931 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1932 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1933 int set_int64s (mxInt64 *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1934 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1935 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1936 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1937 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1938 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1939 int set_uint8s (mxUint8 *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1940 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1941 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1942 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1943 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1944 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1945 int set_uint16s (mxUint16 *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1946 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1947 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1948 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1949 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1950 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1951 int set_uint32s (mxUint32 *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1952 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1953 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1954 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1955 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1956 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1957 int set_uint64s (mxUint64 *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1958 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1959 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1960 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1961 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1962 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1963 int set_complex_doubles (mxComplexDouble *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1964 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1965 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1966 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1967 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1968 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1969 int set_complex_singles (mxComplexSingle *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1970 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1971 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1972 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1973 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1974 |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
1975 #if 0 |
30225
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1976 // We don't have these data types. |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1977 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1978 int set_complex_int8s (mxComplexInt8 *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1979 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1980 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1981 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1982 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1983 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1984 int set_complex_int16s (mxComplexInt16 *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1985 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1986 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1987 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1988 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1989 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1990 int set_complex_int32s (mxComplexInt32 *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1991 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1992 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1993 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1994 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1995 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1996 int set_complex_int64s (mxComplexInt64 *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1997 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1998 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
1999 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2000 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2001 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2002 int set_complex_uint8s (mxComplexUint8 *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2003 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2004 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2005 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2006 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2007 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2008 int set_complex_uint16s (mxComplexUint16 *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2009 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2010 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2011 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2012 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2013 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2014 int set_complex_uint32s (mxComplexUint32 *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2015 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2016 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2017 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2018 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2019 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2020 int set_complex_uint64s (mxComplexUint64 *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2021 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2022 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2023 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2024 } |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
2025 #endif |
5907 | 2026 |
6686 | 2027 int get_string (char *buf, mwSize buflen) const |
5907 | 2028 { |
13753
ab4238b0b09b
Change return value of mxGetString to match Matlab (Bug #34546)
Rik <octave@nomad.inbox5.com>
parents:
12472
diff
changeset
|
2029 int retval = 0; |
5907 | 2030 |
6686 | 2031 mwSize nel = get_number_of_elements (); |
6493 | 2032 |
13753
ab4238b0b09b
Change return value of mxGetString to match Matlab (Bug #34546)
Rik <octave@nomad.inbox5.com>
parents:
12472
diff
changeset
|
2033 if (! (nel < buflen)) |
ab4238b0b09b
Change return value of mxGetString to match Matlab (Bug #34546)
Rik <octave@nomad.inbox5.com>
parents:
12472
diff
changeset
|
2034 { |
ab4238b0b09b
Change return value of mxGetString to match Matlab (Bug #34546)
Rik <octave@nomad.inbox5.com>
parents:
12472
diff
changeset
|
2035 retval = 1; |
ab4238b0b09b
Change return value of mxGetString to match Matlab (Bug #34546)
Rik <octave@nomad.inbox5.com>
parents:
12472
diff
changeset
|
2036 if (buflen > 0) |
ab4238b0b09b
Change return value of mxGetString to match Matlab (Bug #34546)
Rik <octave@nomad.inbox5.com>
parents:
12472
diff
changeset
|
2037 nel = buflen-1; |
ab4238b0b09b
Change return value of mxGetString to match Matlab (Bug #34546)
Rik <octave@nomad.inbox5.com>
parents:
12472
diff
changeset
|
2038 } |
ab4238b0b09b
Change return value of mxGetString to match Matlab (Bug #34546)
Rik <octave@nomad.inbox5.com>
parents:
12472
diff
changeset
|
2039 |
6493 | 2040 if (nel < buflen) |
5907 | 2041 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2042 mxChar *ptr = static_cast<mxChar *> (m_pr); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2043 |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2044 for (mwIndex i = 0; i < nel; i++) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2045 buf[i] = static_cast<char> (ptr[i]); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2046 |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2047 buf[nel] = 0; |
5907 | 2048 } |
2049 | |
2050 return retval; | |
2051 } | |
2052 | |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
2053 char * array_to_string (void) const |
5907 | 2054 { |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
2055 // FIXME: this is supposed to handle multi-byte character strings. |
5907 | 2056 |
6686 | 2057 mwSize nel = get_number_of_elements (); |
5907 | 2058 |
15354
93dff6435fe1
tag calls to mxArray::malloc, mxArray::calloc, and mxArray::strsave with class name
John W. Eaton <jwe@octave.org>
parents:
15353
diff
changeset
|
2059 char *buf = static_cast<char *> (mxArray::malloc (nel + 1)); |
5907 | 2060 |
2061 if (buf) | |
2062 { | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2063 mxChar *ptr = static_cast<mxChar *> (m_pr); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2064 |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2065 for (mwIndex i = 0; i < nel; i++) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2066 buf[i] = static_cast<char> (ptr[i]); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2067 |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2068 buf[nel] = '\0'; |
5907 | 2069 } |
2070 | |
2071 return buf; | |
2072 } | |
2073 | |
5900 | 2074 octave_value as_octave_value (void) const |
2075 { | |
2076 octave_value retval; | |
2077 | |
2078 dim_vector dv = dims_to_dim_vector (); | |
2079 | |
2080 switch (get_class_id ()) | |
2081 { | |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
2082 case mxDOUBLE_CLASS: |
30227
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2083 return (is_complex () |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2084 ? fp_to_ov<Complex> (dv) : fp_to_ov<double> (dv)); |
5900 | 2085 |
2086 case mxSINGLE_CLASS: | |
30227
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2087 return (is_complex () |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2088 ? fp_to_ov<FloatComplex> (dv) : fp_to_ov<float> (dv)); |
5900 | 2089 |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
2090 case mxCHAR_CLASS: |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2091 return int_to_ov<mxChar, charNDArray, char> (dv); |
5900 | 2092 |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
2093 case mxLOGICAL_CLASS: |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2094 return int_to_ov<mxLogical, boolNDArray, bool> (dv); |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
2095 |
5900 | 2096 case mxINT8_CLASS: |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2097 return int_to_ov<int8_t, int8NDArray, octave_int8> (dv); |
5900 | 2098 |
2099 case mxUINT8_CLASS: | |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2100 return int_to_ov<uint8_t, uint8NDArray, octave_uint8> (dv); |
5900 | 2101 |
2102 case mxINT16_CLASS: | |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2103 return int_to_ov<int16_t, int16NDArray, octave_int16> (dv); |
5900 | 2104 |
2105 case mxUINT16_CLASS: | |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2106 return int_to_ov<uint16_t, uint16NDArray, octave_uint16> (dv); |
5900 | 2107 |
2108 case mxINT32_CLASS: | |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2109 return int_to_ov<int32_t, int32NDArray, octave_int32> (dv); |
5900 | 2110 |
2111 case mxUINT32_CLASS: | |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2112 return int_to_ov<uint32_t, uint32NDArray, octave_uint32> (dv); |
5900 | 2113 |
2114 case mxINT64_CLASS: | |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2115 return int_to_ov<int64_t, int64NDArray, octave_int64> (dv); |
5900 | 2116 |
2117 case mxUINT64_CLASS: | |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2118 return int_to_ov<uint64_t, uint64NDArray, octave_uint64> (dv); |
5900 | 2119 |
2120 default: | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2121 panic_impossible (); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
2122 } |
5900 | 2123 |
2124 return retval; | |
2125 } | |
2126 | |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
2127 protected: |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
2128 |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2129 mxArray_base_full (const mxArray_base_full& val) |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2130 : mxArray_matlab (val), |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2131 m_pr (mxArray::malloc (get_number_of_elements () * get_element_size ())) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2132 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2133 if (m_pr) |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2134 memcpy (m_pr, val.m_pr, get_number_of_elements () * get_element_size ()); |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2135 } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2136 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2137 template <typename ELT_T> |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2138 octave_value |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2139 fp_to_ov (const dim_vector& dv) const |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2140 { |
30488
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
2141 octave_value retval; |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
2142 |
30227
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2143 ELT_T *ppr = static_cast<ELT_T *> (m_pr); |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2144 |
30501
79a7f3e3cf54
Use consistent name for OCTAVE_HAVE_STD_PMR_POLYMORPHIC_ALLOCATOR (bug #61472).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30494
diff
changeset
|
2145 #if defined (OCTAVE_HAVE_STD_PMR_POLYMORPHIC_ALLOCATOR) |
30488
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
2146 |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
2147 octave::unwind_action act ([=] () { maybe_disown_ptr (m_pr); }); |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
2148 |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
2149 return octave_value (Array<ELT_T> (ppr, dv, &the_mx_memory_resource)); |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
2150 |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
2151 #else |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
2152 |
30769
822649f5f193
don't mix operator new and free (bug #61813)
John W. Eaton <jwe@octave.org>
parents:
30768
diff
changeset
|
2153 // Copy data instead of allowing the octave_value object to borrow |
822649f5f193
don't mix operator new and free (bug #61813)
John W. Eaton <jwe@octave.org>
parents:
30768
diff
changeset
|
2154 // the mxArray object data. |
822649f5f193
don't mix operator new and free (bug #61813)
John W. Eaton <jwe@octave.org>
parents:
30768
diff
changeset
|
2155 |
822649f5f193
don't mix operator new and free (bug #61813)
John W. Eaton <jwe@octave.org>
parents:
30768
diff
changeset
|
2156 Array<ELT_T> val (dv); |
822649f5f193
don't mix operator new and free (bug #61813)
John W. Eaton <jwe@octave.org>
parents:
30768
diff
changeset
|
2157 |
822649f5f193
don't mix operator new and free (bug #61813)
John W. Eaton <jwe@octave.org>
parents:
30768
diff
changeset
|
2158 ELT_T *ptr = val.fortran_vec (); |
822649f5f193
don't mix operator new and free (bug #61813)
John W. Eaton <jwe@octave.org>
parents:
30768
diff
changeset
|
2159 |
822649f5f193
don't mix operator new and free (bug #61813)
John W. Eaton <jwe@octave.org>
parents:
30768
diff
changeset
|
2160 mwSize nel = get_number_of_elements (); |
822649f5f193
don't mix operator new and free (bug #61813)
John W. Eaton <jwe@octave.org>
parents:
30768
diff
changeset
|
2161 |
822649f5f193
don't mix operator new and free (bug #61813)
John W. Eaton <jwe@octave.org>
parents:
30768
diff
changeset
|
2162 for (mwIndex i = 0; i < nel; i++) |
822649f5f193
don't mix operator new and free (bug #61813)
John W. Eaton <jwe@octave.org>
parents:
30768
diff
changeset
|
2163 ptr[i] = ppr[i]; |
822649f5f193
don't mix operator new and free (bug #61813)
John W. Eaton <jwe@octave.org>
parents:
30768
diff
changeset
|
2164 |
822649f5f193
don't mix operator new and free (bug #61813)
John W. Eaton <jwe@octave.org>
parents:
30768
diff
changeset
|
2165 return octave_value (val); |
30488
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
2166 |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
2167 #endif |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2168 } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2169 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
2170 template <typename ELT_T, typename ARRAY_T, typename ARRAY_ELT_T> |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
2171 octave_value |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
2172 int_to_ov (const dim_vector& dv) const |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
2173 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
2174 if (is_complex ()) |
21151
bfd5e48c41a1
Rename local error in mex I/F from invalid_type_error to err_invalid_type.
Rik <rik@octave.org>
parents:
20940
diff
changeset
|
2175 error ("complex integer types are not supported"); |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
2176 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2177 ELT_T *ppr = static_cast<ELT_T *> (m_pr); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2178 |
30501
79a7f3e3cf54
Use consistent name for OCTAVE_HAVE_STD_PMR_POLYMORPHIC_ALLOCATOR (bug #61472).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30494
diff
changeset
|
2179 #if 0 && defined (OCTAVE_HAVE_STD_PMR_POLYMORPHIC_ALLOCATOR) |
30488
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
2180 |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
2181 octave::unwind_action act ([=] () { maybe_disown_ptr (m_pr); }); |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
2182 |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
2183 return ARRAY_T (ppr, dv, &the_mx_memory_resource); |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
2184 |
30227
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2185 #else |
30488
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
2186 |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
2187 // All octave_int types are objects so we can't mix malloc and |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
2188 // delete[] and we always have to copy. |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
2189 |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
2190 ARRAY_T val (dv); |
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
2191 |
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
2192 ARRAY_ELT_T *ptr = val.fortran_vec (); |
21151
bfd5e48c41a1
Rename local error in mex I/F from invalid_type_error to err_invalid_type.
Rik <rik@octave.org>
parents:
20940
diff
changeset
|
2193 |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2194 mwSize nel = get_number_of_elements (); |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2195 |
21151
bfd5e48c41a1
Rename local error in mex I/F from invalid_type_error to err_invalid_type.
Rik <rik@octave.org>
parents:
20940
diff
changeset
|
2196 for (mwIndex i = 0; i < nel; i++) |
bfd5e48c41a1
Rename local error in mex I/F from invalid_type_error to err_invalid_type.
Rik <rik@octave.org>
parents:
20940
diff
changeset
|
2197 ptr[i] = ppr[i]; |
bfd5e48c41a1
Rename local error in mex I/F from invalid_type_error to err_invalid_type.
Rik <rik@octave.org>
parents:
20940
diff
changeset
|
2198 |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
2199 return octave_value (val); |
30488
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
2200 |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
2201 #endif |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
2202 } |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
2203 |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2204 protected: |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
2205 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
2206 // If using interleaved complex storage, this is the pointer to data |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
2207 // (real, complex, or logical). Otherwise, it is the pointer to the |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
2208 // real part of the data. |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2209 void *m_pr; |
5900 | 2210 }; |
2211 | |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2212 class mxArray_interleaved_full : public mxArray_base_full |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2213 { |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2214 public: |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2215 |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2216 mxArray_interleaved_full (mxClassID id, mwSize ndims, const mwSize *dims, |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2217 mxComplexity flag = mxREAL, bool init = true) |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2218 : mxArray_base_full (true, id, ndims, dims, init), |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2219 m_complex (flag == mxCOMPLEX) |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2220 { } |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2221 |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2222 mxArray_interleaved_full (mxClassID id, const dim_vector& dv, |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2223 mxComplexity flag = mxREAL) |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2224 : mxArray_base_full (true, id, dv), |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2225 m_complex (flag == mxCOMPLEX) |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2226 { } |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2227 |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2228 mxArray_interleaved_full (mxClassID id, mwSize m, mwSize n, |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2229 mxComplexity flag = mxREAL, bool init = true) |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2230 : mxArray_base_full (true, id, m, n, init), |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2231 m_complex (flag == mxCOMPLEX) |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2232 { } |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2233 |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2234 mxArray_interleaved_full (mxClassID id, double val) |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2235 : mxArray_base_full (true, id, val), m_complex (false) |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2236 { } |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2237 |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2238 mxArray_interleaved_full (mxClassID id, mxLogical val) |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2239 : mxArray_base_full (true, id, val), m_complex (false) |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2240 { } |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2241 |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2242 mxArray_interleaved_full (const char *str) |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2243 : mxArray_base_full (true, str), m_complex (false) |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2244 { } |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2245 |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2246 // FIXME: ??? |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2247 mxArray_interleaved_full (mwSize m, const char **str) |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2248 : mxArray_base_full (true, m, str), m_complex (false) |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2249 { } |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2250 |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2251 // No assignment! FIXME: should this be implemented? Note that we |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2252 // do have a copy constructor. |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2253 |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2254 mxArray_interleaved_full& operator = (const mxArray_interleaved_full&); |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2255 |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2256 mxArray_base * dup (void) const |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2257 { |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2258 return new mxArray_interleaved_full (*this); |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2259 } |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2260 |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2261 ~mxArray_interleaved_full (void) = default; |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2262 |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2263 int is_complex (void) const { return m_complex; } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2264 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2265 void * get_imag_data (void) const { panic_impossible (); } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2266 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2267 void set_imag_data (void */*pi*/) { panic_impossible (); } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2268 |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2269 protected: |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2270 |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2271 mxArray_interleaved_full (const mxArray_interleaved_full& val) |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2272 : mxArray_base_full (val), m_complex (val.m_complex) |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2273 { } |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2274 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2275 // Flag to identify complex object. |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2276 bool m_complex; |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2277 }; |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2278 |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2279 class mxArray_separate_full : public mxArray_base_full |
5900 | 2280 { |
2281 public: | |
2282 | |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2283 mxArray_separate_full (mxClassID id, mwSize ndims, const mwSize *dims, |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2284 mxComplexity flag = mxREAL, bool init = true) |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2285 : mxArray_base_full (false, id, ndims, dims, init), |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2286 m_pi (flag == mxCOMPLEX |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2287 ? mxArray::alloc (init, get_number_of_elements (), get_element_size ()) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2288 : nullptr) |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2289 { } |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2290 |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2291 mxArray_separate_full (mxClassID id, const dim_vector& dv, |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2292 mxComplexity flag = mxREAL) |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2293 : mxArray_base_full (false, id, dv), |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2294 m_pi (flag == mxCOMPLEX |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2295 ? mxArray::calloc (get_number_of_elements (), get_element_size ()) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2296 : nullptr) |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2297 { } |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2298 |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2299 mxArray_separate_full (mxClassID id, mwSize m, mwSize n, |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2300 mxComplexity flag = mxREAL, bool init = true) |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2301 : mxArray_base_full (false, id, m, n, init), |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2302 m_pi (flag == mxCOMPLEX |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2303 ? (mxArray::alloc (init, get_number_of_elements (), get_element_size ())) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2304 : nullptr) |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2305 { } |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2306 |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2307 mxArray_separate_full (mxClassID id, double val) |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2308 : mxArray_base_full (false, id, val), m_pi (nullptr) |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2309 { } |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2310 |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2311 mxArray_separate_full (mxClassID id, mxLogical val) |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2312 : mxArray_base_full (false, id, val), m_pi (nullptr) |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2313 { } |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2314 |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2315 mxArray_separate_full (const char *str) |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2316 : mxArray_base_full (false, str), m_pi (nullptr) |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2317 { } |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2318 |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2319 // FIXME: ??? |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2320 mxArray_separate_full (mwSize m, const char **str) |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2321 : mxArray_base_full (false, m, str), m_pi (nullptr) |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2322 { } |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2323 |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2324 // No assignment! FIXME: should this be implemented? Note that we |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2325 // do have a copy constructor. |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2326 |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2327 mxArray_separate_full& operator = (const mxArray_separate_full&); |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2328 |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2329 mxArray_base * dup (void) const |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2330 { |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2331 return new mxArray_separate_full (*this); |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2332 } |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2333 |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2334 ~mxArray_separate_full (void) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2335 { |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2336 mxFree (m_pi); |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2337 } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2338 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2339 int is_complex (void) const { return m_pi != nullptr; } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2340 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2341 void * get_imag_data (void) const { return m_pi; } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2342 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2343 void set_imag_data (void *pi) { m_pi = pi; } |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2344 |
30225
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2345 mxDouble * get_doubles (void) const { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2346 mxSingle * get_singles (void) const { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2347 mxInt8 * get_int8s (void) const { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2348 mxInt16 * get_int16s (void) const { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2349 mxInt32 * get_int32s (void) const { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2350 mxInt64 * get_int64s (void) const { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2351 mxUint8 * get_uint8s (void) const { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2352 mxUint16 * get_uint16s (void) const { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2353 mxUint32 * get_uint32s (void) const { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2354 mxUint64 * get_uint64s (void) const { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2355 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2356 mxComplexDouble * get_complex_doubles (void) const { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2357 mxComplexSingle * get_complex_singles (void) const { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2358 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2359 // We don't have complex integer types, but for separate storage they |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2360 // still would not work. |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2361 mxComplexInt8 * get_complex_int8s (void) const { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2362 mxComplexInt16 * get_complex_int16s (void) const { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2363 mxComplexInt32 * get_complex_int32s (void) const { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2364 mxComplexInt64 * get_complex_int64s (void) const { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2365 mxComplexUint8 * get_complex_uint8s (void) const { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2366 mxComplexUint16 * get_complex_uint16s (void) const { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2367 mxComplexUint32 * get_complex_uint32s (void) const { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2368 mxComplexUint64 * get_complex_uint64s (void) const { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2369 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2370 int set_doubles (mxDouble *) { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2371 int set_singles (mxSingle *) { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2372 int set_int8s (mxInt8 *) { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2373 int set_int16s (mxInt16 *) { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2374 int set_int32s (mxInt32 *) { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2375 int set_int64s (mxInt64 *) { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2376 int set_uint8s (mxUint8 *) { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2377 int set_uint16s (mxUint16 *) { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2378 int set_uint32s (mxUint32 *) { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2379 int set_uint64s (mxUint64 *) { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2380 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2381 int set_complex_doubles (mxComplexDouble *) { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2382 int set_complex_singles (mxComplexSingle *) { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2383 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2384 // We don't have complex integer types, but for separate storage they |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2385 // still would not work. |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2386 int set_complex_int8s (mxComplexInt8 *) { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2387 int set_complex_int16s (mxComplexInt16 *) { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2388 int set_complex_int32s (mxComplexInt32 *) { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2389 int set_complex_int64s (mxComplexInt64 *) { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2390 int set_complex_uint8s (mxComplexUint8 *) { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2391 int set_complex_uint16s (mxComplexUint16 *) { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2392 int set_complex_uint32s (mxComplexUint32 *) { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2393 int set_complex_uint64s (mxComplexUint64 *) { panic_impossible (); } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2394 |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2395 octave_value as_octave_value (void) const |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2396 { |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2397 if (! is_complex ()) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2398 return mxArray_base_full::as_octave_value (); |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2399 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2400 octave_value retval; |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2401 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2402 dim_vector dv = dims_to_dim_vector (); |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2403 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2404 switch (get_class_id ()) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2405 { |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2406 case mxDOUBLE_CLASS: |
30227
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2407 return to_ov<double> (dv); |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2408 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2409 case mxSINGLE_CLASS: |
30227
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2410 return to_ov<float> (dv); |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2411 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2412 case mxLOGICAL_CLASS: |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2413 case mxINT8_CLASS: |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2414 case mxUINT8_CLASS: |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2415 case mxINT16_CLASS: |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2416 case mxUINT16_CLASS: |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2417 case mxINT32_CLASS: |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2418 case mxUINT32_CLASS: |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2419 case mxINT64_CLASS: |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2420 case mxUINT64_CLASS: |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2421 error ("complex integer types are not supported"); |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2422 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2423 default: |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2424 panic_impossible (); |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2425 } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2426 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2427 return retval; |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2428 } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2429 |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2430 protected: |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2431 |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2432 mxArray_separate_full (const mxArray_separate_full& val) |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2433 : mxArray_base_full (val), |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2434 m_pi (val.m_pi |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2435 ? mxArray::malloc (get_number_of_elements () * get_element_size ()) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2436 : nullptr) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2437 { |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2438 if (m_pi) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2439 memcpy (m_pi, val.m_pi, get_number_of_elements () * get_element_size ()); |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2440 } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2441 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2442 private: |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2443 |
30227
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2444 template <typename T> |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2445 octave_value |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2446 to_ov (const dim_vector& dv) const |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2447 { |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2448 mwSize nel = get_number_of_elements (); |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2449 |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2450 T *ppr = static_cast<T *> (m_pr); |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2451 |
30488
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
2452 // We allocate in the Array<T> constructor and copy here, so we |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
2453 // don't need the custom allocator for this object. |
abb4823df535
with C++17, match malloc/free for MEX memory (bug #61472)
John W. Eaton <jwe@octave.org>
parents:
30428
diff
changeset
|
2454 |
30227
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2455 Array<std::complex<T>> val (dv); |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2456 |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2457 std::complex<T> *ptr = val.fortran_vec (); |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2458 |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2459 T *ppi = static_cast<T *> (m_pi); |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2460 |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2461 for (mwIndex i = 0; i < nel; i++) |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2462 ptr[i] = std::complex<T> (ppr[i], ppi[i]); |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2463 |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2464 return octave_value (val); |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2465 } |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2466 |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2467 // Pointer to the imaginary part of the data. |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2468 void *m_pi; |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2469 }; |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2470 |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2471 // Matlab-style sparse arrays. |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2472 |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2473 class mxArray_base_sparse : public mxArray_matlab |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2474 { |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2475 public: |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2476 |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2477 mxArray_base_sparse (bool interleaved, mxClassID id, mwSize m, mwSize n, |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2478 mwSize nzmax) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2479 : mxArray_matlab (interleaved, id, m, n), |
30213
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
2480 |
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
2481 m_nzmax (nzmax > 0 ? nzmax : 1), |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2482 m_ir (static_cast<mwIndex *> (mxArray::calloc (m_nzmax, sizeof (mwIndex)))), |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2483 m_jc (static_cast<mwIndex *> (mxArray::calloc (n + 1, sizeof (mwIndex)))), |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2484 m_pr (mxArray::calloc (m_nzmax, get_element_size ())) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
2485 { } |
5900 | 2486 |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2487 protected: |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2488 |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2489 mxArray_base_sparse (const mxArray_base_sparse& val) |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
2490 : mxArray_matlab (val), m_nzmax (val.m_nzmax), |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2491 m_ir (static_cast<mwIndex *> (mxArray::malloc (m_nzmax * sizeof (mwIndex)))), |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2492 m_jc (static_cast<mwIndex *> (mxArray::malloc (m_nzmax * sizeof (mwIndex)))), |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2493 m_pr (mxArray::malloc (m_nzmax * get_element_size ())) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2494 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2495 if (m_ir) |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
2496 memcpy (m_ir, val.m_ir, m_nzmax * sizeof (mwIndex)); |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2497 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2498 if (m_jc) |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
2499 memcpy (m_jc, val.m_jc, (val.get_n () + 1) * sizeof (mwIndex)); |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2500 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2501 if (m_pr) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2502 memcpy (m_pr, val.m_pr, m_nzmax * get_element_size ()); |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2503 } |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2504 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2505 public: |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2506 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2507 // No assignment! FIXME: should this be implemented? Note that we |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2508 // do have a copy constructor. |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2509 |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2510 mxArray_base_sparse& operator = (const mxArray_base_sparse&); |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2511 |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
2512 mxArray_base * dup (void) const |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
2513 { |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2514 return new mxArray_base_sparse (*this); |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
2515 } |
5900 | 2516 |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2517 ~mxArray_base_sparse (void) |
5900 | 2518 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2519 mxFree (m_ir); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2520 mxFree (m_jc); |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2521 mxFree (m_pr); |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
2522 } |
5907 | 2523 |
2524 int is_sparse (void) const { return 1; } | |
2525 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2526 void * get_data (void) const { return m_pr; } |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
2527 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2528 void set_data (void *pr) { m_pr = pr; } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2529 |
30225
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2530 mxDouble * get_doubles (void) const |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2531 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2532 return static_cast<mxDouble *> (m_pr); |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2533 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2534 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2535 mxComplexDouble * get_complex_doubles (void) const |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2536 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2537 return static_cast<mxComplexDouble *> (m_pr); |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2538 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2539 |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2540 int set_doubles (mxDouble *d) |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2541 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2542 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2543 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2544 } |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2545 |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2546 int set_complex_doubles (mxComplexDouble *d) |
30225
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2547 { |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2548 m_pr = d; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2549 return 0; |
3a988323d5d7
refactor typed data get and set methods for mxArray objects
John W. Eaton <jwe@octave.org>
parents:
30224
diff
changeset
|
2550 } |
5907 | 2551 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2552 mwIndex * get_ir (void) const { return m_ir; } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2553 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2554 mwIndex * get_jc (void) const { return m_jc; } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2555 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2556 mwSize get_nzmax (void) const { return m_nzmax; } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2557 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2558 void set_ir (mwIndex *ir) { m_ir = ir; } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2559 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2560 void set_jc (mwIndex *jc) { m_jc = jc; } |
6686 | 2561 |
30213
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
2562 void set_nzmax (mwSize nzmax) |
27083
23761e83756f
Always reserve memory for 1-element in sparse mxArray matrices (bug #56232).
Rik <rik@octave.org>
parents:
26997
diff
changeset
|
2563 { |
23761e83756f
Always reserve memory for 1-element in sparse mxArray matrices (bug #56232).
Rik <rik@octave.org>
parents:
26997
diff
changeset
|
2564 /* Require storage for at least 1 element */ |
30213
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
2565 m_nzmax = (nzmax > 0 ? nzmax : 1); |
27083
23761e83756f
Always reserve memory for 1-element in sparse mxArray matrices (bug #56232).
Rik <rik@octave.org>
parents:
26997
diff
changeset
|
2566 } |
5907 | 2567 |
5900 | 2568 octave_value as_octave_value (void) const |
2569 { | |
5903 | 2570 octave_value retval; |
2571 | |
30227
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2572 dim_vector dv = dims_to_dim_vector (); |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2573 |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2574 switch (get_class_id ()) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2575 { |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2576 case mxDOUBLE_CLASS: |
30227
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2577 return is_complex () ? to_ov<Complex> (dv): to_ov<double> (dv); |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2578 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2579 case mxSINGLE_CLASS: |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2580 error ("single precision sparse data type not supported"); |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2581 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2582 case mxLOGICAL_CLASS: |
30227
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2583 return to_ov<bool> (dv); |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2584 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2585 default: |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2586 panic_impossible (); |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2587 } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2588 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2589 return retval; |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2590 } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2591 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2592 protected: |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2593 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2594 template <typename ELT_T> |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2595 octave_value |
30227
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2596 to_ov (const dim_vector& dv) const |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2597 { |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2598 ELT_T *ppr = static_cast<ELT_T *> (m_pr); |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2599 |
30227
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2600 Sparse<ELT_T> val (dv, static_cast<octave_idx_type> (m_nzmax), |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2601 ppr, m_ir, m_jc); |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2602 |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2603 maybe_disown_ptr (m_pr); |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2604 maybe_disown_ptr (m_ir); |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2605 maybe_disown_ptr (m_jc); |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2606 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2607 return octave_value (val); |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2608 } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2609 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2610 // Maximun number of nonzero elements. |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2611 mwSize m_nzmax; |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2612 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2613 // Sparse storage indexing arrays. |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2614 mwIndex *m_ir; |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2615 mwIndex *m_jc; |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2616 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2617 // If using interleaved complex storage, this is the pointer to data |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2618 // (real, complex, or logical). Otherwise, it is the pointer to the |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2619 // real part of the data. |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2620 void *m_pr; |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2621 }; |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2622 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2623 class mxArray_interleaved_sparse : public mxArray_base_sparse |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2624 { |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2625 public: |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2626 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2627 mxArray_interleaved_sparse (mxClassID id, mwSize m, mwSize n, mwSize nzmax, |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2628 mxComplexity flag = mxREAL) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2629 : mxArray_base_sparse (true, id, m, n, nzmax), |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2630 m_complex (flag == mxCOMPLEX) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2631 { } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2632 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2633 private: |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2634 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2635 mxArray_interleaved_sparse (const mxArray_interleaved_sparse& val) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2636 : mxArray_base_sparse (val), m_complex (val.m_complex) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2637 { } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2638 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2639 public: |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2640 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2641 // No assignment! FIXME: should this be implemented? Note that we |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2642 // do have a copy constructor. |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2643 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2644 mxArray_interleaved_sparse& operator = (const mxArray_interleaved_sparse&); |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2645 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2646 mxArray_base * dup (void) const |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2647 { |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2648 return new mxArray_interleaved_sparse (*this); |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2649 } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2650 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2651 ~mxArray_interleaved_sparse (void) = default; |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2652 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2653 int is_complex (void) const { return m_complex; } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2654 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2655 void * get_imag_data (void) const { panic_impossible (); } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2656 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2657 void set_imag_data (void */*pi*/) { panic_impossible (); } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2658 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2659 private: |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2660 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2661 // Flag to identify complex object if using interleaved data and PI is |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2662 // always nullptr. |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2663 bool m_complex; |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2664 }; |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2665 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2666 class mxArray_separate_sparse : public mxArray_base_sparse |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2667 { |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2668 public: |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2669 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2670 mxArray_separate_sparse (mxClassID id, mwSize m, mwSize n, mwSize nzmax, |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2671 mxComplexity flag = mxREAL) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2672 : mxArray_base_sparse (false, id, m, n, nzmax), |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2673 m_pi (flag == mxCOMPLEX |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2674 ? mxArray::calloc (m_nzmax, get_element_size ()) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2675 : nullptr) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2676 { } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2677 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2678 private: |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2679 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2680 mxArray_separate_sparse (const mxArray_separate_sparse& val) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2681 : mxArray_base_sparse (val), |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2682 m_pi (val.m_pi |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2683 ? mxArray::malloc (m_nzmax * get_element_size ()) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2684 : nullptr) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2685 { |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2686 if (m_pi) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2687 memcpy (m_pi, val.m_pi, m_nzmax * get_element_size ()); |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2688 } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2689 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2690 public: |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2691 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2692 // No assignment! FIXME: should this be implemented? Note that we |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2693 // do have a copy constructor. |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2694 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2695 mxArray_separate_sparse& operator = (const mxArray_separate_sparse&); |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2696 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2697 mxArray_base * dup (void) const |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2698 { |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2699 return new mxArray_separate_sparse (*this); |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2700 } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2701 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2702 ~mxArray_separate_sparse (void) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2703 { |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2704 mxFree (m_pi); |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2705 } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2706 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2707 int is_complex (void) const |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2708 { |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2709 return m_pi != nullptr; |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2710 } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2711 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2712 void * get_imag_data (void) const { return m_pi; } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2713 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2714 void set_imag_data (void *pi) { m_pi = pi; } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2715 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2716 mxDouble * get_doubles (void) const { panic_impossible (); } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2717 mxComplexDouble * get_complex_doubles (void) const { panic_impossible (); } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2718 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2719 int set_doubles (mxDouble *) { panic_impossible (); } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2720 int set_complex_doubles (mxComplexDouble *) { panic_impossible (); } |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2721 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2722 octave_value as_octave_value (void) const |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2723 { |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2724 if (! is_complex ()) |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2725 return mxArray_base_sparse::as_octave_value (); |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2726 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2727 octave_value retval; |
5903 | 2728 |
30227
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2729 dim_vector dv = dims_to_dim_vector (); |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
2730 |
5903 | 2731 switch (get_class_id ()) |
2732 { | |
2733 case mxDOUBLE_CLASS: | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2734 { |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2735 double *ppr = static_cast<double *> (m_pr); |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2736 double *ppi = static_cast<double *> (m_pi); |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2737 |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2738 SparseComplexMatrix val (get_m (), get_n (), |
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2739 static_cast<octave_idx_type> (m_nzmax)); |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2740 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2741 for (mwIndex i = 0; i < m_nzmax; i++) |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
2742 { |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2743 val.xdata (i) = Complex (ppr[i], ppi[i]); |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
2744 val.xridx (i) = m_ir[i]; |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
2745 } |
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
2746 |
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
2747 for (mwIndex i = 0; i < get_n () + 1; i++) |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
2748 val.xcidx (i) = m_jc[i]; |
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
2749 |
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
2750 retval = val; |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
2751 } |
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
2752 break; |
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
2753 |
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
2754 case mxSINGLE_CLASS: |
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
2755 error ("single precision sparse data type not supported"); |
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
2756 |
5903 | 2757 default: |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2758 panic_impossible (); |
5903 | 2759 } |
2760 | |
2761 return retval; | |
5900 | 2762 } |
2763 | |
2764 private: | |
2765 | |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
2766 // Pointer to the imaginary part of the data. |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2767 void *m_pi; |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2768 }; |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
2769 |
5900 | 2770 // Matlab-style struct arrays. |
2771 | |
2772 class mxArray_struct : public mxArray_matlab | |
2773 { | |
2774 public: | |
2775 | |
30213
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
2776 mxArray_struct (bool interleaved, mwSize ndims, const mwSize *dims, |
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
2777 int num_keys, const char **keys) |
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
2778 : mxArray_matlab (interleaved, mxSTRUCT_CLASS, ndims, dims), |
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
2779 m_nfields (num_keys), |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2780 m_fields (static_cast<char **> (mxArray::calloc (m_nfields, |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2781 sizeof (char *)))), |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2782 m_data (static_cast<mxArray **> (mxArray::calloc (m_nfields * |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2783 get_number_of_elements (), |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2784 sizeof (mxArray *)))) |
5900 | 2785 { |
2786 init (keys); | |
2787 } | |
2788 | |
30213
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
2789 mxArray_struct (bool interleaved, const dim_vector& dv, int num_keys, |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
2790 const char **keys) |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2791 : mxArray_matlab (interleaved, mxSTRUCT_CLASS, dv), |
30213
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
2792 m_nfields (num_keys), |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2793 m_fields (static_cast<char **> (mxArray::calloc (m_nfields, |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2794 sizeof (char *)))), |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2795 m_data (static_cast<mxArray **> (mxArray::calloc (m_nfields * |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2796 get_number_of_elements (), |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2797 sizeof (mxArray *)))) |
5900 | 2798 { |
2799 init (keys); | |
2800 } | |
2801 | |
30213
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
2802 mxArray_struct (bool interleaved, mwSize m, mwSize n, int num_keys, |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
2803 const char **keys) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
2804 : mxArray_matlab (interleaved, mxSTRUCT_CLASS, m, n), |
30213
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
2805 m_nfields (num_keys), |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2806 m_fields (static_cast<char **> (mxArray::calloc (m_nfields, |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2807 sizeof (char *)))), |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2808 m_data (static_cast<mxArray **> (mxArray::calloc (m_nfields * |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2809 get_number_of_elements (), |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2810 sizeof (mxArray *)))) |
5900 | 2811 { |
2812 init (keys); | |
2813 } | |
2814 | |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2815 private: |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2816 |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
2817 mxArray_struct (const mxArray_struct& val) |
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
2818 : mxArray_matlab (val), m_nfields (val.m_nfields), |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2819 m_fields (static_cast<char **> (mxArray::malloc (m_nfields |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2820 * sizeof (char *)))), |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2821 m_data (static_cast<mxArray **> (mxArray::malloc (m_nfields * |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2822 get_number_of_elements () |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2823 * sizeof (mxArray *)))) |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2824 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2825 for (int i = 0; i < m_nfields; i++) |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
2826 m_fields[i] = mxArray::strsave (val.m_fields[i]); |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2827 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2828 mwSize nel = get_number_of_elements (); |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2829 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2830 for (mwIndex i = 0; i < nel * m_nfields; i++) |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2831 { |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
2832 mxArray *ptr = val.m_data[i]; |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2833 m_data[i] = (ptr ? ptr->dup () : nullptr); |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2834 } |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2835 } |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2836 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2837 public: |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2838 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2839 // No assignment! FIXME: should this be implemented? Note that we |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2840 // do have a copy constructor. |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2841 |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
2842 mxArray_struct& operator = (const mxArray_struct& val); |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2843 |
5900 | 2844 void init (const char **keys) |
2845 { | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2846 for (int i = 0; i < m_nfields; i++) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2847 m_fields[i] = mxArray::strsave (keys[i]); |
5900 | 2848 } |
2849 | |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
2850 mxArray_base * dup (void) const { return new mxArray_struct (*this); } |
5900 | 2851 |
2852 ~mxArray_struct (void) | |
2853 { | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2854 for (int i = 0; i < m_nfields; i++) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2855 mxFree (m_fields[i]); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2856 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2857 mxFree (m_fields); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2858 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2859 mwSize ntot = m_nfields * get_number_of_elements (); |
6686 | 2860 |
2861 for (mwIndex i = 0; i < ntot; i++) | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2862 delete m_data[i]; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2863 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2864 mxFree (m_data); |
5900 | 2865 } |
2866 | |
2867 int add_field (const char *key) | |
2868 { | |
2869 int retval = -1; | |
2870 | |
30349
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2871 m_nfields++; |
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2872 |
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2873 m_fields = static_cast<char **> |
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2874 (mxRealloc (m_fields, m_nfields * sizeof (char *))); |
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2875 |
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2876 if (m_fields) |
5900 | 2877 { |
30349
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2878 m_fields[m_nfields-1] = mxArray::strsave (key); |
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2879 |
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2880 mwSize nel = get_number_of_elements (); |
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2881 |
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2882 mwSize ntot = m_nfields * nel; |
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2883 |
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2884 mxArray **new_data; |
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2885 new_data = static_cast<mxArray **> |
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2886 (mxArray::malloc (ntot * sizeof (mxArray *))); |
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2887 |
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2888 if (new_data) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2889 { |
30349
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2890 mwIndex j = 0; |
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2891 mwIndex k = 0; |
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2892 mwIndex n = 0; |
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2893 |
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2894 for (mwIndex i = 0; i < ntot; i++) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2895 { |
30349
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2896 if (++n == m_nfields) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2897 { |
30349
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2898 new_data[j++] = nullptr; |
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2899 n = 0; |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2900 } |
30349
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2901 else |
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2902 new_data[j++] = m_data[k++]; |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2903 } |
30349
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2904 |
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2905 mxFree (m_data); |
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2906 |
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2907 m_data = new_data; |
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2908 |
5c6c5c8bbefd
mxAddField: Allow keys to contain any characters (bug #61537)
John W. Eaton <jwe@octave.org>
parents:
30232
diff
changeset
|
2909 retval = m_nfields - 1; |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2910 } |
5900 | 2911 } |
2912 | |
2913 return retval; | |
2914 } | |
2915 | |
2916 void remove_field (int key_num) | |
2917 { | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2918 if (key_num >= 0 && key_num < m_nfields) |
5900 | 2919 { |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2920 mwSize nel = get_number_of_elements (); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2921 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2922 mwSize ntot = m_nfields * nel; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2923 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2924 int new_nfields = m_nfields - 1; |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2925 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2926 char **new_fields = static_cast<char **> |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2927 (mxArray::malloc (new_nfields * sizeof (char *))); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2928 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2929 mxArray **new_data = static_cast<mxArray **> |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2930 (mxArray::malloc (new_nfields * nel |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2931 * sizeof (mxArray *))); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2932 |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2933 for (int i = 0; i < key_num; i++) |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2934 new_fields[i] = m_fields[i]; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2935 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2936 for (int i = key_num + 1; i < m_nfields; i++) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2937 new_fields[i-1] = m_fields[i]; |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2938 |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2939 if (new_nfields > 0) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2940 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2941 mwIndex j = 0; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2942 mwIndex k = 0; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2943 mwIndex n = 0; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2944 |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2945 for (mwIndex i = 0; i < ntot; i++) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2946 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2947 if (n == key_num) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2948 k++; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2949 else |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2950 new_data[j++] = m_data[k++]; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2951 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2952 if (++n == m_nfields) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2953 n = 0; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2954 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2955 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2956 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2957 m_nfields = new_nfields; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2958 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2959 mxFree (m_fields); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2960 mxFree (m_data); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2961 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2962 m_fields = new_fields; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2963 m_data = new_data; |
5900 | 2964 } |
2965 } | |
2966 | |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
2967 mxArray * get_field_by_number (mwIndex index, int key_num) const |
5900 | 2968 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2969 return key_num >= 0 && key_num < m_nfields |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2970 ? m_data[m_nfields * index + key_num] : nullptr; |
5900 | 2971 } |
2972 | |
6686 | 2973 void set_field_by_number (mwIndex index, int key_num, mxArray *val); |
5900 | 2974 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2975 int get_number_of_fields (void) const { return m_nfields; } |
5900 | 2976 |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
2977 const char * get_field_name_by_number (int key_num) const |
5900 | 2978 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2979 return key_num >= 0 && key_num < m_nfields ? m_fields[key_num] : nullptr; |
5900 | 2980 } |
2981 | |
2982 int get_field_number (const char *key) const | |
2983 { | |
2984 int retval = -1; | |
2985 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2986 for (int i = 0; i < m_nfields; i++) |
5900 | 2987 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2988 if (! strcmp (key, m_fields[i])) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2989 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2990 retval = i; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2991 break; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
2992 } |
5900 | 2993 } |
2994 | |
2995 return retval; | |
2996 } | |
2997 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2998 void * get_data (void) const { return m_data; } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
2999 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3000 void set_data (void *data) { m_data = static_cast<mxArray **> (data); } |
5900 | 3001 |
5907 | 3002 octave_value as_octave_value (void) const |
3003 { | |
3004 dim_vector dv = dims_to_dim_vector (); | |
3005 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3006 string_vector keys (m_fields, m_nfields); |
5907 | 3007 |
25922
34e82a829fdd
Create scalar structs of size 1x1 with MEX interface (bug #54799).
Rik <rik@octave.org>
parents:
25751
diff
changeset
|
3008 octave_map m (dv); |
5907 | 3009 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3010 mwSize ntot = m_nfields * get_number_of_elements (); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3011 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3012 for (int i = 0; i < m_nfields; i++) |
5907 | 3013 { |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3014 Cell c (dv); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3015 |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3016 octave_value *p = c.fortran_vec (); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3017 |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3018 mwIndex k = 0; |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3019 for (mwIndex j = i; j < ntot; j += m_nfields) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3020 p[k++] = mxArray::as_octave_value (m_data[j]); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3021 |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3022 m.assign (keys[i], c); |
5907 | 3023 } |
3024 | |
3025 return m; | |
3026 } | |
3027 | |
5900 | 3028 private: |
3029 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3030 int m_nfields; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3031 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3032 char **m_fields; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3033 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3034 mxArray **m_data; |
5900 | 3035 }; |
3036 | |
3037 // Matlab-style cell arrays. | |
3038 | |
3039 class mxArray_cell : public mxArray_matlab | |
3040 { | |
3041 public: | |
3042 | |
30213
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
3043 mxArray_cell (bool interleaved, mwSize ndims, const mwSize *dims) |
27791344a45c
* mex.cc: Don't use _arg prefix for function argument names if possible.
John W. Eaton <jwe@octave.org>
parents:
30212
diff
changeset
|
3044 : mxArray_matlab (interleaved, mxCELL_CLASS, ndims, dims), |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3045 m_data (static_cast<mxArray **> ( |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3046 mxArray::calloc (get_number_of_elements (), sizeof (mxArray *)))) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3047 { } |
5900 | 3048 |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3049 mxArray_cell (bool interleaved, const dim_vector& dv) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3050 : mxArray_matlab (interleaved, mxCELL_CLASS, dv), |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3051 m_data (static_cast<mxArray **> ( |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3052 mxArray::calloc (get_number_of_elements (), sizeof (mxArray *)))) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3053 { } |
5900 | 3054 |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3055 mxArray_cell (bool interleaved, mwSize m, mwSize n) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3056 : mxArray_matlab (interleaved, mxCELL_CLASS, m, n), |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3057 m_data (static_cast<mxArray **> ( |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3058 mxArray::calloc (get_number_of_elements (), sizeof (mxArray *)))) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3059 { } |
5900 | 3060 |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3061 private: |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3062 |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
3063 mxArray_cell (const mxArray_cell& val) |
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
3064 : mxArray_matlab (val), |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3065 m_data (static_cast<mxArray **> ( |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3066 mxArray::malloc (get_number_of_elements () * sizeof (mxArray *)))) |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3067 { |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3068 mwSize nel = get_number_of_elements (); |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3069 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3070 for (mwIndex i = 0; i < nel; i++) |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3071 { |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
3072 mxArray *ptr = val.m_data[i]; |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3073 m_data[i] = (ptr ? ptr->dup () : nullptr); |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3074 } |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3075 } |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3076 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3077 public: |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3078 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3079 // No assignment! FIXME: should this be implemented? Note that we |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3080 // do have a copy constructor. |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3081 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3082 mxArray_cell& operator = (const mxArray_cell&); |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3083 |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
3084 mxArray_base * dup (void) const { return new mxArray_cell (*this); } |
5900 | 3085 |
3086 ~mxArray_cell (void) | |
3087 { | |
6686 | 3088 mwSize nel = get_number_of_elements (); |
3089 | |
22449
e337b8e3592c
Fix double free causing segfault in mxSetDimensions (bug #49010).
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
3090 for (mwIndex i = 0; i < nel; i++) |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3091 delete m_data[i]; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3092 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3093 mxFree (m_data); |
5900 | 3094 } |
3095 | |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
3096 mxArray * get_cell (mwIndex idx) const |
6187 | 3097 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3098 return idx >= 0 && idx < get_number_of_elements () ? m_data[idx] : nullptr; |
6187 | 3099 } |
5907 | 3100 |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
3101 void set_cell (mwIndex idx, mxArray *val); |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3102 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3103 void * get_data (void) const { return m_data; } |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3104 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3105 void set_data (void *data) { m_data = static_cast<mxArray **> (data); } |
5907 | 3106 |
5900 | 3107 octave_value as_octave_value (void) const |
3108 { | |
3109 dim_vector dv = dims_to_dim_vector (); | |
3110 | |
3111 Cell c (dv); | |
3112 | |
6686 | 3113 mwSize nel = get_number_of_elements (); |
5900 | 3114 |
3115 octave_value *p = c.fortran_vec (); | |
3116 | |
6686 | 3117 for (mwIndex i = 0; i < nel; i++) |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3118 p[i] = mxArray::as_octave_value (m_data[i]); |
5900 | 3119 |
3120 return c; | |
3121 } | |
3122 | |
3123 private: | |
3124 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3125 mxArray **m_data; |
5900 | 3126 }; |
3127 | |
3128 // ------------------------------------------------------------------ | |
3129 | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3130 mxArray::mxArray (bool interleaved, const octave_value& ov) |
30122
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3131 : m_rep (create_rep (interleaved, ov)), m_name (nullptr) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3132 { } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3133 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3134 mxArray::mxArray (bool interleaved, mxClassID id, mwSize ndims, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3135 const mwSize *dims, mxComplexity flag, bool init) |
30122
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3136 : m_rep (create_rep (interleaved, id, ndims, dims, flag, init)), |
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3137 m_name (nullptr) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3138 { } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3139 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3140 mxArray::mxArray (bool interleaved, mxClassID id, const dim_vector& dv, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3141 mxComplexity flag) |
30122
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3142 : m_rep (create_rep (interleaved, id, dv, flag)), m_name (nullptr) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3143 { } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3144 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3145 mxArray::mxArray (bool interleaved, mxClassID id, mwSize m, mwSize n, |
22464
1d2960b5efe6
Add new MEX fcns mxCreateUninitNumericArray, mxCreateUninitNumericMatrix.
Rik <rik@octave.org>
parents:
22462
diff
changeset
|
3146 mxComplexity flag, bool init) |
30122
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3147 : m_rep (create_rep (interleaved, id, m, n, flag, init)), m_name (nullptr) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3148 { } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3149 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3150 mxArray::mxArray (bool interleaved, mxClassID id, double val) |
30122
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3151 : m_rep (create_rep (interleaved, id, val)), m_name (nullptr) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3152 { } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3153 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3154 mxArray::mxArray (bool interleaved, mxClassID id, mxLogical val) |
30122
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3155 : m_rep (create_rep (interleaved, id, val)), m_name (nullptr) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3156 { } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3157 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3158 mxArray::mxArray (bool interleaved, const char *str) |
30122
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3159 : m_rep (create_rep (interleaved, str)), m_name (nullptr) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3160 { } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3161 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3162 mxArray::mxArray (bool interleaved, mwSize m, const char **str) |
30122
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3163 : m_rep (create_rep (interleaved, m, str)), m_name (nullptr) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3164 { } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3165 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3166 mxArray::mxArray (bool interleaved, mxClassID id, mwSize m, mwSize n, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3167 mwSize nzmax, mxComplexity flag) |
30122
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3168 : m_rep (create_rep (interleaved, id, m, n, nzmax, flag)), m_name (nullptr) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3169 { } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3170 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3171 mxArray::mxArray (bool interleaved, mwSize ndims, const mwSize *dims, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3172 int num_keys, |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3173 const char **keys) |
30122
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3174 : m_rep (new mxArray_struct (interleaved, ndims, dims, num_keys, keys)), |
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3175 m_name (nullptr) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3176 { } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3177 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3178 mxArray::mxArray (bool interleaved, const dim_vector& dv, int num_keys, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3179 const char **keys) |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3180 : m_rep (new mxArray_struct (interleaved, dv, num_keys, keys)), |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3181 m_name (nullptr) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3182 { } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3183 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3184 mxArray::mxArray (bool interleaved, mwSize m, mwSize n, int num_keys, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3185 const char **keys) |
30122
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3186 : m_rep (new mxArray_struct (interleaved, m, n, num_keys, keys)), |
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3187 m_name (nullptr) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3188 { } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3189 |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
3190 mxArray::mxArray (bool interleaved, mwSize ndims, const mwSize *dims) |
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
3191 : m_rep (new mxArray_cell (interleaved, ndims, dims)), m_name (nullptr) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3192 { } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3193 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3194 mxArray::mxArray (bool interleaved, const dim_vector& dv) |
30122
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3195 : m_rep (new mxArray_cell (interleaved, dv)), m_name (nullptr) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3196 { } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3197 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3198 mxArray::mxArray (bool interleaved, mwSize m, mwSize n) |
30122
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3199 : m_rep (new mxArray_cell (interleaved, m, n)), m_name (nullptr) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3200 { } |
5900 | 3201 |
3202 mxArray::~mxArray (void) | |
3203 { | |
30122
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3204 mxFree (m_name); |
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3205 |
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3206 delete m_rep; |
5900 | 3207 } |
3208 | |
3209 void | |
30122
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3210 mxArray::set_name (const char *name) |
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3211 { |
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3212 mxFree (m_name); |
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3213 m_name = mxArray::strsave (name); |
5900 | 3214 } |
3215 | |
5907 | 3216 octave_value |
25451
f84755f24ccd
allow NULL mxArray* to be returned as undefined from fcn calls (bug #54096)
John W. Eaton <jwe@octave.org>
parents:
25450
diff
changeset
|
3217 mxArray::as_octave_value (const mxArray *ptr, bool null_is_empty) |
5907 | 3218 { |
25451
f84755f24ccd
allow NULL mxArray* to be returned as undefined from fcn calls (bug #54096)
John W. Eaton <jwe@octave.org>
parents:
25450
diff
changeset
|
3219 static const octave_value empty_matrix = Matrix (); |
f84755f24ccd
allow NULL mxArray* to be returned as undefined from fcn calls (bug #54096)
John W. Eaton <jwe@octave.org>
parents:
25450
diff
changeset
|
3220 |
f84755f24ccd
allow NULL mxArray* to be returned as undefined from fcn calls (bug #54096)
John W. Eaton <jwe@octave.org>
parents:
25450
diff
changeset
|
3221 return (ptr |
f84755f24ccd
allow NULL mxArray* to be returned as undefined from fcn calls (bug #54096)
John W. Eaton <jwe@octave.org>
parents:
25450
diff
changeset
|
3222 ? ptr->as_octave_value () |
f84755f24ccd
allow NULL mxArray* to be returned as undefined from fcn calls (bug #54096)
John W. Eaton <jwe@octave.org>
parents:
25450
diff
changeset
|
3223 : (null_is_empty ? empty_matrix : octave_value ())); |
5907 | 3224 } |
3225 | |
3226 octave_value | |
3227 mxArray::as_octave_value (void) const | |
3228 { | |
30122
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3229 return m_rep->as_octave_value (); |
5907 | 3230 } |
3231 | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3232 mxArray_base * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3233 mxArray::create_rep (bool interleaved, const octave_value& ov) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3234 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3235 return new mxArray_octave_value (interleaved, ov); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3236 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3237 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3238 mxArray_base * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3239 mxArray::create_rep (bool interleaved, mxClassID id, mwSize ndims, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3240 const mwSize *dims, mxComplexity flag, bool init) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3241 { |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3242 if (interleaved) |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3243 return new mxArray_interleaved_full (id, ndims, dims, flag, init); |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3244 else |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3245 return new mxArray_separate_full (id, ndims, dims, flag, init); |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3246 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3247 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3248 mxArray_base * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3249 mxArray::create_rep (bool interleaved, mxClassID id, const dim_vector& dv, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3250 mxComplexity flag) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3251 { |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3252 if (interleaved) |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3253 return new mxArray_interleaved_full (id, dv, flag); |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3254 else |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3255 return new mxArray_separate_full (id, dv, flag); |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3256 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3257 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3258 mxArray_base * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3259 mxArray::create_rep (bool interleaved, mxClassID id, mwSize m, mwSize n, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3260 mxComplexity flag, bool init) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3261 { |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3262 if (interleaved) |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3263 return new mxArray_interleaved_full (id, m, n, flag, init); |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3264 else |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3265 return new mxArray_separate_full (id, m, n, flag, init); |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3266 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3267 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3268 mxArray_base * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3269 mxArray::create_rep (bool interleaved, mxClassID id, double val) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3270 { |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3271 if (interleaved) |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3272 return new mxArray_interleaved_full (id, val); |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3273 else |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3274 return new mxArray_separate_full (id, val); |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3275 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3276 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3277 mxArray_base * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3278 mxArray::create_rep (bool interleaved, mxClassID id, mxLogical val) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3279 { |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3280 if (interleaved) |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3281 return new mxArray_interleaved_full (id, val); |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3282 else |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3283 return new mxArray_separate_full (id, val); |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3284 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3285 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3286 mxArray_base * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3287 mxArray::create_rep (bool interleaved, const char *str) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3288 { |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3289 if (interleaved) |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3290 return new mxArray_interleaved_full (str); |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3291 else |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3292 return new mxArray_separate_full (str); |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3293 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3294 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3295 mxArray_base * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3296 mxArray::create_rep (bool interleaved, mwSize m, const char **str) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3297 { |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3298 if (interleaved) |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3299 return new mxArray_interleaved_full (m, str); |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3300 else |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3301 return new mxArray_separate_full (m, str); |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3302 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3303 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3304 mxArray_base * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3305 mxArray::create_rep (bool interleaved, mxClassID id, mwSize m, mwSize n, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3306 mwSize nzmax, mxComplexity flag) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3307 { |
30224
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3308 if (interleaved) |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3309 return new mxArray_interleaved_sparse (id, m, n, nzmax, flag); |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3310 else |
8670f5165430
use distinct classes for interleaved and separate numeric mxarray objects
John W. Eaton <jwe@octave.org>
parents:
30223
diff
changeset
|
3311 return new mxArray_separate_sparse (id, m, n, nzmax, flag); |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3312 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3313 |
5900 | 3314 void |
3315 mxArray::maybe_mutate (void) const | |
3316 { | |
30122
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3317 if (m_rep->is_octave_value ()) |
5900 | 3318 { |
3319 // The mutate function returns a pointer to a complete new | |
3320 // mxArray object (or 0, if no mutation happened). We just want | |
3321 // to replace the existing rep with the rep from the new object. | |
3322 | |
30122
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3323 mxArray *new_val = m_rep->mutate (); |
5900 | 3324 |
3325 if (new_val) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3326 { |
30122
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3327 delete m_rep; |
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3328 m_rep = new_val->m_rep; |
8418f99cfcd0
maint: use "m_" prefix for member variables in class mxArray_base.
Rik <rik@octave.org>
parents:
30088
diff
changeset
|
3329 new_val->m_rep = nullptr; |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3330 delete new_val; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3331 } |
5900 | 3332 } |
3333 } | |
3334 | |
3335 // ------------------------------------------------------------------ | |
3336 | |
6686 | 3337 // A class to manage calls to MEX functions. Mostly deals with memory |
5900 | 3338 // management. |
5864 | 3339 |
3340 class mex | |
3341 { | |
3342 public: | |
3343 | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3344 mex (octave_mex_function& f) |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3345 : m_curr_mex_fcn (f), m_memlist (), m_arraylist (), m_fname (nullptr) { } |
5864 | 3346 |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3347 // No copying! |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3348 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3349 mex (const mex&) = delete; |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3350 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3351 mex& operator = (const mex&) = delete; |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3352 |
5864 | 3353 ~mex (void) |
3354 { | |
20771
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
3355 // We can't use mex::free here because it modifies memlist. |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3356 while (! m_memlist.empty ()) |
20771
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
3357 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3358 auto p = m_memlist.begin (); |
20771
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
3359 xfree (*p); |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3360 m_memlist.erase (p); |
20771
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
3361 } |
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
3362 |
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
3363 // We can't use mex::free_value here because it modifies arraylist. |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3364 while (! m_arraylist.empty ()) |
20771
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
3365 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3366 auto p = m_arraylist.begin (); |
20771
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
3367 delete *p; |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3368 m_arraylist.erase (p); |
20771
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
3369 } |
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
3370 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3371 if (! (m_memlist.empty () && m_arraylist.empty ())) |
5905 | 3372 error ("mex: %s: cleanup failed", function_name ()); |
5900 | 3373 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3374 mxFree (m_fname); |
5864 | 3375 } |
3376 | |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
3377 const char * function_name (void) const |
5900 | 3378 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3379 if (! m_fname) |
5900 | 3380 { |
27206
4e4a9d7b436e
eliminate direct access to call stack in mex functions
John W. Eaton <jwe@octave.org>
parents:
27083
diff
changeset
|
3381 octave::tree_evaluator& tw |
4e4a9d7b436e
eliminate direct access to call stack in mex functions
John W. Eaton <jwe@octave.org>
parents:
27083
diff
changeset
|
3382 = octave::__get_evaluator__ ("mex::function_name"); |
4e4a9d7b436e
eliminate direct access to call stack in mex functions
John W. Eaton <jwe@octave.org>
parents:
27083
diff
changeset
|
3383 |
4e4a9d7b436e
eliminate direct access to call stack in mex functions
John W. Eaton <jwe@octave.org>
parents:
27083
diff
changeset
|
3384 octave_function *fcn = tw.current_function (); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3385 |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3386 if (fcn) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3387 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3388 std::string nm = fcn->name (); |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3389 m_fname = mxArray::strsave (nm.c_str ()); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3390 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3391 else |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3392 m_fname = mxArray::strsave ("unknown"); |
5900 | 3393 } |
3394 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3395 return m_fname; |
5900 | 3396 } |
3397 | |
6071 | 3398 // Allocate memory. |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
3399 void * malloc_unmarked (std::size_t n) |
5900 | 3400 { |
30428
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
3401 void *ptr = xmalloc (n); |
5900 | 3402 |
3403 if (! ptr) | |
3404 { | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3405 // FIXME: could use "octave_new_handler();" instead |
26159
aa678451b758
Silence compiler warning about incorrect format specifier (bug #55046).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26113
diff
changeset
|
3406 error ("%s: failed to allocate %zd bytes of memory", |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3407 function_name (), n); |
5900 | 3408 } |
3409 | |
3410 global_mark (ptr); | |
3411 | |
3412 return ptr; | |
3413 } | |
3414 | |
6071 | 3415 // Allocate memory to be freed on exit. |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
3416 void * malloc (std::size_t n) |
5900 | 3417 { |
3418 void *ptr = malloc_unmarked (n); | |
3419 | |
3420 mark (ptr); | |
3421 | |
3422 return ptr; | |
3423 } | |
3424 | |
6071 | 3425 // Allocate memory and initialize to 0. |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
3426 void * calloc_unmarked (std::size_t n, std::size_t t) |
5900 | 3427 { |
3428 void *ptr = malloc_unmarked (n*t); | |
3429 | |
3430 memset (ptr, 0, n*t); | |
3431 | |
3432 return ptr; | |
3433 } | |
3434 | |
6071 | 3435 // Allocate memory to be freed on exit and initialize to 0. |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
3436 void * calloc (std::size_t n, std::size_t t) |
5900 | 3437 { |
3438 void *ptr = calloc_unmarked (n, t); | |
3439 | |
3440 mark (ptr); | |
3441 | |
3442 return ptr; | |
3443 } | |
3444 | |
21751
b571fc85953f
maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents:
21743
diff
changeset
|
3445 // Reallocate a pointer obtained from malloc or calloc. |
b571fc85953f
maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents:
21743
diff
changeset
|
3446 // If the pointer is NULL, allocate using malloc. |
b571fc85953f
maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents:
21743
diff
changeset
|
3447 // We don't need an "unmarked" version of this. |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
3448 void * realloc (void *ptr, std::size_t n) |
5900 | 3449 { |
10225
477d05b0a739
mxRealloc: Allocate new memory on NULL argument
David Grundberg <davidg@cs.umu.se>
parents:
10127
diff
changeset
|
3450 void *v; |
477d05b0a739
mxRealloc: Allocate new memory on NULL argument
David Grundberg <davidg@cs.umu.se>
parents:
10127
diff
changeset
|
3451 |
477d05b0a739
mxRealloc: Allocate new memory on NULL argument
David Grundberg <davidg@cs.umu.se>
parents:
10127
diff
changeset
|
3452 if (ptr) |
5900 | 3453 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3454 auto p_local = m_memlist.find (ptr); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3455 auto p_global = s_global_memlist.find (ptr); |
26438
c048a6ac0f79
mex.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
3456 |
30428
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
3457 v = xrealloc (ptr, n); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
3458 |
26438
c048a6ac0f79
mex.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
3459 if (v) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3460 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3461 if (p_local != m_memlist.end ()) |
26438
c048a6ac0f79
mex.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
3462 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3463 m_memlist.erase (p_local); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3464 m_memlist.insert (v); |
26438
c048a6ac0f79
mex.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
3465 } |
c048a6ac0f79
mex.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
3466 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3467 if (p_global != s_global_memlist.end ()) |
26438
c048a6ac0f79
mex.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
3468 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3469 s_global_memlist.erase (p_global); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3470 s_global_memlist.insert (v); |
26438
c048a6ac0f79
mex.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
3471 } |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3472 } |
5900 | 3473 } |
10225
477d05b0a739
mxRealloc: Allocate new memory on NULL argument
David Grundberg <davidg@cs.umu.se>
parents:
10127
diff
changeset
|
3474 else |
477d05b0a739
mxRealloc: Allocate new memory on NULL argument
David Grundberg <davidg@cs.umu.se>
parents:
10127
diff
changeset
|
3475 v = malloc (n); |
5900 | 3476 |
3477 return v; | |
3478 } | |
3479 | |
3480 // Free a pointer obtained from malloc or calloc. | |
3481 void free (void *ptr) | |
3482 { | |
3483 if (ptr) | |
3484 { | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3485 unmark (ptr); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3486 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3487 auto p = s_global_memlist.find (ptr); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3488 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3489 if (p != s_global_memlist.end ()) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3490 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3491 s_global_memlist.erase (p); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3492 |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3493 xfree (ptr); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3494 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3495 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3496 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3497 p = m_foreign_memlist.find (ptr); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3498 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3499 if (p != m_foreign_memlist.end ()) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3500 m_foreign_memlist.erase (p); |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21660
diff
changeset
|
3501 #if defined (DEBUG) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3502 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3503 warning ("mxFree: skipping memory not allocated by mxMalloc, mxCalloc, or mxRealloc"); |
11276
475e90eb4ff1
mex::free: don't warn about skipping memory not allocated by mx{M,C,Re}alloc
John W. Eaton <jwe@octave.org>
parents:
11132
diff
changeset
|
3504 #endif |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3505 } |
5900 | 3506 } |
3507 } | |
3508 | |
7172 | 3509 // Mark a pointer to be freed on exit. |
3510 void mark (void *ptr) | |
3511 { | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21660
diff
changeset
|
3512 #if defined (DEBUG) |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3513 if (m_memlist.find (ptr) != m_memlist.end ()) |
7172 | 3514 warning ("%s: double registration ignored", function_name ()); |
3515 #endif | |
3516 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3517 m_memlist.insert (ptr); |
7172 | 3518 } |
3519 | |
3520 // Unmark a pointer to be freed on exit, either because it was | |
3521 // made persistent, or because it was already freed. | |
3522 void unmark (void *ptr) | |
3523 { | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3524 auto p = m_memlist.find (ptr); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3525 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3526 if (p != m_memlist.end ()) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3527 m_memlist.erase (p); |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21660
diff
changeset
|
3528 #if defined (DEBUG) |
7172 | 3529 else |
3530 warning ("%s: value not marked", function_name ()); | |
3531 #endif | |
3532 } | |
5900 | 3533 |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
3534 mxArray * mark_array (mxArray *ptr) |
6065 | 3535 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3536 m_arraylist.insert (ptr); |
6065 | 3537 return ptr; |
3538 } | |
3539 | |
6071 | 3540 void unmark_array (mxArray *ptr) |
3541 { | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3542 auto p = m_arraylist.find (ptr); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3543 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3544 if (p != m_arraylist.end ()) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3545 m_arraylist.erase (p); |
6071 | 3546 } |
3547 | |
7179 | 3548 // Mark a pointer as one we allocated. |
3549 void mark_foreign (void *ptr) | |
3550 { | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21660
diff
changeset
|
3551 #if defined (DEBUG) |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3552 if (m_foreign_memlist.find (ptr) != m_foreign_memlist.end ()) |
7179 | 3553 warning ("%s: double registration ignored", function_name ()); |
3554 #endif | |
3555 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3556 m_foreign_memlist.insert (ptr); |
7179 | 3557 } |
3558 | |
3559 // Unmark a pointer as one we allocated. | |
3560 void unmark_foreign (void *ptr) | |
3561 { | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3562 auto p = m_foreign_memlist.find (ptr); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3563 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3564 if (p != m_foreign_memlist.end ()) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3565 m_foreign_memlist.erase (p); |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21660
diff
changeset
|
3566 #if defined (DEBUG) |
7179 | 3567 else |
3568 warning ("%s: value not marked", function_name ()); | |
3569 #endif | |
3570 | |
3571 } | |
3572 | |
5900 | 3573 // Make a new array value and initialize from an octave value; it will be |
3574 // freed on exit unless marked as persistent. | |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23432
diff
changeset
|
3575 mxArray * make_value (const octave_value& ov) |
5900 | 3576 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3577 bool interleaved = m_curr_mex_fcn.use_interleaved_complex (); |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3578 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3579 return mark_array (new mxArray (interleaved, ov)); |
5900 | 3580 } |
3581 | |
3582 // Free an array and its contents. | |
6065 | 3583 bool free_value (mxArray *ptr) |
5900 | 3584 { |
6065 | 3585 bool inlist = false; |
3586 | |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3587 auto p = m_arraylist.find (ptr); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3588 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3589 if (p != m_arraylist.end ()) |
5905 | 3590 { |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3591 inlist = true; |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3592 m_arraylist.erase (p); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
3593 delete ptr; |
5905 | 3594 } |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21660
diff
changeset
|
3595 #if defined (DEBUG) |
5905 | 3596 else |
3597 warning ("mex::free_value: skipping memory not allocated by mex::make_value"); | |
3598 #endif | |
6065 | 3599 |
3600 return inlist; | |
5900 | 3601 } |
3602 | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3603 octave_mex_function& current_mex_function (void) const |
6068 | 3604 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3605 return m_curr_mex_fcn; |
6068 | 3606 } |
3607 | |
5900 | 3608 // 1 if error should be returned to MEX file, 0 if abort. |
22452
3a8af9d517de
Initialize MEX TrapFlag variable for Matlab compatibility.
Rik <rik@octave.org>
parents:
22451
diff
changeset
|
3609 int trap_feval_error = 0; |
5864 | 3610 |
5900 | 3611 // Mark a pointer as one we allocated. |
5905 | 3612 void global_mark (void *ptr) |
5900 | 3613 { |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21660
diff
changeset
|
3614 #if defined (DEBUG) |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3615 if (s_global_memlist.find (ptr) != s_global_memlist.end ()) |
5905 | 3616 warning ("%s: double registration ignored", function_name ()); |
5864 | 3617 #endif |
5900 | 3618 |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3619 s_global_memlist.insert (ptr); |
5864 | 3620 } |
3621 | |
5900 | 3622 // Unmark a pointer as one we allocated. |
5905 | 3623 void global_unmark (void *ptr) |
5864 | 3624 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3625 auto p = s_global_memlist.find (ptr); |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3626 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3627 if (p != s_global_memlist.end ()) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3628 s_global_memlist.erase (p); |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21660
diff
changeset
|
3629 #if defined (DEBUG) |
5905 | 3630 else |
3631 warning ("%s: value not marked", function_name ()); | |
5900 | 3632 #endif |
5864 | 3633 } |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3634 |
30226
f3ffb4596bd8
move ptr to imag data in mxArray to separate_full and separate_sparse classes
John W. Eaton <jwe@octave.org>
parents:
30225
diff
changeset
|
3635 private: |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3636 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3637 // Pointer to the mex function that corresponds to this mex context. |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3638 octave_mex_function& m_curr_mex_fcn; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3639 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3640 // List of memory resources that need to be freed upon exit. |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3641 std::set<void *> m_memlist; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3642 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3643 // List of mxArray objects that need to be freed upon exit. |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3644 std::set<mxArray *> m_arraylist; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3645 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3646 // List of memory resources we know about, but that were allocated |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3647 // elsewhere. |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3648 std::set<void *> m_foreign_memlist; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3649 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3650 // The name of the currently executing function. |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3651 mutable char *m_fname; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3652 |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3653 // List of memory resources we allocated. |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3654 static std::set<void *> s_global_memlist; |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3655 |
5864 | 3656 }; |
3657 | |
5900 | 3658 // List of memory resources we allocated. |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3659 std::set<void *> mex::s_global_memlist; |
5900 | 3660 |
3661 // Current context. | |
23457
21baad6b35c4
maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents:
23455
diff
changeset
|
3662 mex *mex_context = nullptr; |
5900 | 3663 |
3664 void * | |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
3665 mxArray::malloc (std::size_t n) |
5900 | 3666 { |
30428
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
3667 return mex_context ? mex_context->malloc_unmarked (n) : xmalloc (n); |
5900 | 3668 } |
3669 | |
3670 void * | |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
3671 mxArray::calloc (std::size_t n, std::size_t t) |
5900 | 3672 { |
6065 | 3673 return mex_context ? mex_context->calloc_unmarked (n, t) : ::calloc (n, t); |
5900 | 3674 } |
3675 | |
30223
b8841fcd28c8
combine calls to mxArray::malloc and mxArray::calloc in wrapper function
John W. Eaton <jwe@octave.org>
parents:
30213
diff
changeset
|
3676 void * |
b8841fcd28c8
combine calls to mxArray::malloc and mxArray::calloc in wrapper function
John W. Eaton <jwe@octave.org>
parents:
30213
diff
changeset
|
3677 mxArray::alloc (bool init, std::size_t n, std::size_t t) |
b8841fcd28c8
combine calls to mxArray::malloc and mxArray::calloc in wrapper function
John W. Eaton <jwe@octave.org>
parents:
30213
diff
changeset
|
3678 { |
b8841fcd28c8
combine calls to mxArray::malloc and mxArray::calloc in wrapper function
John W. Eaton <jwe@octave.org>
parents:
30213
diff
changeset
|
3679 return init ? mxArray::calloc (n, t) : mxArray::malloc (n * t); |
b8841fcd28c8
combine calls to mxArray::malloc and mxArray::calloc in wrapper function
John W. Eaton <jwe@octave.org>
parents:
30213
diff
changeset
|
3680 } |
b8841fcd28c8
combine calls to mxArray::malloc and mxArray::calloc in wrapper function
John W. Eaton <jwe@octave.org>
parents:
30213
diff
changeset
|
3681 |
7179 | 3682 static inline void * |
3683 maybe_mark_foreign (void *ptr) | |
3684 { | |
3685 if (mex_context) | |
3686 mex_context->mark_foreign (ptr); | |
3687 | |
3688 return ptr; | |
3689 } | |
3690 | |
30227
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
3691 static inline void |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
3692 maybe_disown_ptr (void *ptr) |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
3693 { |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
3694 if (mex_context) |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
3695 { |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
3696 mex_context->unmark (ptr); |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
3697 mex_context->global_unmark (ptr); |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
3698 mex_context->mark_foreign (ptr); |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
3699 } |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
3700 } |
b00ff462e0f2
improve efficiency of mxArray -> octave_value conversion
John W. Eaton <jwe@octave.org>
parents:
30226
diff
changeset
|
3701 |
6071 | 3702 static inline mxArray * |
3703 maybe_unmark_array (mxArray *ptr) | |
3704 { | |
3705 if (mex_context) | |
3706 mex_context->unmark_array (ptr); | |
3707 | |
3708 return ptr; | |
3709 } | |
3710 | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3711 template <typename T> |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3712 static inline T * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3713 maybe_unmark (T *ptr) |
7172 | 3714 { |
3715 if (mex_context) | |
3716 mex_context->unmark (ptr); | |
3717 | |
3718 return ptr; | |
3719 } | |
3720 | |
6071 | 3721 void |
6686 | 3722 mxArray_struct::set_field_by_number (mwIndex index, int key_num, mxArray *val) |
6071 | 3723 { |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3724 if (key_num >= 0 && key_num < m_nfields) |
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3725 m_data[m_nfields * index + key_num] = maybe_unmark_array (val); |
6071 | 3726 } |
3727 | |
3728 void | |
6686 | 3729 mxArray_cell::set_cell (mwIndex idx, mxArray *val) |
6071 | 3730 { |
6187 | 3731 if (idx >= 0 && idx < get_number_of_elements ()) |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3732 m_data[idx] = maybe_unmark_array (val); |
6071 | 3733 } |
3734 | |
5900 | 3735 // ------------------------------------------------------------------ |
3736 | |
3737 // C interface to mxArray objects: | |
3738 | |
3739 // Floating point predicates. | |
3740 | |
22465
6149f6b34cbc
Change all mxIs* functions in MEX API to return bool rather than int.
Rik <rik@octave.org>
parents:
22464
diff
changeset
|
3741 bool |
5900 | 3742 mxIsFinite (const double v) |
3743 { | |
30088
fca57eaad2d4
maint: deprecate lo_ieee_finite and replace with lo_ieee_isfinite.
Rik <rik@octave.org>
parents:
29993
diff
changeset
|
3744 return lo_ieee_isfinite (v) != 0; |
5900 | 3745 } |
3746 | |
22465
6149f6b34cbc
Change all mxIs* functions in MEX API to return bool rather than int.
Rik <rik@octave.org>
parents:
22464
diff
changeset
|
3747 bool |
5900 | 3748 mxIsInf (const double v) |
3749 { | |
3750 return lo_ieee_isinf (v) != 0; | |
3751 } | |
3752 | |
22465
6149f6b34cbc
Change all mxIs* functions in MEX API to return bool rather than int.
Rik <rik@octave.org>
parents:
22464
diff
changeset
|
3753 bool |
5900 | 3754 mxIsNaN (const double v) |
3755 { | |
3756 return lo_ieee_isnan (v) != 0; | |
3757 } | |
3758 | |
3759 double | |
3760 mxGetEps (void) | |
3761 { | |
15220
61822c866ba1
use std::numeric_limits<T>::epsilon in C++ code
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
3762 return std::numeric_limits<double>::epsilon (); |
5900 | 3763 } |
3764 | |
3765 double | |
3766 mxGetInf (void) | |
3767 { | |
3768 return lo_ieee_inf_value (); | |
3769 } | |
3770 | |
3771 double | |
3772 mxGetNaN (void) | |
3773 { | |
3774 return lo_ieee_nan_value (); | |
3775 } | |
3776 | |
3777 // Memory management. | |
3778 void * | |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
3779 mxCalloc (std::size_t n, std::size_t size) |
5900 | 3780 { |
15354
93dff6435fe1
tag calls to mxArray::malloc, mxArray::calloc, and mxArray::strsave with class name
John W. Eaton <jwe@octave.org>
parents:
15353
diff
changeset
|
3781 return mex_context ? mex_context->calloc (n, size) : ::calloc (n, size); |
5900 | 3782 } |
3783 | |
3784 void * | |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
3785 mxMalloc (std::size_t n) |
5900 | 3786 { |
30428
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
3787 return mex_context ? mex_context->malloc (n) : xmalloc (n); |
5900 | 3788 } |
3789 | |
3790 void * | |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
3791 mxRealloc (void *ptr, std::size_t size) |
5900 | 3792 { |
30428
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
3793 return (mex_context |
2ac26917bdec
mex.cc: allow for tracing malloc/realloc/free calls
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
3794 ? mex_context->realloc (ptr, size) : xrealloc (ptr, size)); |
5900 | 3795 } |
3796 | |
3797 void | |
3798 mxFree (void *ptr) | |
5864 | 3799 { |
5900 | 3800 if (mex_context) |
3801 mex_context->free (ptr); | |
5864 | 3802 else |
6071 | 3803 xfree (ptr); |
5900 | 3804 } |
6065 | 3805 |
3806 static inline mxArray * | |
3807 maybe_mark_array (mxArray *ptr) | |
3808 { | |
3809 return mex_context ? mex_context->mark_array (ptr) : ptr; | |
3810 } | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
3811 |
5900 | 3812 // Constructors. |
3813 mxArray * | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3814 mxCreateCellArray_interleaved (mwSize ndims, const mwSize *dims) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3815 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3816 return maybe_mark_array (new mxArray (true, ndims, dims)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3817 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3818 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3819 mxArray * |
6686 | 3820 mxCreateCellArray (mwSize ndims, const mwSize *dims) |
5900 | 3821 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3822 return maybe_mark_array (new mxArray (false, ndims, dims)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3823 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3824 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3825 mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3826 mxCreateCellMatrix_interleaved (mwSize m, mwSize n) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3827 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3828 return maybe_mark_array (new mxArray (true, m, n)); |
5900 | 3829 } |
3830 | |
3831 mxArray * | |
6686 | 3832 mxCreateCellMatrix (mwSize m, mwSize n) |
5900 | 3833 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3834 return maybe_mark_array (new mxArray (false, m, n)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3835 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3836 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3837 mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3838 mxCreateCharArray_interleaved (mwSize ndims, const mwSize *dims) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3839 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3840 return maybe_mark_array (new mxArray (true, mxCHAR_CLASS, ndims, dims)); |
5900 | 3841 } |
3842 | |
3843 mxArray * | |
6686 | 3844 mxCreateCharArray (mwSize ndims, const mwSize *dims) |
5900 | 3845 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3846 return maybe_mark_array (new mxArray (false, mxCHAR_CLASS, ndims, dims)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3847 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3848 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3849 mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3850 mxCreateCharMatrixFromStrings_interleaved (mwSize m, const char **str) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3851 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3852 return maybe_mark_array (new mxArray (true, m, str)); |
5864 | 3853 } |
3854 | |
5900 | 3855 mxArray * |
6686 | 3856 mxCreateCharMatrixFromStrings (mwSize m, const char **str) |
5900 | 3857 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3858 return maybe_mark_array (new mxArray (false, m, str)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3859 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3860 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3861 mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3862 mxCreateDoubleMatrix_interleaved (mwSize m, mwSize n, mxComplexity flag) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3863 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3864 return maybe_mark_array (new mxArray (true, mxDOUBLE_CLASS, m, n, flag)); |
5900 | 3865 } |
3866 | |
3867 mxArray * | |
6686 | 3868 mxCreateDoubleMatrix (mwSize m, mwSize n, mxComplexity flag) |
5900 | 3869 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3870 return maybe_mark_array (new mxArray (false, mxDOUBLE_CLASS, m, n, flag)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3871 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3872 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3873 mxArray * |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
3874 mxCreateDoubleScalar_interleaved (double val) |
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
3875 { |
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
3876 return maybe_mark_array (new mxArray (true, mxDOUBLE_CLASS, val)); |
5900 | 3877 } |
3878 | |
3879 mxArray * | |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
3880 mxCreateDoubleScalar (double val) |
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
3881 { |
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
3882 return maybe_mark_array (new mxArray (false, mxDOUBLE_CLASS, val)); |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3883 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3884 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3885 mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3886 mxCreateLogicalArray_interleaved (mwSize ndims, const mwSize *dims) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3887 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3888 return maybe_mark_array (new mxArray (true, mxLOGICAL_CLASS, ndims, dims)); |
5900 | 3889 } |
3890 | |
3891 mxArray * | |
6686 | 3892 mxCreateLogicalArray (mwSize ndims, const mwSize *dims) |
5864 | 3893 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3894 return maybe_mark_array (new mxArray (false, mxLOGICAL_CLASS, ndims, dims)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3895 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3896 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3897 mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3898 mxCreateLogicalMatrix_interleaved (mwSize m, mwSize n) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3899 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3900 return maybe_mark_array (new mxArray (true, mxLOGICAL_CLASS, m, n)); |
5900 | 3901 } |
3902 | |
3903 mxArray * | |
6686 | 3904 mxCreateLogicalMatrix (mwSize m, mwSize n) |
5900 | 3905 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3906 return maybe_mark_array (new mxArray (false, mxLOGICAL_CLASS, m, n)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3907 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3908 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3909 mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3910 mxCreateLogicalScalar_interleaved (mxLogical val) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3911 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3912 return maybe_mark_array (new mxArray (true, mxLOGICAL_CLASS, val)); |
5900 | 3913 } |
3914 | |
3915 mxArray * | |
7577
ba8fcc115fee
mex.cc: arg to mxCreateLogicalScalar is now mxLogical
John W. Eaton <jwe@octave.org>
parents:
7357
diff
changeset
|
3916 mxCreateLogicalScalar (mxLogical val) |
5900 | 3917 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3918 return maybe_mark_array (new mxArray (false, mxLOGICAL_CLASS, val)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3919 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3920 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3921 mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3922 mxCreateNumericArray_interleaved (mwSize ndims, const mwSize *dims, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3923 mxClassID class_id, mxComplexity flag) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3924 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3925 return maybe_mark_array (new mxArray (true, class_id, ndims, dims, flag)); |
5900 | 3926 } |
3927 | |
3928 mxArray * | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3929 mxCreateNumericArray (mwSize ndims, const mwSize *dims, |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
3930 mxClassID class_id, mxComplexity flag) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3931 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3932 return maybe_mark_array (new mxArray (false, class_id, ndims, dims, flag)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3933 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3934 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3935 mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3936 mxCreateNumericMatrix_interleaved (mwSize m, mwSize n, mxClassID class_id, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3937 mxComplexity flag) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3938 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3939 return maybe_mark_array (new mxArray (true, class_id, m, n, flag)); |
5864 | 3940 } |
3941 | |
5900 | 3942 mxArray * |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3943 mxCreateNumericMatrix (mwSize m, mwSize n, mxClassID class_id, |
30390
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30349
diff
changeset
|
3944 mxComplexity flag) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3945 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3946 return maybe_mark_array (new mxArray (false, class_id, m, n, flag)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3947 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3948 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3949 mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3950 mxCreateUninitNumericArray_interleaved (mwSize ndims, const mwSize *dims, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3951 mxClassID class_id, mxComplexity flag) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3952 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3953 return maybe_mark_array (new mxArray (true, class_id, ndims, dims, flag, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3954 false)); |
5900 | 3955 } |
3956 | |
3957 mxArray * | |
22464
1d2960b5efe6
Add new MEX fcns mxCreateUninitNumericArray, mxCreateUninitNumericMatrix.
Rik <rik@octave.org>
parents:
22462
diff
changeset
|
3958 mxCreateUninitNumericArray (mwSize ndims, const mwSize *dims, |
30390
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30349
diff
changeset
|
3959 mxClassID class_id, mxComplexity flag) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3960 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3961 return maybe_mark_array (new mxArray (false, class_id, ndims, dims, flag, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3962 false)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3963 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3964 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3965 mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3966 mxCreateUninitNumericMatrix_interleaved (mwSize m, mwSize n, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3967 mxClassID class_id, mxComplexity flag) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3968 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3969 return maybe_mark_array (new mxArray (true, class_id, m, n, flag, false)); |
22464
1d2960b5efe6
Add new MEX fcns mxCreateUninitNumericArray, mxCreateUninitNumericMatrix.
Rik <rik@octave.org>
parents:
22462
diff
changeset
|
3970 } |
1d2960b5efe6
Add new MEX fcns mxCreateUninitNumericArray, mxCreateUninitNumericMatrix.
Rik <rik@octave.org>
parents:
22462
diff
changeset
|
3971 |
1d2960b5efe6
Add new MEX fcns mxCreateUninitNumericArray, mxCreateUninitNumericMatrix.
Rik <rik@octave.org>
parents:
22462
diff
changeset
|
3972 mxArray * |
1d2960b5efe6
Add new MEX fcns mxCreateUninitNumericArray, mxCreateUninitNumericMatrix.
Rik <rik@octave.org>
parents:
22462
diff
changeset
|
3973 mxCreateUninitNumericMatrix (mwSize m, mwSize n, mxClassID class_id, |
30390
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30349
diff
changeset
|
3974 mxComplexity flag) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3975 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3976 return maybe_mark_array (new mxArray (false, class_id, m, n, flag, false)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3977 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3978 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3979 mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3980 mxCreateSparse_interleaved (mwSize m, mwSize n, mwSize nzmax, mxComplexity flag) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3981 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3982 return maybe_mark_array (new mxArray (true, mxDOUBLE_CLASS, m, n, nzmax, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3983 flag)); |
22464
1d2960b5efe6
Add new MEX fcns mxCreateUninitNumericArray, mxCreateUninitNumericMatrix.
Rik <rik@octave.org>
parents:
22462
diff
changeset
|
3984 } |
1d2960b5efe6
Add new MEX fcns mxCreateUninitNumericArray, mxCreateUninitNumericMatrix.
Rik <rik@octave.org>
parents:
22462
diff
changeset
|
3985 |
1d2960b5efe6
Add new MEX fcns mxCreateUninitNumericArray, mxCreateUninitNumericMatrix.
Rik <rik@octave.org>
parents:
22462
diff
changeset
|
3986 mxArray * |
6686 | 3987 mxCreateSparse (mwSize m, mwSize n, mwSize nzmax, mxComplexity flag) |
5900 | 3988 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3989 return maybe_mark_array (new mxArray (false, mxDOUBLE_CLASS, m, n, nzmax, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3990 flag)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3991 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3992 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3993 mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3994 mxCreateSparseLogicalMatrix_interleaved (mwSize m, mwSize n, mwSize nzmax) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3995 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3996 return maybe_mark_array (new mxArray (true, mxLOGICAL_CLASS, m, n, nzmax)); |
5900 | 3997 } |
3998 | |
3999 mxArray * | |
6686 | 4000 mxCreateSparseLogicalMatrix (mwSize m, mwSize n, mwSize nzmax) |
5900 | 4001 { |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4002 return maybe_mark_array (new mxArray (false, mxLOGICAL_CLASS, m, n, nzmax)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4003 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4004 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4005 mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4006 mxCreateString_interleaved (const char *str) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4007 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4008 return maybe_mark_array (new mxArray (true, str)); |
5900 | 4009 } |
4010 | |
4011 mxArray * | |
4012 mxCreateString (const char *str) | |
4013 { | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4014 return maybe_mark_array (new mxArray (false, str)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4015 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4016 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4017 mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4018 mxCreateStructArray_interleaved (mwSize ndims, const mwSize *dims, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4019 int num_keys, const char **keys) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4020 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4021 return maybe_mark_array (new mxArray (true, ndims, dims, num_keys, keys)); |
5900 | 4022 } |
4023 | |
4024 mxArray * | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4025 mxCreateStructArray (mwSize ndims, const mwSize *dims, int num_keys, |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
4026 const char **keys) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4027 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4028 return maybe_mark_array (new mxArray (false, ndims, dims, num_keys, keys)); |
5900 | 4029 } |
5864 | 4030 |
4031 mxArray * | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4032 mxCreateStructMatrix_interleaved (mwSize m, mwSize n, int num_keys, |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4033 const char **keys) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4034 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4035 return maybe_mark_array (new mxArray (true, m, n, num_keys, keys)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4036 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4037 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4038 mxArray * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4039 mxCreateStructMatrix (mwSize m, mwSize n, int num_keys, |
30129
b7c04a5036d3
maint: use "m_" prefix for member variables in file mex.cc.
Rik <rik@octave.org>
parents:
30122
diff
changeset
|
4040 const char **keys) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4041 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4042 return maybe_mark_array (new mxArray (false, m, n, num_keys, keys)); |
5900 | 4043 } |
4044 | |
4045 // Copy constructor. | |
4046 mxArray * | |
4047 mxDuplicateArray (const mxArray *ptr) | |
4048 { | |
11277
7d5351fc575a
mex.cc: convert mxArray_octave_value to matlab style representation when duplicating
John W. Eaton <jwe@octave.org>
parents:
11276
diff
changeset
|
4049 return maybe_mark_array (ptr->dup ()); |
5900 | 4050 } |
4051 | |
4052 // Destructor. | |
4053 void | |
4054 mxDestroyArray (mxArray *ptr) | |
4055 { | |
6065 | 4056 if (! (mex_context && mex_context->free_value (ptr))) |
4057 delete ptr; | |
5900 | 4058 } |
4059 | |
4060 // Type Predicates. | |
22465
6149f6b34cbc
Change all mxIs* functions in MEX API to return bool rather than int.
Rik <rik@octave.org>
parents:
22464
diff
changeset
|
4061 bool |
5900 | 4062 mxIsCell (const mxArray *ptr) |
4063 { | |
23576
00e518162fda
maint: Deprecate is_cell and replace with iscell.
Rik <rik@octave.org>
parents:
23553
diff
changeset
|
4064 return ptr->iscell (); |
5900 | 4065 } |
4066 | |
22465
6149f6b34cbc
Change all mxIs* functions in MEX API to return bool rather than int.
Rik <rik@octave.org>
parents:
22464
diff
changeset
|
4067 bool |
5900 | 4068 mxIsChar (const mxArray *ptr) |
4069 { | |
4070 return ptr->is_char (); | |
4071 } | |
4072 | |
22465
6149f6b34cbc
Change all mxIs* functions in MEX API to return bool rather than int.
Rik <rik@octave.org>
parents:
22464
diff
changeset
|
4073 bool |
5900 | 4074 mxIsClass (const mxArray *ptr, const char *name) |
4075 { | |
4076 return ptr->is_class (name); | |
4077 } | |
4078 | |
22465
6149f6b34cbc
Change all mxIs* functions in MEX API to return bool rather than int.
Rik <rik@octave.org>
parents:
22464
diff
changeset
|
4079 bool |
5900 | 4080 mxIsComplex (const mxArray *ptr) |
4081 { | |
4082 return ptr->is_complex (); | |
4083 } | |
4084 | |
22465
6149f6b34cbc
Change all mxIs* functions in MEX API to return bool rather than int.
Rik <rik@octave.org>
parents:
22464
diff
changeset
|
4085 bool |
5900 | 4086 mxIsDouble (const mxArray *ptr) |
4087 { | |
4088 return ptr->is_double (); | |
4089 } | |
4090 | |
22465
6149f6b34cbc
Change all mxIs* functions in MEX API to return bool rather than int.
Rik <rik@octave.org>
parents:
22464
diff
changeset
|
4091 bool |
11100
cdf940db26a0
provide mxIsFunctionHandle MEX interface function
John W. Eaton <jwe@octave.org>
parents:
11073
diff
changeset
|
4092 mxIsFunctionHandle (const mxArray *ptr) |
cdf940db26a0
provide mxIsFunctionHandle MEX interface function
John W. Eaton <jwe@octave.org>
parents:
11073
diff
changeset
|
4093 { |
cdf940db26a0
provide mxIsFunctionHandle MEX interface function
John W. Eaton <jwe@octave.org>
parents:
11073
diff
changeset
|
4094 return ptr->is_function_handle (); |
cdf940db26a0
provide mxIsFunctionHandle MEX interface function
John W. Eaton <jwe@octave.org>
parents:
11073
diff
changeset
|
4095 } |
cdf940db26a0
provide mxIsFunctionHandle MEX interface function
John W. Eaton <jwe@octave.org>
parents:
11073
diff
changeset
|
4096 |
22465
6149f6b34cbc
Change all mxIs* functions in MEX API to return bool rather than int.
Rik <rik@octave.org>
parents:
22464
diff
changeset
|
4097 bool |
5900 | 4098 mxIsInt16 (const mxArray *ptr) |
4099 { | |
4100 return ptr->is_int16 (); | |
4101 } | |
4102 | |
22465
6149f6b34cbc
Change all mxIs* functions in MEX API to return bool rather than int.
Rik <rik@octave.org>
parents:
22464
diff
changeset
|
4103 bool |
5900 | 4104 mxIsInt32 (const mxArray *ptr) |
4105 { | |
4106 return ptr->is_int32 (); | |
4107 } | |
4108 | |
22465
6149f6b34cbc
Change all mxIs* functions in MEX API to return bool rather than int.
Rik <rik@octave.org>
parents:
22464
diff
changeset
|
4109 bool |
5900 | 4110 mxIsInt64 (const mxArray *ptr) |
4111 { | |
4112 return ptr->is_int64 (); | |
4113 } | |
4114 | |
22465
6149f6b34cbc
Change all mxIs* functions in MEX API to return bool rather than int.
Rik <rik@octave.org>
parents:
22464
diff
changeset
|
4115 bool |
5900 | 4116 mxIsInt8 (const mxArray *ptr) |
4117 { | |
4118 return ptr->is_int8 (); | |
4119 } | |
4120 | |
22465
6149f6b34cbc
Change all mxIs* functions in MEX API to return bool rather than int.
Rik <rik@octave.org>
parents:
22464
diff
changeset
|
4121 bool |
5900 | 4122 mxIsLogical (const mxArray *ptr) |
4123 { | |
4124 return ptr->is_logical (); | |
4125 } | |
4126 | |
22465
6149f6b34cbc
Change all mxIs* functions in MEX API to return bool rather than int.
Rik <rik@octave.org>
parents:
22464
diff
changeset
|
4127 bool |
5900 | 4128 mxIsNumeric (const mxArray *ptr) |
4129 { | |
4130 return ptr->is_numeric (); | |
4131 } | |
4132 | |
22465
6149f6b34cbc
Change all mxIs* functions in MEX API to return bool rather than int.
Rik <rik@octave.org>
parents:
22464
diff
changeset
|
4133 bool |
5900 | 4134 mxIsSingle (const mxArray *ptr) |
4135 { | |
4136 return ptr->is_single (); | |
4137 } | |
4138 | |
22465
6149f6b34cbc
Change all mxIs* functions in MEX API to return bool rather than int.
Rik <rik@octave.org>
parents:
22464
diff
changeset
|
4139 bool |
5900 | 4140 mxIsSparse (const mxArray *ptr) |
4141 { | |
4142 return ptr->is_sparse (); | |
4143 } | |
4144 | |
22465
6149f6b34cbc
Change all mxIs* functions in MEX API to return bool rather than int.
Rik <rik@octave.org>
parents:
22464
diff
changeset
|
4145 bool |
5900 | 4146 mxIsStruct (const mxArray *ptr) |
4147 { | |
4148 return ptr->is_struct (); | |
4149 } | |
4150 | |
22465
6149f6b34cbc
Change all mxIs* functions in MEX API to return bool rather than int.
Rik <rik@octave.org>
parents:
22464
diff
changeset
|
4151 bool |
5900 | 4152 mxIsUint16 (const mxArray *ptr) |
4153 { | |
4154 return ptr->is_uint16 (); | |
4155 } | |
4156 | |
22465
6149f6b34cbc
Change all mxIs* functions in MEX API to return bool rather than int.
Rik <rik@octave.org>
parents:
22464
diff
changeset
|
4157 bool |
5900 | 4158 mxIsUint32 (const mxArray *ptr) |
4159 { | |
4160 return ptr->is_uint32 (); | |
4161 } | |
4162 | |
22465
6149f6b34cbc
Change all mxIs* functions in MEX API to return bool rather than int.
Rik <rik@octave.org>
parents:
22464
diff
changeset
|
4163 bool |
5900 | 4164 mxIsUint64 (const mxArray *ptr) |
4165 { | |
4166 return ptr->is_uint64 (); | |
4167 } | |
4168 | |
22465
6149f6b34cbc
Change all mxIs* functions in MEX API to return bool rather than int.
Rik <rik@octave.org>
parents:
22464
diff
changeset
|
4169 bool |
5900 | 4170 mxIsUint8 (const mxArray *ptr) |
4171 { | |
4172 return ptr->is_uint8 (); | |
4173 } | |
4174 | |
4175 // Odd type+size predicate. | |
22465
6149f6b34cbc
Change all mxIs* functions in MEX API to return bool rather than int.
Rik <rik@octave.org>
parents:
22464
diff
changeset
|
4176 bool |
5900 | 4177 mxIsLogicalScalar (const mxArray *ptr) |
4178 { | |
4179 return ptr->is_logical_scalar (); | |
4180 } | |
4181 | |
4182 // Odd type+size+value predicate. | |
22465
6149f6b34cbc
Change all mxIs* functions in MEX API to return bool rather than int.
Rik <rik@octave.org>
parents:
22464
diff
changeset
|
4183 bool |
5900 | 4184 mxIsLogicalScalarTrue (const mxArray *ptr) |
4185 { | |
4186 return ptr->is_logical_scalar_true (); | |
4187 } | |
4188 | |
4189 // Size predicate. | |
22465
6149f6b34cbc
Change all mxIs* functions in MEX API to return bool rather than int.
Rik <rik@octave.org>
parents:
22464
diff
changeset
|
4190 bool |
5900 | 4191 mxIsEmpty (const mxArray *ptr) |
4192 { | |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23576
diff
changeset
|
4193 return ptr->isempty (); |
5900 | 4194 } |
4195 | |
22462
6cb7813e5b2f
Add new mxIsScalar function for MEX API.
Rik <rik@octave.org>
parents:
22454
diff
changeset
|
4196 bool |
6cb7813e5b2f
Add new mxIsScalar function for MEX API.
Rik <rik@octave.org>
parents:
22454
diff
changeset
|
4197 mxIsScalar (const mxArray *ptr) |
6cb7813e5b2f
Add new mxIsScalar function for MEX API.
Rik <rik@octave.org>
parents:
22454
diff
changeset
|
4198 { |
6cb7813e5b2f
Add new mxIsScalar function for MEX API.
Rik <rik@octave.org>
parents:
22454
diff
changeset
|
4199 return ptr->is_scalar (); |
6cb7813e5b2f
Add new mxIsScalar function for MEX API.
Rik <rik@octave.org>
parents:
22454
diff
changeset
|
4200 } |
6cb7813e5b2f
Add new mxIsScalar function for MEX API.
Rik <rik@octave.org>
parents:
22454
diff
changeset
|
4201 |
20527
2d9ec16fa960
Print error, rather than aborting, if mex function mxIsFromGlobalWS is used (bug #46070).
Rik <rik@octave.org>
parents:
20362
diff
changeset
|
4202 // FIXME: Just plain odd thing to ask of a value. |
2d9ec16fa960
Print error, rather than aborting, if mex function mxIsFromGlobalWS is used (bug #46070).
Rik <rik@octave.org>
parents:
20362
diff
changeset
|
4203 // Still, Octave is incompatible because it does not implement this. |
22465
6149f6b34cbc
Change all mxIs* functions in MEX API to return bool rather than int.
Rik <rik@octave.org>
parents:
22464
diff
changeset
|
4204 bool |
20527
2d9ec16fa960
Print error, rather than aborting, if mex function mxIsFromGlobalWS is used (bug #46070).
Rik <rik@octave.org>
parents:
20362
diff
changeset
|
4205 mxIsFromGlobalWS (const mxArray * /*ptr*/) |
5900 | 4206 { |
20527
2d9ec16fa960
Print error, rather than aborting, if mex function mxIsFromGlobalWS is used (bug #46070).
Rik <rik@octave.org>
parents:
20362
diff
changeset
|
4207 mexErrMsgTxt ("mxIsFromGlobalWS() is unimplemented"); |
2d9ec16fa960
Print error, rather than aborting, if mex function mxIsFromGlobalWS is used (bug #46070).
Rik <rik@octave.org>
parents:
20362
diff
changeset
|
4208 |
5900 | 4209 return 0; |
4210 } | |
4211 | |
4212 // Dimension extractors. | |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
4213 std::size_t |
5900 | 4214 mxGetM (const mxArray *ptr) |
4215 { | |
4216 return ptr->get_m (); | |
4217 } | |
4218 | |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
4219 std::size_t |
5900 | 4220 mxGetN (const mxArray *ptr) |
4221 { | |
4222 return ptr->get_n (); | |
4223 } | |
4224 | |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
4225 const mwSize * |
5900 | 4226 mxGetDimensions (const mxArray *ptr) |
5864 | 4227 { |
5900 | 4228 return ptr->get_dimensions (); |
4229 } | |
4230 | |
6686 | 4231 mwSize |
5900 | 4232 mxGetNumberOfDimensions (const mxArray *ptr) |
4233 { | |
4234 return ptr->get_number_of_dimensions (); | |
4235 } | |
4236 | |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
4237 std::size_t |
5900 | 4238 mxGetNumberOfElements (const mxArray *ptr) |
4239 { | |
4240 return ptr->get_number_of_elements (); | |
4241 } | |
4242 | |
4243 // Dimension setters. | |
4244 void | |
6686 | 4245 mxSetM (mxArray *ptr, mwSize m) |
5900 | 4246 { |
4247 ptr->set_m (m); | |
4248 } | |
4249 | |
4250 void | |
6686 | 4251 mxSetN (mxArray *ptr, mwSize n) |
5900 | 4252 { |
4253 ptr->set_n (n); | |
4254 } | |
4255 | |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
4256 int |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
4257 mxSetDimensions (mxArray *ptr, const mwSize *dims, mwSize ndims) |
5900 | 4258 { |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
4259 return (ptr->set_dimensions (static_cast<mwSize *> |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
4260 (maybe_unmark (const_cast<mwSize *> (dims))), |
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
4261 ndims)); |
5900 | 4262 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
4263 |
5900 | 4264 // Data extractors. |
4265 double * | |
4266 mxGetPr (const mxArray *ptr) | |
4267 { | |
4268 return static_cast<double *> (ptr->get_data ()); | |
4269 } | |
4270 | |
4271 double | |
4272 mxGetScalar (const mxArray *ptr) | |
4273 { | |
6332 | 4274 return ptr->get_scalar (); |
5900 | 4275 } |
4276 | |
4277 mxChar * | |
4278 mxGetChars (const mxArray *ptr) | |
4279 { | |
22471
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
4280 if (mxIsChar (ptr)) |
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
4281 return static_cast<mxChar *> (ptr->get_data ()); |
667d353d1ab8
Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents:
22465
diff
changeset
|
4282 else |
23457
21baad6b35c4
maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents:
23455
diff
changeset
|
4283 return nullptr; |
5900 | 4284 } |
4285 | |
4286 mxLogical * | |
4287 mxGetLogicals (const mxArray *ptr) | |
4288 { | |
4289 return static_cast<mxLogical *> (ptr->get_data ()); | |
4290 } | |
4291 | |
4292 void * | |
4293 mxGetData (const mxArray *ptr) | |
4294 { | |
4295 return ptr->get_data (); | |
4296 } | |
4297 | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4298 double * |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4299 mxGetPi (const mxArray *ptr) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4300 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4301 return static_cast<double *> (ptr->get_imag_data ()); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4302 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4303 |
5900 | 4304 void * |
4305 mxGetImagData (const mxArray *ptr) | |
4306 { | |
4307 return ptr->get_imag_data (); | |
4308 } | |
4309 | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4310 mxDouble * mxGetDoubles (const mxArray *ptr) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4311 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4312 return ptr->get_doubles (); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4313 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4314 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4315 mxSingle * mxGetSingles (const mxArray *ptr) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4316 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4317 return ptr->get_singles (); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4318 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4319 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4320 mxInt8 * mxGetInt8s (const mxArray *ptr) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4321 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4322 return ptr->get_int8s (); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4323 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4324 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4325 mxInt16 * mxGetInt16s (const mxArray *ptr) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4326 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4327 return ptr->get_int16s (); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4328 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4329 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4330 mxInt32 * mxGetInt32s (const mxArray *ptr) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4331 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4332 return ptr->get_int32s (); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4333 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4334 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4335 mxInt64 * mxGetInt64s (const mxArray *ptr) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4336 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4337 return ptr->get_int64s (); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4338 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4339 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4340 mxUint8 * mxGetUint8s (const mxArray *ptr) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4341 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4342 return ptr->get_uint8s (); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4343 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4344 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4345 mxUint16 * mxGetUint16s (const mxArray *ptr) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4346 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4347 return ptr->get_uint16s (); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4348 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4349 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4350 mxUint32 * mxGetUint32s (const mxArray *ptr) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4351 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4352 return ptr->get_uint32s (); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4353 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4354 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4355 mxUint64 * mxGetUint64s (const mxArray *ptr) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4356 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4357 return ptr->get_uint64s (); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4358 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4359 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4360 mxComplexDouble * mxGetComplexDoubles (const mxArray *ptr) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4361 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4362 return ptr->get_complex_doubles (); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4363 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4364 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4365 mxComplexSingle * mxGetComplexSingles (const mxArray *ptr) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4366 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4367 return ptr->get_complex_singles (); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4368 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4369 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4370 #if 0 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4371 /* We don't have these yet. */ |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4372 mxComplexInt8 * mxGetComplexInt8s (const mxArray *ptr) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4373 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4374 return ptr->get_complex_int8s (); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4375 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4376 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4377 mxComplexInt16 * mxGetComplexInt16s (const mxArray *ptr) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4378 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4379 return ptr->get_complex_int16s (); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4380 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4381 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4382 mxComplexInt32 * mxGetComplexInt32s (const mxArray *ptr) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4383 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4384 return ptr->get_complex_int32s (); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4385 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4386 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4387 mxComplexInt64 * mxGetComplexInt64s (const mxArray *ptr) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4388 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4389 return ptr->get_complex_int64s (); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4390 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4391 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4392 mxComplexUint8 * mxGetComplexUint8s (const mxArray *ptr) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4393 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4394 return ptr->get_complex_uint8s (); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4395 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4396 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4397 mxComplexUint16 * mxGetComplexUint16s (const mxArray *ptr) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4398 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4399 return ptr->get_complex_uint16s (); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4400 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4401 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4402 mxComplexUint32 * mxGetComplexUint32s (const mxArray *ptr) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4403 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4404 return ptr->get_complex_uint32s (); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4405 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4406 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4407 mxComplexUint64 * mxGetComplexUint64s (const mxArray *ptr) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4408 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4409 return ptr->get_complex_uint64s (); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4410 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4411 #endif |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4412 |
5900 | 4413 // Data setters. |
4414 void | |
4415 mxSetPr (mxArray *ptr, double *pr) | |
4416 { | |
7172 | 4417 ptr->set_data (maybe_unmark (pr)); |
5900 | 4418 } |
4419 | |
4420 void | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4421 mxSetData (mxArray *ptr, void *pr) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4422 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4423 ptr->set_data (maybe_unmark (pr)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4424 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4425 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4426 int mxSetDoubles (mxArray *ptr, mxDouble *data) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4427 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4428 return ptr->set_doubles (maybe_unmark (data)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4429 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4430 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4431 int mxSetSingles (mxArray *ptr, mxSingle *data) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4432 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4433 return ptr->set_singles (maybe_unmark (data)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4434 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4435 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4436 int mxSetInt8s (mxArray *ptr, mxInt8 *data) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4437 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4438 return ptr->set_int8s (maybe_unmark (data)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4439 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4440 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4441 int mxSetInt16s (mxArray *ptr, mxInt16 *data) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4442 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4443 return ptr->set_int16s (maybe_unmark (data)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4444 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4445 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4446 int mxSetInt32s (mxArray *ptr, mxInt32 *data) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4447 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4448 return ptr->set_int32s (maybe_unmark (data)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4449 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4450 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4451 int mxSetInt64s (mxArray *ptr, mxInt64 *data) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4452 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4453 return ptr->set_int64s (maybe_unmark (data)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4454 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4455 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4456 int mxSetUint8s (mxArray *ptr, mxUint8 *data) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4457 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4458 return ptr->set_uint8s (maybe_unmark (data)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4459 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4460 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4461 int mxSetUint16s (mxArray *ptr, mxUint16 *data) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4462 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4463 return ptr->set_uint16s (maybe_unmark (data)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4464 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4465 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4466 int mxSetUint32s (mxArray *ptr, mxUint32 *data) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4467 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4468 return ptr->set_uint32s (maybe_unmark (data)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4469 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4470 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4471 int mxSetUint64s (mxArray *ptr, mxUint64 *data) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4472 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4473 return ptr->set_uint64s (maybe_unmark (data)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4474 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4475 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4476 int mxSetComplexDoubles (mxArray *ptr, mxComplexDouble *data) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4477 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4478 return ptr->set_complex_doubles (maybe_unmark (data)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4479 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4480 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4481 int mxSetComplexSingles (mxArray *ptr, mxComplexSingle *data) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4482 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4483 return ptr->set_complex_singles (maybe_unmark (data)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4484 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4485 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4486 #if 0 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4487 /* We don't have these yet. */ |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4488 int mxSetComplexInt8s (mxArray *ptr, mxComplexInt8 *data) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4489 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4490 return ptr->set_complex_int8s (maybe_unmark (data)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4491 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4492 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4493 int mxSetComplexInt16s (mxArray *ptr, mxComplexInt16 *data) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4494 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4495 return ptr->set_complex_int16s (maybe_unmark (data)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4496 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4497 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4498 int mxSetComplexInt32s (mxArray *ptr, mxComplexInt32 *data) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4499 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4500 return ptr->set_complex_int32s (maybe_unmark (data)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4501 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4502 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4503 int mxSetComplexInt64s (mxArray *ptr, mxComplexInt64 *data) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4504 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4505 return ptr->set_complex_int64s (maybe_unmark (data)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4506 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4507 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4508 int mxSetComplexUint8s (mxArray *ptr, mxComplexUint8 *data) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4509 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4510 return ptr->set_complex_uint8s (maybe_unmark (data)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4511 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4512 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4513 int mxSetComplexUint16s (mxArray *ptr, mxComplexUint16 *data) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4514 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4515 return ptr->set_complex_uint16s (maybe_unmark (data)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4516 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4517 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4518 int mxSetComplexUint32s (mxArray *ptr, mxComplexUint32 *data) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4519 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4520 return ptr->set_complex_uint32s (maybe_unmark (data)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4521 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4522 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4523 int mxSetComplexUint64s (mxArray *ptr, mxComplexUint64 *data) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4524 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4525 return ptr->set_complex_uint64s (maybe_unmark (data)); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4526 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4527 #endif |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4528 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4529 void |
5900 | 4530 mxSetPi (mxArray *ptr, double *pi) |
4531 { | |
7172 | 4532 ptr->set_imag_data (maybe_unmark (pi)); |
5864 | 4533 } |
4534 | |
5900 | 4535 void |
4536 mxSetImagData (mxArray *ptr, void *pi) | |
4537 { | |
7172 | 4538 ptr->set_imag_data (maybe_unmark (pi)); |
5900 | 4539 } |
4540 | |
4541 // Classes. | |
4542 mxClassID | |
4543 mxGetClassID (const mxArray *ptr) | |
4544 { | |
4545 return ptr->get_class_id (); | |
4546 } | |
4547 | |
4548 const char * | |
4549 mxGetClassName (const mxArray *ptr) | |
4550 { | |
4551 return ptr->get_class_name (); | |
4552 } | |
4553 | |
4554 void | |
4555 mxSetClassName (mxArray *ptr, const char *name) | |
4556 { | |
4557 ptr->set_class_name (name); | |
4558 } | |
4559 | |
23893
75eff5b667b3
new mxSetProperty function for MEX API
John W. Eaton <jwe@octave.org>
parents:
23891
diff
changeset
|
4560 void |
75eff5b667b3
new mxSetProperty function for MEX API
John W. Eaton <jwe@octave.org>
parents:
23891
diff
changeset
|
4561 mxSetProperty (mxArray *ptr, mwIndex idx, const char *property_name, |
75eff5b667b3
new mxSetProperty function for MEX API
John W. Eaton <jwe@octave.org>
parents:
23891
diff
changeset
|
4562 const mxArray *property_value) |
75eff5b667b3
new mxSetProperty function for MEX API
John W. Eaton <jwe@octave.org>
parents:
23891
diff
changeset
|
4563 { |
75eff5b667b3
new mxSetProperty function for MEX API
John W. Eaton <jwe@octave.org>
parents:
23891
diff
changeset
|
4564 ptr->set_property (idx, property_name, property_value); |
75eff5b667b3
new mxSetProperty function for MEX API
John W. Eaton <jwe@octave.org>
parents:
23891
diff
changeset
|
4565 } |
75eff5b667b3
new mxSetProperty function for MEX API
John W. Eaton <jwe@octave.org>
parents:
23891
diff
changeset
|
4566 |
23891
142a9c7e403a
Avoid CamelCase in variables names in mxGetProperty cset (bd9e719f04cc).
Rik <rik@octave.org>
parents:
23884
diff
changeset
|
4567 mxArray * |
142a9c7e403a
Avoid CamelCase in variables names in mxGetProperty cset (bd9e719f04cc).
Rik <rik@octave.org>
parents:
23884
diff
changeset
|
4568 mxGetProperty (const mxArray *ptr, mwIndex idx, const char *property_name) |
23884
bd9e719f04cc
new mxGetProperty function for MEX API
Piotr Held <pjheld@gmail.com>
parents:
23795
diff
changeset
|
4569 { |
23891
142a9c7e403a
Avoid CamelCase in variables names in mxGetProperty cset (bd9e719f04cc).
Rik <rik@octave.org>
parents:
23884
diff
changeset
|
4570 return ptr->get_property (idx, property_name); |
23884
bd9e719f04cc
new mxGetProperty function for MEX API
Piotr Held <pjheld@gmail.com>
parents:
23795
diff
changeset
|
4571 } |
bd9e719f04cc
new mxGetProperty function for MEX API
Piotr Held <pjheld@gmail.com>
parents:
23795
diff
changeset
|
4572 |
5900 | 4573 // Cell support. |
4574 mxArray * | |
6686 | 4575 mxGetCell (const mxArray *ptr, mwIndex idx) |
5900 | 4576 { |
4577 return ptr->get_cell (idx); | |
4578 } | |
4579 | |
4580 void | |
6686 | 4581 mxSetCell (mxArray *ptr, mwIndex idx, mxArray *val) |
5900 | 4582 { |
4583 ptr->set_cell (idx, val); | |
4584 } | |
4585 | |
4586 // Sparse support. | |
6686 | 4587 mwIndex * |
5900 | 4588 mxGetIr (const mxArray *ptr) |
4589 { | |
4590 return ptr->get_ir (); | |
4591 } | |
4592 | |
6686 | 4593 mwIndex * |
5900 | 4594 mxGetJc (const mxArray *ptr) |
4595 { | |
4596 return ptr->get_jc (); | |
4597 } | |
4598 | |
6686 | 4599 mwSize |
5900 | 4600 mxGetNzmax (const mxArray *ptr) |
4601 { | |
4602 return ptr->get_nzmax (); | |
4603 } | |
4604 | |
4605 void | |
6686 | 4606 mxSetIr (mxArray *ptr, mwIndex *ir) |
5900 | 4607 { |
19739
3fa35defe495
Adjust spacing of static_cast<> calls to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
4608 ptr->set_ir (static_cast<mwIndex *> (maybe_unmark (ir))); |
5900 | 4609 } |
4610 | |
4611 void | |
6686 | 4612 mxSetJc (mxArray *ptr, mwIndex *jc) |
5900 | 4613 { |
7172 | 4614 ptr->set_jc (static_cast<mwIndex *> (maybe_unmark (jc))); |
5900 | 4615 } |
4616 | |
4617 void | |
6686 | 4618 mxSetNzmax (mxArray *ptr, mwSize nzmax) |
5900 | 4619 { |
4620 ptr->set_nzmax (nzmax); | |
4621 } | |
4622 | |
4623 // Structure support. | |
4624 int | |
4625 mxAddField (mxArray *ptr, const char *key) | |
4626 { | |
4627 return ptr->add_field (key); | |
4628 } | |
4629 | |
4630 void | |
4631 mxRemoveField (mxArray *ptr, int key_num) | |
4632 { | |
4633 ptr->remove_field (key_num); | |
4634 } | |
5864 | 4635 |
4636 mxArray * | |
6686 | 4637 mxGetField (const mxArray *ptr, mwIndex index, const char *key) |
5900 | 4638 { |
4639 int key_num = mxGetFieldNumber (ptr, key); | |
4640 return mxGetFieldByNumber (ptr, index, key_num); | |
4641 } | |
4642 | |
4643 mxArray * | |
6686 | 4644 mxGetFieldByNumber (const mxArray *ptr, mwIndex index, int key_num) |
5864 | 4645 { |
5900 | 4646 return ptr->get_field_by_number (index, key_num); |
5864 | 4647 } |
4648 | |
5900 | 4649 void |
6686 | 4650 mxSetField (mxArray *ptr, mwIndex index, const char *key, mxArray *val) |
5900 | 4651 { |
4652 int key_num = mxGetFieldNumber (ptr, key); | |
4653 mxSetFieldByNumber (ptr, index, key_num, val); | |
4654 } | |
5864 | 4655 |
4656 void | |
6686 | 4657 mxSetFieldByNumber (mxArray *ptr, mwIndex index, int key_num, mxArray *val) |
5864 | 4658 { |
5900 | 4659 ptr->set_field_by_number (index, key_num, val); |
4660 } | |
4661 | |
4662 int | |
4663 mxGetNumberOfFields (const mxArray *ptr) | |
4664 { | |
4665 return ptr->get_number_of_fields (); | |
5864 | 4666 } |
4667 | |
5900 | 4668 const char * |
4669 mxGetFieldNameByNumber (const mxArray *ptr, int key_num) | |
5864 | 4670 { |
5900 | 4671 return ptr->get_field_name_by_number (key_num); |
4672 } | |
4673 | |
4674 int | |
4675 mxGetFieldNumber (const mxArray *ptr, const char *key) | |
4676 { | |
4677 return ptr->get_field_number (key); | |
5864 | 4678 } |
4679 | |
5900 | 4680 int |
6686 | 4681 mxGetString (const mxArray *ptr, char *buf, mwSize buflen) |
5900 | 4682 { |
4683 return ptr->get_string (buf, buflen); | |
4684 } | |
4685 | |
4686 char * | |
4687 mxArrayToString (const mxArray *ptr) | |
5864 | 4688 { |
5900 | 4689 return ptr->array_to_string (); |
4690 } | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
4691 |
6686 | 4692 mwIndex |
4693 mxCalcSingleSubscript (const mxArray *ptr, mwSize nsubs, mwIndex *subs) | |
5900 | 4694 { |
4695 return ptr->calc_single_subscript (nsubs, subs); | |
5864 | 4696 } |
5900 | 4697 |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
4698 std::size_t |
5900 | 4699 mxGetElementSize (const mxArray *ptr) |
4700 { | |
4701 return ptr->get_element_size (); | |
4702 } | |
4703 | |
4704 // ------------------------------------------------------------------ | |
5864 | 4705 |
4706 typedef void (*cmex_fptr) (int nlhs, mxArray **plhs, int nrhs, mxArray **prhs); | |
23498
647705ffb110
use F77_INT type for integer args to Fortran MEX functions
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
4707 typedef F77_RET_T (*fmex_fptr) (F77_INT& nlhs, mxArray **plhs, |
647705ffb110
use F77_INT type for integer args to Fortran MEX functions
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
4708 F77_INT& nrhs, mxArray **prhs); |
5864 | 4709 |
4710 octave_value_list | |
23499
7d89f815d78e
modernize octave_mex_function
John W. Eaton <jwe@octave.org>
parents:
23498
diff
changeset
|
4711 call_mex (octave_mex_function& mex_fcn, const octave_value_list& args, |
7d89f815d78e
modernize octave_mex_function
John W. Eaton <jwe@octave.org>
parents:
23498
diff
changeset
|
4712 int nargout_arg) |
5864 | 4713 { |
20771
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
4714 octave_quit (); |
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
4715 |
5900 | 4716 // Use at least 1 for nargout since even for zero specified args, |
4717 // still want to be able to return an ans. | |
5864 | 4718 |
8806 | 4719 volatile int nargout = nargout_arg; |
4720 | |
5864 | 4721 int nargin = args.length (); |
5900 | 4722 OCTAVE_LOCAL_BUFFER (mxArray *, argin, nargin); |
5864 | 4723 for (int i = 0; i < nargin; i++) |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23703
diff
changeset
|
4724 argin[i] = nullptr; |
5864 | 4725 |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
4726 int nout = (nargout == 0 ? 1 : nargout); |
5900 | 4727 OCTAVE_LOCAL_BUFFER (mxArray *, argout, nout); |
5864 | 4728 for (int i = 0; i < nout; i++) |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23703
diff
changeset
|
4729 argout[i] = nullptr; |
5864 | 4730 |
5905 | 4731 // Save old mex pointer. |
28823
26cfccfee9a0
Replace unwind_protect with more efficient constructs (bug #59192).
Rik <rik@octave.org>
parents:
28370
diff
changeset
|
4732 octave::unwind_protect_var<mex *> restore_var (mex_context); |
5905 | 4733 |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4734 mex context (mex_fcn); |
5900 | 4735 |
5864 | 4736 for (int i = 0; i < nargin; i++) |
4737 argin[i] = context.make_value (args(i)); | |
4738 | |
20771
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
4739 mex_context = &context; |
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
4740 |
23499
7d89f815d78e
modernize octave_mex_function
John W. Eaton <jwe@octave.org>
parents:
23498
diff
changeset
|
4741 void *mex_fcn_ptr = mex_fcn.mex_fcn_ptr (); |
7d89f815d78e
modernize octave_mex_function
John W. Eaton <jwe@octave.org>
parents:
23498
diff
changeset
|
4742 |
7d89f815d78e
modernize octave_mex_function
John W. Eaton <jwe@octave.org>
parents:
23498
diff
changeset
|
4743 if (mex_fcn.is_fmex ()) |
5864 | 4744 { |
23499
7d89f815d78e
modernize octave_mex_function
John W. Eaton <jwe@octave.org>
parents:
23498
diff
changeset
|
4745 fmex_fptr fcn = reinterpret_cast<fmex_fptr> (mex_fcn_ptr); |
20771
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
4746 |
23498
647705ffb110
use F77_INT type for integer args to Fortran MEX functions
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
4747 F77_INT tmp_nargout = nargout; |
647705ffb110
use F77_INT type for integer args to Fortran MEX functions
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
4748 F77_INT tmp_nargin = nargin; |
20771
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
4749 |
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
4750 fcn (tmp_nargout, argout, tmp_nargin, argin); |
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
4751 } |
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
4752 else |
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
4753 { |
23499
7d89f815d78e
modernize octave_mex_function
John W. Eaton <jwe@octave.org>
parents:
23498
diff
changeset
|
4754 cmex_fptr fcn = reinterpret_cast<cmex_fptr> (mex_fcn_ptr); |
20771
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
4755 |
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
4756 fcn (nargout, argout, nargin, argin); |
5864 | 4757 } |
4758 | |
4759 // Convert returned array entries back into octave values. | |
4760 | |
4761 octave_value_list retval; | |
4762 | |
20555
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
4763 if (nargout == 0 && argout[0]) |
5864 | 4764 { |
20555
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
4765 // We have something for ans. |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
4766 nargout = 1; |
5864 | 4767 } |
4768 | |
20555
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
4769 retval.resize (nargout); |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
4770 |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
4771 for (int i = 0; i < nargout; i++) |
25451
f84755f24ccd
allow NULL mxArray* to be returned as undefined from fcn calls (bug #54096)
John W. Eaton <jwe@octave.org>
parents:
25450
diff
changeset
|
4772 retval(i) = mxArray::as_octave_value (argout[i], false); |
20555
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
4773 |
5864 | 4774 return retval; |
4775 } | |
4776 | |
4777 // C interface to mex functions: | |
4778 | |
4779 const char * | |
4780 mexFunctionName (void) | |
4781 { | |
5900 | 4782 return mex_context ? mex_context->function_name () : "unknown"; |
4783 } | |
4784 | |
4785 int | |
15354
93dff6435fe1
tag calls to mxArray::malloc, mxArray::calloc, and mxArray::strsave with class name
John W. Eaton <jwe@octave.org>
parents:
15353
diff
changeset
|
4786 mexCallMATLAB (int nargout, mxArray *argout[], int nargin, |
15373
b5d0a47c171c
* mex.cc (mexCallMATLAB): Remove stray const added in 93dff6435fe1 (bug #37342).
John W. Eaton <jwe@octave.org>
parents:
15354
diff
changeset
|
4787 mxArray *argin[], const char *fname) |
5900 | 4788 { |
4789 octave_value_list args; | |
4790 | |
4791 args.resize (nargin); | |
4792 | |
4793 for (int i = 0; i < nargin; i++) | |
5907 | 4794 args(i) = mxArray::as_octave_value (argin[i]); |
5900 | 4795 |
27474
3fec8e9fa2aa
make recover_from_exception a member function
John W. Eaton <jwe@octave.org>
parents:
27471
diff
changeset
|
4796 octave::interpreter& interp = octave::__get_interpreter__ ("mexCallMATLAB"); |
3fec8e9fa2aa
make recover_from_exception a member function
John W. Eaton <jwe@octave.org>
parents:
27471
diff
changeset
|
4797 |
20535
b70cc4bd8109
begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents:
20527
diff
changeset
|
4798 bool execution_error = false; |
b70cc4bd8109
begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents:
20527
diff
changeset
|
4799 |
b70cc4bd8109
begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents:
20527
diff
changeset
|
4800 octave_value_list retval; |
b70cc4bd8109
begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents:
20527
diff
changeset
|
4801 |
b70cc4bd8109
begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents:
20527
diff
changeset
|
4802 try |
b70cc4bd8109
begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents:
20527
diff
changeset
|
4803 { |
29172
32fdcf67a683
don't propagate prevailing isargout info through mexCallMATLAB (bug #59597)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4804 octave::tree_evaluator& tw = interp.get_evaluator (); |
32fdcf67a683
don't propagate prevailing isargout info through mexCallMATLAB (bug #59597)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4805 |
32fdcf67a683
don't propagate prevailing isargout info through mexCallMATLAB (bug #59597)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4806 octave::unwind_action act |
32fdcf67a683
don't propagate prevailing isargout info through mexCallMATLAB (bug #59597)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4807 ([&tw] (const std::list<octave::octave_lvalue> *lvl) |
32fdcf67a683
don't propagate prevailing isargout info through mexCallMATLAB (bug #59597)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4808 { |
32fdcf67a683
don't propagate prevailing isargout info through mexCallMATLAB (bug #59597)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4809 tw.set_lvalue_list (lvl); |
32fdcf67a683
don't propagate prevailing isargout info through mexCallMATLAB (bug #59597)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4810 }, tw.lvalue_list ()); |
32fdcf67a683
don't propagate prevailing isargout info through mexCallMATLAB (bug #59597)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4811 |
32fdcf67a683
don't propagate prevailing isargout info through mexCallMATLAB (bug #59597)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4812 tw.set_lvalue_list (nullptr); |
32fdcf67a683
don't propagate prevailing isargout info through mexCallMATLAB (bug #59597)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
4813 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23052
diff
changeset
|
4814 retval = octave::feval (fname, args, nargout); |
20535
b70cc4bd8109
begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents:
20527
diff
changeset
|
4815 } |
22327
d0562b3159c7
move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
4816 catch (const octave::execution_exception&) |
20535
b70cc4bd8109
begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents:
20527
diff
changeset
|
4817 { |
20771
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
4818 if (mex_context->trap_feval_error) |
22450
2fb86778f78d
Return correct status from mexCallMATLAB when mexSetTrapFlag is 1 (bug #48949).
Rik <rik@octave.org>
parents:
22449
diff
changeset
|
4819 { |
27471 | 4820 // FIXME: is there a way to indicate what error occurred? |
4821 // Should the error message be displayed here? Do we need to | |
4822 // save the exception info for lasterror? | |
4823 | |
27474
3fec8e9fa2aa
make recover_from_exception a member function
John W. Eaton <jwe@octave.org>
parents:
27471
diff
changeset
|
4824 interp.recover_from_exception (); |
22450
2fb86778f78d
Return correct status from mexCallMATLAB when mexSetTrapFlag is 1 (bug #48949).
Rik <rik@octave.org>
parents:
22449
diff
changeset
|
4825 |
2fb86778f78d
Return correct status from mexCallMATLAB when mexSetTrapFlag is 1 (bug #48949).
Rik <rik@octave.org>
parents:
22449
diff
changeset
|
4826 execution_error = true; |
2fb86778f78d
Return correct status from mexCallMATLAB when mexSetTrapFlag is 1 (bug #48949).
Rik <rik@octave.org>
parents:
22449
diff
changeset
|
4827 } |
20771
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
4828 else |
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
4829 { |
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
4830 args.resize (0); |
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
4831 retval.resize (0); |
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
4832 |
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
4833 throw; |
ed708a7ce0a2
simplify memory management for mex files (bug #46559)
John W. Eaton <jwe@octave.org>
parents:
20756
diff
changeset
|
4834 } |
5900 | 4835 } |
4836 | |
4837 int num_to_copy = retval.length (); | |
4838 | |
4839 if (nargout < retval.length ()) | |
4840 num_to_copy = nargout; | |
4841 | |
4842 for (int i = 0; i < num_to_copy; i++) | |
4843 { | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4844 // FIXME: it would be nice to avoid copying the value here, |
5900 | 4845 // but there is no way to steal memory from a matrix, never mind |
4846 // that matrix memory is allocated by new[] and mxArray memory | |
4847 // is allocated by malloc(). | |
22450
2fb86778f78d
Return correct status from mexCallMATLAB when mexSetTrapFlag is 1 (bug #48949).
Rik <rik@octave.org>
parents:
22449
diff
changeset
|
4848 argout[i] = mex_context->make_value (retval(i)); |
5900 | 4849 } |
4850 | |
4851 while (num_to_copy < nargout) | |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23703
diff
changeset
|
4852 argout[num_to_copy++] = nullptr; |
5900 | 4853 |
20535
b70cc4bd8109
begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents:
20527
diff
changeset
|
4854 return execution_error ? 1 : 0; |
5900 | 4855 } |
4856 | |
22451
ad5439817753
Add mexCallMATLABWithTrap to MEX API (bug #48949).
Rik <rik@octave.org>
parents:
22450
diff
changeset
|
4857 mxArray * |
ad5439817753
Add mexCallMATLABWithTrap to MEX API (bug #48949).
Rik <rik@octave.org>
parents:
22450
diff
changeset
|
4858 mexCallMATLABWithTrap (int nargout, mxArray *argout[], int nargin, |
ad5439817753
Add mexCallMATLABWithTrap to MEX API (bug #48949).
Rik <rik@octave.org>
parents:
22450
diff
changeset
|
4859 mxArray *argin[], const char *fname) |
ad5439817753
Add mexCallMATLABWithTrap to MEX API (bug #48949).
Rik <rik@octave.org>
parents:
22450
diff
changeset
|
4860 { |
23457
21baad6b35c4
maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents:
23455
diff
changeset
|
4861 mxArray *mx = nullptr; |
22451
ad5439817753
Add mexCallMATLABWithTrap to MEX API (bug #48949).
Rik <rik@octave.org>
parents:
22450
diff
changeset
|
4862 |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
4863 int old_flag = (mex_context ? mex_context->trap_feval_error : 0); |
22451
ad5439817753
Add mexCallMATLABWithTrap to MEX API (bug #48949).
Rik <rik@octave.org>
parents:
22450
diff
changeset
|
4864 mexSetTrapFlag (1); |
ad5439817753
Add mexCallMATLABWithTrap to MEX API (bug #48949).
Rik <rik@octave.org>
parents:
22450
diff
changeset
|
4865 if (mexCallMATLAB (nargout, argout, nargin, argin, fname)) |
ad5439817753
Add mexCallMATLABWithTrap to MEX API (bug #48949).
Rik <rik@octave.org>
parents:
22450
diff
changeset
|
4866 { |
22454
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4867 const char *field_names[] = {"identifier", "message", "case", "stack"}; |
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4868 mx = mxCreateStructMatrix (1, 1, 4, field_names); |
22451
ad5439817753
Add mexCallMATLABWithTrap to MEX API (bug #48949).
Rik <rik@octave.org>
parents:
22450
diff
changeset
|
4869 mxSetFieldByNumber (mx, 0, 0, mxCreateString ("Octave:MEX")); |
ad5439817753
Add mexCallMATLABWithTrap to MEX API (bug #48949).
Rik <rik@octave.org>
parents:
22450
diff
changeset
|
4870 std::string msg = "mexCallMATLABWithTrap: function call <" |
ad5439817753
Add mexCallMATLABWithTrap to MEX API (bug #48949).
Rik <rik@octave.org>
parents:
22450
diff
changeset
|
4871 + std::string (fname) + "> failed"; |
ad5439817753
Add mexCallMATLABWithTrap to MEX API (bug #48949).
Rik <rik@octave.org>
parents:
22450
diff
changeset
|
4872 mxSetFieldByNumber (mx, 0, 1, mxCreateString (msg.c_str ())); |
ad5439817753
Add mexCallMATLABWithTrap to MEX API (bug #48949).
Rik <rik@octave.org>
parents:
22450
diff
changeset
|
4873 mxSetFieldByNumber (mx, 0, 2, mxCreateCellMatrix (0, 0)); |
23457
21baad6b35c4
maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents:
23455
diff
changeset
|
4874 mxSetFieldByNumber (mx, 0, 3, mxCreateStructMatrix (0, 1, 0, nullptr)); |
22451
ad5439817753
Add mexCallMATLABWithTrap to MEX API (bug #48949).
Rik <rik@octave.org>
parents:
22450
diff
changeset
|
4875 } |
ad5439817753
Add mexCallMATLABWithTrap to MEX API (bug #48949).
Rik <rik@octave.org>
parents:
22450
diff
changeset
|
4876 mexSetTrapFlag (old_flag); |
ad5439817753
Add mexCallMATLABWithTrap to MEX API (bug #48949).
Rik <rik@octave.org>
parents:
22450
diff
changeset
|
4877 |
ad5439817753
Add mexCallMATLABWithTrap to MEX API (bug #48949).
Rik <rik@octave.org>
parents:
22450
diff
changeset
|
4878 return mx; |
ad5439817753
Add mexCallMATLABWithTrap to MEX API (bug #48949).
Rik <rik@octave.org>
parents:
22450
diff
changeset
|
4879 } |
ad5439817753
Add mexCallMATLABWithTrap to MEX API (bug #48949).
Rik <rik@octave.org>
parents:
22450
diff
changeset
|
4880 |
5900 | 4881 void |
4882 mexSetTrapFlag (int flag) | |
4883 { | |
4884 if (mex_context) | |
4885 mex_context->trap_feval_error = flag; | |
4886 } | |
4887 | |
4888 int | |
4889 mexEvalString (const char *s) | |
4890 { | |
4891 int retval = 0; | |
4892 | |
27474
3fec8e9fa2aa
make recover_from_exception a member function
John W. Eaton <jwe@octave.org>
parents:
27471
diff
changeset
|
4893 octave::interpreter& interp = octave::__get_interpreter__ ("mexEvalString"); |
3fec8e9fa2aa
make recover_from_exception a member function
John W. Eaton <jwe@octave.org>
parents:
27471
diff
changeset
|
4894 |
5900 | 4895 int parse_status; |
22454
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4896 bool execution_error = false; |
5900 | 4897 |
4898 octave_value_list ret; | |
4899 | |
20535
b70cc4bd8109
begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents:
20527
diff
changeset
|
4900 try |
5900 | 4901 { |
26113
8a15f3bace49
move eval_string inside interpreter/evaluator class
John W. Eaton <jwe@octave.org>
parents:
25922
diff
changeset
|
4902 ret = interp.eval_string (std::string (s), false, parse_status, 0); |
5900 | 4903 } |
22327
d0562b3159c7
move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
4904 catch (const octave::execution_exception&) |
20535
b70cc4bd8109
begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents:
20527
diff
changeset
|
4905 { |
27474
3fec8e9fa2aa
make recover_from_exception a member function
John W. Eaton <jwe@octave.org>
parents:
27471
diff
changeset
|
4906 interp.recover_from_exception (); |
20756
200ae1d650b7
propagate octave_execution_exception objects through try/catch blocks
John W. Eaton <jwe@octave.org>
parents:
20555
diff
changeset
|
4907 |
20535
b70cc4bd8109
begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents:
20527
diff
changeset
|
4908 execution_error = true; |
b70cc4bd8109
begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents:
20527
diff
changeset
|
4909 } |
b70cc4bd8109
begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents:
20527
diff
changeset
|
4910 |
b70cc4bd8109
begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents:
20527
diff
changeset
|
4911 if (parse_status || execution_error) |
b70cc4bd8109
begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents:
20527
diff
changeset
|
4912 retval = 1; |
5864 | 4913 |
4914 return retval; | |
4915 } | |
4916 | |
22454
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4917 mxArray * |
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4918 mexEvalStringWithTrap (const char *s) |
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4919 { |
23457
21baad6b35c4
maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents:
23455
diff
changeset
|
4920 mxArray *mx = nullptr; |
22454
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4921 |
27474
3fec8e9fa2aa
make recover_from_exception a member function
John W. Eaton <jwe@octave.org>
parents:
27471
diff
changeset
|
4922 octave::interpreter& interp = octave::__get_interpreter__ ("mexEvalString"); |
3fec8e9fa2aa
make recover_from_exception a member function
John W. Eaton <jwe@octave.org>
parents:
27471
diff
changeset
|
4923 |
22454
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4924 int parse_status; |
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4925 bool execution_error = false; |
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4926 |
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4927 octave_value_list ret; |
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4928 |
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4929 try |
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4930 { |
26113
8a15f3bace49
move eval_string inside interpreter/evaluator class
John W. Eaton <jwe@octave.org>
parents:
25922
diff
changeset
|
4931 ret = interp.eval_string (std::string (s), false, parse_status, 0); |
22454
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4932 } |
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4933 catch (const octave::execution_exception&) |
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4934 { |
27474
3fec8e9fa2aa
make recover_from_exception a member function
John W. Eaton <jwe@octave.org>
parents:
27471
diff
changeset
|
4935 interp.recover_from_exception (); |
22454
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4936 |
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4937 execution_error = true; |
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4938 } |
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4939 |
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4940 if (parse_status || execution_error) |
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4941 { |
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4942 const char *field_names[] = {"identifier", "message", "case", "stack"}; |
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4943 mx = mxCreateStructMatrix (1, 1, 4, field_names); |
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4944 mxSetFieldByNumber (mx, 0, 0, mxCreateString ("Octave:MEX")); |
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4945 std::string msg = "mexEvalStringWithTrap: eval of <" |
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4946 + std::string (s) + "> failed"; |
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4947 mxSetFieldByNumber (mx, 0, 1, mxCreateString (msg.c_str ())); |
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4948 mxSetFieldByNumber (mx, 0, 2, mxCreateCellMatrix (0, 0)); |
23457
21baad6b35c4
maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents:
23455
diff
changeset
|
4949 mxSetFieldByNumber (mx, 0, 3, mxCreateStructMatrix (0, 1, 0, nullptr)); |
22454
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4950 } |
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4951 |
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4952 return mx; |
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4953 } |
8445f67a8123
Add function mexEvalStringWithTrap to MEX API.
Rik <rik@octave.org>
parents:
22452
diff
changeset
|
4954 |
5864 | 4955 void |
4956 mexErrMsgTxt (const char *s) | |
4957 { | |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
4958 std::size_t len; |
25751
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
4959 |
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
4960 if (s && (len = strlen (s)) > 0) |
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
4961 { |
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
4962 if (s[len - 1] == '\n') |
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
4963 { |
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
4964 std::string s_tmp (s, len - 1); |
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
4965 error ("%s: %s\n", mexFunctionName (), s_tmp.c_str ()); |
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
4966 } |
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
4967 else |
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
4968 error ("%s: %s", mexFunctionName (), s); |
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
4969 } |
5864 | 4970 else |
16851
209f0db3c32b
mexErrMsgTxt should abort when called with an empty string (bug #39343).
Rik <rik@octave.org>
parents:
16708
diff
changeset
|
4971 { |
209f0db3c32b
mexErrMsgTxt should abort when called with an empty string (bug #39343).
Rik <rik@octave.org>
parents:
16708
diff
changeset
|
4972 // For compatibility with Matlab, print an empty message. |
209f0db3c32b
mexErrMsgTxt should abort when called with an empty string (bug #39343).
Rik <rik@octave.org>
parents:
16708
diff
changeset
|
4973 // Octave's error routine requires a non-null input so use a SPACE. |
209f0db3c32b
mexErrMsgTxt should abort when called with an empty string (bug #39343).
Rik <rik@octave.org>
parents:
16708
diff
changeset
|
4974 error (" "); |
209f0db3c32b
mexErrMsgTxt should abort when called with an empty string (bug #39343).
Rik <rik@octave.org>
parents:
16708
diff
changeset
|
4975 } |
5864 | 4976 } |
4977 | |
5879 | 4978 void |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
4979 mexErrMsgIdAndTxt (const char *id, const char *fmt, ...) |
5879 | 4980 { |
6338 | 4981 if (fmt && strlen (fmt) > 0) |
4982 { | |
4983 const char *fname = mexFunctionName (); | |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
4984 std::size_t len = strlen (fname) + 2 + strlen (fmt) + 1; |
6338 | 4985 OCTAVE_LOCAL_BUFFER (char, tmpfmt, len); |
4986 sprintf (tmpfmt, "%s: %s", fname, fmt); | |
4987 va_list args; | |
4988 va_start (args, fmt); | |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
4989 verror_with_id (id, tmpfmt, args); |
6338 | 4990 va_end (args); |
4991 } | |
5879 | 4992 else |
16851
209f0db3c32b
mexErrMsgTxt should abort when called with an empty string (bug #39343).
Rik <rik@octave.org>
parents:
16708
diff
changeset
|
4993 { |
209f0db3c32b
mexErrMsgTxt should abort when called with an empty string (bug #39343).
Rik <rik@octave.org>
parents:
16708
diff
changeset
|
4994 // For compatibility with Matlab, print an empty message. |
209f0db3c32b
mexErrMsgTxt should abort when called with an empty string (bug #39343).
Rik <rik@octave.org>
parents:
16708
diff
changeset
|
4995 // Octave's error routine requires a non-null input so use a SPACE. |
209f0db3c32b
mexErrMsgTxt should abort when called with an empty string (bug #39343).
Rik <rik@octave.org>
parents:
16708
diff
changeset
|
4996 error (" "); |
209f0db3c32b
mexErrMsgTxt should abort when called with an empty string (bug #39343).
Rik <rik@octave.org>
parents:
16708
diff
changeset
|
4997 } |
5879 | 4998 } |
4999 | |
5000 void | |
5001 mexWarnMsgTxt (const char *s) | |
5002 { | |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
5003 std::size_t len; |
25751
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
5004 |
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
5005 if (s && (len = strlen (s)) > 0) |
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
5006 { |
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
5007 if (s[len - 1] == '\n') |
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
5008 { |
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
5009 std::string s_tmp (s, len - 1); |
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
5010 warning ("%s\n", s_tmp.c_str ()); |
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
5011 } |
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
5012 else |
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
5013 warning ("%s", s); |
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
5014 } |
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
5015 else |
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
5016 { |
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
5017 // For compatibility with Matlab, print an empty message. |
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
5018 // Octave's warning routine requires a non-null input so use a SPACE. |
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
5019 warning (" "); |
4bd60c9c6169
Suppress backtrace when MexErrMsgTxt message ends with newline (bug #54454).
Rik <rik@octave.org>
parents:
25688
diff
changeset
|
5020 } |
5879 | 5021 } |
5022 | |
5023 void | |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
5024 mexWarnMsgIdAndTxt (const char *id, const char *fmt, ...) |
5879 | 5025 { |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5026 // FIXME: is this right? What does Matlab do if fmt is NULL or |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5027 // an empty string? |
6338 | 5028 |
5029 if (fmt && strlen (fmt) > 0) | |
5030 { | |
5031 const char *fname = mexFunctionName (); | |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
5032 std::size_t len = strlen (fname) + 2 + strlen (fmt) + 1; |
6338 | 5033 OCTAVE_LOCAL_BUFFER (char, tmpfmt, len); |
5034 sprintf (tmpfmt, "%s: %s", fname, fmt); | |
5035 va_list args; | |
5036 va_start (args, fmt); | |
30212
c27b9ba4c9bd
* mex.cc: Don't use m_ prefix for function arguments and local variables.
John W. Eaton <jwe@octave.org>
parents:
30129
diff
changeset
|
5037 vwarning_with_id (id, tmpfmt, args); |
6338 | 5038 va_end (args); |
5039 } | |
5879 | 5040 } |
5864 | 5041 |
10127
f21fdff5c906
Change signature of mexPrintf.
David Grundberg <davidg@cs.umu.se>
parents:
10126
diff
changeset
|
5042 int |
5864 | 5043 mexPrintf (const char *fmt, ...) |
5044 { | |
10127
f21fdff5c906
Change signature of mexPrintf.
David Grundberg <davidg@cs.umu.se>
parents:
10126
diff
changeset
|
5045 int retval; |
5864 | 5046 va_list args; |
5047 va_start (args, fmt); | |
25646
4d565baa475e
move libinterp/utils functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25452
diff
changeset
|
5048 retval = octave::vformat (octave_stdout, fmt, args); |
5864 | 5049 va_end (args); |
10127
f21fdff5c906
Change signature of mexPrintf.
David Grundberg <davidg@cs.umu.se>
parents:
10126
diff
changeset
|
5050 return retval; |
5864 | 5051 } |
5052 | |
5053 mxArray * | |
5879 | 5054 mexGetVariable (const char *space, const char *name) |
5864 | 5055 { |
23457
21baad6b35c4
maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents:
23455
diff
changeset
|
5056 mxArray *retval = nullptr; |
5864 | 5057 |
7752
40c428ea3408
initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents:
7577
diff
changeset
|
5058 octave_value val; |
5864 | 5059 |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26438
diff
changeset
|
5060 octave::interpreter& interp = octave::__get_interpreter__ ("mexGetVariable"); |
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26438
diff
changeset
|
5061 |
5864 | 5062 if (! strcmp (space, "global")) |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26438
diff
changeset
|
5063 val = interp.global_varval (name); |
5864 | 5064 else |
7752
40c428ea3408
initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents:
7577
diff
changeset
|
5065 { |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5066 // FIXME: should this be in variables.cc? |
9144
c6463412aebb
eliminate symbol_table::scope_stack; fix scoping issue with evalin
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
5067 |
21743
f4d7d0eb5b0c
use namespace for unwind_protect class
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
5068 octave::unwind_protect frame; |
9144
c6463412aebb
eliminate symbol_table::scope_stack; fix scoping issue with evalin
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
5069 |
7901 | 5070 bool caller = ! strcmp (space, "caller"); |
5071 bool base = ! strcmp (space, "base"); | |
5072 | |
5073 if (caller || base) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
5074 { |
16708
08f0f274de36
use correct "caller" workspace for mexputvariable and mexgetvariable
John W. Eaton <jwe@octave.org>
parents:
16442
diff
changeset
|
5075 // MEX files don't create a separate frame in the call stack, |
08f0f274de36
use correct "caller" workspace for mexputvariable and mexgetvariable
John W. Eaton <jwe@octave.org>
parents:
16442
diff
changeset
|
5076 // so we are already in the "caller" frame. |
08f0f274de36
use correct "caller" workspace for mexputvariable and mexgetvariable
John W. Eaton <jwe@octave.org>
parents:
16442
diff
changeset
|
5077 |
08f0f274de36
use correct "caller" workspace for mexputvariable and mexgetvariable
John W. Eaton <jwe@octave.org>
parents:
16442
diff
changeset
|
5078 if (base) |
08f0f274de36
use correct "caller" workspace for mexputvariable and mexgetvariable
John W. Eaton <jwe@octave.org>
parents:
16442
diff
changeset
|
5079 { |
27206
4e4a9d7b436e
eliminate direct access to call stack in mex functions
John W. Eaton <jwe@octave.org>
parents:
27083
diff
changeset
|
5080 octave::tree_evaluator& tw = interp.get_evaluator (); |
4e4a9d7b436e
eliminate direct access to call stack in mex functions
John W. Eaton <jwe@octave.org>
parents:
27083
diff
changeset
|
5081 |
29253
28913793f678
prefer unwind_action over unwind_protect in more places
John W. Eaton <jwe@octave.org>
parents:
29173
diff
changeset
|
5082 frame.add (&octave::tree_evaluator::restore_frame, &tw, |
28913793f678
prefer unwind_action over unwind_protect in more places
John W. Eaton <jwe@octave.org>
parents:
29173
diff
changeset
|
5083 tw.current_call_stack_frame_number ()); |
27206
4e4a9d7b436e
eliminate direct access to call stack in mex functions
John W. Eaton <jwe@octave.org>
parents:
27083
diff
changeset
|
5084 |
4e4a9d7b436e
eliminate direct access to call stack in mex functions
John W. Eaton <jwe@octave.org>
parents:
27083
diff
changeset
|
5085 tw.goto_base_frame (); |
16708
08f0f274de36
use correct "caller" workspace for mexputvariable and mexgetvariable
John W. Eaton <jwe@octave.org>
parents:
16442
diff
changeset
|
5086 } |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
5087 |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26438
diff
changeset
|
5088 val = interp.varval (name); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
5089 } |
7752
40c428ea3408
initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents:
7577
diff
changeset
|
5090 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
5091 mexErrMsgTxt ("mexGetVariable: symbol table does not exist"); |
7752
40c428ea3408
initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents:
7577
diff
changeset
|
5092 } |
7336 | 5093 |
5094 if (val.is_defined ()) | |
5864 | 5095 { |
7336 | 5096 retval = mex_context->make_value (val); |
5097 | |
5098 retval->set_name (name); | |
5864 | 5099 } |
5100 | |
5101 return retval; | |
5102 } | |
5103 | |
5879 | 5104 const mxArray * |
5105 mexGetVariablePtr (const char *space, const char *name) | |
5864 | 5106 { |
5879 | 5107 return mexGetVariable (space, name); |
5864 | 5108 } |
5109 | |
5900 | 5110 int |
15353
5f3a69a309a7
fix decl of mexPutVariable
John W. Eaton <jwe@octave.org>
parents:
15351
diff
changeset
|
5111 mexPutVariable (const char *space, const char *name, const mxArray *ptr) |
5864 | 5112 { |
5900 | 5113 if (! ptr) |
5114 return 1; | |
5115 | |
5116 if (! name) | |
5117 return 1; | |
5118 | |
5119 if (name[0] == '\0') | |
5120 name = ptr->get_name (); | |
5121 | |
5122 if (! name || name[0] == '\0') | |
5123 return 1; | |
5124 | |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26438
diff
changeset
|
5125 octave::interpreter& interp = octave::__get_interpreter__ ("mexPutVariable"); |
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26438
diff
changeset
|
5126 |
5900 | 5127 if (! strcmp (space, "global")) |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26438
diff
changeset
|
5128 interp.global_assign (name, mxArray::as_octave_value (ptr)); |
5900 | 5129 else |
5130 { | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5131 // FIXME: should this be in variables.cc? |
7336 | 5132 |
21743
f4d7d0eb5b0c
use namespace for unwind_protect class
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
5133 octave::unwind_protect frame; |
9144
c6463412aebb
eliminate symbol_table::scope_stack; fix scoping issue with evalin
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
5134 |
7901 | 5135 bool caller = ! strcmp (space, "caller"); |
5136 bool base = ! strcmp (space, "base"); | |
5137 | |
5138 if (caller || base) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
5139 { |
16708
08f0f274de36
use correct "caller" workspace for mexputvariable and mexgetvariable
John W. Eaton <jwe@octave.org>
parents:
16442
diff
changeset
|
5140 // MEX files don't create a separate frame in the call stack, |
08f0f274de36
use correct "caller" workspace for mexputvariable and mexgetvariable
John W. Eaton <jwe@octave.org>
parents:
16442
diff
changeset
|
5141 // so we are already in the "caller" frame. |
08f0f274de36
use correct "caller" workspace for mexputvariable and mexgetvariable
John W. Eaton <jwe@octave.org>
parents:
16442
diff
changeset
|
5142 |
08f0f274de36
use correct "caller" workspace for mexputvariable and mexgetvariable
John W. Eaton <jwe@octave.org>
parents:
16442
diff
changeset
|
5143 if (base) |
08f0f274de36
use correct "caller" workspace for mexputvariable and mexgetvariable
John W. Eaton <jwe@octave.org>
parents:
16442
diff
changeset
|
5144 { |
27206
4e4a9d7b436e
eliminate direct access to call stack in mex functions
John W. Eaton <jwe@octave.org>
parents:
27083
diff
changeset
|
5145 octave::tree_evaluator& tw = interp.get_evaluator (); |
4e4a9d7b436e
eliminate direct access to call stack in mex functions
John W. Eaton <jwe@octave.org>
parents:
27083
diff
changeset
|
5146 |
29253
28913793f678
prefer unwind_action over unwind_protect in more places
John W. Eaton <jwe@octave.org>
parents:
29173
diff
changeset
|
5147 frame.add (&octave::tree_evaluator::restore_frame, &tw, |
28913793f678
prefer unwind_action over unwind_protect in more places
John W. Eaton <jwe@octave.org>
parents:
29173
diff
changeset
|
5148 tw.current_call_stack_frame_number ()); |
27206
4e4a9d7b436e
eliminate direct access to call stack in mex functions
John W. Eaton <jwe@octave.org>
parents:
27083
diff
changeset
|
5149 |
4e4a9d7b436e
eliminate direct access to call stack in mex functions
John W. Eaton <jwe@octave.org>
parents:
27083
diff
changeset
|
5150 tw.goto_base_frame (); |
16708
08f0f274de36
use correct "caller" workspace for mexputvariable and mexgetvariable
John W. Eaton <jwe@octave.org>
parents:
16442
diff
changeset
|
5151 } |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
5152 |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26438
diff
changeset
|
5153 interp.assign (name, mxArray::as_octave_value (ptr)); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
5154 } |
5900 | 5155 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
5156 mexErrMsgTxt ("mexPutVariable: symbol table does not exist"); |
5900 | 5157 } |
5158 | |
5159 return 0; | |
5864 | 5160 } |
5161 | |
5162 void | |
5900 | 5163 mexMakeArrayPersistent (mxArray *ptr) |
5864 | 5164 { |
7172 | 5165 maybe_unmark_array (ptr); |
5864 | 5166 } |
5879 | 5167 |
5864 | 5168 void |
5900 | 5169 mexMakeMemoryPersistent (void *ptr) |
5864 | 5170 { |
7172 | 5171 maybe_unmark (ptr); |
5864 | 5172 } |
5173 | |
5900 | 5174 int |
6068 | 5175 mexAtExit (void (*f) (void)) |
5864 | 5176 { |
6068 | 5177 if (mex_context) |
5178 { | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
5179 octave_mex_function& curr_mex_fcn = mex_context->current_mex_function (); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
5180 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
5181 curr_mex_fcn.atexit (f); |
6068 | 5182 } |
5183 | |
5900 | 5184 return 0; |
5864 | 5185 } |
5186 | |
5900 | 5187 const mxArray * |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
5188 mexGet_interleaved (double handle, const char *property) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
5189 { |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
5190 mxArray *m = nullptr; |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
5191 |
29993
b5fae48ad807
move classes for graphics objects and properties inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29870
diff
changeset
|
5192 octave_value ret |
b5fae48ad807
move classes for graphics objects and properties inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29870
diff
changeset
|
5193 = octave::get_property_from_handle (handle, property, "mexGet"); |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
5194 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
5195 if (ret.is_defined ()) |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
5196 m = ret.as_mxArray (true); |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
5197 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
5198 return m; |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
5199 } |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
5200 |
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
5201 const mxArray * |
6595 | 5202 mexGet (double handle, const char *property) |
5864 | 5203 { |
23457
21baad6b35c4
maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents:
23455
diff
changeset
|
5204 mxArray *m = nullptr; |
20555
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
5205 |
29993
b5fae48ad807
move classes for graphics objects and properties inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29870
diff
changeset
|
5206 octave_value ret |
b5fae48ad807
move classes for graphics objects and properties inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29870
diff
changeset
|
5207 = octave::get_property_from_handle (handle, property, "mexGet"); |
6595 | 5208 |
20555
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
5209 if (ret.is_defined ()) |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
5210 m = ret.as_mxArray (false); |
20555
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20535
diff
changeset
|
5211 |
6595 | 5212 return m; |
5864 | 5213 } |
5214 | |
5900 | 5215 int |
5216 mexIsGlobal (const mxArray *ptr) | |
5864 | 5217 { |
5900 | 5218 return mxIsFromGlobalWS (ptr); |
5864 | 5219 } |
5220 | |
5900 | 5221 int |
5222 mexIsLocked (void) | |
5864 | 5223 { |
5900 | 5224 int retval = 0; |
5225 | |
5226 if (mex_context) | |
5227 { | |
5228 const char *fname = mexFunctionName (); | |
5229 | |
23703
6eb5f6199a5a
move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents:
23699
diff
changeset
|
5230 octave::interpreter& interp = octave::__get_interpreter__ ("mexIsLocked"); |
6eb5f6199a5a
move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents:
23699
diff
changeset
|
5231 |
6eb5f6199a5a
move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents:
23699
diff
changeset
|
5232 retval = interp.mislocked (fname); |
5900 | 5233 } |
5234 | |
5235 return retval; | |
5864 | 5236 } |
5237 | |
30390
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30349
diff
changeset
|
5238 std::map<std::string, int> mex_lock_count; |
5900 | 5239 |
5240 void | |
5241 mexLock (void) | |
5864 | 5242 { |
5900 | 5243 if (mex_context) |
5864 | 5244 { |
5900 | 5245 const char *fname = mexFunctionName (); |
5246 | |
5247 if (mex_lock_count.find (fname) == mex_lock_count.end ()) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
5248 mex_lock_count[fname] = 1; |
5900 | 5249 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
5250 mex_lock_count[fname]++; |
5900 | 5251 |
23703
6eb5f6199a5a
move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents:
23699
diff
changeset
|
5252 octave::interpreter& interp = octave::__get_interpreter__ ("mexLock"); |
6eb5f6199a5a
move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents:
23699
diff
changeset
|
5253 |
6eb5f6199a5a
move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents:
23699
diff
changeset
|
5254 interp.mlock (); |
5864 | 5255 } |
5256 } | |
5257 | |
5900 | 5258 int |
6595 | 5259 mexSet (double handle, const char *property, mxArray *val) |
5900 | 5260 { |
29993
b5fae48ad807
move classes for graphics objects and properties inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29870
diff
changeset
|
5261 bool ret = octave::set_property_in_handle (handle, property, |
b5fae48ad807
move classes for graphics objects and properties inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29870
diff
changeset
|
5262 mxArray::as_octave_value (val), |
b5fae48ad807
move classes for graphics objects and properties inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29870
diff
changeset
|
5263 "mexSet"); |
6595 | 5264 return (ret ? 0 : 1); |
5900 | 5265 } |
5266 | |
5267 void | |
5268 mexUnlock (void) | |
5864 | 5269 { |
5900 | 5270 if (mex_context) |
5864 | 5271 { |
5900 | 5272 const char *fname = mexFunctionName (); |
5273 | |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
5274 auto p = mex_lock_count.find (fname); |
5905 | 5275 |
6062 | 5276 if (p != mex_lock_count.end ()) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
5277 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
5278 int count = --mex_lock_count[fname]; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
5279 |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
5280 if (count == 0) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
5281 { |
23703
6eb5f6199a5a
move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents:
23699
diff
changeset
|
5282 octave::interpreter& interp |
6eb5f6199a5a
move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents:
23699
diff
changeset
|
5283 = octave::__get_interpreter__ ("mexUnLock"); |
6eb5f6199a5a
move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents:
23699
diff
changeset
|
5284 |
6eb5f6199a5a
move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents:
23699
diff
changeset
|
5285 interp.munlock (fname); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
5286 |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
5287 mex_lock_count.erase (p); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
5288 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10225
diff
changeset
|
5289 } |
5864 | 5290 } |
5291 } |