diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index e34496c6a95..aa22b9d0ae9 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,3 +1 @@ # These are supported funding model platforms - -custom: "https://www.hdfgroup.org/donate" diff --git a/README.md b/README.md index 1f3c6444a1c..4aa6ff84a10 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ are tentative. | Release | New Features | | ------- | ------------ | -| 2.0.0 | Drop Autotools support, drop the C++ API, drop the HDF5 <--> GIF tools, add complex number support, update library defaults (cache sizes, etc.), use semantic versioning | +| 2.0.0 | Drop Autotools support, drop the HDF5 <--> GIF tools, add complex number support, update library defaults (cache sizes, etc.), use semantic versioning | | FUTURE | Multi-threaded HDF5, crashproofing / metadata journaling, Full (VFD) SWMR, encryption, digital signatures, sparse datasets, improved storage for variable-length datatypes, better Unicode support (especially on Windows) | NOTE: In the March 2025 release we will begin using semantic versioning (https://semver.org/) and the previously announced 1.16.0 version will instead be numbered 2.0.0. diff --git a/bin/make_vers b/bin/make_vers index ba335cae27e..6f93b20510d 100755 --- a/bin/make_vers +++ b/bin/make_vers @@ -3,20 +3,49 @@ require 5.003; use warnings; # Global settings -# (The max_idx parameter is the only thing that needs to be changed when adding -# support for a new major release. If support for a prior major release -# is added (like support for 1.4, etc), the min_sup_idx parameter will -# need to be decremented.) -# Max. library "index" (0 = v1.0, 1 = 1.2, 2 = 1.4, 3 = 1.6, 4 = 1.8, 5 = 1.10, 6 = 1.12, 7 = 1.14, 8 = 2.0, etc) -$max_idx = 8; - -# Min. supported previous library version "index" (0 = v1.0, 1 = 1.2, etc) -$min_sup_idx = 3; +# Supported version strings. "16" = HDF5 1.6.0, "200" = HDF5 2.0.0, etc. +# +# Note that the scheme changed with 2.0.0, when we went to semantic versioning. +# We use 200 instead of 20 so that HDF5 11.0.0 will get 1100 instead of 110, +# which would conflict with HDF5 1.10. +# +# Also, note that this scheme started at the 1.6/1.8 transition, so earlier +# versions of the API aren't versioned. +@versions = ("16", "18", "110", "112", "114", "200"); # Number of spaces to indent preprocessor commands inside ifdefs $indent = 2; +# Global hash of functions ==> # symbol versions parsed from H5vers.txt +$functions = {}; + +# Global hash of functions ==> versioned function params parsed from H5vers.txt +$func_params = {}; + +# Global hash of typedefs ==> # symbol versions parsed from H5vers.txt +$typedefs = {}; + +# Hash of API versions to a hash of (API call name --> symbol version) +# +# There is one hash for each version in @versions and the (API call name +# --> symbol version) hash maps an API name like H5Dopen to the symbol version +# (e.g. H5Dopen --> 1 or 2). +# +# So... +# +# 200 --> {H5Dopen --> 2, H5Iregister_type --> 2, etc.} +my %api_vers_to_function_vers; +foreach my $key (@versions) { + $api_vers_to_function_vers{$key} = {}; +} + +# Hash of API versions to a hash of (typedef name --> symbol version) +my %api_vers_to_type_vers; +foreach my $key (@versions) { + $api_vers_to_type_vers{$key} = {}; +} + # # Copyright by The HDF Group. # All rights reserved. @@ -83,7 +112,6 @@ sub print_startprotect ($$) { # sub print_checkoptions ($) { my $fh = shift; # File handle for output file - my $curr_idx; # Current API version index # Print the option checking print $fh "\n\n/* Issue error if contradicting macros have been defined. */\n"; @@ -91,9 +119,12 @@ sub print_checkoptions ($) { # Print the #ifdef print $fh "#if ("; - for $curr_idx ($min_sup_idx .. ($max_idx - 1)) { - print $fh "defined(H5_USE_1", ($curr_idx * 2), "_API)"; - if($curr_idx < ($max_idx - 1)) { + for my $i (0 .. $#versions - 1) { + print $fh "defined(H5_USE_", $versions[$i], "_API)"; + + # -2 because we're ignoring the last version in the array, and the + # last version we DO write out can't have an || after it + if ($i < @versions - 2) { print $fh " || "; } } @@ -104,9 +135,10 @@ sub print_checkoptions ($) { # Print the #endif print $fh "#endif /* ("; - for $curr_idx ($min_sup_idx .. ($max_idx - 1)) { - print $fh "defined(H5_USE_1", ($curr_idx * 2), "_API)"; - if($curr_idx < ($max_idx - 1)) { + for my $i (0 .. $#versions - 1) { + print $fh "defined(H5_USE_", $versions[$i], "_API)"; + + if ($i < @versions - 2) { print $fh " || "; } } @@ -118,7 +150,6 @@ sub print_checkoptions ($) { # sub print_globalapidefvers ($) { my $fh = shift; # File handle for output file - my $curr_idx; # Current API version index # Print the descriptive comment print $fh "\n\n/* If a particular default \"global\" version of the library's interfaces is\n"; @@ -126,13 +157,13 @@ sub print_globalapidefvers ($) { print $fh " *\n"; print $fh " */\n"; - for $curr_idx ($min_sup_idx .. ($max_idx - 1)) { + for my $api_vers (@versions) { # Print API version ifdef - print $fh "\n#if defined(H5_USE_1", ($curr_idx * 2), "_API_DEFAULT) && !defined(H5_USE_1", ($curr_idx * 2), "_API)\n"; + print $fh "\n#if defined(H5_USE_", $api_vers, "_API_DEFAULT) && !defined(H5_USE_", $api_vers, "_API)\n"; # Print API version definition - print $fh " " x $indent, "#define H5_USE_1", ($curr_idx * 2), "_API 1\n"; + print $fh " " x $indent, "#define H5_USE_", $api_vers, "_API 1\n"; # Print API version endif - print $fh "#endif /* H5_USE_1", ($curr_idx * 2), "_API_DEFAULT && !H5_USE_1", ($curr_idx * 2), "_API */\n"; + print $fh "#endif /* H5_USE_", $api_vers, "_API_DEFAULT && !H5_USE_", $api_vers, "_API */\n"; } } @@ -141,7 +172,6 @@ sub print_globalapidefvers ($) { # sub print_globalapisymbolvers ($) { my $fh = shift; # File handle for output file - my $curr_idx; # Current API version index # Print the descriptive comment print $fh "\n\n/* If a particular \"global\" version of the library's interfaces is chosen,\n"; @@ -152,18 +182,18 @@ sub print_globalapisymbolvers ($) { print $fh " */\n"; # Loop over supported older library APIs and define the appropriate macros - for $curr_idx ($min_sup_idx .. ($max_idx - 1)) { + foreach my $api_vers (@versions) { # Print API version ifdef - print $fh "\n#ifdef H5_USE_1", ($curr_idx * 2), "_API\n"; + print $fh "\n#ifdef H5_USE_", $api_vers, "_API\n"; # Print the version macro info for each function that is defined for # this API version print $fh "\n/*************/\n"; print $fh "/* Functions */\n"; print $fh "/*************/\n"; - for $name (sort keys %{$func_vers[$curr_idx]}) { + for $name (sort keys %{$api_vers_to_function_vers{$api_vers}}) { print $fh "\n#if !defined(", $name, "_vers)\n"; - print $fh " " x $indent, "#define ", $name, "_vers $func_vers[$curr_idx]{$name}\n"; + print $fh " " x $indent, "#define ", $name, "_vers $api_vers_to_function_vers{$api_vers}{$name}\n"; print $fh "#endif /* !defined(", $name, "_vers) */\n"; } @@ -172,14 +202,14 @@ sub print_globalapisymbolvers ($) { print $fh "\n/************/\n"; print $fh "/* Typedefs */\n"; print $fh "/************/\n"; - for $name (sort keys %{$type_vers[$curr_idx]}) { + for $name (sort keys %{$api_vers_to_type_vers{$api_vers}}) { print $fh "\n#if !defined(", $name, "_t_vers)\n"; - print $fh " " x $indent, "#define ", $name, "_t_vers $type_vers[$curr_idx]{$name}\n"; + print $fh " " x $indent, "#define ", $name, "_t_vers $api_vers_to_type_vers{$api_vers}{$name}\n"; print $fh "#endif /* !defined(", $name, "_t_vers) */\n"; } # Print API version endif - print $fh "\n#endif /* H5_USE_1", ($curr_idx * 2), "_API */\n"; + print $fh "\n#endif /* H5_USE_", $api_vers, "_API */\n"; } } @@ -222,7 +252,7 @@ sub print_defaultapivers ($) { print $fh " " x $indent, "#define $curr_name $curr_name$curr_vers\n"; # Print function's dependent parameter types - foreach(sort(@param_list)) { + foreach (sort (@param_list)) { print $fh " " x $indent, "#define ${_}_t $_${curr_vers}_t\n"; } @@ -233,7 +263,7 @@ sub print_defaultapivers ($) { print $fh " " x $indent, "#define $curr_name $curr_name$curr_vers\n"; # Print function's dependent parameter types - foreach(sort(@param_list)) { + foreach (sort (@param_list)) { print $fh " " x $indent, "#define ${_}_t $_${curr_vers}_t\n"; } @@ -267,7 +297,7 @@ sub print_defaultapivers ($) { # Loop to print earlier version name mappings $curr_vers--; - while($curr_vers > 0) { + while ($curr_vers > 0) { print $fh "#elif $curr_vers_name == $curr_vers\n"; print $fh " " x $indent, "#define ${curr_name}_t $curr_name${curr_vers}_t\n"; $curr_vers--; @@ -293,6 +323,57 @@ sub print_endprotect ($$) { print $fh "#endif /* ${file}_H */\n\n"; } +############################################################################## +# Validate a line from H5vers.txt +# +sub validate_line { + my $name = $_[0]; + my $params = $_[1]; + my $vers = $_[2]; + + my @vers_list; # Version strings ("v18", etc.) + my %sym_versions; # Versions already seen (for duplicate checks) + + # Check if the name already exists in the list of symbols + if (exists ($functions{$name}) || exists($typedefs{$name})) { + die "duplicated symbol: $name"; + } + + # Check for no version info given + if ($vers eq "") { + die "no version information: $name"; + } + + # Separate the versions on commas (produces string elements like "v18") + @vers_list = split (/\s*,\s*/, $vers); + + # Check for invalid version data + foreach (@vers_list) { + # Note: v111 is allowed because H5O functions were prematurely versioned + # in HDF5 1.10. Because users were affected by this, the versioning + # was rescinded but the H5O version 2 functions were kept to be + # called directly. Now that the version macros are added in 1.12, + # along with a 3rd version of the H5O functions, the H5O function + # version for default api=v110 should be version 1 to work correctly + # with 1.10 applications that were using unversioned H5O functions, + # and the H5O function version should be version 3 for default api=v112 + # (the default api version for 1.12). Allowing a v111 entry allows + # a version 2 that is never accessed via the H5O function macros. + if (!( $_ =~ /v1[02468]/ || $_ =~ /v11[02468]/ || $_ =~ /v111/ || $_ =~ /v200/ )) { + die "bad version information: $name"; + } + + # Make sure we didn't specify duplicate versions on this line + if (exists($sym_versions{$_})) { + die "duplicate version information: $name"; + } + + # Store the versions for the function in a local hash table, indexed by the version + # (this is only used to check for duplicates) + $sym_versions{$_}=$_; + } +} + ############################################################################## # Parse a meaningful line (not a comment or blank line) into the appropriate # data structure @@ -301,149 +382,67 @@ sub parse_line ($) { my $line = shift; # Get the line to parse # Parse API function lines -#print "line=$line\n"; - if($line =~ /^\s*FUNCTION:/ || $line =~ /^\s*TYPEDEF:/) { +#print "line=$line"; + if ($line =~ /^\s*FUNCTION:/ || $line =~ /^\s*TYPEDEF:/) { my $name; # The name of the function my $params; # Typedefs for function parameters - my $vers; # The version info for the function - my @vers_list; # Version info, as a list - my @vers_nums; # Version info, as a numeric list - my $num_versions; # Number of versions for function - my %sym_versions; # Versions for a symbol - my $last_idx; # The previous version index seen for a function - my $last_vers; # The previous version # seen for a function + my $vers_string; # The version info for the function + my @vers_list; # Version info, as a list (e.g., "112", "200", etc. my $line_type; # Type of line we are parsing # Determine the type of the line to parse - if($line =~ /^\s*FUNCTION:/) { + if ($line =~ /^\s*FUNCTION:/) { $line_type = 1; # Get the function's name & version info - ($name, $params, $vers) = ($line =~ /^\s*FUNCTION:\s*(\w*);\s*(.*?)\s*;\s*(.*?)\s*$/); -#print "parse_line: name='$name', params='$params', vers='$vers'\n"; + ($name, $params, $vers_string) = ($line =~ /^\s*FUNCTION:\s*(\w*);\s*(.*?)\s*;\s*(.*?)\s*$/); +#print "parse_line: name='$name', params='$params', vers_string='$vers_string'\n"; } - elsif($line =~ /^\s*TYPEDEF:/) { + elsif ($line =~ /^\s*TYPEDEF:/) { $line_type = 2; # Get the typedefs's name & version info - ($name, $vers) = ($line =~ /^\s*TYPEDEF:\s*(\w*);\s*(.*?)\s*$/); -#print "parse_line: name='$name', vers='$vers'\n"; + ($name, $vers_string) = ($line =~ /^\s*TYPEDEF:\s*(\w*);\s*(.*?)\s*$/); +#print "parse_line: name='$name', vers_string='$vers_string'\n"; + } else { + die "unknown line type: $line"; } #print "parse_line: line_type='$line_type'\n"; + validate_line($name, $params, $vers_string); - # Check if the name already exists in the list of symbols - if(exists($functions{$name}) || exists($typedefs{$name})) { - die "duplicated symbol: $name"; - } - - # Check for no version info given - if($vers eq "") { - die "no version information: $name"; - } - - # Split up version info - @vers_list = split(/\s*,\s*/, $vers); + # Split the version info and strip off the leading "v" + @vers_list = split(/\s*,\s*/, $vers_string); + @vers_list = map { substr($_, 1) } @vers_list; #print "parse_line: vers_list=(@vers_list)\n"; - # Parse the version list into numbers, checking for invalid input - foreach(@vers_list) { - my $vers_idx; # Index of version in array - - # Do some validation on the input - # Note: v111 is allowed because H5O functions were prematurely versioned - # in HDF5 1.10. Because users were affected by this, the versioning - # was rescinded but the H5O version 2 functions were kept to be - # called directly. Now that the version macros are added in 1.12, - # along with a 3rd version of the H5O functions, the H5O function - # version for default api=v110 should be version 1 to work correctly - # with 1.10 applications that were using unversioned H5O functions, - # and the H5O function version should be version 3 for default api=v112 - # (the default api version for 1.12). Allowing a v111 entry and - # incrementing its index 13 lines below allows a version 2 that is - # never accessed via the H5O function macros. - if(!( $_ =~ /v1[02468]/ || $_ =~ /v11[02468]/ || $_ =~ /v111/ )) { - die "bad version information: $name"; - } - if(exists($sym_versions{$_})) { - die "duplicate version information: $name"; - } - - # Store the versions for the function in a local hash table, indexed by the version - $sym_versions{$_}=$_; - -#print "parse_line: _=$_\n"; - # Get the index of the version - ($vers_idx) = ($_ =~ /v1(\d+)/); - if($vers_idx == 11) { - $vers_idx++; - } - $vers_idx /= 2; -#print "parse_line: vers_idx='$vers_idx'\n"; - push(@vers_nums, $vers_idx); - } -#print "parse_line: vers_nums=(@vers_nums)\n"; - - # Check for invalid version info given - $last_idx = -1; - $last_vers = 1; - foreach(sort(@vers_nums)) { -#print "parse_line: _=$_ last_idx='$last_idx'\n"; - # Update intermediate versions of the library that included the API routine - if($last_idx >= 0) { -#print "parse_line: name='$name'\n"; -#print "parse_line: last_vers='$last_vers'\n"; -#print "parse_line: last_idx='$last_idx'\n"; - - # Add the function to the list of API routines available in - # different versions of the library - while($last_idx <= $_) { - if($line_type == 1) { - $func_vers[$last_idx]{$name} = $last_vers; - } elsif($line_type == 2) { - $type_vers[$last_idx]{$name} = $last_vers; + # Parse the version list into the hashes of version and type info + my $curr_sym_number = 1; + foreach my $vers (@vers_list) { + foreach my $hash_vers (@versions) { + if ($vers > $hash_vers) { + next; + } else { + if ($line_type == 1) { + $api_vers_to_function_vers{$hash_vers}{$name} = $curr_sym_number; } else { - die "unknown line type: $line"; + $api_vers_to_type_vers{$hash_vers}{$name} = $curr_sym_number; } - $last_idx++; } - - # Increment the version # of the function - $last_vers++; } - # Keep track of last version index seen - $last_idx = $_; - } - - # Finish updating versions of the library that included the API routine - if($last_idx >= 0) { -#print "parse_line: max_idx='$max_idx'\n"; - - # Add the function to the list of API routines available in - # different versions of the library - while($last_idx <= $max_idx) { - if($line_type == 1) { - $func_vers[$last_idx]{$name} = $last_vers; - } elsif($line_type == 2) { - $type_vers[$last_idx]{$name} = $last_vers; - } else { - die "unknown line type: $line"; - } - $last_idx++; - } + $curr_sym_number++; } # Store the number of symbol versions in a hash table, indexed by the name - if($line_type == 1) { + if ($line_type == 1) { $functions{$name} = $#vers_list + 1; # Store the function's parameter types for later $func_params{$name} = $params; - } elsif($line_type == 2) { + } elsif ($line_type == 2) { $typedefs{$name} = $#vers_list + 1; - } else { - die "unknown line type: $line"; } +#print "\n"; } # Unknown keyword else { @@ -488,7 +487,7 @@ for $file (@ARGV) { #print "file = '$file'\n"; # Check for directory prefix on input file - if($file =~ /\//) { + if ($file =~ /\//) { ($prefix) = ($file =~ /(^.*\/)/); } else { @@ -497,9 +496,9 @@ for $file (@ARGV) { #print "prefix = '$prefix'\n"; # Read in the entire file open SOURCE, $file or die "$file: $!\n"; - while ( defined ($line=
+\image html Palettes.fm.anc.gif + | +
Important Note: The specification of the Indexed +Palette will change substantially in the next version. The Palette +described here is deprecated and is not supported. | +
---|
DEPRECATED +In a standard palette, the color entries are indexed directly. HDF5 +supports the notion of a range index table. Such a table defines an ascending +ordered list of ranges that map dataset values to the palette. If a range +index table exists for the palette, the PAL_TYPE attribute will be set +to "RANGEINDEX", and the PAL_RANGEINDEX attribute will contain an object +reference to a range index table array. If not, the PAL_TYPE attribute +either does not exist, or will be set to "STANDARD". + +The range index table array consists of a one dimensional array with +the same length as the palette dataset - 1. Ideally, the range index would +be of the same type as the dataset it refers to, however this is not a +requirement. + +Example 2: A range index array of type floating point + |
+
Attribute Name | +Required or Optional | +Type | +String Size | +Value | +Description | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|
CLASS | +Required | +String | +7 | +"PALETTE" | +This attribute is of type H5T_C_S1, with size 7.For all palettes, the value of this attribute is "PALETTE". This attribute +identifies this palette data set as a palette that conforms to the specifications +on this page. | +||||||
PAL_COLORMODEL | +Required | +String | +3, 4, or 5 | +Color Model: "RGB", "YUV", "CMY", "CMYK", "YCbCr", or "HSV" | +This attribute is of type H5T_C_S1, with size 3, 4, or 5.
+Possible values for this are "RGB", "YUV", "CMY", "CMYK", "YCbCr", "HSV". +This defines the color model that the entries in the palette data set represent. +
|
+||||||
PAL_TYPE | +Required | +String | +9
|
+"STANDARD8"
|
+This attribute is of type H5T_C_S1, with size 9 or 10.
+The current supported values for this attribute are: "STANDARD8" or "RANGEINDEX". +A PAL_TYPE of "STANDARD8" defines a palette dataset such that the first +entry defines index 0, the second entry defines index 1, etc. up until +the length of the palette - 1. This assumes an image dataset with direct +indexes into the palette. +
+
|
+||||||
|
+
|
+
|
+
|
+
|
+
|
+||||||
PAL_MINMAXNUMERIC | +Optional | +Array[2] of <same datatype as palette> | ++ | The first value is the <Minimum value for color values>, the second +value is <Maximum value for color values>2 | +If present, this attribute is an array of two numbers, of the same HDF5 +datatype as the palette elements or color numerics. +They specify the minimum and maximum values of the color numeric components. +For example, if the palette was an RGB of type Float, the color numeric +range for Red, Green, and Blue could be set to be between 0.0 and 1.0. +The intensity of the color guns would then be scaled accordingly to be +between this minimum and maximum attribute. | ||||||
PAL_VERSION | +Required | +String | +4 | +"1.2" | +This attribute is of type H5T_C_S1, with size corresponding to the +length of the version string. This attribute identifies the version +number of this specification to which it conforms. The current version +is "1.2". | +
PAL_TYPE | +STANDARD8 | +RANGEINDEX | +
---|---|---|
CLASS | +Required | +Required | +
PAL_VERSION | +Required | +Required | +
PAL_COLORMODEL | +Required | +Required | +
RANGE_INDEX | +NA | +Required | +
PAL_MINMAXNUMERIC | +Optional | +Optional | +
+\image html trunk_branches.jpg "Figure 1. The trunk, release branches, and feature branches" + | +
H5public.h
+and determine the version of the include files.
+\li H5_VERS_MAJOR
- The major version number
+\li H5_VERS_MINOR
- The minor version number
+\li H5_VERS_RELEASE
- The release number
+\li H5_VERS_SUBRELEASE
- The subrelease number
+\li H5_VERS_INFO
- A string that contains the version number
+
+Function Call or Macro | Comments |
---|---|
#H5get_libversion | +This function returns through its arguments the version +numbers for the library to which the application is linked. | +
#H5check | +This macro uses the #H5check_version function +to verify that the version number of the HDF5 include file used +to compile the application matches the version number of the +library to which the application is linked. This check occurs +automatically when the first HDF5 file is created or opened and +is important because a mismatch between the include files and the +library is likely to result in corrupted data and/or segmentation +faults. If a mismatch is detected, the library issues an error +message on the standard error stream and aborts. | +
#H5check_version | +This function is called by the #H5check macro
+with the include file version constants. The function compares
+its arguments to the result returned by #H5get_libversion.
+If a mismatch is detected, it prints an error message on the standard
+error stream and aborts. The behavior of this function can be modified by the + HDF5_DISABLE_VERSION_CHECK environment variable. Setting
+the environment variable to a value of "1" will issue a
+warning but continue without aborting. Setting the environment
+variable to a value of "2" will suppress the warning
+and continue silently without aborting. |
+
#H5_VERSION_GE and #H5_VERSION_LE | +These macros compare the version of the HDF5 library being used +against the version number specified in the parameters. At compile +time, they can be used to conditionally include or exclude code +based on the library's version. | +
#H5Pset_libver_bounds | +This function can be used to control the versions of the object +formats that will be used when creating objects in a file. | +
H5Lxxx
, are
+new in version 1.8, and some group functions, H5Gxxx
,
+are deprecated in 1.8. With the #H5_VERSION_GE macro, an
+application could use #H5Ldelete if the library version is
+1.8.0 or greater, or it could use #H5Gunlink if the library
+version is less than 1.8.0.
+
+\subsection subsec_relver_use_spec Specifying a Format
+Suppose a data file has three datasets. It is possible that the three
+datasets were added to the data file with applications using different
+versions of HDF5. The different versions could be 1.4.5, 1.6.10, and
+1.8.6. If another dataset is written to the data file, then it will be
+written by default in the oldest format possible that has all of the
+features needed to successfully write the dataset. If a newer feature
+such as compact storage, a new parameter for a function, or a partially
+compressed dataset is used, then a newer format will be used.
+#H5Pset_libver_bounds could be used to specify the oldest
+format used. In the situation above, the owners of the data file might
+want all data written to the file in the future to be in a 1.8 format
+rather than 1.6 or 1.4.
+
+\section sec_relver_share Shared Library Version Numbers
+HDF5 shared libraries utilize the
+
+libtool versioning system in order to indicate interface
+compatibility between maintenance releases of HDF5. While we always
+attempt to maintain interface compatibility between minor maintenance
+release versions of HDF5, if we are forced to break interface
+compatibility in order to resolve a critical defect within the
+library, then the library interface version attached to the shared
+libraries for a given release will be incremented accordingly.
+
+Please note that this libtool version number for interface
+compatibility is unrelated to the HDF5 release version for a given
+release.
+
+*/
diff --git a/doxygen/examples/H5I_examples.c b/doxygen/examples/H5I_examples.c
index 657e1b53d8d..6cf15b6d3bd 100644
--- a/doxygen/examples/H5I_examples.c
+++ b/doxygen/examples/H5I_examples.c
@@ -133,7 +133,7 @@ fail_dcpl:;
hid_t obj_id;
// register a new ID type
- if ((type = H5Iregister_type(128, 1024, &free_func)) < 0) {
+ if ((type = H5Iregister_type2(1024, &free_func)) < 0) {
ret_val = EXIT_FAILURE;
goto fail_register;
}
@@ -167,7 +167,7 @@ fail_register:;
hsize_t count;
// register a new ID type
- if ((type = H5Iregister_type(128, 1024, NULL)) < 0) {
+ if ((type = H5Iregister_type2(1024, NULL)) < 0) {
ret_val = EXIT_FAILURE;
goto fail_register;
}
@@ -194,7 +194,7 @@ fail_register:;
hid_t obj_id;
// register a new ID type
- if ((type = H5Iregister_type(128, 1024, NULL)) < 0) {
+ if ((type = H5Iregister_type2(1024, NULL)) < 0) {
ret_val = EXIT_FAILURE;
goto fail_register;
}
@@ -224,7 +224,7 @@ fail_register:;
H5I_type_t type;
// register a new ID type
- if ((type = H5Iregister_type(128, 1024, NULL)) < 0) {
+ if ((type = H5Iregister_type2(1024, NULL)) < 0) {
ret_val = EXIT_FAILURE;
goto fail_register;
}
diff --git a/doxygen/examples/ImageSpec.html b/doxygen/examples/ImageSpec.html
deleted file mode 100644
index 130d86ecf6a..00000000000
--- a/doxygen/examples/ImageSpec.html
+++ /dev/null
@@ -1,1203 +0,0 @@
-
-
-
-
-
- This specification is primarily concerned with two dimensional raster -data similar to HDF4 Raster Images. Specifications for storing other -types of imagery will be covered in other documents. -
This specification defines: -
The dataset for an image is distinguished from other datasets by giving -it an attribute "CLASS=IMAGE". In addition, the Image dataset may -have an optional attribute "PALETTE" that is an array of object references -for zero or more palettes. The Image dataset may have additional attributes -to describe the image data, as defined in Section 1.2. -
A Palette is an HDF5 dataset which contains color map information. -A Pallet dataset has an attribute "CLASS=PALETTE" and other attributes -indicating the type and size of the palette, as defined in Section -2.1. A Palette is an independent object, which can be shared -among several Image datasets. -
-
-
-
Attribute Name | - -(R = Required
- O= Optional) |
-
-Type | - -String Size | - -Value | -
CLASS | - -R | - -String | - -5 | - -"IMAGE" | -
PALETTE | - -O | - -Array Object References | - -- - | <references to Palette datasets>1 | -
IMAGE_SUBCLASS | - -O2 | - -String | - -15,
- 12, - 15, - 13 |
-
-
- |
-
INTERLACE_MODE | - -O3,6 | - -String | - -15 | - -The layout of components if more than one component per pixel. | -
DISPLAY_ORIGIN | - -O | - -String | - -2 | - -If set, indicates the intended location of the pixel (0,0). | -
IMAGE_WHITE_IS_ZERO | - -O3,4 | - -Unsigned Integer | - -- - | 0 = false, 1 = true | -
IMAGE_MINMAXRANGE | - -O3,5 | - -Array [2] <same datatype as data values> | - -- - | The (<minimum>, <maximum>) value of the data. | -
IMAGE_BACKGROUNDINDEX | - -O3 | - -Unsigned Integer | - -- - | The index of the background color. | -
IMAGE_TRANSPARENCY | - -O3,5 | - -Unsigned Integer | - -- - | The index of the transparent color. | -
IMAGE_ASPECTRATIO | - -O3,4 | - -Unsigned Integer | - -- - | The aspect ratio. | -
IMAGE_COLORMODEL | - -O3,6 | - -String | - -3, 4, or 5 | - -The color model, as defined below in the Palette specification for -attribute PAL_COLORMODEL. | -
IMAGE_GAMMACORRECTION | - -O3,6 | - -Float | - -- - | The gamma correction. | -
IMAGE_VERSION | - -R | - -String | - -3 | - -"1.2" | -
IMAGE_SUBCLASS1 | - -IMAGE_GRAYSCALE | - -IMAGE_BITMAP | -
CLASS | - -R | - -R | -
IMAGE_VERSION | - -R | - -R | -
INTERLACE_MODE | - -N | - -N | -
IMAGE_WHITE_IS_ZERO | - -R | - -R | -
IMAGE_MINMAXRANGE | - -O | - -O | -
IMAGE_BACKGROUNDINDEX | - -O | - -O | -
IMAGE_TRANSPARENCY | - -O | - -O | -
IMAGE_ASPECTRATIO | - -O | - -O | -
IMAGE_COLORMODEL | - -N | - -N | -
IMAGE_GAMMACORRECTION | - -N | - -N | -
PALETTE | - -O | - -O | -
DISPLAY_ORIGIN | - -O | - -O | -
- -
IMAGE_SUBCLASS | - -IMAGE_TRUECOLOR | - -IMAGE_INDEXED | -
CLASS | - -R | - -R | -
IMAGE_VERSION | - -R | - -R | -
INTERLACE_MODE | - -R | - -N | -
IMAGE_WHITE_IS_ZERO | - -N | - -N | -
IMAGE_MINMAXRANGE | - -N | - -O | -
IMAGE_BACKGROUNDINDEX | - -N | - -O | -
IMAGE_TRANSPARENCY | - -N | - -O | -
IMAGE_ASPECTRATIO | - -O | - -O | -
IMAGE_COLORMODEL | - -O | - -O | -
IMAGE_GAMMACORRECTION | - -O | - -O | -
PALETTE | - -O | - -O | -
DISPLAY_ORIGIN | - -O | - -O | -
Interlace Mode | - -Dimensions in the Dataspace | -
INTERLACE_PIXEL | - -[height][width][pixel components] | -
INTERLACE_PLANE | - -[pixel components][height][width] | -
For example, consider a 5 (rows) by 10 (column) image, with Red, Green, -and Blue components. Each component is an unsigned byte. In HDF5, -the datatype would be declared as an unsigned 8 bit integer. For -pixel interlace, the dataspace would be a three dimensional array, with -dimensions: [10][5][3]. For plane interleave, the dataspace would -be three dimensions: [3][10][5]. -
In the case of images with only one component, the dataspace may be -either a two dimensional array, or a three dimensional array with the third -dimension of size 1. For example, a 5 by 10 image with 8 bit color -indexes would be an HDF5 dataset with type unsigned 8 bit integer. -The dataspace could be either a two dimensional array, with dimensions -[10][5], or three dimensions, with dimensions either [10][5][1] or [1][10][5]. -
Image datasets may be stored with any chunking or compression properties -supported by HDF5. -
A note concerning compatibility with HDF5 GR interface: An Image -dataset is stored as an HDF5 dataset. It is important to note that -the order of the dimensions is the same as for any other HDF5 dataset. -For a two dimensional image that is to be stored as a series of horizontal -scan lines, with the scan lines contiguous (i.e., the fastest changing -dimension is 'width'), the image will have a dataspace with dim[0] = -height and dim[1] = width. This is completely consistent -with all other HDF5 datasets. -
Users familiar with HDF4 should be cautioned that this is not the
-same as HDF4, and specifically is not consistent with what the HDF4
-GR interface does.
-
-
In this example, the color component numeric type is an 8 bit unsigned -integer. While this is most common and recommended for general use, other -component color numeric datatypes, such as a 16 bit unsigned integer , -may be used. This type is specified as the type attribute of the palette -dataset. (see H5Tget_type(), H5Tset_type()) -
The minimum and maximum values of the component color numeric are specified -as attribute of the palette dataset. See below (attribute PAL_MINMAXNUMERIC). -If these attributes do not exist, it is assumed that the range of values -will fill the space of the color numeric type. i.e. with an 8 bit unsigned -integer, the valid range would be 0 to 255 for each color component. -
The HDF5 palette specification additionally allows for color models -beyond RGB. YUV, HSV, CMY, CMYK, YCbCr color models are supported, and -may be specified as a color model attribute of the palette dataset. (see -"Palette Attributes" for details). -
In HDF 4 and earlier, palettes were limited to 256 colors. The HDF5
-palette specification allows for palettes of varying length. The length
-is specified as the number of rows of the palette dataset.
-
-
-
Important Note: The specification of the Indexed -Palette will change substantially in the next version. The Palette -described here is denigrated and is not supported. | -
Denigrated
- In a standard palette, the color entries are indexed directly. HDF5 -supports the notion of a range index table. Such a table defines an ascending -ordered list of ranges that map dataset values to the palette. If a range -index table exists for the palette, the PAL_TYPE attribute will be set -to "RANGEINDEX", and the PAL_RANGEINDEX attribute will contain an object -reference to a range index table array. If not, the PAL_TYPE attribute -either does not exist, or will be set to "STANDARD". - The range index table array consists of a one dimensional array with -the same length as the palette dataset - 1. Ideally, the range index would -be of the same type as the dataset it refers to, however this is not a -requirement. - Example 2: A range index array of type floating point - The range index array attribute defines the "to" of the range. -Notice that the range index array attribute is one less entry in size than -the palette. The first entry of 0.1259, specifies that all values below -and up to 0.1259 inclusive, will map to the first palette entry. The second -entry signifies that all values greater than 0.1259 up to 0.3278 inclusive, -will map to the second palette entry, etc. All value greater than the last -range index array attribute (100000) map to the last entry in the palette. |
-
These attributes are defined as follows: -
Denigrated
- If the PAL_TYPE is set to "RANGEINDEX", there will be an additional -attribute with a name of "PAL_RANGEINDEX", (See example 2 -for more details) |
-
-
|
-
Attribute Name | - -(R = Required,
- O = Optional) |
-
-Type | - -String Size | - -Value | -|||
CLASS | - -R | - -String | - -
- |
-
-"PALETTE" | -|||
PAL_COLORMODEL | - -R | - -String | - -
- |
-
-Color Model: "RGB", YUV", "CMY", "CMYK", "YCbCr", or "HSV" | -|||
PAL_TYPE | - -R | - -String | - -
-
|
-
-"STANDARD8"
-
|
-|||
-
|
-
-- - |
-
|
-
-- - |
-
|
-|||
PAL_MINMAXNUMERIC | - -O | - -Array[2] of <same datatype as palette> | - -- - | The first value is the <Minimum value for color values>, the second -value is <Maximum value for color values>2 | -|||
PAL_VERSION | - -R | - -String | - -4 | - -"1.2" | -
1. The RANGE_INDEX attribute is required if the -PAL_TYPE is "RANGEINDEX". Otherwise, the RANGE_INDEX attribute should -be omitted. (Range index is denigrated.) | -
PAL_TYPE | - -STANDARD8 | - -RANGEINDEX | -
CLASS | - -R | - -R | -
PAL_VERSION | - -R | - -R | -
PAL_COLORMODEL | - -R | - -R | -
RANGE_INDEX | - -N | - -R | -
PAL_MINMAXNUMERIC | - -O | - -O | -
The Image and Palette specifications include several redundant standard -attributes, such as the IMAGE_COLORMODEL and the PAL_COLORMODEL. -These attributes are informative not normative, in that it is acceptable -to attach a Palette to an Image dataset even if their attributes do not -match. Software is not required to enforce consistency, and files -may contain mismatched associations of Images and Palettes. In all -cases, it is up to applications to determine what kinds of images and color -models can be supported. -
For example, an Image that was created from a file with an "RGB" may -have a "YUV" Palette in its PALETTE attribute array. This -would be a legal HDF5 file and also conforms to this specification, although -it may or may not be correct for a given application.
- - - diff --git a/doxygen/examples/LibraryReleaseVersionNumbers.html b/doxygen/examples/LibraryReleaseVersionNumbers.html deleted file mode 100644 index dedbece0c11..00000000000 --- a/doxygen/examples/LibraryReleaseVersionNumbers.html +++ /dev/null @@ -1,318 +0,0 @@ - - -HDF5 software is updated on a regular basis. These updates, known -as releases, range in scope and size from small to large. Some updates -may only fix bugs, and some updates may require a change in the format -of the data file. The version numbers that are applied to updates give -information about the kinds of changes made in the updates. This Tech -Note describes what the version numbers mean.
- -Note that this document describes release version numbers for the -HDF5 Library. For more information, see the -Shared Library Version Numbers section at the end of this document.
- -Each software release of the HDF5 Library is labeled with a version - number. The version number is a set of three integers written as HDF5-1.2.3, - HDF5 version 1.2 release 3, or HDF5 Release 1.2.3. The version number - might also include text. A patch version might be labeled HDF5-1.2.3-patch1. - The '5' in "HDF5" is part of the product name and will not change during - the life of the project.
- -The key components in HDF5 Library version numbers are the major version - number, the minor version number, the release number, and an optional text - string.
- -The first integer in a version number is the major version - number. This integer increments when there is an extensive change - to the file format or library API. Such a change may require files to - be translated and will likely require applications to be modified.
- -The second integer, 2 in the examples above, is the minor version - number. This number is incremented when there are new features that - require a change in the file format. For example, a change in file format - was required during the change from version 1.6 to version 1.8. Stable - released versions of the library are given even minor version - numbers such as 1.6 and 1.8 while odd minor version numbers such - as 1.7 and 1.9 are used on the trunk for major development. See the - section below for more information.
- -The third integer, 3 in the examples above, is the release - number. A change in this number indicates that the library has - been updated. The updates might include bug fixes, performance - improvements, and new features that do not require a file format - change.
- -A version number might also include some text. The two current - possibilities are patch and snap. A patch version might - be made to a released version to make available a feature or a bug - fix. In the figure below, a patch to the 1.8.5 release is labeled - 1.8.5-patch1. A snapshot is an intermediate posting of the software - in a branch or in the trunk. Snapshots are made available so that users - may begin to test changes in the software that affect their software. - The changes may range from bug fixes to new features. Snapshots are made - and released regularly. How regularly depends on whether the software - passes the tests done on each build. A possible version number for a - snapshot might be 1.9-snap81. This version would hold the 81st snapshot - off the 1.9 development branch (the current trunk). For the - snapshots are available at - https://github.com/HDFGroup/hdf5/releases/tag/snapshot.
- -The HDF Group uses a version control system to manage the HDF5 - project. Within the system, a trunk and branches are used to track - changes. The version numbers described above identify where a given - piece of software was produced in the system. The figure below shows - the general scheme.
- -
- - |
-
- - Figure 1. The trunk, release branches, and feature branches - |
-
The trunk is the center of the system. New features are - implemented in feature branches and aggregated in the trunk. - Release branches are then created from the trunk.
- -The minor version number of the trunk is always an odd number. From - the time of Release 1.8.0 to the first 1.10 release, the trunk will be - version 1.9. The trunk was version 1.7 from the time of release 1.6.0 - until the first 1.8 release.
- -Projects that add new features, bug fixes, and performance improvements - are developed on feature branches. When a project is completed, - its feature branch is merged into the trunk. In the figure above, the - merging of a feature branch is represented by a dashed arrow from the - feature branch to the trunk. If a feature requires a file format change, - then the feature will stay in the trunk until the next significant - release. This would mean in the figure above that the new feature would - be released in a future 1.10 release branch. If a feature does not - require a file format change, then it might be merged into one or more - release branches. This would mean in the figure above that the new - feature could be merged into the 1.8 branch and could be included in - the 1.8.6 release. If the feature was added to the 1.8.5 branch, then a - patch version might be released.
- -Release branches hold software that is distributed to general - users. In the figure above, a few release branches are shown below the - trunk. Work is done in release branches for a period of time. Branches - further from the trunk have less work done in them. For example, a patch - branch such as 1.8.5-patch1 may contain only one or two changes. A release - branch such as 1.8.5 may contain a number of bug fixes and new functions, - but these changes are small in number compared to the number of changes in - the 1.8 branch.
- -We aim to make available to the public two maintenance releases a year. - The releases occur usually in the spring near May 15 and in the fall near - November 15. If two release branches are being maintained, then - maintenance releases may be made for each release branch. For example, - there was a time when both the 1.6 and 1.8 branches were actively - maintained. In one maintenance release, the 1.6.10 and 1.8.4 versions were - released at the same time. The 1.6 and 1.8 branches were both actively - maintained to give early adopters access to new features and to give most - users plenty of time to make the change to 1.8 software from 1.6.
- -As we improve any branch, we consider the effect of any change on the - readability of objects. Applications built, for example, with version - 1.8.5 will be able to read data files written with any prior version - of the library. So, a 1.8.5 application will be able to read a dataset - written with 1.4.5. A 1.8.5 application may be able to read a dataset - written under the 1.8.7 library if no new features, features not known - to 1.8.5, were used. - -
The library provides macros and functions to query and check - version numbers.
- -The following constants are defined in the file H5public.h
- and determine the version of the include files.
H5_VERS_MAJOR
H5_VERS_MINOR
H5_VERS_RELEASE
H5_VERS_SUBRELEASE
H5_VERS_INFO
The table below describes some of the function calls and macros - that can be used to query and check version numbers.
- -- Table 1. Version function calls and macros | -|
- Function Call or Macro | -- Comments | -
H5get_libversion |
- This function returns through its arguments the version - numbers for the library to which the application is linked. | -
H5check |
- This macro uses the H5check_version function
- to verify that the version number of the HDF5 include file used
- to compile the application matches the version number of the
- library to which the application is linked. This check occurs
- automatically when the first HDF5 file is created or opened and
- is important because a mismatch between the include files and the
- library is likely to result in corrupted data and/or segmentation
- faults. If a mismatch is detected, the library issues an error
- message on the standard error stream and aborts. |
-
H5check_version |
- This function is called by the The behavior of this function can be modified by the
- |
-
H5_VERSION_GE and
- H5_VERSION_LE |
- These macros compare the version of the HDF5 library being used - against the version number specified in the parameters. At compile - time, they can be used to conditionally include or exclude code - based on the library's version. | -
H5Pset_libver_bounds |
- This function can be used to control the versions of the object - formats that will be used when creating objects in a file. | -
For more information on these and other function calls and macros, - see the HDF5 Reference Manual.
- -The purpose of this section is to describe how some of the version - functions, macros, and constants might be used.
- -Suppose first that a developer builds an application that will read
- from and write to an HDF5 file. When the application is compiled, a
- version of the HDF5 Library such as 1.8.6 will be used. The version
- constants (H5_VERS_MAJOR
, H5_VERS_MINOR
,
- and H5_VERS_RELEASE
) are included in the application when
- it is compiled.
Suppose next that a user gets a copy of the application and starts it
- up on a workstation. The executable is put into memory along with the
- HDF5 Library. However, an application may only work successfully with
- the version of the library with which the application was compiled. In
- other words, the version of the library that is loaded when the applicati=
-on
- is started must be the same version as the version of the library with
- which the application was compiled. This is verified by the library when
- the first HDF5 API routine is called. If an application wants to confirm
- early in its startup procedure that the version of the library that will
- be loaded into memory at the workstation will work with the application,
- then it can use the H5get_libversion
and
- H5check_version
function calls.
The H5_VERSION_GE
and H5_VERSION_LE
version
- macros compare the version of the HDF5 Library being used against the
- version number specified in the parameters. At compile time, they can be
- used to conditionally include or exclude code based on the library's
- version. For example, the link functions, H5Lxxx
, are
- new in version 1.8, and some group functions, H5Gxxx
,
- are deprecated in 1.8. With the H5_VERSION_GE
macro, an
- application could use H5Ldelete
if the library version is
- 1.8.0 or greater, or it could use H5Gunlink
if the library
- version is less than 1.8.0.
Suppose a data file has three datasets. It is possible that the three
- datasets were added to the data file with applications using different
- versions of HDF5. The different versions could be 1.4.5, 1.6.10, and
- 1.8.6. If another dataset is written to the data file, then it will be
- written by default in the oldest format possible that has all of the
- features needed to successfully write the dataset. If a newer feature
- such as compact storage, a new parameter for a function, or a partially
- compressed dataset is used, then a newer format will be used.
- H5Pset_libver_bounds
could be used to specify the oldest
- format used. In the situation above, the owners of the data file might
- want all data written to the file in the future to be in a 1.8 format
- rather than 1.6 or 1.4.
HDF5 shared libraries utilize the - -libtool versioning system in order to indicate interface -compatibility between maintenance releases of HDF5. While we always -attempt to maintain interface compatibility between minor maintenance -release versions of HDF5, if we are forced to break interface -compatibility in order to resolve a critical defect within the -library, then the library interface version attached to the shared -libraries for a given release will be incremented accordingly.
- -Please note that this libtool version number for interface -compatibility is unrelated to the HDF5 release version for a given -release.
- - - diff --git a/hl/src/H5PT.c b/hl/src/H5PT.c index c8cefd3a324..89e6a20d69d 100644 --- a/hl/src/H5PT.c +++ b/hl/src/H5PT.c @@ -25,8 +25,6 @@ typedef struct { static hsize_t H5PT_ptable_count = 0; static H5I_type_t H5PT_ptable_id_type = H5I_UNINIT; -#define H5PT_HASH_TABLE_SIZE 64 - /* Packet Table private functions */ static herr_t H5PT_free_id(void *id, void **_ctx); static herr_t H5PT_close(htbl_t *table); @@ -73,8 +71,7 @@ H5PTcreate(hid_t loc_id, const char *dset_name, hid_t dtype_id, hsize_t chunk_si /* Register the packet table ID type if this is the first table created */ if (H5PT_ptable_id_type < 0) - if ((H5PT_ptable_id_type = - H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)H5PT_free_id)) < 0) + if ((H5PT_ptable_id_type = H5Iregister_type2(0, (H5I_free_t)H5PT_free_id)) < 0) goto error; /* Get memory for the table identifier */ @@ -187,8 +184,7 @@ H5PTcreate_fl(hid_t loc_id, const char *dset_name, hid_t dtype_id, hsize_t chunk /* Register the packet table ID type if this is the first table created */ if (H5PT_ptable_id_type < 0) - if ((H5PT_ptable_id_type = - H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)H5PT_free_id)) < 0) + if ((H5PT_ptable_id_type = H5Iregister_type2(0, (H5I_free_t)H5PT_free_id)) < 0) goto error; /* Get memory for the table identifier */ @@ -287,8 +283,7 @@ H5PTopen(hid_t loc_id, const char *dset_name) /* Register the packet table ID type if this is the first table created */ if (H5PT_ptable_id_type < 0) - if ((H5PT_ptable_id_type = - H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)H5PT_free_id)) < 0) + if ((H5PT_ptable_id_type = H5Iregister_type2(0, (H5I_free_t)H5PT_free_id)) < 0) goto error; table = (htbl_t *)malloc(sizeof(htbl_t)); diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index fe475611bc8..fe51f4e511d 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -6306,7 +6306,7 @@ public synchronized static native void H5Iclear_type(int type_id, boolean force) // hid_t H5Iregister(H5I_type_t type, const void *object); // typedef herr_t (*H5I_free_t)(void *); - // H5I_type_t H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func); + // H5I_type_t H5Iregister_type2(unsigned reserved, H5I_free_t free_func); // void *H5Iremove_verify(hid_t id, H5I_type_t id_type); diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index a0b2c2d6210..7491902a226 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -156,6 +156,24 @@ New Features Library: -------- + - The H5Iregister_type() signature has changed + + The hash_size parameter has not been used since early versions of HDF5 + 1.8, so it has been removed and the API call has been versioned. + + The old signature has been renamed to H5Iregister_type1() and is considered + deprecated: + + H5I_type_t H5Iregister_type1(size_t hash_size, unsigned reserved, H5I_free_t free_func); + + The new signature is H5Iregister_type2(). New code should use this + version: + + H5I_type_t H5Iregister_type2(unsigned reserved, H5I_free_t free_func); + + H5Iregister_type() will map to the new signature unless the library is + explicitly configured to use an older version of the API. + - H5F_LIBVER_LATEST is now an enum value This was previously #defined to the latest H5F_libver_t API version, but diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2cdaa575c43..8900bae7528 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -387,6 +387,7 @@ IDE_GENERATED_PROPERTIES ("H5HL" "${H5HL_HDRS}" "${H5HL_SOURCES}" ) set (H5I_SOURCES ${HDF5_SRC_DIR}/H5I.c ${HDF5_SRC_DIR}/H5Idbg.c + ${HDF5_SRC_DIR}/H5Ideprec.c ${HDF5_SRC_DIR}/H5Iint.c ${HDF5_SRC_DIR}/H5Itest.c ) diff --git a/src/H5FDhdfs.h b/src/H5FDhdfs.h index cc667ac1d81..6ceb86ee2c2 100644 --- a/src/H5FDhdfs.h +++ b/src/H5FDhdfs.h @@ -31,7 +31,7 @@ #else -/** Initializer for the hdfs VFD (disabled) */ +/** Initializer for the hdfs VFD (disabled) \since 1.8.22 */ #define H5FD_HDFS (H5I_INVALID_HID) /** Identifier for the hdfs VFD (disabled) */ @@ -47,11 +47,11 @@ */ #define H5FD__CURR_HDFS_FAPL_T_VERSION 1 -/** Max size of the node name */ +/** Max size of the node name \since 1.8.22 */ #define H5FD__HDFS_NODE_NAME_SPACE 128 -/** Max size of the user name */ +/** Max size of the user name \since 1.8.22 */ #define H5FD__HDFS_USER_NAME_SPACE 128 -/** Max size of the kerberos cache path */ +/** Max size of the kerberos cache path \since 1.8.22 */ #define H5FD__HDFS_KERB_CACHE_PATH_SPACE 128 /** diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index d8e080edab9..cab2a263038 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -107,18 +107,23 @@ * of type 'int' and is compatible with POSIX I/O calls. */ #define H5FD_FEAT_POSIX_COMPAT_HANDLE 0x00000080 -/* - * Defining H5FD_FEAT_HAS_MPI for a VFL driver means that - * the driver makes use of MPI communication and code may retrieve - * communicator/rank information from it - */ + #define H5FD_FEAT_HAS_MPI 0x00000100 -/* - * Defining the H5FD_FEAT_ALLOCATE_EARLY for a VFL driver will force - * the library to use the H5D_ALLOC_TIME_EARLY on dataset create - * instead of the default H5D_ALLOC_TIME_LATE +/**< Defining H5FD_FEAT_HAS_MPI for a VFL driver means that + * the driver makes use of MPI communication and code may retrieve + * communicator/rank information from it + * + * \since 1.8.15 */ + #define H5FD_FEAT_ALLOCATE_EARLY 0x00000200 +/**< Defining the H5FD_FEAT_ALLOCATE_EARLY for a VFL driver will force + * the library to use the H5D_ALLOC_TIME_EARLY on dataset create + * instead of the default H5D_ALLOC_TIME_LATE + * + * \since 1.8.15 + */ + /* * Defining H5FD_FEAT_ALLOW_FILE_IMAGE for a VFL driver means that * the driver is able to use a file image in the fapl as the initial diff --git a/src/H5FDros3.h b/src/H5FDros3.h index 8117ad8a1e5..ff51d6baae2 100644 --- a/src/H5FDros3.h +++ b/src/H5FDros3.h @@ -21,17 +21,17 @@ #ifdef H5_HAVE_ROS3_VFD -/** ID for the ros3 VFD */ +/** Initializer for the ros3 VFD \since 1.8.22 */ #define H5FD_ROS3 (H5OPEN H5FD_ROS3_id_g) -/** Identifier for the ros3 VFD */ +/** Identifier for the ros3 VFD \since 1.14.0 */ #define H5FD_ROS3_VALUE H5_VFD_ROS3 #else -/** Initializer for the ros3 VFD (disabled) */ +/** Initializer for the ros3 VFD (disabled) \since 1.8.22 */ #define H5FD_ROS3 (H5I_INVALID_HID) -/** Identifier for the ros3 VFD (disabled) */ +/** Identifier for the ros3 VFD (disabled) \since 1.14.0 */ #define H5FD_ROS3_VALUE H5_VFD_INVALID #endif diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index 1fb32c2c142..f8644b83f21 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -32,13 +32,13 @@ /* NOTE: 0x0008u was H5F_ACC_DEBUG, now deprecated */ #define H5F_ACC_CREAT (0x0010u) /**< Create non-existing files */ #define H5F_ACC_SWMR_WRITE \ - (0x0020u) /**< Indicate that this file is open for writing in a \ + (0x0020u) /**< Indicates that this file is open for writing in a \ * single-writer/multi-reader (SWMR) scenario. \ * Note that the process(es) opening the file for reading \ * must open the file with #H5F_ACC_RDONLY and use the \ * #H5F_ACC_SWMR_READ access flag. */ #define H5F_ACC_SWMR_READ \ - (0x0040u) /**< Indicate that this file is open for reading in a \ + (0x0040u) /**< Indicates that this file is open for reading in a \ * single-writer/multi-reader (SWMR) scenario. Note that \ * the process(es) opening the file for SWMR reading must \ * also open the file with the #H5F_ACC_RDONLY flag. */ @@ -231,9 +231,10 @@ typedef herr_t (*H5F_flush_cb_t)(hid_t object_id, void *udata); * high number of unused bits. See documentation for \ * H5Pset_relax_file_integrity_checks for details. */ #define H5F_RFIC_ALL \ - (H5F_RFIC_UNUSUAL_NUM_UNUSED_NUMERIC_BITS) /**< Suppress all format integrity check errors. See \ - * documentation for H5Pset_relax_file_integrity_checks \ - * for details. */ + (H5F_RFIC_UNUSUAL_NUM_UNUSED_NUMERIC_BITS) /**< Suppress all format integrity check \ + * errors. See documentation for \ + * H5Pset_relax_file_integrity_checks \ + * for details. */ /*********************/ /* Public Prototypes */ diff --git a/src/H5I.c b/src/H5I.c index 731f0f31c56..201a6fb8e83 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -73,16 +73,15 @@ static int H5I__iterate_pub_cb(void *obj, hid_t id, void *udata); /*******************/ /*------------------------------------------------------------------------- - * Function: H5Iregister_type + * Function: H5Iregister_type2 * - * Purpose: Public interface to H5I_register_type. Creates a new type + * Purpose: Public interface to H5I_register_type2. Creates a new type * of ID's to give out. A specific number (RESERVED) of type * entries may be reserved to enable "constant" values to be handed * out which are valid IDs in the type, but which do not map to any - * data structures and are not allocated dynamically later. HASH_SIZE is - * the minimum hash table size to use for the type. FREE_FUNC is - * called with an object pointer when the object is removed from - * the type. + * data structures and are not allocated dynamically later. + * FREE_FUNC is called with an object pointer when the object is + * removed from the type. * * Return: Success: Type ID of the new type * Failure: H5I_BADID @@ -90,65 +89,18 @@ static int H5I__iterate_pub_cb(void *obj, hid_t id, void *udata); *------------------------------------------------------------------------- */ H5I_type_t -H5Iregister_type(size_t H5_ATTR_UNUSED hash_size, unsigned reserved, H5I_free_t free_func) +H5Iregister_type2(unsigned reserved, H5I_free_t free_func) { - H5I_class_t *cls = NULL; /* New ID class */ - H5I_type_t new_type = H5I_BADID; /* New ID type value */ - H5I_type_t ret_value = H5I_BADID; /* Return value */ + H5I_type_t ret_value = H5I_BADID; FUNC_ENTER_API(H5I_BADID) - /* Generate a new H5I_type_t value */ - - /* Increment the number of types */ - if (H5I_next_type_g < H5I_MAX_NUM_TYPES) { - new_type = (H5I_type_t)H5I_next_type_g; - H5I_next_type_g++; - } - else { - bool done; /* Indicate that search was successful */ - int i; - - /* Look for a free type to give out */ - done = false; - for (i = H5I_NTYPES; i < H5I_MAX_NUM_TYPES && done == false; i++) { - if (NULL == H5I_type_info_array_g[i]) { - /* Found a free type ID */ - new_type = (H5I_type_t)i; - done = true; - } - } - - /* Verify that we found a type to give out */ - if (done == false) - HGOTO_ERROR(H5E_ID, H5E_NOSPACE, H5I_BADID, "Maximum number of ID types exceeded"); - } - - /* Allocate new ID class */ - if (NULL == (cls = H5MM_calloc(sizeof(H5I_class_t)))) - HGOTO_ERROR(H5E_ID, H5E_CANTALLOC, H5I_BADID, "ID class allocation failed"); - - /* Initialize class fields */ - cls->type = new_type; - cls->flags = H5I_CLASS_IS_APPLICATION; - cls->reserved = reserved; - cls->free_func = free_func; - - /* Register the new ID class */ - if (H5I_register_type(cls) < 0) + if (H5I_BADID == (ret_value = H5I__register_type_common(reserved, free_func))) HGOTO_ERROR(H5E_ID, H5E_CANTINIT, H5I_BADID, "can't initialize ID class"); - /* Set return value */ - ret_value = new_type; - done: - /* Clean up on error */ - if (ret_value < 0) - if (cls) - cls = H5MM_xfree(cls); - FUNC_LEAVE_API(ret_value) -} /* end H5Iregister_type() */ +} /* end H5Iregister_type2() */ /*------------------------------------------------------------------------- * Function: H5Itype_exists diff --git a/src/H5Ideprec.c b/src/H5Ideprec.c new file mode 100644 index 00000000000..0d172f668bd --- /dev/null +++ b/src/H5Ideprec.c @@ -0,0 +1,97 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the LICENSE file, which can be found at the root of the source code * + * distribution tree, or in https://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/*------------------------------------------------------------------------- + * + * Created: H5Ideprec.c + * + * Purpose: Deprecated functions from the H5I interface. These + * functions are here for compatibility purposes and may be + * removed in the future. Applications should switch to the + * newer APIs. + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5Imodule.h" /* This source code file is part of the H5I module */ + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Ipkg.h" /* File access */ + +/****************/ +/* Local Macros */ +/****************/ + +/******************/ +/* Local Typedefs */ +/******************/ + +/********************/ +/* Package Typedefs */ +/********************/ + +/********************/ +/* Local Prototypes */ +/********************/ + +/*********************/ +/* Package Variables */ +/*********************/ + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + +/*******************/ +/* Local Variables */ +/*******************/ + +#ifndef H5_NO_DEPRECATED_SYMBOLS +/*------------------------------------------------------------------------- + * Function: H5Iregister_type1 + * + * Purpose: Public interface to H5I_register_type. Creates a new type + * of ID's to give out. A specific number (RESERVED) of type + * entries may be reserved to enable "constant" values to be handed + * out which are valid IDs in the type, but which do not map to any + * data structures and are not allocated dynamically later. HASH_SIZE is + * the minimum hash table size to use for the type. FREE_FUNC is + * called with an object pointer when the object is removed from + * the type. + * + * Return: Success: Type ID of the new type + * Failure: H5I_BADID + * + *------------------------------------------------------------------------- + */ +H5I_type_t +H5Iregister_type1(size_t H5_ATTR_UNUSED hash_size, unsigned reserved, H5I_free_t free_func) +{ + H5I_type_t ret_value = H5I_BADID; + + FUNC_ENTER_API(H5I_BADID) + + if (H5I_BADID == (ret_value = H5I__register_type_common(reserved, free_func))) + HGOTO_ERROR(H5E_ID, H5E_CANTINIT, H5I_BADID, "can't initialize ID class"); + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Iregister_type1() */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Iint.c b/src/H5Iint.c index 785dd9f0e86..21c4bfc280a 100644 --- a/src/H5Iint.c +++ b/src/H5Iint.c @@ -156,6 +156,76 @@ H5I_term_package(void) FUNC_LEAVE_NOAPI(in_use) } /* end H5I_term_package() */ +/*------------------------------------------------------------------------- + * Function: H5I__register_type_common + * + * Purpose: Common functionality for H5Iregister_type(1|2) + * + * Return: Success: Type ID of the new type + * Failure: H5I_BADID + *------------------------------------------------------------------------- + */ +H5I_type_t +H5I__register_type_common(unsigned reserved, H5I_free_t free_func) +{ + H5I_class_t *cls = NULL; /* New ID class */ + H5I_type_t new_type = H5I_BADID; /* New ID type value */ + H5I_type_t ret_value = H5I_BADID; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Generate a new H5I_type_t value */ + + /* Increment the number of types */ + if (H5I_next_type_g < H5I_MAX_NUM_TYPES) { + new_type = (H5I_type_t)H5I_next_type_g; + H5I_next_type_g++; + } + else { + bool done; /* Indicate that search was successful */ + int i; + + /* Look for a free type to give out */ + done = false; + for (i = H5I_NTYPES; i < H5I_MAX_NUM_TYPES && done == false; i++) { + if (NULL == H5I_type_info_array_g[i]) { + /* Found a free type ID */ + new_type = (H5I_type_t)i; + done = true; + } + } + + /* Verify that we found a type to give out */ + if (done == false) + HGOTO_ERROR(H5E_ID, H5E_NOSPACE, H5I_BADID, "Maximum number of ID types exceeded"); + } + + /* Allocate new ID class */ + if (NULL == (cls = H5MM_calloc(sizeof(H5I_class_t)))) + HGOTO_ERROR(H5E_ID, H5E_CANTALLOC, H5I_BADID, "ID class allocation failed"); + + /* Initialize class fields */ + cls->type = new_type; + cls->flags = H5I_CLASS_IS_APPLICATION; + cls->reserved = reserved; + cls->free_func = free_func; + + /* Register the new ID class */ + if (H5I_register_type(cls) < 0) + HGOTO_ERROR(H5E_ID, H5E_CANTINIT, H5I_BADID, "can't initialize ID class"); + + /* Set return value */ + ret_value = new_type; + +done: + /* Clean up on error */ + if (ret_value == H5I_BADID) + if (cls) + cls = H5MM_xfree(cls); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I__register_type_common() */ + /*------------------------------------------------------------------------- * Function: H5I_register_type * diff --git a/src/H5Ipkg.h b/src/H5Ipkg.h index 852ab151dc5..5393c3d2b39 100644 --- a/src/H5Ipkg.h +++ b/src/H5Ipkg.h @@ -106,6 +106,7 @@ H5_DLLVAR int H5I_next_type_g; H5_DLL hid_t H5I__register(H5I_type_t type, const void *object, bool app_ref, H5I_future_realize_func_t realize_cb, H5I_future_discard_func_t discard_cb); +H5_DLL H5I_type_t H5I__register_type_common(unsigned reserved, H5I_free_t free_func); H5_DLL int H5I__destroy_type(H5I_type_t type); H5_DLL void *H5I__remove_verify(hid_t id, H5I_type_t type); H5_DLL int H5I__inc_type_ref(H5I_type_t type); diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h index 9a28dac9094..0ccebda6da5 100644 --- a/src/H5Ipublic.h +++ b/src/H5Ipublic.h @@ -394,20 +394,14 @@ H5_DLL int H5Iget_ref(hid_t id); * * \brief Creates and returns a new ID type * - * \param[in] hash_size Minimum hash table size (in entries) used to store IDs - * for the new type (unused in 1.8.13 and later) * \param[in] reserved Number of reserved IDs for the new type * \param[in] free_func Function used to deallocate space for a single ID * * \return Returns the type identifier on success, negative on failure. * - * \details H5Iregister_type() allocates space for a new ID type and returns an + * \details H5Iregister_type2() allocates space for a new ID type and returns an * identifier for it. * - * The \p hash_size parameter indicates the minimum size of the hash - * table used to store IDs in the new type. This parameter is unused - * in 1.8.13 and later, when the implementation of ID storage changed. - * * The \p reserved parameter indicates the number of IDs in this new * type to be reserved. Reserved IDs are valid IDs which are not * associated with any storage within the library. @@ -420,10 +414,10 @@ H5_DLL int H5Iget_ref(hid_t id); * pointer which was passed in to the H5Iregister() function. The \p * free_func function should return 0 on success and -1 on failure. * - * \since 1.8.0 + * \since 2.0.0 * */ -H5_DLL H5I_type_t H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func); +H5_DLL H5I_type_t H5Iregister_type2(unsigned reserved, H5I_free_t free_func); /** * \ingroup H5IUD * @@ -683,6 +677,51 @@ H5_DLL htri_t H5Itype_exists(H5I_type_t type); */ H5_DLL htri_t H5Iis_valid(hid_t id); +/* Symbols defined for compatibility with previous versions of the HDF5 API. + * + * Use of these symbols is deprecated. + */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + +/** + * \ingroup H5IUD + * + * \brief Creates and returns a new ID type + * + * \param[in] hash_size Minimum hash table size (in entries) used to store IDs + * for the new type (unused in 1.8.13 and later) + * \param[in] reserved Number of reserved IDs for the new type + * \param[in] free_func Function used to deallocate space for a single ID + * + * \return Returns the type identifier on success, negative on failure. + * + * \details H5Iregister_type1() allocates space for a new ID type and returns an + * identifier for it. + * + * The \p hash_size parameter indicates the minimum size of the hash + * table used to store IDs in the new type. This parameter is unused + * in 1.8.13 and later, when the implementation of ID storage changed. + * + * The \p reserved parameter indicates the number of IDs in this new + * type to be reserved. Reserved IDs are valid IDs which are not + * associated with any storage within the library. + * + * The \p free_func parameter is a function pointer to a function + * which returns an herr_t and accepts a \c void*. The purpose of this + * function is to deallocate memory for a single ID. It will be called + * by H5Iclear_type() and H5Idestroy_type() on each ID. This function + * is NOT called by H5Iremove_verify(). The \c void* will be the same + * pointer which was passed in to the H5Iregister() function. The \p + * free_func function should return 0 on success and -1 on failure. + * + * \since 1.8.0 + * \deprecated 2.0.0 Deprecated in favor of the function H5Iregister_type2() + * + */ +H5_DLL H5I_type_t H5Iregister_type1(size_t hash_size, unsigned reserved, H5I_free_t free_func); + +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + #ifdef __cplusplus } #endif diff --git a/src/H5PLpublic.h b/src/H5PLpublic.h index 18ca6ec51ce..8e72949df3b 100644 --- a/src/H5PLpublic.h +++ b/src/H5PLpublic.h @@ -41,10 +41,16 @@ typedef enum H5PL_type_t { //! /* Common dynamic plugin type flags used by the set/get_loading_state functions */ +/** Flag for filter plugin \since 1.8.15 */ #define H5PL_FILTER_PLUGIN 0x0001 -#define H5PL_VOL_PLUGIN 0x0002 -#define H5PL_VFD_PLUGIN 0x0004 -#define H5PL_ALL_PLUGIN 0xFFFF +/** Flag for VOL plugin \since 1.12.0 */ +#define H5PL_VOL_PLUGIN 0x0002 +/** Flag for VFD plugin \since 1.14.0 */ +#define H5PL_VFD_PLUGIN 0x0004 +/** Flag for all plugin types \since 1.8.15 */ +#define H5PL_ALL_PLUGIN 0xFFFF + +#define H5F_ACC_DEBUG (0x0000u) /**< Print debug info \deprecated In which version? */ #ifdef __cplusplus extern "C" { diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 45b6ab905cc..a0022892d12 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -1012,7 +1012,7 @@ H5_DLL htri_t H5Pexist(hid_t plist_id, const char *name); * * The property name must exist or this routine will fail. * - * If the \p get callback routine returns an error, \ value will + * If the \p get callback routine returns an error, \p value will * not be modified. * * \since 1.4.0 diff --git a/src/H5VLnative_private.h b/src/H5VLnative_private.h index 15c9ae94e59..8d49a8ca871 100644 --- a/src/H5VLnative_private.h +++ b/src/H5VLnative_private.h @@ -47,7 +47,7 @@ H5_DLLVAR H5VL_connector_t *H5VL_NATIVE_conn_g; H5_DLL void *H5VL__native_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); -void *H5VL__native_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, +H5_DLL void *H5VL__native_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t aapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); diff --git a/src/H5public.h b/src/H5public.h index 62e0db9764b..7e5b20f2a06 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -343,10 +343,15 @@ typedef int64_t hssize_t; * \internal Defined as a (minimum) 64-bit unsigned integer type. */ typedef uint64_t haddr_t; -#define PRIdHADDR PRId64 -#define PRIoHADDR PRIo64 -#define PRIuHADDR PRIu64 -#define PRIxHADDR PRIx64 +/** d print conversion specifier \since 1.8.23 */ +#define PRIdHADDR PRId64 +/** o print conversion specifier \since 1.8.23 */ +#define PRIoHADDR PRIo64 +/** u print conversion specifier \since 1.8.23 */ +#define PRIuHADDR PRIu64 +/** x print conversion specifier \since 1.8.23 */ +#define PRIxHADDR PRIx64 +/** x print conversion specifier \since 1.8.23 */ #define PRIXHADDR PRIX64 #define H5_SIZEOF_HADDR_T 8 #define HADDR_UNDEF UINT64_MAX diff --git a/src/H5vers.txt b/src/H5vers.txt index c2b0a45886b..ce17f889c7b 100644 --- a/src/H5vers.txt +++ b/src/H5vers.txt @@ -39,7 +39,7 @@ # API function names # (although not required, it's easier to compare this file with the headers -# generated if the list below is in alphanumeric sort order - QAK) +# generated if the list below is in alphanumeric sort order) FUNCTION: H5Acreate; ; v10, v18 FUNCTION: H5Aiterate; H5A_operator; v10, v18 FUNCTION: H5Dcreate; ; v10, v18 @@ -53,6 +53,7 @@ FUNCTION: H5Ewalk; H5E_walk, H5E_error; v10, v18 FUNCTION: H5Fget_info; H5F_info; v18, v110 FUNCTION: H5Gcreate; ; v10, v18 FUNCTION: H5Gopen; ; v10, v18 +FUNCTION: H5Iregister_type; ; v18, v200 FUNCTION: H5Lget_info; H5L_info; v18, v112 FUNCTION: H5Lget_info_by_idx; H5L_info; v18, v112 FUNCTION: H5Literate; H5L_iterate; v18, v112 @@ -88,7 +89,7 @@ FUNCTION: H5Topen; ; v10, v18 # API typedefs # (although not required, it's easier to compare this file with the headers -# generated if the list below is in alphanumeric sort order - QAK) +# generated if the list below is in alphanumeric sort order) TYPEDEF: H5E_auto; v10, v18 TYPEDEF: H5O_info; v18, v112 TYPEDEF: H5O_iterate; v18, v112 diff --git a/src/H5version.h b/src/H5version.h index 089e6e9f2de..9fe80159695 100644 --- a/src/H5version.h +++ b/src/H5version.h @@ -43,6 +43,10 @@ #define H5_USE_114_API 1 #endif /* H5_USE_114_API_DEFAULT && !H5_USE_114_API */ +#if defined(H5_USE_200_API_DEFAULT) && !defined(H5_USE_200_API) + #define H5_USE_200_API 1 +#endif /* H5_USE_200_API_DEFAULT && !H5_USE_200_API */ + /* Issue error if contradicting macros have been defined. */ /* (Can't use an older (deprecated) API version if deprecated symbols have been disabled) */ @@ -224,6 +228,10 @@ #define H5Gopen_vers 2 #endif /* !defined(H5Gopen_vers) */ +#if !defined(H5Iregister_type_vers) + #define H5Iregister_type_vers 1 +#endif /* !defined(H5Iregister_type_vers) */ + #if !defined(H5Lget_info_vers) #define H5Lget_info_vers 1 #endif /* !defined(H5Lget_info_vers) */ @@ -392,6 +400,10 @@ #define H5Gopen_vers 2 #endif /* !defined(H5Gopen_vers) */ +#if !defined(H5Iregister_type_vers) + #define H5Iregister_type_vers 1 +#endif /* !defined(H5Iregister_type_vers) */ + #if !defined(H5Lget_info_vers) #define H5Lget_info_vers 1 #endif /* !defined(H5Lget_info_vers) */ @@ -564,6 +576,10 @@ #define H5Gopen_vers 2 #endif /* !defined(H5Gopen_vers) */ +#if !defined(H5Iregister_type_vers) + #define H5Iregister_type_vers 1 +#endif /* !defined(H5Iregister_type_vers) */ + #if !defined(H5Lget_info_vers) #define H5Lget_info_vers 2 #endif /* !defined(H5Lget_info_vers) */ @@ -736,6 +752,10 @@ #define H5Gopen_vers 2 #endif /* !defined(H5Gopen_vers) */ +#if !defined(H5Iregister_type_vers) + #define H5Iregister_type_vers 1 +#endif /* !defined(H5Iregister_type_vers) */ + #if !defined(H5Lget_info_vers) #define H5Lget_info_vers 2 #endif /* !defined(H5Lget_info_vers) */ @@ -850,6 +870,182 @@ #endif /* H5_USE_114_API */ +#ifdef H5_USE_200_API + +/*************/ +/* Functions */ +/*************/ + +#if !defined(H5Acreate_vers) + #define H5Acreate_vers 2 +#endif /* !defined(H5Acreate_vers) */ + +#if !defined(H5Aiterate_vers) + #define H5Aiterate_vers 2 +#endif /* !defined(H5Aiterate_vers) */ + +#if !defined(H5Dcreate_vers) + #define H5Dcreate_vers 2 +#endif /* !defined(H5Dcreate_vers) */ + +#if !defined(H5Dopen_vers) + #define H5Dopen_vers 2 +#endif /* !defined(H5Dopen_vers) */ + +#if !defined(H5Eclear_vers) + #define H5Eclear_vers 2 +#endif /* !defined(H5Eclear_vers) */ + +#if !defined(H5Eget_auto_vers) + #define H5Eget_auto_vers 2 +#endif /* !defined(H5Eget_auto_vers) */ + +#if !defined(H5Eprint_vers) + #define H5Eprint_vers 2 +#endif /* !defined(H5Eprint_vers) */ + +#if !defined(H5Epush_vers) + #define H5Epush_vers 2 +#endif /* !defined(H5Epush_vers) */ + +#if !defined(H5Eset_auto_vers) + #define H5Eset_auto_vers 2 +#endif /* !defined(H5Eset_auto_vers) */ + +#if !defined(H5Ewalk_vers) + #define H5Ewalk_vers 2 +#endif /* !defined(H5Ewalk_vers) */ + +#if !defined(H5Fget_info_vers) + #define H5Fget_info_vers 2 +#endif /* !defined(H5Fget_info_vers) */ + +#if !defined(H5Gcreate_vers) + #define H5Gcreate_vers 2 +#endif /* !defined(H5Gcreate_vers) */ + +#if !defined(H5Gopen_vers) + #define H5Gopen_vers 2 +#endif /* !defined(H5Gopen_vers) */ + +#if !defined(H5Iregister_type_vers) + #define H5Iregister_type_vers 2 +#endif /* !defined(H5Iregister_type_vers) */ + +#if !defined(H5Lget_info_vers) + #define H5Lget_info_vers 2 +#endif /* !defined(H5Lget_info_vers) */ + +#if !defined(H5Lget_info_by_idx_vers) + #define H5Lget_info_by_idx_vers 2 +#endif /* !defined(H5Lget_info_by_idx_vers) */ + +#if !defined(H5Literate_vers) + #define H5Literate_vers 2 +#endif /* !defined(H5Literate_vers) */ + +#if !defined(H5Literate_by_name_vers) + #define H5Literate_by_name_vers 2 +#endif /* !defined(H5Literate_by_name_vers) */ + +#if !defined(H5Lvisit_vers) + #define H5Lvisit_vers 2 +#endif /* !defined(H5Lvisit_vers) */ + +#if !defined(H5Lvisit_by_name_vers) + #define H5Lvisit_by_name_vers 2 +#endif /* !defined(H5Lvisit_by_name_vers) */ + +#if !defined(H5Oget_info_vers) + #define H5Oget_info_vers 3 +#endif /* !defined(H5Oget_info_vers) */ + +#if !defined(H5Oget_info_by_idx_vers) + #define H5Oget_info_by_idx_vers 3 +#endif /* !defined(H5Oget_info_by_idx_vers) */ + +#if !defined(H5Oget_info_by_name_vers) + #define H5Oget_info_by_name_vers 3 +#endif /* !defined(H5Oget_info_by_name_vers) */ + +#if !defined(H5Ovisit_vers) + #define H5Ovisit_vers 3 +#endif /* !defined(H5Ovisit_vers) */ + +#if !defined(H5Ovisit_by_name_vers) + #define H5Ovisit_by_name_vers 3 +#endif /* !defined(H5Ovisit_by_name_vers) */ + +#if !defined(H5Pencode_vers) + #define H5Pencode_vers 2 +#endif /* !defined(H5Pencode_vers) */ + +#if !defined(H5Pget_filter_vers) + #define H5Pget_filter_vers 2 +#endif /* !defined(H5Pget_filter_vers) */ + +#if !defined(H5Pget_filter_by_id_vers) + #define H5Pget_filter_by_id_vers 2 +#endif /* !defined(H5Pget_filter_by_id_vers) */ + +#if !defined(H5Pinsert_vers) + #define H5Pinsert_vers 2 +#endif /* !defined(H5Pinsert_vers) */ + +#if !defined(H5Pregister_vers) + #define H5Pregister_vers 2 +#endif /* !defined(H5Pregister_vers) */ + +#if !defined(H5Rdereference_vers) + #define H5Rdereference_vers 2 +#endif /* !defined(H5Rdereference_vers) */ + +#if !defined(H5Rget_obj_type_vers) + #define H5Rget_obj_type_vers 2 +#endif /* !defined(H5Rget_obj_type_vers) */ + +#if !defined(H5Sencode_vers) + #define H5Sencode_vers 2 +#endif /* !defined(H5Sencode_vers) */ + +#if !defined(H5Tarray_create_vers) + #define H5Tarray_create_vers 2 +#endif /* !defined(H5Tarray_create_vers) */ + +#if !defined(H5Tcommit_vers) + #define H5Tcommit_vers 2 +#endif /* !defined(H5Tcommit_vers) */ + +#if !defined(H5Tget_array_dims_vers) + #define H5Tget_array_dims_vers 2 +#endif /* !defined(H5Tget_array_dims_vers) */ + +#if !defined(H5Topen_vers) + #define H5Topen_vers 2 +#endif /* !defined(H5Topen_vers) */ + +/************/ +/* Typedefs */ +/************/ + +#if !defined(H5E_auto_t_vers) + #define H5E_auto_t_vers 2 +#endif /* !defined(H5E_auto_t_vers) */ + +#if !defined(H5O_info_t_vers) + #define H5O_info_t_vers 2 +#endif /* !defined(H5O_info_t_vers) */ + +#if !defined(H5O_iterate_t_vers) + #define H5O_iterate_t_vers 2 +#endif /* !defined(H5O_iterate_t_vers) */ + +#if !defined(H5Z_class_t_vers) + #define H5Z_class_t_vers 2 +#endif /* !defined(H5Z_class_t_vers) */ + +#endif /* H5_USE_200_API */ + /* Choose the correct version of each API symbol, defaulting to the latest * version of each. The "best" name for API parameters/data structures @@ -1012,6 +1208,17 @@ #error "H5Gopen_vers set to invalid value" #endif /* H5Gopen_vers */ +#if !defined(H5Iregister_type_vers) || H5Iregister_type_vers == 2 + #ifndef H5Iregister_type_vers + #define H5Iregister_type_vers 2 + #endif /* H5Iregister_type_vers */ + #define H5Iregister_type H5Iregister_type2 +#elif H5Iregister_type_vers == 1 + #define H5Iregister_type H5Iregister_type1 +#else /* H5Iregister_type_vers */ + #error "H5Iregister_type_vers set to invalid value" +#endif /* H5Iregister_type_vers */ + #if !defined(H5Lget_info_vers) || H5Lget_info_vers == 2 #ifndef H5Lget_info_vers #define H5Lget_info_vers 2 diff --git a/src/Makefile.am b/src/Makefile.am index a2166af110f..ae27987aa30 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -67,7 +67,7 @@ libhdf5_la_SOURCES= H5.c H5build_settings.c H5checksum.c H5dbg.c H5system.c \ H5HFspace.c H5HFstat.c H5HFtest.c H5HFtiny.c \ H5HG.c H5HGcache.c H5HGdbg.c H5HGquery.c \ H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c H5HLprfx.c H5HLdblk.c \ - H5I.c H5Idbg.c H5Iint.c H5Itest.c \ + H5I.c H5Idbg.c H5Ideprec.c H5Iint.c H5Itest.c \ H5L.c H5Ldeprec.c H5Lexternal.c H5Lint.c \ H5M.c \ H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \ diff --git a/test/tid.c b/test/tid.c index c4ec0d8ea40..f287f4e00d2 100644 --- a/test/tid.c +++ b/test/tid.c @@ -79,9 +79,9 @@ basic_id_test(void) goto out; /* Register a type */ - myType = H5Iregister_type((size_t)64, 0, free_wrapper); + myType = H5Iregister_type2(0, free_wrapper); - CHECK(myType, H5I_BADID, "H5Iregister_type"); + CHECK(myType, H5I_BADID, "H5Iregister_type2"); if (myType == H5I_BADID) goto out; @@ -173,9 +173,9 @@ basic_id_test(void) H5E_END_TRY /* Register another type and another object in that type */ - myType = H5Iregister_type((size_t)64, 0, free_wrapper); + myType = H5Iregister_type2(0, free_wrapper); - CHECK(myType, H5I_BADID, "H5Iregister_type"); + CHECK(myType, H5I_BADID, "H5Iregister_type2"); if (myType == H5I_BADID) goto out; @@ -246,6 +246,225 @@ basic_id_test(void) return -1; } +#ifndef H5_NO_DEPRECATED_SYMBOLS +/* Test that H5Iregister_type1() works correctly (just a copy of the basic test) */ +static int +H5Iregister_type1_test(void) +{ + H5I_type_t myType = H5I_BADID; + hid_t arrayID = H5I_INVALID_HID; + void *testObj = NULL; + void *testPtr = NULL; + char nameString[10]; + hid_t testID; + ssize_t testSize = -1; + herr_t err; + int num_ref; + hsize_t num_members; + + /* Try to register an ID with fictitious types */ + H5E_BEGIN_TRY + arrayID = H5Iregister((H5I_type_t)420, testObj); + H5E_END_TRY + + VERIFY(arrayID, H5I_INVALID_HID, "H5Iregister"); + if (arrayID != H5I_INVALID_HID) + goto out; + + H5E_BEGIN_TRY + arrayID = H5Iregister((H5I_type_t)-1, testObj); + H5E_END_TRY + + VERIFY(arrayID, H5I_INVALID_HID, "H5Iregister"); + if (arrayID != H5I_INVALID_HID) + goto out; + + /* Try to access IDs with fictitious types */ + H5E_BEGIN_TRY + testPtr = H5Iobject_verify((hid_t)100, (H5I_type_t)0); + H5E_END_TRY + + CHECK_PTR_NULL(testPtr, "H5Iobject_verify"); + if (testPtr != NULL) + goto out; + + H5E_BEGIN_TRY + testPtr = H5Iobject_verify((hid_t)700, (H5I_type_t)700); + H5E_END_TRY + + CHECK_PTR_NULL(testPtr, "H5Iobject_verify"); + if (testPtr != NULL) + goto out; + + /* Register a type */ + myType = H5Iregister_type1(64, 0, free_wrapper); + + CHECK(myType, H5I_BADID, "H5Iregister_type1"); + if (myType == H5I_BADID) + goto out; + + /* Register an ID and retrieve the object it points to. + * Once the ID has been registered, testObj will be freed when + * its ID type is destroyed. + */ + testObj = malloc(7 * sizeof(int)); + arrayID = H5Iregister(myType, testObj); + + CHECK(arrayID, H5I_INVALID_HID, "H5Iregister"); + if (arrayID == H5I_INVALID_HID) { + free(testObj); + goto out; + } + + testPtr = (int *)H5Iobject_verify(arrayID, myType); + + CHECK_PTR_EQ(testPtr, testObj, "H5Iobject_verify"); + if (testPtr != testObj) + goto out; + + /* Ensure that H5Iget_file_id and H5Iget_name() fail, since this + * is an hid_t for the wrong kind of object + */ + H5E_BEGIN_TRY + testID = H5Iget_file_id(arrayID); + H5E_END_TRY + + VERIFY(testID, H5I_INVALID_HID, "H5Iget_file_id"); + if (testID != H5I_INVALID_HID) + goto out; + + H5E_BEGIN_TRY + testSize = H5Iget_name(arrayID, nameString, (size_t)9); + H5E_END_TRY + + VERIFY(testSize, -1, "H5Iget_name"); + if (testSize != -1) + goto out; + + /* Make sure H5Iremove_verify catches objects of the wrong type */ + H5E_BEGIN_TRY + testPtr = (int *)H5Iremove_verify(arrayID, (H5I_type_t)0); + H5E_END_TRY + + CHECK_PTR_NULL(testPtr, "H5Iremove_verify"); + if (testPtr != NULL) + goto out; + + H5E_BEGIN_TRY + testPtr = (int *)H5Iremove_verify(arrayID, (H5I_type_t)((int)myType - 1)); + H5E_END_TRY + + CHECK_PTR_NULL(testPtr, "H5Iremove_verify"); + if (testPtr != NULL) + goto out; + + /* Remove an ID and make sure we can't access it */ + testPtr = (int *)H5Iremove_verify(arrayID, myType); + + CHECK_PTR(testPtr, "H5Iremove_verify"); + if (testPtr == NULL) + goto out; + + H5E_BEGIN_TRY + testPtr = (int *)H5Iobject_verify(arrayID, myType); + H5E_END_TRY + + CHECK_PTR_NULL(testPtr, "H5Iobject_verify"); + if (testPtr != NULL) + goto out; + + /* Delete the type and make sure we can't access objects within it */ + arrayID = H5Iregister(myType, testObj); + + err = H5Idestroy_type(myType); + VERIFY(err, 0, "H5Idestroy_type"); + if (err != 0) + goto out; + VERIFY(H5Itype_exists(myType), 0, "H5Itype_exists"); + if (H5Itype_exists(myType) != 0) + goto out; + + H5E_BEGIN_TRY + VERIFY(H5Inmembers(myType, NULL), -1, "H5Inmembers"); + if (H5Inmembers(myType, NULL) != -1) + goto out; + H5E_END_TRY + + /* Register another type and another object in that type */ + myType = H5Iregister_type1(64, 0, free_wrapper); + + CHECK(myType, H5I_BADID, "H5Iregister_type1"); + if (myType == H5I_BADID) + goto out; + + /* The memory that testObj pointed to should already have been + * freed when the previous type was destroyed. Allocate new + * memory for it. + */ + testObj = malloc(7 * sizeof(int)); + arrayID = H5Iregister(myType, testObj); + + CHECK(arrayID, H5I_INVALID_HID, "H5Iregister"); + if (arrayID == H5I_INVALID_HID) { + free(testObj); + goto out; + } + + err = H5Inmembers(myType, &num_members); + CHECK(err, -1, "H5Inmembers"); + if (err < 0) + goto out; + VERIFY(num_members, 1, "H5Inmembers"); + if (num_members != 1) + goto out; + + /* Increment references to type and ensure that dec_type_ref + * doesn't destroy the type + */ + num_ref = H5Iinc_type_ref(myType); + VERIFY(num_ref, 2, "H5Iinc_type_ref"); + if (num_ref != 2) + goto out; + num_ref = H5Idec_type_ref(myType); + VERIFY(num_ref, 1, "H5Idec_type_ref"); + if (num_ref != 1) + goto out; + err = H5Inmembers(myType, &num_members); + CHECK(err, -1, "H5Inmembers"); + if (err < 0) + goto out; + VERIFY(num_members, 1, "H5Inmembers"); + if (num_members != 1) + goto out; + + /* This call to dec_type_ref should destroy the type */ + num_ref = H5Idec_type_ref(myType); + VERIFY(num_ref, 0, "H5Idec_type_ref"); + if (num_ref != 0) + goto out; + VERIFY(H5Itype_exists(myType), 0, "H5Itype_exists"); + if (H5Itype_exists(myType) != 0) + goto out; + + H5E_BEGIN_TRY + err = H5Inmembers(myType, &num_members); + if (err >= 0) + goto out; + H5E_END_TRY + + return 0; + +out: + /* Clean up type if it has been allocated and free memory used + * by testObj + */ + if (myType >= 0) + H5Idestroy_type(myType); + + return -1; +} +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + /* A dummy search function for the next test */ static int test_search_func(void H5_ATTR_UNUSED *ptr1, hid_t H5_ATTR_UNUSED id, void H5_ATTR_UNUSED *ptr2) @@ -508,47 +727,47 @@ test_id_type_list(void) H5I_type_t testType; int i; /* Just a counter variable */ - startType = H5Iregister_type((size_t)8, 0, free_wrapper); - CHECK(startType, H5I_BADID, "H5Iregister_type"); + startType = H5Iregister_type2(0, free_wrapper); + CHECK(startType, H5I_BADID, "H5Iregister_type2"); if (startType == H5I_BADID) goto out; /* Sanity check */ if ((int)startType >= H5I_MAX_NUM_TYPES || startType < H5I_NTYPES) { /* Error condition, throw an error */ - ERROR("H5Iregister_type"); + ERROR("H5Iregister_type2"); goto out; } /* Create types up to H5I_MAX_NUM_TYPES */ for (i = startType + 1; i < H5I_MAX_NUM_TYPES; i++) { - currentType = H5Iregister_type((size_t)8, 0, free_wrapper); - CHECK(currentType, H5I_BADID, "H5Iregister_type"); + currentType = H5Iregister_type2(0, free_wrapper); + CHECK(currentType, H5I_BADID, "H5Iregister_type2"); if (currentType == H5I_BADID) goto out; } /* Wrap around to low type ID numbers */ for (i = H5I_NTYPES; i < startType; i++) { - currentType = H5Iregister_type((size_t)8, 0, free_wrapper); - CHECK(currentType, H5I_BADID, "H5Iregister_type"); + currentType = H5Iregister_type2(0, free_wrapper); + CHECK(currentType, H5I_BADID, "H5Iregister_type2"); if (currentType == H5I_BADID) goto out; } /* There should be no room at the inn for a new ID type*/ H5E_BEGIN_TRY - testType = H5Iregister_type((size_t)8, 0, free_wrapper); + testType = H5Iregister_type2(0, free_wrapper); H5E_END_TRY - VERIFY(testType, H5I_BADID, "H5Iregister_type"); + VERIFY(testType, H5I_BADID, "H5Iregister_type2"); if (testType != H5I_BADID) goto out; /* Now delete a type and try to insert again */ H5Idestroy_type(H5I_NTYPES); - testType = H5Iregister_type((size_t)8, 0, free_wrapper); + testType = H5Iregister_type2(0, free_wrapper); - VERIFY(testType, H5I_NTYPES, "H5Iregister_type"); + VERIFY(testType, H5I_NTYPES, "H5Iregister_type2"); if (testType != H5I_NTYPES) goto out; @@ -700,8 +919,8 @@ test_remove_clear_type(void) herr_t ret; /* return value */ /* Register a user-defined type with our custom ID-deleting callback */ - obj_type = H5Iregister_type((size_t)8, 0, rct_free_cb); - CHECK(obj_type, H5I_BADID, "H5Iregister_type"); + obj_type = H5Iregister_type2(0, rct_free_cb); + CHECK(obj_type, H5I_BADID, "H5Iregister_type2"); if (obj_type == H5I_BADID) goto error; @@ -994,8 +1213,8 @@ test_future_ids(void) herr_t ret; /* Return value */ /* Register a user-defined type with our custom ID-deleting callback */ - obj_type = H5Iregister_type((size_t)15, 0, free_actual_object); - CHECK(obj_type, H5I_BADID, "H5Iregister_type"); + obj_type = H5Iregister_type2(0, free_actual_object); + CHECK(obj_type, H5I_BADID, "H5Iregister_type2"); if (H5I_BADID == obj_type) goto error; @@ -1054,8 +1273,8 @@ test_future_ids(void) goto error; /* Re-register a user-defined type with our custom ID-deleting callback */ - obj_type = H5Iregister_type((size_t)15, 0, free_actual_object); - CHECK(obj_type, H5I_BADID, "H5Iregister_type"); + obj_type = H5Iregister_type2(0, free_actual_object); + CHECK(obj_type, H5I_BADID, "H5Iregister_type2"); if (H5I_BADID == obj_type) goto error; @@ -1094,8 +1313,8 @@ test_future_ids(void) goto error; /* Re-register a user-defined type with our custom ID-deleting callback */ - obj_type = H5Iregister_type((size_t)15, 0, free_actual_object); - CHECK(obj_type, H5I_BADID, "H5Iregister_type"); + obj_type = H5Iregister_type2(0, free_actual_object); + CHECK(obj_type, H5I_BADID, "H5Iregister_type2"); if (H5I_BADID == obj_type) goto error; @@ -1502,6 +1721,10 @@ test_ids(const void H5_ATTR_UNUSED *params) if (basic_id_test() < 0) TestErrPrintf("Basic ID test failed\n"); +#ifndef H5_NO_DEPRECATED_SYMBOLS + if (H5Iregister_type1_test() < 0) + TestErrPrintf("H5Iregister_type1() test failed\n"); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ if (id_predefined_test() < 0) TestErrPrintf("Predefined ID type test failed\n"); if (test_is_valid() < 0)