forked from fyhamoeba/IncageMapCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmex.h
More file actions
373 lines (286 loc) · 9.09 KB
/
Copy pathmex.h
File metadata and controls
373 lines (286 loc) · 9.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
/*
* @(#)mex.h generated by: makeheader 5.1.5 Fri Dec 27 17:54:20 2013
*
* built from: ../../src/include/copyright.h
* ../../src/include/pragma_interface.h
* mex_typedefs.h
* mexfunction.hpp
* fmexapi.cpp
* globals.cpp
* mexapi.cpp
* mexcbk.cpp
* mexdispatch.cpp
* mexintrf.cpp
*/
#if defined(_MSC_VER)
# pragma once
#endif
#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3))
# pragma once
#endif
#ifndef mex_h
#define mex_h
/*
* Copyright 1984-2003 The MathWorks, Inc.
* All Rights Reserved.
*/
/* Copyright 2003-2006 The MathWorks, Inc. */
/* Only define EXTERN_C if it hasn't been defined already. This allows
* individual modules to have more control over managing their exports.
*/
#ifndef EXTERN_C
#ifdef __cplusplus
#define EXTERN_C extern "C"
#else
#define EXTERN_C extern
#endif
#endif
/* Copyright 1999-2007 The MathWorks, Inc. */
#ifndef mex_typedefs_h
#define mex_typedefs_h
typedef struct impl_info_tag *MEX_impl_info;
#include "matrix.h"
#ifdef __cplusplus
extern "C"
{
#endif
typedef void (*mex_exit_fn)(void);
#ifdef __cplusplus
}
#endif
typedef struct mexGlobalTableEntry_Tag
{
const char *name; /* The name of the global */
mxArray **variable; /* A pointer to the variable */
} mexGlobalTableEntry, *mexGlobalTable;
#ifdef _WIN32
#define cicompare(s1,s2) utStrcmpi((s1),(s2))
#else
#define cicompare(s1,s2) strcmp((s1),(s2))
#endif
#define cscompare(s1,s2) strcmp((s1),(s2))
typedef struct mexFunctionTableEntry_tag {
const char * name;
mxFunctionPtr f;
int nargin;
int nargout;
struct _mexLocalFunctionTable *local_function_table;
} mexFunctionTableEntry, *mexFunctionTable;
typedef struct _mexLocalFunctionTable {
size_t length;
mexFunctionTable entries;
} _mexLocalFunctionTable, *mexLocalFunctionTable;
typedef struct {
void (*initialize)(void);
void (*terminate)(void);
} _mexInitTermTableEntry, *mexInitTermTableEntry;
#define MEX_INFORMATION_VERSION 1
typedef struct {
int version;
int file_function_table_length;
mexFunctionTable file_function_table;
int global_variable_table_length;
mexGlobalTable global_variable_table;
int npaths;
const char ** paths;
int init_term_table_length;
mexInitTermTableEntry init_term_table;
} _mex_information, *mex_information;
typedef mex_information(*fn_mex_file)(void);
typedef void (*fn_clean_up_after_error)(void);
typedef const char *(*fn_simple_function_to_string)(mxFunctionPtr f);
typedef void (*fn_mex_enter_mex_library)(mex_information x);
typedef fn_mex_enter_mex_library fn_mex_exit_mex_library;
typedef mexLocalFunctionTable (*fn_mex_get_local_function_table)(void);
typedef mexLocalFunctionTable (*fn_mex_set_local_function_table)(mexLocalFunctionTable);
#endif
#ifdef DLL_EXPORT_SYM
# define MEXFUNCTION_LINKAGE EXTERN_C DLL_EXPORT_SYM
#else
# ifdef MW_NEEDS_VERSION_H
# include "version.h"
# define MEXFUNCTION_LINKAGE EXTERN_C DLL_EXPORT_SYM
# else
# define MEXFUNCTION_LINKAGE EXTERN_C
# endif
#endif
MEXFUNCTION_LINKAGE
/*
* mexFunction is the user-defined C routine that is called upon invocation
* of a MEX-function.
*/
void mexFunction(
int nlhs, /* number of expected outputs */
mxArray *plhs[], /* array of pointers to output arguments */
int nrhs, /* number of inputs */
const mxArray *prhs[] /* array of pointers to input arguments */
);
/*
* This header file "mex.h" declares all the types, macros and
* functions necessary to interface mex files with the current
* version of MATLAB. See the release notes for information on
* supporting syntax from earlier versions.
*/
#include "matrix.h"
#include <stdio.h>
/*
* Issue error message and return to MATLAB prompt
*/
EXTERN_C void mexErrMsgTxt(
const char *error_msg /* string with error message */
);
/*
* Issue formatted error message with corresponding error identifier and return to MATLAB
* prompt.
*/
EXTERN_C void mexErrMsgIdAndTxt(
const char * identifier, /* string with error message identifier */
const char * err_msg, /* string with error message printf-style format */
... /* any additional arguments */
);
/*
* Invoke an unidentified warning. Such warnings can only be affected by the M-code
* 'warning * all', since they have no specific identifier. See also mexWarnMsgIdAndTxt.
*/
EXTERN_C void mexWarnMsgTxt(
const char *warn_msg /* string with warning message */
);
/*
* Invoke a warning with message identifier 'identifier' and message derived from 'fmt' and
* subsequent arguments. The warning may either get printed as is (if it is set to 'on'), or
* not actually get printed (if set to 'off'). See 'help warning' in MATLAB for more
* details.
*/
EXTERN_C void mexWarnMsgIdAndTxt(
const char * identifier, /* string with warning message identifer */
const char * warn_msg, /* string with warning message printf-style format */
... /* any additional arguments */
);
/*
* mex equivalent to MATLAB's "disp" function
*/
EXTERN_C int mexPrintf(
const char *fmt, /* printf style format */
... /* any additional arguments */
);
#define printf mexPrintf
/*
* Remove all components of an array plus the array header itself
* from MATLAB's memory allocation list. The array will now
* persist between calls to the mex function. To destroy this
* array, you will need to explicitly call mxDestroyArray().
*/
EXTERN_C void mexMakeArrayPersistent(
mxArray *pa /* pointer to array */
);
/*
* Remove memory previously allocated via mxCalloc from MATLAB's
* memory allocation list. To free this memory, you will need to
* explicitly call mxFree().
*/
EXTERN_C void mexMakeMemoryPersistent(void *ptr);
/*
* mex equivalent to MATLAB's "set" function
*/
EXTERN_C int mexSet(double handle, const char *property, mxArray *value);
/* API interface which mimics the "get" function */
EXTERN_C const mxArray *mexGet(double handle, const char *property);
/*
* call MATLAB function
*/
EXTERN_C int mexCallMATLAB(
int nlhs, /* number of expected outputs */
mxArray *plhs[], /* pointer array to outputs */
int nrhs, /* number of inputs */
mxArray *prhs[], /* pointer array to inputs */
const char *fcn_name /* name of function to execute */
);
/*
* call MATLAB function with Trap
*/
EXTERN_C mxArray *mexCallMATLABWithTrap(
int nlhs, /* number of expected outputs */
mxArray *plhs[], /* pointer array to outputs */
int nrhs, /* number of inputs */
mxArray *prhs[], /* pointer array to inputs */
const char *fcn_name /* name of function to execute */
);
/*
* set or clear mexCallMATLAB trap flag (if set then an error in
* mexCallMATLAB is caught and mexCallMATLAB will return a status value,
* if not set an error will cause control to revert to MATLAB)
*/
EXTERN_C void mexSetTrapFlag(int flag);
/*
* Print an assertion-style error message and return control to the
* MATLAB command line.
*/
EXTERN_C void mexPrintAssertion(
const char *test,
const char *fname,
int linenum,
const char *message);
/*
* This function is deprecated and always return false.
*/
EXTERN_C bool mexIsGlobal(const mxArray *pA);
/*
* Place a copy of the array value into the specified workspace with the
* specified name
*/
EXTERN_C int mexPutVariable(
const char *workspace,
const char *name,
const mxArray *parray /* matrix to copy */
);
/*
* return a pointer to the array value with the specified variable
* name in the specified workspace
*/
EXTERN_C const mxArray *mexGetVariablePtr(
const char *workspace,
const char *name /* name of symbol */
);
/*
* return a copy of the array value with the specified variable
* name in the specified workspace
*/
EXTERN_C mxArray *mexGetVariable(
const char *workspace,
const char *name /* name of variable in question */
);
/*
* Lock a MEX-function so that it cannot be cleared from memory.
*/
EXTERN_C void mexLock(void);
/*
* Unlock a locked MEX-function so that it can be cleared from memory.
*/
EXTERN_C void mexUnlock(void);
/*
* Return true if the MEX-function is currently locked, false otherwise.
*/
EXTERN_C bool mexIsLocked(void);
/*
* Return the name of a the MEXfunction currently executing.
*/
EXTERN_C const char *mexFunctionName(void);
/*
* Parse and execute MATLAB syntax in string. Returns zero if successful,
* and a non zero value if an error occurs.
*/
EXTERN_C int mexEvalString(
const char *str /* matlab command string */
);
/*
* Parse and execute MATLAB syntax in string. Returns NULL if successful,
* and an MException if an error occurs.
*/
EXTERN_C mxArray* mexEvalStringWithTrap(
const char *str /* matlab command string */
);
/*
* Register Mex-file's At-Exit function (accessed via MEX callback)
*/
EXTERN_C int mexAtExit(mex_exit_fn exit_fcn );
#endif /* mex_h */