Skip to content

Commit 8fc25ad

Browse files
committed
Update dep method for 0.6 and change Array constructor
1 parent 828da9b commit 8fc25ad

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

src/engine.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type MSession
2121
# hide the MATLAB command window on Windows
2222
is_windows() && ccall(eng_set_visible[], Cint, (Ptr{Void}, Cint), ep, 0)
2323

24-
buf = Array(UInt8, bufsize)
24+
buf = Array{UInt8}(bufsize)
2525
if bufsize > 0
2626
bufptr = pointer(buf)
2727
ccall(eng_output_buffer[], Cint, (Ptr{Void}, Ptr{UInt8}, Cint),
@@ -163,7 +163,7 @@ function _mput_multi(vs::Symbol...)
163163
v = vs[1]
164164
:( MATLAB.put_variable($(Meta.quot(v)), $(v)) )
165165
else
166-
stmts = Array(Expr, nv)
166+
stmts = Array{Expr}(nv)
167167
for i = 1 : nv
168168
v = vs[i]
169169
stmts[i] = :( MATLAB.put_variable($(Meta.quot(v)), $(v)) )
@@ -196,7 +196,7 @@ function _mget_multi(vs::Union{Symbol, Expr}...)
196196
if nv == 1
197197
make_getvar_statement(vs[1])
198198
else
199-
stmts = Array(Expr, nv)
199+
stmts = Array{Expr}(nv)
200200
for i = 1:nv
201201
stmts[i] = make_getvar_statement(vs[i])
202202
end
@@ -227,8 +227,8 @@ function mxcall(session::MSession, mfun::Symbol, nout::Integer, in_args...)
227227

228228
# generate temporary variable names
229229

230-
in_arg_names = Array(String, nin)
231-
out_arg_names = Array(String, nout)
230+
in_arg_names = Array{String}(nin)
231+
out_arg_names = Array{String}(nout)
232232

233233
for i = 1:nin
234234
in_arg_names[i] = _gen_marg_name(mfun, "in", i)
@@ -276,7 +276,7 @@ function mxcall(session::MSession, mfun::Symbol, nout::Integer, in_args...)
276276
ret = if nout == 1
277277
jvalue(get_mvariable(session, Symbol(out_arg_names[1])))
278278
elseif nout >= 2
279-
results = Array(Any, nout)
279+
results = Array{Any}(nout)
280280
for i = 1 : nout
281281
results[i] = jvalue(get_mvariable(session, Symbol(out_arg_names[i])))
282282
end

src/mxarray.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ function size(mx::MxArray)
183183
nd = ndims(mx)
184184
pdims::Ptr{mwSize} = @mxget_attr(mx_get_dims[], Ptr{mwSize}, mx)
185185
_dims = unsafe_wrap(Array, pdims, (nd,))
186-
dims = Array(Int, nd)
186+
dims = Array{Int}(nd)
187187
for i = 1:nd
188188
dims[i] = convert(Int, _dims[i])
189189
end
@@ -216,7 +216,7 @@ end
216216

217217
function _dims_to_mwSize(dims::Tuple{Vararg{Int}})
218218
ndim = length(dims)
219-
_dims = Array(mwSize, ndim)
219+
_dims = Array{mwSize}(ndim)
220220
for i = 1:ndim
221221
_dims[i] = convert(mwSize, dims[i])
222222
end
@@ -382,7 +382,7 @@ mxarray(a::Array) = mxcellarray(a)
382382

383383
function _fieldname_array(fieldnames::String...)
384384
n = length(fieldnames)
385-
a = Array(Ptr{UInt8}, n)
385+
a = Array{Ptr{UInt8}}(n)
386386
for i = 1:n
387387
a[i] = unsafe_convert(Ptr{UInt8}, fieldnames[i])
388388
end
@@ -437,7 +437,7 @@ typealias Pairs Union{Pair,NTuple{2}}
437437

438438
function mxstruct(pairs::Pairs...)
439439
nf = length(pairs)
440-
fieldnames = Array(String, nf)
440+
fieldnames = Array{String}(nf)
441441
for i = 1:nf
442442
fn = pairs[i][1]
443443
fieldnames[i] = string(fn)
@@ -494,17 +494,17 @@ function _jarrayx(fun::String, mx::MxArray, siz::Tuple)
494494
if is_complex(mx)
495495
rdat = unsafe_wrap(Array, real_ptr(mx), siz)
496496
idat = unsafe_wrap(Array, imag_ptr(mx), siz)
497-
a = complex(rdat, idat)
497+
a = complex.(rdat, idat)
498498
else
499-
a = Array(T, siz)
499+
a = Array{T}(siz)
500500
if !isempty(a)
501501
ccall(:memcpy, Ptr{Void}, (Ptr{Void}, Ptr{Void}, UInt), a, data_ptr(mx), length(a)*sizeof(T))
502502
end
503503
end
504504
return a
505505
#unsafe_wrap(Array, data_ptr(mx), siz)
506506
elseif is_cell(mx)
507-
a = Array(Any, siz)
507+
a = Array{Any}(siz)
508508
for i = 1:length(a)
509509
a[i] = jvalue(get_cell(mx, i))
510510
end
@@ -546,8 +546,8 @@ function _jsparse{T<:MxRealNum}(ty::Type{T}, mx::MxArray)
546546
jc_a::Vector{mwIndex} = unsafe_wrap(Array, jc_ptr, (n+1,))
547547
nnz = jc_a[n+1]
548548

549-
ir = Array(Int, nnz)
550-
jc = Array(Int, n+1)
549+
ir = Array{Int}(nnz)
550+
jc = Array{Int}(n+1)
551551

552552
ir_x = unsafe_wrap(Array, ir_ptr, (nnz,))
553553
for i = 1:nnz
@@ -582,8 +582,8 @@ function Dict(mx::MxArray)
582582
throw(ArgumentError("Dict(mx::MxArray) only applies to a single struct"))
583583
end
584584
nf = mxnfields(mx)
585-
fnames = Array(String, nf)
586-
fvals = Array(Any, nf)
585+
fnames = Array{String}(nf)
586+
fvals = Array{Any}(nf)
587587
for i = 1:nf
588588
fnames[i] = get_fieldname(mx, i)
589589
pv = ccall(mx_get_field_bynum[], Ptr{Void}, (Ptr{Void}, mwIndex, Cint), mx, 0, i-1)

0 commit comments

Comments
 (0)