GNU Octave
3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
libinterp
corefcn
mexproto.h
Go to the documentation of this file.
1
/*
2
3
Copyright (C) 2006-2013 Paul Kienzle
4
5
This file is part of Octave.
6
7
Octave is free software; you can redistribute it and/or modify it
8
under the terms of the GNU General Public License as published by the
9
Free Software Foundation; either version 3 of the License, or (at your
10
option) any later version.
11
12
Octave is distributed in the hope that it will be useful, but WITHOUT
13
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15
for more details.
16
17
You should have received a copy of the GNU General Public License
18
along with Octave; see the file COPYING. If not, see
19
<http://www.gnu.org/licenses/>.
20
21
*/
22
23
/*
24
25
This code was originally distributed as part of Octave Forge under
26
the following terms:
27
28
Author: Paul Kienzle
29
I grant this code to the public domain.
30
2001-03-22
31
32
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
33
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
34
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
36
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
40
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
41
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
42
SUCH DAMAGE.
43
44
*/
45
46
/* mex.h is for use in C-programs only; do NOT include it in mex.cc */
47
48
#if ! defined (MEXPROTO_H)
49
#define MEXPROTO_H
50
51
#if defined (__cplusplus)
52
#include <cstdlib>
53
extern
"C"
{
54
#else
55
#include <stdlib.h>
56
#endif
57
58
/* The definition of OCTINTERP_API is normally provided by Octave's
59
config.h file. This is provided for the case of mex.h included by
60
user programs that don't use Octave's config.h. */
61
#if ! defined (OCTINTERP_API)
62
#if defined (_MSC_VER)
63
#define OCTINTERP_API __declspec(dllimport)
64
#else
65
/* All other compilers, at least for now. */
66
#define OCTINTERP_API
67
#endif
68
#endif
69
70
#define MXARRAY_TYPEDEFS_ONLY
71
#include "
mxarray.h
"
72
#undef MXARRAY_TYPEDEFS_ONLY
73
74
/* Interface to the interpreter. */
75
extern
OCTINTERP_API
const
char
*
mexFunctionName
(
void
);
76
77
extern
OCTINTERP_API
int
mexCallMATLAB
(
int
nargout,
mxArray
*argout[],
78
int
nargin,
mxArray
*argin[],
79
const
char
*fname);
80
81
extern
OCTINTERP_API
void
mexSetTrapFlag
(
int
flag);
82
extern
OCTINTERP_API
int
mexEvalString
(
const
char
*s);
83
extern
OCTINTERP_API
void
mexErrMsgTxt
(
const
char
*s);
84
extern
OCTINTERP_API
void
mexErrMsgIdAndTxt
(
const
char
*
id
,
const
char
*s,
85
...);
86
extern
OCTINTERP_API
void
mexWarnMsgTxt
(
const
char
*s);
87
extern
OCTINTERP_API
void
mexWarnMsgIdAndTxt
(
const
char
*
id
,
const
char
*s,
88
...);
89
extern
OCTINTERP_API
int
mexPrintf
(
const
char
*fmt, ...);
90
91
extern
OCTINTERP_API
mxArray
*
mexGetVariable
(
const
char
*space,
92
const
char
*name);
93
extern
OCTINTERP_API
const
mxArray
*
mexGetVariablePtr
(
const
char
*space,
94
const
char
*name);
95
96
extern
OCTINTERP_API
int
mexPutVariable
(
const
char
*space,
const
char
*name,
97
const
mxArray
*ptr);
98
99
extern
OCTINTERP_API
void
mexMakeArrayPersistent
(
mxArray
*ptr);
100
extern
OCTINTERP_API
void
mexMakeMemoryPersistent
(
void
*ptr);
101
102
extern
OCTINTERP_API
int
mexAtExit
(
void
(*
f
) (
void
));
103
extern
OCTINTERP_API
const
mxArray
*
mexGet
(
double
handle,
104
const
char
*
property
);
105
extern
OCTINTERP_API
int
mexIsGlobal
(
const
mxArray
*ptr);
106
extern
OCTINTERP_API
int
mexIsLocked
(
void
);
107
extern
OCTINTERP_API
void
mexLock
(
void
);
108
extern
OCTINTERP_API
int
mexSet
(
double
handle,
const
char
*
property
,
109
mxArray
*val);
110
extern
OCTINTERP_API
void
mexUnlock
(
void
);
111
112
/* Floating point predicates. */
113
extern
OCTINTERP_API
int
mxIsFinite
(
double
v);
114
extern
OCTINTERP_API
int
mxIsInf
(
double
v);
115
extern
OCTINTERP_API
int
mxIsNaN
(
double
v);
116
117
/* Floating point values. */
118
extern
OCTINTERP_API
double
mxGetEps
(
void
);
119
extern
OCTINTERP_API
double
mxGetInf
(
void
);
120
extern
OCTINTERP_API
double
mxGetNaN
(
void
);
121
122
/* Memory management. */
123
extern
OCTINTERP_API
void
*
mxCalloc
(
size_t
n,
size_t
size
);
124
extern
OCTINTERP_API
void
*
mxMalloc
(
size_t
n);
125
extern
OCTINTERP_API
void
*
mxRealloc
(
void
*ptr,
size_t
size
);
126
extern
OCTINTERP_API
void
mxFree
(
void
*ptr);
127
128
/* Constructors. */
129
extern
OCTINTERP_API
mxArray
*
mxCreateCellArray
(
mwSize
ndims,
130
const
mwSize
*dims);
131
extern
OCTINTERP_API
mxArray
*
mxCreateCellMatrix
(
mwSize
m,
mwSize
n);
132
extern
OCTINTERP_API
mxArray
*
mxCreateCharArray
(
mwSize
ndims,
133
const
mwSize
*dims);
134
extern
OCTINTERP_API
mxArray
*
mxCreateCharMatrixFromStrings
(
mwSize
m,
135
const
char
**str);
136
extern
OCTINTERP_API
mxArray
*
mxCreateDoubleMatrix
(
mwSize
nr,
mwSize
nc,
137
mxComplexity
flag);
138
extern
OCTINTERP_API
mxArray
*
mxCreateDoubleScalar
(
double
val);
139
extern
OCTINTERP_API
mxArray
*
mxCreateLogicalArray
(
mwSize
ndims,
140
const
mwSize
*dims);
141
extern
OCTINTERP_API
mxArray
*
mxCreateLogicalMatrix
(
mwSize
m,
mwSize
n);
142
extern
OCTINTERP_API
mxArray
*
mxCreateLogicalScalar
(
mxLogical
val);
143
extern
OCTINTERP_API
mxArray
*
mxCreateNumericArray
(
mwSize
ndims,
144
const
mwSize
*dims,
145
mxClassID
class_id,
146
mxComplexity
flag);
147
extern
OCTINTERP_API
mxArray
*
mxCreateNumericMatrix
(
mwSize
m,
mwSize
n,
148
mxClassID
class_id,
149
mxComplexity
flag);
150
extern
OCTINTERP_API
mxArray
*
mxCreateSparse
(
mwSize
m,
mwSize
n,
mwSize
nzmax,
151
mxComplexity
flag);
152
extern
OCTINTERP_API
mxArray
*
mxCreateSparseLogicalMatrix
(
mwSize
m,
mwSize
n,
153
mwSize
nzmax);
154
extern
OCTINTERP_API
mxArray
*
mxCreateString
(
const
char
*str);
155
extern
OCTINTERP_API
mxArray
*
mxCreateStructArray
(
mwSize
ndims,
156
const
mwSize
*dims,
157
int
num_keys,
158
const
char
**keys);
159
extern
OCTINTERP_API
mxArray
*
mxCreateStructMatrix
(
mwSize
rows,
mwSize
cols,
160
int
num_keys,
161
const
char
**keys);
162
163
/* Copy constructor. */
164
extern
OCTINTERP_API
mxArray
*
mxDuplicateArray
(
const
mxArray
*v);
165
166
/* Destructor. */
167
extern
OCTINTERP_API
void
mxDestroyArray
(
mxArray
*v);
168
169
/* Type Predicates. */
170
extern
OCTINTERP_API
int
mxIsCell
(
const
mxArray
*ptr);
171
extern
OCTINTERP_API
int
mxIsChar
(
const
mxArray
*ptr);
172
extern
OCTINTERP_API
int
mxIsClass
(
const
mxArray
*ptr,
const
char
*name);
173
extern
OCTINTERP_API
int
mxIsComplex
(
const
mxArray
*ptr);
174
extern
OCTINTERP_API
int
mxIsDouble
(
const
mxArray
*ptr);
175
extern
OCTINTERP_API
int
mxIsFunctionHandle
(
const
mxArray
*ptr);
176
extern
OCTINTERP_API
int
mxIsInt16
(
const
mxArray
*ptr);
177
extern
OCTINTERP_API
int
mxIsInt32
(
const
mxArray
*ptr);
178
extern
OCTINTERP_API
int
mxIsInt64
(
const
mxArray
*ptr);
179
extern
OCTINTERP_API
int
mxIsInt8
(
const
mxArray
*ptr);
180
extern
OCTINTERP_API
int
mxIsLogical
(
const
mxArray
*ptr);
181
extern
OCTINTERP_API
int
mxIsNumeric
(
const
mxArray
*ptr);
182
extern
OCTINTERP_API
int
mxIsSingle
(
const
mxArray
*ptr);
183
extern
OCTINTERP_API
int
mxIsSparse
(
const
mxArray
*ptr);
184
extern
OCTINTERP_API
int
mxIsStruct
(
const
mxArray
*ptr);
185
extern
OCTINTERP_API
int
mxIsUint16
(
const
mxArray
*ptr);
186
extern
OCTINTERP_API
int
mxIsUint32
(
const
mxArray
*ptr);
187
extern
OCTINTERP_API
int
mxIsUint64
(
const
mxArray
*ptr);
188
extern
OCTINTERP_API
int
mxIsUint8
(
const
mxArray
*ptr);
189
190
/* Odd type+size predicate. */
191
extern
OCTINTERP_API
int
mxIsLogicalScalar
(
const
mxArray
*ptr);
192
193
/* Odd type+size+value predicate. */
194
extern
OCTINTERP_API
int
mxIsLogicalScalarTrue
(
const
mxArray
*ptr);
195
196
/* Size predicate. */
197
extern
OCTINTERP_API
int
mxIsEmpty
(
const
mxArray
*ptr);
198
199
/* Just plain odd thing to ask of a value. */
200
extern
OCTINTERP_API
int
mxIsFromGlobalWS
(
const
mxArray
*ptr);
201
202
/* Dimension extractors. */
203
extern
OCTINTERP_API
size_t
mxGetM
(
const
mxArray
*ptr);
204
extern
OCTINTERP_API
size_t
mxGetN
(
const
mxArray
*ptr);
205
extern
OCTINTERP_API
mwSize
*
mxGetDimensions
(
const
mxArray
*ptr);
206
extern
OCTINTERP_API
mwSize
mxGetNumberOfDimensions
(
const
mxArray
*ptr);
207
extern
OCTINTERP_API
size_t
mxGetNumberOfElements
(
const
mxArray
*ptr);
208
209
/* Dimension setters. */
210
extern
OCTINTERP_API
void
mxSetM
(
mxArray
*ptr,
mwSize
M
);
211
extern
OCTINTERP_API
void
mxSetN
(
mxArray
*ptr,
mwSize
N
);
212
extern
OCTINTERP_API
void
mxSetDimensions
(
mxArray
*ptr,
const
mwSize
*dims,
213
mwSize
ndims);
214
215
/* Data extractors. */
216
extern
OCTINTERP_API
double
*
mxGetPi
(
const
mxArray
*ptr);
217
extern
OCTINTERP_API
double
*
mxGetPr
(
const
mxArray
*ptr);
218
extern
OCTINTERP_API
double
mxGetScalar
(
const
mxArray
*ptr);
219
extern
OCTINTERP_API
mxChar
*
mxGetChars
(
const
mxArray
*ptr);
220
extern
OCTINTERP_API
mxLogical
*
mxGetLogicals
(
const
mxArray
*ptr);
221
extern
OCTINTERP_API
void
*
mxGetData
(
const
mxArray
*ptr);
222
extern
OCTINTERP_API
void
*
mxGetImagData
(
const
mxArray
*ptr);
223
224
/* Data setters. */
225
extern
OCTINTERP_API
void
mxSetPr
(
mxArray
*ptr,
double
*pr);
226
extern
OCTINTERP_API
void
mxSetPi
(
mxArray
*ptr,
double
*pi);
227
extern
OCTINTERP_API
void
mxSetData
(
mxArray
*ptr,
void
*data);
228
extern
OCTINTERP_API
void
mxSetImagData
(
mxArray
*ptr,
void
*pi);
229
230
/* Classes. */
231
extern
OCTINTERP_API
mxClassID
mxGetClassID
(
const
mxArray
*ptr);
232
extern
OCTINTERP_API
const
char
*
mxGetClassName
(
const
mxArray
*ptr);
233
234
extern
OCTINTERP_API
void
mxSetClassName
(
mxArray
*ptr,
const
char
*name);
235
236
/* Cell support. */
237
extern
OCTINTERP_API
mxArray
*
mxGetCell
(
const
mxArray
*ptr,
mwIndex
idx);
238
239
extern
OCTINTERP_API
void
mxSetCell
(
mxArray
*ptr,
mwIndex
idx,
mxArray
*val);
240
241
/* Sparse support. */
242
extern
OCTINTERP_API
mwIndex
*
mxGetIr
(
const
mxArray
*ptr);
243
extern
OCTINTERP_API
mwIndex
*
mxGetJc
(
const
mxArray
*ptr);
244
extern
OCTINTERP_API
mwSize
mxGetNzmax
(
const
mxArray
*ptr);
245
246
extern
OCTINTERP_API
void
mxSetIr
(
mxArray
*ptr,
mwIndex
*ir);
247
extern
OCTINTERP_API
void
mxSetJc
(
mxArray
*ptr,
mwIndex
*jc);
248
extern
OCTINTERP_API
void
mxSetNzmax
(
mxArray
*ptr,
mwSize
nzmax);
249
250
/* Structure support. */
251
extern
OCTINTERP_API
int
mxAddField
(
mxArray
*ptr,
const
char
*key);
252
253
extern
OCTINTERP_API
void
mxRemoveField
(
mxArray
*ptr,
int
key_num);
254
255
extern
OCTINTERP_API
mxArray
*
mxGetField
(
const
mxArray
*ptr,
mwIndex
index,
256
const
char
*key);
257
extern
OCTINTERP_API
mxArray
*
mxGetFieldByNumber
(
const
mxArray
*ptr,
258
mwIndex
index,
int
key_num);
259
260
extern
OCTINTERP_API
void
mxSetField
(
mxArray
*ptr,
mwIndex
index,
261
const
char
*key,
mxArray
*val);
262
extern
OCTINTERP_API
void
mxSetFieldByNumber
(
mxArray
*ptr,
mwIndex
index,
263
int
key_num,
mxArray
*val);
264
265
extern
OCTINTERP_API
int
mxGetNumberOfFields
(
const
mxArray
*ptr);
266
267
extern
OCTINTERP_API
const
char
*
mxGetFieldNameByNumber
(
const
mxArray
*ptr,
268
int
key_num);
269
extern
OCTINTERP_API
int
mxGetFieldNumber
(
const
mxArray
*ptr,
const
char
*key);
270
271
extern
OCTINTERP_API
int
mxGetString
(
const
mxArray
*ptr,
char
*buf,
272
mwSize
buflen);
273
extern
OCTINTERP_API
char
*
mxArrayToString
(
const
mxArray
*ptr);
274
275
/* Miscellaneous. */
276
#ifdef NDEBUG
277
#define mxAssert(expr, msg) \
278
do \
279
{ \
280
if (! expr) \
281
{ \
282
mexPrintf ("Assertion failed: %s, at line %d of file \"%s\".\n%s\n", \
283
#expr, __LINE__, __FILE__, msg); \
284
} \
285
} \
286
while (0)
287
288
#define mxAssertS(expr, msg) \
289
do \
290
{ \
291
if (! expr) \
292
{ \
293
mexPrintf ("Assertion failed at line %d of file \"%s\".\n%s\n", \
294
__LINE__, __FILE__, msg); \
295
abort (); \
296
} \
297
} \
298
while (0)
299
#else
300
#define mxAssert(expr, msg)
301
#define mxAssertS(expr, msg)
302
#endif
303
304
extern
OCTINTERP_API
mwIndex
mxCalcSingleSubscript
(
const
mxArray
*ptr,
305
mwSize
nsubs,
mwIndex
*subs);
306
307
extern
OCTINTERP_API
size_t
mxGetElementSize
(
const
mxArray
*ptr);
308
309
#if defined (__cplusplus)
310
}
311
#endif
312
313
#endif
Generated on Mon Dec 30 2013 03:04:27 for GNU Octave by
1.8.1.2