Mercurial > octave
annotate libinterp/corefcn/mex.h @ 33614:7f7d6bc5702b default tip @
maint: merge stable to default
author | Rik <rik@octave.org> |
---|---|
date | Mon, 20 May 2024 09:12:08 -0700 |
parents | 2e484f9f1f18 |
children |
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 // |
32632
2e484f9f1f18
maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
31706
diff
changeset
|
3 // Copyright (C) 2001-2024 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 //////////////////////////////////////////////////////////////////////// |
5864 | 25 |
26 /* | |
27 | |
28 This code was originally distributed as part of Octave Forge under | |
5900 | 29 the following terms: |
5864 | 30 |
31 Author: Paul Kienzle | |
32 I grant this code to the public domain. | |
33 2001-03-22 | |
34 | |
35 THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
36 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
37 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
38 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
39 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
40 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
41 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
42 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
43 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
44 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
45 SUCH DAMAGE. | |
46 | |
47 */ | |
48 | |
49 /* mex.h is for use in C-programs only; do NOT include it in mex.cc */ | |
50 | |
21241
bae38398f5f1
use consistent style for all liboctave and libinterp include guards
John W. Eaton <jwe@octave.org>
parents:
21200
diff
changeset
|
51 #if ! defined (octave_mex_h) |
bae38398f5f1
use consistent style for all liboctave and libinterp include guards
John W. Eaton <jwe@octave.org>
parents:
21200
diff
changeset
|
52 #define octave_mex_h 1 |
5864 | 53 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21241
diff
changeset
|
54 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21241
diff
changeset
|
55 |
5864 | 56 #define HAVE_OCTAVE |
57 | |
58 typedef void mxArray; | |
5879 | 59 |
5864 | 60 /* -V4 stuff */ |
61 #if defined (V4) | |
21200
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
20525
diff
changeset
|
62 # define Matrix mxArray |
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
20525
diff
changeset
|
63 # define REAL mxREAL |
5864 | 64 #endif |
65 | |
66 #define mxMAXNAME 64 | |
67 | |
16705
122d3f62e179
do not include C++ header in extern "C" context (bug #38746)
Clemens Buchacher <drizzd@aon.at>
parents:
15195
diff
changeset
|
68 #include "mexproto.h" |
122d3f62e179
do not include C++ header in extern "C" context (bug #38746)
Clemens Buchacher <drizzd@aon.at>
parents:
15195
diff
changeset
|
69 |
5864 | 70 #if defined (__cplusplus) |
71 extern "C" { | |
72 #endif | |
73 | |
74 #if defined (V4) | |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
75 void mexFunction (int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[]); |
5864 | 76 #else |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
77 void mexFunction (int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]); |
5864 | 78 #endif |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
79 |
5864 | 80 /* V4 floating point routines renamed in V5. */ |
81 #define mexIsNaN mxIsNaN | |
82 #define mexIsFinite mxIsFinite | |
83 #define mexIsInf mxIsInf | |
84 #define mexGetEps mxGetEps | |
85 #define mexGetInf mxGetInf | |
28463
2c607b7ecee9
mex.h: Fix typo (bug #58542).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
86 #define mexGetNaN mxGetNaN |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
87 |
5864 | 88 #define mexGetGlobal(nm) mexGetArray (nm, "global") |
89 #define mexGetMatrix(nm) mexGetArray (nm, "caller") | |
90 #define mexGetMatrixPtr(nm) mexGetArrayPtr (nm, "caller") | |
91 | |
5879 | 92 #define mexGetArray(nm, space) mexGetVariable (space, nm) |
93 #define mexGetArrayPtr(nm, space) mexGetVariablePtr (space, nm) | |
94 | |
5864 | 95 #define mexPutMatrix(ptr) mexPutVariable ("caller", "", ptr) |
96 #define mexPutArray(ptr, space) mexPutVariable (space, "", ptr) | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
97 |
5864 | 98 #define mxCreateFull mxCreateDoubleMatrix |
99 | |
100 #define mxCreateScalarDouble mxCreateDoubleScalar | |
101 | |
102 #define mxFreeMatrix mxDestroyArray | |
103 | |
104 #define mxIsString mxIsChar | |
105 | |
6048 | 106 /* Apparently these are also defined. */ |
107 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
108 #if ! defined (UINT64_T) |
21200
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
20525
diff
changeset
|
109 # define UINT64_T uint64_t |
6048 | 110 #endif |
111 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
112 #if ! defined (uint64_T) |
21200
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
20525
diff
changeset
|
113 # define uint64_T uint64_t |
6048 | 114 #endif |
115 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
116 #if ! defined (INT64_T) |
21200
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
20525
diff
changeset
|
117 # define INT64_T int64_t |
6048 | 118 #endif |
119 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
120 #if ! defined (int64_T) |
21200
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
20525
diff
changeset
|
121 # define int64_T int64_t |
6048 | 122 #endif |
123 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
124 #if ! defined (UINT32_T) |
21200
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
20525
diff
changeset
|
125 # define UINT32_T uint32_t |
6048 | 126 #endif |
127 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
128 #if ! defined (uint32_T) |
21200
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
20525
diff
changeset
|
129 # define uint32_T uint32_t |
6048 | 130 #endif |
131 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
132 #if ! defined (INT32_T) |
21200
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
20525
diff
changeset
|
133 # define INT32_T int32_t |
6048 | 134 #endif |
135 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
136 #if ! defined (int32_T) |
21200
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
20525
diff
changeset
|
137 # define int32_T int32_t |
6048 | 138 #endif |
139 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
140 #if ! defined (UINT16_T) |
21200
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
20525
diff
changeset
|
141 # define UINT16_T uint16_t |
6048 | 142 #endif |
143 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
144 #if ! defined (uint16_T) |
21200
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
20525
diff
changeset
|
145 # define uint16_T uint16_t |
6048 | 146 #endif |
147 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
148 #if ! defined (INT16_T) |
21200
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
20525
diff
changeset
|
149 # define INT16_T int16_t |
6048 | 150 #endif |
151 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
152 #if ! defined (int16_T) |
21200
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
20525
diff
changeset
|
153 # define int16_T int16_t |
6048 | 154 #endif |
155 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
156 #if ! defined (UINT8_T) |
21200
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
20525
diff
changeset
|
157 # define UINT8_T uint8_t |
6048 | 158 #endif |
159 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
160 #if ! defined (uint8_T) |
21200
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
20525
diff
changeset
|
161 # define uint8_T uint8_t |
6048 | 162 #endif |
163 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
164 #if ! defined (INT8_T) |
21200
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
20525
diff
changeset
|
165 # define INT8_T int8_t |
6048 | 166 #endif |
167 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
168 #if ! defined (int8_T) |
21200
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
20525
diff
changeset
|
169 # define int8_T int8_t |
6048 | 170 #endif |
171 | |
5864 | 172 #if defined (__cplusplus) |
173 } | |
174 #endif | |
175 | |
176 #endif |