Skip to content

Commit

Permalink
Merge pull request #55 from kbarbary/fix-method-redef
Browse files Browse the repository at this point in the history
Fix cfitsio_typecode() method redefinition
  • Loading branch information
kbarbary committed Aug 9, 2016
2 parents d2586fb + 7bd9060 commit 97b09dd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion deps/build.jl
Expand Up @@ -35,7 +35,7 @@ provides(BuildProcess,
ChangeDirectory(joinpath(srcdir, "cfitsio"))
FileRule(joinpath(libdir, libfilename),
@build_steps begin
`./configure --prefix=$prefix`
`./configure --prefix=$prefix --enable-reentrant`
`make shared install`
end)
end
Expand Down
12 changes: 8 additions & 4 deletions src/libcfitsio.jl
Expand Up @@ -145,7 +145,6 @@ for (T, code) in ((UInt8, 8), # BYTE_IMG
end
end

# TODO: elimiate duplicates (Clong vs Int64 or Clong vs Cint) ?
for (T, code) in ((UInt8, 11),
(Int8, 12),
(Bool, 14),
Expand All @@ -154,16 +153,21 @@ for (T, code) in ((UInt8, 11),
(Cshort, 21),
(Cuint, 30),
(Cint, 31),
(Culong, 40),
(Clong, 41),
(Float32, 42),
(Int64, 81),
(Float32, 42),
(Float64, 82),
(Complex64, 83),
(Complex128, 163))
@eval cfitsio_typecode(::Type{$T}) = convert(Cint, $code)
end

# Above, we don't define a method for Clong because it is either Cint (Int32)
# or Int64 depending on the platform, and those methods are already defined.
# Culong is either UInt64 or Cuint depending on platform. Only define it if
# not already defined.
if Culong !== Cuint
cfitsio_typecode(::Type{Culong}) = convert(Cint, 40)
end

# -----------------------------------------------------------------------------
# FITSFile type
Expand Down

0 comments on commit 97b09dd

Please sign in to comment.