root/applications/bdmtoolbox/matlab7.1/include/mex.h @ 707

Revision 707, 14.4 kB (checked in by smidl, 15 years ago)

matlab 7.1 compile prerequisities

Line 
1/*
2 * @(#)mex.h    generated by: makeheader 4.21  Tue Jul 26 22:40:19 2005
3 *
4 *              built from:     ../../src/include/copyright.h
5 *                              ../../src/include/pragma_interface.h
6 *                              mex_typedefs.h
7 *                              ./fmexapi.cpp
8 *                              ./fmexapiv5.cpp
9 *                              ./globals.cpp
10 *                              ./mexapi.cpp
11 *                              ./mexapiv4.cpp
12 *                              ./mexapiv5.cpp
13 *                              ./mexcbk.cpp
14 *                              ./mexdispatch.cpp
15 *                              ./mexintrf.cpp
16 *                              mexdbg.h
17 */
18
19#ifndef mex_h
20#define mex_h
21
22
23/*
24 * Copyright 1984-2003 The MathWorks, Inc.
25 * All Rights Reserved.
26 */
27
28
29
30/* Copyright 2003-2004 The MathWorks, Inc. */
31
32/*
33 * Prevent g++ from making copies of vtable and typeinfo data
34 * in every compilation unit.  By allowing for only one, we can
35 * save space and prevent some situations where the linker fails
36 * to coalesce them properly into a single entry.
37 *
38 * References:
39 *    http://gcc.gnu.org/onlinedocs/gcc/Vague-Linkage.html#Vague%20Linkage
40 *    http://gcc.gnu.org/onlinedocs/gcc/C---Interface.html
41 */
42
43#ifdef __cplusplus
44#  ifdef __linux__
45#    pragma interface
46#  endif
47#endif
48
49
50
51/* Copyright 1999-2001 The MathWorks, Inc. */
52
53/* $Revision: 1.7.4.1 $ */
54#ifndef mex_typedefs_h
55#define mex_typedefs_h
56typedef struct impl_info_tag *MEX_impl_info;
57
58#include "matrix.h"
59
60typedef struct mexGlobalTableEntry_Tag
61{
62    const char *name;             /* The name of the global */
63    mxArray    **variable;        /* A pointer to the variable */ 
64} mexGlobalTableEntry, *mexGlobalTable;
65
66#if defined(MSWIND)
67#define cicompare(s1,s2) utStrcmpi((s1),(s2))
68#else
69#define cicompare(s1,s2) strcmp((s1),(s2))
70#endif
71#define cscompare(s1,s2) strcmp((s1),(s2))
72
73typedef struct mexFunctionTableEntry_tag {
74  const char *  name;
75  mxFunctionPtr f;
76  int           nargin;
77  int           nargout;
78  struct _mexLocalFunctionTable *local_function_table;
79} mexFunctionTableEntry, *mexFunctionTable;
80
81typedef struct _mexLocalFunctionTable {
82  size_t           length;
83  mexFunctionTable entries;
84} _mexLocalFunctionTable, *mexLocalFunctionTable;
85
86typedef struct {
87  void (*initialize)(void);
88  void (*terminate)(void);
89} _mexInitTermTableEntry, *mexInitTermTableEntry;
90
91#define MEX_INFORMATION_VERSION 1
92
93typedef struct {
94  int                   version;
95  int                   file_function_table_length;
96  mexFunctionTable      file_function_table;
97  int                   global_variable_table_length;
98  mexGlobalTable        global_variable_table;
99  int                   npaths;
100  const char **         paths;
101  int                   init_term_table_length;
102  mexInitTermTableEntry init_term_table;
103} _mex_information, *mex_information;
104
105typedef mex_information(*fn_mex_file)(void);
106
107typedef void (*fn_clean_up_after_error)(void);
108typedef const char *(*fn_simple_function_to_string)(mxFunctionPtr f);
109
110typedef void (*fn_mex_enter_mex_library)(mex_information x);
111typedef fn_mex_enter_mex_library fn_mex_exit_mex_library;
112
113typedef mexLocalFunctionTable (*fn_mex_get_local_function_table)(void);
114typedef mexLocalFunctionTable (*fn_mex_set_local_function_table)(mexLocalFunctionTable);
115
116#endif
117
118
119/*
120 * This header file "mex.h" declares all the types, macros and
121 * functions necessary to interface mex files with the current
122 * version of MATLAB.  See the release notes for information on
123 * supporting syntax from earlier versions.
124 */ 
125#include "matrix.h"
126
127#include <stdio.h>
128
129
130
131#ifdef __cplusplus
132extern "C" {
133#endif
134/*
135 * mexFunction is the user defined C routine which is called upon invocation
136 * of a mex function.
137 */
138void mexFunction(
139    int           nlhs,           /* number of expected outputs */
140    mxArray       *plhs[],        /* array of pointers to output arguments */
141    int           nrhs,           /* number of inputs */
142    const mxArray *prhs[]         /* array of pointers to input arguments */
143);
144#ifdef __cplusplus
145}
146#endif
147
148#ifdef __cplusplus
149extern "C" {
150#endif
151/*
152 * Issue error message and return to MATLAB prompt
153 */
154extern void mexErrMsgTxt(
155    const char  *error_msg      /* string with error message */
156    );
157#ifdef __cplusplus
158}
159#endif
160
161#ifdef __cplusplus
162extern "C" {
163#endif
164/*
165 * Issue formatted error message with corresponding error identifier and return to MATLAB
166 * prompt.
167 */
168extern void mexErrMsgIdAndTxt(
169    const char * identifier, /* string with error message identifier */
170    const char * err_msg,    /* string with error message printf-style format */
171    ...                      /* any additional arguments */
172    );
173#ifdef __cplusplus
174}
175#endif
176
177#ifdef __cplusplus
178extern "C" {
179#endif
180/*
181 * Invoke an unidentified warning. Such warnings can only be affected by the M-code
182 * 'warning * all', since they have no specific identifier. See also mexWarnMsgIdAndTxt.
183 */
184extern void mexWarnMsgTxt(
185    const char  *warn_msg       /* string with warning message */
186    );
187#ifdef __cplusplus
188}
189#endif
190
191#ifdef __cplusplus
192extern "C" {
193#endif
194/*
195 * Invoke a warning with message identifier 'identifier' and message derived from 'fmt' and
196 * subsequent arguments. The warning may either get printed as is (if it is set to 'on'), or
197 * not actually get printed (if set to 'off'). See 'help warning' in MATLAB for more
198 * details.
199 */
200extern void mexWarnMsgIdAndTxt(
201    const char * identifier,    /* string with warning message identifer */
202    const char * warn_msg,      /* string with warning message printf-style format */
203    ...                         /* any additional arguments */
204    );
205#ifdef __cplusplus
206}
207#endif
208
209#ifdef __cplusplus
210extern "C" {
211#endif
212/*
213 * mex equivalent to MATLAB's "disp" function
214 */
215extern int mexPrintf(
216    const char  *fmt,   /* printf style format */
217    ...                         /* any additional arguments */
218    );
219#ifdef __cplusplus
220}
221#endif
222
223
224#define printf mexPrintf
225
226#ifdef __cplusplus
227extern "C" {
228#endif
229/*
230 * Remove all components of an array plus the array header itself
231 * from MATLAB's memory allocation list.  The array will now
232 * persist between calls to the mex function.  To destroy this
233 * array, you will need to explicitly call mxDestroyArray().
234 */
235extern void mexMakeArrayPersistent(
236    mxArray *pa              /* pointer to array */
237    );
238#ifdef __cplusplus
239}
240#endif
241
242#ifdef __cplusplus
243extern "C" {
244#endif
245/*
246 * Remove memory previously allocated via mxCalloc from MATLAB's
247 * memory allocation list.  To free this memory, you will need to
248 * explicitly call mxFree().
249 */
250extern void mexMakeMemoryPersistent(void *ptr);
251#ifdef __cplusplus
252}
253#endif
254
255#ifdef __cplusplus
256extern "C" {
257#endif
258/*
259 * Look up a function and return an opaque handle for use with
260 * mexCallMATLABFunction.
261 */
262extern void mexGetFunctionHandle(void);
263#ifdef __cplusplus
264}
265#endif
266
267#ifdef __cplusplus
268extern "C" {
269#endif
270/*
271 * Call a function whose handle was determined by mexGetFunctionHandle.
272 */
273extern void mexCallMATLABFunction(void);
274#ifdef __cplusplus
275}
276#endif
277
278#ifdef __cplusplus
279extern "C" {
280#endif
281/*
282 * Register a function pointer as a MATLAB-callable function.
283 */
284extern void mexRegisterFunction(void);
285#ifdef __cplusplus
286}
287#endif
288
289#ifdef __cplusplus
290extern "C" {
291#endif
292/*
293 * mex equivalent to MATLAB's "set" function
294 */
295extern int mexSet(double handle, const char *property, mxArray *value);
296#ifdef __cplusplus
297}
298#endif
299
300#ifdef __cplusplus
301extern "C" {
302#endif
303/* API interface which mimics the "get" function */
304extern const mxArray *mexGet(double handle, const char *property);
305#ifdef __cplusplus
306}
307#endif
308
309#ifdef __cplusplus
310extern "C" {
311#endif
312/*
313 * call MATLAB function
314 */
315extern int mexCallMATLAB(
316    int         nlhs,                   /* number of expected outputs */
317    mxArray     *plhs[],                /* pointer array to outputs */
318    int         nrhs,                   /* number of inputs */
319    mxArray     *prhs[],                /* pointer array to inputs */
320    const char  *fcn_name               /* name of function to execute */
321    );
322#ifdef __cplusplus
323}
324#endif
325
326#ifdef __cplusplus
327extern "C" {
328#endif
329/*
330 * set or clear mexCallMATLAB trap flag (if set then an error in 
331 * mexCallMATLAB is caught and mexCallMATLAB will return a status value,
332 * if not set an error will cause control to revert to MATLAB)
333 */
334extern void mexSetTrapFlag(int flag);
335#ifdef __cplusplus
336}
337#endif
338
339#ifdef __cplusplus
340extern "C" {
341#endif
342/*
343 * Perform in-place subscript assignment.
344 */
345extern void mexSubsAssign(
346      mxArray *plhs, /* pointer to lhs, to be modified in-place */
347      const mxArray *prhs, /* pointer to rhs */
348      const mxArray *subs[], /* array of subscripts for lhs */
349      int nsubs     /* number os subscripts */
350      );
351#ifdef __cplusplus
352}
353#endif
354
355#ifdef __cplusplus
356extern "C" {
357#endif
358/*
359 * Retrieve a specified subset of an array.
360 */
361extern mxArray *mexSubsReference(
362      const mxArray *prhs, /* pointer to rhs */
363      const mxArray *subs[], /* array of subscripts for rhs */
364      int nsubs /* number of subscripts */
365      );
366#ifdef __cplusplus
367}
368#endif
369
370#ifdef __cplusplus
371extern "C" {
372#endif
373/*
374 * Print an assertion-style error message and return control to the
375 * MATLAB command line.
376 */ 
377extern void mexPrintAssertion(
378                const char *test, 
379                const char *fname, 
380                int linenum, 
381                const char *message);
382#ifdef __cplusplus
383}
384#endif
385
386#ifdef __cplusplus
387extern "C" {
388#endif
389/*
390 * Tell whether or not a mxArray is in MATLAB's global workspace.
391 */
392extern bool mexIsGlobal(const mxArray *pA);
393#ifdef __cplusplus
394}
395#endif
396
397
398#define mexGetGlobal()    mexGetGlobal_is_obsolete
399#define mxSetString()     mxSetString_is_obsolete
400#define mxSetDispMode()   mxSetDispMode_is_obsolete
401#define mexGetMatrixPtr() mexGetMatrixPtr_is_obsolete
402#define mexGetMatrix()    mexGetMatrix_is_obsolete
403#define mexPutMatrix()    mexPutMatrix_is_obsolete
404#define mexPutFull()      mexPutFull_is_obsolete
405#define mexGetFull()      mexGetFull_is_obsolete
406#define mexGetEps()       mexGetEps_is_obsolete
407#define mexGetInf()       mexGetInf_is_obsolete
408#define mexGetNaN()       mexGetNaN_is_obsolete
409#define mexIsFinite()     mexIsFinite_is_obsolete
410#define mexIsInf()        mexIsInf_is_obsolete
411#define mexIsNaN()        mexIsNaN_is_obsolete
412
413
414/*
415 * mexAddFlops is no longer allowed. 
416 */
417#define mexAddFlops(x) mexAddFlops_is_obsolete
418
419#if defined(V5_COMPAT)
420#define mexPutArray(parray, workspace) mexPutVariable(workspace, mxGetName(parray), parray)
421#define mexGetArray(name, workspace) mexGetVariable(workspace, name)
422#define mexGetArrayPtr(name, workspace) mexGetVariablePtr(workspace, name)
423#else
424#define mexPutArray() mexPutArray_is_obsolete
425#define mexGetArray() mexGetArray_is_obsolete
426#define mexGetArrayPtr() mexGetArrayPtr_is_obsolete
427#endif /* defined(V5_COMPAT) */
428
429#ifdef __cplusplus
430extern "C" {
431#endif
432/*
433 * Place a copy of the array value into the specified workspace with the
434 * specified name
435 */
436extern int mexPutVariable(
437    const char *workspace,
438    const char *name,
439    const mxArray *parray               /* matrix to copy */
440    );
441#ifdef __cplusplus
442}
443#endif
444
445#ifdef __cplusplus
446extern "C" {
447#endif
448/*
449 * return a pointer to the array value with the specified variable
450 * name in the specified workspace
451 */
452extern const mxArray *mexGetVariablePtr(
453    const char *workspace,
454    const char *name            /* name of symbol */
455    );
456#ifdef __cplusplus
457}
458#endif
459
460#ifdef __cplusplus
461extern "C" {
462#endif
463/*
464 * return a copy of the array value with the specified variable
465 * name in the specified workspace
466 */
467extern mxArray *mexGetVariable(
468    const char  *workspace,             
469    const char  *name                /* name of variable in question */
470    );
471#ifdef __cplusplus
472}
473#endif
474
475#ifdef __cplusplus
476extern "C" {
477#endif
478/*
479 * Lock a MEX-function so that it cannot be cleared from memory.
480 */
481extern void mexLock(void);
482#ifdef __cplusplus
483}
484#endif
485
486#ifdef __cplusplus
487extern "C" {
488#endif
489/*
490 * Unlock a locked MEX-function so that it can be cleared from memory.
491 */
492extern void mexUnlock(void);
493#ifdef __cplusplus
494}
495#endif
496
497#ifdef __cplusplus
498extern "C" {
499#endif
500/*
501 * Return true if the MEX-function is currently locked, false otherwise.
502 */
503extern bool mexIsLocked(void);
504#ifdef __cplusplus
505}
506#endif
507
508#ifdef __cplusplus
509extern "C" {
510#endif
511/*
512 * Return the name of a the MEXfunction currently executing.
513 */
514extern const char *mexFunctionName(void);
515#ifdef __cplusplus
516}
517#endif
518
519#ifdef __cplusplus
520extern "C" {
521#endif
522/*
523 * Parse and execute MATLAB syntax in string.  Returns zero if successful,
524 * and a non zero value if an error occurs.
525 */
526extern int mexEvalString(
527   const char *str         /* matlab command string */
528);
529#ifdef __cplusplus
530}
531#endif
532
533#ifdef __cplusplus
534extern "C" {
535#endif
536/*
537 * Register Mex-file's At-Exit function (accessed via MEX callback)
538 */
539extern int mexAtExit(
540    void        (*exit_fcn)(void)
541    );
542#ifdef __cplusplus
543}
544#endif
545
546
547#define NEW_DISPATCHER_EVAL_CALLER 1
548
549
550/* Copyright 1996-1999 The MathWorks, Inc. */
551
552/* $Revision: 1.9.4.1 $ */
553#ifdef ARGCHECK
554
555#include "mwdebug.h" /* Prototype _d versions of API functions */
556
557#define mexAtExit(exitfcn)                              mexAtExit_d(exitfcn, __FILE__, __LINE__)
558#define mexCallMATLAB(nlhs, plhs, nrhs, prhs, fcn) mexCallMATLAB_d(nlhs, plhs, nrhs, prhs, fcn, __FILE__, __LINE__)
559#define mexErrMsgTxt(errmsg)                    mexErrMsgTxt_d(errmsg, __FILE__, __LINE__)
560#define mexEvalString(str)                              mexEvalString_d(str, __FILE__, __LINE__)
561#define mexGet(handle, property)                mexGet_d(handle, property, __FILE__, __LINE__)
562#define mexGetVariable(workspace, name)         mexGetVariable_d(workspace, name, __FILE__, __LINE__)
563#define mexGetVariablePtr(workspace, name)      mexGetVariablePtr_d(workspace, name, __FILE__, __LINE__)
564#define mexIsGlobal(pa)                 mexIsGlobal_d(pa, __FILE__, __LINE__)
565#define mexMakeArrayPersistent(pa)              mexMakeArrayPersistent_d(pa, __FILE__, __LINE__)             
566#define mexMakeMemoryPersistent(ptr)    mexMakeMemoryPersistent_d(ptr, __FILE__, __LINE__)
567#define mexPutVariable(workspace, name, pa)     mexPutVariable_d(workspace, name, pa, __FILE__, __LINE__)
568#define mexSet(handle, property, value) mexSet_d(handle, property, value, __FILE__, __LINE__)
569#define mexSetTrapFlag(value)           mexSetTrapFlag_d(value, __FILE__, __LINE__)
570#define mexSubsAssign(plhs, sub, nsubs, rhs)    mexSubsAssign_d(plhs, sub, nsubs, rhs, __FILE__, __LINE__)
571#define mexSubsReference(prhs, sub, nsubs)    mexSubsReference_d(prhs, sub, nsubs, __FILE__, __LINE__)
572#define mexWarnMsgTxt(str)                              mexWarnMsgTxt_d(str, __FILE__, __LINE__)
573#endif
574
575#endif /* mex_h */
Note: See TracBrowser for help on using the browser.