@@ -6,28 +6,29 @@ using SparseArrays
6
6
import Base: eltype, close, size, copy, ndims, unsafe_convert
7
7
8
8
# mxarray
9
- export MxArray, mxClassID, mxComplexity,
10
- mxclassid, data_ptr,
11
- classid, nrows, ncols, nelems, elsize
9
+ export MxArray,
10
+ mxClassID, mxComplexity,
11
+ mxclassid, data_ptr,
12
+ classid, nrows, ncols, nelems, elsize
12
13
13
14
export is_double, is_single,
14
- is_int8, is_uint8, is_int16, is_uint16,
15
- is_int32, is_uint32, is_int64, is_uint64,
16
- is_numeric, is_complex, is_sparse, is_empty,
17
- is_logical, is_char, is_struct, is_cell
15
+ is_int8, is_uint8, is_int16, is_uint16,
16
+ is_int32, is_uint32, is_int64, is_uint64,
17
+ is_numeric, is_complex, is_sparse, is_empty,
18
+ is_logical, is_char, is_struct, is_cell
18
19
19
20
export mxarray, mxsparse, delete,
20
- mxcellarray, get_cell, set_cell,
21
- mxstruct, mxstructarray, mxnfields, get_fieldname, get_field, set_field,
22
- jvalue, jarray, jscalar, jvector, jmatrix, jsparse, jstring, jdict
21
+ mxcellarray, get_cell, set_cell,
22
+ mxstruct, mxstructarray, mxnfields, get_fieldname, get_field, set_field,
23
+ jvalue, jarray, jscalar, jvector, jmatrix, jsparse, jstring, jdict
23
24
24
25
# engine & matfile
25
26
export MSession, MatFile,
26
- get_default_msession, restart_default_msession, close_default_msession,
27
- eval_string, get_mvariable, get_variable, put_variable, put_variables,
28
- variable_names, read_matfile, write_matfile,
29
- mxcall,
30
- @mput , @mget , @mat_str
27
+ get_default_msession, restart_default_msession, close_default_msession,
28
+ eval_string, get_mvariable, get_variable, put_variable, put_variables,
29
+ variable_names, read_matfile, write_matfile,
30
+ mxcall,
31
+ @mput , @mget , @mat_str
31
32
32
33
if Sys. iswindows ()
33
34
export show_msession, hide_msession, get_msession_visiblity
@@ -37,7 +38,9 @@ const depsfile = joinpath(dirname(@__DIR__), "deps", "deps.jl")
37
38
if isfile (depsfile)
38
39
include (depsfile)
39
40
else
40
- error (" MATLAB is not properly installed. Please run Pkg.build(\" MATLAB\" ) and restart Julia." )
41
+ error (
42
+ " MATLAB is not properly installed. Please run Pkg.build(\" MATLAB\" ) and restart Julia." ,
43
+ )
41
44
end
42
45
43
46
# exceptions
@@ -79,119 +82,114 @@ function __init__()
79
82
80
83
if libmx_size > 0 # non-zero size library path
81
84
82
- # load libraries
83
- # workaround for https://github.com/JuliaInterop/MATLAB.jl/issues/200
84
- if Sys. iswindows ()
85
- ENV [" PATH" ] = string (matlab_libpath, " ;" , ENV [" PATH" ])
86
- elseif Sys. islinux ()
87
- ENV [" PATH" ] = string (matlab_libpath, " :" , ENV [" PATH" ])
88
- end
89
- libmx[] = Libdl. dlopen (joinpath (matlab_libpath, " libmx" ), Libdl. RTLD_GLOBAL)
90
- libmat[] = Libdl. dlopen (joinpath (matlab_libpath, " libmat" ), Libdl. RTLD_GLOBAL)
91
- libeng[] = Libdl. dlopen (joinpath (matlab_libpath, " libeng" ), Libdl. RTLD_GLOBAL)
92
-
93
- # engine functions
94
-
95
- eng_open[] = engfunc (:engOpen )
96
- eng_close[] = engfunc (:engClose )
97
- eng_set_visible[] = engfunc (:engSetVisible )
98
- eng_get_visible[] = engfunc (:engGetVisible )
99
- eng_output_buffer[] = engfunc (:engOutputBuffer )
100
- eng_eval_string[] = engfunc (:engEvalString )
101
- eng_put_variable[] = engfunc (:engPutVariable )
102
- eng_get_variable[] = engfunc (:engGetVariable )
103
-
104
- # mxarray functions
105
-
106
- mx_destroy_array[] = mxfunc (:mxDestroyArray )
107
- mx_duplicate_array[] = mxfunc (:mxDuplicateArray )
108
-
109
- # load functions to access mxarray
110
-
111
- mx_free[] = mxfunc (:mxFree )
112
-
113
- mx_get_classid[] = mxfunc (:mxGetClassID )
114
- mx_get_m[] = mxfunc (:mxGetM )
115
- mx_get_n[] = mxfunc (:mxGetN )
116
- mx_get_nelems[] = mxfunc (:mxGetNumberOfElements )
117
- mx_get_ndims[] = mxfunc (:mxGetNumberOfDimensions_730 )
118
- mx_get_elemsize[] = mxfunc (:mxGetElementSize )
119
- mx_get_data[] = mxfunc (:mxGetData )
120
- mx_get_dims[] = mxfunc (:mxGetDimensions_730 )
121
- mx_get_nfields[] = mxfunc (:mxGetNumberOfFields )
122
- mx_get_pr[] = mxfunc (:mxGetPr )
123
- mx_get_pi[] = mxfunc (:mxGetPi )
124
- mx_get_ir[] = mxfunc (:mxGetIr_730 )
125
- mx_get_jc[] = mxfunc (:mxGetJc_730 )
126
-
127
- mx_is_double[] = mxfunc (:mxIsDouble )
128
- mx_is_single[] = mxfunc (:mxIsSingle )
129
- mx_is_int64[] = mxfunc (:mxIsInt64 )
130
- mx_is_uint64[] = mxfunc (:mxIsUint64 )
131
- mx_is_int32[] = mxfunc (:mxIsInt32 )
132
- mx_is_uint32[] = mxfunc (:mxIsUint32 )
133
- mx_is_int16[] = mxfunc (:mxIsInt16 )
134
- mx_is_uint16[] = mxfunc (:mxIsUint16 )
135
- mx_is_int8[] = mxfunc (:mxIsInt8 )
136
- mx_is_uint8[] = mxfunc (:mxIsUint8 )
137
- mx_is_char[] = mxfunc (:mxIsChar )
138
-
139
- mx_is_numeric[] = mxfunc (:mxIsNumeric )
140
- mx_is_logical[] = mxfunc (:mxIsLogical )
141
- mx_is_complex[] = mxfunc (:mxIsComplex )
142
- mx_is_sparse[] = mxfunc (:mxIsSparse )
143
- mx_is_empty[] = mxfunc (:mxIsEmpty )
144
- mx_is_struct[] = mxfunc (:mxIsStruct )
145
- mx_is_cell[] = mxfunc (:mxIsCell )
146
-
147
-
148
- # load functions to create & delete MATLAB array
149
-
150
- mx_create_numeric_matrix[] = mxfunc (:mxCreateNumericMatrix_730 )
151
- mx_create_numeric_array[] = mxfunc (:mxCreateNumericArray_730 )
152
-
153
- mx_create_double_scalar[] = mxfunc (:mxCreateDoubleScalar )
154
- mx_create_logical_scalar[] = mxfunc (:mxCreateLogicalScalar )
155
-
156
- mx_create_sparse[] = mxfunc (:mxCreateSparse_730 )
157
- mx_create_sparse_logical[] = mxfunc (:mxCreateSparseLogicalMatrix_730 )
158
-
159
- mx_create_string[] = mxfunc (:mxCreateString )
160
- mx_create_char_array[] = mxfunc (:mxCreateCharArray_730 )
161
-
162
- mx_create_cell_array[] = mxfunc (:mxCreateCellArray_730 )
163
-
164
- mx_create_struct_matrix[] = mxfunc (:mxCreateStructMatrix_730 )
165
- mx_create_struct_array[] = mxfunc (:mxCreateStructArray_730 )
166
-
167
- mx_get_cell[] = mxfunc (:mxGetCell_730 )
168
- mx_set_cell[] = mxfunc (:mxSetCell_730 )
169
-
170
- mx_get_field[] = mxfunc (:mxGetField_730 )
171
- mx_set_field[] = mxfunc (:mxSetField_730 )
172
- mx_get_field_bynum[] = mxfunc (:mxGetFieldByNumber_730 )
173
- mx_get_fieldname[] = mxfunc (:mxGetFieldNameByNumber )
174
-
175
- mx_get_string[] = mxfunc (:mxGetString_730 )
176
-
177
-
178
- # load I/O mat functions
179
-
180
- mat_open[] = matfunc (:matOpen )
181
- mat_close[] = matfunc (:matClose )
182
- mat_get_variable[] = matfunc (:matGetVariable )
183
- mat_put_variable[] = matfunc (:matPutVariable )
184
- mat_get_dir[] = matfunc (:matGetDir )
185
-
85
+ # load libraries
86
+ # workaround for https://github.com/JuliaInterop/MATLAB.jl/issues/200
87
+ if Sys. iswindows ()
88
+ ENV [" PATH" ] = string (matlab_libpath, " ;" , ENV [" PATH" ])
89
+ elseif Sys. islinux ()
90
+ ENV [" PATH" ] = string (matlab_libpath, " :" , ENV [" PATH" ])
91
+ end
92
+ libmx[] = Libdl. dlopen (joinpath (matlab_libpath, " libmx" ), Libdl. RTLD_GLOBAL)
93
+ libmat[] = Libdl. dlopen (joinpath (matlab_libpath, " libmat" ), Libdl. RTLD_GLOBAL)
94
+ libeng[] = Libdl. dlopen (joinpath (matlab_libpath, " libeng" ), Libdl. RTLD_GLOBAL)
95
+
96
+ # engine functions
97
+
98
+ eng_open[] = engfunc (:engOpen )
99
+ eng_close[] = engfunc (:engClose )
100
+ eng_set_visible[] = engfunc (:engSetVisible )
101
+ eng_get_visible[] = engfunc (:engGetVisible )
102
+ eng_output_buffer[] = engfunc (:engOutputBuffer )
103
+ eng_eval_string[] = engfunc (:engEvalString )
104
+ eng_put_variable[] = engfunc (:engPutVariable )
105
+ eng_get_variable[] = engfunc (:engGetVariable )
106
+
107
+ # mxarray functions
108
+
109
+ mx_destroy_array[] = mxfunc (:mxDestroyArray )
110
+ mx_duplicate_array[] = mxfunc (:mxDuplicateArray )
111
+
112
+ # load functions to access mxarray
113
+
114
+ mx_free[] = mxfunc (:mxFree )
115
+
116
+ mx_get_classid[] = mxfunc (:mxGetClassID )
117
+ mx_get_m[] = mxfunc (:mxGetM )
118
+ mx_get_n[] = mxfunc (:mxGetN )
119
+ mx_get_nelems[] = mxfunc (:mxGetNumberOfElements )
120
+ mx_get_ndims[] = mxfunc (:mxGetNumberOfDimensions_730 )
121
+ mx_get_elemsize[] = mxfunc (:mxGetElementSize )
122
+ mx_get_data[] = mxfunc (:mxGetData )
123
+ mx_get_dims[] = mxfunc (:mxGetDimensions_730 )
124
+ mx_get_nfields[] = mxfunc (:mxGetNumberOfFields )
125
+ mx_get_pr[] = mxfunc (:mxGetPr )
126
+ mx_get_pi[] = mxfunc (:mxGetPi )
127
+ mx_get_ir[] = mxfunc (:mxGetIr_730 )
128
+ mx_get_jc[] = mxfunc (:mxGetJc_730 )
129
+
130
+ mx_is_double[] = mxfunc (:mxIsDouble )
131
+ mx_is_single[] = mxfunc (:mxIsSingle )
132
+ mx_is_int64[] = mxfunc (:mxIsInt64 )
133
+ mx_is_uint64[] = mxfunc (:mxIsUint64 )
134
+ mx_is_int32[] = mxfunc (:mxIsInt32 )
135
+ mx_is_uint32[] = mxfunc (:mxIsUint32 )
136
+ mx_is_int16[] = mxfunc (:mxIsInt16 )
137
+ mx_is_uint16[] = mxfunc (:mxIsUint16 )
138
+ mx_is_int8[] = mxfunc (:mxIsInt8 )
139
+ mx_is_uint8[] = mxfunc (:mxIsUint8 )
140
+ mx_is_char[] = mxfunc (:mxIsChar )
141
+
142
+ mx_is_numeric[] = mxfunc (:mxIsNumeric )
143
+ mx_is_logical[] = mxfunc (:mxIsLogical )
144
+ mx_is_complex[] = mxfunc (:mxIsComplex )
145
+ mx_is_sparse[] = mxfunc (:mxIsSparse )
146
+ mx_is_empty[] = mxfunc (:mxIsEmpty )
147
+ mx_is_struct[] = mxfunc (:mxIsStruct )
148
+ mx_is_cell[] = mxfunc (:mxIsCell )
149
+
150
+ # load functions to create & delete MATLAB array
151
+
152
+ mx_create_numeric_matrix[] = mxfunc (:mxCreateNumericMatrix_730 )
153
+ mx_create_numeric_array[] = mxfunc (:mxCreateNumericArray_730 )
154
+
155
+ mx_create_double_scalar[] = mxfunc (:mxCreateDoubleScalar )
156
+ mx_create_logical_scalar[] = mxfunc (:mxCreateLogicalScalar )
157
+
158
+ mx_create_sparse[] = mxfunc (:mxCreateSparse_730 )
159
+ mx_create_sparse_logical[] = mxfunc (:mxCreateSparseLogicalMatrix_730 )
160
+
161
+ mx_create_string[] = mxfunc (:mxCreateString )
162
+ mx_create_char_array[] = mxfunc (:mxCreateCharArray_730 )
163
+
164
+ mx_create_cell_array[] = mxfunc (:mxCreateCellArray_730 )
165
+
166
+ mx_create_struct_matrix[] = mxfunc (:mxCreateStructMatrix_730 )
167
+ mx_create_struct_array[] = mxfunc (:mxCreateStructArray_730 )
168
+
169
+ mx_get_cell[] = mxfunc (:mxGetCell_730 )
170
+ mx_set_cell[] = mxfunc (:mxSetCell_730 )
171
+
172
+ mx_get_field[] = mxfunc (:mxGetField_730 )
173
+ mx_set_field[] = mxfunc (:mxSetField_730 )
174
+ mx_get_field_bynum[] = mxfunc (:mxGetFieldByNumber_730 )
175
+ mx_get_fieldname[] = mxfunc (:mxGetFieldNameByNumber )
176
+
177
+ mx_get_string[] = mxfunc (:mxGetString_730 )
178
+
179
+ # load I/O mat functions
180
+
181
+ mat_open[] = matfunc (:matOpen )
182
+ mat_close[] = matfunc (:matClose )
183
+ mat_get_variable[] = matfunc (:matGetVariable )
184
+ mat_put_variable[] = matfunc (:matPutVariable )
185
+ mat_get_dir[] = matfunc (:matGetDir )
186
186
end
187
187
end
188
188
189
-
190
189
# ##########################################################
191
190
#
192
191
# deprecations
193
192
#
194
193
# ##########################################################
195
194
196
-
197
195
end
0 commit comments