diff --git a/src/HDF5.jl b/src/HDF5.jl index a7d76cca8..30969f830 100644 --- a/src/HDF5.jl +++ b/src/HDF5.jl @@ -10,17 +10,18 @@ import Mmap ### PUBLIC API ### export -@read, @write, -h5open, h5read, h5write, h5rewrite, h5writeattr, h5readattr, -create_attribute, open_attribute, read_attribute, write_attribute, delete_attribute, rename_attribute, attributes, attrs, -create_dataset, open_dataset, read_dataset, write_dataset, -create_group, open_group, -copy_object, open_object, delete_object, move_link, -create_datatype, commit_datatype, open_datatype, -create_property, -group_info, object_info, -dataspace, datatype, -Filters, Drivers + @read, @write, + h5open, h5read, h5write, h5rewrite, h5writeattr, h5readattr, + create_attribute, open_attribute, read_attribute, write_attribute, delete_attribute, + rename_attribute, attributes, attrs, + create_dataset, open_dataset, read_dataset, write_dataset, + create_group, open_group, + copy_object, open_object, delete_object, move_link, + create_datatype, commit_datatype, open_datatype, + create_property, + group_info, object_info, + dataspace, datatype, + Filters, Drivers ### The following require module scoping ### @@ -97,7 +98,8 @@ function h5read(filename, name_type_pair::Pair{<:AbstractString,DataType}; pv... dat end -function h5read(filename, name::AbstractString, indices::Tuple{Vararg{Union{AbstractRange{Int},Int,Colon}}}; pv...) +function h5read(filename, name::AbstractString, + indices::Tuple{Vararg{Union{AbstractRange{Int},Int,Colon}}}; pv...) local dat fapl = FileAccessProperties(; fclose_degree = :strong) pv = setproperties!(fapl; pv...) @@ -112,8 +114,6 @@ function h5read(filename, name::AbstractString, indices::Tuple{Vararg{Union{Abst dat end - - function Base.getindex(parent::Union{File,Group}, path::AbstractString; pv...) haskey(parent, path) || throw(KeyError(path)) # Faster than below if defaults are OK @@ -136,7 +136,8 @@ end # Assign syntax: obj[path] = value # Create a dataset with properties: obj[path, prop = val, ...] = val -function Base.setindex!(parent::Union{File,Group}, val, path::Union{AbstractString,Nothing}; pv...) +function Base.setindex!(parent::Union{File,Group}, val, path::Union{AbstractString,Nothing}; + pv...) need_chunks = any(k in keys(chunked_props) for k in keys(pv)) have_chunks = any(k == :chunk for k in keys(pv)) @@ -172,7 +173,6 @@ get_create_properties(g::Group) = GroupCreateProperties(API.h5g_get_create_p get_create_properties(f::File) = FileCreateProperties(API.h5f_get_create_plist(f)) get_create_properties(a::Attribute) = AttributeCreateProperties(API.h5a_get_create_plist(a)) - const HAS_PARALLEL = Ref(false) """ @@ -196,12 +196,14 @@ function __init__() ASCII_ATTRIBUTE_PROPERTIES.char_encoding = :ascii UTF8_ATTRIBUTE_PROPERTIES.char_encoding = :utf8 - @require FileIO="5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" begin - @require OrderedCollections="bac558e1-5e72-5ebc-8fee-abe8a469f55d" include("fileio.jl") - end + @require FileIO="5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" begin @require OrderedCollections="bac558e1-5e72-5ebc-8fee-abe8a469f55d" include("fileio.jl") end @require H5Zblosc="c8ec2601-a99c-407f-b158-e79c03c2f5f7" begin - set_blosc!(p::Properties, val::Bool) = val && push!(Filters.FilterPipeline(p), H5Zblosc.BloscFilter()) - set_blosc!(p::Properties, level::Integer) = push!(Filters.FilterPipeline(p), H5Zblosc.BloscFilter(level=level)) + function set_blosc!(p::Properties, val::Bool) + val && push!(Filters.FilterPipeline(p), H5Zblosc.BloscFilter()) + end + function set_blosc!(p::Properties, level::Integer) + push!(Filters.FilterPipeline(p), H5Zblosc.BloscFilter(; level = level)) + end end return nothing diff --git a/src/api/error.jl b/src/api/error.jl index 7bfae4a0d..103f5583d 100644 --- a/src/api/error.jl +++ b/src/api/error.jl @@ -55,14 +55,15 @@ function Base.showerror(io::IO, err::H5Error) errval = unsafe_load(errptr) print(io, "\n", lpad("[$n] ", 4 + ndigits(n_total))) if errval.func_name != C_NULL - printstyled(io, unsafe_string(errval.func_name); bold=true) + printstyled(io, unsafe_string(errval.func_name); bold = true) print(io, ": ") end major = h5e_get_msg(errval.maj_num)[2] minor = h5e_get_msg(errval.min_num)[2] print(io, major, "/", minor) if errval.desc != C_NULL - printstyled(io, "\n", " "^(4 + ndigits(n_total)), unsafe_string(errval.desc), color=:light_black) + printstyled(io, "\n", " "^(4 + ndigits(n_total)), unsafe_string(errval.desc); + color = :light_black) end if SHORT_ERROR[] if n_total > 1 diff --git a/src/api/functions.jl b/src/api/functions.jl index 63f7b56fe..44dbab49b 100644 --- a/src/api/functions.jl +++ b/src/api/functions.jl @@ -4,11 +4,12 @@ # `gen/gen_wrappers.jl`, and commit the updated `src/api/functions.jl`. _libhdf5_build_ver = let - (majnum, minnum, relnum) = (Ref{Cuint}(), Ref{Cuint}(), Ref{Cuint}()) - r = ccall((:H5get_libversion, libhdf5), herr_t, (Ref{Cuint}, Ref{Cuint}, Ref{Cuint}), majnum, minnum, relnum) - r < 0 && error("Error getting HDF5 library version") - VersionNumber(majnum[], minnum[], relnum[]) - end + (majnum, minnum, relnum) = (Ref{Cuint}(), Ref{Cuint}(), Ref{Cuint}()) + r = ccall((:H5get_libversion, libhdf5), herr_t, (Ref{Cuint}, Ref{Cuint}, Ref{Cuint}), + majnum, minnum, relnum) + r < 0 && error("Error getting HDF5 library version") + VersionNumber(majnum[], minnum[], relnum[]) +end """ h5_close() @@ -60,7 +61,8 @@ end See `libhdf5` documentation for [`H5get_libversion`](https://portal.hdfgroup.org/display/HDF5/H5_GET_LIBVERSION). """ function h5_get_libversion(majnum, minnum, relnum) - var"#status#" = ccall((:H5get_libversion, libhdf5), herr_t, (Ref{Cuint}, Ref{Cuint}, Ref{Cuint}), majnum, minnum, relnum) + var"#status#" = ccall((:H5get_libversion, libhdf5), herr_t, + (Ref{Cuint}, Ref{Cuint}, Ref{Cuint}), majnum, minnum, relnum) var"#status#" < 0 && @h5error("Error getting HDF5 library version") return nothing end @@ -92,8 +94,12 @@ end See `libhdf5` documentation for [`H5set_free_list_limits`](https://portal.hdfgroup.org/display/HDF5/H5_SET_FREE_LIST_LIMITS). """ -function h5_set_free_list_limits(reg_global_lim, reg_list_lim, arr_global_lim, arr_list_lim, blk_global_lim, blk_list_lim) - var"#status#" = ccall((:H5set_free_list_limits, libhdf5), herr_t, (Cint, Cint, Cint, Cint, Cint, Cint), reg_global_lim, reg_list_lim, arr_global_lim, arr_list_lim, blk_global_lim, blk_list_lim) +function h5_set_free_list_limits(reg_global_lim, reg_list_lim, arr_global_lim, arr_list_lim, + blk_global_lim, blk_list_lim) + var"#status#" = ccall((:H5set_free_list_limits, libhdf5), herr_t, + (Cint, Cint, Cint, Cint, Cint, Cint), reg_global_lim, + reg_list_lim, arr_global_lim, arr_list_lim, blk_global_lim, + blk_list_lim) var"#status#" < 0 && @h5error("Error setting limits on free lists") return nothing end @@ -115,8 +121,12 @@ end See `libhdf5` documentation for [`H5Acreate2`](https://portal.hdfgroup.org/display/HDF5/H5A_CREATE2). """ function h5a_create(loc_id, attr_name, type_id, space_id, acpl_id, aapl_id) - var"#status#" = ccall((:H5Acreate2, libhdf5), hid_t, (hid_t, Ptr{UInt8}, hid_t, hid_t, hid_t, hid_t), loc_id, attr_name, type_id, space_id, acpl_id, aapl_id) - var"#status#" < 0 && @h5error(string("Error creating attribute ", attr_name, " for object ", h5i_get_name(loc_id))) + var"#status#" = ccall((:H5Acreate2, libhdf5), hid_t, + (hid_t, Ptr{UInt8}, hid_t, hid_t, hid_t, hid_t), loc_id, + attr_name, type_id, space_id, acpl_id, aapl_id) + var"#status#" < 0 && + @h5error(string("Error creating attribute ", attr_name, " for object ", + h5i_get_name(loc_id))) return var"#status#" end @@ -125,9 +135,14 @@ end See `libhdf5` documentation for [`H5Acreate_by_name`](https://portal.hdfgroup.org/display/HDF5/H5A_CREATE_BY_NAME). """ -function h5a_create_by_name(loc_id, obj_name, attr_name, type_id, space_id, acpl_id, aapl_id, lapl_id) - var"#status#" = ccall((:H5Acreate_by_name, libhdf5), hid_t, (hid_t, Ptr{UInt8}, Ptr{UInt8}, hid_t, hid_t, hid_t, hid_t, hid_t), loc_id, obj_name, attr_name, type_id, space_id, acpl_id, aapl_id, lapl_id) - var"#status#" < 0 && @h5error(string("Error creating attribute ", attr_name, " for object ", obj_name)) +function h5a_create_by_name(loc_id, obj_name, attr_name, type_id, space_id, acpl_id, + aapl_id, lapl_id) + var"#status#" = ccall((:H5Acreate_by_name, libhdf5), hid_t, + (hid_t, Ptr{UInt8}, Ptr{UInt8}, hid_t, hid_t, hid_t, hid_t, + hid_t), loc_id, obj_name, attr_name, type_id, space_id, acpl_id, + aapl_id, lapl_id) + var"#status#" < 0 && + @h5error(string("Error creating attribute ", attr_name, " for object ", obj_name)) return var"#status#" end @@ -137,7 +152,8 @@ end See `libhdf5` documentation for [`H5Adelete`](https://portal.hdfgroup.org/display/HDF5/H5A_DELETE). """ function h5a_delete(loc_id, attr_name) - var"#status#" = ccall((:H5Adelete, libhdf5), herr_t, (hid_t, Ptr{UInt8}), loc_id, attr_name) + var"#status#" = ccall((:H5Adelete, libhdf5), herr_t, (hid_t, Ptr{UInt8}), loc_id, + attr_name) var"#status#" < 0 && @h5error(string("Error deleting attribute ", attr_name)) return nothing end @@ -148,8 +164,11 @@ end See `libhdf5` documentation for [`H5Adelete_by_idx`](https://portal.hdfgroup.org/display/HDF5/H5A_DELETE_BY_IDX). """ function h5a_delete_by_idx(loc_id, obj_name, idx_type, order, n, lapl_id) - var"#status#" = ccall((:H5Adelete_by_idx, libhdf5), herr_t, (hid_t, Ptr{UInt8}, Cint, Cint, hsize_t, hid_t), loc_id, obj_name, idx_type, order, n, lapl_id) - var"#status#" < 0 && @h5error(string("Error deleting attribute ", n, " from object ", obj_name)) + var"#status#" = ccall((:H5Adelete_by_idx, libhdf5), herr_t, + (hid_t, Ptr{UInt8}, Cint, Cint, hsize_t, hid_t), loc_id, obj_name, + idx_type, order, n, lapl_id) + var"#status#" < 0 && + @h5error(string("Error deleting attribute ", n, " from object ", obj_name)) return nothing end @@ -159,8 +178,11 @@ end See `libhdf5` documentation for [`H5Adelete_by_name`](https://portal.hdfgroup.org/display/HDF5/H5A_DELETE_BY_NAME). """ function h5a_delete_by_name(loc_id, obj_name, attr_name, lapl_id) - var"#status#" = ccall((:H5Adelete_by_name, libhdf5), herr_t, (hid_t, Ptr{UInt8}, Ptr{UInt8}, hid_t), loc_id, obj_name, attr_name, lapl_id) - var"#status#" < 0 && @h5error(string("Error removing attribute ", attr_name, " from object ", obj_name)) + var"#status#" = ccall((:H5Adelete_by_name, libhdf5), herr_t, + (hid_t, Ptr{UInt8}, Ptr{UInt8}, hid_t), loc_id, obj_name, + attr_name, lapl_id) + var"#status#" < 0 && + @h5error(string("Error removing attribute ", attr_name, " from object ", obj_name)) return nothing end @@ -170,8 +192,10 @@ end See `libhdf5` documentation for [`H5Aexists`](https://portal.hdfgroup.org/display/HDF5/H5A_EXISTS). """ function h5a_exists(obj_id, attr_name) - var"#status#" = ccall((:H5Aexists, libhdf5), htri_t, (hid_t, Ptr{UInt8}), obj_id, attr_name) - var"#status#" < 0 && @h5error(string("Error checking whether attribute ", attr_name, " exists")) + var"#status#" = ccall((:H5Aexists, libhdf5), htri_t, (hid_t, Ptr{UInt8}), obj_id, + attr_name) + var"#status#" < 0 && + @h5error(string("Error checking whether attribute ", attr_name, " exists")) return var"#status#" > 0 end @@ -181,8 +205,12 @@ end See `libhdf5` documentation for [`H5Aexists_by_name`](https://portal.hdfgroup.org/display/HDF5/H5A_EXISTS_BY_NAME). """ function h5a_exists_by_name(loc_id, obj_name, attr_name, lapl_id) - var"#status#" = ccall((:H5Aexists_by_name, libhdf5), htri_t, (hid_t, Ptr{UInt8}, Ptr{UInt8}, hid_t), loc_id, obj_name, attr_name, lapl_id) - var"#status#" < 0 && @h5error(string("Error checking whether object ", obj_name, " has attribute ", attr_name)) + var"#status#" = ccall((:H5Aexists_by_name, libhdf5), htri_t, + (hid_t, Ptr{UInt8}, Ptr{UInt8}, hid_t), loc_id, obj_name, + attr_name, lapl_id) + var"#status#" < 0 && + @h5error(string("Error checking whether object ", obj_name, " has attribute ", + attr_name)) return var"#status#" > 0 end @@ -203,7 +231,8 @@ end See `libhdf5` documentation for [`H5Aget_name`](https://portal.hdfgroup.org/display/HDF5/H5A_GET_NAME). """ function h5a_get_name(attr_id, buf_size, buf) - var"#status#" = ccall((:H5Aget_name, libhdf5), Cssize_t, (hid_t, Csize_t, Ptr{UInt8}), attr_id, buf_size, buf) + var"#status#" = ccall((:H5Aget_name, libhdf5), Cssize_t, (hid_t, Csize_t, Ptr{UInt8}), + attr_id, buf_size, buf) var"#status#" < 0 && @h5error("Error getting attribute name") return var"#status#" end @@ -214,7 +243,9 @@ end See `libhdf5` documentation for [`H5Aget_name_by_idx`](https://portal.hdfgroup.org/display/HDF5/H5A_GET_NAME_BY_IDX). """ function h5a_get_name_by_idx(loc_id, obj_name, index_type, order, idx, name, size, lapl_id) - var"#status#" = ccall((:H5Aget_name_by_idx, libhdf5), Cssize_t, (hid_t, Cstring, Cint, Cint, hsize_t, Ptr{UInt8}, Csize_t, hid_t), loc_id, obj_name, index_type, order, idx, name, size, lapl_id) + var"#status#" = ccall((:H5Aget_name_by_idx, libhdf5), Cssize_t, + (hid_t, Cstring, Cint, Cint, hsize_t, Ptr{UInt8}, Csize_t, hid_t), + loc_id, obj_name, index_type, order, idx, name, size, lapl_id) var"#status#" < 0 && @h5error("Error getting attribute name") return var"#status#" end @@ -247,8 +278,11 @@ end See `libhdf5` documentation for [`H5Aiterate2`](https://portal.hdfgroup.org/display/HDF5/H5A_ITERATE2). """ function h5a_iterate(obj_id, idx_type, order, n, op, op_data) - var"#status#" = ccall((:H5Aiterate2, libhdf5), herr_t, (hid_t, Cint, Cint, Ptr{hsize_t}, Ptr{Cvoid}, Any), obj_id, idx_type, order, n, op, op_data) - var"#status#" < 0 && @h5error(string("Error iterating attributes in object ", h5i_get_name(obj_id))) + var"#status#" = ccall((:H5Aiterate2, libhdf5), herr_t, + (hid_t, Cint, Cint, Ptr{hsize_t}, Ptr{Cvoid}, Any), obj_id, + idx_type, order, n, op, op_data) + var"#status#" < 0 && + @h5error(string("Error iterating attributes in object ", h5i_get_name(obj_id))) return nothing end @@ -258,8 +292,11 @@ end See `libhdf5` documentation for [`H5Aopen`](https://portal.hdfgroup.org/display/HDF5/H5A_OPEN). """ function h5a_open(obj_id, attr_name, aapl_id) - var"#status#" = ccall((:H5Aopen, libhdf5), hid_t, (hid_t, Ptr{UInt8}, hid_t), obj_id, attr_name, aapl_id) - var"#status#" < 0 && @h5error(string("Error opening attribute ", attr_name, " for object ", h5i_get_name(obj_id))) + var"#status#" = ccall((:H5Aopen, libhdf5), hid_t, (hid_t, Ptr{UInt8}, hid_t), obj_id, + attr_name, aapl_id) + var"#status#" < 0 && + @h5error(string("Error opening attribute ", attr_name, " for object ", + h5i_get_name(obj_id))) return var"#status#" end @@ -269,8 +306,12 @@ end See `libhdf5` documentation for [`H5Aopen_by_idx`](https://portal.hdfgroup.org/display/HDF5/H5A_OPEN_BY_IDX). """ function h5a_open_by_idx(obj_id, pathname, idx_type, order, n, aapl_id, lapl_id) - var"#status#" = ccall((:H5Aopen_by_idx, libhdf5), hid_t, (hid_t, Ptr{UInt8}, Cint, Cint, hsize_t, hid_t, hid_t), obj_id, pathname, idx_type, order, n, aapl_id, lapl_id) - var"#status#" < 0 && @h5error(string("Error opening attribute ", n, " of ", h5i_get_name(obj_id), "/", pathname)) + var"#status#" = ccall((:H5Aopen_by_idx, libhdf5), hid_t, + (hid_t, Ptr{UInt8}, Cint, Cint, hsize_t, hid_t, hid_t), obj_id, + pathname, idx_type, order, n, aapl_id, lapl_id) + var"#status#" < 0 && + @h5error(string("Error opening attribute ", n, " of ", h5i_get_name(obj_id), "/", + pathname)) return var"#status#" end @@ -280,7 +321,8 @@ end See `libhdf5` documentation for [`H5Aread`](https://portal.hdfgroup.org/display/HDF5/H5A_READ). """ function h5a_read(attr_id, mem_type_id, buf) - var"#status#" = ccall((:H5Aread, libhdf5), herr_t, (hid_t, hid_t, Ptr{Cvoid}), attr_id, mem_type_id, buf) + var"#status#" = ccall((:H5Aread, libhdf5), herr_t, (hid_t, hid_t, Ptr{Cvoid}), attr_id, + mem_type_id, buf) var"#status#" < 0 && @h5error(string("Error reading attribute ", h5a_get_name(attr_id))) return nothing end @@ -291,7 +333,8 @@ end See `libhdf5` documentation for [`H5Arename`](https://portal.hdfgroup.org/display/HDF5/H5A_RENAME). """ function h5a_rename(loc_id, old_attr_name, new_attr_name) - var"#status#" = ccall((:H5Arename, libhdf5), herr_t, (hid_t, Cstring, Cstring), loc_id, old_attr_name, new_attr_name) + var"#status#" = ccall((:H5Arename, libhdf5), herr_t, (hid_t, Cstring, Cstring), loc_id, + old_attr_name, new_attr_name) var"#status#" < 0 && @h5error(string("Could not rename attribute")) return nothing end @@ -302,7 +345,8 @@ end See `libhdf5` documentation for [`H5Awrite`](https://portal.hdfgroup.org/display/HDF5/H5A_WRITE). """ function h5a_write(attr_hid, mem_type_id, buf) - var"#status#" = ccall((:H5Awrite, libhdf5), herr_t, (hid_t, hid_t, Ptr{Cvoid}), attr_hid, mem_type_id, buf) + var"#status#" = ccall((:H5Awrite, libhdf5), herr_t, (hid_t, hid_t, Ptr{Cvoid}), + attr_hid, mem_type_id, buf) var"#status#" < 0 && @h5error("Error writing attribute data") return nothing end @@ -324,8 +368,11 @@ end See `libhdf5` documentation for [`H5Dcreate2`](https://portal.hdfgroup.org/display/HDF5/H5D_CREATE2). """ function h5d_create(loc_id, pathname, dtype_id, space_id, lcpl_id, dcpl_id, dapl_id) - var"#status#" = ccall((:H5Dcreate2, libhdf5), hid_t, (hid_t, Ptr{UInt8}, hid_t, hid_t, hid_t, hid_t, hid_t), loc_id, pathname, dtype_id, space_id, lcpl_id, dcpl_id, dapl_id) - var"#status#" < 0 && @h5error(string("Error creating dataset ", h5i_get_name(loc_id), "/", pathname)) + var"#status#" = ccall((:H5Dcreate2, libhdf5), hid_t, + (hid_t, Ptr{UInt8}, hid_t, hid_t, hid_t, hid_t, hid_t), loc_id, + pathname, dtype_id, space_id, lcpl_id, dcpl_id, dapl_id) + var"#status#" < 0 && + @h5error(string("Error creating dataset ", h5i_get_name(loc_id), "/", pathname)) return var"#status#" end @@ -335,7 +382,9 @@ end See `libhdf5` documentation for [`H5Dcreate_anon`](https://portal.hdfgroup.org/display/HDF5/H5D_CREATE_ANON). """ function h5d_create_anon(loc_id, type_id, space_id, dcpl_id, dapl_id) - var"#status#" = ccall((:H5Dcreate_anon, libhdf5), hid_t, (hid_t, hid_t, hid_t, hid_t, hid_t), loc_id, type_id, space_id, dcpl_id, dapl_id) + var"#status#" = ccall((:H5Dcreate_anon, libhdf5), hid_t, + (hid_t, hid_t, hid_t, hid_t, hid_t), loc_id, type_id, space_id, + dcpl_id, dapl_id) var"#status#" < 0 && @h5error("Error in creating anonymous dataset") return var"#status#" end @@ -346,7 +395,8 @@ end See `libhdf5` documentation for [`H5Dextend`](https://portal.hdfgroup.org/display/HDF5/H5D_EXTEND). """ function h5d_extend(dataset_id, size) - var"#status#" = ccall((:H5Dextend, libhdf5), herr_t, (hid_t, Ptr{hsize_t}), dataset_id, size) + var"#status#" = ccall((:H5Dextend, libhdf5), herr_t, (hid_t, Ptr{hsize_t}), dataset_id, + size) var"#status#" < 0 && @h5error("Error extending dataset") return nothing end @@ -357,7 +407,9 @@ end See `libhdf5` documentation for [`H5Dfill`](https://portal.hdfgroup.org/display/HDF5/H5D_FILL). """ function h5d_fill(fill, fill_type_id, buf, buf_type_id, space_id) - var"#status#" = ccall((:H5Dfill, libhdf5), herr_t, (Ptr{Cvoid}, hid_t, Ptr{Cvoid}, hid_t, hid_t), fill, fill_type_id, buf, buf_type_id, space_id) + var"#status#" = ccall((:H5Dfill, libhdf5), herr_t, + (Ptr{Cvoid}, hid_t, Ptr{Cvoid}, hid_t, hid_t), fill, fill_type_id, + buf, buf_type_id, space_id) var"#status#" < 0 && @h5error("Error filling dataset") return nothing end @@ -379,7 +431,10 @@ end See `libhdf5` documentation for [`H5Dgather`](https://portal.hdfgroup.org/display/HDF5/H5D_GATHER). """ function h5d_gather(src_space_id, src_buf, type_id, dst_buf_size, dst_buf, op, op_data) - var"#status#" = ccall((:H5Dgather, libhdf5), herr_t, (hid_t, Ptr{Cvoid}, hid_t, Csize_t, Ptr{Cvoid}, Ptr{Cvoid}, Any), src_space_id, src_buf, type_id, dst_buf_size, dst_buf, op, op_data) + var"#status#" = ccall((:H5Dgather, libhdf5), herr_t, + (hid_t, Ptr{Cvoid}, hid_t, Csize_t, Ptr{Cvoid}, Ptr{Cvoid}, Any), + src_space_id, src_buf, type_id, dst_buf_size, dst_buf, op, + op_data) var"#status#" < 0 && @h5error("Error gathering dataset") return nothing end @@ -401,7 +456,10 @@ end See `libhdf5` documentation for [`H5Dget_chunk_info`](https://portal.hdfgroup.org/display/HDF5/H5D_GET_CHUNK_INFO). """ function h5d_get_chunk_info(dataset_id, fspace_id, index, offset, filter_mask, addr, size) - var"#status#" = ccall((:H5Dget_chunk_info, libhdf5), herr_t, (hid_t, hid_t, hsize_t, Ptr{hsize_t}, Ptr{Cuint}, Ptr{haddr_t}, Ptr{hsize_t}), dataset_id, fspace_id, index, offset, filter_mask, addr, size) + var"#status#" = ccall((:H5Dget_chunk_info, libhdf5), herr_t, + (hid_t, hid_t, hsize_t, Ptr{hsize_t}, Ptr{Cuint}, Ptr{haddr_t}, + Ptr{hsize_t}), dataset_id, fspace_id, index, offset, filter_mask, + addr, size) var"#status#" < 0 && @h5error("Error getting chunk info") return nothing end @@ -413,7 +471,9 @@ end See `libhdf5` documentation for [`H5Dget_chunk_info_by_coord`](https://portal.hdfgroup.org/display/HDF5/H5D_GET_CHUNK_INFO_BY_COORD). """ function h5d_get_chunk_info_by_coord(dataset_id, offset, filter_mask, addr, size) - var"#status#" = ccall((:H5Dget_chunk_info_by_coord, libhdf5), herr_t, (hid_t, Ptr{hsize_t}, Ptr{Cuint}, Ptr{haddr_t}, Ptr{hsize_t}), dataset_id, offset, filter_mask, addr, size) + var"#status#" = ccall((:H5Dget_chunk_info_by_coord, libhdf5), herr_t, + (hid_t, Ptr{hsize_t}, Ptr{Cuint}, Ptr{haddr_t}, Ptr{hsize_t}), + dataset_id, offset, filter_mask, addr, size) var"#status#" < 0 && @h5error("Error getting chunk info by coord") return nothing end @@ -425,7 +485,9 @@ end See `libhdf5` documentation for [`H5Dget_chunk_storage_size`](https://portal.hdfgroup.org/display/HDF5/H5D_GET_CHUNK_STORAGE_SIZE). """ function h5d_get_chunk_storage_size(dataset_id, offset, chunk_nbytes) - var"#status#" = ccall((:H5Dget_chunk_storage_size, libhdf5), herr_t, (hid_t, Ptr{hsize_t}, Ptr{hsize_t}), dataset_id, offset, chunk_nbytes) + var"#status#" = ccall((:H5Dget_chunk_storage_size, libhdf5), herr_t, + (hid_t, Ptr{hsize_t}, Ptr{hsize_t}), dataset_id, offset, + chunk_nbytes) var"#status#" < 0 && @h5error("Error getting chunk storage size") return nothing end @@ -448,7 +510,8 @@ end See `libhdf5` documentation for [`H5Dget_num_chunks`](https://portal.hdfgroup.org/display/HDF5/H5D_GET_NUM_CHUNKS). """ function h5d_get_num_chunks(dataset_id, fspace_id, nchunks) - var"#status#" = ccall((:H5Dget_num_chunks, libhdf5), herr_t, (hid_t, hid_t, Ptr{hsize_t}), dataset_id, fspace_id, nchunks) + var"#status#" = ccall((:H5Dget_num_chunks, libhdf5), herr_t, + (hid_t, hid_t, Ptr{hsize_t}), dataset_id, fspace_id, nchunks) var"#status#" < 0 && @h5error("Error getting number of chunks") return nothing end @@ -482,7 +545,8 @@ end See `libhdf5` documentation for [`H5Dget_space_status`](https://portal.hdfgroup.org/display/HDF5/H5D_GET_SPACE_STATUS). """ function h5d_get_space_status(dataset_id, status) - var"#status#" = ccall((:H5Dget_space_status, libhdf5), herr_t, (hid_t, Ref{Cint}), dataset_id, status) + var"#status#" = ccall((:H5Dget_space_status, libhdf5), herr_t, (hid_t, Ref{Cint}), + dataset_id, status) var"#status#" < 0 && @h5error("Error getting dataspace status") return nothing end @@ -515,7 +579,9 @@ end See `libhdf5` documentation for [`H5Diterate`](https://portal.hdfgroup.org/display/HDF5/H5D_ITERATE). """ function h5d_iterate(buf, type_id, space_id, operator, operator_data) - var"#status#" = ccall((:H5Diterate, libhdf5), herr_t, (Ptr{Cvoid}, hid_t, hid_t, Ptr{Cvoid}, Any), buf, type_id, space_id, operator, operator_data) + var"#status#" = ccall((:H5Diterate, libhdf5), herr_t, + (Ptr{Cvoid}, hid_t, hid_t, Ptr{Cvoid}, Any), buf, type_id, + space_id, operator, operator_data) var"#status#" < 0 && @h5error("Error iterating dataset") return nothing end @@ -526,8 +592,10 @@ end See `libhdf5` documentation for [`H5Dopen2`](https://portal.hdfgroup.org/display/HDF5/H5D_OPEN2). """ function h5d_open(loc_id, pathname, dapl_id) - var"#status#" = ccall((:H5Dopen2, libhdf5), hid_t, (hid_t, Ptr{UInt8}, hid_t), loc_id, pathname, dapl_id) - var"#status#" < 0 && @h5error(string("Error opening dataset ", h5i_get_name(loc_id), "/", pathname)) + var"#status#" = ccall((:H5Dopen2, libhdf5), hid_t, (hid_t, Ptr{UInt8}, hid_t), loc_id, + pathname, dapl_id) + var"#status#" < 0 && + @h5error(string("Error opening dataset ", h5i_get_name(loc_id), "/", pathname)) return var"#status#" end @@ -537,8 +605,11 @@ end See `libhdf5` documentation for [`H5Dread`](https://portal.hdfgroup.org/display/HDF5/H5D_READ). """ function h5d_read(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf) - var"#status#" = ccall((:H5Dread, libhdf5), herr_t, (hid_t, hid_t, hid_t, hid_t, hid_t, Ptr{Cvoid}), dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf) - var"#status#" < 0 && @h5error(string("Error reading dataset ", h5i_get_name(dataset_id))) + var"#status#" = ccall((:H5Dread, libhdf5), herr_t, + (hid_t, hid_t, hid_t, hid_t, hid_t, Ptr{Cvoid}), dataset_id, + mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf) + var"#status#" < 0 && + @h5error(string("Error reading dataset ", h5i_get_name(dataset_id))) return nothing end @@ -548,7 +619,9 @@ end See `libhdf5` documentation for [`H5Dread_chunk`](https://portal.hdfgroup.org/display/HDF5/H5D_READ_CHUNK). """ function h5d_read_chunk(dset, dxpl_id, offset, filters, buf) - var"#status#" = ccall((:H5Dread_chunk, libhdf5), herr_t, (hid_t, hid_t, Ptr{hsize_t}, Ptr{UInt32}, Ptr{Cvoid}), dset, dxpl_id, offset, filters, buf) + var"#status#" = ccall((:H5Dread_chunk, libhdf5), herr_t, + (hid_t, hid_t, Ptr{hsize_t}, Ptr{UInt32}, Ptr{Cvoid}), dset, + dxpl_id, offset, filters, buf) var"#status#" < 0 && @h5error("Error reading chunk") return nothing end @@ -570,7 +643,9 @@ end See `libhdf5` documentation for [`H5Dscatter`](https://portal.hdfgroup.org/display/HDF5/H5D_SCATTER). """ function h5d_scatter(op, op_data, type_id, dst_space_id, dst_buf) - var"#status#" = ccall((:H5Dscatter, libhdf5), herr_t, (Ptr{Cvoid}, Any, hid_t, hid_t, Ptr{Cvoid}), op, op_data, type_id, dst_space_id, dst_buf) + var"#status#" = ccall((:H5Dscatter, libhdf5), herr_t, + (Ptr{Cvoid}, Any, hid_t, hid_t, Ptr{Cvoid}), op, op_data, type_id, + dst_space_id, dst_buf) var"#status#" < 0 && @h5error("Error scattering to dataset") return nothing end @@ -581,7 +656,8 @@ end See `libhdf5` documentation for [`H5Dset_extent`](https://portal.hdfgroup.org/display/HDF5/H5D_SET_EXTENT). """ function h5d_set_extent(dataset_id, new_dims) - var"#status#" = ccall((:H5Dset_extent, libhdf5), herr_t, (hid_t, Ptr{hsize_t}), dataset_id, new_dims) + var"#status#" = ccall((:H5Dset_extent, libhdf5), herr_t, (hid_t, Ptr{hsize_t}), + dataset_id, new_dims) var"#status#" < 0 && @h5error("Error extending dataset dimensions") return nothing end @@ -592,7 +668,9 @@ end See `libhdf5` documentation for [`H5Dvlen_get_buf_size`](https://portal.hdfgroup.org/display/HDF5/H5D_VLEN_GET_BUF_SIZE). """ function h5d_vlen_get_buf_size(dset_id, type_id, space_id, buf) - var"#status#" = ccall((:H5Dvlen_get_buf_size, libhdf5), herr_t, (hid_t, hid_t, hid_t, Ptr{hsize_t}), dset_id, type_id, space_id, buf) + var"#status#" = ccall((:H5Dvlen_get_buf_size, libhdf5), herr_t, + (hid_t, hid_t, hid_t, Ptr{hsize_t}), dset_id, type_id, space_id, + buf) var"#status#" < 0 && @h5error("Error getting vlen buffer size") return nothing end @@ -603,7 +681,9 @@ end See `libhdf5` documentation for [`H5Dvlen_reclaim`](https://portal.hdfgroup.org/display/HDF5/H5D_VLEN_RECLAIM). """ function h5d_vlen_reclaim(type_id, space_id, plist_id, buf) - var"#status#" = ccall((:H5Dvlen_reclaim, libhdf5), herr_t, (hid_t, hid_t, hid_t, Ptr{Cvoid}), type_id, space_id, plist_id, buf) + var"#status#" = ccall((:H5Dvlen_reclaim, libhdf5), herr_t, + (hid_t, hid_t, hid_t, Ptr{Cvoid}), type_id, space_id, plist_id, + buf) var"#status#" < 0 && @h5error("Error reclaiming vlen buffer") return nothing end @@ -614,7 +694,9 @@ end See `libhdf5` documentation for [`H5Dwrite`](https://portal.hdfgroup.org/display/HDF5/H5D_WRITE). """ function h5d_write(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf) - var"#status#" = ccall((:H5Dwrite, libhdf5), herr_t, (hid_t, hid_t, hid_t, hid_t, hid_t, Ptr{Cvoid}), dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf) + var"#status#" = ccall((:H5Dwrite, libhdf5), herr_t, + (hid_t, hid_t, hid_t, hid_t, hid_t, Ptr{Cvoid}), dataset_id, + mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf) var"#status#" < 0 && @h5error("Error writing dataset") return nothing end @@ -625,7 +707,9 @@ end See `libhdf5` documentation for [`H5Dwrite_chunk`](https://portal.hdfgroup.org/display/HDF5/H5D_WRITE_CHUNK). """ function h5d_write_chunk(dset_id, dxpl_id, filter_mask, offset, bufsize, buf) - var"#status#" = ccall((:H5Dwrite_chunk, libhdf5), herr_t, (hid_t, hid_t, UInt32, Ptr{hsize_t}, Csize_t, Ptr{Cvoid}), dset_id, dxpl_id, filter_mask, offset, bufsize, buf) + var"#status#" = ccall((:H5Dwrite_chunk, libhdf5), herr_t, + (hid_t, hid_t, UInt32, Ptr{hsize_t}, Csize_t, Ptr{Cvoid}), + dset_id, dxpl_id, filter_mask, offset, bufsize, buf) var"#status#" < 0 && @h5error("Error writing chunk") return nothing end @@ -636,7 +720,9 @@ end See `libhdf5` documentation for [`H5Eget_auto2`](https://portal.hdfgroup.org/display/HDF5/H5E_GET_AUTO2). """ function h5e_get_auto(estack_id, func, client_data) - var"#status#" = ccall((:H5Eget_auto2, libhdf5), herr_t, (hid_t, Ref{Ptr{Cvoid}}, Ref{Ptr{Cvoid}}), estack_id, func, client_data) + var"#status#" = ccall((:H5Eget_auto2, libhdf5), herr_t, + (hid_t, Ref{Ptr{Cvoid}}, Ref{Ptr{Cvoid}}), estack_id, func, + client_data) var"#status#" < 0 && @h5error("Error getting error reporting behavior") return nothing end @@ -647,7 +733,8 @@ end See `libhdf5` documentation for [`H5Eset_auto2`](https://portal.hdfgroup.org/display/HDF5/H5E_SET_AUTO2). """ function h5e_set_auto(estack_id, func, client_data) - var"#status#" = ccall((:H5Eset_auto2, libhdf5), herr_t, (hid_t, Ptr{Cvoid}, Ptr{Cvoid}), estack_id, func, client_data) + var"#status#" = ccall((:H5Eset_auto2, libhdf5), herr_t, (hid_t, Ptr{Cvoid}, Ptr{Cvoid}), + estack_id, func, client_data) var"#status#" < 0 && @h5error("Error setting error reporting behavior") return nothing end @@ -669,7 +756,9 @@ end See `libhdf5` documentation for [`H5Eget_msg`](https://portal.hdfgroup.org/display/HDF5/H5E_GET_MSG). """ function h5e_get_msg(mesg_id, mesg_type, mesg, len) - var"#status#" = ccall((:H5Eget_msg, libhdf5), Cssize_t, (hid_t, Ref{Cint}, Ref{UInt8}, Csize_t), mesg_id, mesg_type, mesg, len) + var"#status#" = ccall((:H5Eget_msg, libhdf5), Cssize_t, + (hid_t, Ref{Cint}, Ref{UInt8}, Csize_t), mesg_id, mesg_type, mesg, + len) var"#status#" < 0 && @h5error("Error getting message") return var"#status#" end @@ -702,7 +791,8 @@ end See `libhdf5` documentation for [`H5Ewalk2`](https://portal.hdfgroup.org/display/HDF5/H5E_WALK2). """ function h5e_walk(stack_id, direction, op, op_data) - var"#status#" = ccall((:H5Ewalk2, libhdf5), herr_t, (hid_t, Cint, Ptr{Cvoid}, Any), stack_id, direction, op, op_data) + var"#status#" = ccall((:H5Ewalk2, libhdf5), herr_t, (hid_t, Cint, Ptr{Cvoid}, Any), + stack_id, direction, op, op_data) var"#status#" < 0 && @h5error("Error walking stack") return nothing end @@ -735,7 +825,8 @@ end See `libhdf5` documentation for [`H5Fcreate`](https://portal.hdfgroup.org/display/HDF5/H5F_CREATE). """ function h5f_create(pathname, flags, fcpl_id, fapl_id) - var"#status#" = ccall((:H5Fcreate, libhdf5), hid_t, (Ptr{UInt8}, Cuint, hid_t, hid_t), pathname, flags, fcpl_id, fapl_id) + var"#status#" = ccall((:H5Fcreate, libhdf5), hid_t, (Ptr{UInt8}, Cuint, hid_t, hid_t), + pathname, flags, fcpl_id, fapl_id) var"#status#" < 0 && @h5error("Error creating file $(pathname)") return var"#status#" end @@ -746,7 +837,8 @@ end See `libhdf5` documentation for [`H5Fdelete`](https://portal.hdfgroup.org/display/HDF5/H5F_DELETE). """ function h5f_delete(filename, fapl_id) - var"#status#" = ccall((:H5Fdelete, libhdf5), herr_t, (Ptr{Cchar}, hid_t), filename, fapl_id) + var"#status#" = ccall((:H5Fdelete, libhdf5), herr_t, (Ptr{Cchar}, hid_t), filename, + fapl_id) var"#status#" < 0 && @h5error("Error in h5f_delete (not annotated)") return nothing end @@ -801,7 +893,8 @@ end See `libhdf5` documentation for [`H5Fget_dset_no_attrs_hint`](https://portal.hdfgroup.org/display/HDF5/H5F_GET_DSET_NO_ATTRS_HINT). """ function h5f_get_dset_no_attrs_hint(file_id, minimize) - var"#status#" = ccall((:H5Fget_dset_no_attrs_hint, libhdf5), herr_t, (hid_t, Ptr{hbool_t}), file_id, minimize) + var"#status#" = ccall((:H5Fget_dset_no_attrs_hint, libhdf5), herr_t, + (hid_t, Ptr{hbool_t}), file_id, minimize) var"#status#" < 0 && @h5error("Error getting dataset no attributes hint") return nothing end @@ -812,7 +905,8 @@ end See `libhdf5` documentation for [`H5Fget_eoa`](https://portal.hdfgroup.org/display/HDF5/H5F_GET_EOA). """ function h5f_get_eoa(file_id, eoa) - var"#status#" = ccall((:H5Fget_eoa, libhdf5), herr_t, (hid_t, Ptr{haddr_t}), file_id, eoa) + var"#status#" = ccall((:H5Fget_eoa, libhdf5), herr_t, (hid_t, Ptr{haddr_t}), file_id, + eoa) var"#status#" < 0 && @h5error("Error in h5f_get_eoa (not annotated)") return nothing end @@ -823,7 +917,8 @@ end See `libhdf5` documentation for [`H5Fget_file_image`](https://portal.hdfgroup.org/display/HDF5/H5F_GET_FILE_IMAGE). """ function h5f_get_file_image(file_id, buf_ptr, buf_len) - var"#status#" = ccall((:H5Fget_file_image, libhdf5), Cssize_t, (hid_t, Ptr{Cvoid}, Csize_t), file_id, buf_ptr, buf_len) + var"#status#" = ccall((:H5Fget_file_image, libhdf5), Cssize_t, + (hid_t, Ptr{Cvoid}, Csize_t), file_id, buf_ptr, buf_len) var"#status#" < 0 && @h5error("Error in h5f_get_file_image (not annotated)") return var"#status#" end @@ -834,7 +929,8 @@ end See `libhdf5` documentation for [`H5Fget_fileno`](https://portal.hdfgroup.org/display/HDF5/H5F_GET_FILENO). """ function h5f_get_fileno(file_id, fileno) - var"#status#" = ccall((:H5Fget_fileno, libhdf5), herr_t, (hid_t, Ptr{Culong}), file_id, fileno) + var"#status#" = ccall((:H5Fget_fileno, libhdf5), herr_t, (hid_t, Ptr{Culong}), file_id, + fileno) var"#status#" < 0 && @h5error("Error in h5f_get_fileno (not annotated)") return nothing end @@ -845,7 +941,8 @@ end See `libhdf5` documentation for [`H5Fget_filesize`](https://portal.hdfgroup.org/display/HDF5/H5F_GET_FILESIZE). """ function h5f_get_filesize(file_id, size) - var"#status#" = ccall((:H5Fget_filesize, libhdf5), herr_t, (hid_t, Ptr{hsize_t}), file_id, size) + var"#status#" = ccall((:H5Fget_filesize, libhdf5), herr_t, (hid_t, Ptr{hsize_t}), + file_id, size) var"#status#" < 0 && @h5error("Error in h5f_get_filesize (not annotated)") return nothing end @@ -856,7 +953,9 @@ end See `libhdf5` documentation for [`H5Fget_free_sections`](https://portal.hdfgroup.org/display/HDF5/H5F_GET_FREE_SECTIONS). """ function h5f_get_free_sections(file_id, type, nsects, sect_info) - var"#status#" = ccall((:H5Fget_free_sections, libhdf5), Cssize_t, (hid_t, H5F_mem_t, Csize_t, Ptr{H5F_sect_info_t}), file_id, type, nsects, sect_info) + var"#status#" = ccall((:H5Fget_free_sections, libhdf5), Cssize_t, + (hid_t, H5F_mem_t, Csize_t, Ptr{H5F_sect_info_t}), file_id, type, + nsects, sect_info) var"#status#" < 0 && @h5error("Error in h5f_get_free_sections (not annotated)") return var"#status#" end @@ -878,7 +977,8 @@ end See `libhdf5` documentation for [`H5Fget_intent`](https://portal.hdfgroup.org/display/HDF5/H5F_GET_INTENT). """ function h5f_get_intent(file_id, intent) - var"#status#" = ccall((:H5Fget_intent, libhdf5), herr_t, (hid_t, Ptr{Cuint}), file_id, intent) + var"#status#" = ccall((:H5Fget_intent, libhdf5), herr_t, (hid_t, Ptr{Cuint}), file_id, + intent) var"#status#" < 0 && @h5error("Error getting file intent") return nothing end @@ -889,7 +989,8 @@ end See `libhdf5` documentation for [`H5Fget_info2`](https://portal.hdfgroup.org/display/HDF5/H5F_GET_INFO2). """ function h5f_get_info(obj_id, file_info) - var"#status#" = ccall((:H5Fget_info2, libhdf5), herr_t, (hid_t, Ptr{H5F_info2_t}), obj_id, file_info) + var"#status#" = ccall((:H5Fget_info2, libhdf5), herr_t, (hid_t, Ptr{H5F_info2_t}), + obj_id, file_info) var"#status#" < 0 && @h5error("Error in h5f_get_info2 (not annotated)") return nothing end @@ -900,7 +1001,8 @@ end See `libhdf5` documentation for [`H5Fget_mdc_config`](https://portal.hdfgroup.org/display/HDF5/H5F_GET_MDC_CONFIG). """ function h5f_get_mdc_config(file_id, config_ptr) - var"#status#" = ccall((:H5Fget_mdc_config, libhdf5), herr_t, (hid_t, Ptr{H5AC_cache_config_t}), file_id, config_ptr) + var"#status#" = ccall((:H5Fget_mdc_config, libhdf5), herr_t, + (hid_t, Ptr{H5AC_cache_config_t}), file_id, config_ptr) var"#status#" < 0 && @h5error("Error in h5f_get_mdc_config (not annotated)") return nothing end @@ -911,7 +1013,8 @@ end See `libhdf5` documentation for [`H5Fget_mdc_hit_rate`](https://portal.hdfgroup.org/display/HDF5/H5F_GET_MDC_HIT_RATE). """ function h5f_get_mdc_hit_rate(file_id, hit_rate_ptr) - var"#status#" = ccall((:H5Fget_mdc_hit_rate, libhdf5), herr_t, (hid_t, Ptr{Cdouble}), file_id, hit_rate_ptr) + var"#status#" = ccall((:H5Fget_mdc_hit_rate, libhdf5), herr_t, (hid_t, Ptr{Cdouble}), + file_id, hit_rate_ptr) var"#status#" < 0 && @h5error("Error in h5f_get_mdc_hit_rate (not annotated)") return nothing end @@ -922,7 +1025,9 @@ end See `libhdf5` documentation for [`H5Fget_mdc_image_info`](https://portal.hdfgroup.org/display/HDF5/H5F_GET_MDC_IMAGE_INFO). """ function h5f_get_mdc_image_info(file_id, image_addr, image_size) - var"#status#" = ccall((:H5Fget_mdc_image_info, libhdf5), herr_t, (hid_t, Ptr{haddr_t}, Ptr{hsize_t}), file_id, image_addr, image_size) + var"#status#" = ccall((:H5Fget_mdc_image_info, libhdf5), herr_t, + (hid_t, Ptr{haddr_t}, Ptr{hsize_t}), file_id, image_addr, + image_size) var"#status#" < 0 && @h5error("Error in h5f_get_mdc_image_info (not annotated)") return nothing end @@ -933,7 +1038,9 @@ end See `libhdf5` documentation for [`H5Fget_mdc_logging_status`](https://portal.hdfgroup.org/display/HDF5/H5F_GET_MDC_LOGGING_STATUS). """ function h5f_get_mdc_logging_status(file_id, is_enabled, is_currently_logging) - var"#status#" = ccall((:H5Fget_mdc_logging_status, libhdf5), herr_t, (hid_t, Ptr{hbool_t}, Ptr{hbool_t}), file_id, is_enabled, is_currently_logging) + var"#status#" = ccall((:H5Fget_mdc_logging_status, libhdf5), herr_t, + (hid_t, Ptr{hbool_t}, Ptr{hbool_t}), file_id, is_enabled, + is_currently_logging) var"#status#" < 0 && @h5error("Error in h5f_get_mdc_logging_status (not annotated)") return nothing end @@ -943,8 +1050,12 @@ end See `libhdf5` documentation for [`H5Fget_mdc_size`](https://portal.hdfgroup.org/display/HDF5/H5F_GET_MDC_SIZE). """ -function h5f_get_mdc_size(file_id, max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) - var"#status#" = ccall((:H5Fget_mdc_size, libhdf5), herr_t, (hid_t, Ptr{Csize_t}, Ptr{Csize_t}, Ptr{Csize_t}, Ptr{Cint}), file_id, max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) +function h5f_get_mdc_size(file_id, max_size_ptr, min_clean_size_ptr, cur_size_ptr, + cur_num_entries_ptr) + var"#status#" = ccall((:H5Fget_mdc_size, libhdf5), herr_t, + (hid_t, Ptr{Csize_t}, Ptr{Csize_t}, Ptr{Csize_t}, Ptr{Cint}), + file_id, max_size_ptr, min_clean_size_ptr, cur_size_ptr, + cur_num_entries_ptr) var"#status#" < 0 && @h5error("Error in h5f_get_mdc_size (not annotated)") return nothing end @@ -955,8 +1066,10 @@ end See `libhdf5` documentation for [`H5Fget_metadata_read_retry_info`](https://portal.hdfgroup.org/display/HDF5/H5F_GET_METADATA_READ_RETRY_INFO). """ function h5f_get_metadata_read_retry_info(file_id, info) - var"#status#" = ccall((:H5Fget_metadata_read_retry_info, libhdf5), herr_t, (hid_t, Ptr{H5F_retry_info_t}), file_id, info) - var"#status#" < 0 && @h5error("Error in h5f_get_metadata_read_retry_info (not annotated)") + var"#status#" = ccall((:H5Fget_metadata_read_retry_info, libhdf5), herr_t, + (hid_t, Ptr{H5F_retry_info_t}), file_id, info) + var"#status#" < 0 && + @h5error("Error in h5f_get_metadata_read_retry_info (not annotated)") return nothing end @@ -966,7 +1079,8 @@ end See `libhdf5` documentation for [`H5Fget_mpi_atomicity`](https://portal.hdfgroup.org/display/HDF5/H5F_GET_MPI_ATOMICITY). """ function h5f_get_mpi_atomicity(file_id, flag) - var"#status#" = ccall((:H5Fget_mpi_atomicity, libhdf5), herr_t, (hid_t, Ptr{hbool_t}), file_id, flag) + var"#status#" = ccall((:H5Fget_mpi_atomicity, libhdf5), herr_t, (hid_t, Ptr{hbool_t}), + file_id, flag) var"#status#" < 0 && @h5error("Error in h5f_get_mpi_atomicity (not annotated)") return nothing end @@ -977,7 +1091,8 @@ end See `libhdf5` documentation for [`H5Fget_name`](https://portal.hdfgroup.org/display/HDF5/H5F_GET_NAME). """ function h5f_get_name(obj_id, buf, buf_size) - var"#status#" = ccall((:H5Fget_name, libhdf5), Cssize_t, (hid_t, Ptr{UInt8}, Csize_t), obj_id, buf, buf_size) + var"#status#" = ccall((:H5Fget_name, libhdf5), Cssize_t, (hid_t, Ptr{UInt8}, Csize_t), + obj_id, buf, buf_size) var"#status#" < 0 && @h5error("Error getting file name") return var"#status#" end @@ -988,7 +1103,8 @@ end See `libhdf5` documentation for [`H5Fget_obj_count`](https://portal.hdfgroup.org/display/HDF5/H5F_GET_OBJ_COUNT). """ function h5f_get_obj_count(file_id, types) - var"#status#" = ccall((:H5Fget_obj_count, libhdf5), Cssize_t, (hid_t, Cuint), file_id, types) + var"#status#" = ccall((:H5Fget_obj_count, libhdf5), Cssize_t, (hid_t, Cuint), file_id, + types) var"#status#" < 0 && @h5error("Error getting object count") return var"#status#" end @@ -999,7 +1115,9 @@ end See `libhdf5` documentation for [`H5Fget_obj_ids`](https://portal.hdfgroup.org/display/HDF5/H5F_GET_OBJ_IDS). """ function h5f_get_obj_ids(file_id, types, max_objs, obj_id_list) - var"#status#" = ccall((:H5Fget_obj_ids, libhdf5), Cssize_t, (hid_t, Cuint, Csize_t, Ptr{hid_t}), file_id, types, max_objs, obj_id_list) + var"#status#" = ccall((:H5Fget_obj_ids, libhdf5), Cssize_t, + (hid_t, Cuint, Csize_t, Ptr{hid_t}), file_id, types, max_objs, + obj_id_list) var"#status#" < 0 && @h5error("Error getting objects") return var"#status#" end @@ -1010,7 +1128,10 @@ end See `libhdf5` documentation for [`H5Fget_page_buffering_stats`](https://portal.hdfgroup.org/display/HDF5/H5F_GET_PAGE_BUFFERING_STATS). """ function h5f_get_page_buffering_stats(file_id, accesses, hits, misses, evictions, bypasses) - var"#status#" = ccall((:H5Fget_page_buffering_stats, libhdf5), herr_t, (hid_t, Ptr{Cuint}, Ptr{Cuint}, Ptr{Cuint}, Ptr{Cuint}, Ptr{Cuint}), file_id, accesses, hits, misses, evictions, bypasses) + var"#status#" = ccall((:H5Fget_page_buffering_stats, libhdf5), herr_t, + (hid_t, Ptr{Cuint}, Ptr{Cuint}, Ptr{Cuint}, Ptr{Cuint}, + Ptr{Cuint}), file_id, accesses, hits, misses, evictions, + bypasses) var"#status#" < 0 && @h5error("Error in h5f_get_page_buffering_stats (not annotated)") return nothing end @@ -1021,7 +1142,8 @@ end See `libhdf5` documentation for [`H5Fget_vfd_handle`](https://portal.hdfgroup.org/display/HDF5/H5F_GET_VFD_HANDLE). """ function h5f_get_vfd_handle(file_id, fapl_id, file_handle) - var"#status#" = ccall((:H5Fget_vfd_handle, libhdf5), herr_t, (hid_t, hid_t, Ref{Ptr{Cvoid}}), file_id, fapl_id, file_handle) + var"#status#" = ccall((:H5Fget_vfd_handle, libhdf5), herr_t, + (hid_t, hid_t, Ref{Ptr{Cvoid}}), file_id, fapl_id, file_handle) var"#status#" < 0 && @h5error("Error getting VFD handle") return nothing end @@ -1032,7 +1154,8 @@ end See `libhdf5` documentation for [`H5Fincrement_filesize`](https://portal.hdfgroup.org/display/HDF5/H5F_INCREMENT_FILESIZE). """ function h5f_increment_filesize(file_id, increment) - var"#status#" = ccall((:H5Fincrement_filesize, libhdf5), herr_t, (hid_t, hsize_t), file_id, increment) + var"#status#" = ccall((:H5Fincrement_filesize, libhdf5), herr_t, (hid_t, hsize_t), + file_id, increment) var"#status#" < 0 && @h5error("Error in h5f_increment_filesize (not annotated)") return nothing end @@ -1043,7 +1166,8 @@ end See `libhdf5` documentation for [`H5Fis_accessible`](https://portal.hdfgroup.org/display/HDF5/H5F_IS_ACCESSIBLE). """ function h5f_is_accessible(container_name, fapl_id) - var"#status#" = ccall((:H5Fis_accessible, libhdf5), htri_t, (Ptr{Cchar}, hid_t), container_name, fapl_id) + var"#status#" = ccall((:H5Fis_accessible, libhdf5), htri_t, (Ptr{Cchar}, hid_t), + container_name, fapl_id) var"#status#" < 0 && @h5error("Error in h5f_is_accessible (not annotated)") return var"#status#" > 0 end @@ -1065,7 +1189,8 @@ end See `libhdf5` documentation for [`H5Fmount`](https://portal.hdfgroup.org/display/HDF5/H5F_MOUNT). """ function h5f_mount(loc, name, child, plist) - var"#status#" = ccall((:H5Fmount, libhdf5), herr_t, (hid_t, Ptr{Cchar}, hid_t, hid_t), loc, name, child, plist) + var"#status#" = ccall((:H5Fmount, libhdf5), herr_t, (hid_t, Ptr{Cchar}, hid_t, hid_t), + loc, name, child, plist) var"#status#" < 0 && @h5error("Error in h5f_mount (not annotated)") return nothing end @@ -1076,7 +1201,8 @@ end See `libhdf5` documentation for [`H5Fopen`](https://portal.hdfgroup.org/display/HDF5/H5F_OPEN). """ function h5f_open(pathname, flags, fapl_id) - var"#status#" = ccall((:H5Fopen, libhdf5), hid_t, (Cstring, Cuint, hid_t), pathname, flags, fapl_id) + var"#status#" = ccall((:H5Fopen, libhdf5), hid_t, (Cstring, Cuint, hid_t), pathname, + flags, fapl_id) var"#status#" < 0 && @h5error("Error opening file $(pathname)") return var"#status#" end @@ -1098,7 +1224,8 @@ end See `libhdf5` documentation for [`H5Freset_mdc_hit_rate_stats`](https://portal.hdfgroup.org/display/HDF5/H5F_RESET_MDC_HIT_RATE_STATS). """ function h5f_reset_mdc_hit_rate_stats(file_id) - var"#status#" = ccall((:H5Freset_mdc_hit_rate_stats, libhdf5), herr_t, (hid_t,), file_id) + var"#status#" = ccall((:H5Freset_mdc_hit_rate_stats, libhdf5), herr_t, (hid_t,), + file_id) var"#status#" < 0 && @h5error("Error in h5f_reset_mdc_hit_rate_stats (not annotated)") return nothing end @@ -1109,7 +1236,8 @@ end See `libhdf5` documentation for [`H5Freset_page_buffering_stats`](https://portal.hdfgroup.org/display/HDF5/H5F_RESET_PAGE_BUFFERING_STATS). """ function h5f_reset_page_buffering_stats(file_id) - var"#status#" = ccall((:H5Freset_page_buffering_stats, libhdf5), herr_t, (hid_t,), file_id) + var"#status#" = ccall((:H5Freset_page_buffering_stats, libhdf5), herr_t, (hid_t,), + file_id) var"#status#" < 0 && @h5error("Error in h5f_reset_page_buffering_stats (not annotated)") return nothing end @@ -1120,7 +1248,8 @@ end See `libhdf5` documentation for [`H5Fset_dset_no_attrs_hint`](https://portal.hdfgroup.org/display/HDF5/H5F_SET_DSET_NO_ATTRS_HINT). """ function h5f_set_dset_no_attrs_hint(file_id, minimize) - var"#status#" = ccall((:H5Fset_dset_no_attrs_hint, libhdf5), herr_t, (hid_t, hbool_t), file_id, minimize) + var"#status#" = ccall((:H5Fset_dset_no_attrs_hint, libhdf5), herr_t, (hid_t, hbool_t), + file_id, minimize) var"#status#" < 0 && @h5error("Error in setting dataset no attributes hint") return nothing end @@ -1131,7 +1260,8 @@ end See `libhdf5` documentation for [`H5Fset_libver_bounds`](https://portal.hdfgroup.org/display/HDF5/H5F_SET_LIBVER_BOUNDS). """ function h5f_set_libver_bounds(file_id, low, high) - var"#status#" = ccall((:H5Fset_libver_bounds, libhdf5), herr_t, (hid_t, H5F_libver_t, H5F_libver_t), file_id, low, high) + var"#status#" = ccall((:H5Fset_libver_bounds, libhdf5), herr_t, + (hid_t, H5F_libver_t, H5F_libver_t), file_id, low, high) var"#status#" < 0 && @h5error("Error in h5f_set_libver_bounds (not annotated)") return nothing end @@ -1142,7 +1272,8 @@ end See `libhdf5` documentation for [`H5Fset_mdc_config`](https://portal.hdfgroup.org/display/HDF5/H5F_SET_MDC_CONFIG). """ function h5f_set_mdc_config(file_id, config_ptr) - var"#status#" = ccall((:H5Fset_mdc_config, libhdf5), herr_t, (hid_t, Ptr{H5AC_cache_config_t}), file_id, config_ptr) + var"#status#" = ccall((:H5Fset_mdc_config, libhdf5), herr_t, + (hid_t, Ptr{H5AC_cache_config_t}), file_id, config_ptr) var"#status#" < 0 && @h5error("Error in h5f_set_mdc_config (not annotated)") return nothing end @@ -1153,7 +1284,8 @@ end See `libhdf5` documentation for [`H5Fset_mpi_atomicity`](https://portal.hdfgroup.org/display/HDF5/H5F_SET_MPI_ATOMICITY). """ function h5f_set_mpi_atomicity(file_id, flag) - var"#status#" = ccall((:H5Fset_mpi_atomicity, libhdf5), herr_t, (hid_t, hbool_t), file_id, flag) + var"#status#" = ccall((:H5Fset_mpi_atomicity, libhdf5), herr_t, (hid_t, hbool_t), + file_id, flag) var"#status#" < 0 && @h5error("Error in h5f_set_mpi_atomicity (not annotated)") return nothing end @@ -1219,8 +1351,11 @@ end See `libhdf5` documentation for [`H5Gcreate2`](https://portal.hdfgroup.org/display/HDF5/H5G_CREATE2). """ function h5g_create(loc_id, pathname, lcpl_id, gcpl_id, gapl_id) - var"#status#" = ccall((:H5Gcreate2, libhdf5), hid_t, (hid_t, Ptr{UInt8}, hid_t, hid_t, hid_t), loc_id, pathname, lcpl_id, gcpl_id, gapl_id) - var"#status#" < 0 && @h5error("Error creating group $(h5i_get_name(loc_id))/$(pathname)") + var"#status#" = ccall((:H5Gcreate2, libhdf5), hid_t, + (hid_t, Ptr{UInt8}, hid_t, hid_t, hid_t), loc_id, pathname, + lcpl_id, gcpl_id, gapl_id) + var"#status#" < 0 && + @h5error("Error creating group $(h5i_get_name(loc_id))/$(pathname)") return var"#status#" end @@ -1241,7 +1376,8 @@ end See `libhdf5` documentation for [`H5Gget_info`](https://portal.hdfgroup.org/display/HDF5/H5G_GET_INFO). """ function h5g_get_info(group_id, buf) - var"#status#" = ccall((:H5Gget_info, libhdf5), herr_t, (hid_t, Ptr{H5G_info_t}), group_id, buf) + var"#status#" = ccall((:H5Gget_info, libhdf5), herr_t, (hid_t, Ptr{H5G_info_t}), + group_id, buf) var"#status#" < 0 && @h5error("Error getting group info") return nothing end @@ -1252,7 +1388,8 @@ end See `libhdf5` documentation for [`H5Gget_num_objs`](https://portal.hdfgroup.org/display/HDF5/H5G_GET_NUM_OBJS). """ function h5g_get_num_objs(loc_id, num_obj) - var"#status#" = ccall((:H5Gget_num_objs, libhdf5), hid_t, (hid_t, Ptr{hsize_t}), loc_id, num_obj) + var"#status#" = ccall((:H5Gget_num_objs, libhdf5), hid_t, (hid_t, Ptr{hsize_t}), loc_id, + num_obj) var"#status#" < 0 && @h5error("Error getting group length") return var"#status#" end @@ -1263,8 +1400,11 @@ end See `libhdf5` documentation for [`H5Gget_objname_by_idx`](https://portal.hdfgroup.org/display/HDF5/H5G_GET_OBJNAME_BY_IDX). """ function h5g_get_objname_by_idx(loc_id, idx, pathname, size) - var"#status#" = ccall((:H5Gget_objname_by_idx, libhdf5), Cssize_t, (hid_t, hsize_t, Ptr{UInt8}, Csize_t), loc_id, idx, pathname, size) - var"#status#" < 0 && @h5error("Error getting group object name $(h5i_get_name(loc_id))/$(pathname)") + var"#status#" = ccall((:H5Gget_objname_by_idx, libhdf5), Cssize_t, + (hid_t, hsize_t, Ptr{UInt8}, Csize_t), loc_id, idx, pathname, + size) + var"#status#" < 0 && + @h5error("Error getting group object name $(h5i_get_name(loc_id))/$(pathname)") return var"#status#" end @@ -1274,7 +1414,8 @@ end See `libhdf5` documentation for [`H5Gopen2`](https://portal.hdfgroup.org/display/HDF5/H5G_OPEN2). """ function h5g_open(loc_id, pathname, gapl_id) - var"#status#" = ccall((:H5Gopen2, libhdf5), hid_t, (hid_t, Ptr{UInt8}, hid_t), loc_id, pathname, gapl_id) + var"#status#" = ccall((:H5Gopen2, libhdf5), hid_t, (hid_t, Ptr{UInt8}, hid_t), loc_id, + pathname, gapl_id) var"#status#" < 0 && @h5error("Error opening group $(h5i_get_name(loc_id))/$(pathname)") return var"#status#" end @@ -1307,7 +1448,8 @@ end See `libhdf5` documentation for [`H5Iget_name`](https://portal.hdfgroup.org/display/HDF5/H5I_GET_NAME). """ function h5i_get_name(obj_id, buf, buf_size) - var"#status#" = ccall((:H5Iget_name, libhdf5), Cssize_t, (hid_t, Ptr{UInt8}, Csize_t), obj_id, buf, buf_size) + var"#status#" = ccall((:H5Iget_name, libhdf5), Cssize_t, (hid_t, Ptr{UInt8}, Csize_t), + obj_id, buf, buf_size) var"#status#" < 0 && @h5error("Error getting object name") return var"#status#" end @@ -1361,9 +1503,15 @@ end See `libhdf5` documentation for [`H5Lcreate_external`](https://portal.hdfgroup.org/display/HDF5/H5L_CREATE_EXTERNAL). """ -function h5l_create_external(target_file_name, target_obj_name, link_loc_id, link_name, lcpl_id, lapl_id) - var"#status#" = ccall((:H5Lcreate_external, libhdf5), herr_t, (Ptr{UInt8}, Ptr{UInt8}, hid_t, Ptr{UInt8}, hid_t, hid_t), target_file_name, target_obj_name, link_loc_id, link_name, lcpl_id, lapl_id) - var"#status#" < 0 && @h5error(string("Error creating external link ", link_name, " pointing to ", target_obj_name, " in file ", target_file_name)) +function h5l_create_external(target_file_name, target_obj_name, link_loc_id, link_name, + lcpl_id, lapl_id) + var"#status#" = ccall((:H5Lcreate_external, libhdf5), herr_t, + (Ptr{UInt8}, Ptr{UInt8}, hid_t, Ptr{UInt8}, hid_t, hid_t), + target_file_name, target_obj_name, link_loc_id, link_name, + lcpl_id, lapl_id) + var"#status#" < 0 && + @h5error(string("Error creating external link ", link_name, " pointing to ", + target_obj_name, " in file ", target_file_name)) return nothing end @@ -1373,8 +1521,11 @@ end See `libhdf5` documentation for [`H5Lcreate_hard`](https://portal.hdfgroup.org/display/HDF5/H5L_CREATE_HARD). """ function h5l_create_hard(obj_loc_id, obj_name, link_loc_id, link_name, lcpl_id, lapl_id) - var"#status#" = ccall((:H5Lcreate_hard, libhdf5), herr_t, (hid_t, Ptr{UInt8}, hid_t, Ptr{UInt8}, hid_t, hid_t), obj_loc_id, obj_name, link_loc_id, link_name, lcpl_id, lapl_id) - var"#status#" < 0 && @h5error(string("Error creating hard link ", link_name, " pointing to ", obj_name)) + var"#status#" = ccall((:H5Lcreate_hard, libhdf5), herr_t, + (hid_t, Ptr{UInt8}, hid_t, Ptr{UInt8}, hid_t, hid_t), obj_loc_id, + obj_name, link_loc_id, link_name, lcpl_id, lapl_id) + var"#status#" < 0 && + @h5error(string("Error creating hard link ", link_name, " pointing to ", obj_name)) return nothing end @@ -1384,8 +1535,12 @@ end See `libhdf5` documentation for [`H5Lcreate_soft`](https://portal.hdfgroup.org/display/HDF5/H5L_CREATE_SOFT). """ function h5l_create_soft(target_path, link_loc_id, link_name, lcpl_id, lapl_id) - var"#status#" = ccall((:H5Lcreate_soft, libhdf5), herr_t, (Ptr{UInt8}, hid_t, Ptr{UInt8}, hid_t, hid_t), target_path, link_loc_id, link_name, lcpl_id, lapl_id) - var"#status#" < 0 && @h5error(string("Error creating soft link ", link_name, " pointing to ", target_path)) + var"#status#" = ccall((:H5Lcreate_soft, libhdf5), herr_t, + (Ptr{UInt8}, hid_t, Ptr{UInt8}, hid_t, hid_t), target_path, + link_loc_id, link_name, lcpl_id, lapl_id) + var"#status#" < 0 && + @h5error(string("Error creating soft link ", link_name, " pointing to ", + target_path)) return nothing end @@ -1395,8 +1550,10 @@ end See `libhdf5` documentation for [`H5Ldelete`](https://portal.hdfgroup.org/display/HDF5/H5L_DELETE). """ function h5l_delete(obj_id, pathname, lapl_id) - var"#status#" = ccall((:H5Ldelete, libhdf5), herr_t, (hid_t, Ptr{UInt8}, hid_t), obj_id, pathname, lapl_id) - var"#status#" < 0 && @h5error(string("Error deleting ", h5i_get_name(obj_id), "/", pathname)) + var"#status#" = ccall((:H5Ldelete, libhdf5), herr_t, (hid_t, Ptr{UInt8}, hid_t), obj_id, + pathname, lapl_id) + var"#status#" < 0 && + @h5error(string("Error deleting ", h5i_get_name(obj_id), "/", pathname)) return nothing end @@ -1406,8 +1563,12 @@ end See `libhdf5` documentation for [`H5Lmove`](https://portal.hdfgroup.org/display/HDF5/H5L_MOVE). """ function h5l_move(src_obj_id, src_name, dest_obj_id, dest_name, lcpl_id, lapl_id) - var"#status#" = ccall((:H5Lmove, libhdf5), herr_t, (hid_t, Ptr{UInt8}, hid_t, Ptr{UInt8}, hid_t, hid_t), src_obj_id, src_name, dest_obj_id, dest_name, lcpl_id, lapl_id) - var"#status#" < 0 && @h5error(string("Error moving ", h5i_get_name(src_obj_id), "/", src_name, " to ", h5i_get_name(dest_obj_id), "/", dest_name)) + var"#status#" = ccall((:H5Lmove, libhdf5), herr_t, + (hid_t, Ptr{UInt8}, hid_t, Ptr{UInt8}, hid_t, hid_t), src_obj_id, + src_name, dest_obj_id, dest_name, lcpl_id, lapl_id) + var"#status#" < 0 && + @h5error(string("Error moving ", h5i_get_name(src_obj_id), "/", src_name, " to ", + h5i_get_name(dest_obj_id), "/", dest_name)) return nothing end @@ -1417,7 +1578,8 @@ end See `libhdf5` documentation for [`H5Lexists`](https://portal.hdfgroup.org/display/HDF5/H5L_EXISTS). """ function h5l_exists(loc_id, pathname, lapl_id) - var"#status#" = ccall((:H5Lexists, libhdf5), htri_t, (hid_t, Ptr{UInt8}, hid_t), loc_id, pathname, lapl_id) + var"#status#" = ccall((:H5Lexists, libhdf5), htri_t, (hid_t, Ptr{UInt8}, hid_t), loc_id, + pathname, lapl_id) var"#status#" < 0 && @h5error(string("Cannot determine whether ", pathname, " exists")) return var"#status#" > 0 end @@ -1428,7 +1590,9 @@ end See `libhdf5` documentation for [`H5Lget_info`](https://portal.hdfgroup.org/display/HDF5/H5L_GET_INFO). """ function h5l_get_info(link_loc_id, link_name, link_buf, lapl_id) - var"#status#" = ccall((:H5Lget_info, libhdf5), herr_t, (hid_t, Ptr{UInt8}, Ptr{H5L_info_t}, hid_t), link_loc_id, link_name, link_buf, lapl_id) + var"#status#" = ccall((:H5Lget_info, libhdf5), herr_t, + (hid_t, Ptr{UInt8}, Ptr{H5L_info_t}, hid_t), link_loc_id, + link_name, link_buf, lapl_id) var"#status#" < 0 && @h5error(string("Error getting info for link ", link_name)) return nothing end @@ -1439,7 +1603,10 @@ end See `libhdf5` documentation for [`H5Lget_name_by_idx`](https://portal.hdfgroup.org/display/HDF5/H5L_GET_NAME_BY_IDX). """ function h5l_get_name_by_idx(loc_id, group_name, index_field, order, n, name, size, lapl_id) - var"#status#" = ccall((:H5Lget_name_by_idx, libhdf5), Cssize_t, (hid_t, Ptr{UInt8}, Cint, Cint, hsize_t, Ptr{UInt8}, Csize_t, hid_t), loc_id, group_name, index_field, order, n, name, size, lapl_id) + var"#status#" = ccall((:H5Lget_name_by_idx, libhdf5), Cssize_t, + (hid_t, Ptr{UInt8}, Cint, Cint, hsize_t, Ptr{UInt8}, Csize_t, + hid_t), loc_id, group_name, index_field, order, n, name, size, + lapl_id) var"#status#" < 0 && @h5error("Error getting object name") return var"#status#" end @@ -1451,8 +1618,11 @@ end See `libhdf5` documentation for [`H5Literate`](https://portal.hdfgroup.org/display/HDF5/H5L_ITERATE). """ function h5l_iterate(group_id, idx_type, order, idx, op, op_data) - var"#status#" = ccall((:H5Literate, libhdf5), herr_t, (hid_t, Cint, Cint, Ptr{hsize_t}, Ptr{Cvoid}, Any), group_id, idx_type, order, idx, op, op_data) - var"#status#" < 0 && @h5error(string("Error iterating through links in group ", h5i_get_name(group_id))) + var"#status#" = ccall((:H5Literate, libhdf5), herr_t, + (hid_t, Cint, Cint, Ptr{hsize_t}, Ptr{Cvoid}, Any), group_id, + idx_type, order, idx, op, op_data) + var"#status#" < 0 && @h5error(string("Error iterating through links in group ", + h5i_get_name(group_id))) return nothing end end @@ -1464,8 +1634,11 @@ end See `libhdf5` documentation for [`H5Literate1`](https://portal.hdfgroup.org/display/HDF5/H5L_ITERATE1). """ function h5l_iterate(group_id, idx_type, order, idx, op, op_data) - var"#status#" = ccall((:H5Literate1, libhdf5), herr_t, (hid_t, Cint, Cint, Ptr{hsize_t}, Ptr{Cvoid}, Any), group_id, idx_type, order, idx, op, op_data) - var"#status#" < 0 && @h5error(string("Error iterating through links in group ", h5i_get_name(group_id))) + var"#status#" = ccall((:H5Literate1, libhdf5), herr_t, + (hid_t, Cint, Cint, Ptr{hsize_t}, Ptr{Cvoid}, Any), group_id, + idx_type, order, idx, op, op_data) + var"#status#" < 0 && @h5error(string("Error iterating through links in group ", + h5i_get_name(group_id))) return nothing end end @@ -1476,7 +1649,8 @@ end See `libhdf5` documentation for [`H5Oare_mdc_flushes_disabled`](https://portal.hdfgroup.org/display/HDF5/H5O_ARE_MDC_FLUSHES_DISABLED). """ function h5o_are_mdc_flushes_disabled(object_id, are_disabled) - var"#status#" = ccall((:H5Oare_mdc_flushes_disabled, libhdf5), herr_t, (hid_t, Ptr{hbool_t}), object_id, are_disabled) + var"#status#" = ccall((:H5Oare_mdc_flushes_disabled, libhdf5), herr_t, + (hid_t, Ptr{hbool_t}), object_id, are_disabled) var"#status#" < 0 && @h5error("Error in h5o_are_mdc_flushes_disabled (not annotated)") return nothing end @@ -1498,8 +1672,12 @@ end See `libhdf5` documentation for [`H5Ocopy`](https://portal.hdfgroup.org/display/HDF5/H5O_COPY). """ function h5o_copy(src_loc_id, src_name, dst_loc_id, dst_name, ocpypl_id, lcpl_id) - var"#status#" = ccall((:H5Ocopy, libhdf5), herr_t, (hid_t, Ptr{UInt8}, hid_t, Ptr{UInt8}, hid_t, hid_t), src_loc_id, src_name, dst_loc_id, dst_name, ocpypl_id, lcpl_id) - var"#status#" < 0 && @h5error(string("Error copying object ", h5i_get_name(src_loc_id), "/", src_name, " to ", h5i_get_name(dst_loc_id), "/", dst_name)) + var"#status#" = ccall((:H5Ocopy, libhdf5), herr_t, + (hid_t, Ptr{UInt8}, hid_t, Ptr{UInt8}, hid_t, hid_t), src_loc_id, + src_name, dst_loc_id, dst_name, ocpypl_id, lcpl_id) + var"#status#" < 0 && + @h5error(string("Error copying object ", h5i_get_name(src_loc_id), "/", src_name, + " to ", h5i_get_name(dst_loc_id), "/", dst_name)) return nothing end @@ -1542,7 +1720,8 @@ end See `libhdf5` documentation for [`H5Oexists_by_name`](https://portal.hdfgroup.org/display/HDF5/H5O_EXISTS_BY_NAME). """ function h5o_exists_by_name(loc_id, name, lapl_id) - var"#status#" = ccall((:H5Oexists_by_name, libhdf5), htri_t, (hid_t, Ptr{Cchar}, hid_t), loc_id, name, lapl_id) + var"#status#" = ccall((:H5Oexists_by_name, libhdf5), htri_t, (hid_t, Ptr{Cchar}, hid_t), + loc_id, name, lapl_id) var"#status#" < 0 && @h5error("Error in h5o_exists_by_name (not annotated)") return var"#status#" > 0 end @@ -1564,7 +1743,8 @@ end See `libhdf5` documentation for [`H5Oget_comment`](https://portal.hdfgroup.org/display/HDF5/H5O_GET_COMMENT). """ function h5o_get_comment(obj_id, comment, bufsize) - var"#status#" = ccall((:H5Oget_comment, libhdf5), Cssize_t, (hid_t, Ptr{Cchar}, Csize_t), obj_id, comment, bufsize) + var"#status#" = ccall((:H5Oget_comment, libhdf5), Cssize_t, + (hid_t, Ptr{Cchar}, Csize_t), obj_id, comment, bufsize) var"#status#" < 0 && @h5error("Error in h5o_get_comment (not annotated)") return var"#status#" end @@ -1575,7 +1755,9 @@ end See `libhdf5` documentation for [`H5Oget_comment_by_name`](https://portal.hdfgroup.org/display/HDF5/H5O_GET_COMMENT_BY_NAME). """ function h5o_get_comment_by_name(loc_id, name, comment, bufsize, lapl_id) - var"#status#" = ccall((:H5Oget_comment_by_name, libhdf5), Cssize_t, (hid_t, Ptr{Cchar}, Ptr{Cchar}, Csize_t, hid_t), loc_id, name, comment, bufsize, lapl_id) + var"#status#" = ccall((:H5Oget_comment_by_name, libhdf5), Cssize_t, + (hid_t, Ptr{Cchar}, Ptr{Cchar}, Csize_t, hid_t), loc_id, name, + comment, bufsize, lapl_id) var"#status#" < 0 && @h5error("Error in h5o_get_comment_by_name (not annotated)") return var"#status#" end @@ -1587,7 +1769,8 @@ end See `libhdf5` documentation for [`H5Oget_info1`](https://portal.hdfgroup.org/display/HDF5/H5O_GET_INFO1). """ function h5o_get_info(object_id, buf) - var"#status#" = ccall((:H5Oget_info1, libhdf5), herr_t, (hid_t, Ptr{H5O_info1_t}), object_id, buf) + var"#status#" = ccall((:H5Oget_info1, libhdf5), herr_t, (hid_t, Ptr{H5O_info1_t}), + object_id, buf) var"#status#" < 0 && @h5error("Error getting object info") return nothing end @@ -1600,7 +1783,8 @@ end See `libhdf5` documentation for [`H5Oget_info2`](https://portal.hdfgroup.org/display/HDF5/H5O_GET_INFO2). """ function h5o_get_info(loc_id, oinfo, fields) - var"#status#" = ccall((:H5Oget_info2, libhdf5), herr_t, (hid_t, Ptr{H5O_info1_t}, Cuint), loc_id, oinfo, fields) + var"#status#" = ccall((:H5Oget_info2, libhdf5), herr_t, + (hid_t, Ptr{H5O_info1_t}, Cuint), loc_id, oinfo, fields) var"#status#" < 0 && @h5error("Error in h5o_get_info2 (not annotated)") return nothing end @@ -1613,7 +1797,8 @@ end See `libhdf5` documentation for [`H5Oget_info3`](https://portal.hdfgroup.org/display/HDF5/H5O_GET_INFO3). """ function h5o_get_info(loc_id, oinfo, fields) - var"#status#" = ccall((:H5Oget_info3, libhdf5), herr_t, (hid_t, Ptr{H5O_info2_t}, Cuint), loc_id, oinfo, fields) + var"#status#" = ccall((:H5Oget_info3, libhdf5), herr_t, + (hid_t, Ptr{H5O_info2_t}, Cuint), loc_id, oinfo, fields) var"#status#" < 0 && @h5error("Error in h5o_get_info3 (not annotated)") return nothing end @@ -1626,7 +1811,10 @@ end See `libhdf5` documentation for [`H5Oget_info_by_idx1`](https://portal.hdfgroup.org/display/HDF5/H5O_GET_INFO_BY_IDX1). """ function h5o_get_info_by_idx(loc_id, group_name, idx_type, order, n, oinfo, lapl_id) - var"#status#" = ccall((:H5Oget_info_by_idx1, libhdf5), herr_t, (hid_t, Ptr{Cchar}, H5_index_t, H5_iter_order_t, hsize_t, Ptr{H5O_info1_t}, hid_t), loc_id, group_name, idx_type, order, n, oinfo, lapl_id) + var"#status#" = ccall((:H5Oget_info_by_idx1, libhdf5), herr_t, + (hid_t, Ptr{Cchar}, H5_index_t, H5_iter_order_t, hsize_t, + Ptr{H5O_info1_t}, hid_t), loc_id, group_name, idx_type, + order, n, oinfo, lapl_id) var"#status#" < 0 && @h5error("Error in h5o_get_info_by_idx1 (not annotated)") return nothing end @@ -1638,8 +1826,12 @@ end See `libhdf5` documentation for [`H5Oget_info_by_idx2`](https://portal.hdfgroup.org/display/HDF5/H5O_GET_INFO_BY_IDX2). """ - function h5o_get_info_by_idx(loc_id, group_name, idx_type, order, n, oinfo, fields, lapl_id) - var"#status#" = ccall((:H5Oget_info_by_idx2, libhdf5), herr_t, (hid_t, Ptr{Cchar}, H5_index_t, H5_iter_order_t, hsize_t, Ptr{H5O_info1_t}, Cuint, hid_t), loc_id, group_name, idx_type, order, n, oinfo, fields, lapl_id) + function h5o_get_info_by_idx(loc_id, group_name, idx_type, order, n, oinfo, fields, + lapl_id) + var"#status#" = ccall((:H5Oget_info_by_idx2, libhdf5), herr_t, + (hid_t, Ptr{Cchar}, H5_index_t, H5_iter_order_t, hsize_t, + Ptr{H5O_info1_t}, Cuint, hid_t), loc_id, group_name, + idx_type, order, n, oinfo, fields, lapl_id) var"#status#" < 0 && @h5error("Error in h5o_get_info_by_idx2 (not annotated)") return nothing end @@ -1651,8 +1843,12 @@ end See `libhdf5` documentation for [`H5Oget_info_by_idx3`](https://portal.hdfgroup.org/display/HDF5/H5O_GET_INFO_BY_IDX3). """ - function h5o_get_info_by_idx(loc_id, group_name, idx_type, order, n, oinfo, fields, lapl_id) - var"#status#" = ccall((:H5Oget_info_by_idx3, libhdf5), herr_t, (hid_t, Ptr{Cchar}, H5_index_t, H5_iter_order_t, hsize_t, Ptr{H5O_info2_t}, Cuint, hid_t), loc_id, group_name, idx_type, order, n, oinfo, fields, lapl_id) + function h5o_get_info_by_idx(loc_id, group_name, idx_type, order, n, oinfo, fields, + lapl_id) + var"#status#" = ccall((:H5Oget_info_by_idx3, libhdf5), herr_t, + (hid_t, Ptr{Cchar}, H5_index_t, H5_iter_order_t, hsize_t, + Ptr{H5O_info2_t}, Cuint, hid_t), loc_id, group_name, + idx_type, order, n, oinfo, fields, lapl_id) var"#status#" < 0 && @h5error("Error in h5o_get_info_by_idx3 (not annotated)") return nothing end @@ -1665,7 +1861,9 @@ end See `libhdf5` documentation for [`H5Oget_info_by_name1`](https://portal.hdfgroup.org/display/HDF5/H5O_GET_INFO_BY_NAME1). """ function h5o_get_info_by_name(loc_id, name, oinfo, lapl_id) - var"#status#" = ccall((:H5Oget_info_by_name1, libhdf5), herr_t, (hid_t, Ptr{Cchar}, Ptr{H5O_info1_t}, hid_t), loc_id, name, oinfo, lapl_id) + var"#status#" = ccall((:H5Oget_info_by_name1, libhdf5), herr_t, + (hid_t, Ptr{Cchar}, Ptr{H5O_info1_t}, hid_t), loc_id, name, + oinfo, lapl_id) var"#status#" < 0 && @h5error("Error in h5o_get_info_by_name1 (not annotated)") return nothing end @@ -1678,7 +1876,9 @@ end See `libhdf5` documentation for [`H5Oget_info_by_name2`](https://portal.hdfgroup.org/display/HDF5/H5O_GET_INFO_BY_NAME2). """ function h5o_get_info_by_name(loc_id, name, oinfo, fields, lapl_id) - var"#status#" = ccall((:H5Oget_info_by_name2, libhdf5), herr_t, (hid_t, Ptr{Cchar}, Ptr{H5O_info1_t}, Cuint, hid_t), loc_id, name, oinfo, fields, lapl_id) + var"#status#" = ccall((:H5Oget_info_by_name2, libhdf5), herr_t, + (hid_t, Ptr{Cchar}, Ptr{H5O_info1_t}, Cuint, hid_t), loc_id, + name, oinfo, fields, lapl_id) var"#status#" < 0 && @h5error("Error in h5o_get_info_by_name2 (not annotated)") return nothing end @@ -1691,7 +1891,9 @@ end See `libhdf5` documentation for [`H5Oget_info_by_name3`](https://portal.hdfgroup.org/display/HDF5/H5O_GET_INFO_BY_NAME3). """ function h5o_get_info_by_name(loc_id, name, oinfo, fields, lapl_id) - var"#status#" = ccall((:H5Oget_info_by_name3, libhdf5), herr_t, (hid_t, Ptr{Cchar}, Ptr{H5O_info2_t}, Cuint, hid_t), loc_id, name, oinfo, fields, lapl_id) + var"#status#" = ccall((:H5Oget_info_by_name3, libhdf5), herr_t, + (hid_t, Ptr{Cchar}, Ptr{H5O_info2_t}, Cuint, hid_t), loc_id, + name, oinfo, fields, lapl_id) var"#status#" < 0 && @h5error("Error in h5o_get_info_by_name3 (not annotated)") return nothing end @@ -1703,7 +1905,8 @@ end See `libhdf5` documentation for [`H5Oget_native_info`](https://portal.hdfgroup.org/display/HDF5/H5O_GET_NATIVE_INFO). """ function h5o_get_native_info(loc_id, oinfo, fields) - var"#status#" = ccall((:H5Oget_native_info, libhdf5), herr_t, (hid_t, Ptr{H5O_native_info_t}, Cuint), loc_id, oinfo, fields) + var"#status#" = ccall((:H5Oget_native_info, libhdf5), herr_t, + (hid_t, Ptr{H5O_native_info_t}, Cuint), loc_id, oinfo, fields) var"#status#" < 0 && @h5error("Error in h5o_get_native_info (not annotated)") return nothing end @@ -1713,8 +1916,12 @@ end See `libhdf5` documentation for [`H5Oget_native_info_by_idx`](https://portal.hdfgroup.org/display/HDF5/H5O_GET_NATIVE_INFO_BY_IDX). """ -function h5o_get_native_info_by_idx(loc_id, group_name, idx_type, order, n, oinfo, fields, lapl_id) - var"#status#" = ccall((:H5Oget_native_info_by_idx, libhdf5), herr_t, (hid_t, Ptr{Cchar}, H5_index_t, H5_iter_order_t, hsize_t, Ptr{H5O_native_info_t}, Cuint, hid_t), loc_id, group_name, idx_type, order, n, oinfo, fields, lapl_id) +function h5o_get_native_info_by_idx(loc_id, group_name, idx_type, order, n, oinfo, fields, + lapl_id) + var"#status#" = ccall((:H5Oget_native_info_by_idx, libhdf5), herr_t, + (hid_t, Ptr{Cchar}, H5_index_t, H5_iter_order_t, hsize_t, + Ptr{H5O_native_info_t}, Cuint, hid_t), loc_id, group_name, + idx_type, order, n, oinfo, fields, lapl_id) var"#status#" < 0 && @h5error("Error in h5o_get_native_info_by_idx (not annotated)") return nothing end @@ -1725,7 +1932,9 @@ end See `libhdf5` documentation for [`H5Oget_native_info_by_name`](https://portal.hdfgroup.org/display/HDF5/H5O_GET_NATIVE_INFO_BY_NAME). """ function h5o_get_native_info_by_name(loc_id, name, oinfo, fields, lapl_id) - var"#status#" = ccall((:H5Oget_native_info_by_name, libhdf5), herr_t, (hid_t, Ptr{Cchar}, Ptr{H5O_native_info_t}, Cuint, hid_t), loc_id, name, oinfo, fields, lapl_id) + var"#status#" = ccall((:H5Oget_native_info_by_name, libhdf5), herr_t, + (hid_t, Ptr{Cchar}, Ptr{H5O_native_info_t}, Cuint, hid_t), loc_id, + name, oinfo, fields, lapl_id) var"#status#" < 0 && @h5error("Error in h5o_get_native_info_by_name (not annotated)") return nothing end @@ -1747,7 +1956,9 @@ end See `libhdf5` documentation for [`H5Olink`](https://portal.hdfgroup.org/display/HDF5/H5O_LINK). """ function h5o_link(obj_id, new_loc_id, new_name, lcpl_id, lapl_id) - var"#status#" = ccall((:H5Olink, libhdf5), herr_t, (hid_t, hid_t, Ptr{Cchar}, hid_t, hid_t), obj_id, new_loc_id, new_name, lcpl_id, lapl_id) + var"#status#" = ccall((:H5Olink, libhdf5), herr_t, + (hid_t, hid_t, Ptr{Cchar}, hid_t, hid_t), obj_id, new_loc_id, + new_name, lcpl_id, lapl_id) var"#status#" < 0 && @h5error("Error in h5o_link (not annotated)") return nothing end @@ -1758,8 +1969,10 @@ end See `libhdf5` documentation for [`H5Oopen`](https://portal.hdfgroup.org/display/HDF5/H5O_OPEN). """ function h5o_open(loc_id, pathname, lapl_id) - var"#status#" = ccall((:H5Oopen, libhdf5), hid_t, (hid_t, Ptr{UInt8}, hid_t), loc_id, pathname, lapl_id) - var"#status#" < 0 && @h5error(string("Error opening object ", h5i_get_name(loc_id), "/", pathname)) + var"#status#" = ccall((:H5Oopen, libhdf5), hid_t, (hid_t, Ptr{UInt8}, hid_t), loc_id, + pathname, lapl_id) + var"#status#" < 0 && + @h5error(string("Error opening object ", h5i_get_name(loc_id), "/", pathname)) return var"#status#" end @@ -1769,7 +1982,8 @@ end See `libhdf5` documentation for [`H5Oopen_by_addr`](https://portal.hdfgroup.org/display/HDF5/H5O_OPEN_BY_ADDR). """ function h5o_open_by_addr(loc_id, addr) - var"#status#" = ccall((:H5Oopen_by_addr, libhdf5), hid_t, (hid_t, haddr_t), loc_id, addr) + var"#status#" = ccall((:H5Oopen_by_addr, libhdf5), hid_t, (hid_t, haddr_t), loc_id, + addr) var"#status#" < 0 && @h5error("Error opening object by address") return var"#status#" end @@ -1780,7 +1994,9 @@ end See `libhdf5` documentation for [`H5Oopen_by_idx`](https://portal.hdfgroup.org/display/HDF5/H5O_OPEN_BY_IDX). """ function h5o_open_by_idx(loc_id, group_name, index_type, order, n, lapl_id) - var"#status#" = ccall((:H5Oopen_by_idx, libhdf5), hid_t, (hid_t, Ptr{UInt8}, Cint, Cint, hsize_t, hid_t), loc_id, group_name, index_type, order, n, lapl_id) + var"#status#" = ccall((:H5Oopen_by_idx, libhdf5), hid_t, + (hid_t, Ptr{UInt8}, Cint, Cint, hsize_t, hid_t), loc_id, + group_name, index_type, order, n, lapl_id) var"#status#" < 0 && @h5error(string("Error opening object of index ", n)) return var"#status#" end @@ -1802,7 +2018,8 @@ end See `libhdf5` documentation for [`H5Oset_comment`](https://portal.hdfgroup.org/display/HDF5/H5O_SET_COMMENT). """ function h5o_set_comment(obj_id, comment) - var"#status#" = ccall((:H5Oset_comment, libhdf5), herr_t, (hid_t, Ptr{Cchar}), obj_id, comment) + var"#status#" = ccall((:H5Oset_comment, libhdf5), herr_t, (hid_t, Ptr{Cchar}), obj_id, + comment) var"#status#" < 0 && @h5error("Error in h5o_set_comment (not annotated)") return nothing end @@ -1813,7 +2030,9 @@ end See `libhdf5` documentation for [`H5Oset_comment_by_name`](https://portal.hdfgroup.org/display/HDF5/H5O_SET_COMMENT_BY_NAME). """ function h5o_set_comment_by_name(loc_id, name, comment, lapl_id) - var"#status#" = ccall((:H5Oset_comment_by_name, libhdf5), herr_t, (hid_t, Ptr{Cchar}, Ptr{Cchar}, hid_t), loc_id, name, comment, lapl_id) + var"#status#" = ccall((:H5Oset_comment_by_name, libhdf5), herr_t, + (hid_t, Ptr{Cchar}, Ptr{Cchar}, hid_t), loc_id, name, comment, + lapl_id) var"#status#" < 0 && @h5error("Error in h5o_set_comment_by_name (not annotated)") return nothing end @@ -1824,7 +2043,9 @@ end See `libhdf5` documentation for [`H5Otoken_cmp`](https://portal.hdfgroup.org/display/HDF5/H5O_TOKEN_CMP). """ function h5o_token_cmp(loc_id, token1, token2, cmp_value) - var"#status#" = ccall((:H5Otoken_cmp, libhdf5), herr_t, (hid_t, Ptr{H5O_token_t}, Ptr{H5O_token_t}, Ptr{Cint}), loc_id, token1, token2, cmp_value) + var"#status#" = ccall((:H5Otoken_cmp, libhdf5), herr_t, + (hid_t, Ptr{H5O_token_t}, Ptr{H5O_token_t}, Ptr{Cint}), loc_id, + token1, token2, cmp_value) var"#status#" < 0 && @h5error("Error in h5o_token_cmp (not annotated)") return nothing end @@ -1835,7 +2056,8 @@ end See `libhdf5` documentation for [`H5Otoken_from_str`](https://portal.hdfgroup.org/display/HDF5/H5O_TOKEN_FROM_STR). """ function h5o_token_from_str(loc_id, token_str, token) - var"#status#" = ccall((:H5Otoken_from_str, libhdf5), herr_t, (hid_t, Ptr{Cchar}, Ptr{H5O_token_t}), loc_id, token_str, token) + var"#status#" = ccall((:H5Otoken_from_str, libhdf5), herr_t, + (hid_t, Ptr{Cchar}, Ptr{H5O_token_t}), loc_id, token_str, token) var"#status#" < 0 && @h5error("Error in h5o_token_from_str (not annotated)") return nothing end @@ -1846,7 +2068,9 @@ end See `libhdf5` documentation for [`H5Otoken_to_str`](https://portal.hdfgroup.org/display/HDF5/H5O_TOKEN_TO_STR). """ function h5o_token_to_str(loc_id, token, token_str) - var"#status#" = ccall((:H5Otoken_to_str, libhdf5), herr_t, (hid_t, Ptr{H5O_token_t}, Ptr{Ptr{Cchar}}), loc_id, token, token_str) + var"#status#" = ccall((:H5Otoken_to_str, libhdf5), herr_t, + (hid_t, Ptr{H5O_token_t}, Ptr{Ptr{Cchar}}), loc_id, token, + token_str) var"#status#" < 0 && @h5error("Error in h5o_token_to_str (not annotated)") return nothing end @@ -1858,7 +2082,9 @@ end See `libhdf5` documentation for [`H5Ovisit1`](https://portal.hdfgroup.org/display/HDF5/H5O_VISIT1). """ function h5o_visit(obj_id, idx_type, order, op, op_data) - var"#status#" = ccall((:H5Ovisit1, libhdf5), herr_t, (hid_t, H5_index_t, H5_iter_order_t, H5O_iterate1_t, Ptr{Cvoid}), obj_id, idx_type, order, op, op_data) + var"#status#" = ccall((:H5Ovisit1, libhdf5), herr_t, + (hid_t, H5_index_t, H5_iter_order_t, H5O_iterate1_t, + Ptr{Cvoid}), obj_id, idx_type, order, op, op_data) var"#status#" < 0 && @h5error("Error in h5o_visit1 (not annotated)") return nothing end @@ -1871,7 +2097,10 @@ end See `libhdf5` documentation for [`H5Ovisit3`](https://portal.hdfgroup.org/display/HDF5/H5O_VISIT3). """ function h5o_visit(obj_id, idx_type, order, op, op_data, fields) - var"#status#" = ccall((:H5Ovisit3, libhdf5), herr_t, (hid_t, H5_index_t, H5_iter_order_t, H5O_iterate2_t, Ptr{Cvoid}, Cuint), obj_id, idx_type, order, op, op_data, fields) + var"#status#" = ccall((:H5Ovisit3, libhdf5), herr_t, + (hid_t, H5_index_t, H5_iter_order_t, H5O_iterate2_t, + Ptr{Cvoid}, Cuint), obj_id, idx_type, order, op, op_data, + fields) var"#status#" < 0 && @h5error("Error in h5o_visit3 (not annotated)") return nothing end @@ -1884,7 +2113,10 @@ end See `libhdf5` documentation for [`H5Ovisit_by_name1`](https://portal.hdfgroup.org/display/HDF5/H5O_VISIT_BY_NAME1). """ function h5o_visit_by_name(loc_id, obj_name, idx_type, order, op, op_data, lapl_id) - var"#status#" = ccall((:H5Ovisit_by_name1, libhdf5), herr_t, (hid_t, Ptr{Cchar}, H5_index_t, H5_iter_order_t, H5O_iterate1_t, Ptr{Cvoid}, hid_t), loc_id, obj_name, idx_type, order, op, op_data, lapl_id) + var"#status#" = ccall((:H5Ovisit_by_name1, libhdf5), herr_t, + (hid_t, Ptr{Cchar}, H5_index_t, H5_iter_order_t, + H5O_iterate1_t, Ptr{Cvoid}, hid_t), loc_id, obj_name, + idx_type, order, op, op_data, lapl_id) var"#status#" < 0 && @h5error("Error in h5o_visit_by_name1 (not annotated)") return nothing end @@ -1896,8 +2128,12 @@ end See `libhdf5` documentation for [`H5Ovisit_by_name3`](https://portal.hdfgroup.org/display/HDF5/H5O_VISIT_BY_NAME3). """ - function h5o_visit_by_name(loc_id, obj_name, idx_type, order, op, op_data, fields, lapl_id) - var"#status#" = ccall((:H5Ovisit_by_name3, libhdf5), herr_t, (hid_t, Ptr{Cchar}, H5_index_t, H5_iter_order_t, H5O_iterate2_t, Ptr{Cvoid}, Cuint, hid_t), loc_id, obj_name, idx_type, order, op, op_data, fields, lapl_id) + function h5o_visit_by_name(loc_id, obj_name, idx_type, order, op, op_data, fields, + lapl_id) + var"#status#" = ccall((:H5Ovisit_by_name3, libhdf5), herr_t, + (hid_t, Ptr{Cchar}, H5_index_t, H5_iter_order_t, + H5O_iterate2_t, Ptr{Cvoid}, Cuint, hid_t), loc_id, obj_name, + idx_type, order, op, op_data, fields, lapl_id) var"#status#" < 0 && @h5error("Error in h5o_visit_by_name3 (not annotated)") return nothing end @@ -1909,7 +2145,8 @@ end See `libhdf5` documentation for [`H5Pget`](https://portal.hdfgroup.org/display/HDF5/H5P_GET). """ function h5p_get(plist_id, name, value) - var"#status#" = ccall((:H5Pget, libhdf5), herr_t, (hid_t, Ptr{Cchar}, Ptr{Cvoid}), plist_id, name, value) + var"#status#" = ccall((:H5Pget, libhdf5), herr_t, (hid_t, Ptr{Cchar}, Ptr{Cvoid}), + plist_id, name, value) var"#status#" < 0 && @h5error("Error in h5p_get (not annotated)") return nothing end @@ -1920,7 +2157,9 @@ end See `libhdf5` documentation for [`H5Pget_alignment`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_ALIGNMENT). """ function h5p_get_alignment(fapl_id, threshold, alignment) - var"#status#" = ccall((:H5Pget_alignment, libhdf5), herr_t, (hid_t, Ref{hsize_t}, Ref{hsize_t}), fapl_id, threshold, alignment) + var"#status#" = ccall((:H5Pget_alignment, libhdf5), herr_t, + (hid_t, Ref{hsize_t}, Ref{hsize_t}), fapl_id, threshold, + alignment) var"#status#" < 0 && @h5error("Error getting alignment") return nothing end @@ -1931,7 +2170,8 @@ end See `libhdf5` documentation for [`H5Pget_alloc_time`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_ALLOC_TIME). """ function h5p_get_alloc_time(plist_id, alloc_time) - var"#status#" = ccall((:H5Pget_alloc_time, libhdf5), herr_t, (hid_t, Ptr{Cint}), plist_id, alloc_time) + var"#status#" = ccall((:H5Pget_alloc_time, libhdf5), herr_t, (hid_t, Ptr{Cint}), + plist_id, alloc_time) var"#status#" < 0 && @h5error("Error getting allocation timing") return nothing end @@ -1942,7 +2182,9 @@ end See `libhdf5` documentation for [`H5Pget_append_flush`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_APPEND_FLUSH). """ function h5p_get_append_flush(dapl_id, dims, boundary, func, udata) - var"#status#" = ccall((:H5Pget_append_flush, libhdf5), herr_t, (hid_t, Cuint, Ptr{hsize_t}, Ptr{H5D_append_cb_t}, Ptr{Ptr{Cvoid}}), dapl_id, dims, boundary, func, udata) + var"#status#" = ccall((:H5Pget_append_flush, libhdf5), herr_t, + (hid_t, Cuint, Ptr{hsize_t}, Ptr{H5D_append_cb_t}, + Ptr{Ptr{Cvoid}}), dapl_id, dims, boundary, func, udata) var"#status#" < 0 && @h5error("Error in h5p_get_append_flush (not annotated)") return nothing end @@ -1953,7 +2195,8 @@ end See `libhdf5` documentation for [`H5Pget_attr_creation_order`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_ATTR_CREATION_ORDER). """ function h5p_get_attr_creation_order(plist_id, crt_order_flags) - var"#status#" = ccall((:H5Pget_attr_creation_order, libhdf5), herr_t, (hid_t, Ptr{Cuint}), plist_id, crt_order_flags) + var"#status#" = ccall((:H5Pget_attr_creation_order, libhdf5), herr_t, + (hid_t, Ptr{Cuint}), plist_id, crt_order_flags) var"#status#" < 0 && @h5error("Error getting attribute creation order") return nothing end @@ -1964,7 +2207,8 @@ end See `libhdf5` documentation for [`H5Pget_attr_phase_change`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_ATTR_PHASE_CHANGE). """ function h5p_get_attr_phase_change(plist_id, max_compact, min_dense) - var"#status#" = ccall((:H5Pget_attr_phase_change, libhdf5), herr_t, (hid_t, Ptr{Cuint}, Ptr{Cuint}), plist_id, max_compact, min_dense) + var"#status#" = ccall((:H5Pget_attr_phase_change, libhdf5), herr_t, + (hid_t, Ptr{Cuint}, Ptr{Cuint}), plist_id, max_compact, min_dense) var"#status#" < 0 && @h5error("Error in h5p_get_attr_phase_change (not annotated)") return nothing end @@ -1975,7 +2219,9 @@ end See `libhdf5` documentation for [`H5Pget_btree_ratios`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_BTREE_RATIOS). """ function h5p_get_btree_ratios(plist_id, left, middle, right) - var"#status#" = ccall((:H5Pget_btree_ratios, libhdf5), herr_t, (hid_t, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}), plist_id, left, middle, right) + var"#status#" = ccall((:H5Pget_btree_ratios, libhdf5), herr_t, + (hid_t, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}), plist_id, left, + middle, right) var"#status#" < 0 && @h5error("Error in h5p_get_btree_ratios (not annotated)") return nothing end @@ -1986,7 +2232,8 @@ end See `libhdf5` documentation for [`H5Pget_buffer`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_BUFFER). """ function h5p_get_buffer(plist_id, tconv, bkg) - var"#status#" = ccall((:H5Pget_buffer, libhdf5), Csize_t, (hid_t, Ptr{Ptr{Cvoid}}, Ptr{Ptr{Cvoid}}), plist_id, tconv, bkg) + var"#status#" = ccall((:H5Pget_buffer, libhdf5), Csize_t, + (hid_t, Ptr{Ptr{Cvoid}}, Ptr{Ptr{Cvoid}}), plist_id, tconv, bkg) @h5error "Error in h5p_get_buffer (not annotated)" return var"#status#" end @@ -1997,7 +2244,9 @@ end See `libhdf5` documentation for [`H5Pget_cache`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_CACHE). """ function h5p_get_cache(plist_id, mdc_nelmts, rdcc_nslots, rdcc_nbytes, rdcc_w0) - var"#status#" = ccall((:H5Pget_cache, libhdf5), herr_t, (hid_t, Ptr{Cint}, Ptr{Csize_t}, Ptr{Csize_t}, Ptr{Cdouble}), plist_id, mdc_nelmts, rdcc_nslots, rdcc_nbytes, rdcc_w0) + var"#status#" = ccall((:H5Pget_cache, libhdf5), herr_t, + (hid_t, Ptr{Cint}, Ptr{Csize_t}, Ptr{Csize_t}, Ptr{Cdouble}), + plist_id, mdc_nelmts, rdcc_nslots, rdcc_nbytes, rdcc_w0) var"#status#" < 0 && @h5error("Error in h5p_get_cache (not annotated)") return nothing end @@ -2008,7 +2257,8 @@ end See `libhdf5` documentation for [`H5Pget_char_encoding`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_CHAR_ENCODING). """ function h5p_get_char_encoding(plist_id, encoding) - var"#status#" = ccall((:H5Pget_char_encoding, libhdf5), herr_t, (hid_t, Ref{Cint}), plist_id, encoding) + var"#status#" = ccall((:H5Pget_char_encoding, libhdf5), herr_t, (hid_t, Ref{Cint}), + plist_id, encoding) var"#status#" < 0 && @h5error("Error getting char encoding") return nothing end @@ -2019,7 +2269,8 @@ end See `libhdf5` documentation for [`H5Pget_chunk`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_CHUNK). """ function h5p_get_chunk(plist_id, n_dims, dims) - var"#status#" = ccall((:H5Pget_chunk, libhdf5), Cint, (hid_t, Cint, Ptr{hsize_t}), plist_id, n_dims, dims) + var"#status#" = ccall((:H5Pget_chunk, libhdf5), Cint, (hid_t, Cint, Ptr{hsize_t}), + plist_id, n_dims, dims) var"#status#" < 0 && @h5error("Error getting chunk size") return Int(var"#status#") end @@ -2030,7 +2281,9 @@ end See `libhdf5` documentation for [`H5Pget_chunk_cache`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_CHUNK_CACHE). """ function h5p_get_chunk_cache(dapl_id, rdcc_nslots, rdcc_nbytes, rdcc_w0) - var"#status#" = ccall((:H5Pget_chunk_cache, libhdf5), herr_t, (hid_t, Ptr{Csize_t}, Ptr{Csize_t}, Ptr{Cdouble}), dapl_id, rdcc_nslots, rdcc_nbytes, rdcc_w0) + var"#status#" = ccall((:H5Pget_chunk_cache, libhdf5), herr_t, + (hid_t, Ptr{Csize_t}, Ptr{Csize_t}, Ptr{Cdouble}), dapl_id, + rdcc_nslots, rdcc_nbytes, rdcc_w0) var"#status#" < 0 && @h5error("Error in h5p_get_chunk_cache (not annotated)") return nothing end @@ -2041,7 +2294,8 @@ end See `libhdf5` documentation for [`H5Pget_chunk_opts`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_CHUNK_OPTS). """ function h5p_get_chunk_opts(plist_id, opts) - var"#status#" = ccall((:H5Pget_chunk_opts, libhdf5), herr_t, (hid_t, Ptr{Cuint}), plist_id, opts) + var"#status#" = ccall((:H5Pget_chunk_opts, libhdf5), herr_t, (hid_t, Ptr{Cuint}), + plist_id, opts) var"#status#" < 0 && @h5error("Error in h5p_get_chunk_opts (not annotated)") return nothing end @@ -2074,7 +2328,8 @@ end See `libhdf5` documentation for [`H5Pget_copy_object`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_COPY_OBJECT). """ function h5p_get_copy_object(plist_id, copy_options) - var"#status#" = ccall((:H5Pget_copy_object, libhdf5), herr_t, (hid_t, Ptr{Cuint}), plist_id, copy_options) + var"#status#" = ccall((:H5Pget_copy_object, libhdf5), herr_t, (hid_t, Ptr{Cuint}), + plist_id, copy_options) var"#status#" < 0 && @h5error("Error in h5p_get_copy_object (not annotated)") return nothing end @@ -2085,7 +2340,9 @@ end See `libhdf5` documentation for [`H5Pget_core_write_tracking`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_CORE_WRITE_TRACKING). """ function h5p_get_core_write_tracking(fapl_id, is_enabled, page_size) - var"#status#" = ccall((:H5Pget_core_write_tracking, libhdf5), herr_t, (hid_t, Ptr{hbool_t}, Ptr{Csize_t}), fapl_id, is_enabled, page_size) + var"#status#" = ccall((:H5Pget_core_write_tracking, libhdf5), herr_t, + (hid_t, Ptr{hbool_t}, Ptr{Csize_t}), fapl_id, is_enabled, + page_size) var"#status#" < 0 && @h5error("Error in h5p_get_core_write_tracking (not annotated)") return nothing end @@ -2096,7 +2353,8 @@ end See `libhdf5` documentation for [`H5Pget_create_intermediate_group`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_CREATE_INTERMEDIATE_GROUP). """ function h5p_get_create_intermediate_group(lcpl_id, crt_intermed_group) - var"#status#" = ccall((:H5Pget_create_intermediate_group, libhdf5), herr_t, (hid_t, Ref{Cuint}), lcpl_id, crt_intermed_group) + var"#status#" = ccall((:H5Pget_create_intermediate_group, libhdf5), herr_t, + (hid_t, Ref{Cuint}), lcpl_id, crt_intermed_group) var"#status#" < 0 && @h5error("Error getting create intermediate group property") return nothing end @@ -2107,7 +2365,8 @@ end See `libhdf5` documentation for [`H5Pget_data_transform`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_DATA_TRANSFORM). """ function h5p_get_data_transform(plist_id, expression, size) - var"#status#" = ccall((:H5Pget_data_transform, libhdf5), Cssize_t, (hid_t, Ptr{Cchar}, Csize_t), plist_id, expression, size) + var"#status#" = ccall((:H5Pget_data_transform, libhdf5), Cssize_t, + (hid_t, Ptr{Cchar}, Csize_t), plist_id, expression, size) var"#status#" < 0 && @h5error("Error in h5p_get_data_transform (not annotated)") return var"#status#" end @@ -2140,7 +2399,8 @@ end See `libhdf5` documentation for [`H5Pget_dset_no_attrs_hint`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_DSET_NO_ATTRS_HINT). """ function h5p_get_dset_no_attrs_hint(dcpl_id, minimize) - var"#status#" = ccall((:H5Pget_dset_no_attrs_hint, libhdf5), herr_t, (hid_t, Ptr{hbool_t}), dcpl_id, minimize) + var"#status#" = ccall((:H5Pget_dset_no_attrs_hint, libhdf5), herr_t, + (hid_t, Ptr{hbool_t}), dcpl_id, minimize) var"#status#" < 0 && @h5error("Error in getting dataset no attributes hint property") return nothing end @@ -2151,7 +2411,8 @@ end See `libhdf5` documentation for [`H5Pget_dxpl_mpio`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_DXPL_MPIO). """ function h5p_get_dxpl_mpio(dxpl_id, xfer_mode) - var"#status#" = ccall((:H5Pget_dxpl_mpio, libhdf5), herr_t, (hid_t, Ptr{Cint}), dxpl_id, xfer_mode) + var"#status#" = ccall((:H5Pget_dxpl_mpio, libhdf5), herr_t, (hid_t, Ptr{Cint}), dxpl_id, + xfer_mode) var"#status#" < 0 && @h5error("Error getting MPIO transfer mode") return nothing end @@ -2173,7 +2434,8 @@ end See `libhdf5` documentation for [`H5Pget_efile_prefix`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_EFILE_PREFIX). """ function h5p_get_efile_prefix(dapl_id, prefix, size) - var"#status#" = ccall((:H5Pget_efile_prefix, libhdf5), Cssize_t, (hid_t, Ptr{UInt8}, Csize_t), dapl_id, prefix, size) + var"#status#" = ccall((:H5Pget_efile_prefix, libhdf5), Cssize_t, + (hid_t, Ptr{UInt8}, Csize_t), dapl_id, prefix, size) var"#status#" < 0 && @h5error("Error getting external file prefix") return var"#status#" end @@ -2184,7 +2446,8 @@ end See `libhdf5` documentation for [`H5Pget_elink_acc_flags`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_ELINK_ACC_FLAGS). """ function h5p_get_elink_acc_flags(lapl_id, flags) - var"#status#" = ccall((:H5Pget_elink_acc_flags, libhdf5), herr_t, (hid_t, Ptr{Cuint}), lapl_id, flags) + var"#status#" = ccall((:H5Pget_elink_acc_flags, libhdf5), herr_t, (hid_t, Ptr{Cuint}), + lapl_id, flags) var"#status#" < 0 && @h5error("Error in h5p_get_elink_acc_flags (not annotated)") return nothing end @@ -2195,7 +2458,9 @@ end See `libhdf5` documentation for [`H5Pget_elink_cb`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_ELINK_CB). """ function h5p_get_elink_cb(lapl_id, func, op_data) - var"#status#" = ccall((:H5Pget_elink_cb, libhdf5), herr_t, (hid_t, Ptr{H5L_elink_traverse_t}, Ptr{Ptr{Cvoid}}), lapl_id, func, op_data) + var"#status#" = ccall((:H5Pget_elink_cb, libhdf5), herr_t, + (hid_t, Ptr{H5L_elink_traverse_t}, Ptr{Ptr{Cvoid}}), lapl_id, + func, op_data) var"#status#" < 0 && @h5error("Error in h5p_get_elink_cb (not annotated)") return nothing end @@ -2217,7 +2482,8 @@ end See `libhdf5` documentation for [`H5Pget_elink_file_cache_size`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_ELINK_FILE_CACHE_SIZE). """ function h5p_get_elink_file_cache_size(plist_id, efc_size) - var"#status#" = ccall((:H5Pget_elink_file_cache_size, libhdf5), herr_t, (hid_t, Ptr{Cuint}), plist_id, efc_size) + var"#status#" = ccall((:H5Pget_elink_file_cache_size, libhdf5), herr_t, + (hid_t, Ptr{Cuint}), plist_id, efc_size) var"#status#" < 0 && @h5error("Error in h5p_get_elink_file_cache_size (not annotated)") return nothing end @@ -2228,7 +2494,8 @@ end See `libhdf5` documentation for [`H5Pget_elink_prefix`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_ELINK_PREFIX). """ function h5p_get_elink_prefix(plist_id, prefix, size) - var"#status#" = ccall((:H5Pget_elink_prefix, libhdf5), Cssize_t, (hid_t, Ptr{Cchar}, Csize_t), plist_id, prefix, size) + var"#status#" = ccall((:H5Pget_elink_prefix, libhdf5), Cssize_t, + (hid_t, Ptr{Cchar}, Csize_t), plist_id, prefix, size) var"#status#" < 0 && @h5error("Error in h5p_get_elink_prefix (not annotated)") return var"#status#" end @@ -2239,7 +2506,9 @@ end See `libhdf5` documentation for [`H5Pget_est_link_info`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_EST_LINK_INFO). """ function h5p_get_est_link_info(plist_id, est_num_entries, est_name_len) - var"#status#" = ccall((:H5Pget_est_link_info, libhdf5), herr_t, (hid_t, Ptr{Cuint}, Ptr{Cuint}), plist_id, est_num_entries, est_name_len) + var"#status#" = ccall((:H5Pget_est_link_info, libhdf5), herr_t, + (hid_t, Ptr{Cuint}, Ptr{Cuint}), plist_id, est_num_entries, + est_name_len) var"#status#" < 0 && @h5error("Error in h5p_get_est_link_info (not annotated)") return nothing end @@ -2250,7 +2519,8 @@ end See `libhdf5` documentation for [`H5Pget_evict_on_close`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_EVICT_ON_CLOSE). """ function h5p_get_evict_on_close(fapl_id, evict_on_close) - var"#status#" = ccall((:H5Pget_evict_on_close, libhdf5), herr_t, (hid_t, Ptr{hbool_t}), fapl_id, evict_on_close) + var"#status#" = ccall((:H5Pget_evict_on_close, libhdf5), herr_t, (hid_t, Ptr{hbool_t}), + fapl_id, evict_on_close) var"#status#" < 0 && @h5error("Error in h5p_get_evict_on_close (not annotated)") return nothing end @@ -2261,7 +2531,9 @@ end See `libhdf5` documentation for [`H5Pget_external`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_EXTERNAL). """ function h5p_get_external(plist, idx, name_size, name, offset, size) - var"#status#" = ccall((:H5Pget_external, libhdf5), herr_t, (hid_t, Cuint, Csize_t, Ptr{Cuchar}, Ptr{off_t}, Ptr{hsize_t}), plist, idx, name_size, name, offset, size) + var"#status#" = ccall((:H5Pget_external, libhdf5), herr_t, + (hid_t, Cuint, Csize_t, Ptr{Cuchar}, Ptr{off_t}, Ptr{hsize_t}), + plist, idx, name_size, name, offset, size) var"#status#" < 0 && @h5error("Error getting external file properties") return nothing end @@ -2283,7 +2555,8 @@ end See `libhdf5` documentation for [`H5Pget_family_offset`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_FAMILY_OFFSET). """ function h5p_get_family_offset(fapl_id, offset) - var"#status#" = ccall((:H5Pget_family_offset, libhdf5), herr_t, (hid_t, Ptr{hsize_t}), fapl_id, offset) + var"#status#" = ccall((:H5Pget_family_offset, libhdf5), herr_t, (hid_t, Ptr{hsize_t}), + fapl_id, offset) var"#status#" < 0 && @h5error("Error in h5p_get_family_offset (not annotated)") return nothing end @@ -2294,7 +2567,9 @@ end See `libhdf5` documentation for [`H5Pget_fapl_core`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_FAPL_CORE). """ function h5p_get_fapl_core(fapl_id, increment, backing_store) - var"#status#" = ccall((:H5Pget_fapl_core, libhdf5), herr_t, (hid_t, Ptr{Csize_t}, Ptr{hbool_t}), fapl_id, increment, backing_store) + var"#status#" = ccall((:H5Pget_fapl_core, libhdf5), herr_t, + (hid_t, Ptr{Csize_t}, Ptr{hbool_t}), fapl_id, increment, + backing_store) var"#status#" < 0 && @h5error("Error in h5p_get_fapl_core (not annotated)") return nothing end @@ -2305,7 +2580,9 @@ end See `libhdf5` documentation for [`H5Pget_fapl_family`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_FAPL_FAMILY). """ function h5p_get_fapl_family(fapl_id, memb_size, memb_fapl_id) - var"#status#" = ccall((:H5Pget_fapl_family, libhdf5), herr_t, (hid_t, Ptr{hsize_t}, Ptr{hid_t}), fapl_id, memb_size, memb_fapl_id) + var"#status#" = ccall((:H5Pget_fapl_family, libhdf5), herr_t, + (hid_t, Ptr{hsize_t}, Ptr{hid_t}), fapl_id, memb_size, + memb_fapl_id) var"#status#" < 0 && @h5error("Error in h5p_get_fapl_family (not annotated)") return nothing end @@ -2316,7 +2593,8 @@ end See `libhdf5` documentation for [`H5Pget_fapl_hdfs`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_FAPL_HDFS). """ function h5p_get_fapl_hdfs(fapl_id, fa_out) - var"#status#" = ccall((:H5Pget_fapl_hdfs, libhdf5), herr_t, (hid_t, Ptr{H5FD_hdfs_fapl_t}), fapl_id, fa_out) + var"#status#" = ccall((:H5Pget_fapl_hdfs, libhdf5), herr_t, + (hid_t, Ptr{H5FD_hdfs_fapl_t}), fapl_id, fa_out) var"#status#" < 0 && @h5error("Error in h5p_get_fapl_hdfs (not annotated)") return nothing end @@ -2327,7 +2605,8 @@ end See `libhdf5` documentation for [`H5Pget_fapl_mpio`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_FAPL_MPIO32). """ function h5p_get_fapl_mpio32(fapl_id, comm, info) - var"#status#" = ccall((:H5Pget_fapl_mpio, libhdf5), herr_t, (hid_t, Ptr{Hmpih32}, Ptr{Hmpih32}), fapl_id, comm, info) + var"#status#" = ccall((:H5Pget_fapl_mpio, libhdf5), herr_t, + (hid_t, Ptr{Hmpih32}, Ptr{Hmpih32}), fapl_id, comm, info) var"#status#" < 0 && @h5error("Error getting MPIO properties") return nothing end @@ -2338,7 +2617,8 @@ end See `libhdf5` documentation for [`H5Pget_fapl_mpio`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_FAPL_MPIO64). """ function h5p_get_fapl_mpio64(fapl_id, comm, info) - var"#status#" = ccall((:H5Pget_fapl_mpio, libhdf5), herr_t, (hid_t, Ptr{Hmpih64}, Ptr{Hmpih64}), fapl_id, comm, info) + var"#status#" = ccall((:H5Pget_fapl_mpio, libhdf5), herr_t, + (hid_t, Ptr{Hmpih64}, Ptr{Hmpih64}), fapl_id, comm, info) var"#status#" < 0 && @h5error("Error getting MPIO properties") return nothing end @@ -2349,7 +2629,10 @@ end See `libhdf5` documentation for [`H5Pget_fapl_multi`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_FAPL_MULTI). """ function h5p_get_fapl_multi(fapl_id, memb_map, memb_fapl, memb_name, memb_addr, relax) - var"#status#" = ccall((:H5Pget_fapl_multi, libhdf5), herr_t, (hid_t, Ptr{H5FD_mem_t}, Ptr{hid_t}, Ptr{Ptr{Cchar}}, Ptr{haddr_t}, Ptr{hbool_t}), fapl_id, memb_map, memb_fapl, memb_name, memb_addr, relax) + var"#status#" = ccall((:H5Pget_fapl_multi, libhdf5), herr_t, + (hid_t, Ptr{H5FD_mem_t}, Ptr{hid_t}, Ptr{Ptr{Cchar}}, + Ptr{haddr_t}, Ptr{hbool_t}), fapl_id, memb_map, memb_fapl, + memb_name, memb_addr, relax) var"#status#" < 0 && @h5error("Error in h5p_get_fapl_multi (not annotated)") return nothing end @@ -2360,7 +2643,8 @@ end See `libhdf5` documentation for [`H5Pget_fapl_splitter`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_FAPL_SPLITTER). """ function h5p_get_fapl_splitter(fapl_id, config_ptr) - var"#status#" = ccall((:H5Pget_fapl_splitter, libhdf5), herr_t, (hid_t, Ptr{H5FD_splitter_vfd_config_t}), fapl_id, config_ptr) + var"#status#" = ccall((:H5Pget_fapl_splitter, libhdf5), herr_t, + (hid_t, Ptr{H5FD_splitter_vfd_config_t}), fapl_id, config_ptr) var"#status#" < 0 && @h5error("Error in h5p_get_fapl_splitter (not annotated)") return nothing end @@ -2371,7 +2655,8 @@ end See `libhdf5` documentation for [`H5Pget_fclose_degree`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_FCLOSE_DEGREE). """ function h5p_get_fclose_degree(fapl_id, fc_degree) - var"#status#" = ccall((:H5Pget_fclose_degree, libhdf5), herr_t, (hid_t, Ref{Cint}), fapl_id, fc_degree) + var"#status#" = ccall((:H5Pget_fclose_degree, libhdf5), herr_t, (hid_t, Ref{Cint}), + fapl_id, fc_degree) var"#status#" < 0 && @h5error("Error getting close degree") return nothing end @@ -2382,7 +2667,9 @@ end See `libhdf5` documentation for [`H5Pget_file_image`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_FILE_IMAGE). """ function h5p_get_file_image(fapl_id, buf_ptr_ptr, buf_len_ptr) - var"#status#" = ccall((:H5Pget_file_image, libhdf5), herr_t, (hid_t, Ptr{Ptr{Cvoid}}, Ptr{Csize_t}), fapl_id, buf_ptr_ptr, buf_len_ptr) + var"#status#" = ccall((:H5Pget_file_image, libhdf5), herr_t, + (hid_t, Ptr{Ptr{Cvoid}}, Ptr{Csize_t}), fapl_id, buf_ptr_ptr, + buf_len_ptr) var"#status#" < 0 && @h5error("Error in h5p_get_file_image (not annotated)") return nothing end @@ -2393,7 +2680,8 @@ end See `libhdf5` documentation for [`H5Pget_file_image_callbacks`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_FILE_IMAGE_CALLBACKS). """ function h5p_get_file_image_callbacks(fapl_id, callbacks_ptr) - var"#status#" = ccall((:H5Pget_file_image_callbacks, libhdf5), herr_t, (hid_t, Ptr{H5FD_file_image_callbacks_t}), fapl_id, callbacks_ptr) + var"#status#" = ccall((:H5Pget_file_image_callbacks, libhdf5), herr_t, + (hid_t, Ptr{H5FD_file_image_callbacks_t}), fapl_id, callbacks_ptr) var"#status#" < 0 && @h5error("Error in h5p_get_file_image_callbacks (not annotated)") return nothing end @@ -2404,7 +2692,9 @@ end See `libhdf5` documentation for [`H5Pget_file_locking`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_FILE_LOCKING). """ function h5p_get_file_locking(fapl_id, use_file_locking, ignore_when_disabled) - var"#status#" = ccall((:H5Pget_file_locking, libhdf5), herr_t, (hid_t, Ptr{hbool_t}, Ptr{hbool_t}), fapl_id, use_file_locking, ignore_when_disabled) + var"#status#" = ccall((:H5Pget_file_locking, libhdf5), herr_t, + (hid_t, Ptr{hbool_t}, Ptr{hbool_t}), fapl_id, use_file_locking, + ignore_when_disabled) var"#status#" < 0 && @h5error("Error in h5p_get_file_locking (not annotated)") return nothing end @@ -2415,7 +2705,9 @@ end See `libhdf5` documentation for [`H5Pget_file_space`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_FILE_SPACE). """ function h5p_get_file_space(plist_id, strategy, threshold) - var"#status#" = ccall((:H5Pget_file_space, libhdf5), herr_t, (hid_t, Ptr{H5F_file_space_type_t}, Ptr{hsize_t}), plist_id, strategy, threshold) + var"#status#" = ccall((:H5Pget_file_space, libhdf5), herr_t, + (hid_t, Ptr{H5F_file_space_type_t}, Ptr{hsize_t}), plist_id, + strategy, threshold) var"#status#" < 0 && @h5error("Error in h5p_get_file_space (not annotated)") return nothing end @@ -2426,7 +2718,8 @@ end See `libhdf5` documentation for [`H5Pget_file_space_page_size`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_FILE_SPACE_PAGE_SIZE). """ function h5p_get_file_space_page_size(plist_id, fsp_size) - var"#status#" = ccall((:H5Pget_file_space_page_size, libhdf5), herr_t, (hid_t, Ptr{hsize_t}), plist_id, fsp_size) + var"#status#" = ccall((:H5Pget_file_space_page_size, libhdf5), herr_t, + (hid_t, Ptr{hsize_t}), plist_id, fsp_size) var"#status#" < 0 && @h5error("Error in h5p_get_file_space_page_size (not annotated)") return nothing end @@ -2437,7 +2730,9 @@ end See `libhdf5` documentation for [`H5Pget_file_space_strategy`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_FILE_SPACE_STRATEGY). """ function h5p_get_file_space_strategy(plist_id, strategy, persist, threshold) - var"#status#" = ccall((:H5Pget_file_space_strategy, libhdf5), herr_t, (hid_t, Ptr{H5F_fspace_strategy_t}, Ptr{hbool_t}, Ptr{hsize_t}), plist_id, strategy, persist, threshold) + var"#status#" = ccall((:H5Pget_file_space_strategy, libhdf5), herr_t, + (hid_t, Ptr{H5F_fspace_strategy_t}, Ptr{hbool_t}, Ptr{hsize_t}), + plist_id, strategy, persist, threshold) var"#status#" < 0 && @h5error("Error in h5p_get_file_space_strategy (not annotated)") return nothing end @@ -2448,7 +2743,8 @@ end See `libhdf5` documentation for [`H5Pget_fill_time`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_FILL_TIME). """ function h5p_get_fill_time(plist_id, fill_time) - var"#status#" = ccall((:H5Pget_fill_time, libhdf5), herr_t, (hid_t, Ptr{H5D_fill_time_t}), plist_id, fill_time) + var"#status#" = ccall((:H5Pget_fill_time, libhdf5), herr_t, + (hid_t, Ptr{H5D_fill_time_t}), plist_id, fill_time) var"#status#" < 0 && @h5error("Error in h5p_get_fill_time (not annotated)") return nothing end @@ -2459,7 +2755,8 @@ end See `libhdf5` documentation for [`H5Pget_fill_value`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_FILL_VALUE). """ function h5p_get_fill_value(plist_id, type_id, value) - var"#status#" = ccall((:H5Pget_fill_value, libhdf5), herr_t, (hid_t, hid_t, Ptr{Cvoid}), plist_id, type_id, value) + var"#status#" = ccall((:H5Pget_fill_value, libhdf5), herr_t, (hid_t, hid_t, Ptr{Cvoid}), + plist_id, type_id, value) var"#status#" < 0 && @h5error("Error in h5p_get_fill_value (not annotated)") return nothing end @@ -2469,8 +2766,12 @@ end See `libhdf5` documentation for [`H5Pget_filter2`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_FILTER2). """ -function h5p_get_filter(plist_id, idx, flags, cd_nemlts, cd_values, namelen, name, filter_config) - var"#status#" = ccall((:H5Pget_filter2, libhdf5), H5Z_filter_t, (hid_t, Cuint, Ptr{Cuint}, Ref{Csize_t}, Ptr{Cuint}, Csize_t, Ptr{Cchar}, Ptr{Cuint}), plist_id, idx, flags, cd_nemlts, cd_values, namelen, name, filter_config) +function h5p_get_filter(plist_id, idx, flags, cd_nemlts, cd_values, namelen, name, + filter_config) + var"#status#" = ccall((:H5Pget_filter2, libhdf5), H5Z_filter_t, + (hid_t, Cuint, Ptr{Cuint}, Ref{Csize_t}, Ptr{Cuint}, Csize_t, + Ptr{Cchar}, Ptr{Cuint}), plist_id, idx, flags, cd_nemlts, + cd_values, namelen, name, filter_config) var"#status#" < 0 && @h5error("Error getting filter") return var"#status#" end @@ -2480,8 +2781,12 @@ end See `libhdf5` documentation for [`H5Pget_filter_by_id2`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_FILTER_BY_ID2). """ -function h5p_get_filter_by_id(plist_id, filter_id, flags, cd_nelmts, cd_values, namelen, name, filter_config) - var"#status#" = ccall((:H5Pget_filter_by_id2, libhdf5), herr_t, (hid_t, H5Z_filter_t, Ref{Cuint}, Ref{Csize_t}, Ptr{Cuint}, Csize_t, Ptr{UInt8}, Ptr{Cuint}), plist_id, filter_id, flags, cd_nelmts, cd_values, namelen, name, filter_config) +function h5p_get_filter_by_id(plist_id, filter_id, flags, cd_nelmts, cd_values, namelen, + name, filter_config) + var"#status#" = ccall((:H5Pget_filter_by_id2, libhdf5), herr_t, + (hid_t, H5Z_filter_t, Ref{Cuint}, Ref{Csize_t}, Ptr{Cuint}, + Csize_t, Ptr{UInt8}, Ptr{Cuint}), plist_id, filter_id, flags, + cd_nelmts, cd_values, namelen, name, filter_config) var"#status#" < 0 && @h5error("Error getting filter ID") return nothing end @@ -2492,7 +2797,8 @@ end See `libhdf5` documentation for [`H5Pget_gc_references`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_GC_REFERENCES). """ function h5p_get_gc_references(fapl_id, gc_ref) - var"#status#" = ccall((:H5Pget_gc_references, libhdf5), herr_t, (hid_t, Ptr{Cuint}), fapl_id, gc_ref) + var"#status#" = ccall((:H5Pget_gc_references, libhdf5), herr_t, (hid_t, Ptr{Cuint}), + fapl_id, gc_ref) var"#status#" < 0 && @h5error("Error in h5p_get_gc_references (not annotated)") return nothing end @@ -2503,7 +2809,8 @@ end See `libhdf5` documentation for [`H5Pget_hyper_vector_size`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_HYPER_VECTOR_SIZE). """ function h5p_get_hyper_vector_size(fapl_id, size) - var"#status#" = ccall((:H5Pget_hyper_vector_size, libhdf5), herr_t, (hid_t, Ptr{Csize_t}), fapl_id, size) + var"#status#" = ccall((:H5Pget_hyper_vector_size, libhdf5), herr_t, + (hid_t, Ptr{Csize_t}), fapl_id, size) var"#status#" < 0 && @h5error("Error in h5p_get_hyper_vector_size (not annotated)") return nothing end @@ -2514,7 +2821,8 @@ end See `libhdf5` documentation for [`H5Pget_istore_k`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_ISTORE_K). """ function h5p_get_istore_k(plist_id, ik) - var"#status#" = ccall((:H5Pget_istore_k, libhdf5), herr_t, (hid_t, Ptr{Cuint}), plist_id, ik) + var"#status#" = ccall((:H5Pget_istore_k, libhdf5), herr_t, (hid_t, Ptr{Cuint}), + plist_id, ik) var"#status#" < 0 && @h5error("Error in h5p_get_istore_k (not annotated)") return nothing end @@ -2536,7 +2844,8 @@ end See `libhdf5` documentation for [`H5Pget_libver_bounds`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_LIBVER_BOUNDS). """ function h5p_get_libver_bounds(fapl_id, low, high) - var"#status#" = ccall((:H5Pget_libver_bounds, libhdf5), herr_t, (hid_t, Ref{Cint}, Ref{Cint}), fapl_id, low, high) + var"#status#" = ccall((:H5Pget_libver_bounds, libhdf5), herr_t, + (hid_t, Ref{Cint}, Ref{Cint}), fapl_id, low, high) var"#status#" < 0 && @h5error("Error getting library version bounds") return nothing end @@ -2547,7 +2856,8 @@ end See `libhdf5` documentation for [`H5Pget_link_creation_order`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_LINK_CREATION_ORDER). """ function h5p_get_link_creation_order(plist_id, crt_order_flags) - var"#status#" = ccall((:H5Pget_link_creation_order, libhdf5), herr_t, (hid_t, Ptr{Cuint}), plist_id, crt_order_flags) + var"#status#" = ccall((:H5Pget_link_creation_order, libhdf5), herr_t, + (hid_t, Ptr{Cuint}), plist_id, crt_order_flags) var"#status#" < 0 && @h5error("Error getting link creation order") return nothing end @@ -2558,7 +2868,8 @@ end See `libhdf5` documentation for [`H5Pget_link_phase_change`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_LINK_PHASE_CHANGE). """ function h5p_get_link_phase_change(plist_id, max_compact, min_dense) - var"#status#" = ccall((:H5Pget_link_phase_change, libhdf5), herr_t, (hid_t, Ptr{Cuint}, Ptr{Cuint}), plist_id, max_compact, min_dense) + var"#status#" = ccall((:H5Pget_link_phase_change, libhdf5), herr_t, + (hid_t, Ptr{Cuint}, Ptr{Cuint}), plist_id, max_compact, min_dense) var"#status#" < 0 && @h5error("Error in h5p_get_link_phase_change (not annotated)") return nothing end @@ -2569,7 +2880,8 @@ end See `libhdf5` documentation for [`H5Pget_local_heap_size_hint`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_LOCAL_HEAP_SIZE_HINT). """ function h5p_get_local_heap_size_hint(plist_id, size_hint) - var"#status#" = ccall((:H5Pget_local_heap_size_hint, libhdf5), herr_t, (hid_t, Ref{Csize_t}), plist_id, size_hint) + var"#status#" = ccall((:H5Pget_local_heap_size_hint, libhdf5), herr_t, + (hid_t, Ref{Csize_t}), plist_id, size_hint) var"#status#" < 0 && @h5error("Error getting local heap size hint") return nothing end @@ -2580,7 +2892,9 @@ end See `libhdf5` documentation for [`H5Pget_mcdt_search_cb`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_MCDT_SEARCH_CB). """ function h5p_get_mcdt_search_cb(plist_id, func, op_data) - var"#status#" = ccall((:H5Pget_mcdt_search_cb, libhdf5), herr_t, (hid_t, Ptr{H5O_mcdt_search_cb_t}, Ptr{Ptr{Cvoid}}), plist_id, func, op_data) + var"#status#" = ccall((:H5Pget_mcdt_search_cb, libhdf5), herr_t, + (hid_t, Ptr{H5O_mcdt_search_cb_t}, Ptr{Ptr{Cvoid}}), plist_id, + func, op_data) var"#status#" < 0 && @h5error("Error in h5p_get_mcdt_search_cb (not annotated)") return nothing end @@ -2591,7 +2905,8 @@ end See `libhdf5` documentation for [`H5Pget_mdc_config`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_MDC_CONFIG). """ function h5p_get_mdc_config(plist_id, config_ptr) - var"#status#" = ccall((:H5Pget_mdc_config, libhdf5), herr_t, (hid_t, Ptr{H5AC_cache_config_t}), plist_id, config_ptr) + var"#status#" = ccall((:H5Pget_mdc_config, libhdf5), herr_t, + (hid_t, Ptr{H5AC_cache_config_t}), plist_id, config_ptr) var"#status#" < 0 && @h5error("Error in h5p_get_mdc_config (not annotated)") return nothing end @@ -2602,7 +2917,8 @@ end See `libhdf5` documentation for [`H5Pget_mdc_image_config`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_MDC_IMAGE_CONFIG). """ function h5p_get_mdc_image_config(plist_id, config_ptr) - var"#status#" = ccall((:H5Pget_mdc_image_config, libhdf5), herr_t, (hid_t, Ptr{H5AC_cache_image_config_t}), plist_id, config_ptr) + var"#status#" = ccall((:H5Pget_mdc_image_config, libhdf5), herr_t, + (hid_t, Ptr{H5AC_cache_image_config_t}), plist_id, config_ptr) var"#status#" < 0 && @h5error("Error in h5p_get_mdc_image_config (not annotated)") return nothing end @@ -2612,8 +2928,11 @@ end See `libhdf5` documentation for [`H5Pget_mdc_log_options`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_MDC_LOG_OPTIONS). """ -function h5p_get_mdc_log_options(plist_id, is_enabled, location, location_size, start_on_access) - var"#status#" = ccall((:H5Pget_mdc_log_options, libhdf5), herr_t, (hid_t, Ptr{hbool_t}, Ptr{Cchar}, Ptr{Csize_t}, Ptr{hbool_t}), plist_id, is_enabled, location, location_size, start_on_access) +function h5p_get_mdc_log_options(plist_id, is_enabled, location, location_size, + start_on_access) + var"#status#" = ccall((:H5Pget_mdc_log_options, libhdf5), herr_t, + (hid_t, Ptr{hbool_t}, Ptr{Cchar}, Ptr{Csize_t}, Ptr{hbool_t}), + plist_id, is_enabled, location, location_size, start_on_access) var"#status#" < 0 && @h5error("Error in h5p_get_mdc_log_options (not annotated)") return nothing end @@ -2624,7 +2943,8 @@ end See `libhdf5` documentation for [`H5Pget_meta_block_size`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_META_BLOCK_SIZE). """ function h5p_get_meta_block_size(fapl_id, size) - var"#status#" = ccall((:H5Pget_meta_block_size, libhdf5), herr_t, (hid_t, Ptr{hsize_t}), fapl_id, size) + var"#status#" = ccall((:H5Pget_meta_block_size, libhdf5), herr_t, (hid_t, Ptr{hsize_t}), + fapl_id, size) var"#status#" < 0 && @h5error("Error in h5p_get_meta_block_size (not annotated)") return nothing end @@ -2635,7 +2955,8 @@ end See `libhdf5` documentation for [`H5Pget_metadata_read_attempts`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_METADATA_READ_ATTEMPTS). """ function h5p_get_metadata_read_attempts(plist_id, attempts) - var"#status#" = ccall((:H5Pget_metadata_read_attempts, libhdf5), herr_t, (hid_t, Ptr{Cuint}), plist_id, attempts) + var"#status#" = ccall((:H5Pget_metadata_read_attempts, libhdf5), herr_t, + (hid_t, Ptr{Cuint}), plist_id, attempts) var"#status#" < 0 && @h5error("Error in h5p_get_metadata_read_attempts (not annotated)") return nothing end @@ -2646,7 +2967,8 @@ end See `libhdf5` documentation for [`H5Pget_multi_type`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_MULTI_TYPE). """ function h5p_get_multi_type(fapl_id, type) - var"#status#" = ccall((:H5Pget_multi_type, libhdf5), herr_t, (hid_t, Ptr{H5FD_mem_t}), fapl_id, type) + var"#status#" = ccall((:H5Pget_multi_type, libhdf5), herr_t, (hid_t, Ptr{H5FD_mem_t}), + fapl_id, type) var"#status#" < 0 && @h5error("Error in h5p_get_multi_type (not annotated)") return nothing end @@ -2668,7 +2990,8 @@ end See `libhdf5` documentation for [`H5Pget_nlinks`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_NLINKS). """ function h5p_get_nlinks(plist_id, nlinks) - var"#status#" = ccall((:H5Pget_nlinks, libhdf5), herr_t, (hid_t, Ptr{Csize_t}), plist_id, nlinks) + var"#status#" = ccall((:H5Pget_nlinks, libhdf5), herr_t, (hid_t, Ptr{Csize_t}), + plist_id, nlinks) var"#status#" < 0 && @h5error("Error in h5p_get_nlinks (not annotated)") return nothing end @@ -2679,7 +3002,8 @@ end See `libhdf5` documentation for [`H5Pget_nprops`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_NPROPS). """ function h5p_get_nprops(id, nprops) - var"#status#" = ccall((:H5Pget_nprops, libhdf5), herr_t, (hid_t, Ptr{Csize_t}), id, nprops) + var"#status#" = ccall((:H5Pget_nprops, libhdf5), herr_t, (hid_t, Ptr{Csize_t}), id, + nprops) var"#status#" < 0 && @h5error("Error in h5p_get_nprops (not annotated)") return nothing end @@ -2690,7 +3014,8 @@ end See `libhdf5` documentation for [`H5Pget_obj_track_times`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_OBJ_TRACK_TIMES). """ function h5p_get_obj_track_times(plist_id, track_times) - var"#status#" = ccall((:H5Pget_obj_track_times, libhdf5), herr_t, (hid_t, Ref{UInt8}), plist_id, track_times) + var"#status#" = ccall((:H5Pget_obj_track_times, libhdf5), herr_t, (hid_t, Ref{UInt8}), + plist_id, track_times) var"#status#" < 0 && @h5error("Error getting object time tracking") return nothing end @@ -2701,7 +3026,9 @@ end See `libhdf5` documentation for [`H5Pget_object_flush_cb`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_OBJECT_FLUSH_CB). """ function h5p_get_object_flush_cb(plist_id, func, udata) - var"#status#" = ccall((:H5Pget_object_flush_cb, libhdf5), herr_t, (hid_t, Ptr{H5F_flush_cb_t}, Ptr{Ptr{Cvoid}}), plist_id, func, udata) + var"#status#" = ccall((:H5Pget_object_flush_cb, libhdf5), herr_t, + (hid_t, Ptr{H5F_flush_cb_t}, Ptr{Ptr{Cvoid}}), plist_id, func, + udata) var"#status#" < 0 && @h5error("Error in h5p_get_object_flush_cb (not annotated)") return nothing end @@ -2712,7 +3039,9 @@ end See `libhdf5` documentation for [`H5Pget_page_buffer_size`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_PAGE_BUFFER_SIZE). """ function h5p_get_page_buffer_size(plist_id, buf_size, min_meta_perc, min_raw_perc) - var"#status#" = ccall((:H5Pget_page_buffer_size, libhdf5), herr_t, (hid_t, Ptr{Csize_t}, Ptr{Cuint}, Ptr{Cuint}), plist_id, buf_size, min_meta_perc, min_raw_perc) + var"#status#" = ccall((:H5Pget_page_buffer_size, libhdf5), herr_t, + (hid_t, Ptr{Csize_t}, Ptr{Cuint}, Ptr{Cuint}), plist_id, buf_size, + min_meta_perc, min_raw_perc) var"#status#" < 0 && @h5error("Error in h5p_get_page_buffer_size (not annotated)") return nothing end @@ -2734,7 +3063,9 @@ end See `libhdf5` documentation for [`H5Pget_shared_mesg_index`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_SHARED_MESG_INDEX). """ function h5p_get_shared_mesg_index(plist_id, index_num, mesg_type_flags, min_mesg_size) - var"#status#" = ccall((:H5Pget_shared_mesg_index, libhdf5), herr_t, (hid_t, Cuint, Ptr{Cuint}, Ptr{Cuint}), plist_id, index_num, mesg_type_flags, min_mesg_size) + var"#status#" = ccall((:H5Pget_shared_mesg_index, libhdf5), herr_t, + (hid_t, Cuint, Ptr{Cuint}, Ptr{Cuint}), plist_id, index_num, + mesg_type_flags, min_mesg_size) var"#status#" < 0 && @h5error("Error in h5p_get_shared_mesg_index (not annotated)") return nothing end @@ -2745,7 +3076,8 @@ end See `libhdf5` documentation for [`H5Pget_shared_mesg_nindexes`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_SHARED_MESG_NINDEXES). """ function h5p_get_shared_mesg_nindexes(plist_id, nindexes) - var"#status#" = ccall((:H5Pget_shared_mesg_nindexes, libhdf5), herr_t, (hid_t, Ptr{Cuint}), plist_id, nindexes) + var"#status#" = ccall((:H5Pget_shared_mesg_nindexes, libhdf5), herr_t, + (hid_t, Ptr{Cuint}), plist_id, nindexes) var"#status#" < 0 && @h5error("Error in h5p_get_shared_mesg_nindexes (not annotated)") return nothing end @@ -2756,8 +3088,10 @@ end See `libhdf5` documentation for [`H5Pget_shared_mesg_phase_change`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_SHARED_MESG_PHASE_CHANGE). """ function h5p_get_shared_mesg_phase_change(plist_id, max_list, min_btree) - var"#status#" = ccall((:H5Pget_shared_mesg_phase_change, libhdf5), herr_t, (hid_t, Ptr{Cuint}, Ptr{Cuint}), plist_id, max_list, min_btree) - var"#status#" < 0 && @h5error("Error in h5p_get_shared_mesg_phase_change (not annotated)") + var"#status#" = ccall((:H5Pget_shared_mesg_phase_change, libhdf5), herr_t, + (hid_t, Ptr{Cuint}, Ptr{Cuint}), plist_id, max_list, min_btree) + var"#status#" < 0 && + @h5error("Error in h5p_get_shared_mesg_phase_change (not annotated)") return nothing end @@ -2767,7 +3101,8 @@ end See `libhdf5` documentation for [`H5Pget_sieve_buf_size`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_SIEVE_BUF_SIZE). """ function h5p_get_sieve_buf_size(fapl_id, size) - var"#status#" = ccall((:H5Pget_sieve_buf_size, libhdf5), herr_t, (hid_t, Ptr{Csize_t}), fapl_id, size) + var"#status#" = ccall((:H5Pget_sieve_buf_size, libhdf5), herr_t, (hid_t, Ptr{Csize_t}), + fapl_id, size) var"#status#" < 0 && @h5error("Error in h5p_get_sieve_buf_size (not annotated)") return nothing end @@ -2778,7 +3113,8 @@ end See `libhdf5` documentation for [`H5Pget_size`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_SIZE). """ function h5p_get_size(id, name, size) - var"#status#" = ccall((:H5Pget_size, libhdf5), herr_t, (hid_t, Ptr{Cchar}, Ptr{Csize_t}), id, name, size) + var"#status#" = ccall((:H5Pget_size, libhdf5), herr_t, + (hid_t, Ptr{Cchar}, Ptr{Csize_t}), id, name, size) var"#status#" < 0 && @h5error("Error in h5p_get_size (not annotated)") return nothing end @@ -2789,7 +3125,9 @@ end See `libhdf5` documentation for [`H5Pget_sizes`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_SIZES). """ function h5p_get_sizes(plist_id, sizeof_addr, sizeof_size) - var"#status#" = ccall((:H5Pget_sizes, libhdf5), herr_t, (hid_t, Ptr{Csize_t}, Ptr{Csize_t}), plist_id, sizeof_addr, sizeof_size) + var"#status#" = ccall((:H5Pget_sizes, libhdf5), herr_t, + (hid_t, Ptr{Csize_t}, Ptr{Csize_t}), plist_id, sizeof_addr, + sizeof_size) var"#status#" < 0 && @h5error("Error in h5p_get_sizes (not annotated)") return nothing end @@ -2800,7 +3138,8 @@ end See `libhdf5` documentation for [`H5Pget_small_data_block_size`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_SMALL_DATA_BLOCK_SIZE). """ function h5p_get_small_data_block_size(fapl_id, size) - var"#status#" = ccall((:H5Pget_small_data_block_size, libhdf5), herr_t, (hid_t, Ptr{hsize_t}), fapl_id, size) + var"#status#" = ccall((:H5Pget_small_data_block_size, libhdf5), herr_t, + (hid_t, Ptr{hsize_t}), fapl_id, size) var"#status#" < 0 && @h5error("Error in h5p_get_small_data_block_size (not annotated)") return nothing end @@ -2811,7 +3150,8 @@ end See `libhdf5` documentation for [`H5Pget_sym_k`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_SYM_K). """ function h5p_get_sym_k(plist_id, ik, lk) - var"#status#" = ccall((:H5Pget_sym_k, libhdf5), herr_t, (hid_t, Ptr{Cuint}, Ptr{Cuint}), plist_id, ik, lk) + var"#status#" = ccall((:H5Pget_sym_k, libhdf5), herr_t, (hid_t, Ptr{Cuint}, Ptr{Cuint}), + plist_id, ik, lk) var"#status#" < 0 && @h5error("Error in h5p_get_sym_k (not annotated)") return nothing end @@ -2822,7 +3162,9 @@ end See `libhdf5` documentation for [`H5Pget_type_conv_cb`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_TYPE_CONV_CB). """ function h5p_get_type_conv_cb(dxpl_id, op, operate_data) - var"#status#" = ccall((:H5Pget_type_conv_cb, libhdf5), herr_t, (hid_t, Ptr{H5T_conv_except_func_t}, Ptr{Ptr{Cvoid}}), dxpl_id, op, operate_data) + var"#status#" = ccall((:H5Pget_type_conv_cb, libhdf5), herr_t, + (hid_t, Ptr{H5T_conv_except_func_t}, Ptr{Ptr{Cvoid}}), dxpl_id, + op, operate_data) var"#status#" < 0 && @h5error("Error in h5p_get_type_conv_cb (not annotated)") return nothing end @@ -2833,7 +3175,8 @@ end See `libhdf5` documentation for [`H5Pget_userblock`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_USERBLOCK). """ function h5p_get_userblock(plist_id, len) - var"#status#" = ccall((:H5Pget_userblock, libhdf5), herr_t, (hid_t, Ptr{hsize_t}), plist_id, len) + var"#status#" = ccall((:H5Pget_userblock, libhdf5), herr_t, (hid_t, Ptr{hsize_t}), + plist_id, len) var"#status#" < 0 && @h5error("Error getting userblock") return nothing end @@ -2844,7 +3187,9 @@ end See `libhdf5` documentation for [`H5Pget_version`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_VERSION). """ function h5p_get_version(plist_id, boot, freelist, stab, shhdr) - var"#status#" = ccall((:H5Pget_version, libhdf5), herr_t, (hid_t, Ptr{Cuint}, Ptr{Cuint}, Ptr{Cuint}, Ptr{Cuint}), plist_id, boot, freelist, stab, shhdr) + var"#status#" = ccall((:H5Pget_version, libhdf5), herr_t, + (hid_t, Ptr{Cuint}, Ptr{Cuint}, Ptr{Cuint}, Ptr{Cuint}), plist_id, + boot, freelist, stab, shhdr) var"#status#" < 0 && @h5error("Error in h5p_get_version (not annotated)") return nothing end @@ -2855,7 +3200,8 @@ end See `libhdf5` documentation for [`H5Pget_virtual_count`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_VIRTUAL_COUNT). """ function h5p_get_virtual_count(dcpl_id, count) - var"#status#" = ccall((:H5Pget_virtual_count, libhdf5), herr_t, (hid_t, Ptr{Csize_t}), dcpl_id, count) + var"#status#" = ccall((:H5Pget_virtual_count, libhdf5), herr_t, (hid_t, Ptr{Csize_t}), + dcpl_id, count) var"#status#" < 0 && @h5error("Error in h5p_get_virtual_count (not annotated)") return nothing end @@ -2866,7 +3212,8 @@ end See `libhdf5` documentation for [`H5Pget_virtual_dsetname`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_VIRTUAL_DSETNAME). """ function h5p_get_virtual_dsetname(dcpl_id, index, name, size) - var"#status#" = ccall((:H5Pget_virtual_dsetname, libhdf5), Cssize_t, (hid_t, Csize_t, Ptr{Cchar}, Csize_t), dcpl_id, index, name, size) + var"#status#" = ccall((:H5Pget_virtual_dsetname, libhdf5), Cssize_t, + (hid_t, Csize_t, Ptr{Cchar}, Csize_t), dcpl_id, index, name, size) var"#status#" < 0 && @h5error("Error in h5p_get_virtual_dsetname (not annotated)") return var"#status#" end @@ -2877,7 +3224,8 @@ end See `libhdf5` documentation for [`H5Pget_virtual_filename`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_VIRTUAL_FILENAME). """ function h5p_get_virtual_filename(dcpl_id, index, name, size) - var"#status#" = ccall((:H5Pget_virtual_filename, libhdf5), Cssize_t, (hid_t, Csize_t, Ptr{Cchar}, Csize_t), dcpl_id, index, name, size) + var"#status#" = ccall((:H5Pget_virtual_filename, libhdf5), Cssize_t, + (hid_t, Csize_t, Ptr{Cchar}, Csize_t), dcpl_id, index, name, size) var"#status#" < 0 && @h5error("Error in h5p_get_virtual_filename (not annotated)") return var"#status#" end @@ -2888,7 +3236,8 @@ end See `libhdf5` documentation for [`H5Pget_virtual_prefix`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_VIRTUAL_PREFIX). """ function h5p_get_virtual_prefix(dapl_id, prefix, size) - var"#status#" = ccall((:H5Pget_virtual_prefix, libhdf5), Cssize_t, (hid_t, Ptr{Cchar}, Csize_t), dapl_id, prefix, size) + var"#status#" = ccall((:H5Pget_virtual_prefix, libhdf5), Cssize_t, + (hid_t, Ptr{Cchar}, Csize_t), dapl_id, prefix, size) var"#status#" < 0 && @h5error("Error in h5p_get_virtual_prefix (not annotated)") return var"#status#" end @@ -2899,7 +3248,8 @@ end See `libhdf5` documentation for [`H5Pget_virtual_printf_gap`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_VIRTUAL_PRINTF_GAP). """ function h5p_get_virtual_printf_gap(dapl_id, gap_size) - var"#status#" = ccall((:H5Pget_virtual_printf_gap, libhdf5), herr_t, (hid_t, Ptr{hsize_t}), dapl_id, gap_size) + var"#status#" = ccall((:H5Pget_virtual_printf_gap, libhdf5), herr_t, + (hid_t, Ptr{hsize_t}), dapl_id, gap_size) var"#status#" < 0 && @h5error("Error in h5p_get_virtual_printf_gap (not annotated)") return nothing end @@ -2910,7 +3260,8 @@ end See `libhdf5` documentation for [`H5Pget_virtual_srcspace`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_VIRTUAL_SRCSPACE). """ function h5p_get_virtual_srcspace(dcpl_id, index) - var"#status#" = ccall((:H5Pget_virtual_srcspace, libhdf5), hid_t, (hid_t, Csize_t), dcpl_id, index) + var"#status#" = ccall((:H5Pget_virtual_srcspace, libhdf5), hid_t, (hid_t, Csize_t), + dcpl_id, index) var"#status#" < 0 && @h5error("Error in h5p_get_virtual_srcspace (not annotated)") return var"#status#" end @@ -2921,7 +3272,8 @@ end See `libhdf5` documentation for [`H5Pget_virtual_view`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_VIRTUAL_VIEW). """ function h5p_get_virtual_view(dapl_id, view) - var"#status#" = ccall((:H5Pget_virtual_view, libhdf5), herr_t, (hid_t, Ptr{H5D_vds_view_t}), dapl_id, view) + var"#status#" = ccall((:H5Pget_virtual_view, libhdf5), herr_t, + (hid_t, Ptr{H5D_vds_view_t}), dapl_id, view) var"#status#" < 0 && @h5error("Error in h5p_get_virtual_view (not annotated)") return nothing end @@ -2932,7 +3284,8 @@ end See `libhdf5` documentation for [`H5Pget_virtual_vspace`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_VIRTUAL_VSPACE). """ function h5p_get_virtual_vspace(dcpl_id, index) - var"#status#" = ccall((:H5Pget_virtual_vspace, libhdf5), hid_t, (hid_t, Csize_t), dcpl_id, index) + var"#status#" = ccall((:H5Pget_virtual_vspace, libhdf5), hid_t, (hid_t, Csize_t), + dcpl_id, index) var"#status#" < 0 && @h5error("Error in h5p_get_virtual_vspace (not annotated)") return var"#status#" end @@ -2943,7 +3296,10 @@ end See `libhdf5` documentation for [`H5Pget_vlen_mem_manager`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_VLEN_MEM_MANAGER). """ function h5p_get_vlen_mem_manager(plist_id, alloc_func, alloc_info, free_func, free_info) - var"#status#" = ccall((:H5Pget_vlen_mem_manager, libhdf5), herr_t, (hid_t, Ptr{H5MM_allocate_t}, Ptr{Ptr{Cvoid}}, Ptr{H5MM_free_t}, Ptr{Ptr{Cvoid}}), plist_id, alloc_func, alloc_info, free_func, free_info) + var"#status#" = ccall((:H5Pget_vlen_mem_manager, libhdf5), herr_t, + (hid_t, Ptr{H5MM_allocate_t}, Ptr{Ptr{Cvoid}}, Ptr{H5MM_free_t}, + Ptr{Ptr{Cvoid}}), plist_id, alloc_func, alloc_info, free_func, + free_info) var"#status#" < 0 && @h5error("Error in h5p_get_vlen_mem_manager (not annotated)") return nothing end @@ -2954,7 +3310,8 @@ end See `libhdf5` documentation for [`H5Pget_vol_id`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_VOL_ID). """ function h5p_get_vol_id(plist_id, vol_id) - var"#status#" = ccall((:H5Pget_vol_id, libhdf5), herr_t, (hid_t, Ptr{hid_t}), plist_id, vol_id) + var"#status#" = ccall((:H5Pget_vol_id, libhdf5), herr_t, (hid_t, Ptr{hid_t}), plist_id, + vol_id) var"#status#" < 0 && @h5error("Error in h5p_get_vol_id (not annotated)") return nothing end @@ -2965,7 +3322,8 @@ end See `libhdf5` documentation for [`H5Pget_vol_info`](https://portal.hdfgroup.org/display/HDF5/H5P_GET_VOL_INFO). """ function h5p_get_vol_info(plist_id, vol_info) - var"#status#" = ccall((:H5Pget_vol_info, libhdf5), herr_t, (hid_t, Ptr{Ptr{Cvoid}}), plist_id, vol_info) + var"#status#" = ccall((:H5Pget_vol_info, libhdf5), herr_t, (hid_t, Ptr{Ptr{Cvoid}}), + plist_id, vol_info) var"#status#" < 0 && @h5error("Error in h5p_get_vol_info (not annotated)") return nothing end @@ -2976,7 +3334,8 @@ end See `libhdf5` documentation for [`H5Pset`](https://portal.hdfgroup.org/display/HDF5/H5P_SET). """ function h5p_set(plist_id, name, value) - var"#status#" = ccall((:H5Pset, libhdf5), herr_t, (hid_t, Ptr{Cchar}, Ptr{Cvoid}), plist_id, name, value) + var"#status#" = ccall((:H5Pset, libhdf5), herr_t, (hid_t, Ptr{Cchar}, Ptr{Cvoid}), + plist_id, name, value) var"#status#" < 0 && @h5error("Error in h5p_set (not annotated)") return nothing end @@ -2987,7 +3346,8 @@ end See `libhdf5` documentation for [`H5Pset_alignment`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_ALIGNMENT). """ function h5p_set_alignment(plist_id, threshold, alignment) - var"#status#" = ccall((:H5Pset_alignment, libhdf5), herr_t, (hid_t, hsize_t, hsize_t), plist_id, threshold, alignment) + var"#status#" = ccall((:H5Pset_alignment, libhdf5), herr_t, (hid_t, hsize_t, hsize_t), + plist_id, threshold, alignment) var"#status#" < 0 && @h5error("Error setting alignment") return nothing end @@ -2998,7 +3358,8 @@ end See `libhdf5` documentation for [`H5Pset_alloc_time`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_ALLOC_TIME). """ function h5p_set_alloc_time(plist_id, alloc_time) - var"#status#" = ccall((:H5Pset_alloc_time, libhdf5), herr_t, (hid_t, Cint), plist_id, alloc_time) + var"#status#" = ccall((:H5Pset_alloc_time, libhdf5), herr_t, (hid_t, Cint), plist_id, + alloc_time) var"#status#" < 0 && @h5error("Error setting allocation timing") return nothing end @@ -3009,7 +3370,9 @@ end See `libhdf5` documentation for [`H5Pset_append_flush`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_APPEND_FLUSH). """ function h5p_set_append_flush(dapl_id, ndims, boundary, func, udata) - var"#status#" = ccall((:H5Pset_append_flush, libhdf5), herr_t, (hid_t, Cuint, Ptr{hsize_t}, H5D_append_cb_t, Ptr{Cvoid}), dapl_id, ndims, boundary, func, udata) + var"#status#" = ccall((:H5Pset_append_flush, libhdf5), herr_t, + (hid_t, Cuint, Ptr{hsize_t}, H5D_append_cb_t, Ptr{Cvoid}), + dapl_id, ndims, boundary, func, udata) var"#status#" < 0 && @h5error("Error in h5p_set_append_flush (not annotated)") return nothing end @@ -3020,7 +3383,8 @@ end See `libhdf5` documentation for [`H5Pset_attr_creation_order`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_ATTR_CREATION_ORDER). """ function h5p_set_attr_creation_order(plist_id, crt_order_flags) - var"#status#" = ccall((:H5Pset_attr_creation_order, libhdf5), herr_t, (hid_t, Cuint), plist_id, crt_order_flags) + var"#status#" = ccall((:H5Pset_attr_creation_order, libhdf5), herr_t, (hid_t, Cuint), + plist_id, crt_order_flags) var"#status#" < 0 && @h5error("Error setting attribute creation order") return nothing end @@ -3031,7 +3395,8 @@ end See `libhdf5` documentation for [`H5Pset_attr_phase_change`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_ATTR_PHASE_CHANGE). """ function h5p_set_attr_phase_change(plist_id, max_compact, min_dense) - var"#status#" = ccall((:H5Pset_attr_phase_change, libhdf5), herr_t, (hid_t, Cuint, Cuint), plist_id, max_compact, min_dense) + var"#status#" = ccall((:H5Pset_attr_phase_change, libhdf5), herr_t, + (hid_t, Cuint, Cuint), plist_id, max_compact, min_dense) var"#status#" < 0 && @h5error("Error in h5p_set_attr_phase_change (not annotated)") return nothing end @@ -3042,7 +3407,8 @@ end See `libhdf5` documentation for [`H5Pset_btree_ratios`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_BTREE_RATIOS). """ function h5p_set_btree_ratios(plist_id, left, middle, right) - var"#status#" = ccall((:H5Pset_btree_ratios, libhdf5), herr_t, (hid_t, Cdouble, Cdouble, Cdouble), plist_id, left, middle, right) + var"#status#" = ccall((:H5Pset_btree_ratios, libhdf5), herr_t, + (hid_t, Cdouble, Cdouble, Cdouble), plist_id, left, middle, right) var"#status#" < 0 && @h5error("Error in h5p_set_btree_ratios (not annotated)") return nothing end @@ -3053,7 +3419,9 @@ end See `libhdf5` documentation for [`H5Pset_buffer`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_BUFFER). """ function h5p_set_buffer(plist_id, size, tconv, bkg) - var"#status#" = ccall((:H5Pset_buffer, libhdf5), herr_t, (hid_t, Csize_t, Ptr{Cvoid}, Ptr{Cvoid}), plist_id, size, tconv, bkg) + var"#status#" = ccall((:H5Pset_buffer, libhdf5), herr_t, + (hid_t, Csize_t, Ptr{Cvoid}, Ptr{Cvoid}), plist_id, size, tconv, + bkg) var"#status#" < 0 && @h5error("Error in h5p_set_buffer (not annotated)") return nothing end @@ -3064,7 +3432,9 @@ end See `libhdf5` documentation for [`H5Pset_cache`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_CACHE). """ function h5p_set_cache(plist_id, mdc_nelmts, rdcc_nslots, rdcc_nbytes, rdcc_w0) - var"#status#" = ccall((:H5Pset_cache, libhdf5), herr_t, (hid_t, Cint, Csize_t, Csize_t, Cdouble), plist_id, mdc_nelmts, rdcc_nslots, rdcc_nbytes, rdcc_w0) + var"#status#" = ccall((:H5Pset_cache, libhdf5), herr_t, + (hid_t, Cint, Csize_t, Csize_t, Cdouble), plist_id, mdc_nelmts, + rdcc_nslots, rdcc_nbytes, rdcc_w0) var"#status#" < 0 && @h5error("Error in h5p_set_cache (not annotated)") return nothing end @@ -3075,7 +3445,8 @@ end See `libhdf5` documentation for [`H5Pset_char_encoding`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_CHAR_ENCODING). """ function h5p_set_char_encoding(plist_id, encoding) - var"#status#" = ccall((:H5Pset_char_encoding, libhdf5), herr_t, (hid_t, Cint), plist_id, encoding) + var"#status#" = ccall((:H5Pset_char_encoding, libhdf5), herr_t, (hid_t, Cint), plist_id, + encoding) var"#status#" < 0 && @h5error("Error setting char encoding") return nothing end @@ -3086,7 +3457,8 @@ end See `libhdf5` documentation for [`H5Pset_chunk`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_CHUNK). """ function h5p_set_chunk(plist_id, ndims, dims) - var"#status#" = ccall((:H5Pset_chunk, libhdf5), herr_t, (hid_t, Cint, Ptr{hsize_t}), plist_id, ndims, dims) + var"#status#" = ccall((:H5Pset_chunk, libhdf5), herr_t, (hid_t, Cint, Ptr{hsize_t}), + plist_id, ndims, dims) var"#status#" < 0 && @h5error("Error setting chunk size") return nothing end @@ -3097,7 +3469,9 @@ end See `libhdf5` documentation for [`H5Pset_chunk_cache`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_CHUNK_CACHE). """ function h5p_set_chunk_cache(dapl_id, rdcc_nslots, rdcc_nbytes, rdcc_w0) - var"#status#" = ccall((:H5Pset_chunk_cache, libhdf5), herr_t, (hid_t, Csize_t, Csize_t, Cdouble), dapl_id, rdcc_nslots, rdcc_nbytes, rdcc_w0) + var"#status#" = ccall((:H5Pset_chunk_cache, libhdf5), herr_t, + (hid_t, Csize_t, Csize_t, Cdouble), dapl_id, rdcc_nslots, + rdcc_nbytes, rdcc_w0) var"#status#" < 0 && @h5error("Error setting chunk cache") return nothing end @@ -3108,7 +3482,8 @@ end See `libhdf5` documentation for [`H5Pset_chunk_opts`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_CHUNK_OPTS). """ function h5p_set_chunk_opts(plist_id, opts) - var"#status#" = ccall((:H5Pset_chunk_opts, libhdf5), herr_t, (hid_t, Cuint), plist_id, opts) + var"#status#" = ccall((:H5Pset_chunk_opts, libhdf5), herr_t, (hid_t, Cuint), plist_id, + opts) var"#status#" < 0 && @h5error("Error in h5p_set_chunk_opts (not annotated)") return nothing end @@ -3119,7 +3494,8 @@ end See `libhdf5` documentation for [`H5Pset_copy_object`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_COPY_OBJECT). """ function h5p_set_copy_object(plist_id, copy_options) - var"#status#" = ccall((:H5Pset_copy_object, libhdf5), herr_t, (hid_t, Cuint), plist_id, copy_options) + var"#status#" = ccall((:H5Pset_copy_object, libhdf5), herr_t, (hid_t, Cuint), plist_id, + copy_options) var"#status#" < 0 && @h5error("Error in h5p_set_copy_object (not annotated)") return nothing end @@ -3130,7 +3506,8 @@ end See `libhdf5` documentation for [`H5Pset_core_write_tracking`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_CORE_WRITE_TRACKING). """ function h5p_set_core_write_tracking(fapl_id, is_enabled, page_size) - var"#status#" = ccall((:H5Pset_core_write_tracking, libhdf5), herr_t, (hid_t, hbool_t, Csize_t), fapl_id, is_enabled, page_size) + var"#status#" = ccall((:H5Pset_core_write_tracking, libhdf5), herr_t, + (hid_t, hbool_t, Csize_t), fapl_id, is_enabled, page_size) var"#status#" < 0 && @h5error("Error in h5p_set_core_write_tracking (not annotated)") return nothing end @@ -3141,7 +3518,8 @@ end See `libhdf5` documentation for [`H5Pset_create_intermediate_group`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_CREATE_INTERMEDIATE_GROUP). """ function h5p_set_create_intermediate_group(plist_id, setting) - var"#status#" = ccall((:H5Pset_create_intermediate_group, libhdf5), herr_t, (hid_t, Cuint), plist_id, setting) + var"#status#" = ccall((:H5Pset_create_intermediate_group, libhdf5), herr_t, + (hid_t, Cuint), plist_id, setting) var"#status#" < 0 && @h5error("Error setting create intermediate group") return nothing end @@ -3152,7 +3530,8 @@ end See `libhdf5` documentation for [`H5Pset_data_transform`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_DATA_TRANSFORM). """ function h5p_set_data_transform(plist_id, expression) - var"#status#" = ccall((:H5Pset_data_transform, libhdf5), herr_t, (hid_t, Ptr{Cchar}), plist_id, expression) + var"#status#" = ccall((:H5Pset_data_transform, libhdf5), herr_t, (hid_t, Ptr{Cchar}), + plist_id, expression) var"#status#" < 0 && @h5error("Error in h5p_set_data_transform (not annotated)") return nothing end @@ -3163,7 +3542,8 @@ end See `libhdf5` documentation for [`H5Pset_deflate`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_DEFLATE). """ function h5p_set_deflate(plist_id, setting) - var"#status#" = ccall((:H5Pset_deflate, libhdf5), herr_t, (hid_t, Cuint), plist_id, setting) + var"#status#" = ccall((:H5Pset_deflate, libhdf5), herr_t, (hid_t, Cuint), plist_id, + setting) var"#status#" < 0 && @h5error("Error setting compression method and level (deflate)") return nothing end @@ -3174,7 +3554,8 @@ end See `libhdf5` documentation for [`H5Pset_driver`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_DRIVER). """ function h5p_set_driver(plist_id, driver_id, driver_info) - var"#status#" = ccall((:H5Pset_driver, libhdf5), herr_t, (hid_t, hid_t, Ptr{Cvoid}), plist_id, driver_id, driver_info) + var"#status#" = ccall((:H5Pset_driver, libhdf5), herr_t, (hid_t, hid_t, Ptr{Cvoid}), + plist_id, driver_id, driver_info) var"#status#" < 0 && @h5error("Error in h5p_set_driver (not annotated)") return nothing end @@ -3185,7 +3566,8 @@ end See `libhdf5` documentation for [`H5Pset_dset_no_attrs_hint`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_DSET_NO_ATTRS_HINT). """ function h5p_set_dset_no_attrs_hint(dcpl_id, minimize) - var"#status#" = ccall((:H5Pset_dset_no_attrs_hint, libhdf5), herr_t, (hid_t, hbool_t), dcpl_id, minimize) + var"#status#" = ccall((:H5Pset_dset_no_attrs_hint, libhdf5), herr_t, (hid_t, hbool_t), + dcpl_id, minimize) var"#status#" < 0 && @h5error("Error in setting dataset no attributes hint property") return nothing end @@ -3196,7 +3578,8 @@ end See `libhdf5` documentation for [`H5Pset_dxpl_mpio`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_DXPL_MPIO). """ function h5p_set_dxpl_mpio(dxpl_id, xfer_mode) - var"#status#" = ccall((:H5Pset_dxpl_mpio, libhdf5), herr_t, (hid_t, Cint), dxpl_id, xfer_mode) + var"#status#" = ccall((:H5Pset_dxpl_mpio, libhdf5), herr_t, (hid_t, Cint), dxpl_id, + xfer_mode) var"#status#" < 0 && @h5error("Error setting MPIO transfer mode") return nothing end @@ -3207,7 +3590,8 @@ end See `libhdf5` documentation for [`H5Pset_edc_check`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_EDC_CHECK). """ function h5p_set_edc_check(plist_id, check) - var"#status#" = ccall((:H5Pset_edc_check, libhdf5), herr_t, (hid_t, H5Z_EDC_t), plist_id, check) + var"#status#" = ccall((:H5Pset_edc_check, libhdf5), herr_t, (hid_t, H5Z_EDC_t), + plist_id, check) var"#status#" < 0 && @h5error("Error in h5p_set_edc_check (not annotated)") return nothing end @@ -3218,7 +3602,8 @@ end See `libhdf5` documentation for [`H5Pset_efile_prefix`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_EFILE_PREFIX). """ function h5p_set_efile_prefix(plist_id, prefix) - var"#status#" = ccall((:H5Pset_efile_prefix, libhdf5), herr_t, (hid_t, Ptr{UInt8}), plist_id, prefix) + var"#status#" = ccall((:H5Pset_efile_prefix, libhdf5), herr_t, (hid_t, Ptr{UInt8}), + plist_id, prefix) var"#status#" < 0 && @h5error("Error setting external file prefix") return nothing end @@ -3229,7 +3614,8 @@ end See `libhdf5` documentation for [`H5Pset_elink_acc_flags`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_ELINK_ACC_FLAGS). """ function h5p_set_elink_acc_flags(lapl_id, flags) - var"#status#" = ccall((:H5Pset_elink_acc_flags, libhdf5), herr_t, (hid_t, Cuint), lapl_id, flags) + var"#status#" = ccall((:H5Pset_elink_acc_flags, libhdf5), herr_t, (hid_t, Cuint), + lapl_id, flags) var"#status#" < 0 && @h5error("Error in h5p_set_elink_acc_flags (not annotated)") return nothing end @@ -3240,7 +3626,8 @@ end See `libhdf5` documentation for [`H5Pset_elink_cb`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_ELINK_CB). """ function h5p_set_elink_cb(lapl_id, func, op_data) - var"#status#" = ccall((:H5Pset_elink_cb, libhdf5), herr_t, (hid_t, H5L_elink_traverse_t, Ptr{Cvoid}), lapl_id, func, op_data) + var"#status#" = ccall((:H5Pset_elink_cb, libhdf5), herr_t, + (hid_t, H5L_elink_traverse_t, Ptr{Cvoid}), lapl_id, func, op_data) var"#status#" < 0 && @h5error("Error in h5p_set_elink_cb (not annotated)") return nothing end @@ -3251,7 +3638,8 @@ end See `libhdf5` documentation for [`H5Pset_elink_fapl`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_ELINK_FAPL). """ function h5p_set_elink_fapl(lapl_id, fapl_id) - var"#status#" = ccall((:H5Pset_elink_fapl, libhdf5), herr_t, (hid_t, hid_t), lapl_id, fapl_id) + var"#status#" = ccall((:H5Pset_elink_fapl, libhdf5), herr_t, (hid_t, hid_t), lapl_id, + fapl_id) var"#status#" < 0 && @h5error("Error in h5p_set_elink_fapl (not annotated)") return nothing end @@ -3262,7 +3650,8 @@ end See `libhdf5` documentation for [`H5Pset_elink_file_cache_size`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_ELINK_FILE_CACHE_SIZE). """ function h5p_set_elink_file_cache_size(plist_id, efc_size) - var"#status#" = ccall((:H5Pset_elink_file_cache_size, libhdf5), herr_t, (hid_t, Cuint), plist_id, efc_size) + var"#status#" = ccall((:H5Pset_elink_file_cache_size, libhdf5), herr_t, (hid_t, Cuint), + plist_id, efc_size) var"#status#" < 0 && @h5error("Error in h5p_set_elink_file_cache_size (not annotated)") return nothing end @@ -3273,7 +3662,8 @@ end See `libhdf5` documentation for [`H5Pset_elink_prefix`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_ELINK_PREFIX). """ function h5p_set_elink_prefix(plist_id, prefix) - var"#status#" = ccall((:H5Pset_elink_prefix, libhdf5), herr_t, (hid_t, Ptr{Cchar}), plist_id, prefix) + var"#status#" = ccall((:H5Pset_elink_prefix, libhdf5), herr_t, (hid_t, Ptr{Cchar}), + plist_id, prefix) var"#status#" < 0 && @h5error("Error in h5p_set_elink_prefix (not annotated)") return nothing end @@ -3284,7 +3674,8 @@ end See `libhdf5` documentation for [`H5Pset_est_link_info`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_EST_LINK_INFO). """ function h5p_set_est_link_info(plist_id, est_num_entries, est_name_len) - var"#status#" = ccall((:H5Pset_est_link_info, libhdf5), herr_t, (hid_t, Cuint, Cuint), plist_id, est_num_entries, est_name_len) + var"#status#" = ccall((:H5Pset_est_link_info, libhdf5), herr_t, (hid_t, Cuint, Cuint), + plist_id, est_num_entries, est_name_len) var"#status#" < 0 && @h5error("Error in h5p_set_est_link_info (not annotated)") return nothing end @@ -3295,7 +3686,8 @@ end See `libhdf5` documentation for [`H5Pset_evict_on_close`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_EVICT_ON_CLOSE). """ function h5p_set_evict_on_close(fapl_id, evict_on_close) - var"#status#" = ccall((:H5Pset_evict_on_close, libhdf5), herr_t, (hid_t, hbool_t), fapl_id, evict_on_close) + var"#status#" = ccall((:H5Pset_evict_on_close, libhdf5), herr_t, (hid_t, hbool_t), + fapl_id, evict_on_close) var"#status#" < 0 && @h5error("Error in h5p_set_evict_on_close (not annotated)") return nothing end @@ -3306,7 +3698,8 @@ end See `libhdf5` documentation for [`H5Pset_external`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_EXTERNAL). """ function h5p_set_external(plist_id, name, offset, size) - var"#status#" = ccall((:H5Pset_external, libhdf5), herr_t, (hid_t, Ptr{Cchar}, off_t, hsize_t), plist_id, name, offset, size) + var"#status#" = ccall((:H5Pset_external, libhdf5), herr_t, + (hid_t, Ptr{Cchar}, off_t, hsize_t), plist_id, name, offset, size) var"#status#" < 0 && @h5error("Error setting external property") return nothing end @@ -3317,7 +3710,8 @@ end See `libhdf5` documentation for [`H5Pset_family_offset`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_FAMILY_OFFSET). """ function h5p_set_family_offset(fapl_id, offset) - var"#status#" = ccall((:H5Pset_family_offset, libhdf5), herr_t, (hid_t, hsize_t), fapl_id, offset) + var"#status#" = ccall((:H5Pset_family_offset, libhdf5), herr_t, (hid_t, hsize_t), + fapl_id, offset) var"#status#" < 0 && @h5error("Error in h5p_set_family_offset (not annotated)") return nothing end @@ -3328,7 +3722,8 @@ end See `libhdf5` documentation for [`H5Pset_fapl_core`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_FAPL_CORE). """ function h5p_set_fapl_core(fapl_id, increment, backing_store) - var"#status#" = ccall((:H5Pset_fapl_core, libhdf5), herr_t, (hid_t, Csize_t, hbool_t), fapl_id, increment, backing_store) + var"#status#" = ccall((:H5Pset_fapl_core, libhdf5), herr_t, (hid_t, Csize_t, hbool_t), + fapl_id, increment, backing_store) var"#status#" < 0 && @h5error("Error in h5p_set_fapl_core (not annotated)") return nothing end @@ -3339,7 +3734,8 @@ end See `libhdf5` documentation for [`H5Pset_fapl_family`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_FAPL_FAMILY). """ function h5p_set_fapl_family(fapl_id, memb_size, memb_fapl_id) - var"#status#" = ccall((:H5Pset_fapl_family, libhdf5), herr_t, (hid_t, hsize_t, hid_t), fapl_id, memb_size, memb_fapl_id) + var"#status#" = ccall((:H5Pset_fapl_family, libhdf5), herr_t, (hid_t, hsize_t, hid_t), + fapl_id, memb_size, memb_fapl_id) var"#status#" < 0 && @h5error("Error in h5p_set_fapl_family (not annotated)") return nothing end @@ -3350,7 +3746,8 @@ end See `libhdf5` documentation for [`H5Pset_fapl_hdfs`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_FAPL_HDFS). """ function h5p_set_fapl_hdfs(fapl_id, fa) - var"#status#" = ccall((:H5Pset_fapl_hdfs, libhdf5), herr_t, (hid_t, Ptr{H5FD_hdfs_fapl_t}), fapl_id, fa) + var"#status#" = ccall((:H5Pset_fapl_hdfs, libhdf5), herr_t, + (hid_t, Ptr{H5FD_hdfs_fapl_t}), fapl_id, fa) var"#status#" < 0 && @h5error("Error in h5p_set_fapl_hdfs (not annotated)") return nothing end @@ -3361,7 +3758,9 @@ end See `libhdf5` documentation for [`H5Pset_fapl_log`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_FAPL_LOG). """ function h5p_set_fapl_log(fapl_id, logfile, flags, buf_size) - var"#status#" = ccall((:H5Pset_fapl_log, libhdf5), herr_t, (hid_t, Ptr{Cchar}, Culonglong, Csize_t), fapl_id, logfile, flags, buf_size) + var"#status#" = ccall((:H5Pset_fapl_log, libhdf5), herr_t, + (hid_t, Ptr{Cchar}, Culonglong, Csize_t), fapl_id, logfile, flags, + buf_size) var"#status#" < 0 && @h5error("Error in h5p_set_fapl_log (not annotated)") return nothing end @@ -3372,7 +3771,8 @@ end See `libhdf5` documentation for [`H5Pset_fapl_mpio`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_FAPL_MPIO32). """ function h5p_set_fapl_mpio32(fapl_id, comm, info) - var"#status#" = ccall((:H5Pset_fapl_mpio, libhdf5), herr_t, (hid_t, Hmpih32, Hmpih32), fapl_id, comm, info) + var"#status#" = ccall((:H5Pset_fapl_mpio, libhdf5), herr_t, (hid_t, Hmpih32, Hmpih32), + fapl_id, comm, info) var"#status#" < 0 && @h5error("Error setting MPIO properties") return nothing end @@ -3383,7 +3783,8 @@ end See `libhdf5` documentation for [`H5Pset_fapl_mpio`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_FAPL_MPIO64). """ function h5p_set_fapl_mpio64(fapl_id, comm, info) - var"#status#" = ccall((:H5Pset_fapl_mpio, libhdf5), herr_t, (hid_t, Hmpih64, Hmpih64), fapl_id, comm, info) + var"#status#" = ccall((:H5Pset_fapl_mpio, libhdf5), herr_t, (hid_t, Hmpih64, Hmpih64), + fapl_id, comm, info) var"#status#" < 0 && @h5error("Error setting MPIO properties") return nothing end @@ -3394,7 +3795,10 @@ end See `libhdf5` documentation for [`H5Pset_fapl_multi`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_FAPL_MULTI). """ function h5p_set_fapl_multi(fapl_id, memb_map, memb_fapl, memb_name, memb_addr, relax) - var"#status#" = ccall((:H5Pset_fapl_multi, libhdf5), herr_t, (hid_t, Ptr{H5FD_mem_t}, Ptr{hid_t}, Ptr{Ptr{Cchar}}, Ptr{haddr_t}, hbool_t), fapl_id, memb_map, memb_fapl, memb_name, memb_addr, relax) + var"#status#" = ccall((:H5Pset_fapl_multi, libhdf5), herr_t, + (hid_t, Ptr{H5FD_mem_t}, Ptr{hid_t}, Ptr{Ptr{Cchar}}, + Ptr{haddr_t}, hbool_t), fapl_id, memb_map, memb_fapl, memb_name, + memb_addr, relax) var"#status#" < 0 && @h5error("Error in h5p_set_fapl_multi (not annotated)") return nothing end @@ -3416,7 +3820,9 @@ end See `libhdf5` documentation for [`H5Pset_fapl_split`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_FAPL_SPLIT). """ function h5p_set_fapl_split(fapl, meta_ext, meta_plist_id, raw_ext, raw_plist_id) - var"#status#" = ccall((:H5Pset_fapl_split, libhdf5), herr_t, (hid_t, Ptr{Cchar}, hid_t, Ptr{Cchar}, hid_t), fapl, meta_ext, meta_plist_id, raw_ext, raw_plist_id) + var"#status#" = ccall((:H5Pset_fapl_split, libhdf5), herr_t, + (hid_t, Ptr{Cchar}, hid_t, Ptr{Cchar}, hid_t), fapl, meta_ext, + meta_plist_id, raw_ext, raw_plist_id) var"#status#" < 0 && @h5error("Error in h5p_set_fapl_split (not annotated)") return nothing end @@ -3427,7 +3833,8 @@ end See `libhdf5` documentation for [`H5Pset_fapl_splitter`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_FAPL_SPLITTER). """ function h5p_set_fapl_splitter(fapl_id, config_ptr) - var"#status#" = ccall((:H5Pset_fapl_splitter, libhdf5), herr_t, (hid_t, Ptr{H5FD_splitter_vfd_config_t}), fapl_id, config_ptr) + var"#status#" = ccall((:H5Pset_fapl_splitter, libhdf5), herr_t, + (hid_t, Ptr{H5FD_splitter_vfd_config_t}), fapl_id, config_ptr) var"#status#" < 0 && @h5error("Error in h5p_set_fapl_splitter (not annotated)") return nothing end @@ -3460,7 +3867,8 @@ end See `libhdf5` documentation for [`H5Pset_fclose_degree`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_FCLOSE_DEGREE). """ function h5p_set_fclose_degree(plist_id, fc_degree) - var"#status#" = ccall((:H5Pset_fclose_degree, libhdf5), herr_t, (hid_t, Cint), plist_id, fc_degree) + var"#status#" = ccall((:H5Pset_fclose_degree, libhdf5), herr_t, (hid_t, Cint), plist_id, + fc_degree) var"#status#" < 0 && @h5error("Error setting close degree") return nothing end @@ -3471,7 +3879,8 @@ end See `libhdf5` documentation for [`H5Pset_file_image`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_FILE_IMAGE). """ function h5p_set_file_image(fapl_id, buf_ptr, buf_len) - var"#status#" = ccall((:H5Pset_file_image, libhdf5), herr_t, (hid_t, Ptr{Cvoid}, Csize_t), fapl_id, buf_ptr, buf_len) + var"#status#" = ccall((:H5Pset_file_image, libhdf5), herr_t, + (hid_t, Ptr{Cvoid}, Csize_t), fapl_id, buf_ptr, buf_len) var"#status#" < 0 && @h5error("Error in h5p_set_file_image (not annotated)") return nothing end @@ -3482,7 +3891,8 @@ end See `libhdf5` documentation for [`H5Pset_file_image_callbacks`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_FILE_IMAGE_CALLBACKS). """ function h5p_set_file_image_callbacks(fapl_id, callbacks_ptr) - var"#status#" = ccall((:H5Pset_file_image_callbacks, libhdf5), herr_t, (hid_t, Ptr{H5FD_file_image_callbacks_t}), fapl_id, callbacks_ptr) + var"#status#" = ccall((:H5Pset_file_image_callbacks, libhdf5), herr_t, + (hid_t, Ptr{H5FD_file_image_callbacks_t}), fapl_id, callbacks_ptr) var"#status#" < 0 && @h5error("Error in h5p_set_file_image_callbacks (not annotated)") return nothing end @@ -3493,7 +3903,9 @@ end See `libhdf5` documentation for [`H5Pset_file_locking`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_FILE_LOCKING). """ function h5p_set_file_locking(fapl_id, use_file_locking, ignore_when_disabled) - var"#status#" = ccall((:H5Pset_file_locking, libhdf5), herr_t, (hid_t, hbool_t, hbool_t), fapl_id, use_file_locking, ignore_when_disabled) + var"#status#" = ccall((:H5Pset_file_locking, libhdf5), herr_t, + (hid_t, hbool_t, hbool_t), fapl_id, use_file_locking, + ignore_when_disabled) var"#status#" < 0 && @h5error("Error in h5p_set_file_locking (not annotated)") return nothing end @@ -3504,7 +3916,9 @@ end See `libhdf5` documentation for [`H5Pset_file_space`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_FILE_SPACE). """ function h5p_set_file_space(plist_id, strategy, threshold) - var"#status#" = ccall((:H5Pset_file_space, libhdf5), herr_t, (hid_t, H5F_file_space_type_t, hsize_t), plist_id, strategy, threshold) + var"#status#" = ccall((:H5Pset_file_space, libhdf5), herr_t, + (hid_t, H5F_file_space_type_t, hsize_t), plist_id, strategy, + threshold) var"#status#" < 0 && @h5error("Error in h5p_set_file_space (not annotated)") return nothing end @@ -3515,7 +3929,8 @@ end See `libhdf5` documentation for [`H5Pset_file_space_page_size`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_FILE_SPACE_PAGE_SIZE). """ function h5p_set_file_space_page_size(plist_id, fsp_size) - var"#status#" = ccall((:H5Pset_file_space_page_size, libhdf5), herr_t, (hid_t, hsize_t), plist_id, fsp_size) + var"#status#" = ccall((:H5Pset_file_space_page_size, libhdf5), herr_t, (hid_t, hsize_t), + plist_id, fsp_size) var"#status#" < 0 && @h5error("Error in h5p_set_file_space_page_size (not annotated)") return nothing end @@ -3526,7 +3941,9 @@ end See `libhdf5` documentation for [`H5Pset_file_space_strategy`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_FILE_SPACE_STRATEGY). """ function h5p_set_file_space_strategy(plist_id, strategy, persist, threshold) - var"#status#" = ccall((:H5Pset_file_space_strategy, libhdf5), herr_t, (hid_t, H5F_fspace_strategy_t, hbool_t, hsize_t), plist_id, strategy, persist, threshold) + var"#status#" = ccall((:H5Pset_file_space_strategy, libhdf5), herr_t, + (hid_t, H5F_fspace_strategy_t, hbool_t, hsize_t), plist_id, + strategy, persist, threshold) var"#status#" < 0 && @h5error("Error in h5p_set_file_space_strategy (not annotated)") return nothing end @@ -3537,7 +3954,8 @@ end See `libhdf5` documentation for [`H5Pset_fill_time`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_FILL_TIME). """ function h5p_set_fill_time(plist_id, fill_time) - var"#status#" = ccall((:H5Pset_fill_time, libhdf5), herr_t, (hid_t, H5D_fill_time_t), plist_id, fill_time) + var"#status#" = ccall((:H5Pset_fill_time, libhdf5), herr_t, (hid_t, H5D_fill_time_t), + plist_id, fill_time) var"#status#" < 0 && @h5error("Error in h5p_set_fill_time (not annotated)") return nothing end @@ -3548,7 +3966,8 @@ end See `libhdf5` documentation for [`H5Pset_fill_value`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_FILL_VALUE). """ function h5p_set_fill_value(plist_id, type_id, value) - var"#status#" = ccall((:H5Pset_fill_value, libhdf5), herr_t, (hid_t, hid_t, Ptr{Cvoid}), plist_id, type_id, value) + var"#status#" = ccall((:H5Pset_fill_value, libhdf5), herr_t, (hid_t, hid_t, Ptr{Cvoid}), + plist_id, type_id, value) var"#status#" < 0 && @h5error("Error in h5p_set_fill_value (not annotated)") return nothing end @@ -3559,7 +3978,9 @@ end See `libhdf5` documentation for [`H5Pset_filter`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_FILTER). """ function h5p_set_filter(plist_id, filter_id, flags, cd_nelmts, cd_values) - var"#status#" = ccall((:H5Pset_filter, libhdf5), herr_t, (hid_t, H5Z_filter_t, Cuint, Csize_t, Ptr{Cuint}), plist_id, filter_id, flags, cd_nelmts, cd_values) + var"#status#" = ccall((:H5Pset_filter, libhdf5), herr_t, + (hid_t, H5Z_filter_t, Cuint, Csize_t, Ptr{Cuint}), plist_id, + filter_id, flags, cd_nelmts, cd_values) var"#status#" < 0 && @h5error("Error setting filter") return nothing end @@ -3570,7 +3991,8 @@ end See `libhdf5` documentation for [`H5Pset_filter_callback`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_FILTER_CALLBACK). """ function h5p_set_filter_callback(plist_id, func, op_data) - var"#status#" = ccall((:H5Pset_filter_callback, libhdf5), herr_t, (hid_t, H5Z_filter_func_t, Ptr{Cvoid}), plist_id, func, op_data) + var"#status#" = ccall((:H5Pset_filter_callback, libhdf5), herr_t, + (hid_t, H5Z_filter_func_t, Ptr{Cvoid}), plist_id, func, op_data) var"#status#" < 0 && @h5error("Error in h5p_set_filter_callback (not annotated)") return nothing end @@ -3592,7 +4014,8 @@ end See `libhdf5` documentation for [`H5Pset_gc_references`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_GC_REFERENCES). """ function h5p_set_gc_references(fapl_id, gc_ref) - var"#status#" = ccall((:H5Pset_gc_references, libhdf5), herr_t, (hid_t, Cuint), fapl_id, gc_ref) + var"#status#" = ccall((:H5Pset_gc_references, libhdf5), herr_t, (hid_t, Cuint), fapl_id, + gc_ref) var"#status#" < 0 && @h5error("Error in h5p_set_gc_references (not annotated)") return nothing end @@ -3603,7 +4026,8 @@ end See `libhdf5` documentation for [`H5Pset_hyper_vector_size`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_HYPER_VECTOR_SIZE). """ function h5p_set_hyper_vector_size(plist_id, size) - var"#status#" = ccall((:H5Pset_hyper_vector_size, libhdf5), herr_t, (hid_t, Csize_t), plist_id, size) + var"#status#" = ccall((:H5Pset_hyper_vector_size, libhdf5), herr_t, (hid_t, Csize_t), + plist_id, size) var"#status#" < 0 && @h5error("Error in h5p_set_hyper_vector_size (not annotated)") return nothing end @@ -3625,7 +4049,8 @@ end See `libhdf5` documentation for [`H5Pset_layout`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_LAYOUT). """ function h5p_set_layout(plist_id, setting) - var"#status#" = ccall((:H5Pset_layout, libhdf5), herr_t, (hid_t, Cint), plist_id, setting) + var"#status#" = ccall((:H5Pset_layout, libhdf5), herr_t, (hid_t, Cint), plist_id, + setting) var"#status#" < 0 && @h5error("Error setting layout") return nothing end @@ -3636,7 +4061,8 @@ end See `libhdf5` documentation for [`H5Pset_libver_bounds`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_LIBVER_BOUNDS). """ function h5p_set_libver_bounds(fapl_id, low, high) - var"#status#" = ccall((:H5Pset_libver_bounds, libhdf5), herr_t, (hid_t, Cint, Cint), fapl_id, low, high) + var"#status#" = ccall((:H5Pset_libver_bounds, libhdf5), herr_t, (hid_t, Cint, Cint), + fapl_id, low, high) var"#status#" < 0 && @h5error("Error setting library version bounds") return nothing end @@ -3647,7 +4073,8 @@ end See `libhdf5` documentation for [`H5Pset_link_creation_order`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_LINK_CREATION_ORDER). """ function h5p_set_link_creation_order(plist_id, crt_order_flags) - var"#status#" = ccall((:H5Pset_link_creation_order, libhdf5), herr_t, (hid_t, Cuint), plist_id, crt_order_flags) + var"#status#" = ccall((:H5Pset_link_creation_order, libhdf5), herr_t, (hid_t, Cuint), + plist_id, crt_order_flags) var"#status#" < 0 && @h5error("Error setting link creation order") return nothing end @@ -3658,7 +4085,8 @@ end See `libhdf5` documentation for [`H5Pset_link_phase_change`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_LINK_PHASE_CHANGE). """ function h5p_set_link_phase_change(plist_id, max_compact, min_dense) - var"#status#" = ccall((:H5Pset_link_phase_change, libhdf5), herr_t, (hid_t, Cuint, Cuint), plist_id, max_compact, min_dense) + var"#status#" = ccall((:H5Pset_link_phase_change, libhdf5), herr_t, + (hid_t, Cuint, Cuint), plist_id, max_compact, min_dense) var"#status#" < 0 && @h5error("Error in h5p_set_link_phase_change (not annotated)") return nothing end @@ -3669,7 +4097,8 @@ end See `libhdf5` documentation for [`H5Pset_local_heap_size_hint`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_LOCAL_HEAP_SIZE_HINT). """ function h5p_set_local_heap_size_hint(plist_id, size_hint) - var"#status#" = ccall((:H5Pset_local_heap_size_hint, libhdf5), herr_t, (hid_t, Csize_t), plist_id, size_hint) + var"#status#" = ccall((:H5Pset_local_heap_size_hint, libhdf5), herr_t, (hid_t, Csize_t), + plist_id, size_hint) var"#status#" < 0 && @h5error("Error setting local heap size hint") return nothing end @@ -3680,7 +4109,9 @@ end See `libhdf5` documentation for [`H5Pset_mcdt_search_cb`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_MCDT_SEARCH_CB). """ function h5p_set_mcdt_search_cb(plist_id, func, op_data) - var"#status#" = ccall((:H5Pset_mcdt_search_cb, libhdf5), herr_t, (hid_t, H5O_mcdt_search_cb_t, Ptr{Cvoid}), plist_id, func, op_data) + var"#status#" = ccall((:H5Pset_mcdt_search_cb, libhdf5), herr_t, + (hid_t, H5O_mcdt_search_cb_t, Ptr{Cvoid}), plist_id, func, + op_data) var"#status#" < 0 && @h5error("Error in h5p_set_mcdt_search_cb (not annotated)") return nothing end @@ -3691,7 +4122,8 @@ end See `libhdf5` documentation for [`H5Pset_mdc_config`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_MDC_CONFIG). """ function h5p_set_mdc_config(plist_id, config_ptr) - var"#status#" = ccall((:H5Pset_mdc_config, libhdf5), herr_t, (hid_t, Ptr{H5AC_cache_config_t}), plist_id, config_ptr) + var"#status#" = ccall((:H5Pset_mdc_config, libhdf5), herr_t, + (hid_t, Ptr{H5AC_cache_config_t}), plist_id, config_ptr) var"#status#" < 0 && @h5error("Error in h5p_set_mdc_config (not annotated)") return nothing end @@ -3702,7 +4134,8 @@ end See `libhdf5` documentation for [`H5Pset_mdc_image_config`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_MDC_IMAGE_CONFIG). """ function h5p_set_mdc_image_config(plist_id, config_ptr) - var"#status#" = ccall((:H5Pset_mdc_image_config, libhdf5), herr_t, (hid_t, Ptr{H5AC_cache_image_config_t}), plist_id, config_ptr) + var"#status#" = ccall((:H5Pset_mdc_image_config, libhdf5), herr_t, + (hid_t, Ptr{H5AC_cache_image_config_t}), plist_id, config_ptr) var"#status#" < 0 && @h5error("Error in h5p_set_mdc_image_config (not annotated)") return nothing end @@ -3713,7 +4146,9 @@ end See `libhdf5` documentation for [`H5Pset_mdc_log_options`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_MDC_LOG_OPTIONS). """ function h5p_set_mdc_log_options(plist_id, is_enabled, location, start_on_access) - var"#status#" = ccall((:H5Pset_mdc_log_options, libhdf5), herr_t, (hid_t, hbool_t, Ptr{Cchar}, hbool_t), plist_id, is_enabled, location, start_on_access) + var"#status#" = ccall((:H5Pset_mdc_log_options, libhdf5), herr_t, + (hid_t, hbool_t, Ptr{Cchar}, hbool_t), plist_id, is_enabled, + location, start_on_access) var"#status#" < 0 && @h5error("Error in h5p_set_mdc_log_options (not annotated)") return nothing end @@ -3724,7 +4159,8 @@ end See `libhdf5` documentation for [`H5Pset_meta_block_size`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_META_BLOCK_SIZE). """ function h5p_set_meta_block_size(fapl_id, size) - var"#status#" = ccall((:H5Pset_meta_block_size, libhdf5), herr_t, (hid_t, hsize_t), fapl_id, size) + var"#status#" = ccall((:H5Pset_meta_block_size, libhdf5), herr_t, (hid_t, hsize_t), + fapl_id, size) var"#status#" < 0 && @h5error("Error in h5p_set_meta_block_size (not annotated)") return nothing end @@ -3735,7 +4171,8 @@ end See `libhdf5` documentation for [`H5Pset_metadata_read_attempts`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_METADATA_READ_ATTEMPTS). """ function h5p_set_metadata_read_attempts(plist_id, attempts) - var"#status#" = ccall((:H5Pset_metadata_read_attempts, libhdf5), herr_t, (hid_t, Cuint), plist_id, attempts) + var"#status#" = ccall((:H5Pset_metadata_read_attempts, libhdf5), herr_t, (hid_t, Cuint), + plist_id, attempts) var"#status#" < 0 && @h5error("Error in h5p_set_metadata_read_attempts (not annotated)") return nothing end @@ -3746,7 +4183,8 @@ end See `libhdf5` documentation for [`H5Pset_multi_type`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_MULTI_TYPE). """ function h5p_set_multi_type(fapl_id, type) - var"#status#" = ccall((:H5Pset_multi_type, libhdf5), herr_t, (hid_t, H5FD_mem_t), fapl_id, type) + var"#status#" = ccall((:H5Pset_multi_type, libhdf5), herr_t, (hid_t, H5FD_mem_t), + fapl_id, type) var"#status#" < 0 && @h5error("Error in h5p_set_multi_type (not annotated)") return nothing end @@ -3768,7 +4206,8 @@ end See `libhdf5` documentation for [`H5Pset_nlinks`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_NLINKS). """ function h5p_set_nlinks(plist_id, nlinks) - var"#status#" = ccall((:H5Pset_nlinks, libhdf5), herr_t, (hid_t, Csize_t), plist_id, nlinks) + var"#status#" = ccall((:H5Pset_nlinks, libhdf5), herr_t, (hid_t, Csize_t), plist_id, + nlinks) var"#status#" < 0 && @h5error("Error in h5p_set_nlinks (not annotated)") return nothing end @@ -3779,7 +4218,8 @@ end See `libhdf5` documentation for [`H5Pset_obj_track_times`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_OBJ_TRACK_TIMES). """ function h5p_set_obj_track_times(plist_id, track_times) - var"#status#" = ccall((:H5Pset_obj_track_times, libhdf5), herr_t, (hid_t, UInt8), plist_id, track_times) + var"#status#" = ccall((:H5Pset_obj_track_times, libhdf5), herr_t, (hid_t, UInt8), + plist_id, track_times) var"#status#" < 0 && @h5error("Error setting object time tracking") return nothing end @@ -3790,7 +4230,8 @@ end See `libhdf5` documentation for [`H5Pset_object_flush_cb`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_OBJECT_FLUSH_CB). """ function h5p_set_object_flush_cb(plist_id, func, udata) - var"#status#" = ccall((:H5Pset_object_flush_cb, libhdf5), herr_t, (hid_t, H5F_flush_cb_t, Ptr{Cvoid}), plist_id, func, udata) + var"#status#" = ccall((:H5Pset_object_flush_cb, libhdf5), herr_t, + (hid_t, H5F_flush_cb_t, Ptr{Cvoid}), plist_id, func, udata) var"#status#" < 0 && @h5error("Error in h5p_set_object_flush_cb (not annotated)") return nothing end @@ -3801,7 +4242,9 @@ end See `libhdf5` documentation for [`H5Pset_page_buffer_size`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_PAGE_BUFFER_SIZE). """ function h5p_set_page_buffer_size(plist_id, buf_size, min_meta_per, min_raw_per) - var"#status#" = ccall((:H5Pset_page_buffer_size, libhdf5), herr_t, (hid_t, Csize_t, Cuint, Cuint), plist_id, buf_size, min_meta_per, min_raw_per) + var"#status#" = ccall((:H5Pset_page_buffer_size, libhdf5), herr_t, + (hid_t, Csize_t, Cuint, Cuint), plist_id, buf_size, min_meta_per, + min_raw_per) var"#status#" < 0 && @h5error("Error in h5p_set_page_buffer_size (not annotated)") return nothing end @@ -3812,7 +4255,8 @@ end See `libhdf5` documentation for [`H5Pset_preserve`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_PRESERVE). """ function h5p_set_preserve(plist_id, status) - var"#status#" = ccall((:H5Pset_preserve, libhdf5), herr_t, (hid_t, hbool_t), plist_id, status) + var"#status#" = ccall((:H5Pset_preserve, libhdf5), herr_t, (hid_t, hbool_t), plist_id, + status) var"#status#" < 0 && @h5error("Error in h5p_set_preserve (not annotated)") return nothing end @@ -3823,7 +4267,8 @@ end See `libhdf5` documentation for [`H5Pset_scaleoffset`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_SCALEOFFSET). """ function h5p_set_scaleoffset(plist_id, scale_type, scale_factor) - var"#status#" = ccall((:H5Pset_scaleoffset, libhdf5), herr_t, (hid_t, Cint, Cint), plist_id, scale_type, scale_factor) + var"#status#" = ccall((:H5Pset_scaleoffset, libhdf5), herr_t, (hid_t, Cint, Cint), + plist_id, scale_type, scale_factor) var"#status#" < 0 && @h5error("Error enabling szip filter") return nothing end @@ -3834,7 +4279,9 @@ end See `libhdf5` documentation for [`H5Pset_shared_mesg_index`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_SHARED_MESG_INDEX). """ function h5p_set_shared_mesg_index(plist_id, index_num, mesg_type_flags, min_mesg_size) - var"#status#" = ccall((:H5Pset_shared_mesg_index, libhdf5), herr_t, (hid_t, Cuint, Cuint, Cuint), plist_id, index_num, mesg_type_flags, min_mesg_size) + var"#status#" = ccall((:H5Pset_shared_mesg_index, libhdf5), herr_t, + (hid_t, Cuint, Cuint, Cuint), plist_id, index_num, + mesg_type_flags, min_mesg_size) var"#status#" < 0 && @h5error("Error in h5p_set_shared_mesg_index (not annotated)") return nothing end @@ -3845,7 +4292,8 @@ end See `libhdf5` documentation for [`H5Pset_shared_mesg_nindexes`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_SHARED_MESG_NINDEXES). """ function h5p_set_shared_mesg_nindexes(plist_id, nindexes) - var"#status#" = ccall((:H5Pset_shared_mesg_nindexes, libhdf5), herr_t, (hid_t, Cuint), plist_id, nindexes) + var"#status#" = ccall((:H5Pset_shared_mesg_nindexes, libhdf5), herr_t, (hid_t, Cuint), + plist_id, nindexes) var"#status#" < 0 && @h5error("Error in h5p_set_shared_mesg_nindexes (not annotated)") return nothing end @@ -3856,8 +4304,10 @@ end See `libhdf5` documentation for [`H5Pset_shared_mesg_phase_change`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_SHARED_MESG_PHASE_CHANGE). """ function h5p_set_shared_mesg_phase_change(plist_id, max_list, min_btree) - var"#status#" = ccall((:H5Pset_shared_mesg_phase_change, libhdf5), herr_t, (hid_t, Cuint, Cuint), plist_id, max_list, min_btree) - var"#status#" < 0 && @h5error("Error in h5p_set_shared_mesg_phase_change (not annotated)") + var"#status#" = ccall((:H5Pset_shared_mesg_phase_change, libhdf5), herr_t, + (hid_t, Cuint, Cuint), plist_id, max_list, min_btree) + var"#status#" < 0 && + @h5error("Error in h5p_set_shared_mesg_phase_change (not annotated)") return nothing end @@ -3878,7 +4328,8 @@ end See `libhdf5` documentation for [`H5Pset_sieve_buf_size`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_SIEVE_BUF_SIZE). """ function h5p_set_sieve_buf_size(fapl_id, size) - var"#status#" = ccall((:H5Pset_sieve_buf_size, libhdf5), herr_t, (hid_t, Csize_t), fapl_id, size) + var"#status#" = ccall((:H5Pset_sieve_buf_size, libhdf5), herr_t, (hid_t, Csize_t), + fapl_id, size) var"#status#" < 0 && @h5error("Error in h5p_set_sieve_buf_size (not annotated)") return nothing end @@ -3889,7 +4340,8 @@ end See `libhdf5` documentation for [`H5Pset_sizes`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_SIZES). """ function h5p_set_sizes(plist_id, sizeof_addr, sizeof_size) - var"#status#" = ccall((:H5Pset_sizes, libhdf5), herr_t, (hid_t, Csize_t, Csize_t), plist_id, sizeof_addr, sizeof_size) + var"#status#" = ccall((:H5Pset_sizes, libhdf5), herr_t, (hid_t, Csize_t, Csize_t), + plist_id, sizeof_addr, sizeof_size) var"#status#" < 0 && @h5error("Error in h5p_set_sizes (not annotated)") return nothing end @@ -3900,7 +4352,8 @@ end See `libhdf5` documentation for [`H5Pset_small_data_block_size`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_SMALL_DATA_BLOCK_SIZE). """ function h5p_set_small_data_block_size(fapl_id, size) - var"#status#" = ccall((:H5Pset_small_data_block_size, libhdf5), herr_t, (hid_t, hsize_t), fapl_id, size) + var"#status#" = ccall((:H5Pset_small_data_block_size, libhdf5), herr_t, + (hid_t, hsize_t), fapl_id, size) var"#status#" < 0 && @h5error("Error in h5p_set_small_data_block_size (not annotated)") return nothing end @@ -3911,7 +4364,8 @@ end See `libhdf5` documentation for [`H5Pset_sym_k`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_SYM_K). """ function h5p_set_sym_k(plist_id, ik, lk) - var"#status#" = ccall((:H5Pset_sym_k, libhdf5), herr_t, (hid_t, Cuint, Cuint), plist_id, ik, lk) + var"#status#" = ccall((:H5Pset_sym_k, libhdf5), herr_t, (hid_t, Cuint, Cuint), plist_id, + ik, lk) var"#status#" < 0 && @h5error("Error in h5p_set_sym_k (not annotated)") return nothing end @@ -3922,7 +4376,8 @@ end See `libhdf5` documentation for [`H5Pset_szip`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_SZIP). """ function h5p_set_szip(plist_id, options_mask, pixels_per_block) - var"#status#" = ccall((:H5Pset_szip, libhdf5), herr_t, (hid_t, Cuint, Cuint), plist_id, options_mask, pixels_per_block) + var"#status#" = ccall((:H5Pset_szip, libhdf5), herr_t, (hid_t, Cuint, Cuint), plist_id, + options_mask, pixels_per_block) var"#status#" < 0 && @h5error("Error enabling szip filter") return nothing end @@ -3933,7 +4388,9 @@ end See `libhdf5` documentation for [`H5Pset_type_conv_cb`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_TYPE_CONV_CB). """ function h5p_set_type_conv_cb(dxpl_id, op, operate_data) - var"#status#" = ccall((:H5Pset_type_conv_cb, libhdf5), herr_t, (hid_t, H5T_conv_except_func_t, Ptr{Cvoid}), dxpl_id, op, operate_data) + var"#status#" = ccall((:H5Pset_type_conv_cb, libhdf5), herr_t, + (hid_t, H5T_conv_except_func_t, Ptr{Cvoid}), dxpl_id, op, + operate_data) var"#status#" < 0 && @h5error("Error in h5p_set_type_conv_cb (not annotated)") return nothing end @@ -3944,7 +4401,8 @@ end See `libhdf5` documentation for [`H5Pset_userblock`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_USERBLOCK). """ function h5p_set_userblock(plist_id, len) - var"#status#" = ccall((:H5Pset_userblock, libhdf5), herr_t, (hid_t, hsize_t), plist_id, len) + var"#status#" = ccall((:H5Pset_userblock, libhdf5), herr_t, (hid_t, hsize_t), plist_id, + len) var"#status#" < 0 && @h5error("Error setting userblock") return nothing end @@ -3955,7 +4413,9 @@ end See `libhdf5` documentation for [`H5Pset_virtual`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_VIRTUAL). """ function h5p_set_virtual(dcpl_id, vspace_id, src_file_name, src_dset_name, src_space_id) - var"#status#" = ccall((:H5Pset_virtual, libhdf5), herr_t, (hid_t, hid_t, Ptr{UInt8}, Ptr{UInt8}, hid_t), dcpl_id, vspace_id, src_file_name, src_dset_name, src_space_id) + var"#status#" = ccall((:H5Pset_virtual, libhdf5), herr_t, + (hid_t, hid_t, Ptr{UInt8}, Ptr{UInt8}, hid_t), dcpl_id, vspace_id, + src_file_name, src_dset_name, src_space_id) var"#status#" < 0 && @h5error("Error setting virtual") return nothing end @@ -3966,7 +4426,8 @@ end See `libhdf5` documentation for [`H5Pset_virtual_prefix`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_VIRTUAL_PREFIX). """ function h5p_set_virtual_prefix(dapl_id, prefix) - var"#status#" = ccall((:H5Pset_virtual_prefix, libhdf5), herr_t, (hid_t, Ptr{Cchar}), dapl_id, prefix) + var"#status#" = ccall((:H5Pset_virtual_prefix, libhdf5), herr_t, (hid_t, Ptr{Cchar}), + dapl_id, prefix) var"#status#" < 0 && @h5error("Error in h5p_set_virtual_prefix (not annotated)") return nothing end @@ -3977,7 +4438,8 @@ end See `libhdf5` documentation for [`H5Pset_virtual_printf_gap`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_VIRTUAL_PRINTF_GAP). """ function h5p_set_virtual_printf_gap(dapl_id, gap_size) - var"#status#" = ccall((:H5Pset_virtual_printf_gap, libhdf5), herr_t, (hid_t, hsize_t), dapl_id, gap_size) + var"#status#" = ccall((:H5Pset_virtual_printf_gap, libhdf5), herr_t, (hid_t, hsize_t), + dapl_id, gap_size) var"#status#" < 0 && @h5error("Error in h5p_set_virtual_printf_gap (not annotated)") return nothing end @@ -3988,7 +4450,8 @@ end See `libhdf5` documentation for [`H5Pset_virtual_view`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_VIRTUAL_VIEW). """ function h5p_set_virtual_view(dapl_id, view) - var"#status#" = ccall((:H5Pset_virtual_view, libhdf5), herr_t, (hid_t, H5D_vds_view_t), dapl_id, view) + var"#status#" = ccall((:H5Pset_virtual_view, libhdf5), herr_t, (hid_t, H5D_vds_view_t), + dapl_id, view) var"#status#" < 0 && @h5error("Error in h5p_set_virtual_view (not annotated)") return nothing end @@ -3999,7 +4462,9 @@ end See `libhdf5` documentation for [`H5Pset_vlen_mem_manager`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_VLEN_MEM_MANAGER). """ function h5p_set_vlen_mem_manager(plist_id, alloc_func, alloc_info, free_func, free_info) - var"#status#" = ccall((:H5Pset_vlen_mem_manager, libhdf5), herr_t, (hid_t, H5MM_allocate_t, Ptr{Cvoid}, H5MM_free_t, Ptr{Cvoid}), plist_id, alloc_func, alloc_info, free_func, free_info) + var"#status#" = ccall((:H5Pset_vlen_mem_manager, libhdf5), herr_t, + (hid_t, H5MM_allocate_t, Ptr{Cvoid}, H5MM_free_t, Ptr{Cvoid}), + plist_id, alloc_func, alloc_info, free_func, free_info) var"#status#" < 0 && @h5error("Error in h5p_set_vlen_mem_manager (not annotated)") return nothing end @@ -4010,7 +4475,8 @@ end See `libhdf5` documentation for [`H5Pset_vol`](https://portal.hdfgroup.org/display/HDF5/H5P_SET_VOL). """ function h5p_set_vol(plist_id, new_vol_id, new_vol_info) - var"#status#" = ccall((:H5Pset_vol, libhdf5), herr_t, (hid_t, hid_t, Ptr{Cvoid}), plist_id, new_vol_id, new_vol_info) + var"#status#" = ccall((:H5Pset_vol, libhdf5), herr_t, (hid_t, hid_t, Ptr{Cvoid}), + plist_id, new_vol_id, new_vol_info) var"#status#" < 0 && @h5error("Error in h5p_set_vol (not annotated)") return nothing end @@ -4021,8 +4487,10 @@ end See `libhdf5` documentation for [`H5Padd_merge_committed_dtype_path`](https://portal.hdfgroup.org/display/HDF5/H5P_ADD_MERGE_COMMITTED_DTYPE_PATH). """ function h5p_add_merge_committed_dtype_path(plist_id, path) - var"#status#" = ccall((:H5Padd_merge_committed_dtype_path, libhdf5), herr_t, (hid_t, Ptr{Cchar}), plist_id, path) - var"#status#" < 0 && @h5error("Error in h5p_add_merge_committed_dtype_path (not annotated)") + var"#status#" = ccall((:H5Padd_merge_committed_dtype_path, libhdf5), herr_t, + (hid_t, Ptr{Cchar}), plist_id, path) + var"#status#" < 0 && + @h5error("Error in h5p_add_merge_committed_dtype_path (not annotated)") return nothing end @@ -4076,7 +4544,8 @@ end See `libhdf5` documentation for [`H5Pcopy_prop`](https://portal.hdfgroup.org/display/HDF5/H5P_COPY_PROP). """ function h5p_copy_prop(dst_id, src_id, name) - var"#status#" = ccall((:H5Pcopy_prop, libhdf5), herr_t, (hid_t, hid_t, Ptr{Cchar}), dst_id, src_id, name) + var"#status#" = ccall((:H5Pcopy_prop, libhdf5), herr_t, (hid_t, hid_t, Ptr{Cchar}), + dst_id, src_id, name) var"#status#" < 0 && @h5error("Error in h5p_copy_prop (not annotated)") return nothing end @@ -4097,8 +4566,13 @@ end See `libhdf5` documentation for [`H5Pcreate_class`](https://portal.hdfgroup.org/display/HDF5/H5P_CREATE_CLASS). """ -function h5p_create_class(parent, name, create, create_data, copy, copy_data, close, close_data) - var"#status#" = ccall((:H5Pcreate_class, libhdf5), hid_t, (hid_t, Ptr{Cchar}, H5P_cls_create_func_t, Ptr{Cvoid}, H5P_cls_copy_func_t, Ptr{Cvoid}, H5P_cls_close_func_t, Ptr{Cvoid}), parent, name, create, create_data, copy, copy_data, close, close_data) +function h5p_create_class(parent, name, create, create_data, copy, copy_data, close, + close_data) + var"#status#" = ccall((:H5Pcreate_class, libhdf5), hid_t, + (hid_t, Ptr{Cchar}, H5P_cls_create_func_t, Ptr{Cvoid}, + H5P_cls_copy_func_t, Ptr{Cvoid}, H5P_cls_close_func_t, + Ptr{Cvoid}), parent, name, create, create_data, copy, copy_data, + close, close_data) var"#status#" < 0 && @h5error("Error in h5p_create_class (not annotated)") return var"#status#" end @@ -4120,7 +4594,8 @@ end See `libhdf5` documentation for [`H5Pencode1`](https://portal.hdfgroup.org/display/HDF5/H5P_ENCODE1). """ function h5p_encode(plist_id, buf, nalloc) - var"#status#" = ccall((:H5Pencode1, libhdf5), herr_t, (hid_t, Ptr{Cvoid}, Ptr{Csize_t}), plist_id, buf, nalloc) + var"#status#" = ccall((:H5Pencode1, libhdf5), herr_t, (hid_t, Ptr{Cvoid}, Ptr{Csize_t}), + plist_id, buf, nalloc) var"#status#" < 0 && @h5error("Error in h5p_encode1 (not annotated)") return nothing end @@ -4131,7 +4606,9 @@ end See `libhdf5` documentation for [`H5Pencode2`](https://portal.hdfgroup.org/display/HDF5/H5P_ENCODE2). """ function h5p_encode(plist_id, buf, nalloc, fapl_id) - var"#status#" = ccall((:H5Pencode2, libhdf5), herr_t, (hid_t, Ptr{Cvoid}, Ptr{Csize_t}, hid_t), plist_id, buf, nalloc, fapl_id) + var"#status#" = ccall((:H5Pencode2, libhdf5), herr_t, + (hid_t, Ptr{Cvoid}, Ptr{Csize_t}, hid_t), plist_id, buf, nalloc, + fapl_id) var"#status#" < 0 && @h5error("Error in h5p_encode2 (not annotated)") return nothing end @@ -4164,7 +4641,8 @@ end See `libhdf5` documentation for [`H5Pfill_value_defined`](https://portal.hdfgroup.org/display/HDF5/H5P_FILL_VALUE_DEFINED). """ function h5p_fill_value_defined(plist, status) - var"#status#" = ccall((:H5Pfill_value_defined, libhdf5), herr_t, (hid_t, Ptr{H5D_fill_value_t}), plist, status) + var"#status#" = ccall((:H5Pfill_value_defined, libhdf5), herr_t, + (hid_t, Ptr{H5D_fill_value_t}), plist, status) var"#status#" < 0 && @h5error("Error in h5p_fill_value_defined (not annotated)") return nothing end @@ -4175,8 +4653,10 @@ end See `libhdf5` documentation for [`H5Pfree_merge_committed_dtype_paths`](https://portal.hdfgroup.org/display/HDF5/H5P_FREE_MERGE_COMMITTED_DTYPE_PATHS). """ function h5p_free_merge_committed_dtype_paths(plist_id) - var"#status#" = ccall((:H5Pfree_merge_committed_dtype_paths, libhdf5), herr_t, (hid_t,), plist_id) - var"#status#" < 0 && @h5error("Error in h5p_free_merge_committed_dtype_paths (not annotated)") + var"#status#" = ccall((:H5Pfree_merge_committed_dtype_paths, libhdf5), herr_t, (hid_t,), + plist_id) + var"#status#" < 0 && + @h5error("Error in h5p_free_merge_committed_dtype_paths (not annotated)") return nothing end @@ -4185,8 +4665,13 @@ end See `libhdf5` documentation for [`H5Pinsert1`](https://portal.hdfgroup.org/display/HDF5/H5P_INSERT1). """ -function h5p_insert(plist_id, name, size, value, prp_set, prp_get, prp_delete, prp_copy, prp_close) - var"#status#" = ccall((:H5Pinsert1, libhdf5), herr_t, (hid_t, Ptr{Cchar}, Csize_t, Ptr{Cvoid}, H5P_prp_set_func_t, H5P_prp_get_func_t, H5P_prp_delete_func_t, H5P_prp_copy_func_t, H5P_prp_close_func_t), plist_id, name, size, value, prp_set, prp_get, prp_delete, prp_copy, prp_close) +function h5p_insert(plist_id, name, size, value, prp_set, prp_get, prp_delete, prp_copy, + prp_close) + var"#status#" = ccall((:H5Pinsert1, libhdf5), herr_t, + (hid_t, Ptr{Cchar}, Csize_t, Ptr{Cvoid}, H5P_prp_set_func_t, + H5P_prp_get_func_t, H5P_prp_delete_func_t, H5P_prp_copy_func_t, + H5P_prp_close_func_t), plist_id, name, size, value, prp_set, + prp_get, prp_delete, prp_copy, prp_close) var"#status#" < 0 && @h5error("Error in h5p_insert1 (not annotated)") return nothing end @@ -4197,7 +4682,11 @@ end See `libhdf5` documentation for [`H5Pinsert2`](https://portal.hdfgroup.org/display/HDF5/H5P_INSERT2). """ function h5p_insert(plist_id, name, size, value, set, get, prp_del, copy, compare, close) - var"#status#" = ccall((:H5Pinsert2, libhdf5), herr_t, (hid_t, Ptr{Cchar}, Csize_t, Ptr{Cvoid}, H5P_prp_set_func_t, H5P_prp_get_func_t, H5P_prp_delete_func_t, H5P_prp_copy_func_t, H5P_prp_compare_func_t, H5P_prp_close_func_t), plist_id, name, size, value, set, get, prp_del, copy, compare, close) + var"#status#" = ccall((:H5Pinsert2, libhdf5), herr_t, + (hid_t, Ptr{Cchar}, Csize_t, Ptr{Cvoid}, H5P_prp_set_func_t, + H5P_prp_get_func_t, H5P_prp_delete_func_t, H5P_prp_copy_func_t, + H5P_prp_compare_func_t, H5P_prp_close_func_t), plist_id, name, + size, value, set, get, prp_del, copy, compare, close) var"#status#" < 0 && @h5error("Error in h5p_insert2 (not annotated)") return nothing end @@ -4208,7 +4697,8 @@ end See `libhdf5` documentation for [`H5Pisa_class`](https://portal.hdfgroup.org/display/HDF5/H5P_ISA_CLASS). """ function h5p_isa_class(plist_id, pclass_id) - var"#status#" = ccall((:H5Pisa_class, libhdf5), htri_t, (hid_t, hid_t), plist_id, pclass_id) + var"#status#" = ccall((:H5Pisa_class, libhdf5), htri_t, (hid_t, hid_t), plist_id, + pclass_id) var"#status#" < 0 && @h5error("Error in h5p_isa_class (not annotated)") return var"#status#" > 0 end @@ -4219,7 +4709,9 @@ end See `libhdf5` documentation for [`H5Piterate`](https://portal.hdfgroup.org/display/HDF5/H5P_ITERATE). """ function h5p_iterate(id, idx, iter_func, iter_data) - var"#status#" = ccall((:H5Piterate, libhdf5), Cint, (hid_t, Ptr{Cint}, H5P_iterate_t, Ptr{Cvoid}), id, idx, iter_func, iter_data) + var"#status#" = ccall((:H5Piterate, libhdf5), Cint, + (hid_t, Ptr{Cint}, H5P_iterate_t, Ptr{Cvoid}), id, idx, iter_func, + iter_data) var"#status#" < 0 && @h5error("Error in h5p_iterate (not annotated)") return Int(var"#status#") end @@ -4230,7 +4722,9 @@ end See `libhdf5` documentation for [`H5Pmodify_filter`](https://portal.hdfgroup.org/display/HDF5/H5P_MODIFY_FILTER). """ function h5p_modify_filter(plist_id, filter_id, flags, cd_nelmts, cd_values) - var"#status#" = ccall((:H5Pmodify_filter, libhdf5), herr_t, (hid_t, H5Z_filter_t, Cuint, Csize_t, Ptr{Cuint}), plist_id, filter_id, flags, cd_nelmts, cd_values) + var"#status#" = ccall((:H5Pmodify_filter, libhdf5), herr_t, + (hid_t, H5Z_filter_t, Cuint, Csize_t, Ptr{Cuint}), plist_id, + filter_id, flags, cd_nelmts, cd_values) var"#status#" < 0 && @h5error("Error modifying filter") return nothing end @@ -4240,8 +4734,14 @@ end See `libhdf5` documentation for [`H5Pregister1`](https://portal.hdfgroup.org/display/HDF5/H5P_REGISTER1). """ -function h5p_register(cls_id, name, size, def_value, prp_create, prp_set, prp_get, prp_del, prp_copy, prp_close) - var"#status#" = ccall((:H5Pregister1, libhdf5), herr_t, (hid_t, Ptr{Cchar}, Csize_t, Ptr{Cvoid}, H5P_prp_create_func_t, H5P_prp_set_func_t, H5P_prp_get_func_t, H5P_prp_delete_func_t, H5P_prp_copy_func_t, H5P_prp_close_func_t), cls_id, name, size, def_value, prp_create, prp_set, prp_get, prp_del, prp_copy, prp_close) +function h5p_register(cls_id, name, size, def_value, prp_create, prp_set, prp_get, prp_del, + prp_copy, prp_close) + var"#status#" = ccall((:H5Pregister1, libhdf5), herr_t, + (hid_t, Ptr{Cchar}, Csize_t, Ptr{Cvoid}, H5P_prp_create_func_t, + H5P_prp_set_func_t, H5P_prp_get_func_t, H5P_prp_delete_func_t, + H5P_prp_copy_func_t, H5P_prp_close_func_t), cls_id, name, size, + def_value, prp_create, prp_set, prp_get, prp_del, prp_copy, + prp_close) var"#status#" < 0 && @h5error("Error in h5p_register1 (not annotated)") return nothing end @@ -4251,8 +4751,14 @@ end See `libhdf5` documentation for [`H5Pregister2`](https://portal.hdfgroup.org/display/HDF5/H5P_REGISTER2). """ -function h5p_register(cls_id, name, size, def_value, create, set, get, prp_del, copy, compare, close) - var"#status#" = ccall((:H5Pregister2, libhdf5), herr_t, (hid_t, Ptr{Cchar}, Csize_t, Ptr{Cvoid}, H5P_prp_create_func_t, H5P_prp_set_func_t, H5P_prp_get_func_t, H5P_prp_delete_func_t, H5P_prp_copy_func_t, H5P_prp_compare_func_t, H5P_prp_close_func_t), cls_id, name, size, def_value, create, set, get, prp_del, copy, compare, close) +function h5p_register(cls_id, name, size, def_value, create, set, get, prp_del, copy, + compare, close) + var"#status#" = ccall((:H5Pregister2, libhdf5), herr_t, + (hid_t, Ptr{Cchar}, Csize_t, Ptr{Cvoid}, H5P_prp_create_func_t, + H5P_prp_set_func_t, H5P_prp_get_func_t, H5P_prp_delete_func_t, + H5P_prp_copy_func_t, H5P_prp_compare_func_t, + H5P_prp_close_func_t), cls_id, name, size, def_value, create, + set, get, prp_del, copy, compare, close) var"#status#" < 0 && @h5error("Error in h5p_register2 (not annotated)") return nothing end @@ -4263,7 +4769,8 @@ end See `libhdf5` documentation for [`H5Premove`](https://portal.hdfgroup.org/display/HDF5/H5P_REMOVE). """ function h5p_remove(plist_id, name) - var"#status#" = ccall((:H5Premove, libhdf5), herr_t, (hid_t, Ptr{Cchar}), plist_id, name) + var"#status#" = ccall((:H5Premove, libhdf5), herr_t, (hid_t, Ptr{Cchar}), plist_id, + name) var"#status#" < 0 && @h5error("Error in h5p_remove (not annotated)") return nothing end @@ -4274,7 +4781,8 @@ end See `libhdf5` documentation for [`H5Premove_filter`](https://portal.hdfgroup.org/display/HDF5/H5P_REMOVE_FILTER). """ function h5p_remove_filter(plist_id, filter_id) - var"#status#" = ccall((:H5Premove_filter, libhdf5), herr_t, (hid_t, H5Z_filter_t), plist_id, filter_id) + var"#status#" = ccall((:H5Premove_filter, libhdf5), herr_t, (hid_t, H5Z_filter_t), + plist_id, filter_id) var"#status#" < 0 && @h5error("Error removing filter") return nothing end @@ -4285,7 +4793,8 @@ end See `libhdf5` documentation for [`H5Punregister`](https://portal.hdfgroup.org/display/HDF5/H5P_UNREGISTER). """ function h5p_unregister(pclass_id, name) - var"#status#" = ccall((:H5Punregister, libhdf5), herr_t, (hid_t, Ptr{Cchar}), pclass_id, name) + var"#status#" = ccall((:H5Punregister, libhdf5), herr_t, (hid_t, Ptr{Cchar}), pclass_id, + name) var"#status#" < 0 && @h5error("Error in h5p_unregister (not annotated)") return nothing end @@ -4296,7 +4805,8 @@ end See `libhdf5` documentation for [`H5PLset_loading_state`](https://portal.hdfgroup.org/display/HDF5/H5PL_SET_LOADING_STATE). """ function h5pl_set_loading_state(plugin_control_mask) - var"#status#" = ccall((:H5PLset_loading_state, libhdf5), herr_t, (Cuint,), plugin_control_mask) + var"#status#" = ccall((:H5PLset_loading_state, libhdf5), herr_t, (Cuint,), + plugin_control_mask) var"#status#" < 0 && @h5error("Error setting plugin loading state") return nothing end @@ -4307,7 +4817,8 @@ end See `libhdf5` documentation for [`H5PLget_loading_state`](https://portal.hdfgroup.org/display/HDF5/H5PL_GET_LOADING_STATE). """ function h5pl_get_loading_state(plugin_control_mask) - var"#status#" = ccall((:H5PLget_loading_state, libhdf5), herr_t, (Ptr{Cuint},), plugin_control_mask) + var"#status#" = ccall((:H5PLget_loading_state, libhdf5), herr_t, (Ptr{Cuint},), + plugin_control_mask) var"#status#" < 0 && @h5error("Error getting plugin loading state") return nothing end @@ -4340,7 +4851,8 @@ end See `libhdf5` documentation for [`H5PLreplace`](https://portal.hdfgroup.org/display/HDF5/H5PL_REPLACE). """ function h5pl_replace(search_path, index) - var"#status#" = ccall((:H5PLreplace, libhdf5), herr_t, (Ptr{Cchar}, Cuint), search_path, index) + var"#status#" = ccall((:H5PLreplace, libhdf5), herr_t, (Ptr{Cchar}, Cuint), search_path, + index) var"#status#" < 0 && @h5error("Error replacing plugin path") return nothing end @@ -4351,7 +4863,8 @@ end See `libhdf5` documentation for [`H5PLinsert`](https://portal.hdfgroup.org/display/HDF5/H5PL_INSERT). """ function h5pl_insert(search_path, index) - var"#status#" = ccall((:H5PLinsert, libhdf5), herr_t, (Ptr{Cchar}, Cuint), search_path, index) + var"#status#" = ccall((:H5PLinsert, libhdf5), herr_t, (Ptr{Cchar}, Cuint), search_path, + index) var"#status#" < 0 && @h5error("Error inserting plugin path") return nothing end @@ -4373,7 +4886,8 @@ end See `libhdf5` documentation for [`H5PLget`](https://portal.hdfgroup.org/display/HDF5/H5PL_GET). """ function h5pl_get(index, path_buf, buf_size) - var"#status#" = ccall((:H5PLget, libhdf5), Cssize_t, (Cuint, Ptr{Cchar}, Csize_t), index, path_buf, buf_size) + var"#status#" = ccall((:H5PLget, libhdf5), Cssize_t, (Cuint, Ptr{Cchar}, Csize_t), + index, path_buf, buf_size) var"#status#" < 0 && @h5error("Error getting plugin path") return var"#status#" end @@ -4395,8 +4909,12 @@ end See `libhdf5` documentation for [`H5Rcreate`](https://portal.hdfgroup.org/display/HDF5/H5R_CREATE). """ function h5r_create(ref, loc_id, pathname, ref_type, space_id) - var"#status#" = ccall((:H5Rcreate, libhdf5), herr_t, (Ptr{Cvoid}, hid_t, Ptr{UInt8}, Cint, hid_t), ref, loc_id, pathname, ref_type, space_id) - var"#status#" < 0 && @h5error(string("Error creating reference to object ", h5i_get_name(loc_id), "/", pathname)) + var"#status#" = ccall((:H5Rcreate, libhdf5), herr_t, + (Ptr{Cvoid}, hid_t, Ptr{UInt8}, Cint, hid_t), ref, loc_id, + pathname, ref_type, space_id) + var"#status#" < 0 && + @h5error(string("Error creating reference to object ", h5i_get_name(loc_id), "/", + pathname)) return nothing end @@ -4406,7 +4924,8 @@ end See `libhdf5` documentation for [`H5Rdereference2`](https://portal.hdfgroup.org/display/HDF5/H5R_DEREFERENCE2). """ function h5r_dereference(obj_id, oapl_id, ref_type, ref) - var"#status#" = ccall((:H5Rdereference2, libhdf5), hid_t, (hid_t, hid_t, Cint, Ptr{Cvoid}), obj_id, oapl_id, ref_type, ref) + var"#status#" = ccall((:H5Rdereference2, libhdf5), hid_t, + (hid_t, hid_t, Cint, Ptr{Cvoid}), obj_id, oapl_id, ref_type, ref) var"#status#" < 0 && @h5error("Error dereferencing object") return var"#status#" end @@ -4417,7 +4936,9 @@ end See `libhdf5` documentation for [`H5Rget_obj_type2`](https://portal.hdfgroup.org/display/HDF5/H5R_GET_OBJ_TYPE2). """ function h5r_get_obj_type(loc_id, ref_type, ref, obj_type) - var"#status#" = ccall((:H5Rget_obj_type2, libhdf5), herr_t, (hid_t, Cint, Ptr{Cvoid}, Ptr{Cint}), loc_id, ref_type, ref, obj_type) + var"#status#" = ccall((:H5Rget_obj_type2, libhdf5), herr_t, + (hid_t, Cint, Ptr{Cvoid}, Ptr{Cint}), loc_id, ref_type, ref, + obj_type) var"#status#" < 0 && @h5error("Error getting object type") return nothing end @@ -4428,7 +4949,8 @@ end See `libhdf5` documentation for [`H5Rget_region`](https://portal.hdfgroup.org/display/HDF5/H5R_GET_REGION). """ function h5r_get_region(loc_id, ref_type, ref) - var"#status#" = ccall((:H5Rget_region, libhdf5), hid_t, (hid_t, Cint, Ptr{Cvoid}), loc_id, ref_type, ref) + var"#status#" = ccall((:H5Rget_region, libhdf5), hid_t, (hid_t, Cint, Ptr{Cvoid}), + loc_id, ref_type, ref) var"#status#" < 0 && @h5error("Error getting region from reference") return var"#status#" end @@ -4451,7 +4973,8 @@ end See `libhdf5` documentation for [`H5Scombine_select`](https://portal.hdfgroup.org/display/HDF5/H5S_COMBINE_SELECT). """ function h5s_combine_select(space1_id, op, space2_id) - var"#status#" = ccall((:H5Scombine_select, libhdf5), hid_t, (hid_t, Cint, hid_t), space1_id, op, space2_id) + var"#status#" = ccall((:H5Scombine_select, libhdf5), hid_t, (hid_t, Cint, hid_t), + space1_id, op, space2_id) var"#status#" < 0 && @h5error("Error combining dataspaces") return var"#status#" end @@ -4485,7 +5008,9 @@ end See `libhdf5` documentation for [`H5Screate_simple`](https://portal.hdfgroup.org/display/HDF5/H5S_CREATE_SIMPLE). """ function h5s_create_simple(rank, current_dims, maximum_dims) - var"#status#" = ccall((:H5Screate_simple, libhdf5), hid_t, (Cint, Ptr{hsize_t}, Ptr{hsize_t}), rank, current_dims, maximum_dims) + var"#status#" = ccall((:H5Screate_simple, libhdf5), hid_t, + (Cint, Ptr{hsize_t}, Ptr{hsize_t}), rank, current_dims, + maximum_dims) var"#status#" < 0 && @h5error("Error creating simple dataspace") return var"#status#" end @@ -4496,7 +5021,8 @@ end See `libhdf5` documentation for [`H5Sextent_equal`](https://portal.hdfgroup.org/display/HDF5/H5S_EXTENT_EQUAL). """ function h5s_extent_equal(space1_id, space2_id) - var"#status#" = ccall((:H5Sextent_equal, libhdf5), htri_t, (hid_t, hid_t), space1_id, space2_id) + var"#status#" = ccall((:H5Sextent_equal, libhdf5), htri_t, (hid_t, hid_t), space1_id, + space2_id) var"#status#" < 0 && @h5error("Error comparing dataspaces") return var"#status#" > 0 end @@ -4507,7 +5033,9 @@ end See `libhdf5` documentation for [`H5Sget_regular_hyperslab`](https://portal.hdfgroup.org/display/HDF5/H5S_GET_REGULAR_HYPERSLAB). """ function h5s_get_regular_hyperslab(space_id, start, stride, count, block) - var"#status#" = ccall((:H5Sget_regular_hyperslab, libhdf5), herr_t, (hid_t, Ptr{hsize_t}, Ptr{hsize_t}, Ptr{hsize_t}, Ptr{hsize_t}), space_id, start, stride, count, block) + var"#status#" = ccall((:H5Sget_regular_hyperslab, libhdf5), herr_t, + (hid_t, Ptr{hsize_t}, Ptr{hsize_t}, Ptr{hsize_t}, Ptr{hsize_t}), + space_id, start, stride, count, block) var"#status#" < 0 && @h5error("Error getting regular hyperslab selection") return nothing end @@ -4518,7 +5046,8 @@ end See `libhdf5` documentation for [`H5Sget_simple_extent_dims`](https://portal.hdfgroup.org/display/HDF5/H5S_GET_SIMPLE_EXTENT_DIMS). """ function h5s_get_simple_extent_dims(space_id, dims, maxdims) - var"#status#" = ccall((:H5Sget_simple_extent_dims, libhdf5), Cint, (hid_t, Ptr{hsize_t}, Ptr{hsize_t}), space_id, dims, maxdims) + var"#status#" = ccall((:H5Sget_simple_extent_dims, libhdf5), Cint, + (hid_t, Ptr{hsize_t}, Ptr{hsize_t}), space_id, dims, maxdims) var"#status#" < 0 && @h5error("Error getting the dimensions for a dataspace") return Int(var"#status#") end @@ -4551,7 +5080,8 @@ end See `libhdf5` documentation for [`H5Sget_select_hyper_nblocks`](https://portal.hdfgroup.org/display/HDF5/H5S_GET_SELECT_HYPER_NBLOCKS). """ function h5s_get_select_hyper_nblocks(space_id) - var"#status#" = ccall((:H5Sget_select_hyper_nblocks, libhdf5), hssize_t, (hid_t,), space_id) + var"#status#" = ccall((:H5Sget_select_hyper_nblocks, libhdf5), hssize_t, (hid_t,), + space_id) var"#status#" < 0 && @h5error("Error getting number of selected blocks") return var"#status#" end @@ -4606,7 +5136,9 @@ end See `libhdf5` documentation for [`H5Sselect_hyperslab`](https://portal.hdfgroup.org/display/HDF5/H5S_SELECT_HYPERSLAB). """ function h5s_select_hyperslab(dspace_id, seloper, start, stride, count, block) - var"#status#" = ccall((:H5Sselect_hyperslab, libhdf5), herr_t, (hid_t, Cint, Ptr{hsize_t}, Ptr{hsize_t}, Ptr{hsize_t}, Ptr{hsize_t}), dspace_id, seloper, start, stride, count, block) + var"#status#" = ccall((:H5Sselect_hyperslab, libhdf5), herr_t, + (hid_t, Cint, Ptr{hsize_t}, Ptr{hsize_t}, Ptr{hsize_t}, + Ptr{hsize_t}), dspace_id, seloper, start, stride, count, block) var"#status#" < 0 && @h5error("Error selecting hyperslab") return nothing end @@ -4617,7 +5149,9 @@ end See `libhdf5` documentation for [`H5Sset_extent_simple`](https://portal.hdfgroup.org/display/HDF5/H5S_SET_EXTENT_SIMPLE). """ function h5s_set_extent_simple(dspace_id, rank, current_size, maximum_size) - var"#status#" = ccall((:H5Sset_extent_simple, libhdf5), herr_t, (hid_t, Cint, Ptr{hsize_t}, Ptr{hsize_t}), dspace_id, rank, current_size, maximum_size) + var"#status#" = ccall((:H5Sset_extent_simple, libhdf5), herr_t, + (hid_t, Cint, Ptr{hsize_t}, Ptr{hsize_t}), dspace_id, rank, + current_size, maximum_size) var"#status#" < 0 && @h5error("Error setting dataspace size") return nothing end @@ -4628,8 +5162,10 @@ end See `libhdf5` documentation for [`H5Tarray_create2`](https://portal.hdfgroup.org/display/HDF5/H5T_ARRAY_CREATE2). """ function h5t_array_create(basetype_id, ndims, sz) - var"#status#" = ccall((:H5Tarray_create2, libhdf5), hid_t, (hid_t, Cuint, Ptr{hsize_t}), basetype_id, ndims, sz) - var"#status#" < 0 && @h5error(string("Error creating H5T_ARRAY of id ", basetype_id, " and size ", sz)) + var"#status#" = ccall((:H5Tarray_create2, libhdf5), hid_t, (hid_t, Cuint, Ptr{hsize_t}), + basetype_id, ndims, sz) + var"#status#" < 0 && + @h5error(string("Error creating H5T_ARRAY of id ", basetype_id, " and size ", sz)) return var"#status#" end @@ -4661,7 +5197,9 @@ end See `libhdf5` documentation for [`H5Tcommit2`](https://portal.hdfgroup.org/display/HDF5/H5T_COMMIT2). """ function h5t_commit(loc_id, name, dtype_id, lcpl_id, tcpl_id, tapl_id) - var"#status#" = ccall((:H5Tcommit2, libhdf5), herr_t, (hid_t, Ptr{UInt8}, hid_t, hid_t, hid_t, hid_t), loc_id, name, dtype_id, lcpl_id, tcpl_id, tapl_id) + var"#status#" = ccall((:H5Tcommit2, libhdf5), herr_t, + (hid_t, Ptr{UInt8}, hid_t, hid_t, hid_t, hid_t), loc_id, name, + dtype_id, lcpl_id, tcpl_id, tapl_id) var"#status#" < 0 && @h5error("Error committing type") return nothing end @@ -4694,7 +5232,8 @@ end See `libhdf5` documentation for [`H5Tenum_insert`](https://portal.hdfgroup.org/display/HDF5/H5T_ENUM_INSERT). """ function h5t_enum_insert(dtype_id, name, value) - var"#status#" = ccall((:H5Tenum_insert, libhdf5), herr_t, (hid_t, Cstring, Ptr{Cvoid}), dtype_id, name, value) + var"#status#" = ccall((:H5Tenum_insert, libhdf5), herr_t, (hid_t, Cstring, Ptr{Cvoid}), + dtype_id, name, value) var"#status#" < 0 && @h5error(string("Error adding ", name, " to enum datatype")) return nothing end @@ -4705,7 +5244,8 @@ end See `libhdf5` documentation for [`H5Tequal`](https://portal.hdfgroup.org/display/HDF5/H5T_EQUAL). """ function h5t_equal(dtype_id1, dtype_id2) - var"#status#" = ccall((:H5Tequal, libhdf5), htri_t, (hid_t, hid_t), dtype_id1, dtype_id2) + var"#status#" = ccall((:H5Tequal, libhdf5), htri_t, (hid_t, hid_t), dtype_id1, + dtype_id2) var"#status#" < 0 && @h5error("Error checking datatype equality") return var"#status#" > 0 end @@ -4716,7 +5256,8 @@ end See `libhdf5` documentation for [`H5Tget_array_dims2`](https://portal.hdfgroup.org/display/HDF5/H5T_GET_ARRAY_DIMS2). """ function h5t_get_array_dims(dtype_id, dims) - var"#status#" = ccall((:H5Tget_array_dims2, libhdf5), Cint, (hid_t, Ptr{hsize_t}), dtype_id, dims) + var"#status#" = ccall((:H5Tget_array_dims2, libhdf5), Cint, (hid_t, Ptr{hsize_t}), + dtype_id, dims) var"#status#" < 0 && @h5error("Error getting dimensions of array") return Int(var"#status#") end @@ -4771,7 +5312,9 @@ end See `libhdf5` documentation for [`H5Tget_fields`](https://portal.hdfgroup.org/display/HDF5/H5T_GET_FIELDS). """ function h5t_get_fields(dtype_id, spos, epos, esize, mpos, msize) - var"#status#" = ccall((:H5Tget_fields, libhdf5), herr_t, (hid_t, Ref{Csize_t}, Ref{Csize_t}, Ref{Csize_t}, Ref{Csize_t}, Ref{Csize_t}), dtype_id, spos, epos, esize, mpos, msize) + var"#status#" = ccall((:H5Tget_fields, libhdf5), herr_t, + (hid_t, Ref{Csize_t}, Ref{Csize_t}, Ref{Csize_t}, Ref{Csize_t}, + Ref{Csize_t}), dtype_id, spos, epos, esize, mpos, msize) var"#status#" < 0 && @h5error("Error getting datatype floating point bit positions") return nothing end @@ -4782,8 +5325,10 @@ end See `libhdf5` documentation for [`H5Tget_member_class`](https://portal.hdfgroup.org/display/HDF5/H5T_GET_MEMBER_CLASS). """ function h5t_get_member_class(dtype_id, index) - var"#status#" = ccall((:H5Tget_member_class, libhdf5), Cint, (hid_t, Cuint), dtype_id, index) - var"#status#" < 0 && @h5error(string("Error getting class of compound datatype member #", index)) + var"#status#" = ccall((:H5Tget_member_class, libhdf5), Cint, (hid_t, Cuint), dtype_id, + index) + var"#status#" < 0 && + @h5error(string("Error getting class of compound datatype member #", index)) return Int(var"#status#") end @@ -4793,8 +5338,11 @@ end See `libhdf5` documentation for [`H5Tget_member_index`](https://portal.hdfgroup.org/display/HDF5/H5T_GET_MEMBER_INDEX). """ function h5t_get_member_index(dtype_id, membername) - var"#status#" = ccall((:H5Tget_member_index, libhdf5), Cint, (hid_t, Ptr{UInt8}), dtype_id, membername) - var"#status#" < 0 && @h5error(string("Error getting index of compound datatype member \"", membername, "\"")) + var"#status#" = ccall((:H5Tget_member_index, libhdf5), Cint, (hid_t, Ptr{UInt8}), + dtype_id, membername) + var"#status#" < 0 && + @h5error(string("Error getting index of compound datatype member \"", membername, + "\"")) return Int(var"#status#") end @@ -4804,7 +5352,8 @@ end See `libhdf5` documentation for [`H5Tget_member_offset`](https://portal.hdfgroup.org/display/HDF5/H5T_GET_MEMBER_OFFSET). """ function h5t_get_member_offset(dtype_id, index) - var"#status#" = ccall((:H5Tget_member_offset, libhdf5), Csize_t, (hid_t, Cuint), dtype_id, index) + var"#status#" = ccall((:H5Tget_member_offset, libhdf5), Csize_t, (hid_t, Cuint), + dtype_id, index) @h5error "Error getting offset of compound datatype #$(index)" return var"#status#" end @@ -4815,8 +5364,10 @@ end See `libhdf5` documentation for [`H5Tget_member_type`](https://portal.hdfgroup.org/display/HDF5/H5T_GET_MEMBER_TYPE). """ function h5t_get_member_type(dtype_id, index) - var"#status#" = ccall((:H5Tget_member_type, libhdf5), hid_t, (hid_t, Cuint), dtype_id, index) - var"#status#" < 0 && @h5error(string("Error getting type of compound datatype member #", index)) + var"#status#" = ccall((:H5Tget_member_type, libhdf5), hid_t, (hid_t, Cuint), dtype_id, + index) + var"#status#" < 0 && + @h5error(string("Error getting type of compound datatype member #", index)) return var"#status#" end @@ -4826,7 +5377,8 @@ end See `libhdf5` documentation for [`H5Tget_native_type`](https://portal.hdfgroup.org/display/HDF5/H5T_GET_NATIVE_TYPE). """ function h5t_get_native_type(dtype_id, direction) - var"#status#" = ccall((:H5Tget_native_type, libhdf5), hid_t, (hid_t, Cint), dtype_id, direction) + var"#status#" = ccall((:H5Tget_native_type, libhdf5), hid_t, (hid_t, Cint), dtype_id, + direction) var"#status#" < 0 && @h5error("Error getting native type") return var"#status#" end @@ -4925,8 +5477,11 @@ end See `libhdf5` documentation for [`H5Tinsert`](https://portal.hdfgroup.org/display/HDF5/H5T_INSERT). """ function h5t_insert(dtype_id, fieldname, offset, field_id) - var"#status#" = ccall((:H5Tinsert, libhdf5), herr_t, (hid_t, Ptr{UInt8}, Csize_t, hid_t), dtype_id, fieldname, offset, field_id) - var"#status#" < 0 && @h5error(string("Error adding field ", fieldname, " to compound datatype")) + var"#status#" = ccall((:H5Tinsert, libhdf5), herr_t, + (hid_t, Ptr{UInt8}, Csize_t, hid_t), dtype_id, fieldname, offset, + field_id) + var"#status#" < 0 && + @h5error(string("Error adding field ", fieldname, " to compound datatype")) return nothing end @@ -4958,8 +5513,10 @@ end See `libhdf5` documentation for [`H5Topen2`](https://portal.hdfgroup.org/display/HDF5/H5T_OPEN2). """ function h5t_open(loc_id, name, tapl_id) - var"#status#" = ccall((:H5Topen2, libhdf5), hid_t, (hid_t, Ptr{UInt8}, hid_t), loc_id, name, tapl_id) - var"#status#" < 0 && @h5error(string("Error opening type ", h5i_get_name(loc_id), "/", name)) + var"#status#" = ccall((:H5Topen2, libhdf5), hid_t, (hid_t, Ptr{UInt8}, hid_t), loc_id, + name, tapl_id) + var"#status#" < 0 && + @h5error(string("Error opening type ", h5i_get_name(loc_id), "/", name)) return var"#status#" end @@ -4980,7 +5537,8 @@ end See `libhdf5` documentation for [`H5Tset_ebias`](https://portal.hdfgroup.org/display/HDF5/H5T_SET_EBIAS). """ function h5t_set_ebias(dtype_id, ebias) - var"#status#" = ccall((:H5Tset_ebias, libhdf5), herr_t, (hid_t, Csize_t), dtype_id, ebias) + var"#status#" = ccall((:H5Tset_ebias, libhdf5), herr_t, (hid_t, Csize_t), dtype_id, + ebias) var"#status#" < 0 && @h5error("Error setting datatype floating point exponent bias") return nothing end @@ -4991,7 +5549,9 @@ end See `libhdf5` documentation for [`H5Tset_fields`](https://portal.hdfgroup.org/display/HDF5/H5T_SET_FIELDS). """ function h5t_set_fields(dtype_id, spos, epos, esize, mpos, msize) - var"#status#" = ccall((:H5Tset_fields, libhdf5), herr_t, (hid_t, Csize_t, Csize_t, Csize_t, Csize_t, Csize_t), dtype_id, spos, epos, esize, mpos, msize) + var"#status#" = ccall((:H5Tset_fields, libhdf5), herr_t, + (hid_t, Csize_t, Csize_t, Csize_t, Csize_t, Csize_t), dtype_id, + spos, epos, esize, mpos, msize) var"#status#" < 0 && @h5error("Error setting datatype floating point bit positions") return nothing end @@ -5002,7 +5562,8 @@ end See `libhdf5` documentation for [`H5Tset_offset`](https://portal.hdfgroup.org/display/HDF5/H5T_SET_OFFSET). """ function h5t_set_offset(dtype_id, offset) - var"#status#" = ccall((:H5Tset_offset, libhdf5), herr_t, (hid_t, Csize_t), dtype_id, offset) + var"#status#" = ccall((:H5Tset_offset, libhdf5), herr_t, (hid_t, Csize_t), dtype_id, + offset) var"#status#" < 0 && @h5error("Error setting offset") return nothing end @@ -5024,7 +5585,8 @@ end See `libhdf5` documentation for [`H5Tset_precision`](https://portal.hdfgroup.org/display/HDF5/H5T_SET_PRECISION). """ function h5t_set_precision(dtype_id, sz) - var"#status#" = ccall((:H5Tset_precision, libhdf5), herr_t, (hid_t, Csize_t), dtype_id, sz) + var"#status#" = ccall((:H5Tset_precision, libhdf5), herr_t, (hid_t, Csize_t), dtype_id, + sz) var"#status#" < 0 && @h5error("Error setting precision of datatype") return nothing end @@ -5079,7 +5641,9 @@ end See `libhdf5` documentation for [`H5DOappend`](https://portal.hdfgroup.org/display/HDF5/H5DO_APPEND). """ function h5do_append(dset_id, dxpl_id, index, num_elem, memtype, buffer) - var"#status#" = ccall((:H5DOappend, libhdf5_hl), herr_t, (hid_t, hid_t, Cuint, hsize_t, hid_t, Ptr{Cvoid}), dset_id, dxpl_id, index, num_elem, memtype, buffer) + var"#status#" = ccall((:H5DOappend, libhdf5_hl), herr_t, + (hid_t, hid_t, Cuint, hsize_t, hid_t, Ptr{Cvoid}), dset_id, + dxpl_id, index, num_elem, memtype, buffer) var"#status#" < 0 && @h5error("error appending") return nothing end @@ -5090,7 +5654,9 @@ end See `libhdf5` documentation for [`H5DOwrite_chunk`](https://portal.hdfgroup.org/display/HDF5/H5DO_WRITE_CHUNK). """ function h5do_write_chunk(dset_id, dxpl_id, filter_mask, offset, bufsize, buf) - var"#status#" = ccall((:H5DOwrite_chunk, libhdf5_hl), herr_t, (hid_t, hid_t, UInt32, Ptr{hsize_t}, Csize_t, Ptr{Cvoid}), dset_id, dxpl_id, filter_mask, offset, bufsize, buf) + var"#status#" = ccall((:H5DOwrite_chunk, libhdf5_hl), herr_t, + (hid_t, hid_t, UInt32, Ptr{hsize_t}, Csize_t, Ptr{Cvoid}), + dset_id, dxpl_id, filter_mask, offset, bufsize, buf) var"#status#" < 0 && @h5error("Error writing chunk") return nothing end @@ -5101,7 +5667,8 @@ end See `libhdf5` documentation for [`H5DSattach_scale`](https://portal.hdfgroup.org/display/HDF5/H5DS_ATTACH_SCALE). """ function h5ds_attach_scale(did, dsid, idx) - var"#status#" = ccall((:H5DSattach_scale, libhdf5_hl), herr_t, (hid_t, hid_t, Cuint), did, dsid, idx) + var"#status#" = ccall((:H5DSattach_scale, libhdf5_hl), herr_t, (hid_t, hid_t, Cuint), + did, dsid, idx) var"#status#" < 0 && @h5error("Unable to attach scale") return nothing end @@ -5112,7 +5679,8 @@ end See `libhdf5` documentation for [`H5DSdetach_scale`](https://portal.hdfgroup.org/display/HDF5/H5DS_DETACH_SCALE). """ function h5ds_detach_scale(did, dsid, idx) - var"#status#" = ccall((:H5DSdetach_scale, libhdf5_hl), herr_t, (hid_t, hid_t, Cuint), did, dsid, idx) + var"#status#" = ccall((:H5DSdetach_scale, libhdf5_hl), herr_t, (hid_t, hid_t, Cuint), + did, dsid, idx) var"#status#" < 0 && @h5error("Unable to detach scale") return nothing end @@ -5123,7 +5691,8 @@ end See `libhdf5` documentation for [`H5DSget_label`](https://portal.hdfgroup.org/display/HDF5/H5DS_GET_LABEL). """ function h5ds_get_label(did, idx, label, size) - var"#status#" = ccall((:H5DSget_label, libhdf5_hl), herr_t, (hid_t, Cuint, Ptr{UInt8}, hsize_t), did, idx, label, size) + var"#status#" = ccall((:H5DSget_label, libhdf5_hl), herr_t, + (hid_t, Cuint, Ptr{UInt8}, hsize_t), did, idx, label, size) var"#status#" < 0 && @h5error("Unable to get label") return nothing end @@ -5145,7 +5714,8 @@ end See `libhdf5` documentation for [`H5DSget_scale_name`](https://portal.hdfgroup.org/display/HDF5/H5DS_GET_SCALE_NAME). """ function h5ds_get_scale_name(did, name, size) - var"#status#" = ccall((:H5DSget_scale_name, libhdf5_hl), Cssize_t, (hid_t, Ptr{UInt8}, Csize_t), did, name, size) + var"#status#" = ccall((:H5DSget_scale_name, libhdf5_hl), Cssize_t, + (hid_t, Ptr{UInt8}, Csize_t), did, name, size) var"#status#" < 0 && @h5error("Unable to get scale name") return var"#status#" end @@ -5156,7 +5726,8 @@ end See `libhdf5` documentation for [`H5DSis_attached`](https://portal.hdfgroup.org/display/HDF5/H5DS_IS_ATTACHED). """ function h5ds_is_attached(did, dsid, idx) - var"#status#" = ccall((:H5DSis_attached, libhdf5_hl), htri_t, (hid_t, hid_t, Cuint), did, dsid, idx) + var"#status#" = ccall((:H5DSis_attached, libhdf5_hl), htri_t, (hid_t, hid_t, Cuint), + did, dsid, idx) var"#status#" < 0 && @h5error("Unable to check if dimension is attached") return var"#status#" > 0 end @@ -5178,7 +5749,8 @@ end See `libhdf5` documentation for [`H5DSset_label`](https://portal.hdfgroup.org/display/HDF5/H5DS_SET_LABEL). """ function h5ds_set_label(did, idx, label) - var"#status#" = ccall((:H5DSset_label, libhdf5_hl), herr_t, (hid_t, Cuint, Ref{UInt8}), did, idx, label) + var"#status#" = ccall((:H5DSset_label, libhdf5_hl), herr_t, (hid_t, Cuint, Ref{UInt8}), + did, idx, label) var"#status#" < 0 && @h5error("Unable to set label") return nothing end @@ -5189,7 +5761,8 @@ end See `libhdf5` documentation for [`H5DSset_scale`](https://portal.hdfgroup.org/display/HDF5/H5DS_SET_SCALE). """ function h5ds_set_scale(dsid, dimname) - var"#status#" = ccall((:H5DSset_scale, libhdf5_hl), herr_t, (hid_t, Ptr{UInt8}), dsid, dimname) + var"#status#" = ccall((:H5DSset_scale, libhdf5_hl), herr_t, (hid_t, Ptr{UInt8}), dsid, + dimname) var"#status#" < 0 && @h5error("Unable to set scale") return nothing end @@ -5200,7 +5773,9 @@ end See `libhdf5` documentation for [`H5LTdtype_to_text`](https://portal.hdfgroup.org/display/HDF5/H5LT_DTYPE_TO_TEXT). """ function h5lt_dtype_to_text(datatype, str, lang_type, len) - var"#status#" = ccall((:H5LTdtype_to_text, libhdf5_hl), herr_t, (hid_t, Ptr{UInt8}, Cint, Ref{Csize_t}), datatype, str, lang_type, len) + var"#status#" = ccall((:H5LTdtype_to_text, libhdf5_hl), herr_t, + (hid_t, Ptr{UInt8}, Cint, Ref{Csize_t}), datatype, str, lang_type, + len) var"#status#" < 0 && @h5error("Error getting datatype text representation") return nothing end @@ -5210,8 +5785,12 @@ end See `libhdf5` documentation for [`H5TBappend_records`](https://portal.hdfgroup.org/display/HDF5/H5TB_APPEND_RECORDS). """ -function h5tb_append_records(loc_id, dset_name, nrecords, type_size, field_offset, field_sizes, data) - var"#status#" = ccall((:H5TBappend_records, libhdf5_hl), herr_t, (hid_t, Ptr{UInt8}, hsize_t, Csize_t, Ptr{Csize_t}, Ptr{Csize_t}, Ptr{Cvoid}), loc_id, dset_name, nrecords, type_size, field_offset, field_sizes, data) +function h5tb_append_records(loc_id, dset_name, nrecords, type_size, field_offset, + field_sizes, data) + var"#status#" = ccall((:H5TBappend_records, libhdf5_hl), herr_t, + (hid_t, Ptr{UInt8}, hsize_t, Csize_t, Ptr{Csize_t}, Ptr{Csize_t}, + Ptr{Cvoid}), loc_id, dset_name, nrecords, type_size, + field_offset, field_sizes, data) var"#status#" < 0 && @h5error("Error adding record to table") return nothing end @@ -5221,8 +5800,12 @@ end See `libhdf5` documentation for [`H5TBget_field_info`](https://portal.hdfgroup.org/display/HDF5/H5TB_GET_FIELD_INFO). """ -function h5tb_get_field_info(loc_id, table_name, field_names, field_sizes, field_offsets, type_size) - var"#status#" = ccall((:H5TBget_field_info, libhdf5_hl), herr_t, (hid_t, Ptr{UInt8}, Ptr{Ptr{UInt8}}, Ptr{Csize_t}, Ptr{Csize_t}, Ptr{Csize_t}), loc_id, table_name, field_names, field_sizes, field_offsets, type_size) +function h5tb_get_field_info(loc_id, table_name, field_names, field_sizes, field_offsets, + type_size) + var"#status#" = ccall((:H5TBget_field_info, libhdf5_hl), herr_t, + (hid_t, Ptr{UInt8}, Ptr{Ptr{UInt8}}, Ptr{Csize_t}, Ptr{Csize_t}, + Ptr{Csize_t}), loc_id, table_name, field_names, field_sizes, + field_offsets, type_size) var"#status#" < 0 && @h5error("Error getting field information") return nothing end @@ -5233,7 +5816,9 @@ end See `libhdf5` documentation for [`H5TBget_table_info`](https://portal.hdfgroup.org/display/HDF5/H5TB_GET_TABLE_INFO). """ function h5tb_get_table_info(loc_id, table_name, nfields, nrecords) - var"#status#" = ccall((:H5TBget_table_info, libhdf5_hl), herr_t, (hid_t, Ptr{UInt8}, Ptr{hsize_t}, Ptr{hsize_t}), loc_id, table_name, nfields, nrecords) + var"#status#" = ccall((:H5TBget_table_info, libhdf5_hl), herr_t, + (hid_t, Ptr{UInt8}, Ptr{hsize_t}, Ptr{hsize_t}), loc_id, + table_name, nfields, nrecords) var"#status#" < 0 && @h5error("Error getting table information") return nothing end @@ -5243,8 +5828,15 @@ end See `libhdf5` documentation for [`H5TBmake_table`](https://portal.hdfgroup.org/display/HDF5/H5TB_MAKE_TABLE). """ -function h5tb_make_table(table_title, loc_id, dset_name, nfields, nrecords, type_size, field_names, field_offset, field_types, chunk_size, fill_data, compress, data) - var"#status#" = ccall((:H5TBmake_table, libhdf5_hl), herr_t, (Ptr{UInt8}, hid_t, Ptr{UInt8}, hsize_t, hsize_t, Csize_t, Ptr{Ptr{UInt8}}, Ptr{Csize_t}, Ptr{hid_t}, hsize_t, Ptr{Cvoid}, Cint, Ptr{Cvoid}), table_title, loc_id, dset_name, nfields, nrecords, type_size, field_names, field_offset, field_types, chunk_size, fill_data, compress, data) +function h5tb_make_table(table_title, loc_id, dset_name, nfields, nrecords, type_size, + field_names, field_offset, field_types, chunk_size, fill_data, + compress, data) + var"#status#" = ccall((:H5TBmake_table, libhdf5_hl), herr_t, + (Ptr{UInt8}, hid_t, Ptr{UInt8}, hsize_t, hsize_t, Csize_t, + Ptr{Ptr{UInt8}}, Ptr{Csize_t}, Ptr{hid_t}, hsize_t, Ptr{Cvoid}, + Cint, Ptr{Cvoid}), table_title, loc_id, dset_name, nfields, + nrecords, type_size, field_names, field_offset, field_types, + chunk_size, fill_data, compress, data) var"#status#" < 0 && @h5error("Error creating and writing dataset to table") return nothing end @@ -5254,8 +5846,12 @@ end See `libhdf5` documentation for [`H5TBread_records`](https://portal.hdfgroup.org/display/HDF5/H5TB_READ_RECORDS). """ -function h5tb_read_records(loc_id, table_name, start, nrecords, type_size, field_offsets, dst_sizes, data) - var"#status#" = ccall((:H5TBread_records, libhdf5_hl), herr_t, (hid_t, Ptr{UInt8}, hsize_t, hsize_t, Csize_t, Ptr{Csize_t}, Ptr{Csize_t}, Ptr{Cvoid}), loc_id, table_name, start, nrecords, type_size, field_offsets, dst_sizes, data) +function h5tb_read_records(loc_id, table_name, start, nrecords, type_size, field_offsets, + dst_sizes, data) + var"#status#" = ccall((:H5TBread_records, libhdf5_hl), herr_t, + (hid_t, Ptr{UInt8}, hsize_t, hsize_t, Csize_t, Ptr{Csize_t}, + Ptr{Csize_t}, Ptr{Cvoid}), loc_id, table_name, start, nrecords, + type_size, field_offsets, dst_sizes, data) var"#status#" < 0 && @h5error("Error reading record from table") return nothing end @@ -5266,7 +5862,10 @@ end See `libhdf5` documentation for [`H5TBread_table`](https://portal.hdfgroup.org/display/HDF5/H5TB_READ_TABLE). """ function h5tb_read_table(loc_id, table_name, dst_size, dst_offset, dst_sizes, dst_buf) - var"#status#" = ccall((:H5TBread_table, libhdf5_hl), herr_t, (hid_t, Ptr{UInt8}, Csize_t, Ptr{Csize_t}, Ptr{Csize_t}, Ptr{Cvoid}), loc_id, table_name, dst_size, dst_offset, dst_sizes, dst_buf) + var"#status#" = ccall((:H5TBread_table, libhdf5_hl), herr_t, + (hid_t, Ptr{UInt8}, Csize_t, Ptr{Csize_t}, Ptr{Csize_t}, + Ptr{Cvoid}), loc_id, table_name, dst_size, dst_offset, dst_sizes, + dst_buf) var"#status#" < 0 && @h5error("Error reading table") return nothing end @@ -5276,8 +5875,12 @@ end See `libhdf5` documentation for [`H5TBwrite_records`](https://portal.hdfgroup.org/display/HDF5/H5TB_WRITE_RECORDS). """ -function h5tb_write_records(loc_id, table_name, start, nrecords, type_size, field_offsets, field_sizes, data) - var"#status#" = ccall((:H5TBwrite_records, libhdf5_hl), herr_t, (hid_t, Ptr{UInt8}, hsize_t, hsize_t, Csize_t, Ptr{UInt8}, Ptr{UInt8}, Ptr{Cvoid}), loc_id, table_name, start, nrecords, type_size, field_offsets, field_sizes, data) +function h5tb_write_records(loc_id, table_name, start, nrecords, type_size, field_offsets, + field_sizes, data) + var"#status#" = ccall((:H5TBwrite_records, libhdf5_hl), herr_t, + (hid_t, Ptr{UInt8}, hsize_t, hsize_t, Csize_t, Ptr{UInt8}, + Ptr{UInt8}, Ptr{Cvoid}), loc_id, table_name, start, nrecords, + type_size, field_offsets, field_sizes, data) var"#status#" < 0 && @h5error("Error writing record to table") return nothing end @@ -5288,7 +5891,8 @@ end See `libhdf5` documentation for [`H5Zregister`](https://portal.hdfgroup.org/display/HDF5/H5Z_REGISTER). """ function h5z_register(filter_class) - var"#status#" = ccall((:H5Zregister, libhdf5), herr_t, (Ref{H5Z_class_t},), filter_class) + var"#status#" = ccall((:H5Zregister, libhdf5), herr_t, (Ref{H5Z_class_t},), + filter_class) var"#status#" < 0 && @h5error("Unable to register new filter") return nothing end @@ -5321,7 +5925,8 @@ end See `libhdf5` documentation for [`H5Zget_filter_info`](https://portal.hdfgroup.org/display/HDF5/H5Z_GET_FILTER_INFO). """ function h5z_get_filter_info(filter, filter_config_flags) - var"#status#" = ccall((:H5Zget_filter_info, libhdf5), herr_t, (H5Z_filter_t, Ptr{Cuint}), filter, filter_config_flags) + var"#status#" = ccall((:H5Zget_filter_info, libhdf5), herr_t, + (H5Z_filter_t, Ptr{Cuint}), filter, filter_config_flags) var"#status#" < 0 && @h5error("Error getting filter information") return nothing end @@ -5402,4 +6007,3 @@ function h5fd_stdio_init() var"#status#" < 0 && @h5error("Error initializing file driver") return var"#status#" end - diff --git a/src/api/helpers.jl b/src/api/helpers.jl index 0e4b96ba6..6b17aad43 100644 --- a/src/api/helpers.jl +++ b/src/api/helpers.jl @@ -37,7 +37,7 @@ end function h5a_get_name(attr_id) len = h5a_get_name(attr_id, 0, C_NULL) buf = StringVector(len) - h5a_get_name(attr_id, len+1, buf) + h5a_get_name(attr_id, len + 1, buf) return String(buf) end @@ -52,7 +52,8 @@ end # emulating it with the less desirable form of creating closure handles directly in # `@cfunction` with `$f`. # This helper translates between the two preferred forms for each respective language. -function h5a_iterate_helper(loc_id::hid_t, attr_name::Ptr{Cchar}, ainfo::Ptr{H5A_info_t}, @nospecialize(data::Any))::herr_t +function h5a_iterate_helper(loc_id::hid_t, attr_name::Ptr{Cchar}, ainfo::Ptr{H5A_info_t}, + @nospecialize(data::Any))::herr_t f, err_ref = data try return herr_t(f(loc_id, attr_name, ainfo)) @@ -132,7 +133,9 @@ function h5d_get_chunk_info(dataset_id, fspace_id, index) h5d_get_chunk_info(dataset_id, fspace_id, index, offset, filter_mask, addr, size) return (offset = offset, filter_mask = filter_mask[], addr = addr[], size = size[]) end -h5d_get_chunk_info(dataset_id, index; fspace_id = H5S_ALL) = h5d_get_chunk_info(dataset_id, fspace_id, index) +function h5d_get_chunk_info(dataset_id, index; fspace_id = H5S_ALL) + h5d_get_chunk_info(dataset_id, fspace_id, index) +end """ h5d_get_chunk_info_by_coord(dataset_id, offset) @@ -183,7 +186,6 @@ function h5d_get_space_status(dataset_id) return r[] end - ### ### Error Interface ### @@ -203,14 +205,14 @@ function h5e_get_msg(mesg_id) mesg_type = Ref{Cint}() mesg_len = h5e_get_msg(mesg_id, mesg_type, C_NULL, 0) buffer = StringVector(mesg_len) - h5e_get_msg(mesg_id, mesg_type, buffer, mesg_len+1) + h5e_get_msg(mesg_id, mesg_type, buffer, mesg_len + 1) resize!(buffer, mesg_len) return mesg_type[], String(buffer) end - # See explanation for h5a_iterate above. -function h5e_walk_helper(n::Cuint, err_desc::Ptr{H5E_error2_t}, @nospecialize(data::Any))::herr_t +function h5e_walk_helper(n::Cuint, err_desc::Ptr{H5E_error2_t}, + @nospecialize(data::Any))::herr_t f, err_ref = data try return herr_t(f(n, err_desc)) @@ -246,7 +248,7 @@ end function h5f_get_name(loc_id) len = h5f_get_name(loc_id, C_NULL, 0) buf = StringVector(len) - h5f_get_name(loc_id, buf, len+1) + h5f_get_name(loc_id, buf, len + 1) return String(buf) end @@ -296,17 +298,17 @@ end # Check to see if h5p_set_file_locking should exist const _has_h5p_set_file_locking = _has_symbol(:H5Pset_file_locking) function has_h5p_set_file_locking() - return _has_h5p_set_file_locking - #= - h5_version = h5_get_libversion() - if (h5_version >= v"1.10" && h5_version < v"1.10.7") || - (h5_version >= v"1.12" && h5_version < v"1.12.1") || - (h5_version < v"1.10") - return false - else - return true - end - =# + return _has_h5p_set_file_locking + #= + h5_version = h5_get_libversion() + if (h5_version >= v"1.10" && h5_version < v"1.10.7") || + (h5_version >= v"1.12" && h5_version < v"1.12.1") || + (h5_version < v"1.10") + return false + else + return true + end + =# end function h5p_get_file_space_strategy(plist_id) @@ -323,7 +325,8 @@ function h5p_get_file_space_page_size(plist_id) return fsp_size[] end -function h5p_set_file_space_strategy(plist_id; strategy = nothing, persist = nothing, threshold = nothing) +function h5p_set_file_space_strategy(plist_id; strategy = nothing, persist = nothing, + threshold = nothing) current = h5p_get_file_space_strategy(plist_id) strategy = isnothing(strategy) ? current[:strategy] : strategy persist = isnothing(persist) ? current[:persist] : persist @@ -354,7 +357,7 @@ end function h5i_get_name(loc_id) len = h5i_get_name(loc_id, C_NULL, 0) buf = StringVector(len) - h5i_get_name(loc_id, buf, len+1) + h5i_get_name(loc_id, buf, len + 1) return String(buf) end @@ -376,7 +379,8 @@ function h5l_get_name_by_idx(loc_id, group_name, idx_type, order, idx, lapl_id) end # See explanation for h5a_iterate above. -function h5l_iterate_helper(group::hid_t, name::Ptr{Cchar}, info::Ptr{H5L_info_t}, @nospecialize(data::Any))::herr_t +function h5l_iterate_helper(group::hid_t, name::Ptr{Cchar}, info::Ptr{H5L_info_t}, + @nospecialize(data::Any))::herr_t f, err_ref = data try return herr_t(f(group, name, info)) @@ -412,7 +416,7 @@ function h5l_iterate(@nospecialize(f), group_id, idx_type, order, idx = 0) idxref = Ref{hsize_t}(idx) fptr = @cfunction(h5l_iterate_helper, herr_t, (hid_t, Ptr{Cchar}, Ptr{H5L_info_t}, Any)) try - h5l_iterate(group_id, idx_type, order, idxref, fptr, (f,err_ref)) + h5l_iterate(group_id, idx_type, order, idxref, fptr, (f, err_ref)) catch h5err jlerr = err_ref[] if !isnothing(jlerr) @@ -437,14 +441,14 @@ end end # H5Oget_info_by_name1 - function h5o_get_info_by_name(loc_id, name, lapl=H5P_DEFAULT) + function h5o_get_info_by_name(loc_id, name, lapl = H5P_DEFAULT) oinfo = Ref{H5O_info1_t}() h5o_get_info_by_name(loc_id, name, oinfo, lapl) return oinfo[] end # H5Oget_info_by_idx1 - function h5o_get_info_by_idx(loc_id, group_name, idx_type, order, n, lapl=H5P_DEFAULT) + function h5o_get_info_by_idx(loc_id, group_name, idx_type, order, n, lapl = H5P_DEFAULT) oinfo = Ref{H5O_info1_t}() h5o_get_info_by_idx(loc_id, group_name, idx_type, order, n, oinfo, lapl) return oinfo[] @@ -453,21 +457,22 @@ end elseif _libhdf5_build_ver >= v"1.10.3" && _libhdf5_build_ver < v"1.12.0" # H5Oget_info2 - function h5o_get_info(loc_id, fields=H5O_INFO_ALL) + function h5o_get_info(loc_id, fields = H5O_INFO_ALL) oinfo = Ref{H5O_info1_t}() h5o_get_info(loc_id, oinfo, fields) return oinfo[] end # H5Oget_info_by_name2 - function h5o_get_info_by_name(loc_id, name, fields=H5O_INFO_ALL, lapl=H5P_DEFAULT) + function h5o_get_info_by_name(loc_id, name, fields = H5O_INFO_ALL, lapl = H5P_DEFAULT) oinfo = Ref{H5O_info1_t}() h5o_get_info_by_name(loc_id, name, oinfo, fields, lapl) return oinfo[] end # H5Oget_info_by_idx2 - function h5o_get_info_by_idx(loc_id, group_name, idx_type, order, n, fields=H5O_INFO_ALL, lapl=H5P_DEFAULT) + function h5o_get_info_by_idx(loc_id, group_name, idx_type, order, n, + fields = H5O_INFO_ALL, lapl = H5P_DEFAULT) oinfo = Ref{H5O_info1_t}() h5o_get_info_by_idx(loc_id, group_name, idx_type, order, n, oinfo, fields, lapl) return oinfo[] @@ -476,57 +481,50 @@ elseif _libhdf5_build_ver >= v"1.10.3" && _libhdf5_build_ver < v"1.12.0" else # _libhdf5_build_ver >= v"1.12.0" # H5Oget_info3 - function h5o_get_info(loc_id, fields=H5O_INFO_ALL) + function h5o_get_info(loc_id, fields = H5O_INFO_ALL) oinfo = Ref{H5O_info2_t}() h5o_get_info(loc_id, oinfo, fields) return oinfo[] end # H5Oget_info_by_name3 - function h5o_get_info_by_name(loc_id, name, fields=H5O_INFO_ALL, lapl=H5P_DEFAULT) + function h5o_get_info_by_name(loc_id, name, fields = H5O_INFO_ALL, lapl = H5P_DEFAULT) oinfo = Ref{H5O_info2_t}() h5o_get_info_by_name(loc_id, name, oinfo, fields, lapl) return oinfo[] end # H5Oget_info_by_idx3 - function h5o_get_info_by_idx(loc_id, group_name, idx_type, order, n, fields=H5O_INFO_ALL, lapl=H5P_DEFAULT) + function h5o_get_info_by_idx(loc_id, group_name, idx_type, order, n, + fields = H5O_INFO_ALL, lapl = H5P_DEFAULT) oinfo = Ref{H5O_info2_t}() h5o_get_info_by_idx(loc_id, group_name, idx_type, order, n, oinfo, fields, lapl) return oinfo[] end - function h5o_get_native_info( - loc_id, - fields=H5O_NATIVE_INFO_ALL - ) + function h5o_get_native_info(loc_id, + fields = H5O_NATIVE_INFO_ALL) oinfo = Ref{H5O_native_info_t}() h5o_get_native_info(loc_id, oinfo, fields) return oinfo[] end - function h5o_get_native_info_by_idx( - loc_id, group_name, idx_type, order, n, - fields=H5O_NATIVE_INFO_ALL, - lapl=H5P_DEFAULT - ) + function h5o_get_native_info_by_idx(loc_id, group_name, idx_type, order, n, + fields = H5O_NATIVE_INFO_ALL, + lapl = H5P_DEFAULT) oinfo = Ref{H5O_native_info_t}() - h5o_get_native_info_by_idx( - loc_id, group_name, idx_type, order, n, oinfo, fields, lapl - ) + h5o_get_native_info_by_idx(loc_id, group_name, idx_type, order, n, oinfo, fields, + lapl) return oinfo[] end - function h5o_get_native_info_by_name( - loc_id, name, - fields=H5O_NATIVE_INFO_ALL, - lapl=H5P_DEFAULT - ) + function h5o_get_native_info_by_name(loc_id, name, + fields = H5O_NATIVE_INFO_ALL, + lapl = H5P_DEFAULT) oinfo = Ref{H5O_native_info_t}() h5o_get_native_info_by_name(loc_id, name, oinfo, fields, lapl) return oinfo[] end - end # @static if _libhdf5_build_ver < v"1.12.0" # Add a default link access property list if not specified @@ -544,7 +542,8 @@ Deprecated HDF5 function. Use [`h5o_get_info`](@ref) or [`h5o_get_native_info`]( See `libhdf5` documentation for [`H5Oget_info1`](https://portal.hdfgroup.org/display/HDF5/H5O_GET_INFO1). """ function h5o_get_info1(object_id, buf) - var"#status#" = ccall((:H5Oget_info1, libhdf5), herr_t, (hid_t, Ptr{H5O_info_t}), object_id, buf) + var"#status#" = ccall((:H5Oget_info1, libhdf5), herr_t, (hid_t, Ptr{H5O_info_t}), + object_id, buf) var"#status#" < 0 && @h5error("Error getting object info") return nothing end @@ -607,7 +606,7 @@ end function h5p_get_efile_prefix(plist) efile_len = h5p_get_efile_prefix(plist, C_NULL, 0) buffer = StringVector(efile_len) - prefix_size = h5p_get_efile_prefix(plist, buffer, efile_len+1) + prefix_size = h5p_get_efile_prefix(plist, buffer, efile_len + 1) return String(buffer) end @@ -628,7 +627,7 @@ function h5p_get_external(plist, idx = 0) name_size *= 2 resize!(name, name_size) else - resize!(name, null_id-1) + resize!(name, null_id - 1) break end end @@ -695,7 +694,7 @@ end function h5p_get_virtual_prefix(dapl_id) virtual_file_len = h5p_get_virtual_prefix(dapl_id, C_NULL, 0) buffer = StringVector(virtual_file_len) - prefix_size = h5p_get_virtual_prefix(dapl_id, buffer, virtual_file_len+1) + prefix_size = h5p_get_virtual_prefix(dapl_id, buffer, virtual_file_len + 1) return String(buffer) end @@ -770,7 +769,6 @@ function h5pl_size() num_paths[] end - ### ### Reference Interface ### @@ -780,7 +778,7 @@ end ### function h5s_get_regular_hyperslab(space_id) - n = h5s_get_simple_extent_ndims(space_id) + n = h5s_get_simple_extent_ndims(space_id) start = Vector{hsize_t}(undef, n) stride = Vector{hsize_t}(undef, n) count = Vector{hsize_t}(undef, n) @@ -803,7 +801,6 @@ function h5s_get_simple_extent_dims(space_id, ::Nothing) return dims end - ### ### Datatype Interface ### @@ -857,9 +854,7 @@ function h5t_get_tag(type_id) return s end -h5t_get_native_type(type_id) = - h5t_get_native_type(type_id, H5T_DIR_ASCEND) - +h5t_get_native_type(type_id) = h5t_get_native_type(type_id, H5T_DIR_ASCEND) ### ### Optimized Functions Interface @@ -901,7 +896,7 @@ function h5tb_get_field_info(loc_id, table_name) did = h5d_open(loc_id, table_name, H5P_DEFAULT) tid = h5d_get_type(did) h5d_close(did) - field_names = [h5t_get_member_name(tid, i-1) for i in 1:nfields] + field_names = [h5t_get_member_name(tid, i - 1) for i in 1:nfields] h5t_close(tid) return field_names, field_sizes, field_offsets, type_size[] end @@ -916,21 +911,23 @@ function h5z_get_filter_info(filter) ref[] end - ### ### MPIO ### -h5p_set_fapl_mpio(fapl_id, comm::Hmpih32, info::Hmpih32) = +function h5p_set_fapl_mpio(fapl_id, comm::Hmpih32, info::Hmpih32) h5p_set_fapl_mpio32(fapl_id, comm, info) -h5p_set_fapl_mpio(fapl_id, comm::Hmpih64, info::Hmpih64) = +end +function h5p_set_fapl_mpio(fapl_id, comm::Hmpih64, info::Hmpih64) h5p_set_fapl_mpio64(fapl_id, comm, info) +end - -h5p_get_fapl_mpio(fapl_id, comm::Ref{Hmpih32}, info::Ref{Hmpih32}) = +function h5p_get_fapl_mpio(fapl_id, comm::Ref{Hmpih32}, info::Ref{Hmpih32}) h5p_get_fapl_mpio32(fapl_id, comm, info) -h5p_get_fapl_mpio(fapl_id, comm::Ref{Hmpih64}, info::Ref{Hmpih64}) = +end +function h5p_get_fapl_mpio(fapl_id, comm::Ref{Hmpih64}, info::Ref{Hmpih64}) h5p_get_fapl_mpio64(fapl_id, comm, info) +end function h5p_get_fapl_mpio(fapl_id, ::Type{Hmpih}) where {Hmpih<:Union{Hmpih32,Hmpih64}} comm, info = Ref{Hmpih}(), Ref{Hmpih}() diff --git a/src/api/types.jl b/src/api/types.jl index 245cddf5b..39d2129a7 100644 --- a/src/api/types.jl +++ b/src/api/types.jl @@ -117,7 +117,7 @@ const H5O_NATIVE_INFO_META_SIZE = 0x0010 const H5O_NATIVE_INFO_ALL = H5O_NATIVE_INFO_HDR | H5O_NATIVE_INFO_META_SIZE struct H5O_token_t - __data::NTuple{16, UInt8} + __data::NTuple{16,UInt8} end @enum H5O_type_t::Cint begin H5O_TYPE_UNKNOWN = -1 @@ -159,9 +159,9 @@ const H5O_info_t = H5O_info1_t # The field "otype" is originally "type" # Alias "otype" as "type" for compat with H5O_info2_t -Base.getproperty(oinfo::H5O_info1_t, field::Symbol) = +function Base.getproperty(oinfo::H5O_info1_t, field::Symbol) field == :type ? getfield(oinfo, :otype) : getfield(oinfo, field) - +end struct H5O_info2_t fileno::Culong @@ -208,19 +208,18 @@ struct H5E_error2_t desc::Cstring # optional supplied description end - # MPI communicators required by H5P -abstract type Hmpih end +abstract type Hmpih end primitive type Hmpih32 <: Hmpih 32 end # MPICH C/Fortran, OpenMPI Fortran: 32 bit handles primitive type Hmpih64 <: Hmpih 64 end # OpenMPI C: pointers (mostly 64 bit) # HDFS Drivers struct H5FD_hdfs_fapl_t version::Int32 - namenode_name::NTuple{129, Cchar} + namenode_name::NTuple{129,Cchar} namenode_port::Int32 - user_name::NTuple{129, Cchar} - kerberos_ticket_cache::NTuple{129, Cchar} + user_name::NTuple{129,Cchar} + kerberos_ticket_cache::NTuple{129,Cchar} stream_buffer_size::Int32 end @@ -229,8 +228,8 @@ struct H5FD_splitter_vfd_config_t version::Cuint rw_fapl_id::hid_t wo_fapl_id::hid_t - wo_path::NTuple{4097, Cchar} - log_file_path::NTuple{4097, Cchar} + wo_path::NTuple{4097,Cchar} + log_file_path::NTuple{4097,Cchar} ignore_wo_errs::hbool_t end @@ -241,7 +240,9 @@ end const libhdf5handle = Ref(Libdl.dlopen(libhdf5)) ccall(Libdl.dlsym(libhdf5handle[], :H5open), herr_t, ()) _read_const(sym::Symbol) = unsafe_load(cglobal(Libdl.dlsym(libhdf5handle[], sym), hid_t)) -_has_symbol(sym::Symbol) = Libdl.dlsym(libhdf5handle[], sym; throw_error=false) !== nothing +function _has_symbol(sym::Symbol) + Libdl.dlsym(libhdf5handle[], sym; throw_error = false) !== nothing +end # iteration order constants # Moved to H5_iter_t enum @@ -259,9 +260,9 @@ _has_symbol(sym::Symbol) = Libdl.dlsym(libhdf5handle[], sym; throw_error=false) #const H5_INDEX_N = 2 # dataset constants -const H5D_COMPACT = 0 -const H5D_CONTIGUOUS = 1 -const H5D_CHUNKED = 2 +const H5D_COMPACT = 0 +const H5D_CONTIGUOUS = 1 +const H5D_CHUNKED = 2 # allocation times (C enum H5D_alloc_time_t) const H5D_ALLOC_TIME_ERROR = -1 @@ -283,7 +284,7 @@ const H5D_SPACE_STATUS_ALLOCATED = Cint(2) const H5D_space_status_t = Cint # error-related constants -const H5E_DEFAULT = 0 +const H5E_DEFAULT = 0 const H5E_WALK_UPWARD = 0 const H5E_WALK_DOWNWARD = 1 @@ -299,12 +300,12 @@ const H5F_ACC_SWMR_READ = 0x0040 # Library versions @enum H5F_libver_t::Int32 begin - H5F_LIBVER_ERROR = -1 + H5F_LIBVER_ERROR = -1 H5F_LIBVER_EARLIEST = 0 - H5F_LIBVER_V18 = 1 - H5F_LIBVER_V110 = 2 - H5F_LIBVER_V112 = 3 - H5F_LIBVER_NBOUNDS = 4 + H5F_LIBVER_V18 = 1 + H5F_LIBVER_V110 = 2 + H5F_LIBVER_V112 = 3 + H5F_LIBVER_NBOUNDS = 4 end # H5F_LIBVER_LATEST defined in helpers.jl @@ -314,7 +315,7 @@ const H5F_OBJ_DATASET = 0x0002 const H5F_OBJ_GROUP = 0x0004 const H5F_OBJ_DATATYPE = 0x0008 const H5F_OBJ_ATTR = 0x0010 -const H5F_OBJ_ALL = (H5F_OBJ_FILE|H5F_OBJ_DATASET|H5F_OBJ_GROUP|H5F_OBJ_DATATYPE|H5F_OBJ_ATTR) +const H5F_OBJ_ALL = (H5F_OBJ_FILE | H5F_OBJ_DATASET | H5F_OBJ_GROUP | H5F_OBJ_DATATYPE | H5F_OBJ_ATTR) const H5F_OBJ_LOCAL = 0x0020 # other file constants @@ -335,19 +336,19 @@ const H5FD_MPIO_COLLECTIVE_IO = 0 const H5FD_MPIO_INDIVIDUAL_IO = 1 # object types (C enum H5Itype_t) -const H5I_FILE = 1 -const H5I_GROUP = 2 -const H5I_DATATYPE = 3 -const H5I_DATASPACE = 4 -const H5I_DATASET = 5 -const H5I_ATTR = 6 -const H5I_REFERENCE = 7 -const H5I_VFL = 8 +const H5I_FILE = 1 +const H5I_GROUP = 2 +const H5I_DATATYPE = 3 +const H5I_DATASPACE = 4 +const H5I_DATASET = 5 +const H5I_ATTR = 6 +const H5I_REFERENCE = 7 +const H5I_VFL = 8 # Link constants -const H5L_TYPE_HARD = 0 -const H5L_TYPE_SOFT = 1 -const H5L_TYPE_EXTERNAL= 2 +const H5L_TYPE_HARD = 0 +const H5L_TYPE_SOFT = 1 +const H5L_TYPE_EXTERNAL = 2 # H5O_INFO constants const H5O_INFO_BASIC = Cuint(0x0001) @@ -355,7 +356,8 @@ const H5O_INFO_TIME = Cuint(0x0002) const H5O_INFO_NUM_ATTRS = Cuint(0x0004) const H5O_INFO_HDR = Cuint(0x0008) const H5O_INFO_META_SIZE = Cuint(0x0010) -const H5O_INFO_ALL = H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS | H5O_INFO_HDR | H5O_INFO_META_SIZE +const H5O_INFO_ALL = H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS | H5O_INFO_HDR | + H5O_INFO_META_SIZE # Object constants # Moved to H5O_type_t enum @@ -393,8 +395,8 @@ const H5P_CRT_ORDER_TRACKED = 1 const H5P_CRT_ORDER_INDEXED = 2 # Reference constants -const H5R_OBJECT = 0 -const H5R_DATASET_REGION = 1 +const H5R_OBJECT = 0 +const H5R_DATASET_REGION = 1 const H5R_OBJ_REF_BUF_SIZE = 8 # == sizeof(hobj_ref_t) const H5R_DSET_REG_REF_BUF_SIZE = 12 # == sizeof(hdset_reg_ref_t) @@ -424,18 +426,18 @@ const H5S_SEL_HYPERSLABS = 2 const H5S_SEL_ALL = 3 # type classes (C enum H5T_class_t) -const H5T_NO_CLASS = hid_t(-1) -const H5T_INTEGER = hid_t(0) -const H5T_FLOAT = hid_t(1) -const H5T_TIME = hid_t(2) # not supported by HDF5 library -const H5T_STRING = hid_t(3) -const H5T_BITFIELD = hid_t(4) -const H5T_OPAQUE = hid_t(5) -const H5T_COMPOUND = hid_t(6) -const H5T_REFERENCE = hid_t(7) -const H5T_ENUM = hid_t(8) -const H5T_VLEN = hid_t(9) -const H5T_ARRAY = hid_t(10) +const H5T_NO_CLASS = hid_t(-1) +const H5T_INTEGER = hid_t(0) +const H5T_FLOAT = hid_t(1) +const H5T_TIME = hid_t(2) # not supported by HDF5 library +const H5T_STRING = hid_t(3) +const H5T_BITFIELD = hid_t(4) +const H5T_OPAQUE = hid_t(5) +const H5T_COMPOUND = hid_t(6) +const H5T_REFERENCE = hid_t(7) +const H5T_ENUM = hid_t(8) +const H5T_VLEN = hid_t(9) +const H5T_ARRAY = hid_t(10) # Byte orders (C enum H5T_order_t) const H5T_ORDER_ERROR = -1 # error @@ -452,18 +454,18 @@ const H5T_NORM_MSBSET = 1 # msb of mantissa is always 1 const H5T_NORM_NONE = 2 # not normalized # Character types -const H5T_CSET_ASCII = 0 -const H5T_CSET_UTF8 = 1 +const H5T_CSET_ASCII = 0 +const H5T_CSET_UTF8 = 1 # Sign types (C enum H5T_sign_t) -const H5T_SGN_ERROR = Cint(-1) # error -const H5T_SGN_NONE = Cint(0) # unsigned -const H5T_SGN_2 = Cint(1) # 2's complement -const H5T_NSGN = Cint(2) # sentinel: this must be last! +const H5T_SGN_ERROR = Cint(-1) # error +const H5T_SGN_NONE = Cint(0) # unsigned +const H5T_SGN_2 = Cint(1) # 2's complement +const H5T_NSGN = Cint(2) # sentinel: this must be last! # Search directions -const H5T_DIR_ASCEND = 1 -const H5T_DIR_DESCEND = 2 +const H5T_DIR_ASCEND = 1 +const H5T_DIR_DESCEND = 2 # String padding modes const H5T_STR_NULLTERM = 0 @@ -495,17 +497,17 @@ const H5T_C_S1 = _read_const(:H5T_C_S1_g) const H5T_STD_REF_OBJ = _read_const(:H5T_STD_REF_OBJ_g) const H5T_STD_REF_DSETREG = _read_const(:H5T_STD_REF_DSETREG_g) # Native types -const H5T_NATIVE_B8 = _read_const(:H5T_NATIVE_B8_g) -const H5T_NATIVE_INT8 = _read_const(:H5T_NATIVE_INT8_g) -const H5T_NATIVE_UINT8 = _read_const(:H5T_NATIVE_UINT8_g) -const H5T_NATIVE_INT16 = _read_const(:H5T_NATIVE_INT16_g) -const H5T_NATIVE_UINT16 = _read_const(:H5T_NATIVE_UINT16_g) -const H5T_NATIVE_INT32 = _read_const(:H5T_NATIVE_INT32_g) -const H5T_NATIVE_UINT32 = _read_const(:H5T_NATIVE_UINT32_g) -const H5T_NATIVE_INT64 = _read_const(:H5T_NATIVE_INT64_g) -const H5T_NATIVE_UINT64 = _read_const(:H5T_NATIVE_UINT64_g) -const H5T_NATIVE_FLOAT = _read_const(:H5T_NATIVE_FLOAT_g) -const H5T_NATIVE_DOUBLE = _read_const(:H5T_NATIVE_DOUBLE_g) +const H5T_NATIVE_B8 = _read_const(:H5T_NATIVE_B8_g) +const H5T_NATIVE_INT8 = _read_const(:H5T_NATIVE_INT8_g) +const H5T_NATIVE_UINT8 = _read_const(:H5T_NATIVE_UINT8_g) +const H5T_NATIVE_INT16 = _read_const(:H5T_NATIVE_INT16_g) +const H5T_NATIVE_UINT16 = _read_const(:H5T_NATIVE_UINT16_g) +const H5T_NATIVE_INT32 = _read_const(:H5T_NATIVE_INT32_g) +const H5T_NATIVE_UINT32 = _read_const(:H5T_NATIVE_UINT32_g) +const H5T_NATIVE_INT64 = _read_const(:H5T_NATIVE_INT64_g) +const H5T_NATIVE_UINT64 = _read_const(:H5T_NATIVE_UINT64_g) +const H5T_NATIVE_FLOAT = _read_const(:H5T_NATIVE_FLOAT_g) +const H5T_NATIVE_DOUBLE = _read_const(:H5T_NATIVE_DOUBLE_g) # Other type constants const H5T_VARIABLE = reinterpret(UInt, -1) @@ -593,7 +595,6 @@ end H5Z_NO_EDC = 2 end - # Callbacks # typedef herr_t ( * H5P_prp_cb1_t ) ( const char * name , size_t size , void * value ) const H5P_prp_cb1_t = Ptr{Cvoid} @@ -634,7 +635,6 @@ struct H5Z_cb_t op_data::Ptr{Cvoid} end - @enum H5C_cache_incr_mode::UInt32 begin H5C_incr__off = 0 H5C_incr__threshold = 1 @@ -652,13 +652,12 @@ end H5C_decr__age_out_with_threshold = 3 end - struct H5AC_cache_config_t version::Cint rpt_fcn_enabled::hbool_t open_trace_file::hbool_t close_trace_file::hbool_t - trace_file_name::NTuple{1025, Cchar} + trace_file_name::NTuple{1025,Cchar} evictions_enabled::hbool_t set_initial_size::hbool_t initial_size::Csize_t @@ -732,5 +731,5 @@ end struct H5F_retry_info_t nbins::Cuint - retries::NTuple{21, Ptr{UInt32}} + retries::NTuple{21,Ptr{UInt32}} end diff --git a/src/api_midlevel.jl b/src/api_midlevel.jl index 3bf8d4b0c..1c7bf377b 100644 --- a/src/api_midlevel.jl +++ b/src/api_midlevel.jl @@ -1,203 +1,210 @@ -# This file defines midlevel api wrappers. We include name normalization for methods that are -# applicable to different hdf5 api-layers. We still try to adhere close proximity to the underlying -# method name in the hdf5-library. - -""" - HDF5.set_extent_dims(dset::HDF5.Dataset, new_dims::Dims) - -Change the current dimensions of a dataset to `new_dims`, limited by -`max_dims = get_extent_dims(dset)[2]`. Reduction is possible and leads to loss of truncated data. -""" -function set_extent_dims(dset::Dataset, size::Dims) - checkvalid(dset) - API.h5d_set_extent(dset, API.hsize_t[reverse(size)...]) -end - -""" - HDF5.set_extent_dims(dspace::HDF5.Dataspace, new_dims::Dims, max_dims::Union{Dims,Nothing} = nothing) - -Change the dimensions of a dataspace `dspace` to `new_dims`, optionally with the maximum possible -dimensions `max_dims` different from the active size `new_dims`. If not given, `max_dims` is set equal -to `new_dims`. -""" -function set_extent_dims(dspace::Dataspace, size::Dims, max_dims::Union{Dims,Nothing} = nothing) - checkvalid(dspace) - rank = length(size) - current_size = API.hsize_t[reverse(size)...] - maximum_size = isnothing(max_dims) ? C_NULL : [reverse(max_dims .% API.hsize_t)...] - API.h5s_set_extent_simple(dspace, rank, current_size, maximum_size) - return nothing -end - -""" - HDF5.get_extent_dims(obj::Union{HDF5.Dataspace, HDF5.Dataset, HDF5.Attribute}) -> dims, maxdims - -Get the array dimensions from a dataspace, dataset, or attribute and return a tuple of `dims` and `maxdims`. -""" -function get_extent_dims(obj::Union{Dataspace,Dataset,Attribute}) - dspace = obj isa Dataspace ? checkvalid(obj) : dataspace(obj) - h5_dims, h5_maxdims = API.h5s_get_simple_extent_dims(dspace) - # reverse dimensions since hdf5 uses C-style order - N = length(h5_dims) - dims = ntuple(i -> @inbounds(Int(h5_dims[N-i+1])), N) - maxdims = ntuple(i -> @inbounds(h5_maxdims[N-i+1]) % Int, N) # allows max_dims to be specified as -1 without triggering an overflow - obj isa Dataspace || close(dspace) - return dims, maxdims -end - -""" - HDF5.get_chunk_offset(dataset_id, index) - -Get 0-based offset of chunk from 0-based `index`. The offsets are returned in Julia's column-major order rather than hdf5 row-major order. -For a 1-based API, see `HDF5.ChunkStorage`. -""" -function get_chunk_offset(dataset_id, index) - extent = size(dataset_id) - chunk = get_chunk(dataset_id) - chunk_indices = CartesianIndices(ntuple(i -> 0:extent[i]รทchunk[i]-1, length(extent))) - offset = API.hsize_t.(chunk_indices[index + 1].I .* chunk) - return offset -end - -""" - HDF5.get_chunk_index(dataset_id, offset) - -Get 0-based index of chunk from 0-based `offset` returned in Julia's column-major order. -For a 1-based API, see `HDF5.ChunkStorage`. -""" -function get_chunk_index(dataset_id, offset) - extent = size(dataset_id) - chunk = get_chunk(dataset_id) - chunk_indices = LinearIndices(ntuple(i->0:extent[i]รทchunk[i]-1, length(extent))) - chunk_indices[(offset .รท chunk .+ 1)...] - 1 -end - -""" - HDF5.get_num_chunks_per_dim(dataset_id) - -Get the number of chunks in each dimension in Julia's column-major order. -""" -function get_num_chunks_per_dim(dataset_id) - extent = size(dataset_id) - chunk = get_chunk(dataset_id) - return extent .รท chunk -end - -""" - HDF5.get_num_chunks(dataset_id) - -Returns the number of chunks in a dataset. Equivalent to `API.h5d_get_num_chunks(dataset_id, HDF5.H5S_ALL)`. -""" -function get_num_chunks(dataset_id) - @static if v"1.10.5" โ‰ค API._libhdf5_build_ver - API.h5d_get_num_chunks(dataset_id) - else - prod(get_num_chunks_per_dim(dataset_id)) - end -end - -""" - HDF5.get_chunk_length(dataset_id) - -Retrieves the chunk size in bytes. Equivalent to `API.h5d_get_chunk_info(dataset_id, index)[:size]`. -""" -function get_chunk_length(dataset_id) - type = API.h5d_get_type(dataset_id) - chunk = get_chunk(dataset_id) - return Int(API.h5t_get_size(type) * prod(chunk)) -end - -vlen_get_buf_size(dset::Dataset, dtype::Datatype, dspace::Dataspace) = - API.h5d_vlen_get_buf_size(dset, dtype, dspace) -function vlen_get_buf_size(dataset_id) - type = API.h5d_get_type(dataset_id) - space = API.h5d_get_space(dataset_id) - API.h5d_vlen_get_buf_size(dataset_id, type, space) -end - -""" - HDF5.read_chunk(dataset_id, offset, [buf]; dxpl_id = HDF5.API.H5P_DEFAULT, filters = Ref{UInt32}()) - -Helper method to read chunks via 0-based offsets in a `Tuple`. - -Argument `buf` is optional and defaults to a `Vector{UInt8}` of length determined by `HDF5.get_chunk_length`. -Argument `dxpl_id` can be supplied a keyword and defaults to `HDF5.API.H5P_DEFAULT`. -Argument `filters` can be retrieved by supplying a `Ref{UInt32}` value via a keyword argument. - -This method returns `Vector{UInt8}`. -""" -function read_chunk(dataset_id, offset, - buf::Vector{UInt8} = Vector{UInt8}(undef, get_chunk_length(dataset_id)); - dxpl_id = API.H5P_DEFAULT, - filters = Ref{UInt32}() - ) - API.h5d_read_chunk(dataset_id, dxpl_id, offset, filters, buf) - return buf -end - -""" - HDF5.read_chunk(dataset_id, index::Integer, [buf]; dxpl_id = HDF5.API.H5P_DEFAULT, filters = Ref{UInt32}()) - -Helper method to read chunks via 0-based integer `index`. - -Argument `buf` is optional and defaults to a `Vector{UInt8}` of length determined by `HDF5.h5d_get_chunk_info`. -Argument `dxpl_id` can be supplied a keyword and defaults to `HDF5.API.H5P_DEFAULT`. -Argument `filters` can be retrieved by supplying a `Ref{UInt32}` value via a keyword argument. - -This method returns `Vector{UInt8}`. -""" -function read_chunk(dataset_id, index::Integer, - buf::Vector{UInt8} = Vector{UInt8}(undef, get_chunk_length(dataset_id)); - dxpl_id = API.H5P_DEFAULT, - filters = Ref{UInt32}() - ) - offset = [reverse(get_chunk_offset(dataset_id, index))...] - read_chunk(dataset_id, offset, buf; dxpl_id = dxpl_id, filters = filters) -end - -""" - HDF5.write_chunk(dataset_id, offset, buf::AbstractArray; dxpl_id = HDF5.API.H5P_DEFAULT, filter_mask = 0) - -Helper method to write chunks via 0-based offsets `offset` as a `Tuple`. -""" -function write_chunk(dataset_id, offset, buf::AbstractArray; dxpl_id = API.H5P_DEFAULT, filter_mask = 0) - # Borrowed from write_dataset stride detection - stride(buf, 1) == 1 || throw(ArgumentError("Cannot write arrays with a different stride than `Array`")) - API.h5d_write_chunk(dataset_id, dxpl_id, filter_mask, offset, sizeof(buf), buf) -end - -function write_chunk(dataset_id, offset, buf::Union{DenseArray,Base.FastContiguousSubArray}; dxpl_id = API.H5P_DEFAULT, filter_mask = 0) - # We can bypass the need to check stride with Array and FastContiguousSubArray - API.h5d_write_chunk(dataset_id, dxpl_id, filter_mask, offset, sizeof(buf), buf) -end - -""" - HDF5.write_chunk(dataset_id, index::Integer, buf::AbstractArray; dxpl_id = API.H5P_DEFAULT, filter_mask = 0) - -Helper method to write chunks via 0-based integer `index`. -""" -function write_chunk(dataset_id, index::Integer, buf::AbstractArray; dxpl_id = API.H5P_DEFAULT, filter_mask = 0) - offset = [reverse(get_chunk_offset(dataset_id, index))...] - write_chunk(dataset_id, offset, buf; dxpl_id = dxpl_id, filter_mask = filter_mask) -end - -# Avoid ambiguous method with offset based versions -function write_chunk(dataset_id, index::Integer, buf::Union{DenseArray,Base.FastContiguousSubArray}; dxpl_id = API.H5P_DEFAULT, filter_mask = 0) - # We can bypass the need to check stride with Array and FastContiguousSubArray - offset = [reverse(get_chunk_offset(dataset_id, index))...] - write_chunk(dataset_id, offset, buf; dxpl_id = dxpl_id, filter_mask = filter_mask) -end - -function get_fill_value(plist_id, ::Type{T}) where T - value = Ref{T}() - API.h5p_get_fill_value(plist_id, datatype(T), value) - return value[] -end - -get_fill_value(plist_id) = get_fill_value(plist_id, Float64) - -function set_fill_value!(plist_id, value) - ref_value = Ref(value) - API.h5p_set_fill_value(plist_id, datatype(value), ref_value) - return plist_id -end +# This file defines midlevel api wrappers. We include name normalization for methods that are +# applicable to different hdf5 api-layers. We still try to adhere close proximity to the underlying +# method name in the hdf5-library. + +""" + HDF5.set_extent_dims(dset::HDF5.Dataset, new_dims::Dims) + +Change the current dimensions of a dataset to `new_dims`, limited by +`max_dims = get_extent_dims(dset)[2]`. Reduction is possible and leads to loss of truncated data. +""" +function set_extent_dims(dset::Dataset, size::Dims) + checkvalid(dset) + API.h5d_set_extent(dset, API.hsize_t[reverse(size)...]) +end + +""" + HDF5.set_extent_dims(dspace::HDF5.Dataspace, new_dims::Dims, max_dims::Union{Dims,Nothing} = nothing) + +Change the dimensions of a dataspace `dspace` to `new_dims`, optionally with the maximum possible +dimensions `max_dims` different from the active size `new_dims`. If not given, `max_dims` is set equal +to `new_dims`. +""" +function set_extent_dims(dspace::Dataspace, size::Dims, + max_dims::Union{Dims,Nothing} = nothing) + checkvalid(dspace) + rank = length(size) + current_size = API.hsize_t[reverse(size)...] + maximum_size = isnothing(max_dims) ? C_NULL : [reverse(max_dims .% API.hsize_t)...] + API.h5s_set_extent_simple(dspace, rank, current_size, maximum_size) + return nothing +end + +""" + HDF5.get_extent_dims(obj::Union{HDF5.Dataspace, HDF5.Dataset, HDF5.Attribute}) -> dims, maxdims + +Get the array dimensions from a dataspace, dataset, or attribute and return a tuple of `dims` and `maxdims`. +""" +function get_extent_dims(obj::Union{Dataspace,Dataset,Attribute}) + dspace = obj isa Dataspace ? checkvalid(obj) : dataspace(obj) + h5_dims, h5_maxdims = API.h5s_get_simple_extent_dims(dspace) + # reverse dimensions since hdf5 uses C-style order + N = length(h5_dims) + dims = ntuple(i -> @inbounds(Int(h5_dims[N - i + 1])), N) + maxdims = ntuple(i -> @inbounds(h5_maxdims[N - i + 1]) % Int, N) # allows max_dims to be specified as -1 without triggering an overflow + obj isa Dataspace || close(dspace) + return dims, maxdims +end + +""" + HDF5.get_chunk_offset(dataset_id, index) + +Get 0-based offset of chunk from 0-based `index`. The offsets are returned in Julia's column-major order rather than hdf5 row-major order. +For a 1-based API, see `HDF5.ChunkStorage`. +""" +function get_chunk_offset(dataset_id, index) + extent = size(dataset_id) + chunk = get_chunk(dataset_id) + chunk_indices = CartesianIndices(ntuple(i -> 0:(extent[i] รท chunk[i] - 1), + length(extent))) + offset = API.hsize_t.(chunk_indices[index + 1].I .* chunk) + return offset +end + +""" + HDF5.get_chunk_index(dataset_id, offset) + +Get 0-based index of chunk from 0-based `offset` returned in Julia's column-major order. +For a 1-based API, see `HDF5.ChunkStorage`. +""" +function get_chunk_index(dataset_id, offset) + extent = size(dataset_id) + chunk = get_chunk(dataset_id) + chunk_indices = LinearIndices(ntuple(i -> 0:(extent[i] รท chunk[i] - 1), length(extent))) + chunk_indices[(offset .รท chunk .+ 1)...] - 1 +end + +""" + HDF5.get_num_chunks_per_dim(dataset_id) + +Get the number of chunks in each dimension in Julia's column-major order. +""" +function get_num_chunks_per_dim(dataset_id) + extent = size(dataset_id) + chunk = get_chunk(dataset_id) + return extent .รท chunk +end + +""" + HDF5.get_num_chunks(dataset_id) + +Returns the number of chunks in a dataset. Equivalent to `API.h5d_get_num_chunks(dataset_id, HDF5.H5S_ALL)`. +""" +function get_num_chunks(dataset_id) + @static if v"1.10.5" โ‰ค API._libhdf5_build_ver + API.h5d_get_num_chunks(dataset_id) + else + prod(get_num_chunks_per_dim(dataset_id)) + end +end + +""" + HDF5.get_chunk_length(dataset_id) + +Retrieves the chunk size in bytes. Equivalent to `API.h5d_get_chunk_info(dataset_id, index)[:size]`. +""" +function get_chunk_length(dataset_id) + type = API.h5d_get_type(dataset_id) + chunk = get_chunk(dataset_id) + return Int(API.h5t_get_size(type) * prod(chunk)) +end + +function vlen_get_buf_size(dset::Dataset, dtype::Datatype, dspace::Dataspace) + API.h5d_vlen_get_buf_size(dset, dtype, dspace) +end +function vlen_get_buf_size(dataset_id) + type = API.h5d_get_type(dataset_id) + space = API.h5d_get_space(dataset_id) + API.h5d_vlen_get_buf_size(dataset_id, type, space) +end + +""" + HDF5.read_chunk(dataset_id, offset, [buf]; dxpl_id = HDF5.API.H5P_DEFAULT, filters = Ref{UInt32}()) + +Helper method to read chunks via 0-based offsets in a `Tuple`. + +Argument `buf` is optional and defaults to a `Vector{UInt8}` of length determined by `HDF5.get_chunk_length`. +Argument `dxpl_id` can be supplied a keyword and defaults to `HDF5.API.H5P_DEFAULT`. +Argument `filters` can be retrieved by supplying a `Ref{UInt32}` value via a keyword argument. + +This method returns `Vector{UInt8}`. +""" +function read_chunk(dataset_id, offset, + buf::Vector{UInt8} = Vector{UInt8}(undef, get_chunk_length(dataset_id)); + dxpl_id = API.H5P_DEFAULT, + filters = Ref{UInt32}()) + API.h5d_read_chunk(dataset_id, dxpl_id, offset, filters, buf) + return buf +end + +""" + HDF5.read_chunk(dataset_id, index::Integer, [buf]; dxpl_id = HDF5.API.H5P_DEFAULT, filters = Ref{UInt32}()) + +Helper method to read chunks via 0-based integer `index`. + +Argument `buf` is optional and defaults to a `Vector{UInt8}` of length determined by `HDF5.h5d_get_chunk_info`. +Argument `dxpl_id` can be supplied a keyword and defaults to `HDF5.API.H5P_DEFAULT`. +Argument `filters` can be retrieved by supplying a `Ref{UInt32}` value via a keyword argument. + +This method returns `Vector{UInt8}`. +""" +function read_chunk(dataset_id, index::Integer, + buf::Vector{UInt8} = Vector{UInt8}(undef, get_chunk_length(dataset_id)); + dxpl_id = API.H5P_DEFAULT, + filters = Ref{UInt32}()) + offset = [reverse(get_chunk_offset(dataset_id, index))...] + read_chunk(dataset_id, offset, buf; dxpl_id = dxpl_id, filters = filters) +end + +""" + HDF5.write_chunk(dataset_id, offset, buf::AbstractArray; dxpl_id = HDF5.API.H5P_DEFAULT, filter_mask = 0) + +Helper method to write chunks via 0-based offsets `offset` as a `Tuple`. +""" +function write_chunk(dataset_id, offset, buf::AbstractArray; dxpl_id = API.H5P_DEFAULT, + filter_mask = 0) + # Borrowed from write_dataset stride detection + stride(buf, 1) == 1 || + throw(ArgumentError("Cannot write arrays with a different stride than `Array`")) + API.h5d_write_chunk(dataset_id, dxpl_id, filter_mask, offset, sizeof(buf), buf) +end + +function write_chunk(dataset_id, offset, buf::Union{DenseArray,Base.FastContiguousSubArray}; + dxpl_id = API.H5P_DEFAULT, filter_mask = 0) + # We can bypass the need to check stride with Array and FastContiguousSubArray + API.h5d_write_chunk(dataset_id, dxpl_id, filter_mask, offset, sizeof(buf), buf) +end + +""" + HDF5.write_chunk(dataset_id, index::Integer, buf::AbstractArray; dxpl_id = API.H5P_DEFAULT, filter_mask = 0) + +Helper method to write chunks via 0-based integer `index`. +""" +function write_chunk(dataset_id, index::Integer, buf::AbstractArray; + dxpl_id = API.H5P_DEFAULT, filter_mask = 0) + offset = [reverse(get_chunk_offset(dataset_id, index))...] + write_chunk(dataset_id, offset, buf; dxpl_id = dxpl_id, filter_mask = filter_mask) +end + +# Avoid ambiguous method with offset based versions +function write_chunk(dataset_id, index::Integer, + buf::Union{DenseArray,Base.FastContiguousSubArray}; + dxpl_id = API.H5P_DEFAULT, filter_mask = 0) + # We can bypass the need to check stride with Array and FastContiguousSubArray + offset = [reverse(get_chunk_offset(dataset_id, index))...] + write_chunk(dataset_id, offset, buf; dxpl_id = dxpl_id, filter_mask = filter_mask) +end + +function get_fill_value(plist_id, ::Type{T}) where {T} + value = Ref{T}() + API.h5p_get_fill_value(plist_id, datatype(T), value) + return value[] +end + +get_fill_value(plist_id) = get_fill_value(plist_id, Float64) + +function set_fill_value!(plist_id, value) + ref_value = Ref(value) + API.h5p_set_fill_value(plist_id, datatype(value), ref_value) + return plist_id +end diff --git a/src/attributes.jl b/src/attributes.jl index c2810e2ce..1b0118c97 100644 --- a/src/attributes.jl +++ b/src/attributes.jl @@ -25,7 +25,6 @@ function Base.close(obj::Attribute) end name(attr::Attribute) = API.h5a_get_name(attr) - datatype(dset::Attribute) = Datatype(API.h5a_get_type(checkvalid(dset)), file(dset)) dataspace(attr::Attribute) = Dataspace(API.h5a_get_space(checkvalid(attr))) @@ -64,8 +63,10 @@ read_attribute(attr::Attribute, memtype::Datatype, buf) = API.h5a_read(attr, mem Open the [`Attribute`](@ref) named `name` on the object `parent`. """ -open_attribute(parent::Union{File,Object}, name::AbstractString, aapl::AttributeAccessProperties=AttributeAccessProperties()) = +function open_attribute(parent::Union{File,Object}, name::AbstractString, + aapl::AttributeAccessProperties = AttributeAccessProperties()) Attribute(API.h5a_open(checkvalid(parent), name, aapl), file(parent)) +end """ create_attribute(parent::Union{File,Object}, name::AbstractString, dtype::Datatype, space::Dataspace) @@ -86,8 +87,10 @@ function create_attribute(parent::Union{File,Object}, name::AbstractString, data end return obj, dtype end -function create_attribute(parent::Union{File,Object}, name::AbstractString, dtype::Datatype, dspace::Dataspace) - attrid = API.h5a_create(checkvalid(parent), name, dtype, dspace, _attr_properties(name), API.H5P_DEFAULT) +function create_attribute(parent::Union{File,Object}, name::AbstractString, dtype::Datatype, + dspace::Dataspace) + attrid = API.h5a_create(checkvalid(parent), name, dtype, dspace, _attr_properties(name), + API.H5P_DEFAULT) return Attribute(attrid, file(parent)) end @@ -95,7 +98,8 @@ end write_attribute(attr::Attribute, memtype::Datatype, x) = API.h5a_write(attr, memtype, x) # specific methods function write_attribute(attr::Attribute, memtype::Datatype, x::AbstractArray) - length(x) == length(attr) || throw(ArgumentError("Invalid length: $(length(x)) != $(length(attr)), for attribute \"$(name(attr))\"")) + length(x) == length(attr) || + throw(ArgumentError("Invalid length: $(length(x)) != $(length(attr)), for attribute \"$(name(attr))\"")) API.h5a_write(attr, memtype, x) end function write_attribute(attr::Attribute, memtype::Datatype, str::AbstractString) @@ -105,7 +109,8 @@ function write_attribute(attr::Attribute, memtype::Datatype, str::AbstractString write_attribute(attr, memtype, buf) end end -function write_attribute(attr::Attribute, memtype::Datatype, x::T) where {T<:Union{ScalarType,Complex{<:ScalarType}}} +function write_attribute(attr::Attribute, memtype::Datatype, + x::T) where {T<:Union{ScalarType,Complex{<:ScalarType}}} tmp = Ref{T}(x) write_attribute(attr, memtype, tmp) end @@ -139,16 +144,19 @@ end Rename the [`Attribute`](@ref) of the object `parent` named `oldname` to `newname`. """ -rename_attribute(parent::Union{File,Object}, oldname::AbstractString, newname::AbstractString) = +function rename_attribute(parent::Union{File,Object}, oldname::AbstractString, + newname::AbstractString) API.h5a_rename(checkvalid(parent), oldname, newname) +end """ delete_attribute(parent::Union{File,Object}, name::AbstractString) Delete the [`Attribute`](@ref) named `name` on the object `parent`. """ -delete_attribute(parent::Union{File,Object}, path::AbstractString) = API.h5a_delete(checkvalid(parent), path) - +function delete_attribute(parent::Union{File,Object}, path::AbstractString) + API.h5a_delete(checkvalid(parent), path) +end """ h5writeattr(filename, name::AbstractString, data::Dict) @@ -173,7 +181,7 @@ Read the attributes of the object at `name` in the HDF5 file `filename`, returni """ function h5readattr(filename, name::AbstractString) local dat - file = h5open(filename,"r") + file = h5open(filename, "r") try obj = file[name] dat = Dict(attrs(obj)) @@ -222,7 +230,9 @@ function attrs(parent) return AttributeDict(parent) end -Base.haskey(attrdict::AttributeDict, path::AbstractString) = API.h5a_exists(checkvalid(attrdict.parent), path) +function Base.haskey(attrdict::AttributeDict, path::AbstractString) + API.h5a_exists(checkvalid(attrdict.parent), path) +end Base.length(attrdict::AttributeDict) = num_attrs(attrdict.parent) function Base.getindex(x::AttributeDict, name::AbstractString) @@ -248,13 +258,16 @@ function Base.setindex!(attrdict::AttributeDict, val, name::AbstractString) write_attribute(attrdict.parent, name, val) end end -Base.delete!(attrdict::AttributeDict, path::AbstractString) = delete_attribute(attrdict.parent, path) +function Base.delete!(attrdict::AttributeDict, path::AbstractString) + delete_attribute(attrdict.parent, path) +end function Base.keys(attrdict::AttributeDict) # faster than iteratively calling h5a_get_name_by_idx checkvalid(attrdict.parent) keyvec = sizehint!(String[], length(attrdict)) - API.h5a_iterate(attrdict.parent, idx_type(attrdict.parent), order(attrdict.parent)) do _, attr_name, _ + API.h5a_iterate(attrdict.parent, idx_type(attrdict.parent), + order(attrdict.parent)) do _, attr_name, _ push!(keyvec, unsafe_string(attr_name)) return false end @@ -275,9 +288,6 @@ function Base.iterate(attrdict::AttributeDict, (keyvec, n)) return (key => attrdict[key]), (keyvec, nn) end - - - struct Attributes parent::Union{File,Object} end @@ -297,8 +307,12 @@ function Base.getindex(x::Attributes, name::AbstractString) haskey(x, name) || throw(KeyError(name)) open_attribute(x.parent, name) end -Base.setindex!(x::Attributes, val, name::AbstractString) = write_attribute(x.parent, name, val) -Base.haskey(attr::Attributes, path::AbstractString) = API.h5a_exists(checkvalid(attr.parent), path) +function Base.setindex!(x::Attributes, val, name::AbstractString) + write_attribute(x.parent, name, val) +end +function Base.haskey(attr::Attributes, path::AbstractString) + API.h5a_exists(checkvalid(attr.parent), path) +end Base.length(x::Attributes) = num_attrs(x.parent) function Base.keys(x::Attributes) @@ -313,10 +327,14 @@ end Base.read(attr::Attributes, name::AbstractString) = read_attribute(attr.parent, name) # Dataset methods which act like attributes -Base.write(parent::Dataset, name::AbstractString, data; pv...) = write_attribute(parent, name, data; pv...) +function Base.write(parent::Dataset, name::AbstractString, data; pv...) + write_attribute(parent, name, data; pv...) +end function Base.getindex(dset::Dataset, name::AbstractString) haskey(dset, name) || throw(KeyError(name)) open_attribute(dset, name) end Base.setindex!(dset::Dataset, val, name::AbstractString) = write_attribute(dset, name, val) -Base.haskey(dset::Union{Dataset,Datatype}, path::AbstractString) = API.h5a_exists(checkvalid(dset), path) +function Base.haskey(dset::Union{Dataset,Datatype}, path::AbstractString) + API.h5a_exists(checkvalid(dset), path) +end diff --git a/src/context.jl b/src/context.jl index 3c432eb80..3ed088e00 100644 --- a/src/context.jl +++ b/src/context.jl @@ -38,51 +38,51 @@ serves as the default context if the current task does not have a * string_create """ struct HDF5Context - attribute_access::AttributeAccessProperties - attribute_create::AttributeCreateProperties - dataset_access ::DatasetAccessProperties - dataset_create ::DatasetCreateProperties - dataset_transfer::DatasetTransferProperties - datatype_access ::DatatypeAccessProperties - datatype_create ::DatatypeCreateProperties - file_access ::FileAccessProperties - file_create ::FileCreateProperties - file_mount ::FileMountProperties - group_access ::GroupAccessProperties - group_create ::GroupCreateProperties - link_access ::LinkAccessProperties - link_create ::LinkCreateProperties - object_copy ::ObjectCopyProperties - object_create ::ObjectCreateProperties - string_create ::StringCreateProperties + attribute_access :: AttributeAccessProperties + attribute_create :: AttributeCreateProperties + dataset_access :: DatasetAccessProperties + dataset_create :: DatasetCreateProperties + dataset_transfer :: DatasetTransferProperties + datatype_access :: DatatypeAccessProperties + datatype_create :: DatatypeCreateProperties + file_access :: FileAccessProperties + file_create :: FileCreateProperties + file_mount :: FileMountProperties + group_access :: GroupAccessProperties + group_create :: GroupCreateProperties + link_access :: LinkAccessProperties + link_create :: LinkCreateProperties + object_copy :: ObjectCopyProperties + object_create :: ObjectCreateProperties + string_create :: StringCreateProperties end -Base.copy(ctx::HDF5Context) = +function Base.copy(ctx::HDF5Context) HDF5Context(map(n -> copy(getfield(ctx, n)), fieldnames(HDF5Context))...) +end -Base.close(ctx::HDF5Context) = +function Base.close(ctx::HDF5Context) foreach(n -> close(getfield(ctx, n)), fieldnames(HDF5Context)) +end function HDF5Context() - HDF5Context( - AttributeAccessProperties(), - AttributeCreateProperties(), - DatasetAccessProperties(), - DatasetCreateProperties(), - DatasetTransferProperties(), - DatatypeAccessProperties(), - DatatypeCreateProperties(), - FileAccessProperties(), - FileCreateProperties(), - FileMountProperties(), - GroupAccessProperties(), - GroupCreateProperties(), - LinkAccessProperties(), - LinkCreateProperties(), - ObjectCopyProperties(), - ObjectCreateProperties(), - StringCreateProperties(), - ) + HDF5Context(AttributeAccessProperties(), + AttributeCreateProperties(), + DatasetAccessProperties(), + DatasetCreateProperties(), + DatasetTransferProperties(), + DatatypeAccessProperties(), + DatatypeCreateProperties(), + FileAccessProperties(), + FileCreateProperties(), + FileMountProperties(), + GroupAccessProperties(), + GroupCreateProperties(), + LinkAccessProperties(), + LinkCreateProperties(), + ObjectCopyProperties(), + ObjectCreateProperties(), + StringCreateProperties()) end """ @@ -103,5 +103,6 @@ Retrieve a property list from the task local context, defaulting to `HDF5.CONTEXT` if `task_local_storage()[:hdf5_context]` does not exist. """ -get_context_property(name::Symbol) = +function get_context_property(name::Symbol) getfield(get(task_local_storage(), :hdf5_context, CONTEXT), name) +end diff --git a/src/datasets.jl b/src/datasets.jl index aa61d5a0b..ea36c9f60 100644 --- a/src/datasets.jl +++ b/src/datasets.jl @@ -5,11 +5,12 @@ dataspace(dset::Dataset) = Dataspace(API.h5d_get_space(checkvalid(dset))) # Open Dataset -open_dataset(parent::Union{File,Group}, - name::AbstractString, - dapl::DatasetAccessProperties=DatasetAccessProperties(), - dxpl::DatasetTransferProperties=DatasetTransferProperties() -) = Dataset(API.h5d_open(checkvalid(parent), name, dapl), file(parent), dxpl) +function open_dataset(parent::Union{File,Group}, + name::AbstractString, + dapl::DatasetAccessProperties = DatasetAccessProperties(), + dxpl::DatasetTransferProperties = DatasetTransferProperties()) + Dataset(API.h5d_open(checkvalid(parent), name, dapl), file(parent), dxpl) +end # Setting dset creation properties with name/value pairs """ @@ -38,18 +39,18 @@ Additionally, the initial create, transfer, and access properties can be provide See also * [`H5P`](@ref H5P) """ -function create_dataset( - parent::Union{File,Group}, - path::Union{AbstractString,Nothing}, - dtype::Datatype, - dspace::Dataspace; - dcpl::DatasetCreateProperties = DatasetCreateProperties(), - dxpl::DatasetTransferProperties = DatasetTransferProperties(), - dapl::DatasetAccessProperties = DatasetAccessProperties(), - pv... -) - !isnothing(path) && haskey(parent, path) && error("cannot create dataset: object \"", path, "\" already exists at ", name(parent)) - pv = setproperties!(dcpl,dxpl,dapl; pv...) +function create_dataset(parent::Union{File,Group}, + path::Union{AbstractString,Nothing}, + dtype::Datatype, + dspace::Dataspace; + dcpl::DatasetCreateProperties = DatasetCreateProperties(), + dxpl::DatasetTransferProperties = DatasetTransferProperties(), + dapl::DatasetAccessProperties = DatasetAccessProperties(), + pv...) + !isnothing(path) && haskey(parent, path) && + error("cannot create dataset: object \"", path, "\" already exists at ", + name(parent)) + pv = setproperties!(dcpl, dxpl, dapl; pv...) isempty(pv) || error("invalid keyword options") if isnothing(path) ds = API.h5d_create_anon(parent, dtype, dspace, dcpl, dapl) @@ -58,11 +59,28 @@ function create_dataset( end Dataset(ds, file(parent), dxpl) end -create_dataset(parent::Union{File,Group}, path::Union{AbstractString,Nothing}, dtype::Datatype, dspace_dims::Dims; pv...) = create_dataset(checkvalid(parent), path, dtype, dataspace(dspace_dims); pv...) -create_dataset(parent::Union{File,Group}, path::Union{AbstractString,Nothing}, dtype::Datatype, dspace_dims::Tuple{Dims,Dims}; pv...) = create_dataset(checkvalid(parent), path, dtype, dataspace(dspace_dims[1], max_dims=dspace_dims[2]); pv...) -create_dataset(parent::Union{File,Group}, path::Union{AbstractString,Nothing}, dtype::Type, dspace_dims::Tuple{Dims,Dims}; pv...) = create_dataset(checkvalid(parent), path, datatype(dtype), dataspace(dspace_dims[1], max_dims=dspace_dims[2]); pv...) -create_dataset(parent::Union{File,Group}, path::Union{AbstractString,Nothing}, dtype::Type, dspace_dims::Dims; pv...) = create_dataset(checkvalid(parent), path, datatype(dtype), dataspace(dspace_dims); pv...) -create_dataset(parent::Union{File,Group}, path::Union{AbstractString,Nothing}, dtype::Type, dspace_dims::Int...; pv...) = create_dataset(checkvalid(parent), path, datatype(dtype), dataspace(dspace_dims); pv...) +function create_dataset(parent::Union{File,Group}, path::Union{AbstractString,Nothing}, + dtype::Datatype, dspace_dims::Dims; pv...) + create_dataset(checkvalid(parent), path, dtype, dataspace(dspace_dims); pv...) +end +function create_dataset(parent::Union{File,Group}, path::Union{AbstractString,Nothing}, + dtype::Datatype, dspace_dims::Tuple{Dims,Dims}; pv...) + create_dataset(checkvalid(parent), path, dtype, + dataspace(dspace_dims[1]; max_dims = dspace_dims[2]); pv...) +end +function create_dataset(parent::Union{File,Group}, path::Union{AbstractString,Nothing}, + dtype::Type, dspace_dims::Tuple{Dims,Dims}; pv...) + create_dataset(checkvalid(parent), path, datatype(dtype), + dataspace(dspace_dims[1]; max_dims = dspace_dims[2]); pv...) +end +function create_dataset(parent::Union{File,Group}, path::Union{AbstractString,Nothing}, + dtype::Type, dspace_dims::Dims; pv...) + create_dataset(checkvalid(parent), path, datatype(dtype), dataspace(dspace_dims); pv...) +end +function create_dataset(parent::Union{File,Group}, path::Union{AbstractString,Nothing}, + dtype::Type, dspace_dims::Int...; pv...) + create_dataset(checkvalid(parent), path, datatype(dtype), dataspace(dspace_dims); pv...) +end # Get the datatype of a dataset datatype(dset::Dataset) = Datatype(API.h5d_get_type(checkvalid(dset)), file(dset)) @@ -168,7 +186,7 @@ function readmmap(obj::Dataset, ::Type{T}) where {T} elseif offset % Base.datatype_alignment(T) == 0 A = Mmap.mmap(fd, Array{T,length(dims)}, dims, offset) else - Aflat = Mmap.mmap(fd, Vector{UInt8}, prod(dims)*sizeof(T), offset) + Aflat = Mmap.mmap(fd, Vector{UInt8}, prod(dims) * sizeof(T), offset) A = reshape(reinterpret(T, Aflat), dims) end @@ -187,18 +205,19 @@ function readmmap(obj::Dataset) end # Generic write -function Base.write(parent::Union{File,Group}, name1::Union{AbstractString,Nothing}, val1, name2::Union{AbstractString,Nothing}, val2, nameval...) # FIXME: remove? +function Base.write(parent::Union{File,Group}, name1::Union{AbstractString,Nothing}, val1, + name2::Union{AbstractString,Nothing}, val2, nameval...) # FIXME: remove? if !iseven(length(nameval)) error("name, value arguments must come in pairs") end write(parent, name1, val1) write(parent, name2, val2) - for i = 1:2:length(nameval) + for i in 1:2:length(nameval) thisname = nameval[i] if !isa(thisname, AbstractString) - error("Argument ", i+5, " should be a string, but it's a ", typeof(thisname)) + error("Argument ", i + 5, " should be a string, but it's a ", typeof(thisname)) end - write(parent, thisname, nameval[i+1]) + write(parent, thisname, nameval[i + 1]) end end @@ -208,7 +227,8 @@ end # Create datasets and attributes with "native" types, but don't write the data. # The return syntax is: dset, dtype = create_dataset(parent, name, data; properties...) -function create_dataset(parent::Union{File,Group}, name::Union{AbstractString,Nothing}, data; pv...) +function create_dataset(parent::Union{File,Group}, name::Union{AbstractString,Nothing}, + data; pv...) dtype = datatype(data) dspace = dataspace(data) obj = try @@ -220,7 +240,8 @@ function create_dataset(parent::Union{File,Group}, name::Union{AbstractString,No end # Create and write, closing the objects upon exit -function write_dataset(parent::Union{File,Group}, name::Union{AbstractString,Nothing}, data; pv...) +function write_dataset(parent::Union{File,Group}, name::Union{AbstractString,Nothing}, data; + pv...) obj, dtype = create_dataset(parent, name, data; pv...) try write_dataset(obj, dtype, data) @@ -245,8 +266,10 @@ function Base.write(obj::Dataset, x) end # For plain files and groups, let "write(obj, name, val; properties...)" mean "write_dataset" -Base.write(parent::Union{File,Group}, name::Union{AbstractString,Nothing}, data; pv...) = write_dataset(parent, name, data; pv...) - +function Base.write(parent::Union{File,Group}, name::Union{AbstractString,Nothing}, data; + pv...) + write_dataset(parent, name, data; pv...) +end # Indexing @@ -256,7 +279,7 @@ Base.axes(dset::Dataset) = map(Base.OneTo, size(dset)) # Write to a subset of a dataset using array slices: dataset[:,:,10] = array const IndexType = Union{AbstractRange{Int},Int,Colon} -function Base.setindex!(dset::Dataset, X::Array{T}, I::IndexType...) where T +function Base.setindex!(dset::Dataset, X::Array{T}, I::IndexType...) where {T} !isconcretetype(T) && error("type $T is not concrete") U = get_jl_type(dset) @@ -293,7 +316,7 @@ function Base.setindex!(dset::Dataset, X::Array{T}, I::IndexType...) where T return X end -function Base.setindex!(dset::Dataset, x::T, I::IndexType...) where T <: Number +function Base.setindex!(dset::Dataset, x::T, I::IndexType...) where {T<:Number} indices = Base.to_indices(dset, I) X = fill(x, map(length, indices)) Base.setindex!(dset, X, indices...) @@ -317,42 +340,53 @@ Use `API.h5p_set_external` to link to multiple segments. See also [`API.h5p_set_external`](@ref) """ -function create_external_dataset(parent::Union{File,Group}, name::AbstractString, filepath::AbstractString, t, sz::Dims, offset::Integer=0) +function create_external_dataset(parent::Union{File,Group}, name::AbstractString, + filepath::AbstractString, t, sz::Dims, offset::Integer = 0) create_external_dataset(parent, name, filepath, datatype(t), dataspace(sz), offset) end -function create_external_dataset(parent::Union{File,Group}, name::AbstractString, filepath::AbstractString, dtype::Datatype, dspace::Dataspace, offset::Integer=0) +function create_external_dataset(parent::Union{File,Group}, name::AbstractString, + filepath::AbstractString, dtype::Datatype, + dspace::Dataspace, offset::Integer = 0) checkvalid(parent) - create_dataset(parent, name, dtype, dspace; external=(filepath, offset, length(dspace)*sizeof(dtype))) + create_dataset(parent, name, dtype, dspace; + external = (filepath, offset, length(dspace) * sizeof(dtype))) end ### HDF5 utilities ### - # default behavior -read_dataset(dset::Dataset, memtype::Datatype, buf, xfer::DatasetTransferProperties=dset.xfer) = +function read_dataset(dset::Dataset, memtype::Datatype, buf, + xfer::DatasetTransferProperties = dset.xfer) API.h5d_read(dset, memtype, API.H5S_ALL, API.H5S_ALL, xfer, buf) -write_dataset(dset::Dataset, memtype::Datatype, x, xfer::DatasetTransferProperties=dset.xfer) = +end +function write_dataset(dset::Dataset, memtype::Datatype, x, + xfer::DatasetTransferProperties = dset.xfer) API.h5d_write(dset, memtype, API.H5S_ALL, API.H5S_ALL, xfer, x) +end # type-specific behaviors function _check_invalid(dataset::Dataset, buf::AbstractArray) num_bytes_dset = Base.checked_mul(sizeof(datatype(dataset)), length(dataset)) num_bytes_buf = Base.checked_mul(sizeof(eltype(buf)), length(buf)) - num_bytes_buf == num_bytes_dset || throw(ArgumentError( - "Invalid number of bytes: $num_bytes_buf != $num_bytes_dset, for dataset \"$(name(dataset))\"" - )) - stride(buf, 1) == 1 || throw(ArgumentError("Cannot read/write arrays with a different stride than `Array`")) + num_bytes_buf == num_bytes_dset || + throw(ArgumentError("Invalid number of bytes: $num_bytes_buf != $num_bytes_dset, for dataset \"$(name(dataset))\"")) + stride(buf, 1) == 1 || + throw(ArgumentError("Cannot read/write arrays with a different stride than `Array`")) end -function read_dataset(dataset::Dataset, memtype::Datatype, buf::AbstractArray, xfer::DatasetTransferProperties=dataset.xfer) +function read_dataset(dataset::Dataset, memtype::Datatype, buf::AbstractArray, + xfer::DatasetTransferProperties = dataset.xfer) _check_invalid(dataset, buf) API.h5d_read(dataset, memtype, API.H5S_ALL, API.H5S_ALL, xfer, buf) end -function write_dataset(dataset::Dataset, memtype::Datatype, buf::AbstractArray, xfer::DatasetTransferProperties=dataset.xfer) +function write_dataset(dataset::Dataset, memtype::Datatype, buf::AbstractArray, + xfer::DatasetTransferProperties = dataset.xfer) _check_invalid(dataset, buf) API.h5d_write(dataset, memtype, API.H5S_ALL, API.H5S_ALL, xfer, buf) end -function write_dataset(dataset::Dataset, memtype::Datatype, str::Union{AbstractString,Nothing}, xfer::DatasetTransferProperties=dataset.xfer) +function write_dataset(dataset::Dataset, memtype::Datatype, + str::Union{AbstractString,Nothing}, + xfer::DatasetTransferProperties = dataset.xfer) strbuf = Base.cconvert(Cstring, str) GC.@preserve strbuf begin # unsafe_convert(Cstring, strbuf) is responsible for enforcing the no-'\0' policy, @@ -362,15 +396,26 @@ function write_dataset(dataset::Dataset, memtype::Datatype, str::Union{AbstractS API.h5d_write(dataset, memtype, API.H5S_ALL, API.H5S_ALL, xfer, buf) end end -function write_dataset(dataset::Dataset, memtype::Datatype, x::T, xfer::DatasetTransferProperties=dataset.xfer) where {T<:Union{ScalarType, Complex{<:ScalarType}}} +function write_dataset(dataset::Dataset, memtype::Datatype, x::T, + xfer::DatasetTransferProperties = dataset.xfer) where { + T<:Union{ + ScalarType, + Complex{ + <:ScalarType + } + }} tmp = Ref{T}(x) API.h5d_write(dataset, memtype, API.H5S_ALL, API.H5S_ALL, xfer, tmp) end -function write_dataset(dataset::Dataset, memtype::Datatype, strs::Array{<:AbstractString}, xfer::DatasetTransferProperties=dataset.xfer) +function write_dataset(dataset::Dataset, memtype::Datatype, strs::Array{<:AbstractString}, + xfer::DatasetTransferProperties = dataset.xfer) p = Ref{Cstring}(strs) API.h5d_write(dataset, memtype, API.H5S_ALL, API.H5S_ALL, xfer, p) end -write_dataset(dataset::Dataset, memtype::Datatype, ::EmptyArray, xfer::DatasetTransferProperties=dataset.xfer) = nothing +function write_dataset(dataset::Dataset, memtype::Datatype, ::EmptyArray, + xfer::DatasetTransferProperties = dataset.xfer) + nothing +end """ get_datasets(file::HDF5.File) -> datasets::Vector{HDF5.Dataset} @@ -382,7 +427,7 @@ function get_datasets(file::File) get_datasets!(list, file) list end - function get_datasets!(list::Vector{Dataset}, node::Union{File,Group,Dataset}) +function get_datasets!(list::Vector{Dataset}, node::Union{File,Group,Dataset}) if isa(node, Dataset) push!(list, node) else @@ -402,11 +447,11 @@ function heuristic_chunk(T, shape) chunk = [shape...] nd = length(chunk) # simplification of ugly heuristic target chunk size from PyTables/h5py: - target = min(1500000, max(12000, floor(Int, 300*cbrt(Ts*sz)))) + target = min(1500000, max(12000, floor(Int, 300 * cbrt(Ts * sz)))) Ts > target && return ones(chunk) # divide last non-unit dimension by 2 until we get <= target # (since Julia default to column-major, favor contiguous first dimension) - while Ts*prod(chunk) > target + while Ts * prod(chunk) > target i = nd while chunk[i] == 1 i -= 1 @@ -427,10 +472,11 @@ Write a raw chunk at a given offset. `chunk_bytes` is an AbstractArray that can be converted to a pointer, Ptr{Cvoid}. `offset` is a 1-based list of rank `ndims(dataset)` and must fall on a chunk boundary. """ -function do_write_chunk(dataset::Dataset, offset, chunk_bytes::AbstractArray, filter_mask=0) +function do_write_chunk(dataset::Dataset, offset, chunk_bytes::AbstractArray, + filter_mask = 0) checkvalid(dataset) offs = collect(API.hsize_t, reverse(offset)) .- 1 - write_chunk(dataset, offs, chunk_bytes; filter_mask=UInt32(filter_mask)) + write_chunk(dataset, offs, chunk_bytes; filter_mask = UInt32(filter_mask)) end """ @@ -440,10 +486,11 @@ Write a raw chunk at a given linear index. `chunk_bytes` is an AbstractArray that can be converted to a pointer, Ptr{Cvoid}. `index` is 1-based and consecutive up to the number of chunks. """ -function do_write_chunk(dataset::Dataset, index::Integer, chunk_bytes::AbstractArray, filter_mask=0) +function do_write_chunk(dataset::Dataset, index::Integer, chunk_bytes::AbstractArray, + filter_mask = 0) checkvalid(dataset) index -= 1 - write_chunk(dataset, index, chunk_bytes; filter_mask=UInt32(filter_mask)) + write_chunk(dataset, index, chunk_bytes; filter_mask = UInt32(filter_mask)) end """ @@ -483,12 +530,11 @@ Base.IndexStyle(::ChunkStorage{I}) where {I<:IndexStyle} = I() # ChunkStorage{IndexCartesian,N} (default) function ChunkStorage(dataset) - ChunkStorage{IndexCartesian, ndims(dataset)}(dataset) + ChunkStorage{IndexCartesian,ndims(dataset)}(dataset) end Base.size(cs::ChunkStorage{IndexCartesian}) = get_num_chunks_per_dim(cs.dataset) - function Base.axes(cs::ChunkStorage{IndexCartesian}) chunk = get_chunk(cs.dataset) extent = size(cs.dataset) @@ -496,12 +542,14 @@ function Base.axes(cs::ChunkStorage{IndexCartesian}) end # Filter flags provided -function Base.setindex!(chunk_storage::ChunkStorage{IndexCartesian}, v::Tuple{<:Integer,AbstractArray}, index::Integer...) +function Base.setindex!(chunk_storage::ChunkStorage{IndexCartesian}, + v::Tuple{<:Integer,AbstractArray}, index::Integer...) do_write_chunk(chunk_storage.dataset, index, v[2], v[1]) end # Filter flags will default to 0 -function Base.setindex!(chunk_storage::ChunkStorage{IndexCartesian}, v::AbstractArray, index::Integer...) +function Base.setindex!(chunk_storage::ChunkStorage{IndexCartesian}, v::AbstractArray, + index::Integer...) do_write_chunk(chunk_storage.dataset, index, v) end @@ -511,16 +559,18 @@ end # ChunkStorage{IndexLinear,1} -ChunkStorage{IndexLinear}(dataset) = ChunkStorage{IndexLinear,1}(dataset) +ChunkStorage{IndexLinear}(dataset) = ChunkStorage{IndexLinear,1}(dataset) Base.size(cs::ChunkStorage{IndexLinear}) = (get_num_chunks(cs.dataset),) -Base.length(cs::ChunkStorage{IndexLinear}) = get_num_chunks(cs.dataset) +Base.length(cs::ChunkStorage{IndexLinear}) = get_num_chunks(cs.dataset) -function Base.setindex!(chunk_storage::ChunkStorage{IndexLinear}, v::Tuple{<:Integer,AbstractArray}, index::Integer) +function Base.setindex!(chunk_storage::ChunkStorage{IndexLinear}, + v::Tuple{<:Integer,AbstractArray}, index::Integer) do_write_chunk(chunk_storage.dataset, index, v[2], v[1]) end # Filter flags will default to 0 -function Base.setindex!(chunk_storage::ChunkStorage{IndexLinear}, v::AbstractArray, index::Integer) +function Base.setindex!(chunk_storage::ChunkStorage{IndexLinear}, v::AbstractArray, + index::Integer) do_write_chunk(chunk_storage.dataset, index, v) end @@ -532,13 +582,16 @@ end # ChunkStorage axes may be StepRanges, but this is not available until v"1.6.0" # no method matching CartesianIndices(::Tuple{StepRange{Int64,Int64},UnitRange{Int64}}) until v"1.6.0" -function Base.show(io::IO, cs::ChunkStorage{IndexCartesian,N}) where N +function Base.show(io::IO, cs::ChunkStorage{IndexCartesian,N}) where {N} println(io, "HDF5.ChunkStorage{IndexCartesian,$N}") print(io, "Axes: ") println(io, axes(cs)) print(io, cs.dataset) end -Base.show(io::IO, ::MIME{Symbol("text/plain")}, cs::ChunkStorage{IndexCartesian,N}) where {N} = show(io, cs) +function Base.show(io::IO, ::MIME{Symbol("text/plain")}, + cs::ChunkStorage{IndexCartesian,N}) where {N} + show(io, cs) +end function get_chunk(dset::Dataset) p = get_create_properties(dset) @@ -553,4 +606,5 @@ end # properties that require chunks in order to work (e.g. any filter) # values do not matter -- just needed to form a NamedTuple with the desired keys -const chunked_props = (; compress=nothing, deflate=nothing, blosc=nothing, shuffle=nothing) +const chunked_props = (; compress = nothing, deflate = nothing, blosc = nothing, + shuffle = nothing) diff --git a/src/dataspaces.jl b/src/dataspaces.jl index 21267b465..895c4461f 100644 --- a/src/dataspaces.jl +++ b/src/dataspaces.jl @@ -15,8 +15,9 @@ The following functions have methods defined for `Dataspace` objects """ Dataspace # defined in types.jl -Base.:(==)(dspace1::Dataspace, dspace2::Dataspace) = +function Base.:(==)(dspace1::Dataspace, dspace2::Dataspace) API.h5s_extent_equal(checkvalid(dspace1), checkvalid(dspace2)) +end Base.hash(dspace::Dataspace, h::UInt) = hash(dspace.id, hash(Dataspace, h)) Base.copy(dspace::Dataspace) = Dataspace(API.h5s_copy(checkvalid(dspace))) @@ -37,7 +38,6 @@ The [`Dataspace`](@ref) of `obj`. """ dataspace(ds::Dataspace) = ds - # Create a dataspace from in-memory types """ dataspace(data) @@ -47,10 +47,12 @@ The default `Dataspace` used for representing a Julia object `data`: - arrays: a simple `Dataspace` - `nothing` or an `EmptyArray`: a null dataspace """ -dataspace(x::Union{T, Complex{T}}) where {T<:ScalarType} = Dataspace(API.h5s_create(API.H5S_SCALAR)) +function dataspace(x::Union{T,Complex{T}}) where {T<:ScalarType} + Dataspace(API.h5s_create(API.H5S_SCALAR)) +end dataspace(::AbstractString) = Dataspace(API.h5s_create(API.H5S_SCALAR)) -function _dataspace(sz::Dims{N}, max_dims::Union{Dims{N}, Tuple{}}=()) where N +function _dataspace(sz::Dims{N}, max_dims::Union{Dims{N},Tuple{}} = ()) where {N} dims = API.hsize_t[sz[i] for i in N:-1:1] if isempty(max_dims) maxd = dims @@ -61,9 +63,11 @@ function _dataspace(sz::Dims{N}, max_dims::Union{Dims{N}, Tuple{}}=()) where N end return Dataspace(API.h5s_create_simple(length(dims), dims, maxd)) end -dataspace(A::AbstractArray{T,N}; max_dims::Union{Dims{N},Tuple{}} = ()) where {T,N} = _dataspace(size(A), max_dims) +function dataspace(A::AbstractArray{T,N}; max_dims::Union{Dims{N},Tuple{}} = ()) where {T,N} + _dataspace(size(A), max_dims) +end # special array types -dataspace(v::VLen; max_dims::Union{Dims,Tuple{}}=()) = _dataspace(size(v.data), max_dims) +dataspace(v::VLen; max_dims::Union{Dims,Tuple{}} = ()) = _dataspace(size(v.data), max_dims) dataspace(A::EmptyArray) = Dataspace(API.h5s_create(API.H5S_NULL)) dataspace(n::Nothing) = Dataspace(API.h5s_create(API.H5S_NULL)) @@ -75,9 +79,12 @@ Construct a simple `Dataspace` for the given dimensions `dims`. The maximum dimensions `maxdims` specifies the maximum possible size: `-1` can be used to indicate unlimited dimensions. """ -dataspace(sz::Dims{N}; max_dims::Union{Dims{N},Tuple{}}=()) where {N} = _dataspace(sz, max_dims) -dataspace(sz1::Int, sz2::Int, sz3::Int...; max_dims::Union{Dims,Tuple{}}=()) = _dataspace(tuple(sz1, sz2, sz3...), max_dims) - +function dataspace(sz::Dims{N}; max_dims::Union{Dims{N},Tuple{}} = ()) where {N} + _dataspace(sz, max_dims) +end +function dataspace(sz1::Int, sz2::Int, sz3::Int...; max_dims::Union{Dims,Tuple{}} = ()) + _dataspace(tuple(sz1, sz2, sz3...), max_dims) +end function Base.ndims(dspace::Dataspace) API.h5s_get_simple_extent_ndims(checkvalid(dspace)) @@ -85,7 +92,7 @@ end function Base.size(dspace::Dataspace) h5_dims = API.h5s_get_simple_extent_dims(checkvalid(dspace), nothing) N = length(h5_dims) - return ntuple(i -> @inbounds(Int(h5_dims[N-i+1])), N) + return ntuple(i -> @inbounds(Int(h5_dims[N - i + 1])), N) end function Base.size(dspace::Dataspace, d::Integer) d > 0 || throw(ArgumentError("invalid dimension d; must be positive integer")) @@ -101,7 +108,6 @@ function Base.length(dspace::Dataspace) end Base.isempty(dspace::Dataspace) = length(dspace) == 0 - """ isnull(dspace::Union{HDF5.Dataspace, HDF5.Dataset, HDF5.Attribute}) @@ -120,11 +126,10 @@ function isnull(dspace::Dataspace) return API.h5s_get_simple_extent_type(checkvalid(dspace)) == API.H5S_NULL end - function get_regular_hyperslab(dspace::Dataspace) start, stride, count, block = API.h5s_get_regular_hyperslab(dspace) N = length(start) - @inline rev(v) = ntuple(i -> @inbounds(Int(v[N-i+1])), N) + @inline rev(v) = ntuple(i -> @inbounds(Int(v[N - i + 1])), N) return rev(start), rev(stride), rev(count), rev(block) end @@ -134,24 +139,25 @@ function hyperslab(dspace::Dataspace, I::Union{AbstractRange{Int},Int}...) if length(I) != n_dims error("Wrong number of indices supplied, supplied length $(length(I)) but expected $(n_dims).") end - dsel_id = API.h5s_copy(dspace) - dsel_start = Vector{API.hsize_t}(undef,n_dims) - dsel_stride = Vector{API.hsize_t}(undef,n_dims) - dsel_count = Vector{API.hsize_t}(undef,n_dims) - for k = 1:n_dims - index = I[n_dims-k+1] + dsel_id = API.h5s_copy(dspace) + dsel_start = Vector{API.hsize_t}(undef, n_dims) + dsel_stride = Vector{API.hsize_t}(undef, n_dims) + dsel_count = Vector{API.hsize_t}(undef, n_dims) + for k in 1:n_dims + index = I[n_dims - k + 1] if isa(index, Integer) - dsel_start[k] = index-1 + dsel_start[k] = index - 1 dsel_stride[k] = 1 dsel_count[k] = 1 elseif isa(index, AbstractRange) - dsel_start[k] = first(index)-1 + dsel_start[k] = first(index) - 1 dsel_stride[k] = step(index) dsel_count[k] = length(index) else error("index must be range or integer") end - if dsel_start[k] < 0 || dsel_start[k]+(dsel_count[k]-1)*dsel_stride[k] >= dims[n_dims-k+1] + if dsel_start[k] < 0 || + dsel_start[k] + (dsel_count[k] - 1) * dsel_stride[k] >= dims[n_dims - k + 1] println(dsel_start) println(dsel_stride) println(dsel_count) @@ -159,7 +165,8 @@ function hyperslab(dspace::Dataspace, I::Union{AbstractRange{Int},Int}...) error("index out of range") end end - API.h5s_select_hyperslab(dsel_id, API.H5S_SELECT_SET, dsel_start, dsel_stride, dsel_count, C_NULL) + API.h5s_select_hyperslab(dsel_id, API.H5S_SELECT_SET, dsel_start, dsel_stride, + dsel_count, C_NULL) return Dataspace(dsel_id) end diff --git a/src/datatypes.jl b/src/datatypes.jl index d7cb85bf7..aff503e3f 100644 --- a/src/datatypes.jl +++ b/src/datatypes.jl @@ -11,22 +11,22 @@ end # The datatype of a Datatype is the Datatype datatype(dt::Datatype) = dt - -open_datatype(parent::Union{File,Group}, name::AbstractString, tapl::DatatypeAccessProperties=DatatypeAccessProperties()) = +function open_datatype(parent::Union{File,Group}, name::AbstractString, + tapl::DatatypeAccessProperties = DatatypeAccessProperties()) Datatype(API.h5t_open(checkvalid(parent), name, tapl), file(parent)) +end # Note that H5Tcreate is very different; H5Tcommit is the analog of these others create_datatype(class_id, sz) = Datatype(API.h5t_create(class_id, sz)) function commit_datatype(parent::Union{File,Group}, path::AbstractString, dtype::Datatype, - lcpl::LinkCreateProperties=LinkCreateProperties(), - tcpl::DatatypeCreateProperties=DatatypeCreateProperties(), - tapl::DatatypeAccessProperties=DatatypeAccessProperties()) + lcpl::LinkCreateProperties = LinkCreateProperties(), + tcpl::DatatypeCreateProperties = DatatypeCreateProperties(), + tapl::DatatypeAccessProperties = DatatypeAccessProperties()) lcpl.char_encoding = cset(typeof(path)) API.h5t_commit(checkvalid(parent), path, dtype, lcpl, tcpl, tapl) dtype.file = file(parent) return dtype end - -Base.sizeof(dtype::Datatype) = Int(API.h5t_get_size(dtype)) \ No newline at end of file +Base.sizeof(dtype::Datatype) = Int(API.h5t_get_size(dtype)) diff --git a/src/deprecated.jl b/src/deprecated.jl index 8cf19f5a2..562af4e6e 100644 --- a/src/deprecated.jl +++ b/src/deprecated.jl @@ -7,8 +7,8 @@ import Base: @deprecate, @deprecate_binding, depwarn ### Changed in PR #844 @deprecate silence_errors(f::Function) f() -for name in names(API; all=true) - if name โˆ‰ names(HDF5; all=true) && startswith(uppercase(String(name)), "H") +for name in names(API; all = true) + if name โˆ‰ names(HDF5; all = true) && startswith(uppercase(String(name)), "H") depmsg = ", use HDF5.API.$name instead." @eval Base.@deprecate_binding $name API.$name false $depmsg end @@ -23,26 +23,26 @@ import Base: getindex, setindex! @deprecate getindex(p::Properties) p function create_property(class; kwargs...) - (oldname, newtype) = - class == HDF5.API.H5P_OBJECT_CREATE ? (:H5P_OBJECT_CREATE, ObjectCreateProperties) : - class == HDF5.API.H5P_FILE_CREATE ? (:H5P_FILE_CREATE, FileCreateProperties) : - class == HDF5.API.H5P_FILE_ACCESS ? (:H5P_FILE_ACCESS, FileAccessProperties) : - class == HDF5.API.H5P_DATASET_CREATE ? (:H5P_DATASET_CREATE, DatasetCreateProperties) : - class == HDF5.API.H5P_DATASET_ACCESS ? (:H5P_DATASET_ACCESS, DatasetAccessProperties) : - class == HDF5.API.H5P_DATASET_XFER ? (:H5P_DATASET_XFER, DatasetTransferProperties) : - class == HDF5.API.H5P_FILE_MOUNT ? (:H5P_FILE_MOUNT, FileMountProperties) : - class == HDF5.API.H5P_GROUP_CREATE ? (:H5P_GROUP_CREATE, GroupCreateProperties) : - class == HDF5.API.H5P_GROUP_ACCESS ? (:H5P_GROUP_ACCESS, GroupAccessProperties) : - class == HDF5.API.H5P_DATATYPE_CREATE ? (:H5P_DATATYPE_CREATE, DatatypeCreateProperties) : - class == HDF5.API.H5P_DATATYPE_ACCESS ? (:H5P_DATATYPE_ACCESS, DatatypeAccessProperties) : - class == HDF5.API.H5P_STRING_CREATE ? (:H5P_STRING_CREATE, StringCreateProperties) : - class == HDF5.API.H5P_ATTRIBUTE_CREATE ? (:H5P_ATTRIBUTE_CREATE, AttributeCreateProperties) : - class == HDF5.API.H5P_OBJECT_COPY ? (:H5P_OBJECT_COPY, ObjectCopyProperties) : - class == HDF5.API.H5P_LINK_CREATE ? (:H5P_LINK_CREATE, LinkCreateProperties) : - class == HDF5.API.H5P_LINK_ACCESS ? (:H5P_LINK_ACCESS, LinkAccessProperties) : - error("invalid class") - Base.depwarn("`create_property(HDF5.$oldname; kwargs...)` has been deprecated, use `$newtype(;kwargs...)` instead.", :create_property) - init!(newtype(;kwargs...)) + (oldname, newtype) = class == HDF5.API.H5P_OBJECT_CREATE ? (:H5P_OBJECT_CREATE, ObjectCreateProperties) : + class == HDF5.API.H5P_FILE_CREATE ? (:H5P_FILE_CREATE, FileCreateProperties) : + class == HDF5.API.H5P_FILE_ACCESS ? (:H5P_FILE_ACCESS, FileAccessProperties) : + class == HDF5.API.H5P_DATASET_CREATE ? (:H5P_DATASET_CREATE, DatasetCreateProperties) : + class == HDF5.API.H5P_DATASET_ACCESS ? (:H5P_DATASET_ACCESS, DatasetAccessProperties) : + class == HDF5.API.H5P_DATASET_XFER ? (:H5P_DATASET_XFER, DatasetTransferProperties) : + class == HDF5.API.H5P_FILE_MOUNT ? (:H5P_FILE_MOUNT, FileMountProperties) : + class == HDF5.API.H5P_GROUP_CREATE ? (:H5P_GROUP_CREATE, GroupCreateProperties) : + class == HDF5.API.H5P_GROUP_ACCESS ? (:H5P_GROUP_ACCESS, GroupAccessProperties) : + class == HDF5.API.H5P_DATATYPE_CREATE ? (:H5P_DATATYPE_CREATE, DatatypeCreateProperties) : + class == HDF5.API.H5P_DATATYPE_ACCESS ? (:H5P_DATATYPE_ACCESS, DatatypeAccessProperties) : + class == HDF5.API.H5P_STRING_CREATE ? (:H5P_STRING_CREATE, StringCreateProperties) : + class == HDF5.API.H5P_ATTRIBUTE_CREATE ? (:H5P_ATTRIBUTE_CREATE, AttributeCreateProperties) : + class == HDF5.API.H5P_OBJECT_COPY ? (:H5P_OBJECT_COPY, ObjectCopyProperties) : + class == HDF5.API.H5P_LINK_CREATE ? (:H5P_LINK_CREATE, LinkCreateProperties) : + class == HDF5.API.H5P_LINK_ACCESS ? (:H5P_LINK_ACCESS, LinkAccessProperties) : + error("invalid class") + Base.depwarn("`create_property(HDF5.$oldname; kwargs...)` has been deprecated, use `$newtype(;kwargs...)` instead.", + :create_property) + init!(newtype(; kwargs...)) end @deprecate set_chunk(p::Properties, dims...) set_chunk!(p, dims) false @@ -65,8 +65,12 @@ end ### Changed in PR #902 import Base: append!, push! import .Filters: ExternalFilter -@deprecate append!(filters::Filters.FilterPipeline, extra::NTuple{N, Integer}) where N append!(filters, [ExternalFilter(extra...)]) -@deprecate push!(p::Filters.FilterPipeline, f::NTuple{N, Integer}) where N push!(p, ExternalFilter(f...)) +@deprecate append!(filters::Filters.FilterPipeline, extra::NTuple{N,Integer}) where {N} append!(filters, + [ + ExternalFilter(extra...) + ]) +@deprecate push!(p::Filters.FilterPipeline, f::NTuple{N,Integer}) where {N} push!(p, + ExternalFilter(f...)) @deprecate ExternalFilter(t::Tuple) ExternalFilter(t...) false ### Changed in PR #979 @@ -74,4 +78,5 @@ import .Filters: ExternalFilter @deprecate object_info(obj::Union{File,Object}) API.h5o_get_info1(checkvalid(obj)) ### Changed in PR #994 -@deprecate set_track_order(p::Properties, val::Bool) set_track_order!(p::Properties, val::Bool) false +@deprecate set_track_order(p::Properties, val::Bool) set_track_order!(p::Properties, + val::Bool) false diff --git a/src/drivers/drivers.jl b/src/drivers/drivers.jl index 927983a2d..1562c78ce 100644 --- a/src/drivers/drivers.jl +++ b/src/drivers/drivers.jl @@ -18,7 +18,7 @@ end abstract type Driver end -const DRIVERS = Dict{API.hid_t, Type{<: Driver}}() +const DRIVERS = Dict{API.hid_t,Type{<:Driver}}() """ Core([increment::Csize_t, backing_store::Cuint, [write_tracking::Cuint, page_size::Csize_t]]) @@ -38,12 +38,13 @@ struct Core <: Driver page_size::Csize_t end Core(increment, backing_store) = Core(increment, backing_store, false, 524288) -Core(; - increment = 8192, - backing_store = true, - write_tracking = false, - page_size = 524288 -) = Core(increment, backing_store, write_tracking, page_size) +function Core(; + increment = 8192, + backing_store = true, + write_tracking = false, + page_size = 524288) + Core(increment, backing_store, write_tracking, page_size) +end function get_driver(p::Properties, ::Type{Core}) r_increment = Ref{Csize_t}(0) @@ -52,12 +53,10 @@ function get_driver(p::Properties, ::Type{Core}) r_page_size = Ref{Csize_t}(0) API.h5p_get_fapl_core(p, r_increment, r_backing_store) API.h5p_get_core_write_tracking(p, r_write_tracking, r_page_size) - return Core( - r_increment[], - r_backing_store[], - r_write_tracking[], - r_page_size[] - ) + return Core(r_increment[], + r_backing_store[], + r_write_tracking[], + r_page_size[]) end function set_driver!(fapl::Properties, driver::Core) @@ -98,7 +97,7 @@ function __init__() # Check whether the libhdf5 was compiled with parallel support. HDF5.HAS_PARALLEL[] = API._has_symbol(:H5Pset_fapl_mpio) - @require MPI="da04e1cc-30fd-572f-bb4f-1f8673147195" (HDF5.has_parallel() && include("mpio.jl")) + @require MPI="da04e1cc-30fd-572f-bb4f-1f8673147195" (HDF5.has_parallel()&&include("mpio.jl")) end end # module diff --git a/src/drivers/mpio.jl b/src/drivers/mpio.jl index 6231c1b53..6fb9321e3 100644 --- a/src/drivers/mpio.jl +++ b/src/drivers/mpio.jl @@ -2,10 +2,10 @@ using .MPI import Libdl # Low-level MPI handles. -const MPIHandle = Union{MPI.MPI_Comm, MPI.MPI_Info} +const MPIHandle = Union{MPI.MPI_Comm,MPI.MPI_Info} # MPI.jl wrapper types. -const MPIHandleWrapper = Union{MPI.Comm, MPI.Info} +const MPIHandleWrapper = Union{MPI.Comm,MPI.Info} const H5MPIHandle = let csize = sizeof(MPI.MPI_Comm) @assert csize in (4, 8) @@ -18,7 +18,6 @@ h5_to_mpi_info(handle::H5MPIHandle) = reinterpret(MPI.MPI_Info, handle) mpi_to_h5(handle::MPIHandle) = reinterpret(H5MPIHandle, handle) mpi_to_h5(mpiobj::MPIHandleWrapper) = mpi_to_h5(mpiobj.val) - """ MPIO(comm::MPI.Comm, info::MPI.Info) MPIO(comm::MPI.Comm; kwargs....) @@ -39,20 +38,16 @@ struct MPIO <: Driver comm::MPI.Comm info::MPI.Info end - MPIO(comm::MPI.Comm; kwargs...) = - MPIO(comm, MPI.Info(;kwargs...)) +MPIO(comm::MPI.Comm; kwargs...) = MPIO(comm, MPI.Info(; kwargs...)) function set_driver!(fapl::Properties, mpio::MPIO) - HDF5.has_parallel() || error( - "HDF5.jl has no parallel support." * - " Make sure that you're using MPI-enabled HDF5 libraries, and that" * - " MPI was loaded before HDF5." * - " See HDF5.jl docs for details." - ) + HDF5.has_parallel() || error("HDF5.jl has no parallel support." * + " Make sure that you're using MPI-enabled HDF5 libraries, and that" * + " MPI was loaded before HDF5." * + " See HDF5.jl docs for details.") # Note: HDF5 creates a COPY of the comm and info objects. - GC.@preserve mpio begin - API.h5p_set_fapl_mpio(fapl, mpi_to_h5(mpio.comm), mpi_to_h5(mpio.info)) - end + GC.@preserve mpio begin API.h5p_set_fapl_mpio(fapl, mpi_to_h5(mpio.comm), + mpi_to_h5(mpio.info)) end DRIVERS[API.h5p_get_driver(fapl)] = MPIO return nothing @@ -77,12 +72,11 @@ support. See the [HDF5 docs](https://portal.hdfgroup.org/display/HDF5/H5P_SET_FAPL_MPIO) for details on the `comm` and `info` arguments. """ -function HDF5.h5open( - filename::AbstractString, mode::AbstractString, - comm::MPI.Comm, info::MPI.Info = MPI.Info(); pv... - ) - HDF5.h5open(filename, mode; driver=MPIO(comm, info), pv...) +function HDF5.h5open(filename::AbstractString, mode::AbstractString, + comm::MPI.Comm, info::MPI.Info = MPI.Info(); pv...) + HDF5.h5open(filename, mode; driver = MPIO(comm, info), pv...) end -HDF5.h5open(filename::AbstractString, comm::MPI.Comm, args...; pv...) = +function HDF5.h5open(filename::AbstractString, comm::MPI.Comm, args...; pv...) HDF5.h5open(filename, "r", comm, args...; pv...) +end diff --git a/src/file.jl b/src/file.jl index 2002b02ba..4115cd75a 100644 --- a/src/file.jl +++ b/src/file.jl @@ -17,46 +17,45 @@ lists passed in via keyword will be closed. This is useful to set properties not Note that `h5open` uses `fclose_degree = :strong` by default, but this can be overriden by the `fapl` keyword. """ -function h5open(filename::AbstractString, mode::AbstractString, fapl::FileAccessProperties, fcpl::FileCreateProperties=FileCreateProperties(); swmr::Bool = false) - rd, wr, cr, tr, ff = - mode == "r" ? (true, false, false, false, false) : - mode == "r+" ? (true, true, false, false, true ) : - mode == "cw" ? (false, true, true, false, true ) : - mode == "w" ? (false, true, true, true, false) : - # mode == "w+" ? (true, true, true, true, false) : - # mode == "a" ? (true, true, true, true, true ) : - error("invalid open mode: ", mode) +function h5open(filename::AbstractString, mode::AbstractString, fapl::FileAccessProperties, + fcpl::FileCreateProperties = FileCreateProperties(); swmr::Bool = false) + rd, wr, cr, tr, ff = mode == "r" ? (true, false, false, false, false) : + mode == "r+" ? (true, true, false, false, true) : + mode == "cw" ? (false, true, true, false, true) : + mode == "w" ? (false, true, true, true, false) : + # mode == "w+" ? (true, true, true, true, false) : + # mode == "a" ? (true, true, true, true, true ) : + error("invalid open mode: ", mode) if ff && !wr error("HDF5 does not support appending without writing") end if cr && (tr || !isfile(filename)) - flag = swmr ? API.H5F_ACC_TRUNC|API.H5F_ACC_SWMR_WRITE : API.H5F_ACC_TRUNC + flag = swmr ? API.H5F_ACC_TRUNC | API.H5F_ACC_SWMR_WRITE : API.H5F_ACC_TRUNC fid = API.h5f_create(filename, flag, fcpl, fapl) else - ishdf5(filename) || error("unable to determine if $filename is accessible in the HDF5 format (file may not exist)") + ishdf5(filename) || + error("unable to determine if $filename is accessible in the HDF5 format (file may not exist)") if wr - flag = swmr ? API.H5F_ACC_RDWR|API.H5F_ACC_SWMR_WRITE : API.H5F_ACC_RDWR + flag = swmr ? API.H5F_ACC_RDWR | API.H5F_ACC_SWMR_WRITE : API.H5F_ACC_RDWR else - flag = swmr ? API.H5F_ACC_RDONLY|API.H5F_ACC_SWMR_READ : API.H5F_ACC_RDONLY + flag = swmr ? API.H5F_ACC_RDONLY | API.H5F_ACC_SWMR_READ : API.H5F_ACC_RDONLY end fid = API.h5f_open(filename, flag, fapl) end return File(fid, filename) end - function h5open(filename::AbstractString, mode::AbstractString = "r"; - swmr::Bool = false, - # With garbage collection, the other modes don't make sense - fapl = FileAccessProperties(; fclose_degree = :strong), - fcpl = FileCreateProperties(), - pv... -) + swmr::Bool = false, + # With garbage collection, the other modes don't make sense + fapl = FileAccessProperties(; fclose_degree = :strong), + fcpl = FileCreateProperties(), + pv...) try pv = setproperties!(fapl, fcpl; pv...) isempty(pv) || error("invalid keyword options $pv") - return h5open(filename, mode, fapl, fcpl; swmr=swmr) + return h5open(filename, mode, fapl, fcpl; swmr = swmr) finally close(fapl) close(fcpl) @@ -91,26 +90,25 @@ function h5open(f::Function, args...; context = copy(CONTEXT), pv...) end function h5rewrite(f::Function, filename::AbstractString, args...) - tmppath,tmpio = mktemp(dirname(filename)) - close(tmpio) - - try - val = h5open(f, tmppath, "w", args...) - Base.Filesystem.rename(tmppath, filename) - return val - catch - Base.Filesystem.unlink(tmppath) - rethrow() - end -end + tmppath, tmpio = mktemp(dirname(filename)) + close(tmpio) + try + val = h5open(f, tmppath, "w", args...) + Base.Filesystem.rename(tmppath, filename) + return val + catch + Base.Filesystem.unlink(tmppath) + rethrow() + end +end function Base.close(obj::File) - if obj.id != -1 - API.h5f_close(obj) - obj.id = -1 - end - nothing + if obj.id != -1 + API.h5f_close(obj) + obj.id = -1 + end + nothing end """ @@ -120,7 +118,6 @@ Returns `true` if `obj` has not been closed, `false` if it has been closed. """ Base.isopen(obj::File) = obj.id != -1 - """ ishdf5(name::AbstractString) @@ -142,7 +139,9 @@ file(f::File) = f file(o::Union{Object,Attribute}) = o.file fd(obj::Object) = API.h5i_get_file_id(checkvalid(obj)) -filename(obj::Union{File,Group,Dataset,Attribute,Datatype}) = API.h5f_get_name(checkvalid(obj)) +function filename(obj::Union{File,Group,Dataset,Attribute,Datatype}) + API.h5f_get_name(checkvalid(obj)) +end """ start_swmr_write(h5::HDF5.File) @@ -153,5 +152,6 @@ See [SWMR documentation](https://portal.hdfgroup.org/display/HDF5/Single+Writer+ start_swmr_write(h5::File) = API.h5f_start_swmr_write(h5) # Flush buffers -Base.flush(f::Union{Object,Attribute,Datatype,File}, scope = API.H5F_SCOPE_GLOBAL) = API.h5f_flush(checkvalid(f), scope) - +function Base.flush(f::Union{Object,Attribute,Datatype,File}, scope = API.H5F_SCOPE_GLOBAL) + API.h5f_flush(checkvalid(f), scope) +end diff --git a/src/fileio.jl b/src/fileio.jl index c5069c1c8..023913c13 100644 --- a/src/fileio.jl +++ b/src/fileio.jl @@ -1,7 +1,7 @@ import .FileIO import .OrderedCollections: OrderedDict -function loadtodict!(d::AbstractDict, g::Union{File,Group}, prefix::String="") +function loadtodict!(d::AbstractDict, g::Union{File,Group}, prefix::String = "") for k in keys(g) if (v = g[k]) isa Group loadtodict!(d, v, prefix * k * "/") @@ -12,40 +12,43 @@ function loadtodict!(d::AbstractDict, g::Union{File,Group}, prefix::String="") return d end -_infer_track_order(track_order::Union{Nothing,Bool}, dict::AbstractDict) = +function _infer_track_order(track_order::Union{Nothing,Bool}, dict::AbstractDict) track_order === nothing ? isa(dict, OrderedDict) : track_order +end # load with just a filename returns a flat dictionary containing all the variables -function fileio_load( - f::FileIO.File{FileIO.format"HDF5"}; - dict=Dict{String,Any}(), track_order::Union{Nothing,Bool}=nothing, kwargs... -) - h5open(FileIO.filename(f), "r"; track_order=_infer_track_order(track_order, dict), kwargs...) do file +function fileio_load(f::FileIO.File{FileIO.format"HDF5"}; + dict = Dict{String,Any}(), track_order::Union{Nothing,Bool} = nothing, + kwargs...) + h5open(FileIO.filename(f), "r"; track_order = _infer_track_order(track_order, dict), + kwargs...) do file loadtodict!(dict, file) end end # when called with explicitly requested variable names, return each one -function fileio_load(f::FileIO.File{FileIO.format"HDF5"}, varname::AbstractString; kwargs...) +function fileio_load(f::FileIO.File{FileIO.format"HDF5"}, varname::AbstractString; + kwargs...) h5open(FileIO.filename(f), "r"; kwargs...) do file read(file, varname) end end -function fileio_load(f::FileIO.File{FileIO.format"HDF5"}, varnames::AbstractString...; kwargs...) +function fileio_load(f::FileIO.File{FileIO.format"HDF5"}, varnames::AbstractString...; + kwargs...) h5open(FileIO.filename(f), "r"; kwargs...) do file map(var -> read(file, var), varnames) end end # save all the key-value pairs in the dict as top-level variables -function fileio_save( - f::FileIO.File{FileIO.format"HDF5"}, dict::AbstractDict; - track_order::Union{Nothing,Bool}=nothing, kwargs... -) - h5open(FileIO.filename(f), "w"; track_order=_infer_track_order(track_order, dict), kwargs...) do file +function fileio_save(f::FileIO.File{FileIO.format"HDF5"}, dict::AbstractDict; + track_order::Union{Nothing,Bool} = nothing, kwargs...) + h5open(FileIO.filename(f), "w"; track_order = _infer_track_order(track_order, dict), + kwargs...) do file for (k, v) in dict - isa(k, AbstractString) || throw(ArgumentError("keys must be strings (the names of variables), got $k")) + isa(k, AbstractString) || + throw(ArgumentError("keys must be strings (the names of variables), got $k")) write(file, String(k), v) end end diff --git a/src/filters/builtin.jl b/src/filters/builtin.jl index 2c68f0897..0a500e8f7 100644 --- a/src/filters/builtin.jl +++ b/src/filters/builtin.jl @@ -12,7 +12,7 @@ highest compression (but slowest speed). struct Deflate <: Filter level::Cuint end -Deflate(;level=5) = Deflate(level) +Deflate(; level = 5) = Deflate(level) Base.show(io::IO, deflate::Deflate) = print(io, Deflate, "(level=", Int(deflate.level), ")") filterid(::Type{Deflate}) = API.H5Z_FILTER_DEFLATE @@ -92,7 +92,7 @@ struct Szip <: Filter options_mask::Cuint pixels_per_block::Cuint end -function Szip(;coding=:nn, pixels_per_block=8) +function Szip(; coding = :nn, pixels_per_block = 8) options_mask = Cuint(0) if coding == :ec options_mask |= API.H5_SZIP_EC_OPTION_MASK @@ -156,4 +156,3 @@ function Base.push!(f::FilterPipeline, scaleoffset::ScaleOffset) API.h5p_set_scaleoffset(f.plist, scaleoffset.scale_type, scaleoffset.scale_factor) return f end - diff --git a/src/filters/filters.jl b/src/filters/filters.jl index c8af19d97..8167a56be 100644 --- a/src/filters/filters.jl +++ b/src/filters/filters.jl @@ -50,7 +50,6 @@ export Deflate, Shuffle, Fletcher32, Szip, NBit, ScaleOffset, ExternalFilter import ..HDF5: Properties, h5doc, API - """ Filter @@ -91,7 +90,7 @@ abstract type Filter end Maps filter id to filter type. """ -const FILTERS = Dict{API.H5Z_filter_t, Type{<: Filter}}() +const FILTERS = Dict{API.H5Z_filter_t,Type{<:Filter}}() """ filterid(F) where {F <: Filter} @@ -153,7 +152,7 @@ function can_apply_cfunc(::Type{F}) where {F<:Filter} if func === nothing return C_NULL else - return @cfunction($func, API.herr_t, (API.hid_t,API.hid_t,API.hid_t)) + return @cfunction($func, API.herr_t, (API.hid_t, API.hid_t, API.hid_t)) end end @@ -181,11 +180,10 @@ function set_local_cfunc(::Type{F}) where {F<:Filter} if func === nothing return C_NULL else - return @cfunction($func, API.herr_t, (API.hid_t,API.hid_t,API.hid_t)) + return @cfunction($func, API.herr_t, (API.hid_t, API.hid_t, API.hid_t)) end end - """ filter_func(::Type{F}) where {F<:Filter} @@ -212,7 +210,7 @@ function filter_cfunc(::Type{F}) where {F<:Filter} end c_filter_func = @cfunction($func, Csize_t, (Cuint, Csize_t, Ptr{Cuint}, Csize_t, - Ptr{Csize_t}, Ptr{Ptr{Cvoid}})) + Ptr{Csize_t}, Ptr{Ptr{Cvoid}})) return c_filter_func end @@ -223,7 +221,7 @@ end Register the filter with the HDF5 library via [`API.h5z_register`](@ref). Also add F to the FILTERS dictionary. """ -function register_filter(::Type{F}) where F <: Filter +function register_filter(::Type{F}) where {F<:Filter} id = filterid(F) encoder = encoder_present(F) decoder = decoder_present(F) @@ -231,18 +229,14 @@ function register_filter(::Type{F}) where F <: Filter can_apply = can_apply_cfunc(F) set_local = set_local_cfunc(F) func = filter_cfunc(F) - GC.@preserve name begin - API.h5z_register(API.H5Z_class_t( - API.H5Z_CLASS_T_VERS, - id, - encoder, - decoder, - pointer(name), - can_apply, - set_local, - func - )) - end + GC.@preserve name begin API.h5z_register(API.H5Z_class_t(API.H5Z_CLASS_T_VERS, + id, + encoder, + decoder, + pointer(name), + can_apply, + set_local, + func)) end FILTERS[id] = F return nothing end @@ -328,22 +322,24 @@ end Base.size(f::FilterPipeline) = (length(f),) function Base.getindex(f::FilterPipeline, i::Integer) - id = API.h5p_get_filter(f.plist, i-1, C_NULL, C_NULL, C_NULL, 0, C_NULL, C_NULL) + id = API.h5p_get_filter(f.plist, i - 1, C_NULL, C_NULL, C_NULL, 0, C_NULL, C_NULL) F = get(FILTERS, id, ExternalFilter) return getindex(f, F, i) end -function Base.getindex(f::FilterPipeline, ::Type{ExternalFilter}, i::Integer, cd_values::Vector{Cuint} = Cuint[]) +function Base.getindex(f::FilterPipeline, ::Type{ExternalFilter}, i::Integer, + cd_values::Vector{Cuint} = Cuint[]) flags = Ref{Cuint}() cd_nelmts = Ref{Csize_t}(length(cd_values)) namebuf = Array{UInt8}(undef, 256) config = Ref{Cuint}() - id = API.h5p_get_filter(f.plist, i-1, flags, cd_nelmts, cd_values, length(namebuf), namebuf, config) + id = API.h5p_get_filter(f.plist, i - 1, flags, cd_nelmts, cd_values, length(namebuf), + namebuf, config) if cd_nelmts[] > length(cd_values) resize!(cd_values, cd_nelmts[]) return getindex(f, ExternalFilter, i, cd_values) end - resize!(namebuf, findfirst(isequal(0), namebuf)-1) + resize!(namebuf, findfirst(isequal(0), namebuf) - 1) resize!(cd_values, cd_nelmts[]) return ExternalFilter(id, flags[], cd_values, String(namebuf), config[]) end @@ -351,22 +347,23 @@ end function Base.getindex(f::FilterPipeline, ::Type{F}, i::Integer) where {F<:Filter} @assert isbitstype(F) ref = Ref{F}() - GC.@preserve ref begin - id = API.h5p_get_filter(f.plist, i-1, C_NULL, div(sizeof(F), sizeof(Cuint)), pointer_from_objref(ref), 0, C_NULL, C_NULL) - end + GC.@preserve ref begin id = API.h5p_get_filter(f.plist, i - 1, C_NULL, + div(sizeof(F), sizeof(Cuint)), + pointer_from_objref(ref), 0, C_NULL, + C_NULL) end @assert id == filterid(F) return ref[] end function Base.getindex(f::FilterPipeline, ::Type{F}) where {F<:Filter} @assert isbitstype(F) ref = Ref{F}() - GC.@preserve ref begin - API.h5p_get_filter_by_id(f.plist, filterid(F), C_NULL, div(sizeof(F), sizeof(Cuint)), pointer_from_objref(ref), 0, C_NULL, C_NULL) - end + GC.@preserve ref begin API.h5p_get_filter_by_id(f.plist, filterid(F), C_NULL, + div(sizeof(F), sizeof(Cuint)), + pointer_from_objref(ref), 0, C_NULL, + C_NULL) end return ref[] end - function Base.empty!(filters::FilterPipeline) API.h5p_remove_filter(filters.plist, API.H5Z_FILTER_ALL) return filters @@ -375,28 +372,28 @@ function Base.delete!(filters::FilterPipeline, ::Type{F}) where {F<:Filter} API.h5p_remove_filter(filters.plist, filterid(F)) return filters end -function Base.append!(filters::FilterPipeline, extra::Union{AbstractVector{<:Filter}, NTuple{N, Filter} where N}) +function Base.append!(filters::FilterPipeline, + extra::Union{AbstractVector{<:Filter},NTuple{N,Filter} where N}) for filter in extra push!(filters, filter) end return filters end -function Base.push!(p::FilterPipeline, f::F) where F <: Filter +function Base.push!(p::FilterPipeline, f::F) where {F<:Filter} ref = Ref(f) - GC.@preserve ref begin - API.h5p_set_filter(p.plist, filterid(F), API.H5Z_FLAG_OPTIONAL, div(sizeof(F), sizeof(Cuint)), pointer_from_objref(ref)) - end + GC.@preserve ref begin API.h5p_set_filter(p.plist, filterid(F), API.H5Z_FLAG_OPTIONAL, + div(sizeof(F), sizeof(Cuint)), + pointer_from_objref(ref)) end return p end function Base.push!(p::FilterPipeline, f::ExternalFilter) - GC.@preserve f begin - API.h5p_set_filter(p.plist, f.filter_id, f.flags, length(f.data), pointer(f.data)) - end + GC.@preserve f begin API.h5p_set_filter(p.plist, f.filter_id, f.flags, length(f.data), + pointer(f.data)) end return p end # Convert a Filter to an Integer subtype using filterid -function Base.convert(::Type{I}, ::Type{F}) where {I <: Integer, F <: Filter} +function Base.convert(::Type{I}, ::Type{F}) where {I<:Integer,F<:Filter} Base.convert(I, filterid(F)) end diff --git a/src/groups.jl b/src/groups.jl index b2f96b9b7..b153b4c52 100644 --- a/src/groups.jl +++ b/src/groups.jl @@ -20,17 +20,20 @@ See also * [`H5P`](@ref H5P) """ function create_group(parent::Union{File,Group}, path::AbstractString, - lcpl::LinkCreateProperties=_link_properties(path), - gcpl::GroupCreateProperties=GroupCreateProperties(); - pv...) - haskey(parent, path) && error("cannot create group: object \"", path, "\" already exists at ", name(parent)) + lcpl::LinkCreateProperties = _link_properties(path), + gcpl::GroupCreateProperties = GroupCreateProperties(); + pv...) + haskey(parent, path) && + error("cannot create group: object \"", path, "\" already exists at ", name(parent)) pv = setproperties!(gcpl; pv...) isempty(pv) || error("invalid keyword options $pv") Group(API.h5g_create(parent, path, lcpl, gcpl, API.H5P_DEFAULT), file(parent)) end -open_group(parent::Union{File,Group}, name::AbstractString, gapl::GroupAccessProperties=GroupAccessProperties()) = +function open_group(parent::Union{File,Group}, name::AbstractString, + gapl::GroupAccessProperties = GroupAccessProperties()) Group(API.h5g_open(checkvalid(parent), name, gapl), file(parent)) +end # Get the root group root(h5file::File) = open_group(h5file, "/") @@ -44,12 +47,13 @@ Base.isempty(x::Union{Group,File}) = length(x) == 0 name(obj::Union{File,Group,Dataset,Datatype}) = API.h5i_get_name(checkvalid(obj)) # iteration by objects -function Base.iterate(parent::Union{File,Group}, iter = (1,nothing)) +function Base.iterate(parent::Union{File,Group}, iter = (1, nothing)) n, prev_obj = iter prev_obj โ‰ข nothing && close(prev_obj) n > length(parent) && return nothing - obj = h5object(API.h5o_open_by_idx(checkvalid(parent), ".", idx_type(parent), order(parent), n-1, API.H5P_DEFAULT), parent) - return (obj, (n+1,obj)) + obj = h5object(API.h5o_open_by_idx(checkvalid(parent), ".", idx_type(parent), + order(parent), n - 1, API.H5P_DEFAULT), parent) + return (obj, (n + 1, obj)) end function Base.parent(obj::Union{File,Group,Dataset}) @@ -78,7 +82,8 @@ function split1(path::AbstractString) end end -function Base.haskey(parent::Union{File,Group}, path::AbstractString, lapl::LinkAccessProperties = LinkAccessProperties()) +function Base.haskey(parent::Union{File,Group}, path::AbstractString, + lapl::LinkAccessProperties = LinkAccessProperties()) # recursively check each step of the path exists # see https://portal.hdfgroup.org/display/HDF5/H5L_EXISTS checkvalid(parent) @@ -106,16 +111,25 @@ function Base.keys(x::Union{Group,File}) return children end - -delete_object(parent::Union{File,Group}, path::AbstractString, lapl::LinkAccessProperties=LinkAccessProperties()) = +function delete_object(parent::Union{File,Group}, path::AbstractString, + lapl::LinkAccessProperties = LinkAccessProperties()) API.h5l_delete(checkvalid(parent), path, lapl) -delete_object(obj::Object) = delete_object(parent(obj), ascii(split(name(obj),"/")[end])) # FIXME: remove ascii? +end +delete_object(obj::Object) = delete_object(parent(obj), ascii(split(name(obj), "/")[end])) # FIXME: remove ascii? # Move links -move_link(src::Union{File,Group}, src_name::AbstractString, dest::Union{File,Group}, dest_name::AbstractString=src_name, lapl::LinkAccessProperties = LinkAccessProperties(), lcpl::LinkCreateProperties = LinkCreateProperties()) = +function move_link(src::Union{File,Group}, src_name::AbstractString, + dest::Union{File,Group}, dest_name::AbstractString = src_name, + lapl::LinkAccessProperties = LinkAccessProperties(), + lcpl::LinkCreateProperties = LinkCreateProperties()) API.h5l_move(checkvalid(src), src_name, checkvalid(dest), dest_name, lcpl, lapl) -move_link(parent::Union{File,Group}, src_name::AbstractString, dest_name::AbstractString, lapl::LinkAccessProperties = LinkAccessProperties(), lcpl::LinkCreateProperties = LinkCreateProperties()) = +end +function move_link(parent::Union{File,Group}, src_name::AbstractString, + dest_name::AbstractString, + lapl::LinkAccessProperties = LinkAccessProperties(), + lcpl::LinkCreateProperties = LinkCreateProperties()) API.h5l_move(checkvalid(parent), src_name, parent, dest_name, lcpl, lapl) +end """ create_external(source::Union{HDF5.File, HDF5.Group}, source_relpath, target_filename, target_path; @@ -124,7 +138,9 @@ move_link(parent::Union{File,Group}, src_name::AbstractString, dest_name::Abstra Create an external link such that `source[source_relpath]` points to `target_path` within the file with path `target_filename`; Calls `[H5Lcreate_external](https://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-CreateExternal)`. """ -function create_external(source::Union{File,Group}, source_relpath, target_filename, target_path; lcpl_id=API.H5P_DEFAULT, lapl_id=API.H5P_DEFAULT) - API.h5l_create_external(target_filename, target_path, source, source_relpath, lcpl_id, lapl_id) +function create_external(source::Union{File,Group}, source_relpath, target_filename, + target_path; lcpl_id = API.H5P_DEFAULT, lapl_id = API.H5P_DEFAULT) + API.h5l_create_external(target_filename, target_path, source, source_relpath, lcpl_id, + lapl_id) nothing end diff --git a/src/objects.jl b/src/objects.jl index 5ed9855e2..d551ee8f9 100644 --- a/src/objects.jl +++ b/src/objects.jl @@ -1,6 +1,8 @@ # Ensure that objects haven't been closed Base.isvalid(obj::Union{File,Datatype,Dataspace}) = obj.id != -1 && API.h5i_is_valid(obj) -Base.isvalid(obj::Union{Group,Dataset,Attribute}) = obj.id != -1 && obj.file.id != -1 && API.h5i_is_valid(obj) +function Base.isvalid(obj::Union{Group,Dataset,Attribute}) + obj.id != -1 && obj.file.id != -1 && API.h5i_is_valid(obj) +end checkvalid(obj) = isvalid(obj) ? obj : error("File or object has been closed") # Close functions @@ -28,7 +30,9 @@ function h5object(obj_id::API.hid_t, parent) error("Invalid object type for path ", path) end -open_object(parent, path::AbstractString) = h5object(API.h5o_open(checkvalid(parent), path, API.H5P_DEFAULT), parent) +function open_object(parent, path::AbstractString) + h5object(API.h5o_open(checkvalid(parent), path, API.H5P_DEFAULT), parent) +end function gettype(parent, path::AbstractString) obj_id = API.h5o_open(checkvalid(parent), path, API.H5P_DEFAULT) @@ -38,5 +42,13 @@ function gettype(parent, path::AbstractString) end # Copy objects -copy_object(src_parent::Union{File,Group}, src_path::AbstractString, dst_parent::Union{File,Group}, dst_path::AbstractString) = API.h5o_copy(checkvalid(src_parent), src_path, checkvalid(dst_parent), dst_path, API.H5P_DEFAULT, _link_properties(dst_path)) -copy_object(src_obj::Object, dst_parent::Union{File,Group}, dst_path::AbstractString) = API.h5o_copy(checkvalid(src_obj), ".", checkvalid(dst_parent), dst_path, API.H5P_DEFAULT, _link_properties(dst_path)) +function copy_object(src_parent::Union{File,Group}, src_path::AbstractString, + dst_parent::Union{File,Group}, dst_path::AbstractString) + API.h5o_copy(checkvalid(src_parent), src_path, checkvalid(dst_parent), dst_path, + API.H5P_DEFAULT, _link_properties(dst_path)) +end +function copy_object(src_obj::Object, dst_parent::Union{File,Group}, + dst_path::AbstractString) + API.h5o_copy(checkvalid(src_obj), ".", checkvalid(dst_parent), dst_path, + API.H5P_DEFAULT, _link_properties(dst_path)) +end diff --git a/src/properties.jl b/src/properties.jl index 2cbc3a425..6096d7671 100644 --- a/src/properties.jl +++ b/src/properties.jl @@ -17,7 +17,7 @@ function Base.close(obj::Properties) end Base.isvalid(obj::Properties) = obj.id != -1 && API.h5i_is_valid(obj) -Base.copy(obj::P) where {P <: Properties} = P(HDF5.API.h5p_copy(obj.id)) +Base.copy(obj::P) where {P<:Properties} = P(HDF5.API.h5p_copy(obj.id)) # By default, properties objects are only initialized lazily function init!(prop::P) where {P<:Properties} @@ -27,7 +27,7 @@ function init!(prop::P) where {P<:Properties} return prop end -function (::Type{P})(;kwargs...) where {P <: Properties} +function (::Type{P})(; kwargs...) where {P<:Properties} obj = P(API.H5P_DEFAULT) for (k, v) in kwargs setproperty!(obj, k, v) @@ -35,7 +35,7 @@ function (::Type{P})(;kwargs...) where {P <: Properties} return obj end # Properties() do syntax -function (::Type{P})(func::Function; kwargs...) where {P <: Properties} +function (::Type{P})(func::Function; kwargs...) where {P<:Properties} p = P(; kwargs...) # Eagerly initialize when using do syntax # This allows for use low-level API calls @@ -47,8 +47,8 @@ function (::Type{P})(func::Function; kwargs...) where {P <: Properties} end end -function Base.getproperty(p::P, name::Symbol) where {P <: Properties} - name === :id ? getfield(p, :id) : +function Base.getproperty(p::P, name::Symbol) where {P<:Properties} + name === :id ? getfield(p, :id) : class_getproperty(P, init!(p), name) end @@ -61,17 +61,19 @@ function Base.setproperty!(p::P, name::Symbol, val) where {P<:Properties} end Base.propertynames(p::P) where {P<:Properties} = (all_propertynames(P)..., :id) -all_propertynames(::Type{P}) where {P<:Properties} = (class_propertynames(P)..., all_propertynames(superclass(P))...,) +function all_propertynames(::Type{P}) where {P<:Properties} + (class_propertynames(P)..., all_propertynames(superclass(P))...) +end # defaults: refer to super class -class_getproperty(::Type{P}, props, name) where {P<:Properties} = +function class_getproperty(::Type{P}, props, name) where {P<:Properties} class_getproperty(superclass(P), props, name) -class_setproperty!(::Type{P}, p, name, val) where {P<:Properties} = +end +function class_setproperty!(::Type{P}, p, name, val) where {P<:Properties} class_setproperty!(superclass(P), p, name, val) +end class_propertynames(::Type{P}) where {P<:Properties} = () - - """ @propertyclass P classid @@ -115,18 +117,18 @@ macro propertyclass(name, classid) return esc(expr) end - @propertyclass GenericProperties API.H5P_DEFAULT superclass(::Type{P}) where {P<:Properties} = GenericProperties -class_getproperty(::Type{GenericProperties}, props, name) = +function class_getproperty(::Type{GenericProperties}, props, name) error("$(typeof(props)) has no property $name") -class_setproperty!(::Type{GenericProperties}, props, name, val) = +end +function class_setproperty!(::Type{GenericProperties}, props, name, val) error("$(typeof(props)) has no property $name") +end all_propertynames(::Type{GenericProperties}) = () - # for initializing multiple Properties from a set of keyword arguments """ setproperties!(props::Properties...; kwargs...) @@ -136,11 +138,11 @@ each `Properties` object in `props`. Returns a `Dict` of any pairs which didn't match properties in `props`. """ function setproperties!(props::Properties...; kwargs...) - filter(kwargs) do (k,v) + filter(kwargs) do (k, v) found = false for prop in props if k in all_propertynames(typeof(prop)) - setproperty!(prop,k,v) + setproperty!(prop, k, v) found = true end end @@ -148,8 +150,6 @@ function setproperties!(props::Properties...; kwargs...) end end - - ### ### Convenience macros for defining getter/setter functions ### @@ -158,10 +158,10 @@ end @tuple_property(name) """ macro tuple_property(property) - get_property = Symbol(:get_,property) - set_property! = Symbol(:set_,property,:!) - api_get_property = :(API.$(Symbol(:h5p_get_,property))) - api_set_property = :(API.$(Symbol(:h5p_set_,property))) + get_property = Symbol(:get_, property) + set_property! = Symbol(:set_, property, :!) + api_get_property = :(API.$(Symbol(:h5p_get_, property))) + api_set_property = :(API.$(Symbol(:h5p_set_, property))) quote function $(esc(get_property))(p::Properties) return $api_get_property(p) @@ -178,10 +178,10 @@ end Wrap property getter/setter API functions that use enum values to use symbol instead. """ macro enum_property(property, pairs...) - get_property = Symbol(:get_,property) - set_property! = Symbol(:set_,property,:!) - api_get_property = :(API.$(Symbol(:h5p_get_,property))) - api_set_property = :(API.$(Symbol(:h5p_set_,property))) + get_property = Symbol(:get_, property) + set_property! = Symbol(:set_, property, :!) + api_get_property = :(API.$(Symbol(:h5p_get_, property))) + api_set_property = :(API.$(Symbol(:h5p_set_, property))) get_expr = :(error("Unknown $property value $enum")) set_expr = :(throw(ArgumentError("Invalid $property $val"))) @@ -216,10 +216,10 @@ end Wrap property getter/setter API functions that use `0`/`1` to use `Bool` values """ macro bool_property(property) - get_property = Symbol(:get_,property) - set_property! = Symbol(:set_,property,:!) - api_get_property = :(API.$(Symbol(:h5p_get_,property))) - api_set_property = :(API.$(Symbol(:h5p_set_,property))) + get_property = Symbol(:get_, property) + set_property! = Symbol(:set_, property, :!) + api_get_property = :(API.$(Symbol(:h5p_get_, property))) + api_set_property = :(API.$(Symbol(:h5p_set_, property))) quote function $(esc(get_property))(p::Properties) return $api_get_property(p) != 0 @@ -230,7 +230,6 @@ macro bool_property(property) end end - ### ### Define Properties types ### @@ -252,24 +251,31 @@ that will be closed. @bool_property(obj_track_times) -class_propertynames(::Type{ObjectCreateProperties}) = ( - :obj_track_times, - :track_times, - ) +class_propertynames(::Type{ObjectCreateProperties}) = (:obj_track_times, + :track_times) function class_getproperty(::Type{ObjectCreateProperties}, p::Properties, name::Symbol) name === :obj_track_times ? get_obj_track_times(p) : # deprecated - name === :track_times ? (depwarn("`track_times` property is deprecated, use `obj_track_times` instead",:track_times); get_obj_track_times(p)) : + name === :track_times ? + (depwarn("`track_times` property is deprecated, use `obj_track_times` instead", + :track_times); + get_obj_track_times(p)) : class_getproperty(superclass(ObjectCreateProperties), p, name) end -function class_setproperty!(::Type{ObjectCreateProperties}, p::Properties, name::Symbol, val) +function class_setproperty!(::Type{ObjectCreateProperties}, p::Properties, name::Symbol, + val) name === :obj_track_times ? set_obj_track_times!(p, val) : # deprecated - name === :track_times ? (depwarn("`track_times=$val` keyword option is deprecated, use `obj_track_times=$val` instead",:track_times); set_obj_track_times!(p, val)) : + name === :track_times ? + (depwarn("`track_times=$val` keyword option is deprecated, use `obj_track_times=$val` instead", + :track_times); + set_obj_track_times!(p, val)) : class_setproperty!(superclass(ObjectCreateProperties), p, name, val) end -get_track_order(p::Properties) = API.h5p_get_link_creation_order(p) != 0 && API.h5p_get_attr_creation_order(p) != 0 +function get_track_order(p::Properties) + API.h5p_get_link_creation_order(p) != 0 && API.h5p_get_attr_creation_order(p) != 0 +end function set_track_order!(p::Properties, val::Bool) crt_order_flags = val ? (API.H5P_CRT_ORDER_TRACKED | API.H5P_CRT_ORDER_INDEXED) : 0 @@ -295,10 +301,8 @@ that will be closed. @propertyclass GroupCreateProperties API.H5P_GROUP_CREATE superclass(::Type{GroupCreateProperties}) = ObjectCreateProperties -class_propertynames(::Type{GroupCreateProperties}) = ( - :local_heap_size_hint, - :track_order, - ) +class_propertynames(::Type{GroupCreateProperties}) = (:local_heap_size_hint, + :track_order) function class_getproperty(::Type{GroupCreateProperties}, p::Properties, name::Symbol) name === :local_heap_size_hint ? API.h5p_get_local_heap_size_hint(p) : name === :track_order ? get_track_order(p) : @@ -328,26 +332,27 @@ that will be closed. @propertyclass FileCreateProperties API.H5P_FILE_CREATE superclass(::Type{FileCreateProperties}) = ObjectCreateProperties +function class_propertynames(::Type{FileCreateProperties}) + (:userblock, + :track_order, + :strategy, + :persist, + :threshold, + :file_space_page_size) +end -class_propertynames(::Type{FileCreateProperties}) = ( - :userblock, - :track_order, - :strategy, - :persist, - :threshold, - :file_space_page_size - ) - -const FSPACE_STRATEGY_SYMBOLS = Dict( - :fsm_aggr => API.H5F_FSPACE_STRATEGY_FSM_AGGR, - :page => API.H5F_FSPACE_STRATEGY_PAGE, - :aggr => API.H5F_FSPACE_STRATEGY_AGGR, - :none => API.H5F_FSPACE_STRATEGY_NONE, - :ntypes => API.H5F_FSPACE_STRATEGY_NTYPES -) - -set_strategy!(p::FileCreateProperties, val) = API.h5p_set_file_space_strategy(p, strategy = val) -set_strategy!(p::FileCreateProperties, val::Symbol) = API.h5p_set_file_space_strategy(p, strategy = FSPACE_STRATEGY_SYMBOLS[val]) +const FSPACE_STRATEGY_SYMBOLS = Dict(:fsm_aggr => API.H5F_FSPACE_STRATEGY_FSM_AGGR, + :page => API.H5F_FSPACE_STRATEGY_PAGE, + :aggr => API.H5F_FSPACE_STRATEGY_AGGR, + :none => API.H5F_FSPACE_STRATEGY_NONE, + :ntypes => API.H5F_FSPACE_STRATEGY_NTYPES) + +function set_strategy!(p::FileCreateProperties, val) + API.h5p_set_file_space_strategy(p; strategy = val) +end +function set_strategy!(p::FileCreateProperties, val::Symbol) + API.h5p_set_file_space_strategy(p; strategy = FSPACE_STRATEGY_SYMBOLS[val]) +end function get_strategy(p::FileCreateProperties) strategy = API.h5p_get_file_space_strategy(p)[:strategy] for (k, v) in FSPACE_STRATEGY_SYMBOLS @@ -359,25 +364,24 @@ function get_strategy(p::FileCreateProperties) end function class_getproperty(::Type{FileCreateProperties}, p::Properties, name::Symbol) - name === :userblock ? API.h5p_get_userblock(p) : + name === :userblock ? API.h5p_get_userblock(p) : name === :track_order ? get_track_order(p) : - name === :strategy ? get_strategy(p) : - name === :persist ? API.h5p_get_file_space_strategy(p)[:persist] : - name === :threshold ? API.h5p_get_file_space_strategy(p)[:threshold] : + name === :strategy ? get_strategy(p) : + name === :persist ? API.h5p_get_file_space_strategy(p)[:persist] : + name === :threshold ? API.h5p_get_file_space_strategy(p)[:threshold] : name === :file_space_page_size ? API.h5p_get_file_space_page_size(p) : class_getproperty(superclass(FileCreateProperties), p, name) end function class_setproperty!(::Type{FileCreateProperties}, p::Properties, name::Symbol, val) - name === :userblock ? API.h5p_set_userblock(p, val) : + name === :userblock ? API.h5p_set_userblock(p, val) : name === :track_order ? set_track_order!(p, val) : name === :strategy ? set_strategy!(p, val) : - name === :persist ? API.h5p_set_file_space_strategy(p, persist = val) : - name === :threshold ? API.h5p_set_file_space_strategy(p, threshold = val) : + name === :persist ? API.h5p_set_file_space_strategy(p; persist = val) : + name === :threshold ? API.h5p_set_file_space_strategy(p; threshold = val) : name === :file_space_page_size ? API.h5p_set_file_space_page_size(p, val) : class_setproperty!(superclass(FileCreateProperties), p, name, val) end - """ DatatypeCreateProperties(;kws...) DatatypeCreateProperties(f::Function; kws...) @@ -466,102 +470,123 @@ that will be closed. superclass(::Type{DatasetCreateProperties}) = ObjectCreateProperties @enum_property(alloc_time, - :default => API.H5D_ALLOC_TIME_DEFAULT, - :early => API.H5D_ALLOC_TIME_EARLY, - :incremental => API.H5D_ALLOC_TIME_INCR, - :late => API.H5D_ALLOC_TIME_LATE) + :default => API.H5D_ALLOC_TIME_DEFAULT, + :early => API.H5D_ALLOC_TIME_EARLY, + :incremental => API.H5D_ALLOC_TIME_INCR, + :late => API.H5D_ALLOC_TIME_LATE) # reverse indices function get_chunk(p::Properties) dims, N = API.h5p_get_chunk(p) - ntuple(i -> Int(dims[N-i+1]), N) + ntuple(i -> Int(dims[N - i + 1]), N) +end +function set_chunk!(p::Properties, dims) + API.h5p_set_chunk(p, length(dims), API.hsize_t[reverse(dims)...]) end -set_chunk!(p::Properties, dims) = API.h5p_set_chunk(p, length(dims), API.hsize_t[reverse(dims)...]) @enum_property(layout, - :compact => API.H5D_COMPACT, - :contiguous => API.H5D_CONTIGUOUS, - :chunked => API.H5D_CHUNKED, - :virtual => API.H5D_VIRTUAL) + :compact => API.H5D_COMPACT, + :contiguous => API.H5D_CONTIGUOUS, + :chunked => API.H5D_CHUNKED, + :virtual => API.H5D_VIRTUAL) # See https://portal.hdfgroup.org/display/HDF5/H5P_SET_FILL_TIME @enum_property(fill_time, - :alloc => API.H5D_FILL_TIME_ALLOC, - :never => API.H5D_FILL_TIME_NEVER, - :ifset => API.H5D_FILL_TIME_IFSET -) + :alloc => API.H5D_FILL_TIME_ALLOC, + :never => API.H5D_FILL_TIME_NEVER, + :ifset => API.H5D_FILL_TIME_IFSET) # filters getters/setters get_filters(p::Properties) = Filters.FilterPipeline(p) -set_filters!(p::Properties, val::Filters.Filter) = push!(empty!(Filters.FilterPipeline(p)), val) -set_filters!(p::Properties, vals::Union{Tuple, AbstractVector}) = append!(empty!(Filters.FilterPipeline(p)), vals) +function set_filters!(p::Properties, val::Filters.Filter) + push!(empty!(Filters.FilterPipeline(p)), val) +end +function set_filters!(p::Properties, vals::Union{Tuple,AbstractVector}) + append!(empty!(Filters.FilterPipeline(p)), vals) +end # convenience -set_deflate!(p::Properties, val::Bool) = val && push!(Filters.FilterPipeline(p), Filters.Deflate()) -set_deflate!(p::Properties, level::Integer) = push!(Filters.FilterPipeline(p), Filters.Deflate(level=level)) -set_shuffle!(p::Properties, val::Bool) = val && push!(Filters.FilterPipeline(p), Filters.Shuffle()) -set_fletcher32!(p::Properties, val::Bool) = val && push!(Filters.FilterPipeline(p), Filters.Fletcher32()) -set_blosc!(p::Properties, val) = error("The Blosc filter now requires the H5Zblosc package be loaded") - - -class_propertynames(::Type{DatasetCreateProperties}) = ( - :alloc_time, - :fill_time, - :fill_value, - :chunk, - :external, - :filters, - :layout, - :no_attrs_hint, - # convenience - :blosc, - :deflate, - :fletcher32, - :shuffle, - # deprecated - :compress, - :filter - ) +function set_deflate!(p::Properties, val::Bool) + val && push!(Filters.FilterPipeline(p), Filters.Deflate()) +end +function set_deflate!(p::Properties, level::Integer) + push!(Filters.FilterPipeline(p), Filters.Deflate(; level = level)) +end +function set_shuffle!(p::Properties, val::Bool) + val && push!(Filters.FilterPipeline(p), Filters.Shuffle()) +end +function set_fletcher32!(p::Properties, val::Bool) + val && push!(Filters.FilterPipeline(p), Filters.Fletcher32()) +end +function set_blosc!(p::Properties, val) + error("The Blosc filter now requires the H5Zblosc package be loaded") +end +function class_propertynames(::Type{DatasetCreateProperties}) + (:alloc_time, + :fill_time, + :fill_value, + :chunk, + :external, + :filters, + :layout, + :no_attrs_hint, + # convenience + :blosc, + :deflate, + :fletcher32, + :shuffle, + # deprecated + :compress, + :filter) +end function class_getproperty(::Type{DatasetCreateProperties}, p::Properties, name::Symbol) - name === :alloc_time ? get_alloc_time(p) : - name === :fill_time ? get_fill_time(p) : - name === :fill_value ? get_fill_value(p) : - name === :chunk ? get_chunk(p) : - name === :external ? API.h5p_get_external(p) : - name === :filters ? get_filters(p) : - name === :layout ? get_layout(p) : + name === :alloc_time ? get_alloc_time(p) : + name === :fill_time ? get_fill_time(p) : + name === :fill_value ? get_fill_value(p) : + name === :chunk ? get_chunk(p) : + name === :external ? API.h5p_get_external(p) : + name === :filters ? get_filters(p) : + name === :layout ? get_layout(p) : name === :no_attrs_hint ? - @static(API.h5_get_libversion() < v"1.10.5" ? + @static(API.h5_get_libversion() < v"1.10.5" ? false : - API.h5p_get_dset_no_attrs_hint(p) - ) : + API.h5p_get_dset_no_attrs_hint(p)) : # deprecated - name === :filter ? (depwarn("`filter` property name is deprecated, use `filters` instead",:class_getproperty); get_filters(p)) : + name === :filter ? + (depwarn("`filter` property name is deprecated, use `filters` instead", + :class_getproperty); + get_filters(p)) : class_getproperty(superclass(DatasetCreateProperties), p, name) end -function class_setproperty!(::Type{DatasetCreateProperties}, p::Properties, name::Symbol, val) - name === :alloc_time ? set_alloc_time!(p, val) : - name === :fill_time ? set_fill_time!(p, val) : - name === :fill_value ? set_fill_value!(p, val) : - name === :chunk ? set_chunk!(p, val) : - name === :external ? API.h5p_set_external(p, val...) : - name === :filters ? set_filters!(p, val) : - name === :layout ? set_layout!(p, val) : +function class_setproperty!(::Type{DatasetCreateProperties}, p::Properties, name::Symbol, + val) + name === :alloc_time ? set_alloc_time!(p, val) : + name === :fill_time ? set_fill_time!(p, val) : + name === :fill_value ? set_fill_value!(p, val) : + name === :chunk ? set_chunk!(p, val) : + name === :external ? API.h5p_set_external(p, val...) : + name === :filters ? set_filters!(p, val) : + name === :layout ? set_layout!(p, val) : name === :no_attrs_hint ? - @static(API.h5_get_libversion() < v"1.10.5" ? + @static(API.h5_get_libversion() < v"1.10.5" ? error("no_attrs_hint is only valid for HDF5 library versions 1.10.5 or greater") : - API.h5p_set_dset_no_attrs_hint(p, val) - ) : + API.h5p_set_dset_no_attrs_hint(p, val)) : # set-only for convenience - name === :blosc ? set_blosc!(p, val) : - name === :deflate ? set_deflate!(p, val) : - name === :fletcher32 ? set_fletcher32!(p, val) : - name === :shuffle ? set_shuffle!(p, val) : + name === :blosc ? set_blosc!(p, val) : + name === :deflate ? set_deflate!(p, val) : + name === :fletcher32 ? set_fletcher32!(p, val) : + name === :shuffle ? set_shuffle!(p, val) : # deprecated - name === :filter ? (depwarn("`filter=$val` keyword option is deprecated, use `filters=$val` instead",:class_setproperty!); set_filters!(p, val)) : - name === :compress ? (depwarn("`compress=$val` keyword option is deprecated, use `deflate=$val` instead",:class_setproperty!); set_deflate!(p, val)) : + name === :filter ? + (depwarn("`filter=$val` keyword option is deprecated, use `filters=$val` instead", + :class_setproperty!); + set_filters!(p, val)) : + name === :compress ? + (depwarn("`compress=$val` keyword option is deprecated, use `deflate=$val` instead", + :class_setproperty!); + set_deflate!(p, val)) : class_setproperty!(superclass(DatasetCreateProperties), p, name, val) end @@ -575,18 +600,16 @@ that will be closed. @propertyclass StringCreateProperties API.H5P_STRING_CREATE @enum_property(char_encoding, - :ascii => API.H5T_CSET_ASCII, - :utf8 => API.H5T_CSET_UTF8) - + :ascii => API.H5T_CSET_ASCII, + :utf8 => API.H5T_CSET_UTF8) -class_propertynames(::Type{StringCreateProperties}) = ( - :char_encoding, - ) +class_propertynames(::Type{StringCreateProperties}) = (:char_encoding,) function class_getproperty(::Type{StringCreateProperties}, p::Properties, name::Symbol) name === :char_encoding ? get_char_encoding(p) : class_getproperty(superclass(StringCreateProperties), p, name) end -function class_setproperty!(::Type{StringCreateProperties}, p::Properties, name::Symbol, val) +function class_setproperty!(::Type{StringCreateProperties}, p::Properties, name::Symbol, + val) name === :char_encoding ? set_char_encoding!(p, val) : class_setproperty!(superclass(StringCreateProperties), p, name, val) end @@ -610,9 +633,7 @@ superclass(::Type{LinkCreateProperties}) = StringCreateProperties @bool_property(create_intermediate_group) -class_propertynames(::Type{LinkCreateProperties}) = ( - :create_intermediate_group, - ) +class_propertynames(::Type{LinkCreateProperties}) = (:create_intermediate_group,) function class_getproperty(::Type{LinkCreateProperties}, p::Properties, name::Symbol) name === :create_intermediate_group ? get_create_intermediate_group(p) : class_getproperty(superclass(LinkCreateProperties), p, name) @@ -636,7 +657,6 @@ that will be closed. @propertyclass AttributeCreateProperties API.H5P_ATTRIBUTE_CREATE superclass(::Type{AttributeCreateProperties}) = StringCreateProperties - """ FileAccessProperties(;kws...) FileAccessProperties(f::Function; kws...) @@ -694,9 +714,9 @@ end libver_bound_to_enum(val::Integer) = val libver_bound_to_enum(val::API.H5F_libver_t) = val function libver_bound_to_enum(val::VersionNumber) - val >= v"1.12" ? API.H5F_LIBVER_V112 : - val >= v"1.10" ? API.H5F_LIBVER_V110 : - val >= v"1.8" ? API.H5F_LIBVER_V18 : + val >= v"1.12" ? API.H5F_LIBVER_V112 : + val >= v"1.10" ? API.H5F_LIBVER_V110 : + val >= v"1.8" ? API.H5F_LIBVER_V18 : throw(ArgumentError("libver_bound must be >= v\"1.8\".")) end function libver_bound_to_enum(val::Symbol) @@ -723,43 +743,48 @@ function set_libver_bounds!(p::Properties, val) API.h5p_set_libver_bounds(p, libver_bound_to_enum(val), libver_bound_to_enum(val)) end - -class_propertynames(::Type{FileAccessProperties}) = ( - :alignment, - :driver, - :driver_info, - :fapl_mpio, - :fclose_degree, - :file_locking, - :libver_bounds, - :meta_block_size, - ) +function class_propertynames(::Type{FileAccessProperties}) + (:alignment, + :driver, + :driver_info, + :fapl_mpio, + :fclose_degree, + :file_locking, + :libver_bounds, + :meta_block_size) +end function class_getproperty(::Type{FileAccessProperties}, p::Properties, name::Symbol) - name === :alignment ? get_alignment(p) : - name === :driver ? Drivers.get_driver(p) : - name === :driver_info ? API.h5p_get_driver_info(p) : # get only + name === :alignment ? get_alignment(p) : + name === :driver ? Drivers.get_driver(p) : + name === :driver_info ? API.h5p_get_driver_info(p) : # get only name === :fclose_degree ? get_fclose_degree(p) : - name === :file_locking ? API.h5p_get_file_locking(p) : + name === :file_locking ? API.h5p_get_file_locking(p) : name === :libver_bounds ? get_libver_bounds(p) : name === :meta_block_size ? API.h5p_get_meta_block_size(p) : # deprecated - name === :fapl_mpio ? (depwarn("The `fapl_mpio` property is deprecated, use `driver=HDF5.Drivers.MPIO(...)` instead.", :fapl_mpio); drv = get_driver(p, MPIO); (drv.comm, drv.info)) : + name === :fapl_mpio ? + (depwarn("The `fapl_mpio` property is deprecated, use `driver=HDF5.Drivers.MPIO(...)` instead.", + :fapl_mpio); + drv = get_driver(p, MPIO); + (drv.comm, drv.info)) : class_getproperty(superclass(FileAccessProperties), p, name) end function class_setproperty!(::Type{FileAccessProperties}, p::Properties, name::Symbol, val) - name === :alignment ? set_alignment!(p, val) : - name === :driver ? Drivers.set_driver!(p, val) : + name === :alignment ? set_alignment!(p, val) : + name === :driver ? Drivers.set_driver!(p, val) : name === :fclose_degree ? set_fclose_degree!(p, val) : - name === :file_locking ? API.h5p_set_file_locking(p, val...) : + name === :file_locking ? API.h5p_set_file_locking(p, val...) : name === :libver_bounds ? set_libver_bounds!(p, val) : name === :meta_block_size ? API.h5p_set_meta_block_size(p, val) : # deprecated - name === :fapl_mpio ? (depwarn("The `fapl_mpio` property is deprecated, use `driver=HDF5.Drivers.MPIO(...)` instead.", :fapl_mpio); p.driver = Drivers.MPIO(val...)) : + name === :fapl_mpio ? + (depwarn("The `fapl_mpio` property is deprecated, use `driver=HDF5.Drivers.MPIO(...)` instead.", + :fapl_mpio); + p.driver = Drivers.MPIO(val...)) : class_setproperty!(superclass(FileAccessProperties), p, name, val) end - @propertyclass LinkAccessProperties API.H5P_LINK_ACCESS @propertyclass GroupAccessProperties API.H5P_GROUP_ACCESS @@ -798,18 +823,17 @@ See [Dataset Access Properties](https://portal.hdfgroup.org/display/HDF5/Dataset @propertyclass DatasetAccessProperties API.H5P_DATASET_ACCESS superclass(::Type{DatasetAccessProperties}) = LinkAccessProperties -class_propertynames(::Type{DatasetAccessProperties}) = ( - :chunk_cache, - :efile_prefix, - :virtual_prefix, - :virtual_printf_gap, - :virtual_view -) +function class_propertynames(::Type{DatasetAccessProperties}) + (:chunk_cache, + :efile_prefix, + :virtual_prefix, + :virtual_printf_gap, + :virtual_view) +end @enum_property(virtual_view, - :first_missing => API.H5D_VDS_FIRST_MISSING, - :last_available => API.H5D_VDS_LAST_AVAILABLE -) + :first_missing => API.H5D_VDS_FIRST_MISSING, + :last_available => API.H5D_VDS_LAST_AVAILABLE) function class_getproperty(::Type{DatasetAccessProperties}, p::Properties, name::Symbol) name === :chunk_cache ? API.h5p_get_chunk_cache(p) : @@ -819,7 +843,8 @@ function class_getproperty(::Type{DatasetAccessProperties}, p::Properties, name: name === :virtual_view ? get_virtual_view(p) : class_getproperty(superclass(DatasetAccessProperties), p, name) end -function class_setproperty!(::Type{DatasetAccessProperties}, p::Properties, name::Symbol, val) +function class_setproperty!(::Type{DatasetAccessProperties}, p::Properties, name::Symbol, + val) name === :chunk_cache ? API.h5p_set_chunk_cache(p, val...) : name === :efile_prefix ? API.h5p_set_efile_prefix(p, val) : name === :virtual_prefix ? API.h5p_set_virtual_prefix(p, val) : @@ -850,22 +875,20 @@ that will be closed. :independent => API.H5FD_MPIO_INDEPENDENT, :collective => API.H5FD_MPIO_COLLECTIVE) -class_propertynames(::Type{DatasetTransferProperties}) = ( - :dxpl_mpio, - ) +class_propertynames(::Type{DatasetTransferProperties}) = (:dxpl_mpio,) function class_getproperty(::Type{DatasetTransferProperties}, p::Properties, name::Symbol) - name === :dxpl_mpio ? get_dxpl_mpio(p) : + name === :dxpl_mpio ? get_dxpl_mpio(p) : class_getproperty(superclass(DatasetTransferProperties), p, name) end -function class_setproperty!(::Type{DatasetTransferProperties}, p::Properties, name::Symbol, val) - name === :dxpl_mpio ? set_dxpl_mpio!(p, val) : +function class_setproperty!(::Type{DatasetTransferProperties}, p::Properties, name::Symbol, + val) + name === :dxpl_mpio ? set_dxpl_mpio!(p, val) : class_setproperty!(superclass(DatasetTransferProperties), p, name, val) end @propertyclass FileMountProperties API.H5P_FILE_MOUNT @propertyclass ObjectCopyProperties API.H5P_OBJECT_COPY - const DEFAULT_PROPERTIES = GenericProperties() # These properties are initialized in __init__() const ASCII_LINK_PROPERTIES = LinkCreateProperties() diff --git a/src/readwrite.jl b/src/readwrite.jl index 4de283742..98d0f0e8c 100644 --- a/src/readwrite.jl +++ b/src/readwrite.jl @@ -19,7 +19,8 @@ function Base.read(parent::Union{File,Group}, name::AbstractString; pv...) val end -function Base.read(parent::Union{File,Group}, name_type_pair::Pair{<:AbstractString,DataType}; pv...) +function Base.read(parent::Union{File,Group}, + name_type_pair::Pair{<:AbstractString,DataType}; pv...) obj = getindex(parent, name_type_pair[1]; pv...) val = read(obj, name_type_pair[2]) close(obj) @@ -47,7 +48,7 @@ function Base.getindex(obj::DatasetOrAttribute, I...) return val end -function Base.read(obj::DatasetOrAttribute, ::Type{T}, I...) where T +function Base.read(obj::DatasetOrAttribute, ::Type{T}, I...) where {T} dtype = datatype(obj) val = generic_read(obj, dtype, T, I...) close(dtype) @@ -59,7 +60,7 @@ end function Base.read(obj::DatasetOrAttribute, ::Type{String}, I...) dtype = datatype(obj) T = get_jl_type(dtype) - T <: Union{Cstring, FixedString} || error(name(obj), " cannot be read as type `String`") + T <: Union{Cstring,FixedString} || error(name(obj), " cannot be read as type `String`") val = generic_read(obj, dtype, T, I...) close(dtype) return val @@ -71,7 +72,8 @@ end Copy [part of] a HDF5 dataset or attribute to a preallocated output buffer. The output buffer must be convertible to a pointer and have a contiguous layout. """ -function Base.copyto!(output_buffer::AbstractArray{T}, obj::DatasetOrAttribute, I...) where T +function Base.copyto!(output_buffer::AbstractArray{T}, obj::DatasetOrAttribute, + I...) where {T} dtype = datatype(obj) val = nothing try @@ -83,11 +85,13 @@ function Base.copyto!(output_buffer::AbstractArray{T}, obj::DatasetOrAttribute, end # Special handling for reading OPAQUE datasets and attributes -function generic_read!(buf::Matrix{UInt8}, obj::DatasetOrAttribute, filetype::Datatype, ::Type{Opaque}) +function generic_read!(buf::Matrix{UInt8}, obj::DatasetOrAttribute, filetype::Datatype, + ::Type{Opaque}) generic_read(obj, filetype, Opaque, buf) end -function generic_read(obj::DatasetOrAttribute, filetype::Datatype, ::Type{Opaque}, buf::Union{Matrix{UInt8}, Nothing} = nothing) - sz = size(obj) +function generic_read(obj::DatasetOrAttribute, filetype::Datatype, ::Type{Opaque}, + buf::Union{Matrix{UInt8},Nothing} = nothing) + sz = size(obj) if isnothing(buf) buf = Matrix{UInt8}(undef, sizeof(filetype), prod(sz)) end @@ -102,21 +106,24 @@ function generic_read(obj::DatasetOrAttribute, filetype::Datatype, ::Type{Opaque data = vec(buf) else # array of opaque objects - data = reshape([buf[:,i] for i in 1:prod(sz)], sz...) + data = reshape([buf[:, i] for i in 1:prod(sz)], sz...) end return Opaque(data, tag) end # generic read function -function generic_read!(buf::Union{AbstractMatrix{UInt8}, AbstractArray{T}}, obj::DatasetOrAttribute, filetype::Datatype, ::Type{T}, I...) where T +function generic_read!(buf::Union{AbstractMatrix{UInt8},AbstractArray{T}}, + obj::DatasetOrAttribute, filetype::Datatype, ::Type{T}, + I...) where {T} return _generic_read(obj, filetype, T, buf, I...) end -function generic_read(obj::DatasetOrAttribute, filetype::Datatype, ::Type{T}, I...) where T +function generic_read(obj::DatasetOrAttribute, filetype::Datatype, ::Type{T}, + I...) where {T} return _generic_read(obj, filetype, T, nothing, I...) end function _generic_read(obj::DatasetOrAttribute, filetype::Datatype, ::Type{T}, - buf::Union{AbstractMatrix{UInt8}, AbstractArray{T}, Nothing}, I...) where T - + buf::Union{AbstractMatrix{UInt8},AbstractArray{T},Nothing}, + I...) where {T} sz, scalar, dspace = _size_of_buffer(obj, I) if isempty(sz) @@ -128,7 +135,7 @@ function _generic_read(obj::DatasetOrAttribute, filetype::Datatype, ::Type{T}, if isnothing(buf) buf = _normalized_buffer(T, sz) else - sizeof(buf) != prod(sz)*sizeof(T) && + sizeof(buf) != prod(sz) * sizeof(T) && error("Provided array buffer of size, $(size(buf)), and element type, $(eltype(buf)), does not match the dataset of size, $sz, and type, $T") end catch err @@ -168,7 +175,6 @@ function _generic_read(obj::DatasetOrAttribute, filetype::Datatype, ::Type{T}, end end - """ similar(obj::DatasetOrAttribute, [::Type{T}], [dims::Integer...]; normalize = true) @@ -176,57 +182,54 @@ Return a `Array{T}` or `Matrix{UInt8}` to that can contain [part of] the dataset The `normalize` keyword will normalize the buffer for string and array datatypes. """ -function Base.similar( - obj::DatasetOrAttribute, - ::Type{T}, - dims::Dims; - normalize::Bool = true -) where T +function Base.similar(obj::DatasetOrAttribute, + ::Type{T}, + dims::Dims; + normalize::Bool = true) where {T} filetype = datatype(obj) try - return similar(obj, filetype, T, dims; normalize=normalize) + return similar(obj, filetype, T, dims; normalize = normalize) finally close(filetype) end end -Base.similar( - obj::DatasetOrAttribute, - ::Type{T}, - dims::Integer...; - normalize::Bool = true -) where T = similar(obj, T, Int.(dims); normalize=normalize) +function Base.similar(obj::DatasetOrAttribute, + ::Type{T}, + dims::Integer...; + normalize::Bool = true) where {T} + similar(obj, T, Int.(dims); normalize = normalize) +end # Base.similar without specifying the Julia type function Base.similar(obj::DatasetOrAttribute, dims::Dims; normalize::Bool = true) filetype = datatype(obj) try T = get_jl_type(filetype) - return similar(obj, filetype, T, dims; normalize=normalize) + return similar(obj, filetype, T, dims; normalize = normalize) finally close(filetype) end end -Base.similar( - obj::DatasetOrAttribute, - dims::Integer...; - normalize::Bool = true -) = similar(obj, Int.(dims); normalize=normalize) +function Base.similar(obj::DatasetOrAttribute, + dims::Integer...; + normalize::Bool = true) + similar(obj, Int.(dims); normalize = normalize) +end # Opaque types -function Base.similar(obj::DatasetOrAttribute, filetype::Datatype, ::Type{Opaque}; normalize::Bool = true) +function Base.similar(obj::DatasetOrAttribute, filetype::Datatype, ::Type{Opaque}; + normalize::Bool = true) # normalize keyword for consistency, but it is ignored for Opaque - sz = size(obj) + sz = size(obj) return Matrix{UInt8}(undef, sizeof(filetype), prod(sz)) end # Undocumented Base.similar signature allowing filetype to be specified -function Base.similar( - obj::DatasetOrAttribute, - filetype::Datatype, - ::Type{T}, - dims::Dims; - normalize::Bool = true -) where T +function Base.similar(obj::DatasetOrAttribute, + filetype::Datatype, + ::Type{T}, + dims::Dims; + normalize::Bool = true) where {T} # We are reusing code that expect indices I = Base.OneTo.(dims) sz, scalar, dspace = _size_of_buffer(obj, I) @@ -237,20 +240,20 @@ function Base.similar( if normalize && do_normalize(T) buf = reshape(normalize_types(T, buf), sz) end - + return buf finally close(dspace) close(memtype) end end -Base.similar( - obj::DatasetOrAttribute, - filetype::Datatype, - ::Type{T}, - dims::Integer...; - normalize::Bool = true -) where T = similar(obj, filetype, T, Int.(dims); normalize=normalize) +function Base.similar(obj::DatasetOrAttribute, + filetype::Datatype, + ::Type{T}, + dims::Integer...; + normalize::Bool = true) where {T} + similar(obj, filetype, T, Int.(dims); normalize = normalize) +end # Utilities used in Base.similar implementation @@ -261,7 +264,7 @@ This is a utility function originall from generic_read. It gets the native memory type for the system based on filetype, and checks if the size matches. =# -@inline function _memtype(filetype::Datatype, ::Type{T}) where T +@inline function _memtype(filetype::Datatype, ::Type{T}) where {T} !isconcretetype(T) && error("type $T is not concrete") # padded layout in memory @@ -296,12 +299,11 @@ create in order to hold the contents of a Dataset or Attribute. * `scalar`, which is true if the value should be read as a scalar. * `dspace`, hyper =# -@inline function _size_of_buffer( - obj::DatasetOrAttribute, - I::Tuple = (), - dspace::Dataspace = dataspace(obj) -) - !isempty(I) && obj isa Attribute && error("HDF5 attributes do not support hyperslab selections") +@inline function _size_of_buffer(obj::DatasetOrAttribute, + I::Tuple = (), + dspace::Dataspace = dataspace(obj)) + !isempty(I) && obj isa Attribute && + error("HDF5 attributes do not support hyperslab selections") stype = API.h5s_get_simple_extent_type(dspace) @@ -339,7 +341,7 @@ end Return a Matrix{UInt8} for a normalized type or `Array{T}` for a regular type. See `do_normalize` in typeconversions.jl. =# -@inline function _normalized_buffer(::Type{T}, sz::NTuple{N, Int}) where {T, N} +@inline function _normalized_buffer(::Type{T}, sz::NTuple{N,Int}) where {T,N} if do_normalize(T) # The entire dataset is read into in a buffer matrix where the first dimension at # any stage of normalization is the bytes for a single element of type `T`, and @@ -351,4 +353,3 @@ See `do_normalize` in typeconversions.jl. return buf end - diff --git a/src/show.jl b/src/show.jl index 1f2fa9f06..5762a08f9 100644 --- a/src/show.jl +++ b/src/show.jl @@ -1,10 +1,10 @@ function Base.show(io::IO, fid::File) if isvalid(fid) - intent = API.h5f_get_intent(fid) + intent = API.h5f_get_intent(fid) RW_MASK = API.H5F_ACC_RDONLY | API.H5F_ACC_RDWR SWMR_MASK = API.H5F_ACC_SWMR_READ | API.H5F_ACC_SWMR_WRITE - rw = (intent & RW_MASK) == API.H5F_ACC_RDONLY ? "(read-only" : "(read-write" - swmr = (intent & SWMR_MASK) != 0 ? ", swmr) " : ") " + rw = (intent & RW_MASK) == API.H5F_ACC_RDONLY ? "(read-only" : "(read-write" + swmr = (intent & SWMR_MASK) != 0 ? ", swmr) " : ") " print(io, "HDF5.File: ", rw, swmr, fid.filename) else print(io, "HDF5.File: (closed) ", fid.filename) @@ -36,7 +36,7 @@ function Base.show(io::IO, prop::Properties) # or always well-defined (e.g. chunk if layout != :chunked, dxpl_mpio if no MPI) try val = getproperty(prop, name) - print(io, "\n ", rpad(name, 15), " = ", repr(val),",") + print(io, "\n ", rpad(name, 15), " = ", repr(val), ",") catch e end end @@ -46,7 +46,8 @@ end function Base.show(io::IO, dset::Dataset) if isvalid(dset) - print(io, "HDF5.Dataset: ", name(dset), " (file: ", dset.file.filename, " xfer_mode: ", dset.xfer.id, ")") + print(io, "HDF5.Dataset: ", name(dset), " (file: ", dset.file.filename, + " xfer_mode: ", dset.xfer.id, ")") else print(io, "HDF5.Dataset: (invalid)") end @@ -72,15 +73,11 @@ function Base.summary(io::IO, attrdict::AttributeDict) end end - -const ENDIAN_DICT = Dict( - API.H5T_ORDER_LE => "little endian byte order", - API.H5T_ORDER_BE => "big endian byte order", - API.H5T_ORDER_VAX => "vax mixed endian byte order", - API.H5T_ORDER_MIXED => "mixed endian byte order", - API.H5T_ORDER_NONE => "no particular byte order", -) - +const ENDIAN_DICT = Dict(API.H5T_ORDER_LE => "little endian byte order", + API.H5T_ORDER_BE => "big endian byte order", + API.H5T_ORDER_VAX => "vax mixed endian byte order", + API.H5T_ORDER_MIXED => "mixed endian byte order", + API.H5T_ORDER_NONE => "no particular byte order") function Base.show(io::IO, dtype::Datatype) print(io, "HDF5.Datatype: ") @@ -94,7 +91,7 @@ function Base.show(io::IO, dtype::Datatype) println(io, " size: ", API.h5t_get_size(dtype), " bytes") println(io, " precision: ", API.h5t_get_precision(dtype), " bits") println(io, " offset: ", API.h5t_get_offset(dtype), " bits") - print(io, " order: ", ENDIAN_DICT[API.h5t_get_order(dtype)]) + print(io, " order: ", ENDIAN_DICT[API.h5t_get_order(dtype)]) else print(io, str) end @@ -136,7 +133,7 @@ function Base.show(io::IO, dspace::Dataspace) print(io, "(") for ii in 1:ndims s, d, l = start[ii], stride[ii], count[ii] - print(io, range(s + 1, length = l, step = d == 1 ? nothing : d)) + print(io, range(s + 1; length = l, step = d == 1 ? nothing : d)) ii != ndims && print(io, ", ") end print(io, ") / (") @@ -178,7 +175,8 @@ Maximum number of children to show at each node. """ const SHOW_TREE_MAX_CHILDREN = Ref{Int}(50) -function Base.show(io::IO, ::MIME"text/plain", obj::Union{File,Group,Dataset,Attributes,Attribute}) +function Base.show(io::IO, ::MIME"text/plain", + obj::Union{File,Group,Dataset,Attributes,Attribute}) if get(io, :compact, false)::Bool show(io, obj) else @@ -192,20 +190,23 @@ _tree_icon(::Type{Dataset}) = SHOW_TREE_ICONS[] ? "๐Ÿ”ข" : "[D]" _tree_icon(::Type{Datatype}) = SHOW_TREE_ICONS[] ? "๐Ÿ“„" : "[T]" _tree_icon(::Type{File}) = SHOW_TREE_ICONS[] ? "๐Ÿ—‚๏ธ" : "[F]" _tree_icon(::Type) = SHOW_TREE_ICONS[] ? "โ“" : "[?]" -_tree_icon(obj) = _tree_icon(typeof(obj)) -_tree_icon(obj::Attributes) = _tree_icon(obj.parent) +_tree_icon(obj) = _tree_icon(typeof(obj)) +_tree_icon(obj::Attributes) = _tree_icon(obj.parent) _tree_head(io::IO, obj) = print(io, _tree_icon(obj), " ", obj) -_tree_head(io::IO, obj::Datatype) = print(io, _tree_icon(obj), " HDF5.Datatype: ", name(obj)) +function _tree_head(io::IO, obj::Datatype) + print(io, _tree_icon(obj), " HDF5.Datatype: ", name(obj)) +end -_tree_count(parent::Union{File,Group}, attributes::Bool) = +function _tree_count(parent::Union{File,Group}, attributes::Bool) length(parent) + (attributes ? length(HDF5.attrs(parent)) : 0) -_tree_count(parent::Dataset, attributes::Bool) = - attributes ? length(HDF5.attrs(parent)) : 0 +end +_tree_count(parent::Dataset, attributes::Bool) = attributes ? length(HDF5.attrs(parent)) : 0 _tree_count(parent::Attributes, _::Bool) = length(parent) _tree_count(parent::Union{Attribute,Datatype}, _::Bool) = 0 -function _show_tree(io::IO, obj::Union{File,Group,Dataset,Datatype,Attributes,Attribute}, indent::String=""; +function _show_tree(io::IO, obj::Union{File,Group,Dataset,Datatype,Attributes,Attribute}, + indent::String = ""; attributes::Bool = true, depth::Int = 1) isempty(indent) && _tree_head(io, obj) isvalid(obj) || return @@ -219,7 +220,7 @@ function _show_tree(io::IO, obj::Union{File,Group,Dataset,Datatype,Attributes,At counter = 0 nchildren = _tree_count(obj, attributes) - @inline function childstr(io, n, more=" ") + @inline function childstr(io, n, more = " ") print(io, "\n", indent, ELBOW * "(", n, more, n == 1 ? "child" : "children", ")") end @inline function depth_check() @@ -249,7 +250,7 @@ function _show_tree(io::IO, obj::Union{File,Group,Dataset,Datatype,Attributes,At end end - typeof(obj) <: Union{File, Group} || return nothing + typeof(obj) <: Union{File,Group} || return nothing API.h5l_iterate(obj, idx_type(obj), order(obj)) do loc_id, cname, _ depth_check() && return API.herr_t(1) diff --git a/src/typeconversions.jl b/src/typeconversions.jl index 2553f52ff..361214c5f 100644 --- a/src/typeconversions.jl +++ b/src/typeconversions.jl @@ -3,12 +3,12 @@ abstract type CharType <: AbstractString end struct ASCIIChar <: CharType - c::UInt8 + c::UInt8 end Base.length(c::ASCIIChar) = 1 struct UTF8Char <: CharType - c::UInt8 + c::UInt8 end Base.length(c::UTF8Char) = 1 @@ -20,7 +20,6 @@ cset(::Type{<:AbstractString}) = API.H5T_CSET_UTF8 cset(::Type{UTF8Char}) = API.H5T_CSET_UTF8 cset(::Type{ASCIIChar}) = API.H5T_CSET_ASCII - function unpad(s::String, pad::Integer)::String if pad == API.H5T_STR_NULLTERM # null-terminated ind = findfirst(isequal('\0'), s) @@ -35,23 +34,22 @@ function unpad(s::String, pad::Integer)::String end unpad(s, pad::Integer) = unpad(String(s), pad) - # VLEN objects struct VLen{T} - data::Array + data::Array end VLen(strs::Array{S}) where {S<:String} = VLen{chartype(S)}(strs) VLen(A::Array{Array{T}}) where {T<:ScalarType} = VLen{T}(A) VLen(A::Array{Array{T,N}}) where {T<:ScalarType,N} = VLen{T}(A) function Base.cconvert(::Type{Ptr{Cvoid}}, v::VLen) - len = length(v.data) - h = Vector{API.hvl_t}(undef, len) - for ii in 1:len - d = v.data[ii] - p = unsafe_convert(Ptr{UInt8}, d) - h[ii] = API.hvl_t(length(d), p) - end - return h + len = length(v.data) + h = Vector{API.hvl_t}(undef, len) + for ii in 1:len + d = v.data[ii] + p = unsafe_convert(Ptr{UInt8}, d) + h[ii] = API.hvl_t(length(d), p) + end + return h end datatype(A::VLen{T}) where {T<:ScalarType} = Datatype(API.h5t_vlen_create(hdf5_type_id(T))) @@ -64,8 +62,8 @@ end # Opaque types struct Opaque - data - tag::String + data + tag::String end # An empty array type @@ -110,24 +108,23 @@ struct VariableArray{T} len::Csize_t p::Ptr{Cvoid} end -Base.eltype(::Type{VariableArray{T}}) where T = T +Base.eltype(::Type{VariableArray{T}}) where {T} = T ## Conversion between Julia types and HDF5 atomic types -hdf5_type_id(::Type{Bool}) = API.H5T_NATIVE_B8 -hdf5_type_id(::Type{Int8}) = API.H5T_NATIVE_INT8 -hdf5_type_id(::Type{UInt8}) = API.H5T_NATIVE_UINT8 -hdf5_type_id(::Type{Int16}) = API.H5T_NATIVE_INT16 -hdf5_type_id(::Type{UInt16}) = API.H5T_NATIVE_UINT16 -hdf5_type_id(::Type{Int32}) = API.H5T_NATIVE_INT32 -hdf5_type_id(::Type{UInt32}) = API.H5T_NATIVE_UINT32 -hdf5_type_id(::Type{Int64}) = API.H5T_NATIVE_INT64 -hdf5_type_id(::Type{UInt64}) = API.H5T_NATIVE_UINT64 -hdf5_type_id(::Type{Float32}) = API.H5T_NATIVE_FLOAT -hdf5_type_id(::Type{Float64}) = API.H5T_NATIVE_DOUBLE +hdf5_type_id(::Type{Bool}) = API.H5T_NATIVE_B8 +hdf5_type_id(::Type{Int8}) = API.H5T_NATIVE_INT8 +hdf5_type_id(::Type{UInt8}) = API.H5T_NATIVE_UINT8 +hdf5_type_id(::Type{Int16}) = API.H5T_NATIVE_INT16 +hdf5_type_id(::Type{UInt16}) = API.H5T_NATIVE_UINT16 +hdf5_type_id(::Type{Int32}) = API.H5T_NATIVE_INT32 +hdf5_type_id(::Type{UInt32}) = API.H5T_NATIVE_UINT32 +hdf5_type_id(::Type{Int64}) = API.H5T_NATIVE_INT64 +hdf5_type_id(::Type{UInt64}) = API.H5T_NATIVE_UINT64 +hdf5_type_id(::Type{Float32}) = API.H5T_NATIVE_FLOAT +hdf5_type_id(::Type{Float64}) = API.H5T_NATIVE_DOUBLE hdf5_type_id(::Type{Reference}) = API.H5T_STD_REF_OBJ hdf5_type_id(::Type{<:AbstractString}) = API.H5T_C_S1 - # It's not safe to use particular id codes because these can change, so we use characteristics of the type. function _hdf5_type_map(class_id, is_signed, native_size) if class_id == API.H5T_INTEGER @@ -156,18 +153,21 @@ const COMPLEX_SUPPORT = Ref(true) const COMPLEX_FIELD_NAMES = Ref(("r", "i")) enable_complex_support() = COMPLEX_SUPPORT[] = true disable_complex_support() = COMPLEX_SUPPORT[] = false -set_complex_field_names(real::AbstractString, imag::AbstractString) = COMPLEX_FIELD_NAMES[] = ((real, imag)) +function set_complex_field_names(real::AbstractString, imag::AbstractString) + COMPLEX_FIELD_NAMES[] = ((real, imag)) +end # Create a datatype from in-memory types datatype(x::ScalarType) = Datatype(hdf5_type_id(typeof(x)), false) datatype(::Type{T}) where {T<:ScalarType} = Datatype(hdf5_type_id(T), false) datatype(A::AbstractArray{T}) where {T<:ScalarType} = Datatype(hdf5_type_id(T), false) function datatype(::Type{Complex{T}}) where {T<:ScalarType} - COMPLEX_SUPPORT[] || error("complex support disabled. call HDF5.enable_complex_support() to enable") - dtype = API.h5t_create(API.H5T_COMPOUND, 2*sizeof(T)) - API.h5t_insert(dtype, COMPLEX_FIELD_NAMES[][1], 0, hdf5_type_id(T)) - API.h5t_insert(dtype, COMPLEX_FIELD_NAMES[][2], sizeof(T), hdf5_type_id(T)) - return Datatype(dtype) + COMPLEX_SUPPORT[] || + error("complex support disabled. call HDF5.enable_complex_support() to enable") + dtype = API.h5t_create(API.H5T_COMPOUND, 2 * sizeof(T)) + API.h5t_insert(dtype, COMPLEX_FIELD_NAMES[][1], 0, hdf5_type_id(T)) + API.h5t_insert(dtype, COMPLEX_FIELD_NAMES[][2], sizeof(T), hdf5_type_id(T)) + return Datatype(dtype) end datatype(x::Complex{<:ScalarType}) = datatype(typeof(x)) datatype(A::AbstractArray{Complex{T}}) where {T<:ScalarType} = datatype(eltype(A)) @@ -185,183 +185,199 @@ function datatype(::Array{S}) where {S<:AbstractString} Datatype(type_id) end - # conversions to Julia types function get_jl_type(obj_type::Datatype) - class_id = API.h5t_get_class(obj_type) - if class_id == API.H5T_OPAQUE - return Opaque - else - return get_mem_compatible_jl_type(obj_type) - end + class_id = API.h5t_get_class(obj_type) + if class_id == API.H5T_OPAQUE + return Opaque + else + return get_mem_compatible_jl_type(obj_type) + end end function get_jl_type(obj) - dtype = datatype(obj) - try - return get_jl_type(dtype) - finally - close(dtype) - end + dtype = datatype(obj) + try + return get_jl_type(dtype) + finally + close(dtype) + end end Base.eltype(dset::Union{Dataset,Attribute}) = get_jl_type(dset) function get_mem_compatible_jl_type(obj_type::Datatype) - class_id = API.h5t_get_class(obj_type) - if class_id == API.H5T_STRING - if API.h5t_is_variable_str(obj_type) - return Cstring - else - N = sizeof(obj_type) - PAD = API.h5t_get_strpad(obj_type) - return FixedString{N,PAD} - end - elseif class_id == API.H5T_INTEGER || class_id == API.H5T_FLOAT - native_type = API.h5t_get_native_type(obj_type) - try - native_size = API.h5t_get_size(native_type) - if class_id == API.H5T_INTEGER - is_signed = API.h5t_get_sign(native_type) - else - is_signed = nothing - end - return _hdf5_type_map(class_id, is_signed, native_size) - finally - API.h5t_close(native_type) - end - elseif class_id == API.H5T_BITFIELD - return Bool - elseif class_id == API.H5T_ENUM - super_type = API.h5t_get_super(obj_type) - try - native_type = API.h5t_get_native_type(super_type) - try - native_size = API.h5t_get_size(native_type) - is_signed = API.h5t_get_sign(native_type) - return _hdf5_type_map(API.H5T_INTEGER, is_signed, native_size) - finally - API.h5t_close(native_type) - end - finally - API.h5t_close(super_type) - end - elseif class_id == API.H5T_REFERENCE - # TODO update to use version 1.12 reference functions/types - return Reference - elseif class_id == API.H5T_OPAQUE - # TODO: opaque objects should get their own fixed-size data type; punning like - # this permits recursively reading (i.e. compound data type containing an - # opaque field). Requires figuring out what to do about the tag... - len = Int(API.h5t_get_size(obj_type)) - return FixedArray{UInt8, (len,), len} - elseif class_id == API.H5T_VLEN - superid = API.h5t_get_super(obj_type) - return VariableArray{get_mem_compatible_jl_type(Datatype(superid))} - elseif class_id == API.H5T_COMPOUND - N = API.h5t_get_nmembers(obj_type) - - membernames = ntuple(N) do i - API.h5t_get_member_name(obj_type, i-1) - end + class_id = API.h5t_get_class(obj_type) + if class_id == API.H5T_STRING + if API.h5t_is_variable_str(obj_type) + return Cstring + else + N = sizeof(obj_type) + PAD = API.h5t_get_strpad(obj_type) + return FixedString{N,PAD} + end + elseif class_id == API.H5T_INTEGER || class_id == API.H5T_FLOAT + native_type = API.h5t_get_native_type(obj_type) + try + native_size = API.h5t_get_size(native_type) + if class_id == API.H5T_INTEGER + is_signed = API.h5t_get_sign(native_type) + else + is_signed = nothing + end + return _hdf5_type_map(class_id, is_signed, native_size) + finally + API.h5t_close(native_type) + end + elseif class_id == API.H5T_BITFIELD + return Bool + elseif class_id == API.H5T_ENUM + super_type = API.h5t_get_super(obj_type) + try + native_type = API.h5t_get_native_type(super_type) + try + native_size = API.h5t_get_size(native_type) + is_signed = API.h5t_get_sign(native_type) + return _hdf5_type_map(API.H5T_INTEGER, is_signed, native_size) + finally + API.h5t_close(native_type) + end + finally + API.h5t_close(super_type) + end + elseif class_id == API.H5T_REFERENCE + # TODO update to use version 1.12 reference functions/types + return Reference + elseif class_id == API.H5T_OPAQUE + # TODO: opaque objects should get their own fixed-size data type; punning like + # this permits recursively reading (i.e. compound data type containing an + # opaque field). Requires figuring out what to do about the tag... + len = Int(API.h5t_get_size(obj_type)) + return FixedArray{UInt8,(len,),len} + elseif class_id == API.H5T_VLEN + superid = API.h5t_get_super(obj_type) + return VariableArray{get_mem_compatible_jl_type(Datatype(superid))} + elseif class_id == API.H5T_COMPOUND + N = API.h5t_get_nmembers(obj_type) + + membernames = ntuple(N) do i + API.h5t_get_member_name(obj_type, i - 1) + end - membertypes = ntuple(N) do i - dtype = Datatype(API.h5t_get_member_type(obj_type, i-1)) - return get_mem_compatible_jl_type(dtype) - end + membertypes = ntuple(N) do i + dtype = Datatype(API.h5t_get_member_type(obj_type, i - 1)) + return get_mem_compatible_jl_type(dtype) + end - # check if should be interpreted as complex - iscomplex = COMPLEX_SUPPORT[] && - N == 2 && - (membernames == COMPLEX_FIELD_NAMES[]) && - (membertypes[1] == membertypes[2]) && - (membertypes[1] <: ScalarType) + # check if should be interpreted as complex + iscomplex = COMPLEX_SUPPORT[] && + N == 2 && + (membernames == COMPLEX_FIELD_NAMES[]) && + (membertypes[1] == membertypes[2]) && + (membertypes[1] <: ScalarType) - if iscomplex - return Complex{membertypes[1]} - else - return NamedTuple{Symbol.(membernames), Tuple{membertypes...}} - end - elseif class_id == API.H5T_ARRAY - dims = API.h5t_get_array_dims(obj_type) - nd = length(dims) - eltyp = Datatype(API.h5t_get_super(obj_type)) - elT = get_mem_compatible_jl_type(eltyp) - dimsizes = ntuple(i -> Int(dims[nd-i+1]), nd) # reverse order - return FixedArray{elT, dimsizes, prod(dimsizes)} - end - error("Class id ", class_id, " is not yet supported") + if iscomplex + return Complex{membertypes[1]} + else + return NamedTuple{Symbol.(membernames),Tuple{membertypes...}} + end + elseif class_id == API.H5T_ARRAY + dims = API.h5t_get_array_dims(obj_type) + nd = length(dims) + eltyp = Datatype(API.h5t_get_super(obj_type)) + elT = get_mem_compatible_jl_type(eltyp) + dimsizes = ntuple(i -> Int(dims[nd - i + 1]), nd) # reverse order + return FixedArray{elT,dimsizes,prod(dimsizes)} + end + error("Class id ", class_id, " is not yet supported") end # convert special types to native julia types function normalize_types(::Type{T}, buf::AbstractMatrix{UInt8}) where {T} - # First dimension spans bytes of a single element of type T --- (recursively) normalize - # each range of bytes to final type, returning vector of normalized data. - return [_normalize_types(T, view(buf, :, ind)) for ind in axes(buf, 2)] + # First dimension spans bytes of a single element of type T --- (recursively) normalize + # each range of bytes to final type, returning vector of normalized data. + return [_normalize_types(T, view(buf, :, ind)) for ind in axes(buf, 2)] end # high-level description which should always work --- here, the buffer contains the bytes # for exactly 1 element of an object of type T, so reinterpret the `UInt8` vector as a # length-1 array of type `T` and extract the (only) element. function _typed_load(::Type{T}, buf::AbstractVector{UInt8}) where {T} - return @inbounds reinterpret(T, buf)[1] + return @inbounds reinterpret(T, buf)[1] end # fast-path for common concrete types with simple layout (which should be nearly all cases) -function _typed_load(::Type{T}, buf::V) where {T, V <: Union{Vector{UInt8}, Base.FastContiguousSubArray{UInt8,1}}} - dest = Ref{T}() - GC.@preserve dest buf Base._memcpy!(unsafe_convert(Ptr{Cvoid}, dest), pointer(buf), sizeof(T)) - return dest[] - # TODO: The above can maybe be replaced with - # return GC.@preserve buf unsafe_load(convert(Ptr{t}, pointer(buf))) - # dependent on data elements being properly aligned for all datatypes, on all - # platforms. +function _typed_load(::Type{T}, + buf::V) where {T, + V<:Union{Vector{UInt8}, + Base.FastContiguousSubArray{UInt8,1}}} + dest = Ref{T}() + GC.@preserve dest buf Base._memcpy!(unsafe_convert(Ptr{Cvoid}, dest), pointer(buf), + sizeof(T)) + return dest[] + # TODO: The above can maybe be replaced with + # return GC.@preserve buf unsafe_load(convert(Ptr{t}, pointer(buf))) + # dependent on data elements being properly aligned for all datatypes, on all + # platforms. end _normalize_types(::Type{T}, buf::AbstractVector{UInt8}) where {T} = _typed_load(T, buf) -function _normalize_types(::Type{T}, buf::AbstractVector{UInt8}) where {K, T <: NamedTuple{K}} - # Compound data types do not necessarily have members of uniform size, so instead of - # dim-1 => bytes of single element and dim-2 => over elements, just loop over exact - # byte ranges within the provided buffer vector. - nv = ntuple(length(K)) do ii - elT = fieldtype(T, ii) - off = fieldoffset(T, ii) % Int - sub = view(buf, off .+ (1:sizeof(elT))) - return _normalize_types(elT, sub) - end - return NamedTuple{K}(nv) +function _normalize_types(::Type{T}, buf::AbstractVector{UInt8}) where {K,T<:NamedTuple{K}} + # Compound data types do not necessarily have members of uniform size, so instead of + # dim-1 => bytes of single element and dim-2 => over elements, just loop over exact + # byte ranges within the provided buffer vector. + nv = ntuple(length(K)) do ii + elT = fieldtype(T, ii) + off = fieldoffset(T, ii) % Int + sub = view(buf, off .+ (1:sizeof(elT))) + return _normalize_types(elT, sub) + end + return NamedTuple{K}(nv) +end +function _normalize_types(::Type{V}, + buf::AbstractVector{UInt8}) where {T,V<:VariableArray{T}} + va = _typed_load(V, buf) + pbuf = unsafe_wrap(Array, convert(Ptr{UInt8}, va.p), (sizeof(T), Int(va.len))) + if do_normalize(T) + # If `T` a non-trivial type, recursively normalize the vlen buffer. + return normalize_types(T, pbuf) + else + # Otherwise if `T` is simple type, directly reinterpret the vlen buffer. + # (copy since libhdf5 will reclaim `pbuf = va.p` in `API.h5d_vlen_reclaim`) + return copy(vec(reinterpret(T, pbuf))) + end +end +function _normalize_types(::Type{F}, buf::AbstractVector{UInt8}) where {T,F<:FixedArray{T}} + if do_normalize(T) + # If `T` a non-trivial type, recursively normalize the buffer after reshaping to + # matrix with dim-1 => bytes of single element and dim-2 => over elements. + return reshape(normalize_types(T, reshape(buf, sizeof(T), :)), size(F)...) + else + # Otherwise, if `T` is simple type, directly reinterpret the array and reshape to + # final dimensions. The copy ensures (a) the returned array is independent of + # [potentially much larger] read() buffer, and (b) that the returned data is an + # Array and not ReshapedArray of ReinterpretArray of SubArray of ... + return copy(reshape(reinterpret(T, buf), size(F)...)) + end end -function _normalize_types(::Type{V}, buf::AbstractVector{UInt8}) where {T, V <: VariableArray{T}} - va = _typed_load(V, buf) - pbuf = unsafe_wrap(Array, convert(Ptr{UInt8}, va.p), (sizeof(T), Int(va.len))) - if do_normalize(T) - # If `T` a non-trivial type, recursively normalize the vlen buffer. - return normalize_types(T, pbuf) - else - # Otherwise if `T` is simple type, directly reinterpret the vlen buffer. - # (copy since libhdf5 will reclaim `pbuf = va.p` in `API.h5d_vlen_reclaim`) - return copy(vec(reinterpret(T, pbuf))) - end +function _normalize_types(::Type{Cstring}, buf::AbstractVector{UInt8}) + unsafe_string(_typed_load(Ptr{UInt8}, buf)) end -function _normalize_types(::Type{F}, buf::AbstractVector{UInt8}) where {T, F <: FixedArray{T}} - if do_normalize(T) - # If `T` a non-trivial type, recursively normalize the buffer after reshaping to - # matrix with dim-1 => bytes of single element and dim-2 => over elements. - return reshape(normalize_types(T, reshape(buf, sizeof(T), :)), size(F)...) - else - # Otherwise, if `T` is simple type, directly reinterpret the array and reshape to - # final dimensions. The copy ensures (a) the returned array is independent of - # [potentially much larger] read() buffer, and (b) that the returned data is an - # Array and not ReshapedArray of ReinterpretArray of SubArray of ... - return copy(reshape(reinterpret(T, buf), size(F)...)) - end +function _normalize_types(::Type{T}, buf::AbstractVector{UInt8}) where {T<:FixedString} + unpad(String(buf), pad(T)) end -_normalize_types(::Type{Cstring}, buf::AbstractVector{UInt8}) = unsafe_string(_typed_load(Ptr{UInt8}, buf)) -_normalize_types(::Type{T}, buf::AbstractVector{UInt8}) where {T <: FixedString} = unpad(String(buf), pad(T)) do_normalize(::Type{T}) where {T} = false -do_normalize(::Type{NamedTuple{T,U}}) where {U,T} = any(i -> do_normalize(fieldtype(U,i)), 1:fieldcount(U)) -do_normalize(::Type{T}) where {T <: Union{Cstring,FixedString,FixedArray,VariableArray}} = true +function do_normalize(::Type{NamedTuple{T,U}}) where {U,T} + any(i -> do_normalize(fieldtype(U, i)), 1:fieldcount(U)) +end +function do_normalize(::Type{T}) where { + T<:Union{Cstring,FixedString,FixedArray, + VariableArray}} + true +end do_reclaim(::Type{T}) where {T} = false -do_reclaim(::Type{NamedTuple{T,U}}) where {U,T} = any(i -> do_reclaim(fieldtype(U,i)), 1:fieldcount(U)) -do_reclaim(::Type{T}) where T <: Union{Cstring,VariableArray} = true +function do_reclaim(::Type{NamedTuple{T,U}}) where {U,T} + any(i -> do_reclaim(fieldtype(U, i)), 1:fieldcount(U)) +end +do_reclaim(::Type{T}) where {T<:Union{Cstring,VariableArray}} = true diff --git a/src/types.jl b/src/types.jl index 735d479fb..6c4c8b40e 100644 --- a/src/types.jl +++ b/src/types.jl @@ -13,14 +13,13 @@ end # Read every variable in the file function Base.read(f::H5DataStore) vars = keys(f) - vals = Vector{Any}(undef,length(vars)) - for i = 1:length(vars) + vals = Vector{Any}(undef, length(vars)) + for i in 1:length(vars) vals[i] = read(f, vars[i]) end Dict(zip(vars, vals)) end - ### Base HDF5 structs ### ## HDF5 uses a plain integer to refer to each file, group, or @@ -39,7 +38,7 @@ mutable struct File <: H5DataStore id::API.hid_t filename::String - function File(id, filename, toclose::Bool=true) + function File(id, filename, toclose::Bool = true) f = new(id, filename) if toclose finalizer(close, f) @@ -82,14 +81,14 @@ mutable struct Datatype toclose::Bool file::File - function Datatype(id, toclose::Bool=true) + function Datatype(id, toclose::Bool = true) nt = new(id, toclose) if toclose finalizer(close, nt) end nt end - function Datatype(id, file::File, toclose::Bool=true) + function Datatype(id, file::File, toclose::Bool = true) nt = new(id, toclose, file) if toclose finalizer(close, nt) @@ -129,24 +128,30 @@ Base.unsafe_convert(::Type{API.hid_t}, attr::Attribute) = attr.id # High-level reference handler struct Reference - r::API.hobj_ref_t + r::API.hobj_ref_t +end +function Base.cconvert(::Type{Ptr{T}}, + ref::Reference) where {T<:Union{Reference,API.hobj_ref_t,Cvoid}} + Ref(ref) end -Base.cconvert(::Type{Ptr{T}}, ref::Reference) where {T<:Union{Reference,API.hobj_ref_t,Cvoid}} = Ref(ref) -const BitsType = Union{Bool,Int8,UInt8,Int16,UInt16,Int32,UInt32,Int64,UInt64,Float32,Float64} +const BitsType = Union{Bool,Int8,UInt8,Int16,UInt16,Int32,UInt32,Int64,UInt64,Float32, + Float64} const ScalarType = Union{BitsType,Reference} # Define an H5O Object type const Object = Union{Group,Dataset,Datatype} -idx_type(obj::File) = +function idx_type(obj::File) get_context_property(:file_create).track_order || - get_create_properties(obj).track_order ? + get_create_properties(obj).track_order ? API.H5_INDEX_CRT_ORDER : API.H5_INDEX_NAME -idx_type(obj::Group) = +end +function idx_type(obj::Group) get_context_property(:group_create).track_order || - get_create_properties(obj).track_order ? + get_create_properties(obj).track_order ? API.H5_INDEX_CRT_ORDER : API.H5_INDEX_NAME +end idx_type(obj) = API.H5_INDEX_NAME # TODO: implement alternative iteration order ? diff --git a/test/api.jl b/test/api.jl index 81ae20d59..8822437d3 100644 --- a/test/api.jl +++ b/test/api.jl @@ -9,7 +9,8 @@ using HDF5, Test # iterate over attributes names = String[] - @test HDF5.API.h5a_iterate(f, HDF5.API.H5_INDEX_NAME, HDF5.API.H5_ITER_INC) do loc, name, info + @test HDF5.API.h5a_iterate(f, HDF5.API.H5_INDEX_NAME, + HDF5.API.H5_ITER_INC) do loc, name, info push!(names, unsafe_string(name)) return false end == 2 @@ -17,7 +18,8 @@ using HDF5, Test # iterate over attributes in reverse names = String[] - @test HDF5.API.h5a_iterate(f, HDF5.API.H5_INDEX_NAME, HDF5.API.H5_ITER_DEC) do loc, name, info + @test HDF5.API.h5a_iterate(f, HDF5.API.H5_INDEX_NAME, + HDF5.API.H5_ITER_DEC) do loc, name, info push!(names, unsafe_string(name)) return false end == 2 @@ -25,26 +27,29 @@ using HDF5, Test # only iterate once names = String[] - @test HDF5.API.h5a_iterate(f, HDF5.API.H5_INDEX_NAME, HDF5.API.H5_ITER_INC) do loc, name, info + @test HDF5.API.h5a_iterate(f, HDF5.API.H5_INDEX_NAME, + HDF5.API.H5_ITER_INC) do loc, name, info push!(names, unsafe_string(name)) return true end == 1 @test names == ["a"] # HDF5 error - @test_throws HDF5.API.H5Error HDF5.API.h5a_iterate(f, HDF5.API.H5_INDEX_NAME, HDF5.API.H5_ITER_INC) do loc, name, info - return -1 + @test_throws HDF5.API.H5Error HDF5.API.h5a_iterate(f, HDF5.API.H5_INDEX_NAME, + HDF5.API.H5_ITER_INC) do loc, name, + info + return -1 end # Julia error - @test_throws AssertionError HDF5.API.h5a_iterate(f, HDF5.API.H5_INDEX_NAME, HDF5.API.H5_ITER_INC) do loc, name, info - @assert false + @test_throws AssertionError HDF5.API.h5a_iterate(f, HDF5.API.H5_INDEX_NAME, + HDF5.API.H5_ITER_INC) do loc, name, + info + @assert false end - end @testset "h5l_iterate" begin - filename = tempname() f = h5open(filename, "w") @@ -53,7 +58,8 @@ end # iterate over groups names = String[] - @test HDF5.API.h5l_iterate(f, HDF5.API.H5_INDEX_NAME, HDF5.API.H5_ITER_INC) do loc, name, info + @test HDF5.API.h5l_iterate(f, HDF5.API.H5_INDEX_NAME, + HDF5.API.H5_ITER_INC) do loc, name, info push!(names, unsafe_string(name)) return false end == 2 @@ -61,7 +67,8 @@ end # iterate over attributes in reverse names = String[] - @test HDF5.API.h5l_iterate(f, HDF5.API.H5_INDEX_NAME, HDF5.API.H5_ITER_DEC) do loc, name, info + @test HDF5.API.h5l_iterate(f, HDF5.API.H5_INDEX_NAME, + HDF5.API.H5_ITER_DEC) do loc, name, info push!(names, unsafe_string(name)) return false end == 2 @@ -69,20 +76,24 @@ end # only iterate once names = String[] - @test HDF5.API.h5l_iterate(f, HDF5.API.H5_INDEX_NAME, HDF5.API.H5_ITER_INC) do loc, name, info + @test HDF5.API.h5l_iterate(f, HDF5.API.H5_INDEX_NAME, + HDF5.API.H5_ITER_INC) do loc, name, info push!(names, unsafe_string(name)) return true end == 1 @test names == ["a"] # HDF5 error - @test_throws HDF5.API.H5Error HDF5.API.h5l_iterate(f, HDF5.API.H5_INDEX_NAME, HDF5.API.H5_ITER_INC) do loc, name, info + @test_throws HDF5.API.H5Error HDF5.API.h5l_iterate(f, HDF5.API.H5_INDEX_NAME, + HDF5.API.H5_ITER_INC) do loc, name, + info return -1 end # Julia error - @test_throws AssertionError HDF5.API.h5l_iterate(f, HDF5.API.H5_INDEX_NAME, HDF5.API.H5_ITER_INC) do loc, name, info + @test_throws AssertionError HDF5.API.h5l_iterate(f, HDF5.API.H5_INDEX_NAME, + HDF5.API.H5_ITER_INC) do loc, name, + info @assert false end - -end \ No newline at end of file +end diff --git a/test/attributes.jl b/test/attributes.jl index 5678c690c..41f0dd06d 100644 --- a/test/attributes.jl +++ b/test/attributes.jl @@ -1,15 +1,14 @@ using HDF5, Test -function test_attrs(o::Union{HDF5.File, HDF5.Object}) - +function test_attrs(o::Union{HDF5.File,HDF5.Object}) @test attrs(o) isa HDF5.AttributeDict attrs(o)["a"] = 1 @test haskey(attrs(o), "a") @test attrs(o)["a"] == 1 - attrs(o)["b"] = [2,3] - @test attrs(o)["b"] == [2,3] + attrs(o)["b"] = [2, 3] + @test attrs(o)["b"] == [2, 3] @test haskey(attrs(o), "a") @test length(attrs(o)) == 2 @test sort(keys(attrs(o))) == ["a", "b"] @@ -24,8 +23,8 @@ function test_attrs(o::Union{HDF5.File, HDF5.Object}) @test sort(keys(attrs(o))) == ["a", "b"] # overwrite: different size - attrs(o)["b"] = [4,5,6] - @test attrs(o)["b"] == [4,5,6] + attrs(o)["b"] = [4, 5, 6] + @test attrs(o)["b"] == [4, 5, 6] @test length(attrs(o)) == 2 @test sort(keys(attrs(o))) == ["a", "b"] @@ -43,10 +42,8 @@ function test_attrs(o::Union{HDF5.File, HDF5.Object}) @test_throws KeyError attrs(o)["a"] @test isnothing(get(attrs(o), "a", nothing)) - end - @testset "attrs interface" begin filename = tempname() f = h5open(filename, "w") @@ -65,10 +62,9 @@ end # Test attrs on a HDF5.Datatype t = commit_datatype(g, "datatype_int16", - HDF5.Datatype(HDF5.API.h5t_copy(HDF5.API.H5T_NATIVE_INT16)) - ) + HDF5.Datatype(HDF5.API.h5t_copy(HDF5.API.H5T_NATIVE_INT16))) test_attrs(t) finally close(f) end -end \ No newline at end of file +end diff --git a/test/chunkstorage.jl b/test/chunkstorage.jl index 1a4985a1f..0c41230b0 100644 --- a/test/chunkstorage.jl +++ b/test/chunkstorage.jl @@ -2,168 +2,169 @@ using HDF5 using Test @testset "Raw Chunk I/O" begin + fn = tempname() -fn = tempname() - -# Direct chunk write is no longer dependent on HL library -# Test direct chunk writing Cartesian index -h5open(fn, "w") do f - d = create_dataset(f, "dataset", datatype(Int), dataspace(4, 4), chunk=(2, 2)) - HDF5.API.h5d_extend(d, HDF5.API.hsize_t[3,3]) # should do nothing (deprecated call) - HDF5.API.h5d_extend(d, HDF5.API.hsize_t[4,4]) # should do nothing (deprecated call) - raw = HDF5.ChunkStorage(d) - raw[1,1] = 0, collect(reinterpret(UInt8, [1,2,5,6])) - raw[3,1] = 0, collect(reinterpret(UInt8, [3,4,7,8])) - raw[1,3] = 0, collect(reinterpret(UInt8, [9,10,13,14])) - raw[3,3] = 0, collect(reinterpret(UInt8, [11,12,15,16])) -end - -# Test read back -@test h5open(fn, "r") do f - vec(f["dataset"][:,:]) -end == collect(1:16) - -# Test reading direct chunks via linear indexing -h5open(fn, "r") do f - d = f["dataset"] - raw = HDF5.ChunkStorage{IndexLinear}(d) - @test size(raw) == (4,) - @test length(raw) == 4 - @test axes(raw) == (Base.OneTo(4),) - @test prod(HDF5.get_num_chunks_per_dim(d)) == HDF5.get_num_chunks(d) - if v"1.10.5" โ‰ค HDF5.API._libhdf5_build_ver - @test HDF5.get_chunk_length(d) == HDF5.API.h5d_get_chunk_info(d,1)[:size] - end - @test reinterpret(Int, raw[1][2]) == [1,2,5,6] - @test reinterpret(Int, raw[2][2]) == [3,4,7,8] - @test reinterpret(Int, raw[3][2]) == [9,10,13,14] - @test reinterpret(Int, raw[4][2]) == [11,12,15,16] - # Test 0-based indexed API - @test HDF5.get_chunk_offset(d, 0) == (0, 0) - @test HDF5.get_chunk_offset(d, 1) == (2, 0) - @test HDF5.get_chunk_offset(d, 2) == (0, 2) - @test HDF5.get_chunk_offset(d, 3) == (2, 2) - # Test reverse look up of index from coords - @test HDF5.get_chunk_index(d, (0, 0)) == 0 - @test HDF5.get_chunk_index(d, (2, 0)) == 1 - @test HDF5.get_chunk_index(d, (0, 2)) == 2 - @test HDF5.get_chunk_index(d, (2, 2)) == 3 - # Test internal coordinates - @test HDF5.get_chunk_index(d, (1, 1)) == 0 - @test HDF5.get_chunk_index(d, (3, 1)) == 1 - @test HDF5.get_chunk_index(d, (1, 3)) == 2 - @test HDF5.get_chunk_index(d, (3, 3)) == 3 -end - -# Test direct write chunk writing via linear indexing -h5open(fn, "w") do f - d = create_dataset(f, "dataset", datatype(Int64), dataspace(4, 6), chunk=(2, 3)) - raw = HDF5.ChunkStorage{IndexLinear}(d) - raw[1] = 0, collect(reinterpret(UInt8, Int64[1,2,5,6, 9,10])) - raw[2] = 0, collect(reinterpret(UInt8, Int64[3,4,7,8,11,12])) - raw[3] = 0, collect(reinterpret(UInt8, Int64[13,14,17,18,21,22])) - raw[4] = 0, collect(reinterpret(UInt8, Int64[15,16,19,20,23,24])) -end - -@test h5open(fn, "r") do f - f["dataset"][:,:] -end == reshape(1:24, 4, 6) - -h5open(fn, "r") do f - d = f["dataset"] - raw = HDF5.ChunkStorage(d) - chunk = HDF5.get_chunk(d) - extent = HDF5.get_extent_dims(d)[1] - - @test chunk == (2, 3) - @test extent == (4, 6) - @test size(raw) == (2, 2) - @test length(raw) == 4 - @test axes(raw) == (1:2:4, 1:3:6) - @test prod(HDF5.get_num_chunks_per_dim(d)) == HDF5.get_num_chunks(d) - - # Test 0-based indexed API - @test HDF5.get_chunk_offset(d, 0) == (0, 0) - @test HDF5.get_chunk_offset(d, 1) == (2, 0) - @test HDF5.get_chunk_offset(d, 2) == (0, 3) - @test HDF5.get_chunk_offset(d, 3) == (2, 3) - # Test reverse look up of index from coords - @test HDF5.get_chunk_index(d, (0, 0)) == 0 - @test HDF5.get_chunk_index(d, (2, 0)) == 1 - @test HDF5.get_chunk_index(d, (0, 3)) == 2 - @test HDF5.get_chunk_index(d, (2, 3)) == 3 - # Test internal coordinates - @test HDF5.get_chunk_index(d, (1, 1)) == 0 - @test HDF5.get_chunk_index(d, (3, 1)) == 1 - @test HDF5.get_chunk_index(d, (1, 4)) == 2 - @test HDF5.get_chunk_index(d, (3, 4)) == 3 - - if v"1.10.5" โ‰ค HDF5.API._libhdf5_build_ver - chunk_length = HDF5.get_chunk_length(d) - origin = HDF5.API.h5d_get_chunk_info(d, 0) - @test chunk_length == origin[:size] - chunk_info = HDF5.API.h5d_get_chunk_info_by_coord(d, HDF5.API.hsize_t[0, 1]) - @test chunk_info[:filter_mask] == 0 - @test chunk_info[:size] == chunk_length - - # Test HDF5.get_chunk_offset equivalence to h5d_get_chunk_info information - @test all(reverse(HDF5.API.h5d_get_chunk_info(d, 3)[:offset]) .== HDF5.get_chunk_offset(d, 3)) - - # Test HDF5.get_chunk_index equivalence to h5d_get_chunk_info_by_coord information - offset = HDF5.API.hsize_t[2,3] - chunk_info = HDF5.API.h5d_get_chunk_info_by_coord(d, reverse(offset)) - @test HDF5.get_chunk_index(d, offset) == (chunk_info[:addr] - origin[:addr]) รท chunk_info[:size] - - @test HDF5.API.h5d_get_chunk_storage_size(d, HDF5.API.hsize_t[0, 1]) == chunk_length - @test HDF5.API.h5d_get_storage_size(d) == sizeof(Int64)*24 - @test HDF5.API.h5d_get_space_status(d) == HDF5.API.H5D_SPACE_STATUS_ALLOCATED + # Direct chunk write is no longer dependent on HL library + # Test direct chunk writing Cartesian index + h5open(fn, "w") do f + d = create_dataset(f, "dataset", datatype(Int), dataspace(4, 4); chunk = (2, 2)) + HDF5.API.h5d_extend(d, HDF5.API.hsize_t[3, 3]) # should do nothing (deprecated call) + HDF5.API.h5d_extend(d, HDF5.API.hsize_t[4, 4]) # should do nothing (deprecated call) + raw = HDF5.ChunkStorage(d) + raw[1, 1] = 0, collect(reinterpret(UInt8, [1, 2, 5, 6])) + raw[3, 1] = 0, collect(reinterpret(UInt8, [3, 4, 7, 8])) + raw[1, 3] = 0, collect(reinterpret(UInt8, [9, 10, 13, 14])) + raw[3, 3] = 0, collect(reinterpret(UInt8, [11, 12, 15, 16])) end - # Manually reconstruct matrix - A = Matrix{Int}(undef, extent) - for (r,c) in Iterators.product(axes(raw)...) - A[r:r+chunk[1]-1, c:c+chunk[2]-1] .= reshape( reinterpret(Int64, raw[r,c][2]), chunk) + # Test read back + @test h5open(fn, "r") do f + vec(f["dataset"][:, :]) + end == collect(1:16) + + # Test reading direct chunks via linear indexing + h5open(fn, "r") do f + d = f["dataset"] + raw = HDF5.ChunkStorage{IndexLinear}(d) + @test size(raw) == (4,) + @test length(raw) == 4 + @test axes(raw) == (Base.OneTo(4),) + @test prod(HDF5.get_num_chunks_per_dim(d)) == HDF5.get_num_chunks(d) + if v"1.10.5" โ‰ค HDF5.API._libhdf5_build_ver + @test HDF5.get_chunk_length(d) == HDF5.API.h5d_get_chunk_info(d, 1)[:size] + end + @test reinterpret(Int, raw[1][2]) == [1, 2, 5, 6] + @test reinterpret(Int, raw[2][2]) == [3, 4, 7, 8] + @test reinterpret(Int, raw[3][2]) == [9, 10, 13, 14] + @test reinterpret(Int, raw[4][2]) == [11, 12, 15, 16] + # Test 0-based indexed API + @test HDF5.get_chunk_offset(d, 0) == (0, 0) + @test HDF5.get_chunk_offset(d, 1) == (2, 0) + @test HDF5.get_chunk_offset(d, 2) == (0, 2) + @test HDF5.get_chunk_offset(d, 3) == (2, 2) + # Test reverse look up of index from coords + @test HDF5.get_chunk_index(d, (0, 0)) == 0 + @test HDF5.get_chunk_index(d, (2, 0)) == 1 + @test HDF5.get_chunk_index(d, (0, 2)) == 2 + @test HDF5.get_chunk_index(d, (2, 2)) == 3 + # Test internal coordinates + @test HDF5.get_chunk_index(d, (1, 1)) == 0 + @test HDF5.get_chunk_index(d, (3, 1)) == 1 + @test HDF5.get_chunk_index(d, (1, 3)) == 2 + @test HDF5.get_chunk_index(d, (3, 3)) == 3 end - @test A == reshape(1:24, extent) -end + # Test direct write chunk writing via linear indexing + h5open(fn, "w") do f + d = create_dataset(f, "dataset", datatype(Int64), dataspace(4, 6); chunk = (2, 3)) + raw = HDF5.ChunkStorage{IndexLinear}(d) + raw[1] = 0, collect(reinterpret(UInt8, Int64[1, 2, 5, 6, 9, 10])) + raw[2] = 0, collect(reinterpret(UInt8, Int64[3, 4, 7, 8, 11, 12])) + raw[3] = 0, collect(reinterpret(UInt8, Int64[13, 14, 17, 18, 21, 22])) + raw[4] = 0, collect(reinterpret(UInt8, Int64[15, 16, 19, 20, 23, 24])) + end -@static if VERSION >= v"1.6" - # CartesianIndices does not accept StepRange + @test h5open(fn, "r") do f + f["dataset"][:, :] + end == reshape(1:24, 4, 6) - h5open(fn, "w") do f - d = create_dataset(f, "dataset", datatype(Int), dataspace(4, 6), chunk=(2, 3)) + h5open(fn, "r") do f + d = f["dataset"] raw = HDF5.ChunkStorage(d) - data = permutedims(reshape(1:24, 2, 2, 3, 2), (1,3,2,4)) - ci = CartesianIndices(raw) - for ind in eachindex(ci) - raw[ci[ind]] = data[:,:,ind] + chunk = HDF5.get_chunk(d) + extent = HDF5.get_extent_dims(d)[1] + + @test chunk == (2, 3) + @test extent == (4, 6) + @test size(raw) == (2, 2) + @test length(raw) == 4 + @test axes(raw) == (1:2:4, 1:3:6) + @test prod(HDF5.get_num_chunks_per_dim(d)) == HDF5.get_num_chunks(d) + + # Test 0-based indexed API + @test HDF5.get_chunk_offset(d, 0) == (0, 0) + @test HDF5.get_chunk_offset(d, 1) == (2, 0) + @test HDF5.get_chunk_offset(d, 2) == (0, 3) + @test HDF5.get_chunk_offset(d, 3) == (2, 3) + # Test reverse look up of index from coords + @test HDF5.get_chunk_index(d, (0, 0)) == 0 + @test HDF5.get_chunk_index(d, (2, 0)) == 1 + @test HDF5.get_chunk_index(d, (0, 3)) == 2 + @test HDF5.get_chunk_index(d, (2, 3)) == 3 + # Test internal coordinates + @test HDF5.get_chunk_index(d, (1, 1)) == 0 + @test HDF5.get_chunk_index(d, (3, 1)) == 1 + @test HDF5.get_chunk_index(d, (1, 4)) == 2 + @test HDF5.get_chunk_index(d, (3, 4)) == 3 + + if v"1.10.5" โ‰ค HDF5.API._libhdf5_build_ver + chunk_length = HDF5.get_chunk_length(d) + origin = HDF5.API.h5d_get_chunk_info(d, 0) + @test chunk_length == origin[:size] + chunk_info = HDF5.API.h5d_get_chunk_info_by_coord(d, HDF5.API.hsize_t[0, 1]) + @test chunk_info[:filter_mask] == 0 + @test chunk_info[:size] == chunk_length + + # Test HDF5.get_chunk_offset equivalence to h5d_get_chunk_info information + @test all(reverse(HDF5.API.h5d_get_chunk_info(d, 3)[:offset]) .== + HDF5.get_chunk_offset(d, 3)) + + # Test HDF5.get_chunk_index equivalence to h5d_get_chunk_info_by_coord information + offset = HDF5.API.hsize_t[2, 3] + chunk_info = HDF5.API.h5d_get_chunk_info_by_coord(d, reverse(offset)) + @test HDF5.get_chunk_index(d, offset) == + (chunk_info[:addr] - origin[:addr]) รท chunk_info[:size] + + @test HDF5.API.h5d_get_chunk_storage_size(d, HDF5.API.hsize_t[0, 1]) == + chunk_length + @test HDF5.API.h5d_get_storage_size(d) == sizeof(Int64) * 24 + @test HDF5.API.h5d_get_space_status(d) == HDF5.API.H5D_SPACE_STATUS_ALLOCATED end + + # Manually reconstruct matrix + A = Matrix{Int}(undef, extent) + for (r, c) in Iterators.product(axes(raw)...) + A[r:(r + chunk[1] - 1), c:(c + chunk[2] - 1)] .= reshape(reinterpret(Int64, + raw[r, c][2]), + chunk) + end + @test A == reshape(1:24, extent) end - @test h5open(fn, "r") do f - f["dataset"][:,:] - end == reshape(1:24, 4, 6) + @static if VERSION >= v"1.6" + # CartesianIndices does not accept StepRange + + h5open(fn, "w") do f + d = create_dataset(f, "dataset", datatype(Int), dataspace(4, 6); chunk = (2, 3)) + raw = HDF5.ChunkStorage(d) + data = permutedims(reshape(1:24, 2, 2, 3, 2), (1, 3, 2, 4)) + ci = CartesianIndices(raw) + for ind in eachindex(ci) + raw[ci[ind]] = data[:, :, ind] + end + end -end - -# Test direct write chunk writing via linear indexing, using views and without filter flag -h5open(fn, "w") do f - d = create_dataset(f, "dataset", datatype(Int), dataspace(4, 6), chunk=(2, 3)) - raw = HDF5.ChunkStorage{IndexLinear}(d) - data = permutedims(reshape(1:24, 2, 2, 3, 2), (1,3,2,4)) - chunks = Iterators.partition(data, 6) - i = 1 - for c in chunks - raw[i] = c - i += 1 + @test h5open(fn, "r") do f + f["dataset"][:, :] + end == reshape(1:24, 4, 6) end -end -@test h5open(fn, "r") do f - f["dataset"][:,:] -end == reshape(1:24, 4, 6) + # Test direct write chunk writing via linear indexing, using views and without filter flag + h5open(fn, "w") do f + d = create_dataset(f, "dataset", datatype(Int), dataspace(4, 6); chunk = (2, 3)) + raw = HDF5.ChunkStorage{IndexLinear}(d) + data = permutedims(reshape(1:24, 2, 2, 3, 2), (1, 3, 2, 4)) + chunks = Iterators.partition(data, 6) + i = 1 + for c in chunks + raw[i] = c + i += 1 + end + end -rm(fn) + @test h5open(fn, "r") do f + f["dataset"][:, :] + end == reshape(1:24, 4, 6) + rm(fn) end # testset "Raw Chunk I/O" diff --git a/test/compound.jl b/test/compound.jl index c7c10cb99..1932578f0 100644 --- a/test/compound.jl +++ b/test/compound.jl @@ -15,18 +15,17 @@ end struct foo_hdf5 a::Float64 b::Cstring - c::NTuple{20, UInt8} - d::NTuple{9, ComplexF64} + c::NTuple{20,UInt8} + d::NTuple{9,ComplexF64} e::HDF5.API.hvl_t end function unsafe_convert(::Type{foo_hdf5}, x::foo) foo_hdf5(x.a, - Base.unsafe_convert(Cstring, x.b), - ntuple(i -> i <= ncodeunits(x.c) ? codeunit(x.c, i) : '\0', 20), - ntuple(i -> x.d[i], length(x.d)), - HDF5.API.hvl_t(length(x.e), pointer(x.e)) - ) + Base.unsafe_convert(Cstring, x.b), + ntuple(i -> i <= ncodeunits(x.c) ? codeunit(x.c, i) : '\0', 20), + ntuple(i -> x.d[i], length(x.d)), + HDF5.API.hvl_t(length(x.e), pointer(x.e))) end function datatype(::Type{foo_hdf5}) @@ -44,7 +43,7 @@ function datatype(::Type{foo_hdf5}) HDF5.API.h5t_set_strpad(fixedstr_dtype, HDF5.API.H5T_STR_NULLPAD) HDF5.API.h5t_insert(dtype, "c", fieldoffset(foo_hdf5, 3), fixedstr_dtype) - hsz = HDF5.API.hsize_t[3,3] + hsz = HDF5.API.hsize_t[3, 3] array_dtype = HDF5.API.h5t_array_create(datatype(ComplexF64), 2, hsz) HDF5.API.h5t_insert(dtype, "d", fieldoffset(foo_hdf5, 4), array_dtype) @@ -59,7 +58,7 @@ struct bar end struct bar_hdf5 - a::NTuple{2, NTuple{20, UInt8}} + a::NTuple{2,NTuple{20,UInt8}} end function datatype(::Type{bar_hdf5}) @@ -78,25 +77,24 @@ function datatype(::Type{bar_hdf5}) end function convert(::Type{bar_hdf5}, x::bar) - bar_hdf5(ntuple(i -> ntuple(j -> j <= ncodeunits(x.a[i]) ? codeunit(x.a[i], j) : '\0', 20), 2)) + bar_hdf5(ntuple(i -> ntuple(j -> j <= ncodeunits(x.a[i]) ? codeunit(x.a[i], j) : '\0', + 20), 2)) end - @testset "compound" begin N = 10 v = [foo(rand(), - randstring(rand(10:100)), - randstring(10), - rand(ComplexF64, 3,3), - rand(1:10, rand(10:100)) - ) - for _ in 1:N] + randstring(rand(10:100)), + randstring(10), + rand(ComplexF64, 3, 3), + rand(1:10, rand(10:100))) + for _ in 1:N] v[1] = foo(1.0, - "uniรงยบโˆ‚e", - "uniรงยบโˆ‚e", - rand(ComplexF64, 3,3), - rand(1:10, rand(10:100))) + "uniรงยบโˆ‚e", + "uniรงยบโˆ‚e", + rand(ComplexF64, 3, 3), + rand(1:10, rand(10:100))) v_write = unsafe_convert.(foo_hdf5, v) @@ -128,18 +126,18 @@ end @test f.(w) == f.(w_read) end - T = NamedTuple{(:a, :b, :c, :d, :e, :f), Tuple{Int, Int, Int, Int, Int, Cstring}} - TT = NamedTuple{(:a, :b, :c, :d, :e, :f), Tuple{Int, Int, Int, Int, Int, T}} - TTT = NamedTuple{(:a, :b, :c, :d, :e, :f), Tuple{Int, Int, Int, Int, Int, TT}} - TTTT = NamedTuple{(:a, :b, :c, :d, :e, :f), Tuple{Int, Int, Int, Int, Int, TTT}} + T = NamedTuple{(:a, :b, :c, :d, :e, :f),Tuple{Int,Int,Int,Int,Int,Cstring}} + TT = NamedTuple{(:a, :b, :c, :d, :e, :f),Tuple{Int,Int,Int,Int,Int,T}} + TTT = NamedTuple{(:a, :b, :c, :d, :e, :f),Tuple{Int,Int,Int,Int,Int,TT}} + TTTT = NamedTuple{(:a, :b, :c, :d, :e, :f),Tuple{Int,Int,Int,Int,Int,TTT}} @test HDF5.do_reclaim(TTTT) == true @test HDF5.do_normalize(TTTT) == true - T = NamedTuple{(:a, :b, :c, :d, :e, :f), Tuple{Int, Int, Int, Int, Int, HDF5.FixedArray}} - TT = NamedTuple{(:a, :b, :c, :d, :e, :f), Tuple{Int, Int, Int, Int, Int, T}} - TTT = NamedTuple{(:a, :b, :c, :d, :e, :f), Tuple{Int, Int, Int, Int, Int, TT}} - TTTT = NamedTuple{(:a, :b, :c, :d, :e, :f), Tuple{Int, Int, Int, Int, Int, TTT}} + T = NamedTuple{(:a, :b, :c, :d, :e, :f),Tuple{Int,Int,Int,Int,Int,HDF5.FixedArray}} + TT = NamedTuple{(:a, :b, :c, :d, :e, :f),Tuple{Int,Int,Int,Int,Int,T}} + TTT = NamedTuple{(:a, :b, :c, :d, :e, :f),Tuple{Int,Int,Int,Int,Int,TT}} + TTTT = NamedTuple{(:a, :b, :c, :d, :e, :f),Tuple{Int,Int,Int,Int,Int,TTT}} @test HDF5.do_reclaim(TTTT) == false @test HDF5.do_normalize(TTTT) == true diff --git a/test/custom.jl b/test/custom.jl index 3db33aa11..b891fa23a 100644 --- a/test/custom.jl +++ b/test/custom.jl @@ -38,10 +38,10 @@ end v_read = read(dset, Simple, indices...) @test v_read == v[indices...] - v_read = read(h5f, "data"=>Simple) + v_read = read(h5f, "data" => Simple) @test v_read == v end - v_read = h5read(fn, "data"=>Simple) + v_read = h5read(fn, "data" => Simple) @test v_read == v end diff --git a/test/dataspace.jl b/test/dataspace.jl index 1cfb5a767..30bc36282 100644 --- a/test/dataspace.jl +++ b/test/dataspace.jl @@ -16,7 +16,7 @@ using Test @test isvalid(ds_scalar) - @test ndims(ds_null) === 0 + @test ndims(ds_null) === 0 @test ndims(ds_scalar) === 0 @test ndims(ds_zerosz) === 1 @test ndims(ds_vector) === 1 @@ -25,23 +25,25 @@ using Test # Test that properties of existing datasets can be extracted. # Note: Julia reverses the order of dimensions when using the high-level API versus # the dimensions used above to create the reference objects. - @test size(ds_null) === () + @test size(ds_null) === () @test size(ds_scalar) === () @test size(ds_zerosz) === (0,) @test size(ds_vector) === (5,) @test size(ds_matrix) === (5, 7) @test size(ds_maxdim) === (5, 7) - @test size(ds_null, 5) === 1 + @test size(ds_null, 5) === 1 @test size(ds_scalar, 5) === 1 @test size(ds_zerosz, 5) === 1 @test size(ds_vector, 5) === 1 @test size(ds_matrix, 5) === 1 @test size(ds_maxdim, 5) === 1 - @test_throws ArgumentError("invalid dimension d; must be positive integer") size(ds_null, 0) - @test_throws ArgumentError("invalid dimension d; must be positive integer") size(ds_scalar, -1) + @test_throws ArgumentError("invalid dimension d; must be positive integer") size(ds_null, + 0) + @test_throws ArgumentError("invalid dimension d; must be positive integer") size(ds_scalar, + -1) - @test length(ds_null) === 0 + @test length(ds_null) === 0 @test length(ds_scalar) === 1 @test length(ds_zerosz) === 0 @test length(ds_vector) === 5 @@ -58,23 +60,23 @@ using Test @test !HDF5.isnull(ds_zerosz) @test !HDF5.isnull(ds_vector) - @test HDF5.get_extent_dims(ds_null) === ((), ()) + @test HDF5.get_extent_dims(ds_null) === ((), ()) @test HDF5.get_extent_dims(ds_scalar) === ((), ()) @test HDF5.get_extent_dims(ds_zerosz) === ((0,), (0,)) @test HDF5.get_extent_dims(ds_vector) === ((5,), (5,)) @test HDF5.get_extent_dims(ds_matrix) === ((5, 7), (5, 7)) @test HDF5.get_extent_dims(ds_maxdim) === ((5, 7), (20, 20)) - @test HDF5.get_extent_dims(ds_unlim) === ((1,), (-1,)) + @test HDF5.get_extent_dims(ds_unlim) === ((1,), (-1,)) # Can create new copies ds_tmp = copy(ds_maxdim) ds_tmp2 = HDF5.Dataspace(ds_tmp.id) # copy of ID, but new Julia object @test ds_tmp.id == ds_tmp2.id != ds_maxdim.id # Equality and hashing - @test ds_tmp == ds_maxdim + @test ds_tmp == ds_maxdim @test ds_tmp !== ds_maxdim @test hash(ds_tmp) != hash(ds_maxdim) - @test ds_tmp == ds_tmp2 + @test ds_tmp == ds_tmp2 @test ds_tmp !== ds_tmp2 @test hash(ds_tmp) == hash(ds_tmp2) @@ -90,7 +92,7 @@ using Test @test_throws ErrorException("File or object has been closed") size(ds_tmp) @test_throws ErrorException("File or object has been closed") size(ds_tmp, 1) @test_throws ErrorException("File or object has been closed") length(ds_tmp) - @test_throws ErrorException("File or object has been closed") ds_tmp == ds_tmp2 + @test_throws ErrorException("File or object has been closed") ds_tmp==ds_tmp2 @test close(ds_tmp) === nothing # no error # Test ability to create explicitly-sized dataspaces @@ -98,8 +100,8 @@ using Test @test dataspace(()) == ds_scalar @test dataspace((5,)) == ds_vector @test dataspace((5, 7)) == ds_matrix != ds_maxdim - @test dataspace((5, 7), max_dims = (20, 20)) == ds_maxdim != ds_matrix - @test dataspace((1,), max_dims = (-1,)) == ds_unlim + @test dataspace((5, 7); max_dims = (20, 20)) == ds_maxdim != ds_matrix + @test dataspace((1,); max_dims = (-1,)) == ds_unlim # for โ‰ฅ 2 numbers, same as single tuple argument @test dataspace(5, 7) == ds_matrix @test dataspace(5, 7, 1) == dataspace((5, 7, 1)) @@ -127,9 +129,9 @@ using Test h5open(path, "w") do hid dset = create_dataset(hid, "dset", datatype(Int), ds_matrix) attr = create_attribute(dset, "attr", datatype(Bool), ds_vector) - @test dataspace(dset) == ds_matrix + @test dataspace(dset) == ds_matrix @test dataspace(dset) !== ds_matrix - @test dataspace(attr) == ds_vector + @test dataspace(attr) == ds_vector @test dataspace(attr) !== ds_vector close(dset) close(attr) @@ -138,20 +140,21 @@ using Test end end - # Test mid-level routines: set/get_extent_dims dspace_norm = dataspace((100, 4)) - @test HDF5.get_extent_dims(dspace_norm)[1] == HDF5.get_extent_dims(dspace_norm)[2] == (100, 4) + @test HDF5.get_extent_dims(dspace_norm)[1] == HDF5.get_extent_dims(dspace_norm)[2] == + (100, 4) HDF5.set_extent_dims(dspace_norm, (8, 2)) - @test HDF5.get_extent_dims(dspace_norm)[1] == HDF5.get_extent_dims(dspace_norm)[2] == (8, 2) + @test HDF5.get_extent_dims(dspace_norm)[1] == HDF5.get_extent_dims(dspace_norm)[2] == + (8, 2) - dspace_maxd = dataspace((100, 4), max_dims = (256, 5)) + dspace_maxd = dataspace((100, 4); max_dims = (256, 5)) @test HDF5.get_extent_dims(dspace_maxd)[1] == (100, 4) @test HDF5.get_extent_dims(dspace_maxd)[2] == (256, 5) HDF5.set_extent_dims(dspace_maxd, (8, 2)) @test HDF5.get_extent_dims(dspace_maxd)[1] == (8, 2) - HDF5.set_extent_dims(dspace_maxd, (3, 1), (4,2)) + HDF5.set_extent_dims(dspace_maxd, (3, 1), (4, 2)) @test HDF5.get_extent_dims(dspace_maxd)[1] == (3, 1) @test HDF5.get_extent_dims(dspace_maxd)[2] == (4, 2) HDF5.set_extent_dims(dspace_maxd, (3, 1), (-1, -1)) # unlimited max size diff --git a/test/drivers.jl b/test/drivers.jl index dcfd5b32c..36f37a6ef 100644 --- a/test/drivers.jl +++ b/test/drivers.jl @@ -3,22 +3,19 @@ import HDF5.Drivers using Test @testset "Drivers" begin + fn = tempname() + A = rand(UInt8, 256, 128) + h5open(fn, "w"; driver = Drivers.Core()) do f + ds = write_dataset(f, "core_dataset", A) + end + @test isfile(fn) + h5open(fn, "r") do f + @test f["core_dataset"][] == A + end -fn = tempname() -A = rand(UInt8, 256, 128) -h5open(fn, "w"; driver = Drivers.Core()) do f - ds = write_dataset(f, "core_dataset", A) -end -@test isfile(fn) -h5open(fn, "r") do f - @test f["core_dataset"][] == A -end - -fn = tempname() -h5open(fn, "w"; driver = Drivers.Core(backing_store = false)) do f - ds = write_dataset(f, "core_dataset", A) -end -@test !isfile(fn) - - + fn = tempname() + h5open(fn, "w"; driver = Drivers.Core(; backing_store = false)) do f + ds = write_dataset(f, "core_dataset", A) + end + @test !isfile(fn) end diff --git a/test/extend_test.jl b/test/extend_test.jl index 928c7c1aa..76b5189ed 100644 --- a/test/extend_test.jl +++ b/test/extend_test.jl @@ -2,79 +2,77 @@ using HDF5 using Test @testset "extend" begin + fn = tempname() -fn = tempname() + fid = h5open(fn, "w") + g = create_group(fid, "shoe") + d = create_dataset(g, "foo", datatype(Float64), ((10, 20), (100, 200)); chunk = (1, 1)) + #println("d is size current $(map(int,HDF5.get_extent_dims(d)[1])) max $(map(int,HDF5.get_extent_dims(d)[2]))") + dims, max_dims = HDF5.get_extent_dims(d) + @test dims == (UInt64(10), UInt64(20)) + @test max_dims == (UInt64(100), UInt64(200)) + HDF5.set_extent_dims(d, (100, 150)) + dims, max_dims = HDF5.get_extent_dims(d) + @test dims == (UInt64(100), UInt64(150)) + @test max_dims == (UInt64(100), UInt64(200)) + d[1, 1:5] = [1.1231, 1.313, 5.123, 2.231, 4.1231] + HDF5.set_extent_dims(d, (1, 5)) + @test size(d) == (1, 5) -fid = h5open(fn, "w") -g = create_group(fid, "shoe") -d = create_dataset(g, "foo", datatype(Float64), ((10, 20), (100, 200)), chunk=(1, 1)) -#println("d is size current $(map(int,HDF5.get_extent_dims(d)[1])) max $(map(int,HDF5.get_extent_dims(d)[2]))") -dims, max_dims = HDF5.get_extent_dims(d) -@test dims == (UInt64(10), UInt64(20)) -@test max_dims == (UInt64(100), UInt64(200)) -HDF5.set_extent_dims(d, (100, 150)) -dims, max_dims = HDF5.get_extent_dims(d) -@test dims == (UInt64(100), UInt64(150)) -@test max_dims == (UInt64(100), UInt64(200)) -d[1, 1:5] = [1.1231, 1.313, 5.123, 2.231, 4.1231] -HDF5.set_extent_dims(d, (1, 5)) -@test size(d) == (1, 5) + # Indexing returns correct array dimensions + @test d[1, end] โ‰ˆ 4.1231 + @test d[:, end] โ‰ˆ [4.1231] + @test d[end, :] == [1.1231, 1.313, 5.123, 2.231, 4.1231] + @test d[:, :] == [1.1231 1.313 5.123 2.231 4.1231] -# Indexing returns correct array dimensions -@test d[1, end] โ‰ˆ 4.1231 -@test d[:, end] โ‰ˆ [4.1231] -@test d[end, :] == [1.1231, 1.313, 5.123, 2.231, 4.1231] -@test d[:, :] == [1.1231 1.313 5.123 2.231 4.1231] + # Test all integer types work + @test d[UInt8(1), UInt16(1)] == 1.1231 + @test d[UInt32(1), UInt128(1)] == 1.1231 + @test d[Int8(1), Int16(1)] == 1.1231 + @test d[Int32(1), Int128(1)] == 1.1231 -# Test all integer types work -@test d[UInt8(1), UInt16(1)] == 1.1231 -@test d[UInt32(1), UInt128(1)] == 1.1231 -@test d[Int8(1), Int16(1)] == 1.1231 -@test d[Int32(1), Int128(1)] == 1.1231 + # Test ranges work with steps + @test d[1, 1:2:5] == [1.1231, 5.123, 4.1231] + @test d[1:1, 2:2:4] == [1.313 2.231] -# Test ranges work with steps -@test d[1, 1:2:5] == [1.1231, 5.123, 4.1231] -@test d[1:1, 2:2:4] == [1.313 2.231] + # Test Array constructor + Array(d) == [1.1231 1.313 5.123 2.231 4.1231] -# Test Array constructor -Array(d) == [1.1231 1.313 5.123 2.231 4.1231] + #println("d is size current $(map(int,HDF5.get_extent_dims(d)[1])) max $(map(int,HDF5.get_extent_dims(d)[2]))") + b = create_dataset(fid, "b", Int, ((1000,), (-1,)); chunk = (100,)) #-1 is equivalent to typemax(hsize_t) as far as I can tell + #println("b is size current $(map(int,HDF5.get_extent_dims(b)[1])) max $(map(int,HDF5.get_extent_dims(b)[2]))") + b[1:200] = ones(200) + dims, max_dims = HDF5.get_extent_dims(b) + @test dims == (UInt64(1000),) + @test max_dims == (HDF5.API.H5S_UNLIMITED % Int,) + HDF5.set_extent_dims(b, (10000,)) + dims, max_dims = HDF5.get_extent_dims(b) + @test dims == (UInt64(10000),) + @test max_dims == (HDF5.API.H5S_UNLIMITED % Int,) + #println("b is size current $(map(int,HDF5.get_extent_dims(b)[1])) max $(map(int,HDF5.get_extent_dims(b)[2]))") + # b[:] = [1:10000] # gave error no method lastindex(HDF5.Dataset{PlainHDF5File},), + # so I defined lastindex(dset::HDF5.Dataset) = length(dset), and exported lastindex + # but that didn't fix the error, despite the lastindex function working + # d[1] produces error ERROR: Wrong number of indices supplied, should datasets support linear indexing? + b[1:10000] = [1:10000;] + #println(b[1:100]) -#println("d is size current $(map(int,HDF5.get_extent_dims(d)[1])) max $(map(int,HDF5.get_extent_dims(d)[2]))") -b = create_dataset(fid, "b", Int, ((1000,), (-1,)), chunk=(100,)) #-1 is equivalent to typemax(hsize_t) as far as I can tell -#println("b is size current $(map(int,HDF5.get_extent_dims(b)[1])) max $(map(int,HDF5.get_extent_dims(b)[2]))") -b[1:200] = ones(200) -dims, max_dims = HDF5.get_extent_dims(b) -@test dims == (UInt64(1000),) -@test max_dims == (HDF5.API.H5S_UNLIMITED % Int,) -HDF5.set_extent_dims(b, (10000,)) -dims, max_dims = HDF5.get_extent_dims(b) -@test dims == (UInt64(10000),) -@test max_dims == (HDF5.API.H5S_UNLIMITED % Int,) -#println("b is size current $(map(int,HDF5.get_extent_dims(b)[1])) max $(map(int,HDF5.get_extent_dims(b)[2]))") -# b[:] = [1:10000] # gave error no method lastindex(HDF5.Dataset{PlainHDF5File},), -# so I defined lastindex(dset::HDF5.Dataset) = length(dset), and exported lastindex -# but that didn't fix the error, despite the lastindex function working -# d[1] produces error ERROR: Wrong number of indices supplied, should datasets support linear indexing? -b[1:10000] = [1:10000;] -#println(b[1:100]) + close(fid) -close(fid) - -fid = h5open(fn, "r") -d_again = fid["shoe/foo"] -dims, max_dims = HDF5.get_extent_dims(d_again) -@test dims == (UInt64(1), UInt64(5)) -@test max_dims == (UInt64(100), UInt64(200)) -@test (sum(d_again[1, 1:5]) - sum([1.1231, 1.313, 5.123, 2.231, 4.1231])) == 0 -#println("d is size current $(map(int,HDF5.get_extent_dims(re_d)[1])) max $(map(int,HDF5.get_extent_dims(re_d)[2]))") -@test fid["b"][1:10000] == [1:10000;] -b_again = fid["b"] -dims, max_dims = HDF5.get_extent_dims(b_again) -@test dims == (UInt64(10000),) -@test max_dims == (HDF5.API.H5S_UNLIMITED % Int,) -#println("b is size current $(map(int,HDF5.get_extent_dims(b)[1])) max $(map(int,HDF5.get_extent_dims(b)[2]))") - -close(fid) -rm(fn) + fid = h5open(fn, "r") + d_again = fid["shoe/foo"] + dims, max_dims = HDF5.get_extent_dims(d_again) + @test dims == (UInt64(1), UInt64(5)) + @test max_dims == (UInt64(100), UInt64(200)) + @test (sum(d_again[1, 1:5]) - sum([1.1231, 1.313, 5.123, 2.231, 4.1231])) == 0 + #println("d is size current $(map(int,HDF5.get_extent_dims(re_d)[1])) max $(map(int,HDF5.get_extent_dims(re_d)[2]))") + @test fid["b"][1:10000] == [1:10000;] + b_again = fid["b"] + dims, max_dims = HDF5.get_extent_dims(b_again) + @test dims == (UInt64(10000),) + @test max_dims == (HDF5.API.H5S_UNLIMITED % Int,) + #println("b is size current $(map(int,HDF5.get_extent_dims(b)[1])) max $(map(int,HDF5.get_extent_dims(b)[2]))") + close(fid) + rm(fn) end # testset extend_test diff --git a/test/external.jl b/test/external.jl index 72bfe0183..d5327036f 100644 --- a/test/external.jl +++ b/test/external.jl @@ -3,56 +3,56 @@ using Test @testset "external" begin -# roughly following https://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/examples/h5_extlink.c -fn1 = tempname() -fn2 = tempname() - -source_file = h5open(fn1, "w") -agroup = create_group(source_file, "agroup") -target_file = h5open(fn2, "w") -target_group = create_group(target_file, "target_group") -target_group["abc"] = "abc" -target_group["1"] = 1 -target_group["1.1"] = 1.1 -close(target_file) - -# create external link such that source_file["ext_link"] points to target_file["target_group"] -# test both an HDF5.File and an HDF5.Group for first argument -HDF5.create_external(source_file, "ext_link", target_file.filename, "target_group") -HDF5.create_external(agroup, "ext_link", target_file.filename, "target_group") -close(agroup) -# write some things via the external link -new_group = create_group(source_file["ext_link"], "new_group") -new_group["abc"] = "abc" -new_group["1"] = 1 -new_group["1.1"] = 1.1 -close(new_group) - -# read things from target_group via exernal link created with HDF5File argument -group = source_file["ext_link"] -@test read(group["abc"]) == "abc" -@test read(group["1"]) == 1 -@test read(group["1.1"]) == 1.1 -close(group) -# read things from target_group via the external link created with HDF5.Group argument -groupalt = source_file["agroup/ext_link"] -@test read(groupalt["abc"]) == "abc" -@test read(groupalt["1"]) == 1 -@test read(groupalt["1.1"]) == 1.1 -close(groupalt) -close(source_file) - -##### tests that should be included but don't work -# when ggggggggg restarts julia and keeps track of target_file.filename, -# these tests succeed -# reopening the target_file crashes due to "file close degree doesn't match" -# target_file = h5open(target_file.filename, "r") -# group2 = target_file["target_group"]["new_group"] -# @test read(group2["abc"])=="abc" -# @test read(group2["1"])==1 -# @test read(group2["1.1"])==1.1 - -rm(fn1) -# rm(fn2) + # roughly following https://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/examples/h5_extlink.c + fn1 = tempname() + fn2 = tempname() + + source_file = h5open(fn1, "w") + agroup = create_group(source_file, "agroup") + target_file = h5open(fn2, "w") + target_group = create_group(target_file, "target_group") + target_group["abc"] = "abc" + target_group["1"] = 1 + target_group["1.1"] = 1.1 + close(target_file) + + # create external link such that source_file["ext_link"] points to target_file["target_group"] + # test both an HDF5.File and an HDF5.Group for first argument + HDF5.create_external(source_file, "ext_link", target_file.filename, "target_group") + HDF5.create_external(agroup, "ext_link", target_file.filename, "target_group") + close(agroup) + # write some things via the external link + new_group = create_group(source_file["ext_link"], "new_group") + new_group["abc"] = "abc" + new_group["1"] = 1 + new_group["1.1"] = 1.1 + close(new_group) + + # read things from target_group via exernal link created with HDF5File argument + group = source_file["ext_link"] + @test read(group["abc"]) == "abc" + @test read(group["1"]) == 1 + @test read(group["1.1"]) == 1.1 + close(group) + # read things from target_group via the external link created with HDF5.Group argument + groupalt = source_file["agroup/ext_link"] + @test read(groupalt["abc"]) == "abc" + @test read(groupalt["1"]) == 1 + @test read(groupalt["1.1"]) == 1.1 + close(groupalt) + close(source_file) + + ##### tests that should be included but don't work + # when ggggggggg restarts julia and keeps track of target_file.filename, + # these tests succeed + # reopening the target_file crashes due to "file close degree doesn't match" + # target_file = h5open(target_file.filename, "r") + # group2 = target_file["target_group"]["new_group"] + # @test read(group2["abc"])=="abc" + # @test read(group2["1"])==1 + # @test read(group2["1.1"])==1.1 + + rm(fn1) + # rm(fn2) end # testset external diff --git a/test/fileio.jl b/test/fileio.jl index cc81c8a88..3f26d4310 100644 --- a/test/fileio.jl +++ b/test/fileio.jl @@ -1,120 +1,112 @@ using HDF5, OrderedCollections, FileIO, Test @testset "fileio" begin -fn = tempname() * ".h5" - -hfile = h5open(fn, "w") -hfile["A"] = 1.0 -hfile["B"] = [1,2,3] -create_group(hfile, "G") -hfile["G/A"] = collect(-3:4) -create_group(hfile, "G1/G2") -hfile["G1/G2/A"] = "hello" -close(hfile); - -# test loader -data = Dict("A" => 1.0, "B"=> [1,2,3], "G/A"=>collect(-3:4), "G1/G2/A"=>"hello") -@test load(fn) == data -@test load(fn, "A") == 1.0 -@test load(fn, "A", "B") == (1.0, [1,2,3]) -@test load(fn, "G/A") == collect(-3:4) - -rm(fn) - -# test saver -save(fn, data) -@test load(fn) == data -@test load(fn, "A") == 1.0 -fr = h5open(fn, "r") -read(fr, "A") == 1.0 -close(fr) - -rm(fn) + fn = tempname() * ".h5" + + hfile = h5open(fn, "w") + hfile["A"] = 1.0 + hfile["B"] = [1, 2, 3] + create_group(hfile, "G") + hfile["G/A"] = collect(-3:4) + create_group(hfile, "G1/G2") + hfile["G1/G2/A"] = "hello" + close(hfile) + + # test loader + data = Dict("A" => 1.0, "B" => [1, 2, 3], "G/A" => collect(-3:4), "G1/G2/A" => "hello") + @test load(fn) == data + @test load(fn, "A") == 1.0 + @test load(fn, "A", "B") == (1.0, [1, 2, 3]) + @test load(fn, "G/A") == collect(-3:4) + + rm(fn) + + # test saver + save(fn, data) + @test load(fn) == data + @test load(fn, "A") == 1.0 + fr = h5open(fn, "r") + read(fr, "A") == 1.0 + close(fr) + + rm(fn) end @testset "track order" begin - -let fn = tempname() * ".h5" - h5open(fn, "w"; track_order=true) do io - fcpl = HDF5.get_create_properties(io) - @test fcpl.track_order - io["b"] = 1 - io["a"] = 2 - g = create_group(io, "G"; track_order=true) - gcpl = HDF5.get_create_properties(io["G"]) - @test gcpl.track_order - write(g, "z", 3) - write(g, "f", 4) - end - - dat = load(fn; dict=OrderedDict()) # `track_order` is inferred from `OrderedDict` - - @test all(keys(dat) .== ["b", "a", "G/z", "G/f"]) - - # issue #939 - h5open(fn, "r"; track_order=true) do io - @test HDF5.get_context_property(:file_create).track_order - @test all(keys(io) .== ["b", "a", "G"]) - @test HDF5.get_context_property(:group_create).track_order - @test HDF5.get_create_properties(io["G"]).track_order # inferred from file, created with `track_order=true` - @test all(keys(io["G"]) .== ["z", "f"]) - end - - h5open(fn, "r"; track_order=false) do io - @test !HDF5.get_context_property(:file_create).track_order - @test all(keys(io) .== ["G", "a", "b"]) - @test !HDF5.get_context_property(:group_create).track_order - @test HDF5.get_create_properties(io["G"]).track_order # inferred from file - @test all(keys(io["G"]) .== ["z", "f"]) - end - - h5open(fn, "r") do io - @test !HDF5.get_create_properties(io).track_order - @test all(keys(io) .== ["G", "a", "b"]) - @test HDF5.get_create_properties(io["G"]).track_order # inferred from file - @test all(keys(io["G"]) .== ["z", "f"]) - end -end - -let fn = tempname() * ".h5" - save(fn, OrderedDict("b"=>1, "a"=>2, "G/z"=>3, "G/f"=>4)) - - dat = load(fn; dict=OrderedDict()) - - @test all(keys(dat) .== ["b", "a", "G/z", "G/f"]) -end - + let fn = tempname() * ".h5" + h5open(fn, "w"; track_order = true) do io + fcpl = HDF5.get_create_properties(io) + @test fcpl.track_order + io["b"] = 1 + io["a"] = 2 + g = create_group(io, "G"; track_order = true) + gcpl = HDF5.get_create_properties(io["G"]) + @test gcpl.track_order + write(g, "z", 3) + write(g, "f", 4) + end + + dat = load(fn; dict = OrderedDict()) # `track_order` is inferred from `OrderedDict` + + @test all(keys(dat) .== ["b", "a", "G/z", "G/f"]) + + # issue #939 + h5open(fn, "r"; track_order = true) do io + @test HDF5.get_context_property(:file_create).track_order + @test all(keys(io) .== ["b", "a", "G"]) + @test HDF5.get_context_property(:group_create).track_order + @test HDF5.get_create_properties(io["G"]).track_order # inferred from file, created with `track_order=true` + @test all(keys(io["G"]) .== ["z", "f"]) + end + + h5open(fn, "r"; track_order = false) do io + @test !HDF5.get_context_property(:file_create).track_order + @test all(keys(io) .== ["G", "a", "b"]) + @test !HDF5.get_context_property(:group_create).track_order + @test HDF5.get_create_properties(io["G"]).track_order # inferred from file + @test all(keys(io["G"]) .== ["z", "f"]) + end + + h5open(fn, "r") do io + @test !HDF5.get_create_properties(io).track_order + @test all(keys(io) .== ["G", "a", "b"]) + @test HDF5.get_create_properties(io["G"]).track_order # inferred from file + @test all(keys(io["G"]) .== ["z", "f"]) + end + end + + let fn = tempname() * ".h5" + save(fn, OrderedDict("b" => 1, "a" => 2, "G/z" => 3, "G/f" => 4)) + + dat = load(fn; dict = OrderedDict()) + + @test all(keys(dat) .== ["b", "a", "G/z", "G/f"]) + end end # @testset track_order @static if HDF5.API.h5_get_libversion() >= v"1.10.5" - -@testset "h5f_get_dset_no_attrs_hint" begin - fn = tempname() - threshold = 300 - h5open( - fn, "w"; - libver_bounds = :latest, - meta_block_size = threshold - ) do f - HDF5.API.h5f_set_dset_no_attrs_hint(f, true) - @test HDF5.API.h5f_get_dset_no_attrs_hint(f) - f["test"] = 0x1 - # We expect that with the hint, the offset will actually be 300 - @test HDF5.API.h5d_get_offset(f["test"]) == threshold - end - @test filesize(fn) == threshold + 1 - h5open( - fn, "w"; - libver_bounds = :latest, - meta_block_size = threshold - ) do f - HDF5.API.h5f_set_dset_no_attrs_hint(f, false) - @test !HDF5.API.h5f_get_dset_no_attrs_hint(f) - f["test"] = 0x1 - # We expect that with the hint, the offset will be greater than 300 - @test HDF5.API.h5d_get_offset(f["test"]) > threshold - end - @test filesize(fn) > threshold + 1 -end - + @testset "h5f_get_dset_no_attrs_hint" begin + fn = tempname() + threshold = 300 + h5open(fn, "w"; + libver_bounds = :latest, + meta_block_size = threshold) do f + HDF5.API.h5f_set_dset_no_attrs_hint(f, true) + @test HDF5.API.h5f_get_dset_no_attrs_hint(f) + f["test"] = 0x1 + # We expect that with the hint, the offset will actually be 300 + @test HDF5.API.h5d_get_offset(f["test"]) == threshold + end + @test filesize(fn) == threshold + 1 + h5open(fn, "w"; + libver_bounds = :latest, + meta_block_size = threshold) do f + HDF5.API.h5f_set_dset_no_attrs_hint(f, false) + @test !HDF5.API.h5f_get_dset_no_attrs_hint(f) + f["test"] = 0x1 + # We expect that with the hint, the offset will be greater than 300 + @test HDF5.API.h5d_get_offset(f["test"]) > threshold + end + @test filesize(fn) > threshold + 1 + end end # @static if HDF5.API.h5_get_libversion() >= v"1.10.5" diff --git a/test/filter.jl b/test/filter.jl index 51f537c55..154139827 100644 --- a/test/filter.jl +++ b/test/filter.jl @@ -3,177 +3,168 @@ using HDF5.Filters using Test using H5Zblosc, H5Zlz4, H5Zbzip2, H5Zzstd -@static if VERSION >= v"1.6" using H5Zbitshuffle end +@static if VERSION >= v"1.6" + using H5Zbitshuffle +end using HDF5.Filters: ExternalFilter, isavailable, isencoderenabled, isdecoderenabled @testset "filter" begin -# Create a new file -fn = tempname() + # Create a new file + fn = tempname() -# Create test data -data = rand(1000, 1000) + # Create test data + data = rand(1000, 1000) -# Open temp file for writing -f = h5open(fn, "w") + # Open temp file for writing + f = h5open(fn, "w") -# Create datasets -dsdeflate = create_dataset(f, "deflate", datatype(data), dataspace(data), - chunk=(100, 100), deflate=3) + # Create datasets + dsdeflate = create_dataset(f, "deflate", datatype(data), dataspace(data); + chunk = (100, 100), deflate = 3) -dsshufdef = create_dataset(f, "shufdef", datatype(data), dataspace(data), - chunk=(100, 100), shuffle=true, deflate=3) + dsshufdef = create_dataset(f, "shufdef", datatype(data), dataspace(data); + chunk = (100, 100), shuffle = true, deflate = 3) -dsfiltdef = create_dataset(f, "filtdef", datatype(data), dataspace(data), - chunk=(100, 100), filters=Filters.Deflate(3)) + dsfiltdef = create_dataset(f, "filtdef", datatype(data), dataspace(data); + chunk = (100, 100), filters = Filters.Deflate(3)) -dsfiltshufdef = create_dataset(f, "filtshufdef", datatype(data), dataspace(data), - chunk=(100, 100), filters=[Filters.Shuffle(), Filters.Deflate(3)]) + dsfiltshufdef = create_dataset(f, "filtshufdef", datatype(data), dataspace(data); + chunk = (100, 100), + filters = [Filters.Shuffle(), Filters.Deflate(3)]) + # Write data + write(dsdeflate, data) + write(dsshufdef, data) + write(dsfiltdef, data) + write(dsfiltshufdef, data) -# Write data -write(dsdeflate, data) -write(dsshufdef, data) -write(dsfiltdef, data) -write(dsfiltshufdef, data) + # Test compression filters -# Test compression filters + compressionFilters = Dict("blosc" => BloscFilter, + "bzip2" => Bzip2Filter, + "lz4" => Lz4Filter, + "zstd" => ZstdFilter) -compressionFilters = Dict( - "blosc" => BloscFilter, - "bzip2" => Bzip2Filter, - "lz4" => Lz4Filter, - "zstd" => ZstdFilter, -) + for (name, filter) in compressionFilters + ds = create_dataset(f, name, datatype(data), dataspace(data); + chunk = (100, 100), filters = filter()) + write(ds, data) -for (name, filter) in compressionFilters + ds = create_dataset(f, "shuffle+" * name, datatype(data), dataspace(data); + chunk = (100, 100), filters = [Filters.Shuffle(), filter()]) + write(ds, data) + end - ds = create_dataset( - f, name, datatype(data), dataspace(data), - chunk=(100,100), filters=filter() - ) - write(ds, data) + ds = create_dataset(f, "blosc_bitshuffle", datatype(data), dataspace(data); + chunk = (100, 100), + filters = BloscFilter(; shuffle = H5Zblosc.BITSHUFFLE)) - ds = create_dataset( - f, "shuffle+"*name, datatype(data), dataspace(data), - chunk=(100,100), filters=[Filters.Shuffle(), filter()] - ) write(ds, data) -end + function extra_bitshuffle() + ds = create_dataset(f, "bitshuffle_lz4", datatype(data), dataspace(data); + chunk = (100, 100), + filters = BitshuffleFilter(; compressor = :lz4)) -ds = create_dataset( - f, "blosc_bitshuffle", datatype(data), dataspace(data), - chunk=(100,100), filters=BloscFilter(shuffle=H5Zblosc.BITSHUFFLE) -) - -write(ds, data) + write(ds, data) -function extra_bitshuffle() + ds = create_dataset(f, "bitshuffle_zstd", datatype(data), dataspace(data); + chunk = (100, 100), + filters = BitshuffleFilter(; compressor = :zstd, + comp_level = 5)) - ds = create_dataset( - f, "bitshuffle_lz4", datatype(data), dataspace(data), - chunk=(100,100), filters=BitshuffleFilter(compressor=:lz4) - ) + write(ds, data) - write(ds, data) + ds = create_dataset(f, "bitshuffle_plain", datatype(data), dataspace(data); + chunk = (100, 100), filters = BitshuffleFilter()) - ds = create_dataset( - f, "bitshuffle_zstd", datatype(data), dataspace(data), - chunk=(100,100), filters=BitshuffleFilter(compressor=:zstd,comp_level=5) - ) - - write(ds, data) - - ds = create_dataset( - f, "bitshuffle_plain", datatype(data), dataspace(data), - chunk=(100,100), filters=BitshuffleFilter() - ) - - write(ds, data) -end + write(ds, data) + end -@static VERSION >= v"1.6" ? extra_bitshuffle() : nothing - -# Close and re-open file for reading -close(f) -f = h5open(fn) - -# Read datasets and test for equality -for name in keys(f) - ds = f[name] - @testset "$name" begin - @debug "Filter Dataset" HDF5.name(ds) - @test ds[] == data - filters = HDF5.get_create_properties(ds).filters - if startswith(name, "shuffle+") - @test filters[1] isa Shuffle - @test filters[2] isa compressionFilters[name[9:end]] - elseif haskey(compressionFilters, name) || name == "blosc_bitshuffle" - name = replace(name, r"_.*"=>"") - @test filters[1] isa compressionFilters[name] + @static VERSION >= v"1.6" ? extra_bitshuffle() : nothing + + # Close and re-open file for reading + close(f) + f = h5open(fn) + + # Read datasets and test for equality + for name in keys(f) + ds = f[name] + @testset "$name" begin + @debug "Filter Dataset" HDF5.name(ds) + @test ds[] == data + filters = HDF5.get_create_properties(ds).filters + if startswith(name, "shuffle+") + @test filters[1] isa Shuffle + @test filters[2] isa compressionFilters[name[9:end]] + elseif haskey(compressionFilters, name) || name == "blosc_bitshuffle" + name = replace(name, r"_.*" => "") + @test filters[1] isa compressionFilters[name] + end end end -end -close(f) - -# Issue #896 and https://github.com/JuliaIO/HDF5.jl/issues/285#issuecomment-1002243321 -# Create an ExternalFilter from a Tuple -h5open(fn, "w") do f - data = rand(UInt8, 512, 16, 512) - # Tuple of integers should become an Unknown Filter - ds, dt = create_dataset(f, "data", data, chunk=(256,1,256), filter=(H5Z_FILTER_BZIP2, 0)) - # Tuple of Filters should get pushed into the pipeline one by one - dsfiltshufdef = create_dataset(f, "filtshufdef", datatype(data), dataspace(data), - chunk=(128, 4, 128), filters=(Filters.Shuffle(), Filters.Deflate(3))) - write(ds, data) - close(ds) - write(dsfiltshufdef, data) - close(dsfiltshufdef) -end - -h5open(fn, "r") do f - @test f["data"][] == data - @test f["filtshufdef"][] == data -end + close(f) + + # Issue #896 and https://github.com/JuliaIO/HDF5.jl/issues/285#issuecomment-1002243321 + # Create an ExternalFilter from a Tuple + h5open(fn, "w") do f + data = rand(UInt8, 512, 16, 512) + # Tuple of integers should become an Unknown Filter + ds, dt = create_dataset(f, "data", data; chunk = (256, 1, 256), + filter = (H5Z_FILTER_BZIP2, 0)) + # Tuple of Filters should get pushed into the pipeline one by one + dsfiltshufdef = create_dataset(f, "filtshufdef", datatype(data), dataspace(data); + chunk = (128, 4, 128), + filters = (Filters.Shuffle(), Filters.Deflate(3))) + write(ds, data) + close(ds) + write(dsfiltshufdef, data) + close(dsfiltshufdef) + end -# Filter Pipeline test for ExternalFilter -FILTERS_backup = copy(HDF5.Filters.FILTERS) -empty!(HDF5.Filters.FILTERS) -h5open(fn, "w") do f - data = collect(1:128) - filter = ExternalFilter(H5Z_FILTER_LZ4, 0, Cuint[0, 2, 4, 6, 8, 10], "Unknown LZ4", 0) - ds, dt = create_dataset(f, "data", data, chunk=(32,), filters=filter) - dcpl = HDF5.get_create_properties(ds) - pipeline = HDF5.Filters.FilterPipeline(dcpl) - @test pipeline[1].data == filter.data -end -merge!(HDF5.Filters.FILTERS, FILTERS_backup) - -@test HDF5.API.h5z_filter_avail(HDF5.API.H5Z_FILTER_DEFLATE) -@test HDF5.API.h5z_filter_avail(HDF5.API.H5Z_FILTER_FLETCHER32) -@test HDF5.API.h5z_filter_avail(HDF5.API.H5Z_FILTER_NBIT) -@test HDF5.API.h5z_filter_avail(HDF5.API.H5Z_FILTER_SCALEOFFSET) -@test HDF5.API.h5z_filter_avail(HDF5.API.H5Z_FILTER_SHUFFLE) -@static if Sys.iswindows() || VERSION โ‰ค v"1.6" - @test HDF5.API.h5z_filter_avail(HDF5.API.H5Z_FILTER_SZIP) -elseif HDF5.API.h5_get_libversion() >= v"1.12.0" - # These are missing in the macOS and Linux JLLs for h5 version 1.12+ - @test_broken HDF5.API.h5z_filter_avail(HDF5.API.H5Z_FILTER_SZIP) -end -@test HDF5.API.h5z_filter_avail(H5Z_FILTER_BZIP2) -@test HDF5.API.h5z_filter_avail(H5Z_FILTER_LZ4) -@test HDF5.API.h5z_filter_avail(H5Z_FILTER_ZSTD) -@test HDF5.API.h5z_filter_avail(H5Z_FILTER_BLOSC) -HDF5.API.h5z_unregister(H5Z_FILTER_LZ4) -HDF5.Filters.register_filter(H5Zlz4.Lz4Filter) -@test isavailable(H5Z_FILTER_LZ4) -@test isavailable(Lz4Filter) -@test isencoderenabled(H5Z_FILTER_LZ4) -@test isdecoderenabled(H5Z_FILTER_LZ4) -@test isencoderenabled(Lz4Filter) -@test isdecoderenabled(Lz4Filter) + h5open(fn, "r") do f + @test f["data"][] == data + @test f["filtshufdef"][] == data + end + # Filter Pipeline test for ExternalFilter + FILTERS_backup = copy(HDF5.Filters.FILTERS) + empty!(HDF5.Filters.FILTERS) + h5open(fn, "w") do f + data = collect(1:128) + filter = ExternalFilter(H5Z_FILTER_LZ4, 0, Cuint[0, 2, 4, 6, 8, 10], "Unknown LZ4", + 0) + ds, dt = create_dataset(f, "data", data; chunk = (32,), filters = filter) + dcpl = HDF5.get_create_properties(ds) + pipeline = HDF5.Filters.FilterPipeline(dcpl) + @test pipeline[1].data == filter.data + end + merge!(HDF5.Filters.FILTERS, FILTERS_backup) + + @test HDF5.API.h5z_filter_avail(HDF5.API.H5Z_FILTER_DEFLATE) + @test HDF5.API.h5z_filter_avail(HDF5.API.H5Z_FILTER_FLETCHER32) + @test HDF5.API.h5z_filter_avail(HDF5.API.H5Z_FILTER_NBIT) + @test HDF5.API.h5z_filter_avail(HDF5.API.H5Z_FILTER_SCALEOFFSET) + @test HDF5.API.h5z_filter_avail(HDF5.API.H5Z_FILTER_SHUFFLE) + @static if Sys.iswindows() || VERSION โ‰ค v"1.6" + @test HDF5.API.h5z_filter_avail(HDF5.API.H5Z_FILTER_SZIP) + elseif HDF5.API.h5_get_libversion() >= v"1.12.0" + # These are missing in the macOS and Linux JLLs for h5 version 1.12+ + @test_broken HDF5.API.h5z_filter_avail(HDF5.API.H5Z_FILTER_SZIP) + end + @test HDF5.API.h5z_filter_avail(H5Z_FILTER_BZIP2) + @test HDF5.API.h5z_filter_avail(H5Z_FILTER_LZ4) + @test HDF5.API.h5z_filter_avail(H5Z_FILTER_ZSTD) + @test HDF5.API.h5z_filter_avail(H5Z_FILTER_BLOSC) + HDF5.API.h5z_unregister(H5Z_FILTER_LZ4) + HDF5.Filters.register_filter(H5Zlz4.Lz4Filter) + @test isavailable(H5Z_FILTER_LZ4) + @test isavailable(Lz4Filter) + @test isencoderenabled(H5Z_FILTER_LZ4) + @test isdecoderenabled(H5Z_FILTER_LZ4) + @test isencoderenabled(Lz4Filter) + @test isdecoderenabled(Lz4Filter) end # @testset "filter" diff --git a/test/filters/FilterTestUtils.jl b/test/filters/FilterTestUtils.jl index 86c58cf97..bdccd787d 100644 --- a/test/filters/FilterTestUtils.jl +++ b/test/filters/FilterTestUtils.jl @@ -24,18 +24,18 @@ function test_filter_init(; cd_values = Cuint[], data = ones(UInt8, 1024)) return flags, cd_values, nbytes, buf_size, buf end -function test_filter_compress!(filter_func, flags::Cuint, cd_values::Vector{Cuint}, nbytes::Integer, buf_size::Ref{Csize_t}, buf::Ref{Ptr{Cvoid}}) +function test_filter_compress!(filter_func, flags::Cuint, cd_values::Vector{Cuint}, + nbytes::Integer, buf_size::Ref{Csize_t}, + buf::Ref{Ptr{Cvoid}}) nbytes = Csize_t(nbytes) cd_nelmts = Csize_t(length(cd_values)) GC.@preserve flags cd_nelmts cd_values nbytes buf_size buf begin - ret_code = filter_func( - flags, - cd_nelmts, - pointer(cd_values), - Csize_t(nbytes), - Base.unsafe_convert(Ptr{Csize_t}, buf_size), - Base.unsafe_convert(Ptr{Ptr{Cvoid}}, buf) - ) + ret_code = filter_func(flags, + cd_nelmts, + pointer(cd_values), + Csize_t(nbytes), + Base.unsafe_convert(Ptr{Csize_t}, buf_size), + Base.unsafe_convert(Ptr{Ptr{Cvoid}}, buf)) @debug "Compression:" ret_code buf_size[] if ret_code <= 0 error("Test compression failed: $ret_code.") @@ -44,19 +44,19 @@ function test_filter_compress!(filter_func, flags::Cuint, cd_values::Vector{Cuin return ret_code end -function test_filter_decompress!(filter_func, flags::Cuint, cd_values::Vector{Cuint}, nbytes::Integer, buf_size::Ref{Csize_t}, buf::Ref{Ptr{Cvoid}}) +function test_filter_decompress!(filter_func, flags::Cuint, cd_values::Vector{Cuint}, + nbytes::Integer, buf_size::Ref{Csize_t}, + buf::Ref{Ptr{Cvoid}}) nbytes = Csize_t(nbytes) cd_nelmts = Csize_t(length(cd_values)) flags |= UInt32(API.H5Z_FLAG_REVERSE) GC.@preserve flags cd_nelmts cd_values nbytes buf_size buf begin - ret_code = filter_func( - flags, - cd_nelmts, - pointer(cd_values), - Csize_t(nbytes), - Base.unsafe_convert(Ptr{Csize_t},buf_size), - Base.unsafe_convert(Ptr{Ptr{Cvoid}}, buf) - ) + ret_code = filter_func(flags, + cd_nelmts, + pointer(cd_values), + Csize_t(nbytes), + Base.unsafe_convert(Ptr{Csize_t}, buf_size), + Base.unsafe_convert(Ptr{Ptr{Cvoid}}, buf)) @debug "Decompression:" ret_code buf_size[] end return ret_code @@ -66,23 +66,27 @@ function test_filter_cleanup!(buf::Ref{Ptr{Cvoid}}) Libc.free(buf[]) end -function test_filter(filter_func; cd_values::Vector{Cuint} = Cuint[], data = ones(UInt8, 1024)) - flags, cd_values, nbytes, buf_size, buf = test_filter_init(; cd_values = cd_values, data = data) +function test_filter(filter_func; cd_values::Vector{Cuint} = Cuint[], + data = ones(UInt8, 1024)) + flags, cd_values, nbytes, buf_size, buf = test_filter_init(; cd_values = cd_values, + data = data) nbytes_compressed, nbytes_decompressed = 0, 0 try - nbytes_compressed = test_filter_compress!(filter_func, flags, cd_values, nbytes, buf_size, buf) - nbytes_decompressed = test_filter_decompress!(filter_func, flags, cd_values, nbytes_compressed, buf_size, buf) + nbytes_compressed = test_filter_compress!(filter_func, flags, cd_values, nbytes, + buf_size, buf) + nbytes_decompressed = test_filter_decompress!(filter_func, flags, cd_values, + nbytes_compressed, buf_size, buf) if nbytes_decompressed > 0 # ret_code is the number of bytes out - round_trip_data = unsafe_wrap(Array,Ptr{UInt8}(buf[]), nbytes_decompressed) - @debug "Is the data the same after a roundtrip?" data == round_trip_data + round_trip_data = unsafe_wrap(Array, Ptr{UInt8}(buf[]), nbytes_decompressed) + @debug "Is the data the same after a roundtrip?" data==round_trip_data end catch err rethrow(err) finally test_filter_cleanup!(buf) end - @debug "Compression Ratio" nbytes_compressed / nbytes_decompressed + @debug "Compression Ratio" nbytes_compressed/nbytes_decompressed return nbytes_compressed, nbytes_decompressed end @@ -113,4 +117,4 @@ function __init__() end end -end \ No newline at end of file +end diff --git a/test/gc.jl b/test/gc.jl index c34eede9f..285b84f8a 100644 --- a/test/gc.jl +++ b/test/gc.jl @@ -3,11 +3,11 @@ using Test macro gcvalid(args...) Expr(:block, quote - GC.enable(true) - GC.gc() - GC.enable(false) - end, - [:(@test HDF5.isvalid($(esc(x)))) for x in args]...) + GC.enable(true) + GC.gc() + GC.enable(false) + end, + [:(@test HDF5.isvalid($(esc(x)))) for x in args]...) end macro closederror(x) @@ -16,59 +16,58 @@ macro closederror(x) $(esc(x)) catch e isa(e, ErrorException) || rethrow(e) - e.msg == "File or object has been closed" || error("Attempt to access closed object did not throw") + e.msg == "File or object has been closed" || + error("Attempt to access closed object did not throw") end end end @testset "gc" begin + GC.enable(false) + fn = tempname() + for i in 1:10 + file = h5open(fn, "w") + memtype_id = HDF5.API.h5t_create(HDF5.API.H5T_COMPOUND, 2 * sizeof(Float64)) + HDF5.API.h5t_insert(memtype_id, "real", 0, HDF5.hdf5_type_id(Float64)) + HDF5.API.h5t_insert(memtype_id, "imag", sizeof(Float64), HDF5.hdf5_type_id(Float64)) + dt = HDF5.Datatype(memtype_id) + commit_datatype(file, "dt", dt) + ds = dataspace((2,)) + d = create_dataset(file, "d", dt, ds) + g = create_group(file, "g") + a = create_attribute(file, "a", dt, ds) + @gcvalid dt ds d g a + close(file) -GC.enable(false) -fn = tempname() -for i = 1:10 - file = h5open(fn, "w") - memtype_id = HDF5.API.h5t_create(HDF5.API.H5T_COMPOUND, 2*sizeof(Float64)) - HDF5.API.h5t_insert(memtype_id, "real", 0, HDF5.hdf5_type_id(Float64)) - HDF5.API.h5t_insert(memtype_id, "imag", sizeof(Float64), HDF5.hdf5_type_id(Float64)) - dt = HDF5.Datatype(memtype_id) - commit_datatype(file, "dt", dt) - ds = dataspace((2,)) - d = create_dataset(file, "d", dt, ds) - g = create_group(file, "g") - a = create_attribute(file, "a", dt, ds) - @gcvalid dt ds d g a - close(file) - - @closederror read(d) - for obj in (d, g) - @closederror read_attribute(obj, "a") - @closederror write_attribute(obj, "a", 1) + @closederror read(d) + for obj in (d, g) + @closederror read_attribute(obj, "a") + @closederror write_attribute(obj, "a", 1) + end + for obj in (g, file) + @closederror open_dataset(obj, "d") + @closederror read_dataset(obj, "d") + @closederror write_dataset(obj, "d", 1) + @closederror read(obj, "x") + @closederror write(obj, "x", "y") + end end - for obj in (g, file) - @closederror open_dataset(obj, "d") - @closederror read_dataset(obj, "d") - @closederror write_dataset(obj, "d", 1) - @closederror read(obj, "x") - @closederror write(obj, "x", "y") + for i in 1:10 + file = h5open(fn, "r") + dt = file["dt"] + d = file["d"] + ds = dataspace(d) + g = file["g"] + a = attributes(file)["a"] + @gcvalid dt ds d g a + close(file) end -end -for i = 1:10 - file = h5open(fn, "r") - dt = file["dt"] - d = file["d"] - ds = dataspace(d) - g = file["g"] - a = attributes(file)["a"] - @gcvalid dt ds d g a - close(file) -end -GC.enable(true) - -let plist = HDF5.init!(HDF5.FileAccessProperties()) # related to issue #620 - HDF5.API.h5p_close(plist) - @test_nowarn finalize(plist) -end + GC.enable(true) -rm(fn) + let plist = HDF5.init!(HDF5.FileAccessProperties()) # related to issue #620 + HDF5.API.h5p_close(plist) + @test_nowarn finalize(plist) + end + rm(fn) end # testset gc diff --git a/test/memtest.jl b/test/memtest.jl index 30e8d7141..fa4e01c76 100644 --- a/test/memtest.jl +++ b/test/memtest.jl @@ -9,17 +9,19 @@ macro memtest(ex) $ex end # HDF5.h5_garbage_collect() - GC.gc(); print(rpad(i, 8)); run(PRINT_MEMORY) + GC.gc() + print(rpad(i, 8)) + run(PRINT_MEMORY) end end end @memtest h5open("/tmp/memtest.h5", "w") do file - dset = create_dataset(file, "A", datatype(DATA), dataspace(DATA), chunk=(100,)) + dset = create_dataset(file, "A", datatype(DATA), dataspace(DATA); chunk = (100,)) dset[:] = DATA[:] end @memtest h5open("/tmp/memtest.h5", "w") do file - file["A", chunk=(100,)] = DATA[:] + file["A", chunk = (100,)] = DATA[:] end @memtest h5open("/tmp/memtest.h5", "r") do file - file["A","dxpl_mpio", 0] + file["A", "dxpl_mpio", 0] end diff --git a/test/mmap.jl b/test/mmap.jl index 6b4394026..f2c9a2b3e 100644 --- a/test/mmap.jl +++ b/test/mmap.jl @@ -3,57 +3,56 @@ using Test @testset "mmap" begin -# Create a new file -fn = tempname() -f = h5open(fn, "w") -@test isopen(f) + # Create a new file + fn = tempname() + f = h5open(fn, "w") + @test isopen(f) -# Create two datasets, one with late allocation (the default for contiguous -# datasets) and the other with explicit early allocation. -hdf5_A = create_dataset(f, "A", datatype(Int64), dataspace(3,3)) -hdf5_B = create_dataset(f, "B", datatype(Float64), dataspace(3,3); - alloc_time = HDF5.API.H5D_ALLOC_TIME_EARLY) -# The late case cannot be mapped yet. -@test_throws ErrorException("Error getting offset") HDF5.readmmap(f["A"]) -# Then write and fill dataset A, making it mappable. B was filled with 0.0 at -# creation. -A = rand(Int64,3,3) -hdf5_A[:,:] = A -flush(f) -close(f) -# Read HDF5 file & MMAP -f = h5open(fn,"r") -A_mmaped = HDF5.readmmap(f["A"]) -@test all(A .== A_mmaped) -@test all(iszero, HDF5.readmmap(f["B"])) -# Check that it is read only -@test_throws ReadOnlyMemoryError A_mmaped[1,1] = 33 -close(f) -# Now check if we can write -f = h5open(fn,"r+") -A_mmaped = HDF5.readmmap(f["A"]) -A_mmaped[1,1] = 33 -close(f) - -# issue #863 - fix mmapping complex arrays -fn = tempname() -f = h5open(fn, "w") -A = rand(ComplexF32, 5, 5) -f["A"] = A -close(f) -f = h5open(fn, "r+") -complex_support = HDF5.COMPLEX_SUPPORT[] -# Complex arrays can be mmapped when complex support is enabled -complex_support || HDF5.enable_complex_support() -@test A == read(f["A"]) -@test A == HDF5.readmmap(f["A"]) -# But mmapping should throw an error when support is disabled -HDF5.disable_complex_support() -At = [(r = real(c), i = imag(c)) for c in A] -@test read(f["A"]) == At # readable as array of NamedTuples -@test_throws ErrorException("Cannot mmap datasets of type $(eltype(At))") HDF5.readmmap(f["A"]) -close(f) -# Restore complex support state -complex_support && HDF5.enable_complex_support() + # Create two datasets, one with late allocation (the default for contiguous + # datasets) and the other with explicit early allocation. + hdf5_A = create_dataset(f, "A", datatype(Int64), dataspace(3, 3)) + hdf5_B = create_dataset(f, "B", datatype(Float64), dataspace(3, 3); + alloc_time = HDF5.API.H5D_ALLOC_TIME_EARLY) + # The late case cannot be mapped yet. + @test_throws ErrorException("Error getting offset") HDF5.readmmap(f["A"]) + # Then write and fill dataset A, making it mappable. B was filled with 0.0 at + # creation. + A = rand(Int64, 3, 3) + hdf5_A[:, :] = A + flush(f) + close(f) + # Read HDF5 file & MMAP + f = h5open(fn, "r") + A_mmaped = HDF5.readmmap(f["A"]) + @test all(A .== A_mmaped) + @test all(iszero, HDF5.readmmap(f["B"])) + # Check that it is read only + @test_throws ReadOnlyMemoryError A_mmaped[1, 1]=33 + close(f) + # Now check if we can write + f = h5open(fn, "r+") + A_mmaped = HDF5.readmmap(f["A"]) + A_mmaped[1, 1] = 33 + close(f) + # issue #863 - fix mmapping complex arrays + fn = tempname() + f = h5open(fn, "w") + A = rand(ComplexF32, 5, 5) + f["A"] = A + close(f) + f = h5open(fn, "r+") + complex_support = HDF5.COMPLEX_SUPPORT[] + # Complex arrays can be mmapped when complex support is enabled + complex_support || HDF5.enable_complex_support() + @test A == read(f["A"]) + @test A == HDF5.readmmap(f["A"]) + # But mmapping should throw an error when support is disabled + HDF5.disable_complex_support() + At = [(r = real(c), i = imag(c)) for c in A] + @test read(f["A"]) == At # readable as array of NamedTuples + @test_throws ErrorException("Cannot mmap datasets of type $(eltype(At))") HDF5.readmmap(f["A"]) + close(f) + # Restore complex support state + complex_support && HDF5.enable_complex_support() end # testset diff --git a/test/mpio.jl b/test/mpio.jl index 7167a6dfe..0018b3229 100644 --- a/test/mpio.jl +++ b/test/mpio.jl @@ -3,77 +3,78 @@ using HDF5 using Test @testset "mpio" begin + HDF5.FileAccessProperties() do fapl + Drivers.set_driver!(fapl, Drivers.Core()) + end -HDF5.FileAccessProperties() do fapl - Drivers.set_driver!(fapl, Drivers.Core()) -end + MPI.Init() -MPI.Init() + info = MPI.Info() + comm = MPI.COMM_WORLD -info = MPI.Info() -comm = MPI.COMM_WORLD + nprocs = MPI.Comm_size(comm) + myrank = MPI.Comm_rank(comm) -nprocs = MPI.Comm_size(comm) -myrank = MPI.Comm_rank(comm) + @test HDF5.has_parallel() -@test HDF5.has_parallel() + # Check that serial drivers are still there after loading MPI (#928) + @test Drivers.Core โˆˆ values(Drivers.DRIVERS) + @test Drivers.POSIX โˆˆ values(Drivers.DRIVERS) -# Check that serial drivers are still there after loading MPI (#928) -@test Drivers.Core โˆˆ values(Drivers.DRIVERS) -@test Drivers.POSIX โˆˆ values(Drivers.DRIVERS) + let fileprop = HDF5.FileAccessProperties() + fileprop.driver = HDF5.Drivers.MPIO(comm, info) + driver = fileprop.driver + h5comm = driver.comm + h5info = driver.info -let fileprop = HDF5.FileAccessProperties() - fileprop.driver = HDF5.Drivers.MPIO(comm, info) - driver = fileprop.driver - h5comm = driver.comm - h5info = driver.info + # check that the two communicators point to the same group + if isdefined(MPI, :Comm_compare) # requires recent MPI.jl version + @test MPI.Comm_compare(comm, h5comm) === MPI.CONGRUENT + end + end - # check that the two communicators point to the same group - if isdefined(MPI, :Comm_compare) # requires recent MPI.jl version - @test MPI.Comm_compare(comm, h5comm) === MPI.CONGRUENT + # open file in parallel and write dataset + fn = MPI.bcast(tempname(), 0, comm) + A = [myrank + i for i in 1:10] + h5open(fn, "w", comm, info) do f + @test isopen(f) + g = create_group(f, "mygroup") + dset = create_dataset(g, "B", datatype(Int64), dataspace(10, nprocs); + chunk = (10, 1), dxpl_mpio = :collective) + dset[:, myrank + 1] = A end -end - -# open file in parallel and write dataset -fn = MPI.bcast(tempname(), 0, comm) -A = [myrank + i for i = 1:10] -h5open(fn, "w", comm, info) do f - @test isopen(f) - g = create_group(f, "mygroup") - dset = create_dataset(g, "B", datatype(Int64), dataspace(10, nprocs), chunk=(10, 1), dxpl_mpio=:collective) - dset[:, myrank + 1] = A -end - -MPI.Barrier(comm) -h5open(fn, comm) do f # default: opened in read mode, with default MPI.Info() - @test isopen(f) - @test keys(f) == ["mygroup"] - - B = read(f, "mygroup/B", dxpl_mpio=:collective) - @test !isempty(B) - @test A == vec(B[:, myrank + 1]) - B = f["mygroup/B", dxpl_mpio=:collective] - @test !isempty(B) - @test A == vec(B[:, myrank + 1]) -end + MPI.Barrier(comm) + h5open(fn, comm) do f # default: opened in read mode, with default MPI.Info() + @test isopen(f) + @test keys(f) == ["mygroup"] -MPI.Barrier(comm) + B = read(f, "mygroup/B"; dxpl_mpio = :collective) + @test !isempty(B) + @test A == vec(B[:, myrank + 1]) -B = h5read(fn, "mygroup/B", driver = HDF5.Drivers.MPIO(comm, info), dxpl_mpio=:collective) -@test A == vec(B[:, myrank + 1]) + B = f["mygroup/B", dxpl_mpio = :collective] + @test !isempty(B) + @test A == vec(B[:, myrank + 1]) + end + + MPI.Barrier(comm) -MPI.Barrier(comm) + B = h5read(fn, "mygroup/B"; driver = HDF5.Drivers.MPIO(comm, info), + dxpl_mpio = :collective) + @test A == vec(B[:, myrank + 1]) -B = h5read(fn, "mygroup/B", (:, myrank + 1), driver=HDF5.Drivers.MPIO(comm, info), dxpl_mpio=:collective) -@test A == vec(B) + MPI.Barrier(comm) -# we need to close HDF5 and finalize the info object before finalizing MPI -finalize(info) -HDF5.API.h5_close() + B = h5read(fn, "mygroup/B", (:, myrank + 1); driver = HDF5.Drivers.MPIO(comm, info), + dxpl_mpio = :collective) + @test A == vec(B) -MPI.Barrier(MPI.COMM_WORLD) + # we need to close HDF5 and finalize the info object before finalizing MPI + finalize(info) + HDF5.API.h5_close() -MPI.Finalize() + MPI.Barrier(MPI.COMM_WORLD) + MPI.Finalize() end # testset mpio diff --git a/test/nonallocating.jl b/test/nonallocating.jl index ff00699f3..7a540da88 100644 --- a/test/nonallocating.jl +++ b/test/nonallocating.jl @@ -19,20 +19,20 @@ using Test v = h5f["data"][1:4, 1:4] buffer = similar(v) - @test size(buffer) == (4,4) + @test size(buffer) == (4, 4) copyto!(buffer, v) @test isequal(buffer, @view(data[1:4, 1:4])) @test size(similar(h5f["data"], Int16)) == size(h5f["data"]) - @test size(similar(h5f["data"], 5,6)) == (5, 6) - @test size(similar(h5f["data"], Int16, 8,7)) == (8,7) - @test size(similar(h5f["data"], Int16, 8,7; normalize = false)) == (8,7) - @test_broken size(similar(h5f["data"], Int8, 8,7)) == (8,7) - - @test size(similar(h5f["data"], (5,6))) == (5, 6) - @test size(similar(h5f["data"], Int16, (8,7))) == (8,7) - @test size(similar(h5f["data"], Int16, (8,7); normalize = false)) == (8,7) - @test size(similar(h5f["data"], Int16, 0x8,0x7; normalize = false)) == (8,7) + @test size(similar(h5f["data"], 5, 6)) == (5, 6) + @test size(similar(h5f["data"], Int16, 8, 7)) == (8, 7) + @test size(similar(h5f["data"], Int16, 8, 7; normalize = false)) == (8, 7) + @test_broken size(similar(h5f["data"], Int8, 8, 7)) == (8, 7) + + @test size(similar(h5f["data"], (5, 6))) == (5, 6) + @test size(similar(h5f["data"], Int16, (8, 7))) == (8, 7) + @test size(similar(h5f["data"], Int16, (8, 7); normalize = false)) == (8, 7) + @test size(similar(h5f["data"], Int16, 0x8, 0x7; normalize = false)) == (8, 7) end rm(fn) diff --git a/test/objects.jl b/test/objects.jl index c197f83e3..dc49b2388 100644 --- a/test/objects.jl +++ b/test/objects.jl @@ -64,15 +64,12 @@ using HDF5.API @test oninfo.hdr.mesg.present > 0 end - oinfo = API.h5o_get_info_by_idx( - h5f, ".", API.H5_INDEX_NAME, API.H5_ITER_INC, 0 - ) + oinfo = API.h5o_get_info_by_idx(h5f, ".", API.H5_INDEX_NAME, API.H5_ITER_INC, 0) @test oinfo.num_attrs == 0 @static if HDF5.API.h5_get_libversion() >= v"1.12.0" - oninfo = API.h5o_get_native_info_by_idx( - h5f, ".", API.H5_INDEX_NAME, API.H5_ITER_INC, 1 - ) + oninfo = API.h5o_get_native_info_by_idx(h5f, ".", API.H5_INDEX_NAME, + API.H5_ITER_INC, 1) @test oninfo.hdr.version > 0 @test oninfo.hdr.nmesgs > 0 @test oninfo.hdr.nchunks > 0 @@ -83,6 +80,5 @@ using HDF5.API @test oninfo.hdr.space.free > 0 @test oninfo.hdr.mesg.present > 0 end - end end diff --git a/test/plain.jl b/test/plain.jl index 313db01c6..10fff092b 100644 --- a/test/plain.jl +++ b/test/plain.jl @@ -5,1293 +5,1321 @@ using Test gatherf(dst_buf, dst_buf_bytes_used, op_data) = HDF5.API.herr_t(0) gatherf_bad(dst_buf, dst_buf_bytes_used, op_data) = HDF5.API.herr_t(-1) -gatherf_data(dst_buf, dst_buf_bytes_used, op_data) = HDF5.API.herr_t((op_data == 9)-1) - +gatherf_data(dst_buf, dst_buf_bytes_used, op_data) = HDF5.API.herr_t((op_data == 9) - 1) function scatterf(src_buf, src_buf_bytes_used, op_data) - A = [1,2,3,4] + A = [1, 2, 3, 4] unsafe_store!(src_buf, pointer(A)) unsafe_store!(src_buf_bytes_used, sizeof(A)) return HDF5.API.herr_t(0) end scatterf_bad(src_buf, src_buf_bytes_used, op_data) = HDF5.API.herr_t(-1) function scatterf_data(src_buf, src_buf_bytes_used, op_data) - A = [1,2,3,4] + A = [1, 2, 3, 4] unsafe_store!(src_buf, pointer(A)) unsafe_store!(src_buf_bytes_used, sizeof(A)) - return HDF5.API.herr_t((op_data == 9)-1) + return HDF5.API.herr_t((op_data == 9) - 1) end @testset "plain" begin -# Create a new file -fn = tempname() -f = h5open(fn, "w") -@test isopen(f) -# Write scalars -f["Float64"] = 3.2 -f["Int16"] = Int16(4) -# compression of empty array (issue #246) -f["compressedempty", shuffle=true, deflate=4] = Int64[] -# compression of zero-dimensional array (pull request #445) -f["compressed_zerodim", shuffle=true, deflate=4] = fill(Int32(42), ()) -f["bloscempty", blosc=4] = Int64[] -# test creation of an anonymouse dataset -f[nothing] = 5 -# Create arrays of different types -A = randn(3, 5) -write(f, "Afloat64", convert(Matrix{Float64}, A)) -write(f, "Afloat32", convert(Matrix{Float32}, A)) -Ai = rand(1:20, 2, 4) -write(f, "Aint8", convert(Matrix{Int8}, Ai)) -f["Aint16"] = convert(Matrix{Int16}, Ai) -write(f, "Aint32", convert(Matrix{Int32}, Ai)) -write(f, "Aint64", convert(Matrix{Int64}, Ai)) -write(f, "Auint8", convert(Matrix{UInt8}, Ai)) -write(f, "Auint16", convert(Matrix{UInt16}, Ai)) - -# test writing multiple variable (issue #599) -write(f, "Auint32", convert(Matrix{UInt32}, Ai), "Auint64", convert(Matrix{UInt64}, Ai)) - -# Arrays of bools (pull request #540) -Abool = [false, true, false] -write(f, "Abool", Abool) - -salut = "Hi there" -ucode = "uniรงยบโˆ‚e" -write(f, "salut", salut) -write(f, "ucode", ucode) -# Manually write a variable-length string (issue #187) -let - dtype = HDF5.Datatype(HDF5.API.h5t_copy(HDF5.API.H5T_C_S1)) - HDF5.API.h5t_set_size(dtype, HDF5.API.H5T_VARIABLE) - HDF5.API.h5t_set_cset(dtype, HDF5.cset(typeof(salut))) - dspace = dataspace(salut) - dset = create_dataset(f, "salut-vlen", dtype, dspace) - GC.@preserve salut begin - HDF5.API.h5d_write(dset, dtype, HDF5.API.H5S_ALL, HDF5.API.H5S_ALL, HDF5.API.H5P_DEFAULT, [pointer(salut)]) + # Create a new file + fn = tempname() + f = h5open(fn, "w") + @test isopen(f) + # Write scalars + f["Float64"] = 3.2 + f["Int16"] = Int16(4) + # compression of empty array (issue #246) + f["compressedempty", shuffle = true, deflate = 4] = Int64[] + # compression of zero-dimensional array (pull request #445) + f["compressed_zerodim", shuffle = true, deflate = 4] = fill(Int32(42), ()) + f["bloscempty", blosc = 4] = Int64[] + # test creation of an anonymouse dataset + f[nothing] = 5 + # Create arrays of different types + A = randn(3, 5) + write(f, "Afloat64", convert(Matrix{Float64}, A)) + write(f, "Afloat32", convert(Matrix{Float32}, A)) + Ai = rand(1:20, 2, 4) + write(f, "Aint8", convert(Matrix{Int8}, Ai)) + f["Aint16"] = convert(Matrix{Int16}, Ai) + write(f, "Aint32", convert(Matrix{Int32}, Ai)) + write(f, "Aint64", convert(Matrix{Int64}, Ai)) + write(f, "Auint8", convert(Matrix{UInt8}, Ai)) + write(f, "Auint16", convert(Matrix{UInt16}, Ai)) + + # test writing multiple variable (issue #599) + write(f, "Auint32", convert(Matrix{UInt32}, Ai), "Auint64", convert(Matrix{UInt64}, Ai)) + + # Arrays of bools (pull request #540) + Abool = [false, true, false] + write(f, "Abool", Abool) + + salut = "Hi there" + ucode = "uniรงยบโˆ‚e" + write(f, "salut", salut) + write(f, "ucode", ucode) + # Manually write a variable-length string (issue #187) + let + dtype = HDF5.Datatype(HDF5.API.h5t_copy(HDF5.API.H5T_C_S1)) + HDF5.API.h5t_set_size(dtype, HDF5.API.H5T_VARIABLE) + HDF5.API.h5t_set_cset(dtype, HDF5.cset(typeof(salut))) + dspace = dataspace(salut) + dset = create_dataset(f, "salut-vlen", dtype, dspace) + GC.@preserve salut begin HDF5.API.h5d_write(dset, dtype, HDF5.API.H5S_ALL, + HDF5.API.H5S_ALL, HDF5.API.H5P_DEFAULT, + [pointer(salut)]) end + end + # Arrays of strings + salut_split = ["Hi", "there"] + write(f, "salut_split", salut_split) + salut_2d = ["Hi" "there"; "Salut" "friend"] + write(f, "salut_2d", salut_2d) + # Arrays of strings as vlen + vlen = HDF5.VLen(salut_split) + write_dataset(f, "salut_vlen", vlen) + # Arrays of scalars as vlen + vlen_int = [[3], [1], [4]] + vleni = HDF5.VLen(vlen_int) + write_dataset(f, "int_vlen", vleni) + write_attribute(f["int_vlen"], "vlen_attr", vleni) + # Empty arrays + empty = UInt32[] + write(f, "empty", empty) + write(f, nothing, empty) + # Empty strings + empty_string = "" + write(f, "empty_string", empty_string) + # Empty array of strings + empty_string_array = String[] + write(f, "empty_string_array", empty_string_array) + # Array of empty string + empty_array_of_strings = [""] + write(f, "empty_array_of_strings", empty_array_of_strings) + # attributes + species = [["N", "C"]; ["A", "B"]] + attributes(f)["species"] = species + @test read(attributes(f)["species"]) == species + @test attributes(f)["species"][] == species + Cโˆž = 42 + attributes(f)["Cโˆž"] = Cโˆž + dset = f["salut"] + @test !isempty(dset) + label = "This is a string" + attributes(dset)["typeinfo"] = label + @test read(attributes(dset)["typeinfo"]) == label + @test attributes(dset)["typeinfo"][] == label + @test dset["typeinfo"][] == label + close(dset) + # Scalar reference values in attributes + attributes(f)["ref_test"] = HDF5.Reference(f, "empty_array_of_strings") + @test read(attributes(f)["ref_test"]) === HDF5.Reference(f, "empty_array_of_strings") + # Group + g = create_group(f, "mygroup") + # Test dataset with compression + R = rand(1:20, 20, 40) + g["CompressedA", chunk = (5, 6), shuffle = true, deflate = 9] = R + g["BloscA", chunk = (5, 6), shuffle = true, blosc = 9] = R + close(g) + # Copy group containing dataset + copy_object(f, "mygroup", f, "mygroup2") + # Copy dataset + g = create_group(f, "mygroup3") + copy_object(f["mygroup/CompressedA"], g, "CompressedA") + copy_object(f["mygroup/BloscA"], g, "BloscA") + close(g) + # Writing hyperslabs + dset = create_dataset(f, "slab", datatype(Float64), dataspace(20, 20, 5); + chunk = (5, 5, 1)) + Xslab = randn(20, 20, 5) + for i in 1:5 + dset[:, :, i] = Xslab[:, :, i] + end + dset = create_dataset(f, nothing, datatype(Float64), dataspace(20, 20, 5); + chunk = (5, 5, 1)) + dset[:, :, :] = 3.0 + # More complex hyperslab and assignment with "incorrect" types (issue #34) + d = create_dataset(f, "slab2", datatype(Float64), ((10, 20), (100, 200)); + chunk = (1, 1)) + d[:, :] = 5 + d[1, 1] = 4 + # 1d indexing + d = create_dataset(f, "slab3", datatype(Int), ((10,), (-1,)); chunk = (5,)) + @test d[:] == zeros(Int, 10) + d[3:5] = 3:5 + # Create a dataset designed to be deleted + f["deleteme"] = 17.2 + close(f) + @test !isopen(f) + # Test the h5read/write interface, with attributes + W = copy(reshape(1:120, 15, 8)) + Wa = Dict("a" => 1, "b" => 2) + h5write(fn, "newgroup/W", W) + h5writeattr(fn, "newgroup/W", Wa) + + # Read the file back in + fr = h5open(fn) + x = read(fr, "Float64") + @test x == 3.2 && isa(x, Float64) + y = read(fr, "Int16") + @test y == 4 && isa(y, Int16) + zerodim = read(fr, "compressed_zerodim") + @test zerodim == 42 && isa(zerodim, Int32) + bloscempty = read(fr, "bloscempty") + @test bloscempty == Int64[] && isa(bloscempty, Vector{Int64}) + Af32 = read(fr, "Afloat32") + @test convert(Matrix{Float32}, A) == Af32 + @test eltype(Af32) == Float32 + Af64 = read(fr, "Afloat64") + @test convert(Matrix{Float64}, A) == Af64 + @test eltype(Af64) == Float64 + @test eltype(fr["Afloat64"]) == Float64 # issue 167 + Ai8 = read(fr, "Aint8") + @test Ai == Ai8 + @test eltype(Ai8) == Int8 + Ai16 = read(fr, "Aint16") + @test Ai == Ai16 + @test eltype(Ai16) == Int16 + Ai32 = read(fr, "Aint32") + @test Ai == Ai32 + @test eltype(Ai32) == Int32 + Ai64 = read(fr, "Aint64") + @test Ai == Ai64 + @test eltype(Ai64) == Int64 + Ai8 = read(fr, "Auint8") + @test Ai == Ai8 + @test eltype(Ai8) == UInt8 + Ai16 = read(fr, "Auint16") + @test Ai == Ai16 + @test eltype(Ai16) == UInt16 + Ai32 = read(fr, "Auint32") + @test Ai == Ai32 + @test eltype(Ai32) == UInt32 + Ai64 = read(fr, "Auint64") + @test Ai == Ai64 + @test eltype(Ai64) == UInt64 + + Abool_read = read(fr, "Abool") + @test Abool_read == Abool + @test eltype(Abool_read) == Bool + + salutr = read(fr, "salut") + @test salut == salutr + salutr = read(fr, "salut-vlen") + @test salut == salutr + ucoder = read(fr, "ucode") + @test ucode == ucoder + salut_splitr = read(fr, "salut_split") + @test salut_splitr == salut_split + salut_2dr = read(fr, "salut_2d") + @test salut_2d == salut_2dr + salut_vlenr = read(fr, "salut_vlen") + @test HDF5.vlen_get_buf_size(fr["salut_vlen"]) == 7 + @test HDF5.API.h5d_get_access_plist(fr["salut-vlen"]) != 0 + #@test salut_vlenr == salut_split + vlen_intr = read(fr, "int_vlen") + @test vlen_intr == vlen_int + vlen_attrr = read(fr["int_vlen"]["vlen_attr"]) + @test vlen_attrr == vlen_int + Rr = read(fr, "mygroup/CompressedA") + @test Rr == R + Rr2 = read(fr, "mygroup2/CompressedA") + @test Rr2 == R + Rr3 = read(fr, "mygroup3/CompressedA") + @test Rr3 == R + Rr4 = read(fr, "mygroup/BloscA") + @test Rr4 == R + Rr5 = read(fr, "mygroup2/BloscA") + @test Rr5 == R + Rr6 = read(fr, "mygroup3/BloscA") + @test Rr6 == R + dset = fr["mygroup/CompressedA"] + @test HDF5.get_chunk(dset) == (5, 6) + @test HDF5.name(dset) == "/mygroup/CompressedA" + dset2 = fr["mygroup/BloscA"] + @test HDF5.get_chunk(dset2) == (5, 6) + @test HDF5.name(dset2) == "/mygroup/BloscA" + Xslabr = read(fr, "slab") + @test Xslabr == Xslab + Xslabr = h5read(fn, "slab", (:, :, :)) # issue #87 + @test Xslabr == Xslab + Xslab2r = read(fr, "slab2") + target = fill(5, 10, 20) + target[1] = 4 + @test Xslab2r == target + dset = fr["slab3"] + @test dset[3:5] == [3:5;] + emptyr = read(fr, "empty") + @test isempty(emptyr) + empty_stringr = read(fr, "empty_string") + @test empty_stringr == empty_string + empty_string_arrayr = read(fr, "empty_string_array") + @test empty_string_arrayr == empty_string_array + empty_array_of_stringsr = read(fr, "empty_array_of_strings") + @test empty_array_of_stringsr == empty_array_of_strings + @test read_attribute(fr, "species") == species + @test read_attribute(fr, "Cโˆž") == Cโˆž + dset = fr["salut"] + @test read_attribute(dset, "typeinfo") == label + close(dset) + # Test ref-based reading + Aref = fr["Afloat64"] + sel = (2:3, 1:2:5) + Asub = Aref[sel...] + @test Asub == A[sel...] + close(Aref) + # Test iteration, name, and parent + for obj in fr + @test HDF5.filename(obj) == fn + n = HDF5.name(obj) + p = parent(obj) + end + # Test reading multiple vars at once + z = read(fr, "Float64", "Int16") + @test z == (3.2, 4) + @test typeof(z) == Tuple{Float64,Int16} + # Test reading entire file at once + z = read(fr) + @test z["Float64"] == 3.2 + close(fr) + + # Test object deletion + fr = h5open(fn, "r+") + @test haskey(fr, "deleteme") + delete_object(fr, "deleteme") + @test !haskey(fr, "deleteme") + close(fr) + + # Test object move + h5open(fn, "r+") do io + io["moveme"] = [1, 2, 3] + create_group(io, "moveto") end -end -# Arrays of strings -salut_split = ["Hi", "there"] -write(f, "salut_split", salut_split) -salut_2d = ["Hi" "there"; "Salut" "friend"] -write(f, "salut_2d", salut_2d) -# Arrays of strings as vlen -vlen = HDF5.VLen(salut_split) -write_dataset(f, "salut_vlen", vlen) -# Arrays of scalars as vlen -vlen_int = [[3], [1], [4]] -vleni = HDF5.VLen(vlen_int) -write_dataset(f, "int_vlen", vleni) -write_attribute(f["int_vlen"], "vlen_attr", vleni) -# Empty arrays -empty = UInt32[] -write(f, "empty", empty) -write(f, nothing, empty) -# Empty strings -empty_string = "" -write(f, "empty_string", empty_string) -# Empty array of strings -empty_string_array = String[] -write(f, "empty_string_array", empty_string_array) -# Array of empty string -empty_array_of_strings = [""] -write(f, "empty_array_of_strings", empty_array_of_strings) -# attributes -species = [["N", "C"]; ["A", "B"]] -attributes(f)["species"] = species -@test read(attributes(f)["species"]) == species -@test attributes(f)["species"][] == species -Cโˆž = 42 -attributes(f)["Cโˆž"] = Cโˆž -dset = f["salut"] -@test !isempty(dset) -label = "This is a string" -attributes(dset)["typeinfo"] = label -@test read(attributes(dset)["typeinfo"]) == label -@test attributes(dset)["typeinfo"][] == label -@test dset["typeinfo"][] == label -close(dset) -# Scalar reference values in attributes -attributes(f)["ref_test"] = HDF5.Reference(f, "empty_array_of_strings") -@test read(attributes(f)["ref_test"]) === HDF5.Reference(f, "empty_array_of_strings") -# Group -g = create_group(f, "mygroup") -# Test dataset with compression -R = rand(1:20, 20, 40); -g["CompressedA", chunk=(5, 6), shuffle=true, deflate=9] = R -g["BloscA", chunk=(5, 6), shuffle=true, blosc=9] = R -close(g) -# Copy group containing dataset -copy_object(f, "mygroup", f, "mygroup2") -# Copy dataset -g = create_group(f, "mygroup3") -copy_object(f["mygroup/CompressedA"], g, "CompressedA") -copy_object(f["mygroup/BloscA"], g, "BloscA") -close(g) -# Writing hyperslabs -dset = create_dataset(f, "slab", datatype(Float64), dataspace(20, 20, 5), chunk=(5, 5, 1)) -Xslab = randn(20, 20, 5) -for i = 1:5 - dset[:,:,i] = Xslab[:,:,i] -end -dset = create_dataset(f, nothing, datatype(Float64), dataspace(20, 20, 5), chunk=(5, 5, 1)) -dset[:, :, :] = 3.0 -# More complex hyperslab and assignment with "incorrect" types (issue #34) -d = create_dataset(f, "slab2", datatype(Float64), ((10, 20), (100, 200)), chunk=(1, 1)) -d[:,:] = 5 -d[1,1] = 4 -# 1d indexing -d = create_dataset(f, "slab3", datatype(Int), ((10,), (-1,)), chunk=(5,)) -@test d[:] == zeros(Int, 10) -d[3:5] = 3:5 -# Create a dataset designed to be deleted -f["deleteme"] = 17.2 -close(f) -@test !isopen(f) -# Test the h5read/write interface, with attributes -W = copy(reshape(1:120, 15, 8)) -Wa = Dict("a" => 1, "b" => 2) -h5write(fn, "newgroup/W", W) -h5writeattr(fn, "newgroup/W", Wa) - -# Read the file back in -fr = h5open(fn) -x = read(fr, "Float64") -@test x == 3.2 && isa(x, Float64) -y = read(fr, "Int16") -@test y == 4 && isa(y, Int16) -zerodim = read(fr, "compressed_zerodim") -@test zerodim == 42 && isa(zerodim, Int32) -bloscempty = read(fr, "bloscempty") -@test bloscempty == Int64[] && isa(bloscempty, Vector{Int64}) -Af32 = read(fr, "Afloat32") -@test convert(Matrix{Float32}, A) == Af32 -@test eltype(Af32) == Float32 -Af64 = read(fr, "Afloat64") -@test convert(Matrix{Float64}, A) == Af64 -@test eltype(Af64) == Float64 -@test eltype(fr["Afloat64"]) == Float64 # issue 167 -Ai8 = read(fr, "Aint8") -@test Ai == Ai8 -@test eltype(Ai8) == Int8 -Ai16 = read(fr, "Aint16") -@test Ai == Ai16 -@test eltype(Ai16) == Int16 -Ai32 = read(fr, "Aint32") -@test Ai == Ai32 -@test eltype(Ai32) == Int32 -Ai64 = read(fr, "Aint64") -@test Ai == Ai64 -@test eltype(Ai64) == Int64 -Ai8 = read(fr, "Auint8") -@test Ai == Ai8 -@test eltype(Ai8) == UInt8 -Ai16 = read(fr, "Auint16") -@test Ai == Ai16 -@test eltype(Ai16) == UInt16 -Ai32 = read(fr, "Auint32") -@test Ai == Ai32 -@test eltype(Ai32) == UInt32 -Ai64 = read(fr, "Auint64") -@test Ai == Ai64 -@test eltype(Ai64) == UInt64 - -Abool_read = read(fr, "Abool") -@test Abool_read == Abool -@test eltype(Abool_read) == Bool - -salutr = read(fr, "salut") -@test salut == salutr -salutr = read(fr, "salut-vlen") -@test salut == salutr -ucoder = read(fr, "ucode") -@test ucode == ucoder -salut_splitr = read(fr, "salut_split") -@test salut_splitr == salut_split -salut_2dr = read(fr, "salut_2d") -@test salut_2d == salut_2dr -salut_vlenr = read(fr, "salut_vlen") -@test HDF5.vlen_get_buf_size(fr["salut_vlen"]) == 7 -@test HDF5.API.h5d_get_access_plist(fr["salut-vlen"]) != 0 -#@test salut_vlenr == salut_split -vlen_intr = read(fr, "int_vlen") -@test vlen_intr == vlen_int -vlen_attrr = read(fr["int_vlen"]["vlen_attr"]) -@test vlen_attrr == vlen_int -Rr = read(fr, "mygroup/CompressedA") -@test Rr == R -Rr2 = read(fr, "mygroup2/CompressedA") -@test Rr2 == R -Rr3 = read(fr, "mygroup3/CompressedA") -@test Rr3 == R -Rr4 = read(fr, "mygroup/BloscA") -@test Rr4 == R -Rr5 = read(fr, "mygroup2/BloscA") -@test Rr5 == R -Rr6 = read(fr, "mygroup3/BloscA") -@test Rr6 == R -dset = fr["mygroup/CompressedA"] -@test HDF5.get_chunk(dset) == (5, 6) -@test HDF5.name(dset) == "/mygroup/CompressedA" -dset2 = fr["mygroup/BloscA"] -@test HDF5.get_chunk(dset2) == (5, 6) -@test HDF5.name(dset2) == "/mygroup/BloscA" -Xslabr = read(fr, "slab") -@test Xslabr == Xslab -Xslabr = h5read(fn, "slab", (:, :, :)) # issue #87 -@test Xslabr == Xslab -Xslab2r = read(fr, "slab2") -target = fill(5, 10, 20) -target[1] = 4 -@test Xslab2r == target -dset = fr["slab3"] -@test dset[3:5] == [3:5;] -emptyr = read(fr, "empty") -@test isempty(emptyr) -empty_stringr = read(fr, "empty_string") -@test empty_stringr == empty_string -empty_string_arrayr = read(fr, "empty_string_array") -@test empty_string_arrayr == empty_string_array -empty_array_of_stringsr = read(fr, "empty_array_of_strings") -@test empty_array_of_stringsr == empty_array_of_strings -@test read_attribute(fr, "species") == species -@test read_attribute(fr, "Cโˆž") == Cโˆž -dset = fr["salut"] -@test read_attribute(dset, "typeinfo") == label -close(dset) -# Test ref-based reading -Aref = fr["Afloat64"] -sel = (2:3, 1:2:5) -Asub = Aref[sel...] -@test Asub == A[sel...] -close(Aref) -# Test iteration, name, and parent -for obj in fr - @test HDF5.filename(obj) == fn - n = HDF5.name(obj) - p = parent(obj) -end -# Test reading multiple vars at once -z = read(fr, "Float64", "Int16") -@test z == (3.2, 4) -@test typeof(z) == Tuple{Float64,Int16} -# Test reading entire file at once -z = read(fr) -@test z["Float64"] == 3.2 -close(fr) - -# Test object deletion -fr = h5open(fn, "r+") -@test haskey(fr, "deleteme") -delete_object(fr, "deleteme") -@test !haskey(fr, "deleteme") -close(fr) - -# Test object move -h5open(fn, "r+") do io - io["moveme"] = [1,2,3] - create_group(io, "moveto") -end - -h5open(fn, "r+") do io - @test haskey(io, "moveme") - @test haskey(io, "moveto") && !haskey(io, "moveto/moveme") - move_link(io, "moveme", io["moveto"]) - @test haskey(io, "moveto/moveme") && !haskey(io, "moveme") -end -# Test the h5read interface -Wr = h5read(fn, "newgroup/W") -@test Wr == W -rng = (2:3:15, 3:5) -Wr = h5read(fn, "newgroup/W", rng) -@test Wr == W[rng...] -War = h5readattr(fn, "newgroup/W") -@test War == Wa - -# issue #618 -# Test that invalid writes treat implicit creation as a transaction, cleaning up the partial -# operation -hid = h5open(fn, "w") -A = rand(3, 3)' -@test !haskey(hid, "A") -@test_throws ArgumentError write(hid, "A", A) -@test !haskey(hid, "A") -dset = create_dataset(hid, "attr", datatype(Int), dataspace(0)) -@test !haskey(attributes(dset), "attr") -# broken test - writing attributes does not check that the stride is correct -@test_skip @test_throws ArgumentError write(dset, "attr", A) -@test !haskey(attributes(dset), "attr") -close(hid) - -# more do syntax -h5open(fn, "w") do fid - g = create_group(fid, "mygroup") - write(g, "x", 3.2) -end + h5open(fn, "r+") do io + @test haskey(io, "moveme") + @test haskey(io, "moveto") && !haskey(io, "moveto/moveme") + move_link(io, "moveme", io["moveto"]) + @test haskey(io, "moveto/moveme") && !haskey(io, "moveme") + end -fid = h5open(fn, "r") -@test keys(fid) == ["mygroup"] -g = fid["mygroup"] -@test keys(g) == ["x"] -close(g) -close(fid) -rm(fn) - -# more do syntax: atomic rename version -tmpdir = mktempdir() -outfile = joinpath(tmpdir, "test.h5") - -# create a new file -h5rewrite(outfile) do fid - g = create_group(fid, "mygroup") - write(g, "x", 3.3) -end -@test length(readdir(tmpdir)) == 1 -h5open(outfile, "r") do fid - @test keys(fid) == ["mygroup"] - @test keys(fid["mygroup"]) == ["x"] -end + # Test the h5read interface + Wr = h5read(fn, "newgroup/W") + @test Wr == W + rng = (2:3:15, 3:5) + Wr = h5read(fn, "newgroup/W", rng) + @test Wr == W[rng...] + War = h5readattr(fn, "newgroup/W") + @test War == Wa + + # issue #618 + # Test that invalid writes treat implicit creation as a transaction, cleaning up the partial + # operation + hid = h5open(fn, "w") + A = rand(3, 3)' + @test !haskey(hid, "A") + @test_throws ArgumentError write(hid, "A", A) + @test !haskey(hid, "A") + dset = create_dataset(hid, "attr", datatype(Int), dataspace(0)) + @test !haskey(attributes(dset), "attr") + # broken test - writing attributes does not check that the stride is correct + @test_skip @test_throws ArgumentError write(dset, "attr", A) + @test !haskey(attributes(dset), "attr") + close(hid) + + # more do syntax + h5open(fn, "w") do fid + g = create_group(fid, "mygroup") + write(g, "x", 3.2) + end -# fail to overwrite -@test_throws ErrorException h5rewrite(outfile) do fid - g = create_group(fid, "mygroup") - write(g, "oops", 3.3) - error("failed") -end -@test length(readdir(tmpdir)) == 1 -h5open(outfile, "r") do fid + fid = h5open(fn, "r") @test keys(fid) == ["mygroup"] - @test keys(fid["mygroup"]) == ["x"] -end + g = fid["mygroup"] + @test keys(g) == ["x"] + close(g) + close(fid) + rm(fn) -# overwrite -h5rewrite(outfile) do fid - g = create_group(fid, "mygroup") - write(g, "y", 3.3) -end -@test length(readdir(tmpdir)) == 1 -h5open(outfile, "r") do fid - @test keys(fid) == ["mygroup"] - @test keys(fid["mygroup"]) == ["y"] -end -rm(tmpdir, recursive=true) - -test_files = joinpath(@__DIR__, "test_files") - -d = h5read(joinpath(test_files, "compound.h5"), "/data") -@test typeof(d[1]) == NamedTuple{(:wgt, :xyz, :uvw, :E), Tuple{Float64, Array{Float64, 1}, Array{Float64, 1}, Float64}} - -# get-datasets -fn = tempname() -fd = h5open(fn, "w") -fd["level_0"] = [1,2,3] -grp = create_group(fd, "mygroup") -fd["mygroup/level_1"] = [4, 5] -grp2 = create_group(grp, "deep_group") -fd["mygroup/deep_group/level_2"] = [6.0, 7.0] -datasets = HDF5.get_datasets(fd) -@test sort(map(HDF5.name, datasets)) == sort(["/level_0", "/mygroup/deep_group/level_2", "/mygroup/level_1"]) -close(fd) -rm(fn) - -# File creation and access property lists -fid = h5open(fn, "w", userblock=1024, libver_bounds=(HDF5.API.H5F_LIBVER_EARLIEST, HDF5.API.H5F_LIBVER_LATEST)) -write(fid, "intarray", [1, 2, 3]) -close(fid) -h5open(fn, "r", libver_bounds=(HDF5.API.H5F_LIBVER_EARLIEST, HDF5.API.H5F_LIBVER_LATEST)) do fid - intarray = read(fid, "intarray") - @test intarray == [1, 2, 3] -end + # more do syntax: atomic rename version + tmpdir = mktempdir() + outfile = joinpath(tmpdir, "test.h5") -# Test null terminated ASCII string (e.g. exported by h5py) #332 -h5open(joinpath(test_files, "nullterm_ascii.h5"), "r") do fid - str = read(fid["test"]) - @test str == "Hello World" -end + # create a new file + h5rewrite(outfile) do fid + g = create_group(fid, "mygroup") + write(g, "x", 3.3) + end + @test length(readdir(tmpdir)) == 1 + h5open(outfile, "r") do fid + @test keys(fid) == ["mygroup"] + @test keys(fid["mygroup"]) == ["x"] + end -@test HDF5.unpad(UInt8[0x43, 0x43, 0x41], 1) == "CCA" - -# Test the h5read/write interface with a filename as a first argument, when -# the file does not exist -rm(fn) -h5write(fn, "newgroup/W", W) -Wr = h5read(fn, "newgroup/W") -@test Wr == W -close(f) -rm(fn) - -# Test dataspace convenience versions of create_dataset -try - h5open(fn, "w") do f - create_dataset(f, "test", Int, (128, 32)) - create_dataset(f, "test2", Float64, 128, 64) - @test size(f["test"]) == (128, 32) - @test size(f["test2"]) == (128, 64) + # fail to overwrite + @test_throws ErrorException h5rewrite(outfile) do fid + g = create_group(fid, "mygroup") + write(g, "oops", 3.3) + error("failed") + end + @test length(readdir(tmpdir)) == 1 + h5open(outfile, "r") do fid + @test keys(fid) == ["mygroup"] + @test keys(fid["mygroup"]) == ["x"] end -finally - rm(fn) -end -@testset "h5d_fill" begin - val = 5 - h5open(fn, "w") do f - d = create_dataset(f, "dataset", datatype(Int), dataspace(6, 6), chunk=(2, 3)) - buf = Array{Int,2}(undef,(6,6)) - dtype = datatype(Int) - HDF5.API.h5d_fill(Ref(val), dtype, buf, datatype(Int), dataspace(d)) - @test all(buf .== 5) - HDF5.API.h5d_write(d, dtype, HDF5.API.H5S_ALL, HDF5.API.H5S_ALL, HDF5.API.H5P_DEFAULT, buf) + # overwrite + h5rewrite(outfile) do fid + g = create_group(fid, "mygroup") + write(g, "y", 3.3) end - h5open(fn, "r") do f - @test all( f["dataset"][:,:] .== 5 ) + @test length(readdir(tmpdir)) == 1 + h5open(outfile, "r") do fid + @test keys(fid) == ["mygroup"] + @test keys(fid["mygroup"]) == ["y"] end + rm(tmpdir; recursive = true) + + test_files = joinpath(@__DIR__, "test_files") + + d = h5read(joinpath(test_files, "compound.h5"), "/data") + @test typeof(d[1]) == NamedTuple{(:wgt, :xyz, :uvw, :E), + Tuple{Float64,Array{Float64,1},Array{Float64,1},Float64}} + + # get-datasets + fn = tempname() + fd = h5open(fn, "w") + fd["level_0"] = [1, 2, 3] + grp = create_group(fd, "mygroup") + fd["mygroup/level_1"] = [4, 5] + grp2 = create_group(grp, "deep_group") + fd["mygroup/deep_group/level_2"] = [6.0, 7.0] + datasets = HDF5.get_datasets(fd) + @test sort(map(HDF5.name, datasets)) == + sort(["/level_0", "/mygroup/deep_group/level_2", "/mygroup/level_1"]) + close(fd) rm(fn) -end # testset "Test h5d_fill - -@testset "h5d_gather" begin - src_buf = rand(Int, (4,4) ) - dst_buf = Array{Int,2}(undef,(4,4)) - h5open(fn ,"w") do f - d = create_dataset(f, "dataset", datatype(Int), dataspace(4, 4), chunk=(2, 2)) - @test HDF5.API.h5d_gather(dataspace(d), src_buf, datatype(Int), sizeof(dst_buf), dst_buf, C_NULL, C_NULL) |> isnothing - @test src_buf == dst_buf - gatherf_ptr = @cfunction(gatherf, HDF5.API.herr_t, (Ptr{Nothing}, Csize_t, Ptr{Nothing})) - @test HDF5.API.h5d_gather(dataspace(d), src_buf, datatype(Int), sizeof(dst_buf)รท2, dst_buf, gatherf_ptr, C_NULL) |> isnothing - gatherf_bad_ptr = @cfunction(gatherf_bad, HDF5.API.herr_t, (Ptr{Nothing}, Csize_t, Ptr{Nothing})) - @test_throws HDF5.API.H5Error HDF5.API.h5d_gather(dataspace(d), src_buf, datatype(Int), sizeof(dst_buf)รท2, dst_buf, gatherf_bad_ptr, C_NULL) - gatherf_data_ptr = @cfunction(gatherf_data, HDF5.API.herr_t, (Ptr{Nothing}, Csize_t, Ref{Int})) - @test HDF5.API.h5d_gather(dataspace(d), src_buf, datatype(Int), sizeof(dst_buf)รท2, dst_buf, gatherf_data_ptr, Ref(9)) |> isnothing - @test_throws HDF5.API.H5Error HDF5.API.h5d_gather(dataspace(d), src_buf, datatype(Int), sizeof(dst_buf)รท2, dst_buf, gatherf_data_ptr, 10) + + # File creation and access property lists + fid = h5open(fn, "w"; userblock = 1024, + libver_bounds = (HDF5.API.H5F_LIBVER_EARLIEST, HDF5.API.H5F_LIBVER_LATEST)) + write(fid, "intarray", [1, 2, 3]) + close(fid) + h5open(fn, "r"; + libver_bounds = (HDF5.API.H5F_LIBVER_EARLIEST, HDF5.API.H5F_LIBVER_LATEST)) do fid + intarray = read(fid, "intarray") + @test intarray == [1, 2, 3] end - rm(fn) -end + # Test null terminated ASCII string (e.g. exported by h5py) #332 + h5open(joinpath(test_files, "nullterm_ascii.h5"), "r") do fid + str = read(fid["test"]) + @test str == "Hello World" + end + @test HDF5.unpad(UInt8[0x43, 0x43, 0x41], 1) == "CCA" + # Test the h5read/write interface with a filename as a first argument, when + # the file does not exist + rm(fn) + h5write(fn, "newgroup/W", W) + Wr = h5read(fn, "newgroup/W") + @test Wr == W + close(f) + rm(fn) -@testset "h5d_scatter" begin - h5open(fn, "w") do f - dst_buf = Array{Int,2}(undef,(4,4)) - d = create_dataset(f, "dataset", datatype(Int), dataspace(4, 4), chunk=(2, 2)) - scatterf_ptr = @cfunction(scatterf, HDF5.API.herr_t, (Ptr{Ptr{Nothing}}, Ptr{Csize_t}, Ptr{Nothing})) - @test HDF5.API.h5d_scatter(scatterf_ptr, C_NULL, datatype(Int), dataspace(d), dst_buf) |> isnothing - scatterf_bad_ptr = @cfunction(scatterf_bad, HDF5.API.herr_t, (Ptr{Ptr{Nothing}}, Ptr{Csize_t}, Ptr{Nothing})) - @test_throws HDF5.API.H5Error HDF5.API.h5d_scatter(scatterf_bad_ptr, C_NULL, datatype(Int), dataspace(d), dst_buf) - scatterf_data_ptr = @cfunction(scatterf_data, HDF5.API.herr_t, (Ptr{Ptr{Int}}, Ptr{Csize_t}, Ref{Int})) - @test HDF5.API.h5d_scatter(scatterf_data_ptr, Ref(9), datatype(Int), dataspace(d), dst_buf) |> isnothing + # Test dataspace convenience versions of create_dataset + try + h5open(fn, "w") do f + create_dataset(f, "test", Int, (128, 32)) + create_dataset(f, "test2", Float64, 128, 64) + @test size(f["test"]) == (128, 32) + @test size(f["test2"]) == (128, 64) + end + finally + rm(fn) end - rm(fn) -end -# Test that switching time tracking off results in identical files -fn1 = tempname(); fn2 = tempname() -h5open(fn1, "w") do f - f["x", obj_track_times=false] = [1, 2, 3] -end -sleep(1) -h5open(fn2, "w") do f - f["x", obj_track_times=false] = [1, 2, 3] -end -@test open(crc32c, fn1) == open(crc32c, fn2) -rm(fn1); rm(fn2) + @testset "h5d_fill" begin + val = 5 + h5open(fn, "w") do f + d = create_dataset(f, "dataset", datatype(Int), dataspace(6, 6); chunk = (2, 3)) + buf = Array{Int,2}(undef, (6, 6)) + dtype = datatype(Int) + HDF5.API.h5d_fill(Ref(val), dtype, buf, datatype(Int), dataspace(d)) + @test all(buf .== 5) + HDF5.API.h5d_write(d, dtype, HDF5.API.H5S_ALL, HDF5.API.H5S_ALL, + HDF5.API.H5P_DEFAULT, buf) + end + h5open(fn, "r") do f + @test all(f["dataset"][:, :] .== 5) + end + rm(fn) + end # testset "Test h5d_fill + + @testset "h5d_gather" begin + src_buf = rand(Int, (4, 4)) + dst_buf = Array{Int,2}(undef, (4, 4)) + h5open(fn, "w") do f + d = create_dataset(f, "dataset", datatype(Int), dataspace(4, 4); chunk = (2, 2)) + @test HDF5.API.h5d_gather(dataspace(d), src_buf, datatype(Int), sizeof(dst_buf), + dst_buf, C_NULL, C_NULL) |> isnothing + @test src_buf == dst_buf + gatherf_ptr = @cfunction(gatherf, HDF5.API.herr_t, + (Ptr{Nothing}, Csize_t, Ptr{Nothing})) + @test HDF5.API.h5d_gather(dataspace(d), src_buf, datatype(Int), + sizeof(dst_buf) รท 2, dst_buf, gatherf_ptr, C_NULL) |> + isnothing + gatherf_bad_ptr = @cfunction(gatherf_bad, HDF5.API.herr_t, + (Ptr{Nothing}, Csize_t, Ptr{Nothing})) + @test_throws HDF5.API.H5Error HDF5.API.h5d_gather(dataspace(d), src_buf, + datatype(Int), + sizeof(dst_buf) รท 2, dst_buf, + gatherf_bad_ptr, C_NULL) + gatherf_data_ptr = @cfunction(gatherf_data, HDF5.API.herr_t, + (Ptr{Nothing}, Csize_t, Ref{Int})) + @test HDF5.API.h5d_gather(dataspace(d), src_buf, datatype(Int), + sizeof(dst_buf) รท 2, dst_buf, gatherf_data_ptr, + Ref(9)) |> isnothing + @test_throws HDF5.API.H5Error HDF5.API.h5d_gather(dataspace(d), src_buf, + datatype(Int), + sizeof(dst_buf) รท 2, dst_buf, + gatherf_data_ptr, 10) + end + rm(fn) + end + @testset "h5d_scatter" begin + h5open(fn, "w") do f + dst_buf = Array{Int,2}(undef, (4, 4)) + d = create_dataset(f, "dataset", datatype(Int), dataspace(4, 4); chunk = (2, 2)) + scatterf_ptr = @cfunction(scatterf, HDF5.API.herr_t, + (Ptr{Ptr{Nothing}}, Ptr{Csize_t}, Ptr{Nothing})) + @test HDF5.API.h5d_scatter(scatterf_ptr, C_NULL, datatype(Int), dataspace(d), + dst_buf) |> isnothing + scatterf_bad_ptr = @cfunction(scatterf_bad, HDF5.API.herr_t, + (Ptr{Ptr{Nothing}}, Ptr{Csize_t}, Ptr{Nothing})) + @test_throws HDF5.API.H5Error HDF5.API.h5d_scatter(scatterf_bad_ptr, C_NULL, + datatype(Int), dataspace(d), + dst_buf) + scatterf_data_ptr = @cfunction(scatterf_data, HDF5.API.herr_t, + (Ptr{Ptr{Int}}, Ptr{Csize_t}, Ref{Int})) + @test HDF5.API.h5d_scatter(scatterf_data_ptr, Ref(9), datatype(Int), + dataspace(d), dst_buf) |> isnothing + end + rm(fn) + end + + # Test that switching time tracking off results in identical files + fn1 = tempname() + fn2 = tempname() + h5open(fn1, "w") do f + f["x", obj_track_times = false] = [1, 2, 3] + end + sleep(1) + h5open(fn2, "w") do f + f["x", obj_track_times = false] = [1, 2, 3] + end + @test open(crc32c, fn1) == open(crc32c, fn2) + rm(fn1) + rm(fn2) end # testset plain @testset "complex" begin - HDF5.enable_complex_support() - - fn = tempname() - f = h5open(fn, "w") - - f["ComplexF64"] = 1.0 + 2.0im - attributes(f["ComplexF64"])["ComplexInt64"] = 1im - - Acmplx = rand(ComplexF64, 3, 5) - write(f, "Acmplx64", convert(Matrix{ComplexF64}, Acmplx)) - write(f, "Acmplx32", convert(Matrix{ComplexF32}, Acmplx)) - - dset = create_dataset(f, "Acmplx64_hyperslab", datatype(Complex{Float64}), dataspace(Acmplx)) - for i in 1:size(Acmplx, 2) - dset[:, i] = Acmplx[:,i] - end - - HDF5.disable_complex_support() - @test_throws ErrorException f["_ComplexF64"] = 1.0 + 2.0im - @test_throws ErrorException write(f, "_Acmplx64", convert(Matrix{ComplexF64}, Acmplx)) - @test_throws ErrorException write(f, "_Acmplx32", convert(Matrix{ComplexF32}, Acmplx)) - HDF5.enable_complex_support() - - close(f) - - fr = h5open(fn) - z = read(fr, "ComplexF64") - @test z == 1.0 + 2.0im && isa(z, ComplexF64) - z_attrs = attributes(fr["ComplexF64"]) - @test read(z_attrs["ComplexInt64"]) == 1im - - Acmplx32 = read(fr, "Acmplx32") - @test convert(Matrix{ComplexF32}, Acmplx) == Acmplx32 - @test eltype(Acmplx32) == ComplexF32 - Acmplx64 = read(fr, "Acmplx64") - @test convert(Matrix{ComplexF64}, Acmplx) == Acmplx64 - @test eltype(Acmplx64) == ComplexF64 - - dset = fr["Acmplx64_hyperslab"] - Acmplx64_hyperslab = zeros(eltype(dset), size(dset)) - for i in 1:size(dset, 2) - Acmplx64_hyperslab[:,i] = dset[:,i] - end - @test convert(Matrix{ComplexF64}, Acmplx) == Acmplx64_hyperslab - - HDF5.disable_complex_support() - z = read(fr, "ComplexF64") - @test isa(z, NamedTuple{(:r, :i), Tuple{Float64, Float64}}) - - Acmplx32 = read(fr, "Acmplx32") - @test eltype(Acmplx32) == NamedTuple{(:r, :i), Tuple{Float32, Float32}} - Acmplx64 = read(fr, "Acmplx64") - @test eltype(Acmplx64) == NamedTuple{(:r, :i), Tuple{Float64, Float64}} - - close(fr) - - HDF5.enable_complex_support() + HDF5.enable_complex_support() + + fn = tempname() + f = h5open(fn, "w") + + f["ComplexF64"] = 1.0 + 2.0im + attributes(f["ComplexF64"])["ComplexInt64"] = 1im + + Acmplx = rand(ComplexF64, 3, 5) + write(f, "Acmplx64", convert(Matrix{ComplexF64}, Acmplx)) + write(f, "Acmplx32", convert(Matrix{ComplexF32}, Acmplx)) + + dset = create_dataset(f, "Acmplx64_hyperslab", datatype(Complex{Float64}), + dataspace(Acmplx)) + for i in 1:size(Acmplx, 2) + dset[:, i] = Acmplx[:, i] + end + + HDF5.disable_complex_support() + @test_throws ErrorException f["_ComplexF64"]=1.0 + 2.0im + @test_throws ErrorException write(f, "_Acmplx64", convert(Matrix{ComplexF64}, Acmplx)) + @test_throws ErrorException write(f, "_Acmplx32", convert(Matrix{ComplexF32}, Acmplx)) + HDF5.enable_complex_support() + + close(f) + + fr = h5open(fn) + z = read(fr, "ComplexF64") + @test z == 1.0 + 2.0im && isa(z, ComplexF64) + z_attrs = attributes(fr["ComplexF64"]) + @test read(z_attrs["ComplexInt64"]) == 1im + + Acmplx32 = read(fr, "Acmplx32") + @test convert(Matrix{ComplexF32}, Acmplx) == Acmplx32 + @test eltype(Acmplx32) == ComplexF32 + Acmplx64 = read(fr, "Acmplx64") + @test convert(Matrix{ComplexF64}, Acmplx) == Acmplx64 + @test eltype(Acmplx64) == ComplexF64 + + dset = fr["Acmplx64_hyperslab"] + Acmplx64_hyperslab = zeros(eltype(dset), size(dset)) + for i in 1:size(dset, 2) + Acmplx64_hyperslab[:, i] = dset[:, i] + end + @test convert(Matrix{ComplexF64}, Acmplx) == Acmplx64_hyperslab + + HDF5.disable_complex_support() + z = read(fr, "ComplexF64") + @test isa(z, NamedTuple{(:r, :i),Tuple{Float64,Float64}}) + + Acmplx32 = read(fr, "Acmplx32") + @test eltype(Acmplx32) == NamedTuple{(:r, :i),Tuple{Float32,Float32}} + Acmplx64 = read(fr, "Acmplx64") + @test eltype(Acmplx64) == NamedTuple{(:r, :i),Tuple{Float64,Float64}} + + close(fr) + + HDF5.enable_complex_support() end # test strings with null and undefined references @testset "undefined and null" begin -fn = tempname() -f = h5open(fn, "w") + fn = tempname() + f = h5open(fn, "w") -# don't silently truncate data -@test_throws ArgumentError write(f, "test", ["hello","there","\0"]) -@test_throws ArgumentError write(f, "trunc1", "\0") -@test_throws ArgumentError write(f, "trunc2", "trunc\0ateme") + # don't silently truncate data + @test_throws ArgumentError write(f, "test", ["hello", "there", "\0"]) + @test_throws ArgumentError write(f, "trunc1", "\0") + @test_throws ArgumentError write(f, "trunc2", "trunc\0ateme") -# test writing uninitialized string arrays -undefstrarr = similar(Vector(1:3), String) # strs = String[#undef, #undef, #undef] -@test_throws UndefRefError write(f, "undef", undefstrarr) - -close(f) -rm(fn) + # test writing uninitialized string arrays + undefstrarr = similar(Vector(1:3), String) # strs = String[#undef, #undef, #undef] + @test_throws UndefRefError write(f, "undef", undefstrarr) + close(f) + rm(fn) end # testset null and undefined # test writing abstract arrays @testset "abstract arrays" begin -# test writing reinterpreted data -fn = tempname() -try - h5open(fn, "w") do f - data = reinterpret(UInt8, [true, false, false]) - write(f, "reinterpret array", data) + # test writing reinterpreted data + fn = tempname() + try + h5open(fn, "w") do f + data = reinterpret(UInt8, [true, false, false]) + write(f, "reinterpret array", data) + end + + @test h5open(fn, "r") do f + read(f, "reinterpret array") + end == UInt8[0x01, 0x00, 0x00] + finally + rm(fn) end - @test h5open(fn, "r") do f - read(f, "reinterpret array") - end == UInt8[0x01, 0x00, 0x00] -finally - rm(fn) -end - -# don't silently fail for arrays with a different stride -fn = tempname() -try - data = rand(UInt16, 2, 3); - pdv_data = PermutedDimsArray(data, (2, 1)) - - @test_throws ArgumentError h5write(fn, "pdv_data", pdv_data) -finally - rm(fn) -end + # don't silently fail for arrays with a different stride + fn = tempname() + try + data = rand(UInt16, 2, 3) + pdv_data = PermutedDimsArray(data, (2, 1)) -# test alignment -fn = tempname() -h5open(fn, "w", alignment=(0, 8)) do fid - fid["x"] = zeros(10, 10) -end + @test_throws ArgumentError h5write(fn, "pdv_data", pdv_data) + finally + rm(fn) + end + # test alignment + fn = tempname() + h5open(fn, "w"; alignment = (0, 8)) do fid + fid["x"] = zeros(10, 10) + end end # writing abstract arrays # issue #705 @testset "empty and 0-size arrays" begin -fn = tempname() -hfile = h5open(fn, "w") - -# Write datasets with various 0-sizes -write(hfile, "empty", HDF5.EmptyArray{Int64}()) # HDF5 empty -write(hfile, "zerodim", fill(1.0ฯ€)) # 0-dimensional -write(hfile, "zerovec", zeros(0)) # 1-dimensional, size 0 -write(hfile, "zeromat", zeros(0, 0)) # 2-dimensional, size 0 -write(hfile, "zeromat2", zeros(0, 1)) # 2-dimensional, size 0 with non-zero axis -dempty = hfile["empty"] -dzerodim = hfile["zerodim"] -dzerovec = hfile["zerovec"] -dzeromat = hfile["zeromat"] -dzeromat2 = hfile["zeromat2"] - -# Test that eltype is preserved (especially for EmptyArray) -@test eltype(dempty) == Int64 -@test eltype(dzerodim) == Float64 -@test eltype(dzerovec) == Float64 -@test eltype(dzeromat) == Float64 -@test eltype(dzeromat2) == Float64 -# Test sizes are as expected -@test size(dempty) == () -@test size(dzerovec) == (0,) -@test size(dzeromat) == (0, 0) -@test size(dzeromat2) == (0, 1) -@test HDF5.isnull(dempty) -@test !HDF5.isnull(dzerovec) -@test !HDF5.isnull(dzeromat) -@test !HDF5.isnull(dzeromat2) -# Reading back must preserve emptiness -@test read(dempty) isa HDF5.EmptyArray -# but 0-dimensional Array{T,0} are stored as HDF5 scalar -@test size(dzerodim) == () -@test !HDF5.isnull(dzerodim) -@test read(dzerodim) == 1.0ฯ€ - -# Similar tests for writing to attributes -write(dempty, "attr", HDF5.EmptyArray{Float64}()) -write(dzerodim, "attr", fill(1.0โ„ฏ)) -write(dzerovec, "attr", zeros(Int64, 0)) -write(dzeromat, "attr", zeros(Int64, 0, 0)) -write(dzeromat2, "attr", zeros(Int64, 0, 1)) -aempty = dempty["attr"] -azerodim = dzerodim["attr"] -azerovec = dzerovec["attr"] -azeromat = dzeromat["attr"] -azeromat2 = dzeromat2["attr"] -# Test that eltype is preserved (especially for EmptyArray) -@test eltype(aempty) == Float64 -@test eltype(azerodim) == Float64 -@test eltype(azerovec) == Int64 -@test eltype(azeromat) == Int64 -@test eltype(azeromat2) == Int64 -# Test sizes are as expected -@test size(aempty) == () -@test size(azerovec) == (0,) -@test size(azeromat) == (0, 0) -@test size(azeromat2) == (0, 1) -@test HDF5.isnull(aempty) -@test !HDF5.isnull(azerovec) -@test !HDF5.isnull(azeromat) -@test !HDF5.isnull(azeromat2) -# Reading back must preserve emptiness -@test read(aempty) isa HDF5.EmptyArray -# but 0-dimensional Array{T,0} are stored as HDF5 scalar -@test size(azerodim) == () -@test !HDF5.isnull(azerodim) -@test read(azerodim) == 1.0โ„ฏ - -# Concatenation of EmptyArrays is not supported -x = HDF5.EmptyArray{Float64}() -@test_throws ErrorException [x x] -@test_throws ErrorException [x; x] -@test_throws ErrorException [x x; x x] - -close(hfile) -rm(fn) - -# check that printing EmptyArray doesn't error -buf = IOBuffer() -show(buf, HDF5.EmptyArray{Int64}()) -@test String(take!(buf)) == "HDF5.EmptyArray{Int64}()" -show(buf, MIME"text/plain"(), HDF5.EmptyArray{Int64}()) -@test String(take!(buf)) == "HDF5.EmptyArray{Int64}()" + fn = tempname() + hfile = h5open(fn, "w") + + # Write datasets with various 0-sizes + write(hfile, "empty", HDF5.EmptyArray{Int64}()) # HDF5 empty + write(hfile, "zerodim", fill(1.0ฯ€)) # 0-dimensional + write(hfile, "zerovec", zeros(0)) # 1-dimensional, size 0 + write(hfile, "zeromat", zeros(0, 0)) # 2-dimensional, size 0 + write(hfile, "zeromat2", zeros(0, 1)) # 2-dimensional, size 0 with non-zero axis + dempty = hfile["empty"] + dzerodim = hfile["zerodim"] + dzerovec = hfile["zerovec"] + dzeromat = hfile["zeromat"] + dzeromat2 = hfile["zeromat2"] + + # Test that eltype is preserved (especially for EmptyArray) + @test eltype(dempty) == Int64 + @test eltype(dzerodim) == Float64 + @test eltype(dzerovec) == Float64 + @test eltype(dzeromat) == Float64 + @test eltype(dzeromat2) == Float64 + # Test sizes are as expected + @test size(dempty) == () + @test size(dzerovec) == (0,) + @test size(dzeromat) == (0, 0) + @test size(dzeromat2) == (0, 1) + @test HDF5.isnull(dempty) + @test !HDF5.isnull(dzerovec) + @test !HDF5.isnull(dzeromat) + @test !HDF5.isnull(dzeromat2) + # Reading back must preserve emptiness + @test read(dempty) isa HDF5.EmptyArray + # but 0-dimensional Array{T,0} are stored as HDF5 scalar + @test size(dzerodim) == () + @test !HDF5.isnull(dzerodim) + @test read(dzerodim) == 1.0ฯ€ + + # Similar tests for writing to attributes + write(dempty, "attr", HDF5.EmptyArray{Float64}()) + write(dzerodim, "attr", fill(1.0โ„ฏ)) + write(dzerovec, "attr", zeros(Int64, 0)) + write(dzeromat, "attr", zeros(Int64, 0, 0)) + write(dzeromat2, "attr", zeros(Int64, 0, 1)) + aempty = dempty["attr"] + azerodim = dzerodim["attr"] + azerovec = dzerovec["attr"] + azeromat = dzeromat["attr"] + azeromat2 = dzeromat2["attr"] + # Test that eltype is preserved (especially for EmptyArray) + @test eltype(aempty) == Float64 + @test eltype(azerodim) == Float64 + @test eltype(azerovec) == Int64 + @test eltype(azeromat) == Int64 + @test eltype(azeromat2) == Int64 + # Test sizes are as expected + @test size(aempty) == () + @test size(azerovec) == (0,) + @test size(azeromat) == (0, 0) + @test size(azeromat2) == (0, 1) + @test HDF5.isnull(aempty) + @test !HDF5.isnull(azerovec) + @test !HDF5.isnull(azeromat) + @test !HDF5.isnull(azeromat2) + # Reading back must preserve emptiness + @test read(aempty) isa HDF5.EmptyArray + # but 0-dimensional Array{T,0} are stored as HDF5 scalar + @test size(azerodim) == () + @test !HDF5.isnull(azerodim) + @test read(azerodim) == 1.0โ„ฏ + + # Concatenation of EmptyArrays is not supported + x = HDF5.EmptyArray{Float64}() + @test_throws ErrorException [x x] + @test_throws ErrorException [x; x] + @test_throws ErrorException [x x; x x] + + close(hfile) + rm(fn) + + # check that printing EmptyArray doesn't error + buf = IOBuffer() + show(buf, HDF5.EmptyArray{Int64}()) + @test String(take!(buf)) == "HDF5.EmptyArray{Int64}()" + show(buf, MIME"text/plain"(), HDF5.EmptyArray{Int64}()) + @test String(take!(buf)) == "HDF5.EmptyArray{Int64}()" end # empty and 0-size arrays @testset "generic read of native types" begin -fn = tempname() -hfile = h5open(fn, "w") - -dtype_varstring = HDF5.Datatype(HDF5.API.h5t_copy(HDF5.API.H5T_C_S1)) -HDF5.API.h5t_set_size(dtype_varstring, HDF5.API.H5T_VARIABLE) - -write(hfile, "uint8_array", UInt8[(1:8)...]) -write(hfile, "bool_scalar", true) - -fixstring = "fix" -varstring = "var" -write(hfile, "fixed_string", fixstring) -vardset = create_dataset(hfile, "variable_string", dtype_varstring, dataspace(varstring)) -GC.@preserve varstring begin - HDF5.API.h5d_write(vardset, dtype_varstring, HDF5.API.H5S_ALL, HDF5.API.H5S_ALL, HDF5.API.H5P_DEFAULT, [pointer(varstring)]) -end -flush(hfile) -close(dtype_varstring) - -# generic read() handles concrete types with definite sizes transparently -d = read(hfile["uint8_array"], UInt8) -@test d isa Vector{UInt8} -@test d == 1:8 -d = read(hfile["bool_scalar"], Bool) -@test d isa Bool -@test d == true -d = read(hfile["fixed_string"], HDF5.FixedString{length(fixstring),0}) -@test d isa String -@test d == fixstring -d = read(hfile["variable_string"], Cstring) -@test d isa String -@test d == varstring -# will also accept memory-compatible reinterpretations -d = read(hfile["uint8_array"], Int8) -@test d isa Vector{Int8} -@test d == 1:8 -d = read(hfile["bool_scalar"], UInt8) -@test d isa UInt8 -@test d == 0x1 -# but should throw on non-compatible types -@test_throws ErrorException(""" - Type size mismatch - sizeof(UInt16) = 2 - sizeof($(sprint(show, datatype(UInt8)))) = 1 - """) read(hfile["uint8_array"], UInt16) - -# Strings are not fixed size, but generic read still handles them if given the correct -# underlying FixedString or Cstring type; a method overload makes String work, too. -d = read(hfile["fixed_string"], String) -@test d isa String -@test d == fixstring -d = read(hfile["variable_string"], String) -@test d isa String -@test d == varstring - -close(hfile) -rm(fn) + fn = tempname() + hfile = h5open(fn, "w") + + dtype_varstring = HDF5.Datatype(HDF5.API.h5t_copy(HDF5.API.H5T_C_S1)) + HDF5.API.h5t_set_size(dtype_varstring, HDF5.API.H5T_VARIABLE) + + write(hfile, "uint8_array", UInt8[(1:8)...]) + write(hfile, "bool_scalar", true) + + fixstring = "fix" + varstring = "var" + write(hfile, "fixed_string", fixstring) + vardset = create_dataset(hfile, "variable_string", dtype_varstring, + dataspace(varstring)) + GC.@preserve varstring begin HDF5.API.h5d_write(vardset, dtype_varstring, + HDF5.API.H5S_ALL, HDF5.API.H5S_ALL, + HDF5.API.H5P_DEFAULT, + [pointer(varstring)]) end + flush(hfile) + close(dtype_varstring) + + # generic read() handles concrete types with definite sizes transparently + d = read(hfile["uint8_array"], UInt8) + @test d isa Vector{UInt8} + @test d == 1:8 + d = read(hfile["bool_scalar"], Bool) + @test d isa Bool + @test d == true + d = read(hfile["fixed_string"], HDF5.FixedString{length(fixstring),0}) + @test d isa String + @test d == fixstring + d = read(hfile["variable_string"], Cstring) + @test d isa String + @test d == varstring + # will also accept memory-compatible reinterpretations + d = read(hfile["uint8_array"], Int8) + @test d isa Vector{Int8} + @test d == 1:8 + d = read(hfile["bool_scalar"], UInt8) + @test d isa UInt8 + @test d == 0x1 + # but should throw on non-compatible types + @test_throws ErrorException(""" + Type size mismatch + sizeof(UInt16) = 2 + sizeof($(sprint(show, datatype(UInt8)))) = 1 + """) read(hfile["uint8_array"], UInt16) + + # Strings are not fixed size, but generic read still handles them if given the correct + # underlying FixedString or Cstring type; a method overload makes String work, too. + d = read(hfile["fixed_string"], String) + @test d isa String + @test d == fixstring + d = read(hfile["variable_string"], String) + @test d isa String + @test d == varstring + + close(hfile) + rm(fn) end # generic read of native types @testset "show" begin -fn = tempname() - -# First create data objects and sure they print useful outputs + fn = tempname() + + # First create data objects and sure they print useful outputs + + hfile = h5open(fn, "w"; swmr = true) + @test sprint(show, hfile) == "HDF5.File: (read-write, swmr) $fn" + + group = create_group(hfile, "group") + @test sprint(show, group) == "HDF5.Group: /group (file: $fn)" + + dset = create_dataset(group, "dset", datatype(Int), dataspace((1,))) + @test sprint(show, dset) == "HDF5.Dataset: /group/dset (file: $fn xfer_mode: 0)" + + meta = create_attribute(dset, "meta", datatype(Bool), dataspace((1,))) + @test sprint(show, meta) == "HDF5.Attribute: meta" + + dsetattrs = attributes(dset) + @test sprint(show, dsetattrs) == + "Attributes of HDF5.Dataset: /group/dset (file: $fn xfer_mode: 0)" + + prop = HDF5.init!(HDF5.LinkCreateProperties()) + @test sprint(show, prop) == """ + HDF5.LinkCreateProperties( + create_intermediate_group = false, + char_encoding = :ascii, + )""" + + prop = HDF5.DatasetCreateProperties() + @test sprint(show, prop) == "HDF5.DatasetCreateProperties()" + + dtype = HDF5.Datatype(HDF5.API.h5t_copy(HDF5.API.H5T_IEEE_F64LE)) + @test sprint(show, dtype) == "HDF5.Datatype: H5T_IEEE_F64LE" + commit_datatype(hfile, "type", dtype) + @test sprint(show, dtype) == "HDF5.Datatype: /type H5T_IEEE_F64LE" + + dtypemeta = create_attribute(dtype, "dtypemeta", datatype(Bool), dataspace((1,))) + @test sprint(show, dtypemeta) == "HDF5.Attribute: dtypemeta" + + dtypeattrs = attributes(dtype) + @test sprint(show, dtypeattrs) == "Attributes of HDF5.Datatype: /type H5T_IEEE_F64LE" + + dspace_null = HDF5.Dataspace(HDF5.API.h5s_create(HDF5.API.H5S_NULL)) + dspace_scal = HDF5.Dataspace(HDF5.API.h5s_create(HDF5.API.H5S_SCALAR)) + dspace_norm = dataspace((100, 4)) + dspace_maxd = dataspace((100, 4); max_dims = (256, 4)) + dspace_slab = HDF5.hyperslab(dataspace((100, 4)), 1:20:100, 1:4) + if HDF5.libversion โ‰ฅ v"1.10.7" + dspace_irrg = HDF5.Dataspace(HDF5.API.h5s_combine_select(HDF5.API.h5s_copy(dspace_slab), + HDF5.API.H5S_SELECT_OR, + HDF5.hyperslab(dataspace((100, + 4)), + 2, 2))) + @test sprint(show, dspace_irrg) == "HDF5.Dataspace: (100, 4) [irregular selection]" + end + @test sprint(show, dspace_null) == "HDF5.Dataspace: H5S_NULL" + @test sprint(show, dspace_scal) == "HDF5.Dataspace: H5S_SCALAR" + @test sprint(show, dspace_norm) == "HDF5.Dataspace: (100, 4)" + @test sprint(show, dspace_maxd) == "HDF5.Dataspace: (100, 4) / (256, 4)" + @test sprint(show, dspace_slab) == "HDF5.Dataspace: (1:20:81, 1:4) / (1:100, 1:4)" -hfile = h5open(fn, "w", swmr = true) -@test sprint(show, hfile) == "HDF5.File: (read-write, swmr) $fn" + # Now test printing after closing each object -group = create_group(hfile, "group") -@test sprint(show, group) == "HDF5.Group: /group (file: $fn)" + close(dspace_null) + @test sprint(show, dspace_null) == "HDF5.Dataspace: (invalid)" -dset = create_dataset(group, "dset", datatype(Int), dataspace((1,))) -@test sprint(show, dset) == "HDF5.Dataset: /group/dset (file: $fn xfer_mode: 0)" + close(dtype) + @test sprint(show, dtype) == "HDF5.Datatype: (invalid)" -meta = create_attribute(dset, "meta", datatype(Bool), dataspace((1,))) -@test sprint(show, meta) == "HDF5.Attribute: meta" + close(prop) + @test sprint(show, prop) == "HDF5.DatasetCreateProperties: (invalid)" -dsetattrs = attributes(dset) -@test sprint(show, dsetattrs) == "Attributes of HDF5.Dataset: /group/dset (file: $fn xfer_mode: 0)" + close(meta) + @test sprint(show, meta) == "HDF5.Attribute: (invalid)" -prop = HDF5.init!(HDF5.LinkCreateProperties()) -@test sprint(show, prop) == """ -HDF5.LinkCreateProperties( - create_intermediate_group = false, - char_encoding = :ascii, -)""" + close(dtypemeta) + @test sprint(show, dtypemeta) == "HDF5.Attribute: (invalid)" -prop = HDF5.DatasetCreateProperties() -@test sprint(show, prop) == "HDF5.DatasetCreateProperties()" + close(dset) + @test sprint(show, dset) == "HDF5.Dataset: (invalid)" + @test sprint(show, dsetattrs) == "Attributes of HDF5.Dataset: (invalid)" -dtype = HDF5.Datatype(HDF5.API.h5t_copy(HDF5.API.H5T_IEEE_F64LE)) -@test sprint(show, dtype) == "HDF5.Datatype: H5T_IEEE_F64LE" -commit_datatype(hfile, "type", dtype) -@test sprint(show, dtype) == "HDF5.Datatype: /type H5T_IEEE_F64LE" + close(group) + @test sprint(show, group) == "HDF5.Group: (invalid)" -dtypemeta = create_attribute(dtype, "dtypemeta", datatype(Bool), dataspace((1,))) -@test sprint(show, dtypemeta) == "HDF5.Attribute: dtypemeta" + close(hfile) + @test sprint(show, hfile) == "HDF5.File: (closed) $fn" -dtypeattrs = attributes(dtype) -@test sprint(show, dtypeattrs) == "Attributes of HDF5.Datatype: /type H5T_IEEE_F64LE" + # Go back and check different access modes for file printing + hfile = h5open(fn, "r+"; swmr = true) + @test sprint(show, hfile) == "HDF5.File: (read-write, swmr) $fn" + close(hfile) + hfile = h5open(fn, "r"; swmr = true) + @test sprint(show, hfile) == "HDF5.File: (read-only, swmr) $fn" + close(hfile) + hfile = h5open(fn, "r") + @test sprint(show, hfile) == "HDF5.File: (read-only) $fn" + close(hfile) + hfile = h5open(fn, "cw") + @test sprint(show, hfile) == "HDF5.File: (read-write) $fn" + close(hfile) -dspace_null = HDF5.Dataspace(HDF5.API.h5s_create(HDF5.API.H5S_NULL)) -dspace_scal = HDF5.Dataspace(HDF5.API.h5s_create(HDF5.API.H5S_SCALAR)) -dspace_norm = dataspace((100, 4)) -dspace_maxd = dataspace((100, 4), max_dims = (256, 4)) -dspace_slab = HDF5.hyperslab(dataspace((100, 4)), 1:20:100, 1:4) -if HDF5.libversion โ‰ฅ v"1.10.7" -dspace_irrg = HDF5.Dataspace(HDF5.API.h5s_combine_select( - HDF5.API.h5s_copy(dspace_slab), HDF5.API.H5S_SELECT_OR, - HDF5.hyperslab(dataspace((100, 4)), 2, 2))) -@test sprint(show, dspace_irrg) == "HDF5.Dataspace: (100, 4) [irregular selection]" -end -@test sprint(show, dspace_null) == "HDF5.Dataspace: H5S_NULL" -@test sprint(show, dspace_scal) == "HDF5.Dataspace: H5S_SCALAR" -@test sprint(show, dspace_norm) == "HDF5.Dataspace: (100, 4)" -@test sprint(show, dspace_maxd) == "HDF5.Dataspace: (100, 4) / (256, 4)" -@test sprint(show, dspace_slab) == "HDF5.Dataspace: (1:20:81, 1:4) / (1:100, 1:4)" - -# Now test printing after closing each object - -close(dspace_null) -@test sprint(show, dspace_null) == "HDF5.Dataspace: (invalid)" - -close(dtype) -@test sprint(show, dtype) == "HDF5.Datatype: (invalid)" - -close(prop) -@test sprint(show, prop) == "HDF5.DatasetCreateProperties: (invalid)" - -close(meta) -@test sprint(show, meta) == "HDF5.Attribute: (invalid)" - -close(dtypemeta) -@test sprint(show, dtypemeta) == "HDF5.Attribute: (invalid)" - -close(dset) -@test sprint(show, dset) == "HDF5.Dataset: (invalid)" -@test sprint(show, dsetattrs) == "Attributes of HDF5.Dataset: (invalid)" - -close(group) -@test sprint(show, group) == "HDF5.Group: (invalid)" - -close(hfile) -@test sprint(show, hfile) == "HDF5.File: (closed) $fn" - -# Go back and check different access modes for file printing -hfile = h5open(fn, "r+", swmr = true) -@test sprint(show, hfile) == "HDF5.File: (read-write, swmr) $fn" -close(hfile) -hfile = h5open(fn, "r", swmr = true) -@test sprint(show, hfile) == "HDF5.File: (read-only, swmr) $fn" -close(hfile) -hfile = h5open(fn, "r") -@test sprint(show, hfile) == "HDF5.File: (read-only) $fn" -close(hfile) -hfile = h5open(fn, "cw") -@test sprint(show, hfile) == "HDF5.File: (read-write) $fn" -close(hfile) - -rm(fn) - -# Make an interesting file tree -hfile = h5open(fn, "w") -# file level -hfile["version"] = 1.0 -attributes(hfile)["creator"] = "HDF5.jl" -# group level -create_group(hfile, "inner") -attributes(hfile["inner"])["dirty"] = true -# dataset level -hfile["inner/data"] = collect(-5:5) -attributes(hfile["inner/data"])["mode"] = 1 -# non-trivial committed datatype -# TODO: print more datatype information -tmeta = HDF5.Datatype(HDF5.API.h5t_create(HDF5.API.H5T_COMPOUND, sizeof(Int) + sizeof(Float64))) -HDF5.API.h5t_insert(tmeta, "scale", 0, HDF5.hdf5_type_id(Int)) -HDF5.API.h5t_insert(tmeta, "bias", sizeof(Int), HDF5.hdf5_type_id(Float64)) -tstr = datatype("fixed") -t = HDF5.Datatype(HDF5.API.h5t_create(HDF5.API.H5T_COMPOUND, sizeof(tmeta) + sizeof(tstr))) -HDF5.API.h5t_insert(t, "meta", 0, tmeta) -HDF5.API.h5t_insert(t, "type", sizeof(tmeta), tstr) -commit_datatype(hfile, "dtype", t) - -buf = IOBuffer() -iobuf = IOContext(buf, :limit => true, :module => Main) -show3(io::IO, x) = show(IOContext(io, iobuf), MIME"text/plain"(), x) - -HDF5.show_tree(iobuf, hfile) -msg = String(take!(buf)) -@test occursin(r""" -๐Ÿ—‚๏ธ HDF5.File: .*$ -โ”œโ”€ ๐Ÿท๏ธ creator -โ”œโ”€ ๐Ÿ“„ dtype -โ”œโ”€ ๐Ÿ“‚ inner -โ”‚ โ”œโ”€ ๐Ÿท๏ธ dirty -โ”‚ โ””โ”€ ๐Ÿ”ข data -โ”‚ โ””โ”€ ๐Ÿท๏ธ mode -โ””โ”€ ๐Ÿ”ข version"""m, msg) -@test sprint(show3, hfile) == msg - -HDF5.show_tree(iobuf, hfile, attributes = false) -@test occursin(r""" -๐Ÿ—‚๏ธ HDF5.File: .*$ -โ”œโ”€ ๐Ÿ“„ dtype -โ”œโ”€ ๐Ÿ“‚ inner -โ”‚ โ””โ”€ ๐Ÿ”ข data -โ””โ”€ ๐Ÿ”ข version"""m, String(take!(buf))) - -HDF5.show_tree(iobuf, attributes(hfile)) -msg = String(take!(buf)) -@test occursin(r""" -๐Ÿ—‚๏ธ Attributes of HDF5.File: .*$ -โ””โ”€ ๐Ÿท๏ธ creator"""m, msg) -@test sprint(show3, attributes(hfile)) == msg - -HDF5.show_tree(iobuf, hfile["inner"]) -msg = String(take!(buf)) -@test occursin(r""" -๐Ÿ“‚ HDF5.Group: /inner .*$ -โ”œโ”€ ๐Ÿท๏ธ dirty -โ””โ”€ ๐Ÿ”ข data - โ””โ”€ ๐Ÿท๏ธ mode"""m, msg) -@test sprint(show3, hfile["inner"]) == msg - -HDF5.show_tree(iobuf, hfile["inner"], attributes = false) -@test occursin(r""" -๐Ÿ“‚ HDF5.Group: /inner .*$ -โ””โ”€ ๐Ÿ”ข data"""m, String(take!(buf))) - -HDF5.show_tree(iobuf, hfile["inner/data"]) -msg = String(take!(buf)) -@test occursin(r""" -๐Ÿ”ข HDF5.Dataset: /inner/data .*$ -โ””โ”€ ๐Ÿท๏ธ mode"""m, msg) -# xfer_mode changes between printings, so need regex again -@test occursin(r""" -๐Ÿ”ข HDF5.Dataset: /inner/data .*$ -โ””โ”€ ๐Ÿท๏ธ mode"""m, sprint(show3, hfile["inner/data"])) - -HDF5.show_tree(iobuf, hfile["inner/data"], attributes = false) -@test occursin(r""" -๐Ÿ”ข HDF5.Dataset: /inner/data .*$"""m, String(take!(buf))) - -HDF5.show_tree(iobuf, hfile["dtype"]) -@test occursin(r""" -๐Ÿ“„ HDF5.Datatype: /dtype""", String(take!(buf))) - -HDF5.show_tree(iobuf, hfile["inner/data"]["mode"], attributes = true) -@test occursin(r""" -๐Ÿท๏ธ HDF5.Attribute: mode""", String(take!(buf))) - -# configurable options - -# no emoji icons -HDF5.SHOW_TREE_ICONS[] = false -@test occursin(r""" -\[F\] HDF5.File: .*$ -โ”œโ”€ \[A\] creator -โ”œโ”€ \[T\] dtype -โ”œโ”€ \[G\] inner -โ”‚ โ”œโ”€ \[A\] dirty -โ”‚ โ””โ”€ \[D\] data -โ”‚ โ””โ”€ \[A\] mode -โ””โ”€ \[D\] version"""m, sprint(show3, hfile)) -HDF5.SHOW_TREE_ICONS[] = true - -# no tree printing -show(IOContext(iobuf, :compact => true), MIME"text/plain"(), hfile) -msg = String(take!(buf)) -@test msg == sprint(show, hfile) - -close(hfile) - -# Now test the print-limiting heuristics for large/complex datasets - -# group with a large number of children; tests child entry truncation heuristic -h5open(fn, "w") do hfile - dt, ds = datatype(Int), dataspace(()) - opts = Iterators.product('A':'Z', 1:9) - for ii in opts - create_dataset(hfile, string(ii...), dt, ds) - end + rm(fn) - def = HDF5.SHOW_TREE_MAX_CHILDREN[] - HDF5.SHOW_TREE_MAX_CHILDREN[] = 5 + # Make an interesting file tree + hfile = h5open(fn, "w") + # file level + hfile["version"] = 1.0 + attributes(hfile)["creator"] = "HDF5.jl" + # group level + create_group(hfile, "inner") + attributes(hfile["inner"])["dirty"] = true + # dataset level + hfile["inner/data"] = collect(-5:5) + attributes(hfile["inner/data"])["mode"] = 1 + # non-trivial committed datatype + # TODO: print more datatype information + tmeta = HDF5.Datatype(HDF5.API.h5t_create(HDF5.API.H5T_COMPOUND, + sizeof(Int) + sizeof(Float64))) + HDF5.API.h5t_insert(tmeta, "scale", 0, HDF5.hdf5_type_id(Int)) + HDF5.API.h5t_insert(tmeta, "bias", sizeof(Int), HDF5.hdf5_type_id(Float64)) + tstr = datatype("fixed") + t = HDF5.Datatype(HDF5.API.h5t_create(HDF5.API.H5T_COMPOUND, + sizeof(tmeta) + sizeof(tstr))) + HDF5.API.h5t_insert(t, "meta", 0, tmeta) + HDF5.API.h5t_insert(t, "type", sizeof(tmeta), tstr) + commit_datatype(hfile, "dtype", t) + + buf = IOBuffer() + iobuf = IOContext(buf, :limit => true, :module => Main) + show3(io::IO, x) = show(IOContext(io, iobuf), MIME"text/plain"(), x) HDF5.show_tree(iobuf, hfile) msg = String(take!(buf)) @test occursin(r""" -๐Ÿ—‚๏ธ HDF5.File: .*$ -โ”œโ”€ ๐Ÿ”ข A1 -โ”œโ”€ ๐Ÿ”ข A2 -โ”œโ”€ ๐Ÿ”ข A3 -โ”œโ”€ ๐Ÿ”ข A4 -โ”œโ”€ ๐Ÿ”ข A5 -โ””โ”€ \(229 more children\)"""m, msg) + ๐Ÿ—‚๏ธ HDF5.File: .*$ + โ”œโ”€ ๐Ÿท๏ธ creator + โ”œโ”€ ๐Ÿ“„ dtype + โ”œโ”€ ๐Ÿ“‚ inner + โ”‚ โ”œโ”€ ๐Ÿท๏ธ dirty + โ”‚ โ””โ”€ ๐Ÿ”ข data + โ”‚ โ””โ”€ ๐Ÿท๏ธ mode + โ””โ”€ ๐Ÿ”ข version"""m, msg) @test sprint(show3, hfile) == msg - HDF5.SHOW_TREE_MAX_CHILDREN[] = def + HDF5.show_tree(iobuf, hfile; attributes = false) + @test occursin(r""" + ๐Ÿ—‚๏ธ HDF5.File: .*$ + โ”œโ”€ ๐Ÿ“„ dtype + โ”œโ”€ ๐Ÿ“‚ inner + โ”‚ โ””โ”€ ๐Ÿ”ข data + โ””โ”€ ๐Ÿ”ข version"""m, String(take!(buf))) - # IOContext can halt limiting - HDF5.show_tree(IOContext(iobuf, :limit => false), hfile) - @test countlines(seekstart(buf)) == length(opts) + 1 - truncate(buf, 0) -end + HDF5.show_tree(iobuf, attributes(hfile)) + msg = String(take!(buf)) + @test occursin(r""" + ๐Ÿ—‚๏ธ Attributes of HDF5.File: .*$ + โ””โ”€ ๐Ÿท๏ธ creator"""m, msg) + @test sprint(show3, attributes(hfile)) == msg -# deeply nested set of elements; test that the tree is truncated -h5open(fn, "w") do hfile - p = HDF5.root(hfile)::HDF5.Group - opts = 'A':'Z' - for ii in opts - p = create_group(p, string(ii)) - end + HDF5.show_tree(iobuf, hfile["inner"]) + msg = String(take!(buf)) + @test occursin(r""" + ๐Ÿ“‚ HDF5.Group: /inner .*$ + โ”œโ”€ ๐Ÿท๏ธ dirty + โ””โ”€ ๐Ÿ”ข data + โ””โ”€ ๐Ÿท๏ธ mode"""m, msg) + @test sprint(show3, hfile["inner"]) == msg - def = HDF5.SHOW_TREE_MAX_DEPTH[] - HDF5.SHOW_TREE_MAX_DEPTH[] = 5 + HDF5.show_tree(iobuf, hfile["inner"]; attributes = false) + @test occursin(r""" + ๐Ÿ“‚ HDF5.Group: /inner .*$ + โ””โ”€ ๐Ÿ”ข data"""m, String(take!(buf))) - HDF5.show_tree(iobuf, hfile) + HDF5.show_tree(iobuf, hfile["inner/data"]) msg = String(take!(buf)) @test occursin(r""" -๐Ÿ—‚๏ธ HDF5.File: .*$ -โ””โ”€ ๐Ÿ“‚ A - โ””โ”€ ๐Ÿ“‚ B - โ””โ”€ ๐Ÿ“‚ C - โ””โ”€ ๐Ÿ“‚ D - โ””โ”€ ๐Ÿ“‚ E - โ””โ”€ \(1 child\)"""m, msg) - @test sprint(show3, hfile) == msg + ๐Ÿ”ข HDF5.Dataset: /inner/data .*$ + โ””โ”€ ๐Ÿท๏ธ mode"""m, msg) + # xfer_mode changes between printings, so need regex again + @test occursin(r""" + ๐Ÿ”ข HDF5.Dataset: /inner/data .*$ + โ””โ”€ ๐Ÿท๏ธ mode"""m, sprint(show3, hfile["inner/data"])) - HDF5.SHOW_TREE_MAX_DEPTH[] = def + HDF5.show_tree(iobuf, hfile["inner/data"]; attributes = false) + @test occursin(r""" + ๐Ÿ”ข HDF5.Dataset: /inner/data .*$"""m, String(take!(buf))) - # IOContext can halt limiting - HDF5.show_tree(IOContext(iobuf, :limit => false), hfile) - @test countlines(seekstart(buf)) == length(opts) + 1 - truncate(buf, 0) -end + HDF5.show_tree(iobuf, hfile["dtype"]) + @test occursin(r""" + ๐Ÿ“„ HDF5.Datatype: /dtype""", String(take!(buf))) -rm(fn) + HDF5.show_tree(iobuf, hfile["inner/data"]["mode"]; attributes = true) + @test occursin(r""" + ๐Ÿท๏ธ HDF5.Attribute: mode""", String(take!(buf))) -end # show tests + # configurable options -@testset "split1" begin + # no emoji icons + HDF5.SHOW_TREE_ICONS[] = false + @test occursin(r""" + \[F\] HDF5.File: .*$ + โ”œโ”€ \[A\] creator + โ”œโ”€ \[T\] dtype + โ”œโ”€ \[G\] inner + โ”‚ โ”œโ”€ \[A\] dirty + โ”‚ โ””โ”€ \[D\] data + โ”‚ โ””โ”€ \[A\] mode + โ””โ”€ \[D\] version"""m, sprint(show3, hfile)) + HDF5.SHOW_TREE_ICONS[] = true + + # no tree printing + show(IOContext(iobuf, :compact => true), MIME"text/plain"(), hfile) + msg = String(take!(buf)) + @test msg == sprint(show, hfile) + + close(hfile) + + # Now test the print-limiting heuristics for large/complex datasets + + # group with a large number of children; tests child entry truncation heuristic + h5open(fn, "w") do hfile + dt, ds = datatype(Int), dataspace(()) + opts = Iterators.product('A':'Z', 1:9) + for ii in opts + create_dataset(hfile, string(ii...), dt, ds) + end + + def = HDF5.SHOW_TREE_MAX_CHILDREN[] + HDF5.SHOW_TREE_MAX_CHILDREN[] = 5 + + HDF5.show_tree(iobuf, hfile) + msg = String(take!(buf)) + @test occursin(r""" + ๐Ÿ—‚๏ธ HDF5.File: .*$ + โ”œโ”€ ๐Ÿ”ข A1 + โ”œโ”€ ๐Ÿ”ข A2 + โ”œโ”€ ๐Ÿ”ข A3 + โ”œโ”€ ๐Ÿ”ข A4 + โ”œโ”€ ๐Ÿ”ข A5 + โ””โ”€ \(229 more children\)"""m, msg) + @test sprint(show3, hfile) == msg + + HDF5.SHOW_TREE_MAX_CHILDREN[] = def + + # IOContext can halt limiting + HDF5.show_tree(IOContext(iobuf, :limit => false), hfile) + @test countlines(seekstart(buf)) == length(opts) + 1 + truncate(buf, 0) + end -@test HDF5.split1("/") == ("/", "") -@test HDF5.split1("a") == ("a", "") -@test HDF5.split1("/a/b/c") == ("/", "a/b/c") -@test HDF5.split1("a/b/c") == ("a", "b/c") -@test HDF5.split1(GenericString("a")) == ("a", "") -@test HDF5.split1(GenericString("/a/b/c")) == ("/", "a/b/c") -@test HDF5.split1(GenericString("a/b/c")) == ("a", "b/c") - -# The following two paths have the same graphemes but different code unit structures: -# the first one is -# "/" -# while the second one is -# "a" "/" -circa = "รข" # -acomb = "aฬ‚" # "a" + -path1 = circa * "/ฮฑ" -path2 = acomb * "/ฮฑ" -# Sanity checks that the two strings are different but equivalent under normalization -@test path1 != path2 -@test Base.Unicode.normalize(path1, :NFC) == Base.Unicode.normalize(path2, :NFC) -# Check split1 operates correctly -@test HDF5.split1(path1) == (circa, "ฮฑ") -@test HDF5.split1(path2) == (acomb, "ฮฑ") -@test HDF5.split1("/" * path1) == ("/", path1) -@test HDF5.split1("/" * path2) == ("/", path2) + # deeply nested set of elements; test that the tree is truncated + h5open(fn, "w") do hfile + p = HDF5.root(hfile)::HDF5.Group + opts = 'A':'Z' + for ii in opts + p = create_group(p, string(ii)) + end + + def = HDF5.SHOW_TREE_MAX_DEPTH[] + HDF5.SHOW_TREE_MAX_DEPTH[] = 5 + + HDF5.show_tree(iobuf, hfile) + msg = String(take!(buf)) + @test occursin(r""" + ๐Ÿ—‚๏ธ HDF5.File: .*$ + โ””โ”€ ๐Ÿ“‚ A + โ””โ”€ ๐Ÿ“‚ B + โ””โ”€ ๐Ÿ“‚ C + โ””โ”€ ๐Ÿ“‚ D + โ””โ”€ ๐Ÿ“‚ E + โ””โ”€ \(1 child\)"""m, msg) + @test sprint(show3, hfile) == msg + + HDF5.SHOW_TREE_MAX_DEPTH[] = def + + # IOContext can halt limiting + HDF5.show_tree(IOContext(iobuf, :limit => false), hfile) + @test countlines(seekstart(buf)) == length(opts) + 1 + truncate(buf, 0) + end -end # split1 tests + rm(fn) +end # show tests +@testset "split1" begin + @test HDF5.split1("/") == ("/", "") + @test HDF5.split1("a") == ("a", "") + @test HDF5.split1("/a/b/c") == ("/", "a/b/c") + @test HDF5.split1("a/b/c") == ("a", "b/c") + @test HDF5.split1(GenericString("a")) == ("a", "") + @test HDF5.split1(GenericString("/a/b/c")) == ("/", "a/b/c") + @test HDF5.split1(GenericString("a/b/c")) == ("a", "b/c") + + # The following two paths have the same graphemes but different code unit structures: + # the first one is + # "/" + # while the second one is + # "a" "/" + circa = "รข" # + acomb = "aฬ‚" # "a" + + path1 = circa * "/ฮฑ" + path2 = acomb * "/ฮฑ" + # Sanity checks that the two strings are different but equivalent under normalization + @test path1 != path2 + @test Base.Unicode.normalize(path1, :NFC) == Base.Unicode.normalize(path2, :NFC) + # Check split1 operates correctly + @test HDF5.split1(path1) == (circa, "ฮฑ") + @test HDF5.split1(path2) == (acomb, "ฮฑ") + @test HDF5.split1("/" * path1) == ("/", path1) + @test HDF5.split1("/" * path2) == ("/", path2) +end # split1 tests # Also tests AbstractString interface @testset "haskey" begin -fn = tempname() -hfile = h5open(fn, "w") - -group1 = create_group(hfile, "group1") -group2 = create_group(group1, "group2") - -@test haskey(hfile, "/") -@test haskey(hfile, GenericString("group1")) -@test !haskey(hfile, GenericString("groupna")) -@test haskey(hfile, "group1/group2") -@test !haskey(hfile, "group1/groupna") -@test_throws KeyError hfile["nothing"] - -dset1 = create_dataset(hfile, "dset1", datatype(Int), dataspace((1,))) -dset2 = create_dataset(group1, "dset2", datatype(Int), dataspace((1,))) - -@test haskey(hfile, "dset1") -@test !haskey(hfile, "dsetna") -@test haskey(hfile, "group1/dset2") -@test !haskey(hfile, "group1/dsetna") - -meta1 = create_attribute(dset1, "meta1", datatype(Bool), dataspace((1,))) -@test haskey(dset1, "meta1") -@test !haskey(dset1, "metana") -@test_throws KeyError dset1["nothing"] - - -attribs = attributes(hfile) -attribs["test1"] = true -attribs["test2"] = "foo" - -@test haskey(attribs, "test1") -@test haskey(attribs, "test2") -@test !haskey(attribs, "testna") -@test_throws KeyError attribs["nothing"] - -attribs = attributes(dset2) -attribs["attr"] = "foo" -@test haskey(attribs, GenericString("attr")) - -close(hfile) -rm(fn) + fn = tempname() + hfile = h5open(fn, "w") + + group1 = create_group(hfile, "group1") + group2 = create_group(group1, "group2") + + @test haskey(hfile, "/") + @test haskey(hfile, GenericString("group1")) + @test !haskey(hfile, GenericString("groupna")) + @test haskey(hfile, "group1/group2") + @test !haskey(hfile, "group1/groupna") + @test_throws KeyError hfile["nothing"] + + dset1 = create_dataset(hfile, "dset1", datatype(Int), dataspace((1,))) + dset2 = create_dataset(group1, "dset2", datatype(Int), dataspace((1,))) + + @test haskey(hfile, "dset1") + @test !haskey(hfile, "dsetna") + @test haskey(hfile, "group1/dset2") + @test !haskey(hfile, "group1/dsetna") + + meta1 = create_attribute(dset1, "meta1", datatype(Bool), dataspace((1,))) + @test haskey(dset1, "meta1") + @test !haskey(dset1, "metana") + @test_throws KeyError dset1["nothing"] + + attribs = attributes(hfile) + attribs["test1"] = true + attribs["test2"] = "foo" + + @test haskey(attribs, "test1") + @test haskey(attribs, "test2") + @test !haskey(attribs, "testna") + @test_throws KeyError attribs["nothing"] + + attribs = attributes(dset2) + attribs["attr"] = "foo" + @test haskey(attribs, GenericString("attr")) + + close(hfile) + rm(fn) end # haskey tests - @testset "AbstractString" begin + fn = GenericString(tempname()) + hfile = h5open(fn, "w") + close(hfile) + hfile = h5open(fn) + close(hfile) + hfile = h5open(fn, "w") + + @test_nowarn create_group(hfile, GenericString("group1")) + @test_nowarn create_dataset(hfile, GenericString("dset1"), datatype(Int), + dataspace((1,))) + @test_nowarn create_dataset(hfile, GenericString("dset2"), 1) + + @test_nowarn hfile[GenericString("group1")] + @test_nowarn hfile[GenericString("dset1")] + + dset1 = hfile["dset1"] + @test_nowarn create_attribute(dset1, GenericString("meta1"), datatype(Bool), + dataspace((1,))) + @test_nowarn create_attribute(dset1, GenericString("meta2"), 1) + @test_nowarn dset1[GenericString("meta1")] + @test_nowarn dset1[GenericString("x")] = 2 + + array_of_strings = ["test",] + write(hfile, "array_of_strings", array_of_strings) + @test_nowarn attributes(hfile)[GenericString("ref_test")] = HDF5.Reference(hfile, + GenericString("array_of_strings")) + @test read(attributes(hfile)[GenericString("ref_test")]) === + HDF5.Reference(hfile, "array_of_strings") + + hfile[GenericString("test")] = 17.2 + @test_nowarn delete_object(hfile, GenericString("test")) + @test_nowarn delete_attribute(dset1, GenericString("meta1")) + + # transient types + memtype_id = HDF5.API.h5t_copy(HDF5.API.H5T_NATIVE_DOUBLE) + dt = HDF5.Datatype(memtype_id) + @test !HDF5.API.h5t_committed(dt) + commit_datatype(hfile, GenericString("dt"), dt) + @test HDF5.API.h5t_committed(dt) + + dt = datatype(Int) + ds = dataspace(0) + d = create_dataset(hfile, GenericString("d"), dt, ds) + g = create_group(hfile, GenericString("g")) + a = create_attribute(hfile, GenericString("a"), dt, ds) + + for obj in (d, g) + @test_nowarn write_attribute(obj, GenericString("a"), 1) + @test_nowarn read_attribute(obj, GenericString("a")) + @test_nowarn write(obj, GenericString("aa"), 1) + @test_nowarn attributes(obj)["attr1"] = GenericString("b") + end + @test_nowarn write(d, "attr2", GenericString("c")) + @test_nowarn write_dataset(g, GenericString("ag"), GenericString("gg")) + @test_nowarn write_dataset(g, GenericString("ag_array"), + [GenericString("a1"), GenericString("a2")]) + + genstrs = GenericString["fee", "fi", "foo"] + @test_nowarn write_attribute(d, GenericString("myattr"), genstrs) + @test genstrs == read(d["myattr"]) + + for obj in (hfile,) + @test_nowarn open_dataset(obj, GenericString("d")) + @test_nowarn write_dataset(obj, GenericString("dd"), 1) + @test_nowarn read_dataset(obj, GenericString("dd")) + @test_nowarn read(obj, GenericString("dd")) + @test_nowarn read(obj, GenericString("dd") => Int) + end + read(attributes(hfile), GenericString("a")) + + write(hfile, GenericString("ASD"), GenericString("Aa")) + write(g, GenericString("ASD"), GenericString("Aa")) + write(g, GenericString("ASD1"), [GenericString("Aa")]) + + # test writing multiple variable + @test_nowarn write(hfile, GenericString("a1"), rand(2, 2), GenericString("a2"), + rand(2, 2)) + + # copy methods + d1 = create_dataset(hfile, GenericString("d1"), dt, ds) + d1["x"] = 32 + @test_nowarn copy_object(hfile, GenericString("d1"), hfile, GenericString("d1copy1")) + @test_nowarn copy_object(d1, hfile, GenericString("d1copy2")) + + fn = GenericString(tempname()) + A = Matrix(reshape(1:120, 15, 8)) + @test_nowarn h5write(fn, GenericString("A"), A) + @test_nowarn h5read(fn, GenericString("A")) + @test_nowarn h5read(fn, GenericString("A"), (2:3:15, 3:5)) + + @test_nowarn h5write(fn, GenericString("x"), 1) + @test_nowarn h5read(fn, GenericString("x") => Int) + + @test_nowarn h5rewrite(fn) do fid + g = create_group(fid, "mygroup") + write(g, "x", 3.3) + end + @test_nowarn h5rewrite(fn) do fid + g = create_group(fid, "mygroup") + write(g, "y", 3.3) + end -fn = GenericString(tempname()) -hfile = h5open(fn, "w") -close(hfile) -hfile = h5open(fn); close(hfile) -hfile = h5open(fn, "w") - -@test_nowarn create_group(hfile, GenericString("group1")) -@test_nowarn create_dataset(hfile, GenericString("dset1"), datatype(Int), dataspace((1,))) -@test_nowarn create_dataset(hfile, GenericString("dset2"), 1) - -@test_nowarn hfile[GenericString("group1")] -@test_nowarn hfile[GenericString("dset1")] - - -dset1 = hfile["dset1"] -@test_nowarn create_attribute(dset1, GenericString("meta1"), datatype(Bool), dataspace((1,))) -@test_nowarn create_attribute(dset1, GenericString("meta2"), 1) -@test_nowarn dset1[GenericString("meta1")] -@test_nowarn dset1[GenericString("x")] = 2 - -array_of_strings = ["test",] -write(hfile, "array_of_strings", array_of_strings) -@test_nowarn attributes(hfile)[GenericString("ref_test")] = HDF5.Reference(hfile, GenericString("array_of_strings")) -@test read(attributes(hfile)[GenericString("ref_test")]) === HDF5.Reference(hfile, "array_of_strings") - -hfile[GenericString("test")] = 17.2 -@test_nowarn delete_object(hfile, GenericString("test")) -@test_nowarn delete_attribute(dset1, GenericString("meta1")) - -# transient types -memtype_id = HDF5.API.h5t_copy(HDF5.API.H5T_NATIVE_DOUBLE) -dt = HDF5.Datatype(memtype_id) -@test !HDF5.API.h5t_committed(dt) -commit_datatype(hfile, GenericString("dt"), dt) -@test HDF5.API.h5t_committed(dt) - -dt = datatype(Int) -ds = dataspace(0) -d = create_dataset(hfile, GenericString("d"), dt, ds) -g = create_group(hfile, GenericString("g")) -a = create_attribute(hfile, GenericString("a"), dt, ds) - -for obj in (d, g) - @test_nowarn write_attribute(obj, GenericString("a"), 1) - @test_nowarn read_attribute(obj, GenericString("a")) - @test_nowarn write(obj, GenericString("aa"), 1) - @test_nowarn attributes(obj)["attr1"] = GenericString("b") -end -@test_nowarn write(d, "attr2", GenericString("c")) -@test_nowarn write_dataset(g, GenericString("ag"), GenericString("gg")) -@test_nowarn write_dataset(g, GenericString("ag_array"), [GenericString("a1"), GenericString("a2")]) - -genstrs = GenericString["fee", "fi", "foo"] -@test_nowarn write_attribute(d, GenericString("myattr"), genstrs) -@test genstrs == read(d["myattr"]) - -for obj in (hfile,) - @test_nowarn open_dataset(obj, GenericString("d")) - @test_nowarn write_dataset(obj, GenericString("dd"), 1) - @test_nowarn read_dataset(obj, GenericString("dd")) - @test_nowarn read(obj, GenericString("dd")) - @test_nowarn read(obj, GenericString("dd")=>Int) -end -read(attributes(hfile), GenericString("a")) - -write(hfile, GenericString("ASD"), GenericString("Aa")) -write(g, GenericString("ASD"), GenericString("Aa")) -write(g, GenericString("ASD1"), [GenericString("Aa")]) - -# test writing multiple variable -@test_nowarn write(hfile, GenericString("a1"), rand(2,2), GenericString("a2"), rand(2,2)) - -# copy methods -d1 = create_dataset(hfile, GenericString("d1"), dt, ds) -d1["x"] = 32 -@test_nowarn copy_object(hfile, GenericString("d1"), hfile, GenericString("d1copy1")) -@test_nowarn copy_object(d1, hfile, GenericString("d1copy2")) - -fn = GenericString(tempname()) -A = Matrix(reshape(1:120, 15, 8)) -@test_nowarn h5write(fn, GenericString("A"), A) -@test_nowarn h5read(fn, GenericString("A")) -@test_nowarn h5read(fn, GenericString("A"), (2:3:15, 3:5)) - -@test_nowarn h5write(fn, GenericString("x"), 1) -@test_nowarn h5read(fn, GenericString("x") => Int) - - -@test_nowarn h5rewrite(fn) do fid - g = create_group(fid, "mygroup") - write(g, "x", 3.3) + @test_nowarn h5write(fn, "W", [1 2; 3 4]) + @test_nowarn h5writeattr(fn, GenericString("W"), Dict("a" => 1, "b" => 2)) + @test_nowarn h5readattr(fn, GenericString("W")) + + fn_external = GenericString(tempname()) + dset = HDF5.create_external_dataset(hfile, "ext", fn_external, Int, (10, 20)) + dcpl = HDF5.get_create_properties(dset) + @test HDF5.API.h5p_get_external_count(dcpl) == 1 + ext_prop = HDF5.API.h5p_get_external(dcpl) + @test ext_prop.name == fn_external + @test ext_prop.offset == 0 + @test ext_prop.size == 10 * 20 * sizeof(Int) + dapl = HDF5.get_access_properties(dset) + dapl.efile_prefix = "efile_test" + @test HDF5.API.h5p_get_efile_prefix(dapl) == "efile_test" + close(hfile) end -@test_nowarn h5rewrite(fn) do fid - g = create_group(fid, "mygroup") - write(g, "y", 3.3) -end - -@test_nowarn h5write(fn, "W", [1 2; 3 4]) -@test_nowarn h5writeattr(fn, GenericString("W"), Dict("a" => 1, "b" => 2)) -@test_nowarn h5readattr(fn, GenericString("W")) - -fn_external = GenericString(tempname()) -dset = HDF5.create_external_dataset(hfile, "ext", fn_external, Int, (10,20)) -dcpl = HDF5.get_create_properties(dset) -@test HDF5.API.h5p_get_external_count(dcpl) == 1 -ext_prop = HDF5.API.h5p_get_external(dcpl) -@test ext_prop.name == fn_external -@test ext_prop.offset == 0 -@test ext_prop.size == 10*20*sizeof(Int) -dapl = HDF5.get_access_properties(dset) -dapl.efile_prefix = "efile_test" -@test HDF5.API.h5p_get_efile_prefix(dapl) == "efile_test" -close(hfile) -end - -@testset "opaque data" begin - mktemp() do path, io - close(io) - fid = h5open(path, "w") - - num = 1 - olen = 4 - otype = HDF5.Datatype(HDF5.API.h5t_create(HDF5.API.H5T_OPAQUE, olen)) - HDF5.API.h5t_set_tag(otype, "opaque test") - - # scalar - dat0 = rand(UInt8, olen) - create_dataset(fid, "scalar", otype, dataspace(())) - write_dataset(fid["scalar"], otype, dat0) - # vector - dat1 = [rand(UInt8, olen) for _ in 1:4] - buf1 = reduce(vcat, dat1) - create_dataset(fid, "vector", otype, dataspace(dat1)) - write_dataset(fid["vector"], otype, buf1) - # matrix - dat2 = [rand(UInt8, olen) for _ in 1:4, _ in 1:2] - buf2 = reduce(vcat, dat2) - create_dataset(fid, "matrix", otype, dataspace(dat2)) - write_dataset(fid["matrix"], otype, buf2) - - # opaque data within a compound data type - ctype = HDF5.Datatype(HDF5.API.h5t_create(HDF5.API.H5T_COMPOUND, sizeof(num) + sizeof(otype))) - HDF5.API.h5t_insert(ctype, "v", 0, datatype(num)) - HDF5.API.h5t_insert(ctype, "d", sizeof(num), otype) - cdat = vcat(reinterpret(UInt8, [num]), dat0) - create_dataset(fid, "compound", ctype, dataspace(())) - write_dataset(fid["compound"], ctype, cdat) - - opaque0 = read(fid["scalar"]) - @test opaque0.tag == "opaque test" - @test opaque0.data == dat0 - opaque1 = read(fid["vector"]) - @test opaque1.tag == "opaque test" - @test opaque1.data == dat1 - opaque2 = read(fid["matrix"]) - @test opaque2.tag == "opaque test" - @test opaque2.data == dat2 - - # Note: opaque tag is lost - compound = read(fid["compound"]) - @test compound == (v = num, d = dat0) - - close(fid) - end -end +@testset "opaque data" begin mktemp() do path, io + close(io) + fid = h5open(path, "w") + + num = 1 + olen = 4 + otype = HDF5.Datatype(HDF5.API.h5t_create(HDF5.API.H5T_OPAQUE, olen)) + HDF5.API.h5t_set_tag(otype, "opaque test") + + # scalar + dat0 = rand(UInt8, olen) + create_dataset(fid, "scalar", otype, dataspace(())) + write_dataset(fid["scalar"], otype, dat0) + # vector + dat1 = [rand(UInt8, olen) for _ in 1:4] + buf1 = reduce(vcat, dat1) + create_dataset(fid, "vector", otype, dataspace(dat1)) + write_dataset(fid["vector"], otype, buf1) + # matrix + dat2 = [rand(UInt8, olen) for _ in 1:4, _ in 1:2] + buf2 = reduce(vcat, dat2) + create_dataset(fid, "matrix", otype, dataspace(dat2)) + write_dataset(fid["matrix"], otype, buf2) + + # opaque data within a compound data type + ctype = HDF5.Datatype(HDF5.API.h5t_create(HDF5.API.H5T_COMPOUND, + sizeof(num) + sizeof(otype))) + HDF5.API.h5t_insert(ctype, "v", 0, datatype(num)) + HDF5.API.h5t_insert(ctype, "d", sizeof(num), otype) + cdat = vcat(reinterpret(UInt8, [num]), dat0) + create_dataset(fid, "compound", ctype, dataspace(())) + write_dataset(fid["compound"], ctype, cdat) + + opaque0 = read(fid["scalar"]) + @test opaque0.tag == "opaque test" + @test opaque0.data == dat0 + opaque1 = read(fid["vector"]) + @test opaque1.tag == "opaque test" + @test opaque1.data == dat1 + opaque2 = read(fid["matrix"]) + @test opaque2.tag == "opaque test" + @test opaque2.data == dat2 + + # Note: opaque tag is lost + compound = read(fid["compound"]) + @test compound == (v = num, d = dat0) + + close(fid) +end end @testset "FixedStrings and FixedArrays" begin # properties for FixedString @@ -1304,13 +1332,14 @@ end mktemp() do path, io close(io) num = Int64(9) - ref = join('a':'z') ^ 1000 + ref = join('a':'z')^1000 fid = h5open(path, "w") # long string serialized as FixedString fid["longstring"] = ref # compound datatype containing a FixedString - compound_dtype = HDF5.Datatype(HDF5.API.h5t_create(HDF5.API.H5T_COMPOUND, sizeof(num) + sizeof(ref))) + compound_dtype = HDF5.Datatype(HDF5.API.h5t_create(HDF5.API.H5T_COMPOUND, + sizeof(num) + sizeof(ref))) HDF5.API.h5t_insert(compound_dtype, "n", 0, datatype(num)) HDF5.API.h5t_insert(compound_dtype, "a", sizeof(num), datatype(ref)) c = create_dataset(fid, "compoundlongstring", compound_dtype, dataspace(())) @@ -1321,7 +1350,6 @@ end @assert position(buf) == sizeof(compound_dtype) write_dataset(c, compound_dtype, take!(buf)) - # Test reading without stalling d = fid["longstring"] T = HDF5.get_jl_type(d) @@ -1337,7 +1365,7 @@ end close(fid) end - fix = HDF5.FixedArray{Float64,(2,2),4}((1, 2, 3, 4)) + fix = HDF5.FixedArray{Float64,(2, 2),4}((1, 2, 3, 4)) @test size(typeof(fix)) == (2, 2) @test size(fix) == (2, 2) @test eltype(typeof(fix)) == Float64 @@ -1346,7 +1374,8 @@ end mktemp() do path, io close(io) ref = rand(Float64, 3000) - t = HDF5.Datatype(HDF5.API.h5t_array_create(datatype(Float64), ndims(ref), collect(size(ref)))) + t = HDF5.Datatype(HDF5.API.h5t_array_create(datatype(Float64), ndims(ref), + collect(size(ref)))) scalarspace = dataspace(()) fid = h5open(path, "w") @@ -1364,45 +1393,41 @@ end end @testset "Object Exists" begin + hfile = h5open(tempname(), "w") + g1 = create_group(hfile, "group1") + @test_throws ErrorException create_group(hfile, "group1") + create_group(g1, "group1a") + @test_throws ErrorException create_group(hfile, "/group1/group1a") + @test_throws ErrorException create_group(g1, "group1a") -hfile = h5open(tempname(), "w") -g1 = create_group(hfile, "group1") -@test_throws ErrorException create_group(hfile, "group1") -create_group(g1, "group1a") -@test_throws ErrorException create_group(hfile, "/group1/group1a") -@test_throws ErrorException create_group(g1, "group1a") + create_dataset(hfile, "dset1", 1) + create_dataset(hfile, "/group1/dset1", 1) -create_dataset(hfile, "dset1", 1) -create_dataset(hfile, "/group1/dset1", 1) - -@test_throws ErrorException create_dataset(hfile, "dset1", 1) -@test_throws ErrorException create_dataset(hfile, "group1", 1) -@test_throws ErrorException create_dataset(g1, "dset1", 1) - -close(hfile) + @test_throws ErrorException create_dataset(hfile, "dset1", 1) + @test_throws ErrorException create_dataset(hfile, "group1", 1) + @test_throws ErrorException create_dataset(g1, "dset1", 1) + close(hfile) end @testset "HDF5 existance" begin + fn1 = tempname() + fn2 = tempname() -fn1 = tempname() -fn2 = tempname() - -open(fn1, "w") do f - write(f, "Hello text file") -end - -@test !HDF5.ishdf5(fn1) # check that a non-hdf5 file retuns false -@test !HDF5.ishdf5(fn2) # checks that a file that does not exist returns false + open(fn1, "w") do f + write(f, "Hello text file") + end -@test_throws ErrorException h5write(fn1, "x", 1) # non hdf5 file throws -h5write(fn2, "x", 1) + @test !HDF5.ishdf5(fn1) # check that a non-hdf5 file retuns false + @test !HDF5.ishdf5(fn2) # checks that a file that does not exist returns false -@test HDF5.ishdf5(fn2) + @test_throws ErrorException h5write(fn1, "x", 1) # non hdf5 file throws + h5write(fn2, "x", 1) -rm(fn1) -rm(fn2) + @test HDF5.ishdf5(fn2) + rm(fn1) + rm(fn2) end @testset "bounds" begin @@ -1413,6 +1438,4 @@ h5open(tempname(), "w") do f @test_throws ArgumentError write(a, ones(2)) d, _ = create_dataset(f, "dd", zeros(4)) @test_throws ArgumentError write(d, ones(2)) -end - -end +end end diff --git a/test/properties.jl b/test/properties.jl index 9030ffa03..7af67b512 100644 --- a/test/properties.jl +++ b/test/properties.jl @@ -2,115 +2,112 @@ using HDF5 using Test @testset "properties" begin - -fn = tempname() -h5open(fn, "w"; - userblock = 1024, - alignment = (0, sizeof(Int)), - libver_bounds = (:earliest, :latest), - meta_block_size = 1024, - strategy = :fsm_aggr, - persist = 1, - threshold = 2, - file_space_page_size = 0x800 - ) do hfile - # generic - g = create_group(hfile, "group") - if HDF5.API.h5_get_libversion() >= v"1.10.5" - kwargs = (:no_attrs_hint => true,) - else - kwargs = () + fn = tempname() + h5open(fn, "w"; + userblock = 1024, + alignment = (0, sizeof(Int)), + libver_bounds = (:earliest, :latest), + meta_block_size = 1024, + strategy = :fsm_aggr, + persist = 1, + threshold = 2, + file_space_page_size = 0x800) do hfile + # generic + g = create_group(hfile, "group") + if HDF5.API.h5_get_libversion() >= v"1.10.5" + kwargs = (:no_attrs_hint => true,) + else + kwargs = () + end + d = create_dataset(g, "dataset", datatype(Int), dataspace((500, 50)); + alloc_time = HDF5.API.H5D_ALLOC_TIME_EARLY, + chunk = (5, 10), + fill_value = 1, + fill_time = :never, + obj_track_times = false, + chunk_cache = (522, 0x200000, 0.80), + efile_prefix = :origin, + virtual_prefix = "virtual", + virtual_printf_gap = 2, + virtual_view = :last_available, + kwargs...) + attributes(d)["metadata"] = "test" + + flush(hfile) + + fcpl = HDF5.get_create_properties(hfile) + fapl = HDF5.get_access_properties(hfile) + gcpl = HDF5.get_create_properties(hfile["group"]) + dcpl = HDF5.get_create_properties(d) + dapl = HDF5.get_access_properties(d) + acpl = HDF5.get_create_properties(attributes(d)["metadata"]) + + # Retrievability of properties + @test isvalid(fcpl) + @test isvalid(fapl) + @test isvalid(gcpl) + @test isvalid(dcpl) + @test isvalid(dapl) + @test isvalid(acpl) + + # Retrieving property values: + @test fcpl.userblock == 1024 + @test fcpl.obj_track_times + @test fcpl.file_space_page_size == 0x800 + @test fcpl.strategy == :fsm_aggr + @test fcpl.persist == 1 + @test fcpl.threshold == 2 + + @test fapl.alignment == (0, sizeof(Int)) + @test fapl.driver == Drivers.POSIX() + @test_throws HDF5.API.H5Error fapl.driver_info + @test fapl.fclose_degree == :strong + @test fapl.libver_bounds == (:earliest, Base.thisminor(HDF5.libversion)) + @test fapl.meta_block_size == 1024 + + @test gcpl.local_heap_size_hint == 0 + @test gcpl.obj_track_times + + @test HDF5.UTF8_LINK_PROPERTIES.char_encoding == :utf8 + @test HDF5.UTF8_LINK_PROPERTIES.create_intermediate_group + + @test dcpl.alloc_time == :early + @test dcpl.chunk == (5, 10) + @test dcpl.layout == :chunked + @test !dcpl.obj_track_times + @test dcpl.fill_time == :never + @test dcpl.fill_value == 1.0 + if HDF5.API.h5_get_libversion() >= v"1.10.5" + @test dcpl.no_attrs_hint == true + end + + @test dapl.chunk_cache.nslots == 522 + @test dapl.chunk_cache.nbytes == 0x200000 + @test dapl.chunk_cache.w0 == 0.8 + @test dapl.efile_prefix == raw"$ORIGIN" + @test dapl.virtual_prefix == "virtual" + # We probably need to actually use a virtual dataset + @test_broken dapl.virtual_printf_gap == 2 + @test_broken dapl.virtual_view == :last_available + + @test acpl.char_encoding == :utf8 + + # Test auto-initialization of property lists on get + dcpl2 = HDF5.DatasetCreateProperties() # uninitialized + @test dcpl2.id < 1 # 0 or -1 + @test !isvalid(dcpl2) + @test dcpl2.alloc_time == :late + @test isvalid(dcpl2) + + # Test H5Pcopy + dapl2 = copy(dapl) + @test dapl2.id != dapl.id + @test dapl2.virtual_prefix == dapl.virtual_prefix + dapl2.virtual_prefix = "somewhere_else" + @test dapl2.virtual_prefix != dapl.virtual_prefix + + nothing end - d = create_dataset(g, "dataset", datatype(Int), dataspace((500,50)); - alloc_time = HDF5.API.H5D_ALLOC_TIME_EARLY, - chunk = (5, 10), - fill_value = 1, - fill_time = :never, - obj_track_times = false, - chunk_cache = (522, 0x200000, 0.80), - efile_prefix = :origin, - virtual_prefix = "virtual", - virtual_printf_gap = 2, - virtual_view = :last_available, - kwargs...) - attributes(d)["metadata"] = "test" - - flush(hfile) - - fcpl = HDF5.get_create_properties(hfile) - fapl = HDF5.get_access_properties(hfile) - gcpl = HDF5.get_create_properties(hfile["group"]) - dcpl = HDF5.get_create_properties(d) - dapl = HDF5.get_access_properties(d) - acpl = HDF5.get_create_properties(attributes(d)["metadata"]) - - # Retrievability of properties - @test isvalid(fcpl) - @test isvalid(fapl) - @test isvalid(gcpl) - @test isvalid(dcpl) - @test isvalid(dapl) - @test isvalid(acpl) - - # Retrieving property values: - @test fcpl.userblock == 1024 - @test fcpl.obj_track_times - @test fcpl.file_space_page_size == 0x800 - @test fcpl.strategy == :fsm_aggr - @test fcpl.persist == 1 - @test fcpl.threshold == 2 - - @test fapl.alignment == (0, sizeof(Int)) - @test fapl.driver == Drivers.POSIX() - @test_throws HDF5.API.H5Error fapl.driver_info - @test fapl.fclose_degree == :strong - @test fapl.libver_bounds == (:earliest, Base.thisminor(HDF5.libversion)) - @test fapl.meta_block_size == 1024 - - @test gcpl.local_heap_size_hint == 0 - @test gcpl.obj_track_times - - @test HDF5.UTF8_LINK_PROPERTIES.char_encoding == :utf8 - @test HDF5.UTF8_LINK_PROPERTIES.create_intermediate_group - - @test dcpl.alloc_time == :early - @test dcpl.chunk == (5, 10) - @test dcpl.layout == :chunked - @test !dcpl.obj_track_times - @test dcpl.fill_time == :never - @test dcpl.fill_value == 1.0 - if HDF5.API.h5_get_libversion() >= v"1.10.5" - @test dcpl.no_attrs_hint == true - end - - @test dapl.chunk_cache.nslots == 522 - @test dapl.chunk_cache.nbytes == 0x200000 - @test dapl.chunk_cache.w0 == 0.8 - @test dapl.efile_prefix == raw"$ORIGIN" - @test dapl.virtual_prefix == "virtual" - # We probably need to actually use a virtual dataset - @test_broken dapl.virtual_printf_gap == 2 - @test_broken dapl.virtual_view == :last_available - - @test acpl.char_encoding == :utf8 - - # Test auto-initialization of property lists on get - dcpl2 = HDF5.DatasetCreateProperties() # uninitialized - @test dcpl2.id < 1 # 0 or -1 - @test !isvalid(dcpl2) - @test dcpl2.alloc_time == :late - @test isvalid(dcpl2) - - # Test H5Pcopy - dapl2 = copy(dapl) - @test dapl2.id != dapl.id - @test dapl2.virtual_prefix == dapl.virtual_prefix - dapl2.virtual_prefix = "somewhere_else" - @test dapl2.virtual_prefix != dapl.virtual_prefix - - nothing -end - -rm(fn, force=true) + rm(fn; force = true) end diff --git a/test/readremote.jl b/test/readremote.jl index 3baa46426..5a0be382a 100644 --- a/test/readremote.jl +++ b/test/readremote.jl @@ -4,187 +4,184 @@ using LinearAlgebra: norm @testset "readremote" begin -# check that we can read the official HDF5 example files - -# download and save test file via: -# urlbase = "https://support.hdfgroup.org/ftp/HDF5/examples/files/exbyapi/" -test_files = joinpath(@__DIR__, "test_files") -# if !isdir(test_files) -# mkdir(test_files) -# end -# function joinpath(test_files, name) -# file = joinpath(test_files, name) -# if !isfile(file) -# file = download(urlbase*name, file) -# end -# file -# end - -fcmp = [0 1 2 3 4 5 6; - 2 1.66667 2.4 3.28571 4.22222 5.18182 6.15385; - 4 2.33333 2.8 3.57143 4.44444 5.36364 6.30769; - 6 3 3.2 3.85714 4.66667 5.54545 6.46154]' -icmp = [0 -1 -2 -3 -4 -5 -6; - 0 0 0 0 0 0 0; - 0 1 2 3 4 5 6; - 0 2 4 6 8 10 12]' -SOLID, LIQUID, GAS, PLASMA = 0, 1, 2, 3 -ecmp = [SOLID SOLID SOLID SOLID SOLID SOLID SOLID; - SOLID LIQUID GAS PLASMA SOLID LIQUID GAS; - SOLID GAS SOLID GAS SOLID GAS SOLID; - SOLID PLASMA GAS LIQUID SOLID PLASMA GAS]' -scmp = ["Parting", "is such", "sweet", "sorrow."] -vicmp = Array{Int32}[[3, 2, 1],[1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144]] -opq = Array{UInt8}[[0x4f, 0x50, 0x41, 0x51, 0x55, 0x45, 0x30], - [0x4f, 0x50, 0x41, 0x51, 0x55, 0x45, 0x31], - [0x4f, 0x50, 0x41, 0x51, 0x55, 0x45, 0x32], - [0x4f, 0x50, 0x41, 0x51, 0x55, 0x45, 0x33]] -# For H5T_ARRAY -AA = Array{Int,2}[ - [0 0 0; - 0 -1 -2; - 0 -2 -4; - 0 -3 -6; - 0 -4 -8], - [0 1 2; - 1 1 1; - 2 1 0; - 3 1 -1; - 4 1 -2], - [0 2 4; - 2 3 4; - 4 4 4; - 6 5 4; - 8 6 4], - [0 3 6; - 3 5 7; - 6 7 8; - 9 9 9; - 12 11 10]] - - -file = joinpath(test_files, "h5ex_t_floatatt.h5") -fid = h5open(file, "r") -dset = fid["DS1"] -a = read_attribute(dset, "A1") -@test norm(a - fcmp) < 1.5e-5 -close(fid) - -file = joinpath(test_files, "h5ex_t_float.h5") -fid = h5open(file, "r") -d = read(fid, "DS1") -@test norm(d - fcmp) < 1.5e-5 -close(fid) - -file = joinpath(test_files, "h5ex_t_intatt.h5") -fid = h5open(file, "r") -dset = fid["DS1"] -a = read_attribute(dset, "A1") -@test a == icmp -close(fid) - -file = joinpath(test_files, "h5ex_t_int.h5") -fid = h5open(file, "r") -d = read(fid, "DS1") -@test d == icmp -close(fid) - -if HDF5.API.h5_get_libversion() >= v"1.8.11" - file = joinpath(test_files, "h5ex_t_enumatt.h5") - fid = h5open(file, "r") - dset = fid["DS1"] - a = read_attribute(dset, "A1") - @test a == ecmp - close(fid) - - file = joinpath(test_files, "h5ex_t_enum.h5") - fid = h5open(file, "r") - d = read(fid, "DS1") - @test d == ecmp - close(fid) -end - -file = joinpath(test_files, "h5ex_t_objrefatt.h5") -fid = h5open(file, "r") -dset = fid["DS1"] -a = read_attribute(dset, "A1") -g = fid[a[1]] -@test isa(g, HDF5.Group) -ds2 = fid[a[2]] -ds2v = read(ds2) -@test isa(ds2v, HDF5.EmptyArray{Int32}) -@test isempty(ds2v) -close(fid) - -file = joinpath(test_files, "h5ex_t_objref.h5") -fid = h5open(file, "r") -d = read(fid, "DS1") -g = fid[d[1]] -@test isa(g, HDF5.Group) -ds2 = fid[d[2]] -ds2v = read(ds2) -@test isa(ds2v, HDF5.EmptyArray{Int32}) -@test isempty(ds2v) -close(fid) - -file = joinpath(test_files, "h5ex_t_stringatt.h5") -fid = h5open(file, "r") -dset = fid["DS1"] -a = read_attribute(dset, "A1") -@test a == scmp -close(fid) - -file = joinpath(test_files, "h5ex_t_string.h5") -fid = h5open(file, "r") -d = read(fid, "DS1") -@test d == scmp -close(fid) - -file = joinpath(test_files, "h5ex_t_vlenatt.h5") -fid = h5open(file, "r") -dset = fid["DS1"] -a = read_attribute(dset, "A1") -@test a == vicmp -close(fid) - -file = joinpath(test_files, "h5ex_t_vlen.h5") -fid = h5open(file, "r") -d = read(fid, "DS1") -@test d == vicmp -close(fid) - -file = joinpath(test_files, "h5ex_t_vlstringatt.h5") -fid = h5open(file, "r") -dset = fid["DS1"] -a = read_attribute(dset, "A1") -@test a == scmp -close(fid) - -file = joinpath(test_files, "h5ex_t_vlstring.h5") -fid = h5open(file, "r") -d = read(fid, "DS1") -@test d == scmp -close(fid) - -file = joinpath(test_files, "h5ex_t_opaqueatt.h5") -fid = h5open(file, "r") -dset = fid["DS1"] -a = read_attribute(dset, "A1") -@test a.tag == "Character array" -@test a.data == opq -close(fid) - -file = joinpath(test_files, "h5ex_t_opaque.h5") -fid = h5open(file, "r") -d = read(fid, "DS1") -@test d.tag == "Character array" -@test d.data == opq -close(fid) - -file = joinpath(test_files, "h5ex_t_array.h5") -fid = h5open(file, "r") -A = read(fid, "DS1") -@test A == AA -close(fid) - + # check that we can read the official HDF5 example files + + # download and save test file via: + # urlbase = "https://support.hdfgroup.org/ftp/HDF5/examples/files/exbyapi/" + test_files = joinpath(@__DIR__, "test_files") + # if !isdir(test_files) + # mkdir(test_files) + # end + # function joinpath(test_files, name) + # file = joinpath(test_files, name) + # if !isfile(file) + # file = download(urlbase*name, file) + # end + # file + # end + + fcmp = [0 1 2 3 4 5 6; + 2 1.66667 2.4 3.28571 4.22222 5.18182 6.15385; + 4 2.33333 2.8 3.57143 4.44444 5.36364 6.30769; + 6 3 3.2 3.85714 4.66667 5.54545 6.46154]' + icmp = [0 -1 -2 -3 -4 -5 -6; + 0 0 0 0 0 0 0; + 0 1 2 3 4 5 6; + 0 2 4 6 8 10 12]' + SOLID, LIQUID, GAS, PLASMA = 0, 1, 2, 3 + ecmp = [SOLID SOLID SOLID SOLID SOLID SOLID SOLID; + SOLID LIQUID GAS PLASMA SOLID LIQUID GAS; + SOLID GAS SOLID GAS SOLID GAS SOLID; + SOLID PLASMA GAS LIQUID SOLID PLASMA GAS]' + scmp = ["Parting", "is such", "sweet", "sorrow."] + vicmp = Array{Int32}[[3, 2, 1], [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144]] + opq = Array{UInt8}[[0x4f, 0x50, 0x41, 0x51, 0x55, 0x45, 0x30], + [0x4f, 0x50, 0x41, 0x51, 0x55, 0x45, 0x31], + [0x4f, 0x50, 0x41, 0x51, 0x55, 0x45, 0x32], + [0x4f, 0x50, 0x41, 0x51, 0x55, 0x45, 0x33]] + # For H5T_ARRAY + AA = Array{Int,2}[[0 0 0; + 0 -1 -2; + 0 -2 -4; + 0 -3 -6; + 0 -4 -8], + [0 1 2; + 1 1 1; + 2 1 0; + 3 1 -1; + 4 1 -2], + [0 2 4; + 2 3 4; + 4 4 4; + 6 5 4; + 8 6 4], + [0 3 6; + 3 5 7; + 6 7 8; + 9 9 9; + 12 11 10]] + + file = joinpath(test_files, "h5ex_t_floatatt.h5") + fid = h5open(file, "r") + dset = fid["DS1"] + a = read_attribute(dset, "A1") + @test norm(a - fcmp) < 1.5e-5 + close(fid) + + file = joinpath(test_files, "h5ex_t_float.h5") + fid = h5open(file, "r") + d = read(fid, "DS1") + @test norm(d - fcmp) < 1.5e-5 + close(fid) + + file = joinpath(test_files, "h5ex_t_intatt.h5") + fid = h5open(file, "r") + dset = fid["DS1"] + a = read_attribute(dset, "A1") + @test a == icmp + close(fid) + + file = joinpath(test_files, "h5ex_t_int.h5") + fid = h5open(file, "r") + d = read(fid, "DS1") + @test d == icmp + close(fid) + + if HDF5.API.h5_get_libversion() >= v"1.8.11" + file = joinpath(test_files, "h5ex_t_enumatt.h5") + fid = h5open(file, "r") + dset = fid["DS1"] + a = read_attribute(dset, "A1") + @test a == ecmp + close(fid) + + file = joinpath(test_files, "h5ex_t_enum.h5") + fid = h5open(file, "r") + d = read(fid, "DS1") + @test d == ecmp + close(fid) + end + + file = joinpath(test_files, "h5ex_t_objrefatt.h5") + fid = h5open(file, "r") + dset = fid["DS1"] + a = read_attribute(dset, "A1") + g = fid[a[1]] + @test isa(g, HDF5.Group) + ds2 = fid[a[2]] + ds2v = read(ds2) + @test isa(ds2v, HDF5.EmptyArray{Int32}) + @test isempty(ds2v) + close(fid) + + file = joinpath(test_files, "h5ex_t_objref.h5") + fid = h5open(file, "r") + d = read(fid, "DS1") + g = fid[d[1]] + @test isa(g, HDF5.Group) + ds2 = fid[d[2]] + ds2v = read(ds2) + @test isa(ds2v, HDF5.EmptyArray{Int32}) + @test isempty(ds2v) + close(fid) + + file = joinpath(test_files, "h5ex_t_stringatt.h5") + fid = h5open(file, "r") + dset = fid["DS1"] + a = read_attribute(dset, "A1") + @test a == scmp + close(fid) + + file = joinpath(test_files, "h5ex_t_string.h5") + fid = h5open(file, "r") + d = read(fid, "DS1") + @test d == scmp + close(fid) + + file = joinpath(test_files, "h5ex_t_vlenatt.h5") + fid = h5open(file, "r") + dset = fid["DS1"] + a = read_attribute(dset, "A1") + @test a == vicmp + close(fid) + + file = joinpath(test_files, "h5ex_t_vlen.h5") + fid = h5open(file, "r") + d = read(fid, "DS1") + @test d == vicmp + close(fid) + + file = joinpath(test_files, "h5ex_t_vlstringatt.h5") + fid = h5open(file, "r") + dset = fid["DS1"] + a = read_attribute(dset, "A1") + @test a == scmp + close(fid) + + file = joinpath(test_files, "h5ex_t_vlstring.h5") + fid = h5open(file, "r") + d = read(fid, "DS1") + @test d == scmp + close(fid) + + file = joinpath(test_files, "h5ex_t_opaqueatt.h5") + fid = h5open(file, "r") + dset = fid["DS1"] + a = read_attribute(dset, "A1") + @test a.tag == "Character array" + @test a.data == opq + close(fid) + + file = joinpath(test_files, "h5ex_t_opaque.h5") + fid = h5open(file, "r") + d = read(fid, "DS1") + @test d.tag == "Character array" + @test d.data == opq + close(fid) + + file = joinpath(test_files, "h5ex_t_array.h5") + fid = h5open(file, "r") + A = read(fid, "DS1") + @test A == AA + close(fid) end # testset readremote diff --git a/test/runtests.jl b/test/runtests.jl index 612ba4402..0f7debf8d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -2,12 +2,12 @@ using HDF5 using Test using Pkg filter_path = joinpath(dirname(pathof(HDF5)), "..", "filters") -Pkg.develop(PackageSpec(path=joinpath(filter_path, "H5Zblosc"))) -Pkg.develop(PackageSpec(path=joinpath(filter_path, "H5Zbzip2"))) -Pkg.develop(PackageSpec(path=joinpath(filter_path, "H5Zlz4"))) -Pkg.develop(PackageSpec(path=joinpath(filter_path, "H5Zzstd"))) +Pkg.develop(PackageSpec(; path = joinpath(filter_path, "H5Zblosc"))) +Pkg.develop(PackageSpec(; path = joinpath(filter_path, "H5Zbzip2"))) +Pkg.develop(PackageSpec(; path = joinpath(filter_path, "H5Zlz4"))) +Pkg.develop(PackageSpec(; path = joinpath(filter_path, "H5Zzstd"))) @static if VERSION >= v"1.6" - Pkg.develop(PackageSpec(path=joinpath(filter_path, "H5Zbitshuffle"))) + Pkg.develop(PackageSpec(; path = joinpath(filter_path, "H5Zbitshuffle"))) end @info "libhdf5 v$(HDF5.API.h5_get_libversion())" @@ -16,61 +16,59 @@ end # ENV["JULIA_DEBUG"] = "Main" @testset "HDF5.jl" begin + @debug "plain" + include("plain.jl") + @debug "api" + include("api.jl") + @debug "compound" + include("compound.jl") + @debug "custom" + include("custom.jl") + @debug "reference" + include("reference.jl") + @debug "dataspace" + include("dataspace.jl") + @debug "datatype" + include("datatype.jl") + @debug "hyperslab" + include("hyperslab.jl") + @debug "attributes" + include("attributes.jl") + @debug "readremote" + include("readremote.jl") + @debug "extend_test" + include("extend_test.jl") + @debug "gc" + include("gc.jl") + @debug "external" + include("external.jl") + @debug "swmr" + include("swmr.jl") + @debug "mmap" + include("mmap.jl") + @debug "properties" + include("properties.jl") + @debug "table" + include("table.jl") + @debug "filter" + include("filter.jl") + @debug "chunkstorage" + include("chunkstorage.jl") + @debug "fileio" + include("fileio.jl") + @debug "nonallocating" + include("nonallocating.jl") + @debug "filter test utils" + include("filters/FilterTestUtils.jl") + @debug "objects" + include("objects.jl") -@debug "plain" -include("plain.jl") -@debug "api" -include("api.jl") -@debug "compound" -include("compound.jl") -@debug "custom" -include("custom.jl") -@debug "reference" -include("reference.jl") -@debug "dataspace" -include("dataspace.jl") -@debug "datatype" -include("datatype.jl") -@debug "hyperslab" -include("hyperslab.jl") -@debug "attributes" -include("attributes.jl") -@debug "readremote" -include("readremote.jl") -@debug "extend_test" -include("extend_test.jl") -@debug "gc" -include("gc.jl") -@debug "external" -include("external.jl") -@debug "swmr" -include("swmr.jl") -@debug "mmap" -include("mmap.jl") -@debug "properties" -include("properties.jl") -@debug "table" -include("table.jl") -@debug "filter" -include("filter.jl") -@debug "chunkstorage" -include("chunkstorage.jl") -@debug "fileio" -include("fileio.jl") -@debug "nonallocating" -include("nonallocating.jl") -@debug "filter test utils" -include("filters/FilterTestUtils.jl") -@debug "objects" -include("objects.jl") - -using MPI -if HDF5.has_parallel() - # basic MPI tests, for actual parallel tests we need to run in MPI mode - include("mpio.jl") -end - -# Clean up after all resources -HDF5.API.h5_close() + using MPI + if HDF5.has_parallel() + # basic MPI tests, for actual parallel tests we need to run in MPI mode + include("mpio.jl") + end + # Clean up after all resources + HDF5.API.h5_close() end diff --git a/test/swmr.jl b/test/swmr.jl index 0cc6e7e2a..a893c9823 100644 --- a/test/swmr.jl +++ b/test/swmr.jl @@ -12,113 +12,109 @@ end @everywhere using HDF5 @testset "swmr" begin -fname = tempname() + fname = tempname() -@testset "swmr modes" begin - h5open(fname, "w", swmr=true) do h5 - h5["foo"] = collect(1:10) - end - h5open(fname, "r", swmr=true) do h5 - @test read(h5["foo"]) == collect(1:10) - end - h5open(fname, "r+", swmr=true) do h5 - @test read(h5["foo"]) == collect(1:10) + @testset "swmr modes" begin + h5open(fname, "w"; swmr = true) do h5 + h5["foo"] = collect(1:10) + end + h5open(fname, "r"; swmr = true) do h5 + @test read(h5["foo"]) == collect(1:10) + end + h5open(fname, "r+"; swmr = true) do h5 + @test read(h5["foo"]) == collect(1:10) + end end -end -@testset "h5d_oappend" begin - h5open(fname, "w") do h5 + @testset "h5d_oappend" begin h5open(fname, "w") do h5 g = create_group(h5, "shoe") - d = create_dataset(g, "bar", datatype(Float64), ((1,), (-1,)), chunk=(100,)) + d = create_dataset(g, "bar", datatype(Float64), ((1,), (-1,)); chunk = (100,)) dxpl_id = HDF5.get_create_properties(d) v = [1.0, 2.0] memtype = datatype(Float64) # @test HDF5.h5d_oappend(d, dxpl_id, 0, length(v), memtype, v) - end -end + end end -function dataset_write(d, ch_written, ch_read) - for i = 1:10 - @assert take!(ch_read) == true - HDF5.set_extent_dims(d, (i*10,)) - inds::UnitRange{Int} = (1:10) .+ (i - 1) * 10 - d[inds] = inds - flush(d) # flush the dataset - put!(ch_written,i) + function dataset_write(d, ch_written, ch_read) + for i in 1:10 + @assert take!(ch_read) == true + HDF5.set_extent_dims(d, (i * 10,)) + inds::UnitRange{Int} = (1:10) .+ (i - 1) * 10 + d[inds] = inds + flush(d) # flush the dataset + put!(ch_written, i) + end end -end -@everywhere function dataset_read(d, ch_written, ch_read) - n = nlast = length(d) - nbigger = 0 - i = 0 - put!(ch_read, true) - while n < 100 - i = take!(ch_written) - for j = 1:1000 # wait for new data to be available to avoid CI failures - HDF5.refresh(d) - nlast, n = n, length(d) - n > nlast && break - sleep(0.001) + @everywhere function dataset_read(d, ch_written, ch_read) + n = nlast = length(d) + nbigger = 0 + i = 0 + put!(ch_read, true) + while n < 100 + i = take!(ch_written) + for j in 1:1000 # wait for new data to be available to avoid CI failures + HDF5.refresh(d) + nlast, n = n, length(d) + n > nlast && break + sleep(0.001) + end + vals = read(d) + @assert vals == collect(1:n) + n > nlast && (nbigger += 1) + put!(ch_read, true) end - vals = read(d) - @assert vals == collect(1:n) - n > nlast && (nbigger += 1) - put!(ch_read,true) + return nbigger end - return nbigger -end -@everywhere function swmr_reader(fname, ch_written, ch_read) - h5open(fname, "r", swmr=true) do h5 - d = h5["foo"] - dataset_read(d, ch_written, ch_read) + @everywhere function swmr_reader(fname, ch_written, ch_read) + h5open(fname, "r"; swmr = true) do h5 + d = h5["foo"] + dataset_read(d, ch_written, ch_read) + end end -end -# Spawn a reader function in a 2nd process, provide two channels for synchronization. -# Run a writing function in this process. The writing function writes, -# then notifies `ch_read`, then the reading function reads, and notifies `ch_read`. So read -# attempts should always follow writes, though there may be a delay before the data is available -# so there is a step that sleeps until data is available. -function remote_test(h5) - ch_written, ch_read = RemoteChannel(1), RemoteChannel(1) - a = @spawn(swmr_reader(fname, ch_written, ch_read)) - dataset_write(h5["foo"], ch_written, ch_read) - nbigger = fetch(a) - @test nbigger == 10 -end + # Spawn a reader function in a 2nd process, provide two channels for synchronization. + # Run a writing function in this process. The writing function writes, + # then notifies `ch_read`, then the reading function reads, and notifies `ch_read`. So read + # attempts should always follow writes, though there may be a delay before the data is available + # so there is a step that sleeps until data is available. + function remote_test(h5) + ch_written, ch_read = RemoteChannel(1), RemoteChannel(1) + a = @spawn(swmr_reader(fname, ch_written, ch_read)) + dataset_write(h5["foo"], ch_written, ch_read) + nbigger = fetch(a) + @test nbigger == 10 + end -# create datasets and attributes before staring swmr writing -function prep_h5_file(h5) - d = create_dataset(h5, "foo", datatype(Int), ((1,), (100,)), chunk=(1,)) - attributes(h5)["bar"] = "bar" - g = create_group(h5, "group") -end + # create datasets and attributes before staring swmr writing + function prep_h5_file(h5) + d = create_dataset(h5, "foo", datatype(Int), ((1,), (100,)); chunk = (1,)) + attributes(h5)["bar"] = "bar" + g = create_group(h5, "group") + end -@testset "create by libver, then start_swmr_write" begin + @testset "create by libver, then start_swmr_write" begin #test this h5open method with keyword arg - h5open(fname, "w", libver_bounds=(:latest, :latest), swmr=false) do h5 + h5open(fname, "w"; libver_bounds = (:latest, :latest), swmr = false) do h5 prep_h5_file(h5) HDF5.start_swmr_write(h5) # after creating datasets remote_test(h5) - end -end + end end -@testset "create by swmr mode, then close and open again" begin - h5open(fname, "w", swmr=true) do h5 - prep_h5_file(h5) - end - # close the file after creating datasets, open again with swmr write access but not truncate - h5open(fname, "r+", swmr=true) do h5 - remote_test(h5) + @testset "create by swmr mode, then close and open again" begin + h5open(fname, "w"; swmr = true) do h5 + prep_h5_file(h5) + end + # close the file after creating datasets, open again with swmr write access but not truncate + h5open(fname, "r+"; swmr = true) do h5 + remote_test(h5) + end end -end -rm(fname) # cleanup file created by swmr tests - -if nprocs() > 1 - rmprocs(procs) -end + rm(fname) # cleanup file created by swmr tests + if nprocs() > 1 + rmprocs(procs) + end end # testset swmr diff --git a/test/table.jl b/test/table.jl index b41884148..d9f53f508 100644 --- a/test/table.jl +++ b/test/table.jl @@ -1,11 +1,10 @@ using HDF5 using Test - hf = h5open(tempname(), "w") fv = 3.14 -data = [1.,2.,3.,4.,5.,6.] +data = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] floatsize = sizeof(data[1]) h5t = datatype(data[1]) title = "lal" @@ -14,16 +13,18 @@ nfield = 2 nrec = 3 recsize = nfield * floatsize colname = ["f1_verylongnameforfun", "f2"] -offset = [0,floatsize] +offset = [0, floatsize] tid = [h5t.id, h5t.id] chunk = 7 fillvalue = [3.14, 2.71] compress = 1 -HDF5.API.h5tb_make_table(title, hf, name, nfield, nrec, recsize, colname, offset, tid, chunk, fillvalue, compress, data) +HDF5.API.h5tb_make_table(title, hf, name, nfield, nrec, recsize, colname, offset, tid, + chunk, fillvalue, compress, data) fieldsize = [floatsize, floatsize] HDF5.API.h5tb_append_records(hf, name, nrec, recsize, offset, fieldsize, data) -HDF5.API.h5tb_write_records(hf, name, 1, 4, recsize, offset, fieldsize, collect(1:8) .+ 20.0) +HDF5.API.h5tb_write_records(hf, name, 1, 4, recsize, offset, fieldsize, + collect(1:8) .+ 20.0) buf = fill(0.0, 100) HDF5.API.h5tb_read_table(hf, name, recsize, offset, fieldsize, buf)