Skip to content

Commit

Permalink
Merge pull request #26 from JuliaOpt/ml/fix07
Browse files Browse the repository at this point in the history
fix compilation on Julia 0.7
  • Loading branch information
mlubin authored Apr 11, 2018
2 parents 4a26a3c + b8bde16 commit a7c6223
Showing 1 changed file with 34 additions and 12 deletions.
46 changes: 34 additions & 12 deletions src/ClpCInterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -699,23 +699,45 @@ end
# TODO: do we actually want to make a copy of the result?
# More efficient to not and let the sufficiently warned user do so if desired.
macro def_get_row_property(fname,clpname)
quote
function $(esc(fname))(model::ClpModel)
_jl__check_model(model)
row_property_p = @clp_ccall $(esc(clpname)) Ptr{Float64} (Ptr{Void},) model.p
num_rows = convert(Int,get_num_rows(model))
return copy(unsafe_wrap(Array,row_property_p,(num_rows,)))
if VERSION >= v"0.7-"
return quote
function $(esc(fname))(model::ClpModel)
_jl__check_model(model)
row_property_p = @clp_ccall $clpname Ptr{Float64} (Ptr{Void},) model.p
num_rows = convert(Int,get_num_rows(model))
return copy(unsafe_wrap(Array,row_property_p,(num_rows,)))
end
end
else
return quote
function $(esc(fname))(model::ClpModel)
_jl__check_model(model)
row_property_p = @clp_ccall $(esc(clpname)) Ptr{Float64} (Ptr{Void},) model.p
num_rows = convert(Int,get_num_rows(model))
return copy(unsafe_wrap(Array,row_property_p,(num_rows,)))
end
end
end
end

macro def_get_col_property(fname,clpname)
quote
function $(esc(fname))(model::ClpModel)
_jl__check_model(model)
col_property_p = @clp_ccall $(esc(clpname)) Ptr{Float64} (Ptr{Void},) model.p
num_cols = convert(Int,get_num_cols(model))
return copy(unsafe_wrap(Array,col_property_p,(num_cols,)))
if VERSION >= v"0.7-"
return quote
function $(esc(fname))(model::ClpModel)
_jl__check_model(model)
col_property_p = @clp_ccall $clpname Ptr{Float64} (Ptr{Void},) model.p
num_cols = convert(Int,get_num_cols(model))
return copy(unsafe_wrap(Array,col_property_p,(num_cols,)))
end
end
else
return quote
function $(esc(fname))(model::ClpModel)
_jl__check_model(model)
col_property_p = @clp_ccall $(esc(clpname)) Ptr{Float64} (Ptr{Void},) model.p
num_cols = convert(Int,get_num_cols(model))
return copy(unsafe_wrap(Array,col_property_p,(num_cols,)))
end
end
end
end
Expand Down

0 comments on commit a7c6223

Please sign in to comment.