|
134 | 134 | # |
135 | 135 | ########################################################### |
136 | 136 |
|
137 | | -# initialize some useful functions |
138 | | - |
139 | | -const _mx_free = Ref{Ptr{Void}}(0) |
140 | | - |
141 | | -const _mx_get_classid = Ref{Ptr{Void}}(0) |
142 | | -const _mx_get_m = Ref{Ptr{Void}}(0) |
143 | | -const _mx_get_n = Ref{Ptr{Void}}(0) |
144 | | -const _mx_get_nelems = Ref{Ptr{Void}}(0) |
145 | | -const _mx_get_ndims = Ref{Ptr{Void}}(0) |
146 | | -const _mx_get_elemsize = Ref{Ptr{Void}}(0) |
147 | | -const _mx_get_data = Ref{Ptr{Void}}(0) |
148 | | -const _mx_get_dims = Ref{Ptr{Void}}(0) |
149 | | -const _mx_get_nfields = Ref{Ptr{Void}}(0) |
150 | | -const _mx_get_pr = Ref{Ptr{Void}}(0) |
151 | | -const _mx_get_pi = Ref{Ptr{Void}}(0) |
152 | | -const _mx_get_ir = Ref{Ptr{Void}}(0) |
153 | | -const _mx_get_jc = Ref{Ptr{Void}}(0) |
154 | | - |
155 | | -const _mx_is_double = Ref{Ptr{Void}}(0) |
156 | | -const _mx_is_single = Ref{Ptr{Void}}(0) |
157 | | -const _mx_is_int64 = Ref{Ptr{Void}}(0) |
158 | | -const _mx_is_uint64 = Ref{Ptr{Void}}(0) |
159 | | -const _mx_is_int32 = Ref{Ptr{Void}}(0) |
160 | | -const _mx_is_uint32 = Ref{Ptr{Void}}(0) |
161 | | -const _mx_is_int16 = Ref{Ptr{Void}}(0) |
162 | | -const _mx_is_uint16 = Ref{Ptr{Void}}(0) |
163 | | -const _mx_is_int8 = Ref{Ptr{Void}}(0) |
164 | | -const _mx_is_uint8 = Ref{Ptr{Void}}(0) |
165 | | -const _mx_is_char = Ref{Ptr{Void}}(0) |
166 | | - |
167 | | -const _mx_is_numeric = Ref{Ptr{Void}}(0) |
168 | | -const _mx_is_logical = Ref{Ptr{Void}}(0) |
169 | | -const _mx_is_complex = Ref{Ptr{Void}}(0) |
170 | | -const _mx_is_sparse = Ref{Ptr{Void}}(0) |
171 | | -const _mx_is_empty = Ref{Ptr{Void}}(0) |
172 | | -const _mx_is_struct = Ref{Ptr{Void}}(0) |
173 | | -const _mx_is_cell = Ref{Ptr{Void}}(0) |
174 | | - |
175 | 137 | macro mxget_attr(fun, ret, mx) |
176 | 138 | :(ccall($(esc(fun)), $(esc(ret)), (Ptr{Void},), $(esc(mx)))) |
177 | 139 | end |
@@ -246,40 +208,12 @@ function size(mx::MxArray, d::Integer) |
246 | 208 | end |
247 | 209 |
|
248 | 210 |
|
249 | | - |
250 | 211 | ########################################################### |
251 | 212 | # |
252 | 213 | # functions to create & delete MATLAB arrays |
253 | 214 | # |
254 | 215 | ########################################################### |
255 | 216 |
|
256 | | -# initialize some useful functions |
257 | | - |
258 | | -const _mx_create_numeric_mat = Ref{Ptr{Void}}(0) |
259 | | -const _mx_create_numeric_arr = Ref{Ptr{Void}}(0) |
260 | | - |
261 | | -const _mx_create_double_scalar = Ref{Ptr{Void}}(0) |
262 | | -const _mx_create_logical_scalar = Ref{Ptr{Void}}(0) |
263 | | - |
264 | | -const _mx_create_sparse = Ref{Ptr{Void}}(0) |
265 | | -const _mx_create_sparse_logical = Ref{Ptr{Void}}(0) |
266 | | - |
267 | | -const _mx_create_string = Ref{Ptr{Void}}(0) |
268 | | -const _mx_create_char_array = Ref{Ptr{Void}}(0) |
269 | | - |
270 | | -const _mx_create_cell_array = Ref{Ptr{Void}}(0) |
271 | | - |
272 | | -const _mx_create_struct_matrix = Ref{Ptr{Void}}(0) |
273 | | -const _mx_create_struct_array = Ref{Ptr{Void}}(0) |
274 | | - |
275 | | -const _mx_get_cell = Ref{Ptr{Void}}(0) |
276 | | -const _mx_set_cell = Ref{Ptr{Void}}(0) |
277 | | - |
278 | | -const _mx_get_field = Ref{Ptr{Void}}(0) |
279 | | -const _mx_set_field = Ref{Ptr{Void}}(0) |
280 | | -const _mx_get_field_bynum = Ref{Ptr{Void}}(0) |
281 | | -const _mx_get_fieldname = Ref{Ptr{Void}}(0) |
282 | | - |
283 | 217 |
|
284 | 218 | function _dims_to_mwSize(dims::Tuple{Vararg{Int}}) |
285 | 219 | ndim = length(dims) |
|
407 | 341 |
|
408 | 342 | function mxarray(s::String) |
409 | 343 | utf16string = transcode(UInt16, s) |
410 | | - pm = ccall(_mx_create_char_array, Ptr{Void}, (mwSize, Ptr{mwSize},), 2, |
| 344 | + pm = ccall(_mx_create_char_array[], Ptr{Void}, (mwSize, Ptr{mwSize},), 2, |
411 | 345 | _dims_to_mwSize((1, length(utf16string)))) |
412 | 346 | mx = MxArray(pm) |
413 | 347 | ccall(:memcpy, Ptr{Void}, (Ptr{Void}, Ptr{Void}, UInt), data_ptr(mx), utf16string, |
@@ -551,8 +485,6 @@ mxarray(d) = mxstruct(d) |
551 | 485 | # |
552 | 486 | ########################################################### |
553 | 487 |
|
554 | | -const _mx_get_string = Ref{Ptr{Void}}(0) |
555 | | - |
556 | 488 | # use deep-copy from MATLAB variable to Julia array |
557 | 489 | # in practice, MATLAB variable often has shorter life-cycle |
558 | 490 |
|
|
0 commit comments