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

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

matlab 7.1 compile prerequisities

Line 
1/*
2 * @(#)mat.h    generated by: makeheader 4.21  Tue Jul 26 18:28:42 2005
3 *
4 *              built from:     ../../src/include/copyright.h
5 *                              ../../src/include/pragma_interface.h
6 *                              ./fmatapi.cpp
7 *                              ./fmatapiv5.cpp
8 *                              ./matapi.cpp
9 *                              ./matapiv5.cpp
10 *                              ./matlvl4.cpp
11 *                              ./matlvl5.cpp
12 *                              matdbg.h
13 */
14
15#ifndef mat_h
16#define mat_h
17
18
19/*
20 * Copyright 1984-2003 The MathWorks, Inc.
21 * All Rights Reserved.
22 */
23
24
25
26/* Copyright 2003-2004 The MathWorks, Inc. */
27
28/*
29 * Prevent g++ from making copies of vtable and typeinfo data
30 * in every compilation unit.  By allowing for only one, we can
31 * save space and prevent some situations where the linker fails
32 * to coalesce them properly into a single entry.
33 *
34 * References:
35 *    http://gcc.gnu.org/onlinedocs/gcc/Vague-Linkage.html#Vague%20Linkage
36 *    http://gcc.gnu.org/onlinedocs/gcc/C---Interface.html
37 */
38
39#ifdef __cplusplus
40#  ifdef __linux__
41#    pragma interface
42#  endif
43#endif
44
45
46
47#include <stdio.h>
48
49
50#include "matrix.h"
51
52
53typedef struct MATFile_tag MATFile;
54
55#ifdef __cplusplus
56extern "C" {
57#endif
58/*
59 * Allocate and initialize a MATFile structure for a file "filename".
60 * file "filename" must already have been fopened with a mode corresponding
61 * to "mode" ("r" == "rb", "w" == "w+b", "u" == "r+b"), and the result
62 * of that fopen must be passed in as "fp".
63 *
64 * WARNING:
65 * THIS FILE IS FOR INTERNAL MATHWORKS USE ONLY.  IT IS AN UNDOCUMENTED
66 * FUNCTION, AND MAY AT ANY TIME BE REMOVED FROM THE MAT API.
67 */
68extern MATFile * matCreateMATFile(const char * filename, FILE *fp, const char * mode);
69#ifdef __cplusplus
70}
71#endif
72
73#ifdef __cplusplus
74extern "C" {
75#endif
76/*
77 * Open a MAT-file "filename" using mode "mode".  Return
78 * a pointer to a MATFile for use with other MAT API functions.
79 *
80 * Current valid entries for "mode" are
81 * "r"  == read only.
82 * "w"  == write only (deletes any existing file with name <filename>).
83 * "w4" == as "w", but create a MATLAB 4.0 MAT-file.
84 * "u"  == update.  Read and write allowed, existing file is not deleted.
85 *
86 * Return NULL if an error occurs.
87 */
88extern MATFile * matOpen(const char *filename, const char * mode);
89#ifdef __cplusplus
90}
91#endif
92
93#ifdef __cplusplus
94extern "C" {
95#endif
96/*
97 * Close a MAT-file opened with matOpen.
98 *
99 * Return zero for success, EOF on error.
100 */
101extern int matClose(MATFile *pMF);
102#ifdef __cplusplus
103}
104#endif
105
106#ifdef __cplusplus
107extern "C" {
108#endif
109/*
110 * Return the ANSI C FILE pointer obtained when the MAT-file was opened.
111 */
112extern FILE * matGetFp(MATFile *pMF);
113#ifdef __cplusplus
114}
115#endif
116
117#ifdef __cplusplus
118extern "C" {
119#endif
120/*
121 * Write array value with the specified name to the MAT-file, deleting any
122 * previously existing variable with that name in the MAT-file.
123 *
124 * Return zero for success, nonzero for error.
125 */
126extern int matPutVariable(
127                   MATFile * pMF, 
128                   const char * name,
129                   const mxArray * pA
130                   );
131#ifdef __cplusplus
132}
133#endif
134
135#ifdef __cplusplus
136extern "C" {
137#endif
138/*
139 * Write array value with the specified name to the MAT-file pMF, deleting any
140 * previously existing variable in the MAT-file with the same name.
141 *
142 * The variable will be written such that when the MATLAB LOAD command
143 * loads the variable, it will automatically place it in the
144 * global workspace and establish a link to it in the local
145 * workspace (as if the command "global <varname>" had been
146 * issued after the variable was loaded.)
147 *
148 * Return zero for success, nonzero for error.
149 */
150extern int matPutVariableAsGlobal(
151                           MATFile * pMF, 
152                           const char * name,
153                           const mxArray * pA
154                           );
155#ifdef __cplusplus
156}
157#endif
158
159#ifdef __cplusplus
160extern "C" {
161#endif
162/*
163 * Read the array value for the specified variable name from a MAT-file.
164 *
165 * Return NULL if an error occurs.
166 */
167extern mxArray * matGetVariable(
168                         MATFile * pMF, 
169                         const char * name
170                         );
171#ifdef __cplusplus
172}
173#endif
174
175#ifdef __cplusplus
176extern "C" {
177#endif
178/*
179 * Read the next array value from the current file location of the MAT-file
180 * pMF.  This function should only be used in conjunction with
181 * matOpen and matClose.  Passing pMF to any other API functions
182 * will cause matGetNextVariable() to work incorrectly.
183 *
184 * Return NULL if an error occurs.
185 */
186extern mxArray * matGetNextVariable(MATFile *pMF, const char **nameptr);
187#ifdef __cplusplus
188}
189#endif
190
191#ifdef __cplusplus
192extern "C" {
193#endif
194/*
195 * Read the array header of the next array value in a MAT-file. 
196 * This function should only be used in conjunction with
197 * matOpen and matClose.  Passing pMF to any other API functions
198 * will cause matGetNextVariableInfo to work incorrectly.
199 *
200 * See the description of matGetVariableInfo() for the definition
201 * and valid uses of an array header.
202 *
203 * Return NULL if an error occurs.
204 */ 
205extern mxArray * matGetNextVariableInfo(MATFile *pMF, const char **nameptr);
206#ifdef __cplusplus
207}
208#endif
209
210#ifdef __cplusplus
211extern "C" {
212#endif
213/*
214 * Read the array header for the variable with the specified name from
215 * the MAT-file.
216 *
217 * An array header contains all the same information as an
218 * array, except that the pr, pi, ir, and jc data structures are
219 * not allocated for non-recursive data types.  That is,
220 * Cells, structures, and objects contain pointers to other
221 * array headers, but numeric, string, and sparse arrays do not
222 * contain valid data in their pr, pi, ir, or jc fields.
223 *
224 * The purpose of an array header is to gain fast access to
225 * information about an array without reading all the array's
226 * actual data.  Thus, functions such as mxGetM, mxGetN, and mxGetClassID
227 * can be used with array headers, but mxGetPr, mxGetPi, mxGetIr, mxGetJc,
228 * mxSetPr, mxSetPi, mxSetIr, and mxSetJc cannot.
229 *
230 * An array header should NEVER be returned to MATLAB (for example via the
231 * MEX API), or any other non-matrix access API function that expects a
232 * full mxArray (examples include engPutVariable(), matPutVariable(), and
233 * mexPutVariable()).
234 *
235 * Return NULL if an error occurs.
236 */
237extern mxArray * matGetVariableInfo(MATFile *pMF, const char * name);
238#ifdef __cplusplus
239}
240#endif
241
242#ifdef __cplusplus
243extern "C" {
244#endif
245/*
246 * Remove a variable with with the specified name from the MAT-file pMF.
247 *
248 * Return zero on success, non-zero on error.
249 */
250extern int matDeleteVariable(MATFile *pMF, const char *name);
251#ifdef __cplusplus
252}
253#endif
254
255#ifdef __cplusplus
256extern "C" {
257#endif
258/*
259 * Get a list of the names of the arrays in a MAT-file.
260 * The array of strings returned by this function contains "num"
261 * entries.  It is allocated with one call to mxCalloc, and so
262 * can (must) be freed with one call to mxFree.
263 *
264 * If there are no arrays in the MAT-file, return value
265 * is NULL and num is set to zero.  If an error occurs,
266 * return value is NULL and num is set to a negative number.
267 */
268extern char ** matGetDir(MATFile * pMF, int *num);
269#ifdef __cplusplus
270}
271#endif
272
273
274#if defined(V5_COMPAT)
275#define matPutArray(pMF, pA)         matPutVariable(pMF, mxGetName(pA), pA)
276#define matPutNextArray(pMF, pA)     matPutNextVariable(pMF, mxGetName(pA), pA)
277#define matPutArrayAsGlobal(pMF, pA) matPutVariableAsGlobal(pMF, mxGetName(pA), pA)
278#define matGetArray(pMF, name)       matGetVariable(pMF, name)
279#define matGetArrayHeader(pMF, name) matGetVariableInfo(pMF, name)
280#define matGetNextArray(pMF)         matGetNextVariable(pMF, NULL)
281#define matGetNextArrayHeader(pMF)   matGetNextVariableInfo(pMF, NULL)
282#define matDeleteArray(pMF, name)    matDeleteVariable(pMF, name)
283#else
284#define matPutArray()                matPutArray_is_obsolete
285#define matPutNextArray()            matPutNextArray_is_obsolete
286#define matPutArrayAsGlobal()        matPutArrayAsGlobal_is_obsolete
287#define matGetArray()                matGetArray_is_obsolete
288#define matGetArrayHeader()          matGetArrayHeader_is_obsolete
289#define matGetNextArray()            matGetNextArray_is_obsolete
290#define matGetNextArrayHeader()      matGetNextArrayHeader_is_obsolete
291#define matDeleteArray()             matDeleteArray_is_obsolete
292#endif  /* defined(V5_COMPAT) */
293
294
295/* $Revision: 1.9 $ */
296#ifdef ARGCHECK
297
298#include "mwdebug.h" /* Prototype _d versions of API functions */
299
300#define matClose(pMAT)                          matClose_d(pMAT, __FILE__, __LINE__)
301#define matDeleteVariable(pMAT, name)           matDeleteVariable_d(pMAT, name, __FILE__, __LINE__)
302#define matGetVariable(pMAT, name)      matGetVariable_d(pMAT, name, __FILE__, __LINE__)
303#define matGetVariableInfo(pMAT, name) matGetVariableInfo_d(pMAT, name, __FILE__, __LINE__)
304#define matGetDir(pMAT, num)                    matGetDir_d(pMAT, num, __FILE__, __LINE__)
305#define matGetFp(pMAT)                          matGetFp_d(pMAT, __FILE__, __LINE__)
306#define matGetNextVariable(pMAT, pname) matGetNextVariable_d(pMAT, pname, __FILE__, __LINE__)
307#define matGetNextVariableInfo(pMAT, pname)     matGetNextVariableInfo_d(pMAT, pname, __FILE__, __LINE__)
308#define matOpen(fname, permissions)             matOpen_d(fname, permissions, __FILE__, __LINE__)
309#define matPutVariable(pMAT, name, pa)  matPutVariable_d(pMAT, name, pa, __FILE__, __LINE__)
310#define matPutVariableAsGlobal(pMAT, name, pa) matPutVariableAsGlobal_d(pMAT, name, pa, __FILE__, __LINE__)
311#endif
312
313#endif /* mat_h */
Note: See TracBrowser for help on using the browser.