Skip to content

Commit 3ccbe03

Browse files
authored
Merge pull request #117 from mulimoen/feature/versioned_functionality
Add deprecated functions and deprecation warnings
2 parents 9445078 + ca21001 commit 3ccbe03

File tree

11 files changed

+276
-70
lines changed

11 files changed

+276
-70
lines changed

hdf5-sys/src/h5a.rs

+28
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ use std::mem;
33
use crate::internal_prelude::*;
44

55
use crate::h5o::H5O_msg_crt_idx_t;
6+
pub use {
7+
H5A_operator2_t as H5A_operator_t, H5A_operator2_t as H5A_operator_r, H5Acreate2 as H5Acreate,
8+
H5Aiterate2 as H5Aiterate,
9+
};
610

711
#[repr(C)]
812
#[derive(Copy, Clone)]
@@ -19,6 +23,15 @@ impl Default for H5A_info_t {
1923
}
2024
}
2125

26+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5A_operator2_t")]
27+
pub type H5A_operator1_t = Option<
28+
extern "C" fn(
29+
location_id: hid_t,
30+
attr_name: *const c_char,
31+
operator_data: *mut c_void,
32+
) -> herr_t,
33+
>;
34+
2235
pub type H5A_operator2_t = Option<
2336
extern "C" fn(
2437
location_id: hid_t,
@@ -92,4 +105,19 @@ extern "C" {
92105
pub fn H5Aexists_by_name(
93106
obj_id: hid_t, obj_name: *const c_char, attr_name: *const c_char, lapl_id: hid_t,
94107
) -> htri_t;
108+
109+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Aget_info")]
110+
pub fn H5Aget_num_attrs(loc_id: hid_t) -> c_int;
111+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Aopen_by_idx")]
112+
pub fn H5Aopen_idx(loc_id: hid_t, idx: c_uint) -> hid_t;
113+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Aopen_by_name")]
114+
pub fn H5Aopen_name(loc_id: hid_t, name: *const c_char) -> hid_t;
115+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Acreate2")]
116+
pub fn H5Acreate1(
117+
loc_id: hid_t, name: *const c_char, type_id: hid_t, space_id: hid_t, acpl_id: hid_t,
118+
) -> hid_t;
119+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Aiterate2")]
120+
pub fn H5Aiterate1(
121+
loc_id: hid_t, attr_num: *mut c_uint, op: H5A_operator1_t, op_data: *mut c_void,
122+
) -> herr_t;
95123
}

hdf5-sys/src/h5d.rs

+9
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ pub use self::H5D_mpio_actual_chunk_opt_mode_t::*;
66
pub use self::H5D_mpio_actual_io_mode_t::*;
77
pub use self::H5D_mpio_no_collective_cause_t::*;
88
pub use self::H5D_space_status_t::*;
9+
pub use {H5Dcreate2 as H5D_create, H5Dopen2 as H5Dopen};
910

1011
use crate::internal_prelude::*;
1112

@@ -178,6 +179,7 @@ extern "C" {
178179
buf: *mut c_void, type_id: hid_t, space_id: hid_t, op: H5D_operator_t,
179180
operator_data: *mut c_void,
180181
) -> herr_t;
182+
#[cfg_attr(hdf5_1_12_0, deprecated(note = "deprecated in HDF5 1.12.0, use H5Treclaim"))]
181183
pub fn H5Dvlen_reclaim(
182184
type_id: hid_t, space_id: hid_t, plist_id: hid_t, buf: *mut c_void,
183185
) -> herr_t;
@@ -189,6 +191,13 @@ extern "C" {
189191
) -> herr_t;
190192
pub fn H5Dset_extent(dset_id: hid_t, size: *const hsize_t) -> herr_t;
191193
pub fn H5Ddebug(dset_id: hid_t) -> herr_t;
194+
195+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Dcreate2")]
196+
pub fn H5Dcreate1(
197+
file_id: hid_t, name: *const c_char, type_id: hid_t, space_id: hid_t, dcpl_id: hid_t,
198+
) -> hid_t;
199+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Dopen2")]
200+
pub fn H5Dopen1(file_id: hid_t, name: *const c_char) -> hid_t;
192201
}
193202

194203
#[cfg(hdf5_1_8_11)]

hdf5-sys/src/h5e.rs

+49
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ use std::mem;
22

33
pub use self::H5E_direction_t::*;
44
pub use self::H5E_type_t::*;
5+
pub use {
6+
H5E_auto2_t as H5E_auto_t, H5E_error2_t as H5E_error_t, H5E_walk2_t as H5E_walk_t,
7+
H5Eclear2 as H5Eclear, H5Eget_auto2 as H5Eget_auto, H5Eprint2 as H5Eprint, H5Epush2 as H5Epush,
8+
H5Eset_auto2 as H5Eset_auto, H5Ewalk2 as H5Ewalk,
9+
};
510

611
use crate::internal_prelude::*;
712

@@ -14,6 +19,21 @@ pub enum H5E_type_t {
1419
H5E_MINOR = 1,
1520
}
1621

22+
pub type H5E_major_t = hid_t;
23+
pub type H5E_minor_t = hid_t;
24+
25+
#[repr(C)]
26+
#[derive(Debug, Copy, Clone)]
27+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5E_error2_t")]
28+
pub struct H5E_error1_t {
29+
maj_num: H5E_major_t,
30+
min_num: H5E_minor_t,
31+
func_name: *const c_char,
32+
file_name: *const c_char,
33+
line: c_uint,
34+
desc: *const c_char,
35+
}
36+
1737
#[repr(C)]
1838
#[derive(Debug, Copy, Clone)]
1939
pub struct H5E_error2_t {
@@ -39,6 +59,13 @@ pub enum H5E_direction_t {
3959
H5E_WALK_DOWNWARD = 1,
4060
}
4161

62+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5E_walk2_t")]
63+
pub type H5E_walk1_t = Option<
64+
unsafe extern "C" fn(n: c_int, err_desc: *mut H5E_error1_t, client_data: *mut c_void) -> herr_t,
65+
>;
66+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5E_auto2_t")]
67+
pub type H5E_auto1_t = Option<unsafe extern "C" fn(client_data: *mut c_void) -> herr_t>;
68+
4269
pub type H5E_walk2_t = Option<
4370
unsafe extern "C" fn(
4471
n: c_uint,
@@ -80,6 +107,28 @@ extern "C" {
80107
msg_id: hid_t, type_: *mut H5E_type_t, msg: *mut c_char, size: size_t,
81108
) -> ssize_t;
82109
pub fn H5Eget_num(error_stack_id: hid_t) -> ssize_t;
110+
111+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Epush2")]
112+
pub fn H5Epush1(
113+
file: *const c_char, func: *const c_char, line: c_uint, maj: H5E_major_t, min: H5E_minor_t,
114+
str_: *const c_char,
115+
) -> herr_t;
116+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Eprint2")]
117+
pub fn H5Eprint1(stream: *mut FILE) -> herr_t;
118+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Ewalk2")]
119+
pub fn H5Ewalk1(
120+
direction: H5E_direction_t, func: H5E_walk1_t, client_data: *mut c_void,
121+
) -> herr_t;
122+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Eget_auto2")]
123+
pub fn H5Eget_auto1(func: *mut H5E_auto1_t, client_data: *mut *mut c_void) -> herr_t;
124+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Eset_auto2")]
125+
pub fn H5Eset_auto1(func: H5E_auto1_t, client_data: *mut c_void) -> herr_t;
126+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Eclear2")]
127+
pub fn H5Eclear1() -> herr_t;
128+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Eget_msg")]
129+
pub fn H5Eget_major(maj: H5E_major_t) -> *mut c_char;
130+
#[deprecated(note = "deprecated in HDF5 1.8.0")]
131+
pub fn H5Eget_minor(min: H5E_minor_t) -> *mut c_char;
83132
}
84133

85134
pub use self::globals::*;

hdf5-sys/src/h5f.rs

+20-16
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ pub use self::H5F_close_degree_t::*;
44
pub use self::H5F_libver_t::*;
55
pub use self::H5F_mem_t::*;
66
pub use self::H5F_scope_t::*;
7+
#[cfg(not(hdf5_1_10_0))]
8+
pub use {
9+
H5F_info1_t as H5F_info_t, H5F_info1_t__sohm as H5F_info_t__sohm, H5Fget_info1 as H5Fget_info,
10+
};
11+
#[cfg(hdf5_1_10_0)]
12+
pub use {
13+
H5F_info2_t as H5F_info_t, H5F_info2_t__free as H5F_info_t__free,
14+
H5F_info2_t__sohm as H5F_info_t__sohm, H5F_info2_t__super as H5F_info_t__super,
15+
H5Fget_info2 as H5Fget_info,
16+
};
717

818
use crate::internal_prelude::*;
919

@@ -60,12 +70,12 @@ impl Default for H5F_close_degree_t {
6070
#[cfg_attr(hdf5_1_10_0, deprecated(note = "deprecated in HDF5 1.10.0, use H5F_info2_t"))]
6171
#[repr(C)]
6272
#[derive(Debug, Copy, Clone)]
63-
pub struct H5F_info_t {
73+
pub struct H5F_info1_t {
6474
pub super_ext_size: hsize_t,
65-
pub sohm: H5F_info_t__sohm,
75+
pub sohm: H5F_info1_t__sohm,
6676
}
6777

68-
impl Default for H5F_info_t {
78+
impl Default for H5F_info1_t {
6979
fn default() -> Self {
7080
unsafe { mem::zeroed() }
7181
}
@@ -74,12 +84,12 @@ impl Default for H5F_info_t {
7484
#[cfg_attr(hdf5_1_10_0, deprecated(note = "deprecated in HDF5 1.10.0, use H5F_info2_t"))]
7585
#[repr(C)]
7686
#[derive(Debug, Copy, Clone)]
77-
pub struct H5F_info_t__sohm {
87+
pub struct H5F_info1_t__sohm {
7888
pub hdr_size: hsize_t,
7989
pub msgs_info: H5_ih_info_t,
8090
}
8191

82-
impl Default for H5F_info_t__sohm {
92+
impl Default for H5F_info1_t__sohm {
8393
fn default() -> Self {
8494
unsafe { mem::zeroed() }
8595
}
@@ -127,11 +137,6 @@ impl Default for H5F_libver_t {
127137
}
128138
}
129139

130-
#[cfg(not(hdf5_1_10_0))]
131-
extern "C" {
132-
pub fn H5Fget_info(obj_id: hid_t, bh_info: *mut H5F_info_t) -> herr_t;
133-
}
134-
135140
extern "C" {
136141
#[cfg_attr(
137142
hdf5_1_10_2,
@@ -308,14 +313,13 @@ mod hdf5_1_10_0 {
308313
) -> ssize_t;
309314
pub fn H5Fformat_convert(fid: hid_t) -> herr_t;
310315
pub fn H5Fget_info2(obj_id: hid_t, finfo: *mut H5F_info2_t) -> herr_t;
311-
#[deprecated(note = "deprecated in HDF5 1.10.0, use H5Fget_info2")]
312-
pub fn H5Fget_info1(obj_id: hid_t, finfo: *mut H5F_info1_t) -> herr_t;
313316
}
317+
}
314318

315-
pub use super::{
316-
H5F_info_t as H5F_info1_t, H5F_info_t__sohm as H5F_info1_t__sohm,
317-
H5Fget_info1 as H5Fget_info,
318-
};
319+
extern "C" {
320+
#[cfg_attr(hdf5_1_10_0, deprecated(note = "deprecated in HDF5 1.10.0, use H5Fget_info2"))]
321+
#[cfg_attr(not(hdf5_1_10_0), link_name = "H5Fget_info")]
322+
pub fn H5Fget_info1(obj_id: hid_t, finfo: *mut H5F_info1_t) -> herr_t;
319323
}
320324

321325
#[cfg(hdf5_1_10_0)]

hdf5-sys/src/h5g.rs

+67
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
use std::mem;
22

33
pub use self::H5G_storage_type_t::*;
4+
pub use {H5Gcreate2 as H5Gcreate, H5Gopen2 as H5Gopen};
45

56
use crate::internal_prelude::*;
67

78
use crate::h5l::{H5L_type_t, H5L_SAME_LOC, H5L_TYPE_ERROR, H5L_TYPE_HARD, H5L_TYPE_SOFT};
9+
use crate::h5o::H5O_stat_t;
810

911
pub const H5G_SAME_LOC: hid_t = H5L_SAME_LOC;
1012

@@ -62,10 +64,75 @@ extern "C" {
6264
n: hsize_t, ginfo: *mut H5G_info_t, lapl_id: hid_t,
6365
) -> herr_t;
6466
pub fn H5Gclose(group_id: hid_t) -> herr_t;
67+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Gcreate2")]
68+
pub fn H5Gcreate1(loc_id: hid_t, name: *const c_char, size_hint: size_t) -> hid_t;
69+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Oget_comment")]
70+
pub fn H5Gget_comment(
71+
loc_id: hid_t, name: *const c_char, bufsize: size_t, buf: *mut c_char,
72+
) -> c_int;
73+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Lget_val")]
74+
pub fn H5Gget_linkval(loc_id: hid_t, name: *const c_char, comment: *const c_char) -> herr_t;
75+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Gget_info")]
76+
pub fn H5Gget_num_objs(loc_id: hid_t, num_objs: *mut hsize_t) -> herr_t;
77+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Oget_info or H5Lget_info")]
78+
pub fn H5Gget_objinfo(
79+
loc_id: hid_t, name: *const c_char, follow_link: hbool_t, statubuf: *mut H5G_stat_t,
80+
) -> herr_t;
81+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Lget_name_by_idx")]
82+
pub fn H5Gget_objname_by_idx(
83+
loc_id: hid_t, idx: hsize_t, name: *mut c_char, size: size_t,
84+
) -> ssize_t;
85+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Oget_info")]
86+
pub fn H5Gget_objtype_by_idx(loc_id: hid_t, idx: hsize_t) -> H5G_obj_t;
87+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Lcreate_hard or H5Lcreate_soft")]
88+
pub fn H5Glink(
89+
cur_loc_id: hid_t, type_: H5G_link_t, cur_name: *const c_char, new_name: *const c_char,
90+
) -> herr_t;
91+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Lcreate_hard or H5Lcreate_soft")]
92+
pub fn H5Glink2(
93+
cur_loc_id: hid_t, cur_name: *const c_char, type_: H5G_link_t, new_loc_id: hid_t,
94+
new_name: *const c_char,
95+
) -> herr_t;
96+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Lmove")]
97+
pub fn H5Gmove(src_loc_id: hid_t, src_name: *const c_char, dst_name: *const c_char) -> herr_t;
98+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Lmove")]
99+
pub fn H5Gmove2(
100+
src_loc_id: hid_t, src_name: *const c_char, dst_loc_id: hid_t, dst_name: *const c_char,
101+
) -> herr_t;
102+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Gopen2")]
103+
pub fn H5Gopen1(loc_id: hid_t, name: *const c_char) -> hid_t;
104+
#[deprecated(note = "deprecated in HDF5 1.8.0, use H5Ldelete")]
105+
pub fn H5Gunlink(loc_id: hid_t, name: *const c_char) -> herr_t;
65106
}
66107

67108
#[cfg(hdf5_1_10_0)]
68109
extern "C" {
69110
pub fn H5Gflush(group_id: hid_t) -> herr_t;
70111
pub fn H5Grefresh(group_id: hid_t) -> herr_t;
71112
}
113+
114+
#[repr(C)]
115+
#[derive(Debug, Copy, Clone)]
116+
pub enum H5G_obj_t {
117+
H5G_UNKNOwN = -1,
118+
H5G_GROUP,
119+
H5G_DATASET,
120+
H5G_TYPE,
121+
H5G_LINK,
122+
H5G_UDLINK,
123+
H5G_RESERVED_5,
124+
H5G_RESERVED_6,
125+
H5G_RESERVED_7,
126+
}
127+
128+
#[repr(C)]
129+
#[derive(Debug, Copy, Clone)]
130+
pub struct H5G_stat_t {
131+
fileno: [c_ulong; 2],
132+
objno: [c_ulong; 2],
133+
nlink: c_uint,
134+
type_: H5G_obj_t,
135+
mtime: time_t,
136+
linklen: size_t,
137+
ohdr: H5O_stat_t,
138+
}

0 commit comments

Comments
 (0)