Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jmert committed Oct 13, 2020
1 parent 9c98300 commit 8163b58
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
8 changes: 0 additions & 8 deletions src/HDF5.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1936,14 +1936,6 @@ function __init__()
__init_globals__()
register_blosc()

# Generate the Float16 datatype:
float16 = h5t_copy(H5T.NATIVE_FLOAT)
h5t_set_fields(float16, 15, 10, 5, 0, 10)
h5t_set_size(float16, 2)
h5t_set_ebias(float16, 15)
h5t_lock(float16)
H5T.NATIVE_FLOAT16 = float16

# Turn off automatic error printing
# h5e_set_auto(H5E.DEFAULT, C_NULL, C_NULL)

Expand Down
8 changes: 8 additions & 0 deletions src/api_types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -414,5 +414,13 @@ function __init_globals__()
H5T.NATIVE_FLOAT = read_const(:H5T_NATIVE_FLOAT_g)
H5T.NATIVE_DOUBLE = read_const(:H5T_NATIVE_DOUBLE_g)

# Defines a type corresponding to Julia's IEEE Float16 type.
float16 = h5t_copy(H5T.NATIVE_FLOAT)
h5t_set_fields(float16, 15, 10, 5, 0, 10)
h5t_set_size(float16, 2)
h5t_set_ebias(float16, 15)
h5t_lock(float16)
H5T.NATIVE_FLOAT16 = float16

nothing
end
8 changes: 5 additions & 3 deletions src/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ macro defconstants(prefix::Symbol, expr::Expr)

isruntime = isexpr(line, :(=)) ? false :
isexpr(line, :(::)) ? true :
error("Unexpected statement: ", repr(line))
error("Unexpected statement: ", line)

# Get the name and type pair
nametype = isruntime ? line : line.args[1]
isexpr(nametype, :(::)) || error("Expected `name::type`, got ", repr(nametype))
isexpr(nametype, :(::)) || error("Expected `name::type`, got: ", nametype)
name = nametype.args[1]::Symbol
type = nametype.args[2]
type = nametype.args[2]::Union{Symbol,Expr}
# Save type for later use
push!(imports, type)

Expand Down Expand Up @@ -106,12 +106,14 @@ macro defconstants(prefix::Symbol, expr::Expr)
end
function Base.getproperty(::$einnermod.$prefix, sym::Symbol)
$(getbody...)
error($(string(prefix) * " has no constant "), sym)
end
end
if !isempty(setbody)
setfn = quote
function Base.setproperty!(::$einnermod.$prefix, sym::Symbol, value)
$(setbody...)
error($(string(prefix) * "."), sym, " cannot be set")
end
end
append!(block.args, Base.remove_linenums!(setfn).args)
Expand Down

0 comments on commit 8163b58

Please sign in to comment.