Skip to content

Commit ea957d2

Browse files
committed
Address review comments
1 parent 9c98300 commit ea957d2

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

src/HDF5.jl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1936,14 +1936,6 @@ function __init__()
19361936
__init_globals__()
19371937
register_blosc()
19381938

1939-
# Generate the Float16 datatype:
1940-
float16 = h5t_copy(H5T.NATIVE_FLOAT)
1941-
h5t_set_fields(float16, 15, 10, 5, 0, 10)
1942-
h5t_set_size(float16, 2)
1943-
h5t_set_ebias(float16, 15)
1944-
h5t_lock(float16)
1945-
H5T.NATIVE_FLOAT16 = float16
1946-
19471939
# Turn off automatic error printing
19481940
# h5e_set_auto(H5E.DEFAULT, C_NULL, C_NULL)
19491941

src/api_types.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ end
253253
# Dataspace constants
254254
@defconstants H5S begin
255255
# atomic data types
256-
ALL::hsize_t = 0
256+
ALL::hid_t = 0
257257
UNLIMITED::hsize_t = typemax(hsize_t)
258258

259259
# Types of dataspaces (C enum H5S_class_t)
@@ -414,5 +414,13 @@ function __init_globals__()
414414
H5T.NATIVE_FLOAT = read_const(:H5T_NATIVE_FLOAT_g)
415415
H5T.NATIVE_DOUBLE = read_const(:H5T_NATIVE_DOUBLE_g)
416416

417+
# Defines a type corresponding to Julia's IEEE Float16 type.
418+
float16 = h5t_copy(H5T.NATIVE_FLOAT)
419+
h5t_set_fields(float16, 15, 10, 5, 0, 10)
420+
h5t_set_size(float16, 2)
421+
h5t_set_ebias(float16, 15)
422+
h5t_lock(float16)
423+
H5T.NATIVE_FLOAT16 = float16
424+
417425
nothing
418426
end

src/macros.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ macro defconstants(prefix::Symbol, expr::Expr)
5454

5555
isruntime = isexpr(line, :(=)) ? false :
5656
isexpr(line, :(::)) ? true :
57-
error("Unexpected statement: ", repr(line))
57+
error("Unexpected statement: ", line)
5858

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

@@ -106,12 +106,14 @@ macro defconstants(prefix::Symbol, expr::Expr)
106106
end
107107
function Base.getproperty(::$einnermod.$prefix, sym::Symbol)
108108
$(getbody...)
109+
error($(string(prefix) * " has no constant "), sym)
109110
end
110111
end
111112
if !isempty(setbody)
112113
setfn = quote
113114
function Base.setproperty!(::$einnermod.$prefix, sym::Symbol, value)
114115
$(setbody...)
116+
error($(string(prefix) * "."), sym, " cannot be set")
115117
end
116118
end
117119
append!(block.args, Base.remove_linenums!(setfn).args)

0 commit comments

Comments
 (0)