Skip to content

Add deprecated functions and deprecation warnings #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions hdf5-sys/src/h5a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ use std::mem;
use crate::internal_prelude::*;

use crate::h5o::H5O_msg_crt_idx_t;
pub use {
H5A_operator2_t as H5A_operator_t, H5A_operator2_t as H5A_operator_r, H5Acreate2 as H5Acreate,
H5Aiterate2 as H5Aiterate,
};

#[repr(C)]
#[derive(Copy, Clone)]
Expand All @@ -19,6 +23,15 @@ impl Default for H5A_info_t {
}
}

#[deprecated(note = "deprecated in HDF5 1.8.0, use H5A_operator2_t")]
pub type H5A_operator1_t = Option<
extern "C" fn(
location_id: hid_t,
attr_name: *const c_char,
operator_data: *mut c_void,
) -> herr_t,
>;

pub type H5A_operator2_t = Option<
extern "C" fn(
location_id: hid_t,
Expand Down Expand Up @@ -92,4 +105,19 @@ extern "C" {
pub fn H5Aexists_by_name(
obj_id: hid_t, obj_name: *const c_char, attr_name: *const c_char, lapl_id: hid_t,
) -> htri_t;

#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Aget_info")]
pub fn H5Aget_num_attrs(loc_id: hid_t) -> c_int;
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Aopen_by_idx")]
pub fn H5Aopen_idx(loc_id: hid_t, idx: c_uint) -> hid_t;
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Aopen_by_name")]
pub fn H5Aopen_name(loc_id: hid_t, name: *const c_char) -> hid_t;
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Acreate2")]
pub fn H5Acreate1(
loc_id: hid_t, name: *const c_char, type_id: hid_t, space_id: hid_t, acpl_id: hid_t,
) -> hid_t;
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Aiterate2")]
pub fn H5Aiterate1(
loc_id: hid_t, attr_num: *mut c_uint, op: H5A_operator1_t, op_data: *mut c_void,
) -> herr_t;
}
9 changes: 9 additions & 0 deletions hdf5-sys/src/h5d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pub use self::H5D_mpio_actual_chunk_opt_mode_t::*;
pub use self::H5D_mpio_actual_io_mode_t::*;
pub use self::H5D_mpio_no_collective_cause_t::*;
pub use self::H5D_space_status_t::*;
pub use {H5Dcreate2 as H5D_create, H5Dopen2 as H5Dopen};

use crate::internal_prelude::*;

Expand Down Expand Up @@ -178,6 +179,7 @@ extern "C" {
buf: *mut c_void, type_id: hid_t, space_id: hid_t, op: H5D_operator_t,
operator_data: *mut c_void,
) -> herr_t;
#[cfg_attr(hdf5_1_12_0, deprecated(note = "deprecated in HDF5 1.12.0, use H5Treclaim"))]
pub fn H5Dvlen_reclaim(
type_id: hid_t, space_id: hid_t, plist_id: hid_t, buf: *mut c_void,
) -> herr_t;
Expand All @@ -189,6 +191,13 @@ extern "C" {
) -> herr_t;
pub fn H5Dset_extent(dset_id: hid_t, size: *const hsize_t) -> herr_t;
pub fn H5Ddebug(dset_id: hid_t) -> herr_t;

#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Dcreate2")]
pub fn H5Dcreate1(
file_id: hid_t, name: *const c_char, type_id: hid_t, space_id: hid_t, dcpl_id: hid_t,
) -> hid_t;
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Dopen2")]
pub fn H5Dopen1(file_id: hid_t, name: *const c_char) -> hid_t;
}

#[cfg(hdf5_1_8_11)]
Expand Down
49 changes: 49 additions & 0 deletions hdf5-sys/src/h5e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ use std::mem;

pub use self::H5E_direction_t::*;
pub use self::H5E_type_t::*;
pub use {
H5E_auto2_t as H5E_auto_t, H5E_error2_t as H5E_error_t, H5E_walk2_t as H5E_walk_t,
H5Eclear2 as H5Eclear, H5Eget_auto2 as H5Eget_auto, H5Eprint2 as H5Eprint, H5Epush2 as H5Epush,
H5Eset_auto2 as H5Eset_auto, H5Ewalk2 as H5Ewalk,
};

use crate::internal_prelude::*;

Expand All @@ -14,6 +19,21 @@ pub enum H5E_type_t {
H5E_MINOR = 1,
}

pub type H5E_major_t = hid_t;
pub type H5E_minor_t = hid_t;

#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5E_error2_t")]
pub struct H5E_error1_t {
maj_num: H5E_major_t,
min_num: H5E_minor_t,
func_name: *const c_char,
file_name: *const c_char,
line: c_uint,
desc: *const c_char,
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct H5E_error2_t {
Expand All @@ -39,6 +59,13 @@ pub enum H5E_direction_t {
H5E_WALK_DOWNWARD = 1,
}

#[deprecated(note = "deprecated in HDF5 1.8.0, use H5E_walk2_t")]
pub type H5E_walk1_t = Option<
unsafe extern "C" fn(n: c_int, err_desc: *mut H5E_error1_t, client_data: *mut c_void) -> herr_t,
>;
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5E_auto2_t")]
pub type H5E_auto1_t = Option<unsafe extern "C" fn(client_data: *mut c_void) -> herr_t>;

pub type H5E_walk2_t = Option<
unsafe extern "C" fn(
n: c_uint,
Expand Down Expand Up @@ -80,6 +107,28 @@ extern "C" {
msg_id: hid_t, type_: *mut H5E_type_t, msg: *mut c_char, size: size_t,
) -> ssize_t;
pub fn H5Eget_num(error_stack_id: hid_t) -> ssize_t;

#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Epush2")]
pub fn H5Epush1(
file: *const c_char, func: *const c_char, line: c_uint, maj: H5E_major_t, min: H5E_minor_t,
str_: *const c_char,
) -> herr_t;
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Eprint2")]
pub fn H5Eprint1(stream: *mut FILE) -> herr_t;
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Ewalk2")]
pub fn H5Ewalk1(
direction: H5E_direction_t, func: H5E_walk1_t, client_data: *mut c_void,
) -> herr_t;
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Eget_auto2")]
pub fn H5Eget_auto1(func: *mut H5E_auto1_t, client_data: *mut *mut c_void) -> herr_t;
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Eset_auto2")]
pub fn H5Eset_auto1(func: H5E_auto1_t, client_data: *mut c_void) -> herr_t;
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Eclear2")]
pub fn H5Eclear1() -> herr_t;
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Eget_msg")]
pub fn H5Eget_major(maj: H5E_major_t) -> *mut c_char;
#[deprecated(note = "deprecated in HDF5 1.8.0")]
pub fn H5Eget_minor(min: H5E_minor_t) -> *mut c_char;
}

pub use self::globals::*;
Expand Down
36 changes: 20 additions & 16 deletions hdf5-sys/src/h5f.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ pub use self::H5F_close_degree_t::*;
pub use self::H5F_libver_t::*;
pub use self::H5F_mem_t::*;
pub use self::H5F_scope_t::*;
#[cfg(not(hdf5_1_10_0))]
pub use {
H5F_info1_t as H5F_info_t, H5F_info1_t__sohm as H5F_info_t__sohm, H5Fget_info1 as H5Fget_info,
};
#[cfg(hdf5_1_10_0)]
pub use {
H5F_info2_t as H5F_info_t, H5F_info2_t__free as H5F_info_t__free,
H5F_info2_t__sohm as H5F_info_t__sohm, H5F_info2_t__super as H5F_info_t__super,
H5Fget_info2 as H5Fget_info,
};

use crate::internal_prelude::*;

Expand Down Expand Up @@ -60,12 +70,12 @@ impl Default for H5F_close_degree_t {
#[cfg_attr(hdf5_1_10_0, deprecated(note = "deprecated in HDF5 1.10.0, use H5F_info2_t"))]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct H5F_info_t {
pub struct H5F_info1_t {
pub super_ext_size: hsize_t,
pub sohm: H5F_info_t__sohm,
pub sohm: H5F_info1_t__sohm,
}

impl Default for H5F_info_t {
impl Default for H5F_info1_t {
fn default() -> Self {
unsafe { mem::zeroed() }
}
Expand All @@ -74,12 +84,12 @@ impl Default for H5F_info_t {
#[cfg_attr(hdf5_1_10_0, deprecated(note = "deprecated in HDF5 1.10.0, use H5F_info2_t"))]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct H5F_info_t__sohm {
pub struct H5F_info1_t__sohm {
pub hdr_size: hsize_t,
pub msgs_info: H5_ih_info_t,
}

impl Default for H5F_info_t__sohm {
impl Default for H5F_info1_t__sohm {
fn default() -> Self {
unsafe { mem::zeroed() }
}
Expand Down Expand Up @@ -127,11 +137,6 @@ impl Default for H5F_libver_t {
}
}

#[cfg(not(hdf5_1_10_0))]
extern "C" {
pub fn H5Fget_info(obj_id: hid_t, bh_info: *mut H5F_info_t) -> herr_t;
}

extern "C" {
#[cfg_attr(
hdf5_1_10_2,
Expand Down Expand Up @@ -308,14 +313,13 @@ mod hdf5_1_10_0 {
) -> ssize_t;
pub fn H5Fformat_convert(fid: hid_t) -> herr_t;
pub fn H5Fget_info2(obj_id: hid_t, finfo: *mut H5F_info2_t) -> herr_t;
#[deprecated(note = "deprecated in HDF5 1.10.0, use H5Fget_info2")]
pub fn H5Fget_info1(obj_id: hid_t, finfo: *mut H5F_info1_t) -> herr_t;
}
}

pub use super::{
H5F_info_t as H5F_info1_t, H5F_info_t__sohm as H5F_info1_t__sohm,
H5Fget_info1 as H5Fget_info,
};
extern "C" {
#[cfg_attr(hdf5_1_10_0, deprecated(note = "deprecated in HDF5 1.10.0, use H5Fget_info2"))]
#[cfg_attr(not(hdf5_1_10_0), link_name = "H5Fget_info")]
pub fn H5Fget_info1(obj_id: hid_t, finfo: *mut H5F_info1_t) -> herr_t;
}

#[cfg(hdf5_1_10_0)]
Expand Down
67 changes: 67 additions & 0 deletions hdf5-sys/src/h5g.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
use std::mem;

pub use self::H5G_storage_type_t::*;
pub use {H5Gcreate2 as H5Gcreate, H5Gopen2 as H5Gopen};

use crate::internal_prelude::*;

use crate::h5l::{H5L_type_t, H5L_SAME_LOC, H5L_TYPE_ERROR, H5L_TYPE_HARD, H5L_TYPE_SOFT};
use crate::h5o::H5O_stat_t;

pub const H5G_SAME_LOC: hid_t = H5L_SAME_LOC;

Expand Down Expand Up @@ -62,10 +64,75 @@ extern "C" {
n: hsize_t, ginfo: *mut H5G_info_t, lapl_id: hid_t,
) -> herr_t;
pub fn H5Gclose(group_id: hid_t) -> herr_t;
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Gcreate2")]
pub fn H5Gcreate1(loc_id: hid_t, name: *const c_char, size_hint: size_t) -> hid_t;
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Oget_comment")]
pub fn H5Gget_comment(
loc_id: hid_t, name: *const c_char, bufsize: size_t, buf: *mut c_char,
) -> c_int;
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Lget_val")]
pub fn H5Gget_linkval(loc_id: hid_t, name: *const c_char, comment: *const c_char) -> herr_t;
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Gget_info")]
pub fn H5Gget_num_objs(loc_id: hid_t, num_objs: *mut hsize_t) -> herr_t;
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Oget_info or H5Lget_info")]
pub fn H5Gget_objinfo(
loc_id: hid_t, name: *const c_char, follow_link: hbool_t, statubuf: *mut H5G_stat_t,
) -> herr_t;
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Lget_name_by_idx")]
pub fn H5Gget_objname_by_idx(
loc_id: hid_t, idx: hsize_t, name: *mut c_char, size: size_t,
) -> ssize_t;
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Oget_info")]
pub fn H5Gget_objtype_by_idx(loc_id: hid_t, idx: hsize_t) -> H5G_obj_t;
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Lcreate_hard or H5Lcreate_soft")]
pub fn H5Glink(
cur_loc_id: hid_t, type_: H5G_link_t, cur_name: *const c_char, new_name: *const c_char,
) -> herr_t;
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Lcreate_hard or H5Lcreate_soft")]
pub fn H5Glink2(
cur_loc_id: hid_t, cur_name: *const c_char, type_: H5G_link_t, new_loc_id: hid_t,
new_name: *const c_char,
) -> herr_t;
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Lmove")]
pub fn H5Gmove(src_loc_id: hid_t, src_name: *const c_char, dst_name: *const c_char) -> herr_t;
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Lmove")]
pub fn H5Gmove2(
src_loc_id: hid_t, src_name: *const c_char, dst_loc_id: hid_t, dst_name: *const c_char,
) -> herr_t;
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Gopen2")]
pub fn H5Gopen1(loc_id: hid_t, name: *const c_char) -> hid_t;
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Ldelete")]
pub fn H5Gunlink(loc_id: hid_t, name: *const c_char) -> herr_t;
}

#[cfg(hdf5_1_10_0)]
extern "C" {
pub fn H5Gflush(group_id: hid_t) -> herr_t;
pub fn H5Grefresh(group_id: hid_t) -> herr_t;
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub enum H5G_obj_t {
H5G_UNKNOwN = -1,
H5G_GROUP,
H5G_DATASET,
H5G_TYPE,
H5G_LINK,
H5G_UDLINK,
H5G_RESERVED_5,
H5G_RESERVED_6,
H5G_RESERVED_7,
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct H5G_stat_t {
fileno: [c_ulong; 2],
objno: [c_ulong; 2],
nlink: c_uint,
type_: H5G_obj_t,
mtime: time_t,
linklen: size_t,
ohdr: H5O_stat_t,
}
Loading