From a793f30e2c5885d92d31484dc3d7319374c4d58b Mon Sep 17 00:00:00 2001 From: Jordan Henderson Date: Mon, 5 Feb 2024 19:15:03 -0600 Subject: Add support for _Float16 16-bit floating point type --- config/cmake/ConfigureChecks.cmake | 10 + config/cmake/H5pubconf.h.in | 6 + configure.ac | 11 + doxygen/dox/LearnBasics2.dox | 5 + doxygen/examples/tables/predefinedDatatypes.dox | 12 + hl/src/H5LT.c | 13 +- hl/src/H5LTanalyze.c | 456 +++++++------- hl/src/H5LTanalyze.l | 3 + hl/src/H5LTparse.c | 789 ++++++++++++------------ hl/src/H5LTparse.h | 63 +- hl/src/H5LTparse.y | 8 +- java/src/hdf/hdf5lib/HDF5Constants.java | 12 + java/src/jni/h5Constants.c | 15 + java/src/jni/h5util.c | 8 +- src/H5T.c | 190 ++++++ src/H5Tconv.c | 377 ++++++++++- src/H5Tinit_float.c | 48 +- src/H5Tmodule.h | 15 +- src/H5Tnative.c | 28 +- src/H5Tpkg.h | 60 ++ src/H5Tpublic.h | 19 + src/H5private.h | 20 +- src/H5trace.c | 8 + test/API/H5_api_dataset_test.c | 10 +- test/API/H5_api_test_util.c | 14 +- test/dt_arith.c | 660 ++++++++++++++++++-- test/dtypes.c | 425 ++++++++++++- test/ntypes.c | 120 ++++ tools/lib/h5diff_array.c | 265 +++++++- tools/lib/h5diff_util.c | 10 +- tools/lib/h5tools_dump.c | 10 +- tools/lib/h5tools_str.c | 12 +- tools/lib/h5tools_type.c | 8 +- tools/src/h5import/h5import.c | 108 ++++ tools/src/h5ls/h5ls.c | 13 +- tools/test/h5dump/CMakeTests.cmake | 5 + tools/test/h5dump/expected/tfloat16.ddl | 46 ++ tools/test/h5dump/h5dumpgentest.c | 86 +++ tools/test/h5dump/testfiles/tfloat16.h5 | Bin 0 -> 2304 bytes tools/test/h5dump/testh5dump.sh.in | 5 + tools/test/h5ls/CMakeTests.cmake | 20 + tools/test/h5ls/expected/tfloat16.ls | 8 + tools/test/h5ls/expected/tfloat16_nosupport.ls | 8 + tools/test/h5ls/testh5ls.sh.in | 11 + 44 files changed, 3261 insertions(+), 759 deletions(-) create mode 100644 tools/test/h5dump/expected/tfloat16.ddl create mode 100644 tools/test/h5dump/testfiles/tfloat16.h5 create mode 100644 tools/test/h5ls/expected/tfloat16.ls create mode 100644 tools/test/h5ls/expected/tfloat16_nosupport.ls diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 37f306e..9ccb7a4 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -363,6 +363,16 @@ endif () HDF_CHECK_TYPE_SIZE (time_t ${HDF_PREFIX}_SIZEOF_TIME_T) #----------------------------------------------------------------------------- +# Check if _Float16 type is available +#----------------------------------------------------------------------------- +HDF_CHECK_TYPE_SIZE (_Float16 ${HDF_PREFIX}_SIZEOF__FLOAT16) +if (${HDF_PREFIX}_SIZEOF__FLOAT16) + set (${HDF_PREFIX}_HAVE__FLOAT16 1) +else () + set (${HDF_PREFIX}_HAVE__FLOAT16 0) +endif () + +#----------------------------------------------------------------------------- # Extra C99 types #----------------------------------------------------------------------------- diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index da53ade..b5dddba 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -140,6 +140,9 @@ /* Define if support for szip filter is enabled */ #cmakedefine H5_HAVE_FILTER_SZIP @H5_HAVE_FILTER_SZIP@ +/* Determine if _Float16 is available */ +#cmakedefine H5_HAVE__FLOAT16 @H5_HAVE__FLOAT16@ + /* Determine if __float128 is available */ #cmakedefine H5_HAVE_FLOAT128 @H5_HAVE_FLOAT128@ @@ -592,6 +595,9 @@ /* The size of `_Quad', as computed by sizeof. */ #define H5_SIZEOF__QUAD @H5_SIZEOF__QUAD@ +/* The size of `_Float16', as computed by sizeof. */ +#define H5_SIZEOF__FLOAT16 @H5_SIZEOF__FLOAT16@ + /* The size of `__float128', as computed by sizeof. */ #define H5_SIZEOF___FLOAT128 @H5_SIZEOF___FLOAT128@ diff --git a/configure.ac b/configure.ac index f945df5..1d26fb5 100644 --- a/configure.ac +++ b/configure.ac @@ -545,6 +545,17 @@ AC_CHECK_SIZEOF([long long]) AC_CHECK_SIZEOF([float]) AC_CHECK_SIZEOF([double]) AC_CHECK_SIZEOF([long double]) +AC_CHECK_SIZEOF([_Float16]) + +# Define HAVE__FLOAT16 macro for H5pubconf.h if _Float16 is available. +# Also define HAVE__FLOAT16 value to substitute into other files for +# conditional testing +HAVE__FLOAT16="no" +if test "$ac_cv_sizeof__Float16" != 0; then + HAVE__FLOAT16="yes" + AC_DEFINE([HAVE__FLOAT16], [1], [Determine if _Float16 is available]) +fi +AC_SUBST([HAVE__FLOAT16]) ## ---------------------------------------------------------------------- ## Check if the Fortran interface should be enabled diff --git a/doxygen/dox/LearnBasics2.dox b/doxygen/dox/LearnBasics2.dox index f436a02..ed2810c 100644 --- a/doxygen/dox/LearnBasics2.dox +++ b/doxygen/dox/LearnBasics2.dox @@ -626,6 +626,11 @@ into a long integer buffer.) Float +_Float16 +#H5T_NATIVE_FLOAT16 +#H5T_IEEE_F16BE or #H5T_IEEE_F16LE + + float #H5T_NATIVE_FLOAT #H5T_IEEE_F32BE or #H5T_IEEE_F32LE diff --git a/doxygen/examples/tables/predefinedDatatypes.dox b/doxygen/examples/tables/predefinedDatatypes.dox index 2427d0c..6cf044a 100644 --- a/doxygen/examples/tables/predefinedDatatypes.dox +++ b/doxygen/examples/tables/predefinedDatatypes.dox @@ -8,6 +8,14 @@ Description +#H5T_IEEE_F16BE +16-bit big-endian IEEE floating point + + +#H5T_IEEE_F16LE +16-bit little-endian IEEE floating point + + #H5T_IEEE_F32BE 32-bit big-endian IEEE floating point @@ -465,6 +473,10 @@ C-style unsigned long long +#H5T_NATIVE_FLOAT16 +C-style _Float16 (May be H5I_INVALID_HID if platform doesn't support _Float16 type) + + #H5T_NATIVE_FLOAT C-style float diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 099356f..7d44792 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -2287,7 +2287,13 @@ H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *slen, bo break; case H5T_FLOAT: - if (H5Tequal(dtype, H5T_IEEE_F32BE)) { + if (H5Tequal(dtype, H5T_IEEE_F16BE)) { + snprintf(dt_str, *slen, "H5T_IEEE_F16BE"); + } + else if (H5Tequal(dtype, H5T_IEEE_F16LE)) { + snprintf(dt_str, *slen, "H5T_IEEE_F16LE"); + } + else if (H5Tequal(dtype, H5T_IEEE_F32BE)) { snprintf(dt_str, *slen, "H5T_IEEE_F32BE"); } else if (H5Tequal(dtype, H5T_IEEE_F32LE)) { @@ -2299,6 +2305,11 @@ H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *slen, bo else if (H5Tequal(dtype, H5T_IEEE_F64LE)) { snprintf(dt_str, *slen, "H5T_IEEE_F64LE"); } +#ifdef H5_HAVE__FLOAT16 + else if (H5Tequal(dtype, H5T_NATIVE_FLOAT16)) { + snprintf(dt_str, *slen, "H5T_NATIVE_FLOAT16"); + } +#endif else if (H5Tequal(dtype, H5T_NATIVE_FLOAT)) { snprintf(dt_str, *slen, "H5T_NATIVE_FLOAT"); } diff --git a/hl/src/H5LTanalyze.c b/hl/src/H5LTanalyze.c index 8890b8e..3e6b20d 100644 --- a/hl/src/H5LTanalyze.c +++ b/hl/src/H5LTanalyze.c @@ -29,14 +29,14 @@ #elif defined _MSC_VER #pragma warning(push, 1) #endif -#line 2 "hl/src//H5LTanalyze.c" +#line 1 "hl/src//H5LTanalyze.c" /* Quiet warnings about integer type macro redefinitions on Visual Studio * (MSVC doesn't define STDC_VERSION, but has inttypes.h). This is an * issue that is apparently fixed in flex 2.6.5. */ #include -#line 9 "hl/src//H5LTanalyze.c" +#line 8 "hl/src//H5LTanalyze.c" #define YY_INT_ALIGNED short int @@ -647,8 +647,8 @@ static void yynoreturn yy_fatal_error ( const char* msg ); (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 64 -#define YY_END_OF_BUFFER 65 +#define YY_NUM_RULES 67 +#define YY_END_OF_BUFFER 68 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -656,38 +656,39 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static const flex_int16_t yy_accept[275] = +static const flex_int16_t yy_accept[283] = { 0, - 63, 63, 65, 64, 63, 64, 55, 61, 62, 64, - 64, 64, 64, 59, 60, 57, 58, 63, 0, 55, - 0, 0, 0, 0, 0, 56, 0, 0, 0, 0, - 0, 38, 0, 0, 0, 0, 0, 39, 0, 0, + 66, 66, 68, 67, 66, 67, 58, 64, 65, 67, + 67, 67, 67, 62, 63, 60, 61, 66, 0, 58, + 0, 0, 0, 0, 0, 59, 0, 0, 0, 0, + 0, 41, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 37, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 54, 36, 0, 0, 0, 45, 49, 0, 0, - 0, 0, 0, 0, 0, 0, 51, 53, 50, 0, + 0, 57, 39, 0, 0, 0, 48, 52, 0, 0, + 0, 0, 0, 0, 0, 0, 54, 56, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 52, 0, 0, - 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 55, 0, 0, + 0, 0, 0, 0, 0, 0, 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 2, 0, 0, 0, 0, 0, 0, 9, 10, 0, - 0, 47, 0, 44, 0, 0, 0, 0, 0, 0, + 0, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 3, 4, 5, 6, 7, 8, 11, 12, - 13, 14, 15, 16, 0, 0, 0, 43, 46, 28, - 29, 30, 31, 0, 0, 0, 22, 0, 0, 0, + 0, 1, 2, 0, 0, 0, 0, 0, 0, 9, + 10, 0, 0, 50, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 17, 0, 0, 0, 0, 24, 0, 0, 0, 23, - 0, 0, 0, 41, 0, 0, 0, 32, 0, 26, - 18, 20, 19, 0, 25, 0, 40, 42, 33, 0, - 27, 21, 34, 0 + + 0, 0, 0, 0, 0, 0, 3, 4, 5, 6, + 7, 8, 11, 12, 13, 14, 15, 16, 0, 0, + 0, 46, 49, 28, 29, 30, 31, 32, 33, 0, + 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, + 0, 24, 0, 0, 0, 23, 0, 0, 0, 44, + 0, 0, 0, 35, 0, 26, 18, 20, 19, 0, + 25, 0, 43, 45, 36, 0, 0, 27, 21, 34, + 37, 0 } ; static const YY_CHAR yy_ec[256] = @@ -730,75 +731,77 @@ static const YY_CHAR yy_meta[41] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; -static const flex_int16_t yy_base[277] = +static const flex_int16_t yy_base[285] = { 0, - 0, 0, 299, 300, 296, 0, 0, 300, 300, 11, - 288, 269, 264, 300, 300, 300, 300, 292, 290, 0, - 274, 257, 259, 261, 259, 300, 256, 259, 247, 246, - 16, 300, 265, 33, 14, 268, 259, 300, 251, 24, - 254, 252, 259, 262, 248, 243, 34, 251, 258, 254, - 235, 240, 244, 249, 236, 233, 235, 245, 231, 247, - 36, 231, 241, 223, 237, 300, 238, 241, 227, 222, - 247, 227, 219, 231, 226, 219, 208, 34, 223, 219, - 225, 300, 300, 208, 215, 202, 300, 300, 210, 200, - 204, 204, 38, 210, 39, 220, 300, 300, 300, 201, - - 47, 218, 212, 212, 211, 66, 73, 208, 195, 199, - 210, 199, 193, 191, 196, 75, 182, 300, 209, 212, - 209, 52, 206, 209, 206, 66, 300, 190, 198, 188, - 193, 193, 189, 169, 200, 197, 74, 71, 72, 77, - 186, 185, 84, 86, 87, 184, 183, 177, 183, 180, - 300, 175, 185, 165, 88, 90, 173, 167, 169, 166, - 91, 99, 96, 172, 171, 170, 169, 168, 167, 300, - 300, 166, 165, 164, 163, 162, 161, 300, 300, 94, - 160, 300, 155, 300, 171, 157, 156, 155, 154, 157, - 138, 143, 137, 141, 140, 140, 143, 137, 141, 136, - - 101, 139, 300, 300, 300, 300, 300, 300, 300, 300, - 300, 300, 300, 300, 145, 140, 130, 300, 300, 300, - 300, 300, 300, 127, 140, 140, 300, 121, 127, 131, - 136, 120, 134, 116, 120, 120, 118, 126, 113, 127, - 300, 117, 108, 123, 117, 300, 107, 104, 105, 300, - 108, 112, 102, 300, 105, 106, 104, 300, 93, 300, - 300, 300, 300, 78, 300, 57, 300, 300, 300, 56, - 300, 300, 300, 300, 127, 65 + 0, 0, 307, 308, 304, 0, 0, 308, 308, 11, + 296, 277, 272, 308, 308, 308, 308, 300, 298, 0, + 282, 265, 267, 269, 267, 308, 264, 267, 255, 254, + 16, 308, 273, 33, 14, 276, 267, 308, 259, 24, + 262, 260, 267, 270, 256, 251, 34, 259, 266, 262, + 243, 248, 252, 257, 244, 241, 243, 253, 239, 255, + 36, 239, 249, 231, 245, 308, 246, 249, 235, 230, + 255, 235, 227, 239, 234, 227, 216, 34, 231, 227, + 233, 308, 308, 216, 223, 210, 308, 308, 218, 208, + 212, 212, 38, 218, 39, 228, 308, 308, 308, 209, + + 47, 226, 220, 220, 219, 66, 73, 216, 203, 207, + 218, 207, 201, 199, 204, 80, 190, 308, 217, 220, + 217, 52, 214, 217, 214, 59, 308, 198, 206, 196, + 201, 201, 197, 177, 204, 207, 204, 75, 66, 73, + 78, 193, 192, 80, 85, 87, 191, 190, 184, 190, + 187, 308, 182, 192, 172, 89, 91, 94, 180, 174, + 176, 173, 96, 95, 102, 179, 178, 177, 176, 175, + 174, 308, 308, 173, 172, 171, 170, 169, 168, 308, + 308, 96, 167, 308, 162, 308, 178, 164, 163, 162, + 161, 160, 159, 162, 143, 148, 142, 146, 145, 145, + + 148, 142, 146, 141, 103, 144, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, 150, 145, + 135, 308, 308, 308, 308, 308, 308, 308, 308, 132, + 145, 145, 308, 126, 132, 136, 141, 125, 139, 121, + 125, 125, 123, 131, 118, 132, 308, 122, 113, 128, + 122, 308, 112, 109, 110, 308, 113, 117, 107, 308, + 110, 114, 112, 123, 98, 308, 308, 308, 308, 100, + 308, 84, 308, 308, 308, 89, 68, 308, 308, 308, + 308, 308, 132, 65 } ; -static const flex_int16_t yy_def[277] = +static const flex_int16_t yy_def[285] = { 0, - 274, 1, 274, 274, 274, 275, 276, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 275, 276, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 0, 274, 274 + 282, 1, 282, 282, 282, 283, 284, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 283, 284, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 0, 282, 282 } ; -static const flex_int16_t yy_nxt[341] = +static const flex_int16_t yy_nxt[349] = { 0, 4, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 9, 4, 4, 10, 4, 4, 4, 4, @@ -806,40 +809,41 @@ static const flex_int16_t yy_nxt[341] = 4, 4, 4, 4, 4, 14, 15, 4, 16, 17, 21, 22, 36, 48, 49, 37, 39, 62, 40, 53, 41, 42, 77, 54, 43, 94, 63, 44, 45, 106, - 113, 55, 46, 109, 78, 47, 141, 20, 110, 107, - 119, 95, 120, 273, 142, 121, 122, 123, 114, 124, - 146, 135, 125, 126, 136, 164, 166, 272, 147, 157, - 158, 168, 159, 165, 167, 160, 161, 271, 172, 169, - - 174, 176, 186, 162, 188, 163, 173, 194, 175, 177, - 187, 199, 189, 195, 197, 270, 196, 200, 201, 198, - 215, 269, 268, 235, 216, 202, 236, 19, 267, 19, - 266, 265, 264, 263, 262, 261, 260, 259, 258, 257, - 256, 255, 254, 253, 252, 251, 250, 249, 248, 247, - 246, 245, 244, 243, 242, 241, 240, 239, 238, 237, - 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, - 224, 223, 222, 221, 220, 219, 218, 217, 214, 213, - 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, - 193, 192, 191, 190, 185, 184, 183, 182, 181, 180, - - 179, 178, 171, 170, 156, 155, 154, 153, 152, 151, - 150, 149, 148, 145, 144, 143, 140, 139, 138, 137, - 134, 133, 132, 131, 130, 129, 128, 127, 118, 117, - 116, 115, 112, 111, 108, 105, 104, 103, 102, 101, - 100, 99, 98, 97, 96, 93, 92, 91, 90, 89, - 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, - 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, - 66, 65, 64, 61, 60, 59, 58, 57, 56, 52, - 51, 50, 38, 35, 34, 33, 32, 31, 30, 29, - 28, 27, 26, 18, 25, 24, 23, 18, 274, 3, - - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274 + 113, 55, 46, 109, 78, 47, 142, 20, 110, 107, + 119, 95, 120, 147, 143, 121, 122, 123, 114, 124, + 166, 148, 125, 126, 135, 281, 136, 168, 167, 137, + 159, 160, 170, 161, 174, 169, 162, 163, 280, 176, + + 171, 178, 175, 188, 164, 190, 165, 177, 192, 179, + 201, 189, 198, 191, 279, 202, 193, 203, 199, 278, + 277, 200, 219, 204, 205, 241, 220, 276, 242, 275, + 274, 206, 19, 273, 19, 272, 271, 270, 269, 268, + 267, 266, 265, 264, 263, 262, 261, 260, 259, 258, + 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, + 247, 246, 245, 244, 243, 240, 239, 238, 237, 236, + 235, 234, 233, 232, 231, 230, 229, 228, 227, 226, + 225, 224, 223, 222, 221, 218, 217, 216, 215, 214, + 213, 212, 211, 210, 209, 208, 207, 197, 196, 195, + + 194, 187, 186, 185, 184, 183, 182, 181, 180, 173, + 172, 158, 157, 156, 155, 154, 153, 152, 151, 150, + 149, 146, 145, 144, 141, 140, 139, 138, 134, 133, + 132, 131, 130, 129, 128, 127, 118, 117, 116, 115, + 112, 111, 108, 105, 104, 103, 102, 101, 100, 99, + 98, 97, 96, 93, 92, 91, 90, 89, 88, 87, + 86, 85, 84, 83, 82, 81, 80, 79, 76, 75, + 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, + 64, 61, 60, 59, 58, 57, 56, 52, 51, 50, + 38, 35, 34, 33, 32, 31, 30, 29, 28, 27, + + 26, 18, 25, 24, 23, 18, 282, 3, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282 } ; -static const flex_int16_t yy_chk[341] = +static const flex_int16_t yy_chk[349] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -847,37 +851,38 @@ static const flex_int16_t yy_chk[341] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 10, 31, 35, 35, 31, 34, 47, 34, 40, 34, 34, 61, 40, 34, 78, 47, 34, 34, 93, - 101, 40, 34, 95, 61, 34, 122, 276, 95, 93, - 106, 78, 106, 270, 122, 106, 106, 107, 101, 107, - 126, 116, 107, 107, 116, 138, 139, 266, 126, 137, - 137, 140, 137, 138, 139, 137, 137, 264, 143, 140, - - 144, 145, 155, 137, 156, 137, 143, 161, 144, 145, - 155, 163, 156, 161, 162, 259, 161, 163, 163, 162, - 180, 257, 256, 201, 180, 163, 201, 275, 255, 275, - 253, 252, 251, 249, 248, 247, 245, 244, 243, 242, - 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, - 230, 229, 228, 226, 225, 224, 217, 216, 215, 202, - 200, 199, 198, 197, 196, 195, 194, 193, 192, 191, - 190, 189, 188, 187, 186, 185, 183, 181, 177, 176, - 175, 174, 173, 172, 169, 168, 167, 166, 165, 164, - 160, 159, 158, 157, 154, 153, 152, 150, 149, 148, - - 147, 146, 142, 141, 136, 135, 134, 133, 132, 131, - 130, 129, 128, 125, 124, 123, 121, 120, 119, 117, - 115, 114, 113, 112, 111, 110, 109, 108, 105, 104, - 103, 102, 100, 96, 94, 92, 91, 90, 89, 86, - 85, 84, 81, 80, 79, 77, 76, 75, 74, 73, - 72, 71, 70, 69, 68, 67, 65, 64, 63, 62, - 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, - 50, 49, 48, 46, 45, 44, 43, 42, 41, 39, - 37, 36, 33, 30, 29, 28, 27, 25, 24, 23, - 22, 21, 19, 18, 13, 12, 11, 5, 3, 274, - - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274 + 101, 40, 34, 95, 61, 34, 122, 284, 95, 93, + 106, 78, 106, 126, 122, 106, 106, 107, 101, 107, + 139, 126, 107, 107, 116, 277, 116, 140, 139, 116, + 138, 138, 141, 138, 144, 140, 138, 138, 276, 145, + + 141, 146, 144, 156, 138, 157, 138, 145, 158, 146, + 164, 156, 163, 157, 272, 164, 158, 165, 163, 270, + 265, 163, 182, 165, 165, 205, 182, 264, 205, 263, + 262, 165, 283, 261, 283, 259, 258, 257, 255, 254, + 253, 251, 250, 249, 248, 246, 245, 244, 243, 242, + 241, 240, 239, 238, 237, 236, 235, 234, 232, 231, + 230, 221, 220, 219, 206, 204, 203, 202, 201, 200, + 199, 198, 197, 196, 195, 194, 193, 192, 191, 190, + 189, 188, 187, 185, 183, 179, 178, 177, 176, 175, + 174, 171, 170, 169, 168, 167, 166, 162, 161, 160, + + 159, 155, 154, 153, 151, 150, 149, 148, 147, 143, + 142, 137, 136, 135, 134, 133, 132, 131, 130, 129, + 128, 125, 124, 123, 121, 120, 119, 117, 115, 114, + 113, 112, 111, 110, 109, 108, 105, 104, 103, 102, + 100, 96, 94, 92, 91, 90, 89, 86, 85, 84, + 81, 80, 79, 77, 76, 75, 74, 73, 72, 71, + 70, 69, 68, 67, 65, 64, 63, 62, 60, 59, + 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, + 48, 46, 45, 44, 43, 42, 41, 39, 37, 36, + 33, 30, 29, 28, 27, 25, 24, 23, 22, 21, + + 19, 18, 13, 12, 11, 5, 3, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282 } ; static yy_state_type yy_last_accepting_state; @@ -936,8 +941,8 @@ static int my_yyinput(char *, int); extern char *myinput; extern size_t input_len; -#line 909 "hl/src//H5LTanalyze.c" -#line 910 "hl/src//H5LTanalyze.c" +#line 913 "hl/src//H5LTanalyze.c" +#line 914 "hl/src//H5LTanalyze.c" #define INITIAL 0 @@ -1149,7 +1154,7 @@ YY_DECL #line 53 "hl/src//H5LTanalyze.l" -#line 1122 "hl/src//H5LTanalyze.c" +#line 1126 "hl/src//H5LTanalyze.c" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { @@ -1176,13 +1181,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 275 ) + if ( yy_current_state >= 283 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 300 ); + while ( yy_base[yy_current_state] != 308 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -1344,197 +1349,212 @@ YY_RULE_SETUP case 28: YY_RULE_SETUP #line 85 "hl/src//H5LTanalyze.l" -{return hid(H5T_IEEE_F32BE_TOKEN);} +{return hid(H5T_IEEE_F16BE_TOKEN);} YY_BREAK case 29: YY_RULE_SETUP #line 86 "hl/src//H5LTanalyze.l" -{return hid(H5T_IEEE_F32LE_TOKEN);} +{return hid(H5T_IEEE_F16LE_TOKEN);} YY_BREAK case 30: YY_RULE_SETUP #line 87 "hl/src//H5LTanalyze.l" -{return hid(H5T_IEEE_F64BE_TOKEN);} +{return hid(H5T_IEEE_F32BE_TOKEN);} YY_BREAK case 31: YY_RULE_SETUP #line 88 "hl/src//H5LTanalyze.l" -{return hid(H5T_IEEE_F64LE_TOKEN);} +{return hid(H5T_IEEE_F32LE_TOKEN);} YY_BREAK case 32: YY_RULE_SETUP #line 89 "hl/src//H5LTanalyze.l" -{return hid(H5T_NATIVE_FLOAT_TOKEN);} +{return hid(H5T_IEEE_F64BE_TOKEN);} YY_BREAK case 33: YY_RULE_SETUP #line 90 "hl/src//H5LTanalyze.l" -{return hid(H5T_NATIVE_DOUBLE_TOKEN);} +{return hid(H5T_IEEE_F64LE_TOKEN);} YY_BREAK case 34: YY_RULE_SETUP #line 91 "hl/src//H5LTanalyze.l" -{return hid(H5T_NATIVE_LDOUBLE_TOKEN);} +{return hid(H5T_NATIVE_FLOAT16_TOKEN);} YY_BREAK case 35: YY_RULE_SETUP -#line 93 "hl/src//H5LTanalyze.l" -{return token(H5T_STRING_TOKEN);} +#line 92 "hl/src//H5LTanalyze.l" +{return hid(H5T_NATIVE_FLOAT_TOKEN);} YY_BREAK case 36: YY_RULE_SETUP -#line 94 "hl/src//H5LTanalyze.l" -{return token(STRSIZE_TOKEN);} +#line 93 "hl/src//H5LTanalyze.l" +{return hid(H5T_NATIVE_DOUBLE_TOKEN);} YY_BREAK case 37: YY_RULE_SETUP -#line 95 "hl/src//H5LTanalyze.l" -{return token(STRPAD_TOKEN);} +#line 94 "hl/src//H5LTanalyze.l" +{return hid(H5T_NATIVE_LDOUBLE_TOKEN);} YY_BREAK case 38: YY_RULE_SETUP #line 96 "hl/src//H5LTanalyze.l" -{return token(CSET_TOKEN);} +{return token(H5T_STRING_TOKEN);} YY_BREAK case 39: YY_RULE_SETUP #line 97 "hl/src//H5LTanalyze.l" -{return token(CTYPE_TOKEN);} +{return token(STRSIZE_TOKEN);} YY_BREAK case 40: YY_RULE_SETUP #line 98 "hl/src//H5LTanalyze.l" -{return token(H5T_STR_NULLTERM_TOKEN);} +{return token(STRPAD_TOKEN);} YY_BREAK case 41: YY_RULE_SETUP #line 99 "hl/src//H5LTanalyze.l" -{return token(H5T_STR_NULLPAD_TOKEN);} +{return token(CSET_TOKEN);} YY_BREAK case 42: YY_RULE_SETUP #line 100 "hl/src//H5LTanalyze.l" -{return token(H5T_STR_SPACEPAD_TOKEN);} +{return token(CTYPE_TOKEN);} YY_BREAK case 43: YY_RULE_SETUP #line 101 "hl/src//H5LTanalyze.l" -{return token(H5T_CSET_ASCII_TOKEN);} +{return token(H5T_STR_NULLTERM_TOKEN);} YY_BREAK case 44: YY_RULE_SETUP #line 102 "hl/src//H5LTanalyze.l" -{return token(H5T_CSET_UTF8_TOKEN);} +{return token(H5T_STR_NULLPAD_TOKEN);} YY_BREAK case 45: YY_RULE_SETUP #line 103 "hl/src//H5LTanalyze.l" -{return token(H5T_C_S1_TOKEN);} +{return token(H5T_STR_SPACEPAD_TOKEN);} YY_BREAK case 46: YY_RULE_SETUP #line 104 "hl/src//H5LTanalyze.l" -{return token(H5T_FORTRAN_S1_TOKEN);} +{return token(H5T_CSET_ASCII_TOKEN);} YY_BREAK case 47: YY_RULE_SETUP #line 105 "hl/src//H5LTanalyze.l" -{return token(H5T_VARIABLE_TOKEN);} +{return token(H5T_CSET_UTF8_TOKEN);} YY_BREAK case 48: YY_RULE_SETUP -#line 107 "hl/src//H5LTanalyze.l" -{return token(H5T_COMPOUND_TOKEN);} +#line 106 "hl/src//H5LTanalyze.l" +{return token(H5T_C_S1_TOKEN);} YY_BREAK case 49: YY_RULE_SETUP -#line 108 "hl/src//H5LTanalyze.l" -{return token(H5T_ENUM_TOKEN);} +#line 107 "hl/src//H5LTanalyze.l" +{return token(H5T_FORTRAN_S1_TOKEN);} YY_BREAK case 50: YY_RULE_SETUP -#line 109 "hl/src//H5LTanalyze.l" -{return token(H5T_ARRAY_TOKEN);} +#line 108 "hl/src//H5LTanalyze.l" +{return token(H5T_VARIABLE_TOKEN);} YY_BREAK case 51: YY_RULE_SETUP #line 110 "hl/src//H5LTanalyze.l" -{return token(H5T_VLEN_TOKEN);} +{return token(H5T_COMPOUND_TOKEN);} YY_BREAK case 52: YY_RULE_SETUP -#line 112 "hl/src//H5LTanalyze.l" -{return token(H5T_OPAQUE_TOKEN);} +#line 111 "hl/src//H5LTanalyze.l" +{return token(H5T_ENUM_TOKEN);} YY_BREAK case 53: YY_RULE_SETUP -#line 113 "hl/src//H5LTanalyze.l" -{return token(OPQ_SIZE_TOKEN);} +#line 112 "hl/src//H5LTanalyze.l" +{return token(H5T_ARRAY_TOKEN);} YY_BREAK case 54: YY_RULE_SETUP -#line 114 "hl/src//H5LTanalyze.l" -{return token(OPQ_TAG_TOKEN);} +#line 113 "hl/src//H5LTanalyze.l" +{return token(H5T_VLEN_TOKEN);} YY_BREAK case 55: YY_RULE_SETUP +#line 115 "hl/src//H5LTanalyze.l" +{return token(H5T_OPAQUE_TOKEN);} + YY_BREAK +case 56: +YY_RULE_SETUP #line 116 "hl/src//H5LTanalyze.l" +{return token(OPQ_SIZE_TOKEN);} + YY_BREAK +case 57: +YY_RULE_SETUP +#line 117 "hl/src//H5LTanalyze.l" +{return token(OPQ_TAG_TOKEN);} + YY_BREAK +case 58: +YY_RULE_SETUP +#line 119 "hl/src//H5LTanalyze.l" { H5LTyylval.ival = atoi(yytext); return NUMBER; } YY_BREAK -case 56: -/* rule 56 can match eol */ +case 59: +/* rule 59 can match eol */ YY_RULE_SETUP -#line 121 "hl/src//H5LTanalyze.l" +#line 124 "hl/src//H5LTanalyze.l" { H5LTyylval.sval = trim_quotes(yytext); return STRING; } YY_BREAK -case 57: +case 60: YY_RULE_SETUP -#line 126 "hl/src//H5LTanalyze.l" +#line 129 "hl/src//H5LTanalyze.l" {return token('{');} YY_BREAK -case 58: +case 61: YY_RULE_SETUP -#line 127 "hl/src//H5LTanalyze.l" +#line 130 "hl/src//H5LTanalyze.l" {return token('}');} YY_BREAK -case 59: +case 62: YY_RULE_SETUP -#line 128 "hl/src//H5LTanalyze.l" +#line 131 "hl/src//H5LTanalyze.l" {return token('[');} YY_BREAK -case 60: +case 63: YY_RULE_SETUP -#line 129 "hl/src//H5LTanalyze.l" +#line 132 "hl/src//H5LTanalyze.l" {return token(']');} YY_BREAK -case 61: +case 64: YY_RULE_SETUP -#line 130 "hl/src//H5LTanalyze.l" +#line 133 "hl/src//H5LTanalyze.l" {return token(':');} YY_BREAK -case 62: +case 65: YY_RULE_SETUP -#line 131 "hl/src//H5LTanalyze.l" +#line 134 "hl/src//H5LTanalyze.l" {return token(';');} YY_BREAK -case 63: -/* rule 63 can match eol */ +case 66: +/* rule 66 can match eol */ YY_RULE_SETUP -#line 132 "hl/src//H5LTanalyze.l" +#line 135 "hl/src//H5LTanalyze.l" ; YY_BREAK -case 64: +case 67: YY_RULE_SETUP -#line 134 "hl/src//H5LTanalyze.l" +#line 137 "hl/src//H5LTanalyze.l" ECHO; YY_BREAK -#line 1507 "hl/src//H5LTanalyze.c" +#line 1526 "hl/src//H5LTanalyze.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1831,7 +1851,7 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 275 ) + if ( yy_current_state >= 283 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; @@ -1859,11 +1879,11 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 275 ) + if ( yy_current_state >= 283 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 274); + yy_is_jam = (yy_current_state == 282); return yy_is_jam ? 0 : yy_current_state; } @@ -2539,7 +2559,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 134 "hl/src//H5LTanalyze.l" +#line 137 "hl/src//H5LTanalyze.l" /* Allocate a copy of `quoted` with the double quote character at diff --git a/hl/src/H5LTanalyze.l b/hl/src/H5LTanalyze.l index 58a6636..a573f81 100644 --- a/hl/src/H5LTanalyze.l +++ b/hl/src/H5LTanalyze.l @@ -82,10 +82,13 @@ H5T_NATIVE_ULONG {return hid(H5T_NATIVE_ULONG_TOKEN);} H5T_NATIVE_LLONG {return hid(H5T_NATIVE_LLONG_TOKEN);} H5T_NATIVE_ULLONG {return hid(H5T_NATIVE_ULLONG_TOKEN);} +H5T_IEEE_F16BE {return hid(H5T_IEEE_F16BE_TOKEN);} +H5T_IEEE_F16LE {return hid(H5T_IEEE_F16LE_TOKEN);} H5T_IEEE_F32BE {return hid(H5T_IEEE_F32BE_TOKEN);} H5T_IEEE_F32LE {return hid(H5T_IEEE_F32LE_TOKEN);} H5T_IEEE_F64BE {return hid(H5T_IEEE_F64BE_TOKEN);} H5T_IEEE_F64LE {return hid(H5T_IEEE_F64LE_TOKEN);} +H5T_NATIVE_FLOAT16 {return hid(H5T_NATIVE_FLOAT16_TOKEN);} H5T_NATIVE_FLOAT {return hid(H5T_NATIVE_FLOAT_TOKEN);} H5T_NATIVE_DOUBLE {return hid(H5T_NATIVE_DOUBLE_TOKEN);} H5T_NATIVE_LDOUBLE {return hid(H5T_NATIVE_LDOUBLE_TOKEN);} diff --git a/hl/src/H5LTparse.c b/hl/src/H5LTparse.c index 592b863..bb71376 100644 --- a/hl/src/H5LTparse.c +++ b/hl/src/H5LTparse.c @@ -213,84 +213,87 @@ enum yysymbol_kind_t YYSYMBOL_H5T_NATIVE_ULONG_TOKEN = 27, /* H5T_NATIVE_ULONG_TOKEN */ YYSYMBOL_H5T_NATIVE_LLONG_TOKEN = 28, /* H5T_NATIVE_LLONG_TOKEN */ YYSYMBOL_H5T_NATIVE_ULLONG_TOKEN = 29, /* H5T_NATIVE_ULLONG_TOKEN */ - YYSYMBOL_H5T_IEEE_F32BE_TOKEN = 30, /* H5T_IEEE_F32BE_TOKEN */ - YYSYMBOL_H5T_IEEE_F32LE_TOKEN = 31, /* H5T_IEEE_F32LE_TOKEN */ - YYSYMBOL_H5T_IEEE_F64BE_TOKEN = 32, /* H5T_IEEE_F64BE_TOKEN */ - YYSYMBOL_H5T_IEEE_F64LE_TOKEN = 33, /* H5T_IEEE_F64LE_TOKEN */ - YYSYMBOL_H5T_NATIVE_FLOAT_TOKEN = 34, /* H5T_NATIVE_FLOAT_TOKEN */ - YYSYMBOL_H5T_NATIVE_DOUBLE_TOKEN = 35, /* H5T_NATIVE_DOUBLE_TOKEN */ - YYSYMBOL_H5T_NATIVE_LDOUBLE_TOKEN = 36, /* H5T_NATIVE_LDOUBLE_TOKEN */ - YYSYMBOL_H5T_STRING_TOKEN = 37, /* H5T_STRING_TOKEN */ - YYSYMBOL_STRSIZE_TOKEN = 38, /* STRSIZE_TOKEN */ - YYSYMBOL_STRPAD_TOKEN = 39, /* STRPAD_TOKEN */ - YYSYMBOL_CSET_TOKEN = 40, /* CSET_TOKEN */ - YYSYMBOL_CTYPE_TOKEN = 41, /* CTYPE_TOKEN */ - YYSYMBOL_H5T_VARIABLE_TOKEN = 42, /* H5T_VARIABLE_TOKEN */ - YYSYMBOL_H5T_STR_NULLTERM_TOKEN = 43, /* H5T_STR_NULLTERM_TOKEN */ - YYSYMBOL_H5T_STR_NULLPAD_TOKEN = 44, /* H5T_STR_NULLPAD_TOKEN */ - YYSYMBOL_H5T_STR_SPACEPAD_TOKEN = 45, /* H5T_STR_SPACEPAD_TOKEN */ - YYSYMBOL_H5T_CSET_ASCII_TOKEN = 46, /* H5T_CSET_ASCII_TOKEN */ - YYSYMBOL_H5T_CSET_UTF8_TOKEN = 47, /* H5T_CSET_UTF8_TOKEN */ - YYSYMBOL_H5T_C_S1_TOKEN = 48, /* H5T_C_S1_TOKEN */ - YYSYMBOL_H5T_FORTRAN_S1_TOKEN = 49, /* H5T_FORTRAN_S1_TOKEN */ - YYSYMBOL_H5T_OPAQUE_TOKEN = 50, /* H5T_OPAQUE_TOKEN */ - YYSYMBOL_OPQ_SIZE_TOKEN = 51, /* OPQ_SIZE_TOKEN */ - YYSYMBOL_OPQ_TAG_TOKEN = 52, /* OPQ_TAG_TOKEN */ - YYSYMBOL_H5T_COMPOUND_TOKEN = 53, /* H5T_COMPOUND_TOKEN */ - YYSYMBOL_H5T_ENUM_TOKEN = 54, /* H5T_ENUM_TOKEN */ - YYSYMBOL_H5T_ARRAY_TOKEN = 55, /* H5T_ARRAY_TOKEN */ - YYSYMBOL_H5T_VLEN_TOKEN = 56, /* H5T_VLEN_TOKEN */ - YYSYMBOL_STRING = 57, /* STRING */ - YYSYMBOL_NUMBER = 58, /* NUMBER */ - YYSYMBOL_59_ = 59, /* '{' */ - YYSYMBOL_60_ = 60, /* '}' */ - YYSYMBOL_61_ = 61, /* '[' */ - YYSYMBOL_62_ = 62, /* ']' */ - YYSYMBOL_63_ = 63, /* ':' */ - YYSYMBOL_64_ = 64, /* ';' */ - YYSYMBOL_YYACCEPT = 65, /* $accept */ - YYSYMBOL_start = 66, /* start */ - YYSYMBOL_ddl_type = 67, /* ddl_type */ - YYSYMBOL_atomic_type = 68, /* atomic_type */ - YYSYMBOL_integer_type = 69, /* integer_type */ - YYSYMBOL_fp_type = 70, /* fp_type */ - YYSYMBOL_compound_type = 71, /* compound_type */ - YYSYMBOL_72_1 = 72, /* $@1 */ - YYSYMBOL_memb_list = 73, /* memb_list */ - YYSYMBOL_memb_def = 74, /* memb_def */ - YYSYMBOL_75_2 = 75, /* $@2 */ - YYSYMBOL_field_name = 76, /* field_name */ - YYSYMBOL_field_offset = 77, /* field_offset */ - YYSYMBOL_offset = 78, /* offset */ - YYSYMBOL_array_type = 79, /* array_type */ - YYSYMBOL_80_3 = 80, /* $@3 */ - YYSYMBOL_dim_list = 81, /* dim_list */ - YYSYMBOL_dim = 82, /* dim */ - YYSYMBOL_83_4 = 83, /* $@4 */ - YYSYMBOL_84_5 = 84, /* $@5 */ - YYSYMBOL_dimsize = 85, /* dimsize */ - YYSYMBOL_vlen_type = 86, /* vlen_type */ - YYSYMBOL_opaque_type = 87, /* opaque_type */ - YYSYMBOL_88_6 = 88, /* @6 */ - YYSYMBOL_89_7 = 89, /* $@7 */ - YYSYMBOL_opaque_size = 90, /* opaque_size */ - YYSYMBOL_opaque_tag = 91, /* opaque_tag */ - YYSYMBOL_string_type = 92, /* string_type */ - YYSYMBOL_93_8 = 93, /* $@8 */ - YYSYMBOL_94_9 = 94, /* $@9 */ - YYSYMBOL_95_10 = 95, /* $@10 */ - YYSYMBOL_96_11 = 96, /* @11 */ - YYSYMBOL_strsize = 97, /* strsize */ - YYSYMBOL_strpad = 98, /* strpad */ - YYSYMBOL_cset = 99, /* cset */ - YYSYMBOL_ctype = 100, /* ctype */ - YYSYMBOL_enum_type = 101, /* enum_type */ - YYSYMBOL_102_12 = 102, /* $@12 */ - YYSYMBOL_enum_list = 103, /* enum_list */ - YYSYMBOL_enum_def = 104, /* enum_def */ - YYSYMBOL_105_13 = 105, /* $@13 */ - YYSYMBOL_enum_symbol = 106, /* enum_symbol */ - YYSYMBOL_enum_val = 107 /* enum_val */ + YYSYMBOL_H5T_IEEE_F16BE_TOKEN = 30, /* H5T_IEEE_F16BE_TOKEN */ + YYSYMBOL_H5T_IEEE_F16LE_TOKEN = 31, /* H5T_IEEE_F16LE_TOKEN */ + YYSYMBOL_H5T_IEEE_F32BE_TOKEN = 32, /* H5T_IEEE_F32BE_TOKEN */ + YYSYMBOL_H5T_IEEE_F32LE_TOKEN = 33, /* H5T_IEEE_F32LE_TOKEN */ + YYSYMBOL_H5T_IEEE_F64BE_TOKEN = 34, /* H5T_IEEE_F64BE_TOKEN */ + YYSYMBOL_H5T_IEEE_F64LE_TOKEN = 35, /* H5T_IEEE_F64LE_TOKEN */ + YYSYMBOL_H5T_NATIVE_FLOAT16_TOKEN = 36, /* H5T_NATIVE_FLOAT16_TOKEN */ + YYSYMBOL_H5T_NATIVE_FLOAT_TOKEN = 37, /* H5T_NATIVE_FLOAT_TOKEN */ + YYSYMBOL_H5T_NATIVE_DOUBLE_TOKEN = 38, /* H5T_NATIVE_DOUBLE_TOKEN */ + YYSYMBOL_H5T_NATIVE_LDOUBLE_TOKEN = 39, /* H5T_NATIVE_LDOUBLE_TOKEN */ + YYSYMBOL_H5T_STRING_TOKEN = 40, /* H5T_STRING_TOKEN */ + YYSYMBOL_STRSIZE_TOKEN = 41, /* STRSIZE_TOKEN */ + YYSYMBOL_STRPAD_TOKEN = 42, /* STRPAD_TOKEN */ + YYSYMBOL_CSET_TOKEN = 43, /* CSET_TOKEN */ + YYSYMBOL_CTYPE_TOKEN = 44, /* CTYPE_TOKEN */ + YYSYMBOL_H5T_VARIABLE_TOKEN = 45, /* H5T_VARIABLE_TOKEN */ + YYSYMBOL_H5T_STR_NULLTERM_TOKEN = 46, /* H5T_STR_NULLTERM_TOKEN */ + YYSYMBOL_H5T_STR_NULLPAD_TOKEN = 47, /* H5T_STR_NULLPAD_TOKEN */ + YYSYMBOL_H5T_STR_SPACEPAD_TOKEN = 48, /* H5T_STR_SPACEPAD_TOKEN */ + YYSYMBOL_H5T_CSET_ASCII_TOKEN = 49, /* H5T_CSET_ASCII_TOKEN */ + YYSYMBOL_H5T_CSET_UTF8_TOKEN = 50, /* H5T_CSET_UTF8_TOKEN */ + YYSYMBOL_H5T_C_S1_TOKEN = 51, /* H5T_C_S1_TOKEN */ + YYSYMBOL_H5T_FORTRAN_S1_TOKEN = 52, /* H5T_FORTRAN_S1_TOKEN */ + YYSYMBOL_H5T_OPAQUE_TOKEN = 53, /* H5T_OPAQUE_TOKEN */ + YYSYMBOL_OPQ_SIZE_TOKEN = 54, /* OPQ_SIZE_TOKEN */ + YYSYMBOL_OPQ_TAG_TOKEN = 55, /* OPQ_TAG_TOKEN */ + YYSYMBOL_H5T_COMPOUND_TOKEN = 56, /* H5T_COMPOUND_TOKEN */ + YYSYMBOL_H5T_ENUM_TOKEN = 57, /* H5T_ENUM_TOKEN */ + YYSYMBOL_H5T_ARRAY_TOKEN = 58, /* H5T_ARRAY_TOKEN */ + YYSYMBOL_H5T_VLEN_TOKEN = 59, /* H5T_VLEN_TOKEN */ + YYSYMBOL_STRING = 60, /* STRING */ + YYSYMBOL_NUMBER = 61, /* NUMBER */ + YYSYMBOL_62_ = 62, /* '{' */ + YYSYMBOL_63_ = 63, /* '}' */ + YYSYMBOL_64_ = 64, /* '[' */ + YYSYMBOL_65_ = 65, /* ']' */ + YYSYMBOL_66_ = 66, /* ':' */ + YYSYMBOL_67_ = 67, /* ';' */ + YYSYMBOL_YYACCEPT = 68, /* $accept */ + YYSYMBOL_start = 69, /* start */ + YYSYMBOL_ddl_type = 70, /* ddl_type */ + YYSYMBOL_atomic_type = 71, /* atomic_type */ + YYSYMBOL_integer_type = 72, /* integer_type */ + YYSYMBOL_fp_type = 73, /* fp_type */ + YYSYMBOL_compound_type = 74, /* compound_type */ + YYSYMBOL_75_1 = 75, /* $@1 */ + YYSYMBOL_memb_list = 76, /* memb_list */ + YYSYMBOL_memb_def = 77, /* memb_def */ + YYSYMBOL_78_2 = 78, /* $@2 */ + YYSYMBOL_field_name = 79, /* field_name */ + YYSYMBOL_field_offset = 80, /* field_offset */ + YYSYMBOL_offset = 81, /* offset */ + YYSYMBOL_array_type = 82, /* array_type */ + YYSYMBOL_83_3 = 83, /* $@3 */ + YYSYMBOL_dim_list = 84, /* dim_list */ + YYSYMBOL_dim = 85, /* dim */ + YYSYMBOL_86_4 = 86, /* $@4 */ + YYSYMBOL_87_5 = 87, /* $@5 */ + YYSYMBOL_dimsize = 88, /* dimsize */ + YYSYMBOL_vlen_type = 89, /* vlen_type */ + YYSYMBOL_opaque_type = 90, /* opaque_type */ + YYSYMBOL_91_6 = 91, /* @6 */ + YYSYMBOL_92_7 = 92, /* $@7 */ + YYSYMBOL_opaque_size = 93, /* opaque_size */ + YYSYMBOL_opaque_tag = 94, /* opaque_tag */ + YYSYMBOL_string_type = 95, /* string_type */ + YYSYMBOL_96_8 = 96, /* $@8 */ + YYSYMBOL_97_9 = 97, /* $@9 */ + YYSYMBOL_98_10 = 98, /* $@10 */ + YYSYMBOL_99_11 = 99, /* @11 */ + YYSYMBOL_strsize = 100, /* strsize */ + YYSYMBOL_strpad = 101, /* strpad */ + YYSYMBOL_cset = 102, /* cset */ + YYSYMBOL_ctype = 103, /* ctype */ + YYSYMBOL_enum_type = 104, /* enum_type */ + YYSYMBOL_105_12 = 105, /* $@12 */ + YYSYMBOL_enum_list = 106, /* enum_list */ + YYSYMBOL_enum_def = 107, /* enum_def */ + YYSYMBOL_108_13 = 108, /* $@13 */ + YYSYMBOL_enum_symbol = 109, /* enum_symbol */ + YYSYMBOL_enum_val = 110 /* enum_val */ }; typedef enum yysymbol_kind_t yysymbol_kind_t; @@ -616,21 +619,21 @@ union yyalloc #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 58 +#define YYFINAL 61 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 197 +#define YYLAST 206 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 65 +#define YYNTOKENS 68 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 43 /* YYNRULES -- Number of rules. */ -#define YYNRULES 92 +#define YYNRULES 95 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 134 +#define YYNSTATES 137 /* YYMAXUTOK -- Last valid token kind. */ -#define YYMAXUTOK 313 +#define YYMAXUTOK 316 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM @@ -649,14 +652,14 @@ static const yytype_int8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 63, 64, + 2, 2, 2, 2, 2, 2, 2, 2, 66, 67, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 61, 2, 62, 2, 2, 2, 2, 2, 2, + 2, 64, 2, 65, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 59, 2, 60, 2, 2, 2, 2, + 2, 2, 2, 62, 2, 63, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -675,23 +678,23 @@ static const yytype_int8 yytranslate[] = 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58 + 55, 56, 57, 58, 59, 60, 61 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_int16 yyrline[] = { - 0, 101, 101, 102, 104, 105, 106, 107, 109, 110, - 111, 112, 113, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 145, 146, 147, 148, 149, 150, 151, 155, 154, 163, - 164, 166, 166, 203, 211, 212, 215, 217, 217, 226, - 227, 229, 230, 229, 237, 240, 247, 252, 244, 259, - 261, 266, 273, 282, 289, 263, 313, 314, 316, 317, - 318, 320, 321, 323, 324, 328, 327, 332, 333, 335, - 335, 385, 387 + 0, 102, 102, 103, 105, 106, 107, 108, 110, 111, + 112, 113, 114, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 159, 158, 167, 168, 170, 170, 207, 215, 216, 219, + 221, 221, 230, 231, 233, 234, 233, 241, 244, 251, + 256, 248, 263, 265, 270, 277, 286, 293, 267, 317, + 318, 320, 321, 322, 324, 325, 327, 328, 332, 331, + 336, 337, 339, 339, 389, 391 }; #endif @@ -718,24 +721,26 @@ static const char *const yytname[] = "H5T_NATIVE_USHORT_TOKEN", "H5T_NATIVE_INT_TOKEN", "H5T_NATIVE_UINT_TOKEN", "H5T_NATIVE_LONG_TOKEN", "H5T_NATIVE_ULONG_TOKEN", "H5T_NATIVE_LLONG_TOKEN", - "H5T_NATIVE_ULLONG_TOKEN", "H5T_IEEE_F32BE_TOKEN", - "H5T_IEEE_F32LE_TOKEN", "H5T_IEEE_F64BE_TOKEN", "H5T_IEEE_F64LE_TOKEN", - "H5T_NATIVE_FLOAT_TOKEN", "H5T_NATIVE_DOUBLE_TOKEN", - "H5T_NATIVE_LDOUBLE_TOKEN", "H5T_STRING_TOKEN", "STRSIZE_TOKEN", - "STRPAD_TOKEN", "CSET_TOKEN", "CTYPE_TOKEN", "H5T_VARIABLE_TOKEN", - "H5T_STR_NULLTERM_TOKEN", "H5T_STR_NULLPAD_TOKEN", - "H5T_STR_SPACEPAD_TOKEN", "H5T_CSET_ASCII_TOKEN", "H5T_CSET_UTF8_TOKEN", - "H5T_C_S1_TOKEN", "H5T_FORTRAN_S1_TOKEN", "H5T_OPAQUE_TOKEN", - "OPQ_SIZE_TOKEN", "OPQ_TAG_TOKEN", "H5T_COMPOUND_TOKEN", - "H5T_ENUM_TOKEN", "H5T_ARRAY_TOKEN", "H5T_VLEN_TOKEN", "STRING", - "NUMBER", "'{'", "'}'", "'['", "']'", "':'", "';'", "$accept", "start", - "ddl_type", "atomic_type", "integer_type", "fp_type", "compound_type", - "$@1", "memb_list", "memb_def", "$@2", "field_name", "field_offset", - "offset", "array_type", "$@3", "dim_list", "dim", "$@4", "$@5", - "dimsize", "vlen_type", "opaque_type", "@6", "$@7", "opaque_size", - "opaque_tag", "string_type", "$@8", "$@9", "$@10", "@11", "strsize", - "strpad", "cset", "ctype", "enum_type", "$@12", "enum_list", "enum_def", - "$@13", "enum_symbol", "enum_val", YY_NULLPTR + "H5T_NATIVE_ULLONG_TOKEN", "H5T_IEEE_F16BE_TOKEN", + "H5T_IEEE_F16LE_TOKEN", "H5T_IEEE_F32BE_TOKEN", "H5T_IEEE_F32LE_TOKEN", + "H5T_IEEE_F64BE_TOKEN", "H5T_IEEE_F64LE_TOKEN", + "H5T_NATIVE_FLOAT16_TOKEN", "H5T_NATIVE_FLOAT_TOKEN", + "H5T_NATIVE_DOUBLE_TOKEN", "H5T_NATIVE_LDOUBLE_TOKEN", + "H5T_STRING_TOKEN", "STRSIZE_TOKEN", "STRPAD_TOKEN", "CSET_TOKEN", + "CTYPE_TOKEN", "H5T_VARIABLE_TOKEN", "H5T_STR_NULLTERM_TOKEN", + "H5T_STR_NULLPAD_TOKEN", "H5T_STR_SPACEPAD_TOKEN", + "H5T_CSET_ASCII_TOKEN", "H5T_CSET_UTF8_TOKEN", "H5T_C_S1_TOKEN", + "H5T_FORTRAN_S1_TOKEN", "H5T_OPAQUE_TOKEN", "OPQ_SIZE_TOKEN", + "OPQ_TAG_TOKEN", "H5T_COMPOUND_TOKEN", "H5T_ENUM_TOKEN", + "H5T_ARRAY_TOKEN", "H5T_VLEN_TOKEN", "STRING", "NUMBER", "'{'", "'}'", + "'['", "']'", "':'", "';'", "$accept", "start", "ddl_type", + "atomic_type", "integer_type", "fp_type", "compound_type", "$@1", + "memb_list", "memb_def", "$@2", "field_name", "field_offset", "offset", + "array_type", "$@3", "dim_list", "dim", "$@4", "$@5", "dimsize", + "vlen_type", "opaque_type", "@6", "$@7", "opaque_size", "opaque_tag", + "string_type", "$@8", "$@9", "$@10", "@11", "strsize", "strpad", "cset", + "ctype", "enum_type", "$@12", "enum_list", "enum_def", "$@13", + "enum_symbol", "enum_val", YY_NULLPTR }; static const char * @@ -759,20 +764,20 @@ yysymbol_name (yysymbol_kind_t yysymbol) STATE-NUM. */ static const yytype_int16 yypact[] = { - 114, -25, -25, -25, -25, -25, -25, -25, -25, -25, + 120, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, -24, -22, -25, -13, -25, - -11, 49, -25, -25, -25, -25, -25, -25, -25, -25, - -25, -25, 18, 45, 38, 168, 39, 114, -25, -4, - 41, -25, 36, -25, 42, -25, -25, 37, -25, 40, - 56, -25, -3, -25, -25, -25, -25, -25, -25, -25, - -25, 43, -25, 66, 55, 51, -21, 57, -25, 0, - 95, -25, 50, -25, -25, -25, -25, -25, -25, -25, - -25, -25, 89, -25, 90, 97, 92, 99, 52, -25, - -25, -25, -25, -25, -25, 94, -25, 119, 100, -25, - -6, -25, -25, -25, 98, -25, 120, 46, -25, -25, - 101, -25, 103, -25 + -25, -25, -25, -25, -25, -25, -25, -25, -24, -22, + -25, -13, -25, -11, 52, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, 18, 48, 41, 177, 42, + 120, -25, -4, 44, -25, 39, -25, 45, -25, -25, + 40, -25, 43, 59, -25, -3, -25, -25, -25, -25, + -25, -25, -25, -25, 46, -25, 69, 58, 54, -21, + 60, -25, 0, 101, -25, 53, -25, -25, -25, -25, + -25, -25, -25, -25, -25, 95, -25, 96, 103, 98, + 105, 55, -25, -25, -25, -25, -25, -25, 100, -25, + 125, 106, -25, -6, -25, -25, -25, 104, -25, 126, + 49, -25, -25, 107, -25, 109, -25 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -783,23 +788,23 @@ static const yytype_int8 yydefact[] = 2, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 0, 0, 47, 0, 57, - 0, 0, 3, 4, 8, 9, 5, 6, 7, 12, - 10, 11, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 49, 0, 59, 0, 76, 77, 0, 69, 0, - 0, 85, 0, 65, 71, 66, 48, 51, 50, 87, - 61, 0, 60, 0, 0, 0, 0, 0, 58, 0, - 0, 53, 54, 91, 86, 88, 89, 64, 62, 78, - 79, 80, 0, 70, 0, 0, 0, 0, 0, 72, - 67, 56, 55, 52, 92, 0, 63, 0, 0, 90, - 0, 68, 81, 82, 0, 73, 0, 0, 83, 84, - 0, 74, 0, 75 + 42, 43, 44, 45, 46, 47, 48, 49, 0, 0, + 50, 0, 60, 0, 0, 3, 4, 8, 9, 5, + 6, 7, 12, 10, 11, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 52, 0, 62, 0, 79, 80, + 0, 72, 0, 0, 88, 0, 68, 74, 69, 51, + 54, 53, 90, 64, 0, 63, 0, 0, 0, 0, + 0, 61, 0, 0, 56, 57, 94, 89, 91, 92, + 67, 65, 81, 82, 83, 0, 73, 0, 0, 0, + 0, 0, 75, 70, 59, 58, 55, 95, 0, 66, + 0, 0, 93, 0, 71, 84, 85, 0, 76, 0, + 0, 86, 87, 0, 77, 0, 78 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -25, -25, -15, -25, 111, -25, -25, -25, -25, -25, + -25, -25, -15, -25, 117, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, @@ -809,11 +814,11 @@ static const yytype_int8 yypgoto[] = /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_uint8 yydefgoto[] = { - 0, 41, 42, 43, 44, 45, 46, 54, 70, 78, - 85, 92, 106, 112, 47, 56, 72, 82, 87, 108, - 98, 48, 49, 84, 118, 69, 104, 50, 83, 117, - 126, 132, 67, 102, 124, 130, 51, 79, 86, 95, - 107, 96, 115 + 0, 44, 45, 46, 47, 48, 49, 57, 73, 81, + 88, 95, 109, 115, 50, 59, 75, 85, 90, 111, + 101, 51, 52, 87, 121, 72, 107, 53, 86, 120, + 129, 135, 70, 105, 127, 133, 54, 82, 89, 98, + 110, 99, 118 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -824,23 +829,24 @@ static const yytype_uint8 yytable[] = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 52, 93, 53, 65, 94, - 122, 123, 64, 99, 100, 101, 55, 36, 57, 58, - 37, 38, 39, 40, 66, 77, 59, 81, 80, 1, - 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 128, 129, 60, 61, 63, 68, - 71, 74, 73, 88, 75, 89, 36, 90, 91, 37, - 38, 39, 40, 105, 116, 97, 76, 1, 2, 3, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 103, 109, 110, 111, 113, 114, 119, 120, - 121, 127, 125, 133, 36, 131, 62, 37, 38, 39, - 40, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27 + 31, 32, 33, 34, 35, 36, 37, 38, 55, 96, + 56, 68, 97, 125, 126, 67, 102, 103, 104, 58, + 39, 60, 61, 40, 41, 42, 43, 69, 80, 62, + 84, 83, 1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 131, 132, 63, 64, 66, 71, 74, 77, 76, 91, + 78, 92, 39, 93, 94, 40, 41, 42, 43, 108, + 119, 100, 79, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 106, 112, 113, 114, 116, 117, 122, 123, 124, + 130, 128, 136, 39, 134, 65, 40, 41, 42, 43, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27 }; static const yytype_int8 yycheck[] = @@ -848,23 +854,24 @@ static const yytype_int8 yycheck[] = 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 59, 57, 59, 42, 60, - 46, 47, 57, 43, 44, 45, 59, 50, 59, 0, - 53, 54, 55, 56, 58, 70, 38, 72, 61, 3, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 48, 49, 51, 59, 59, 58, - 64, 64, 60, 60, 64, 39, 50, 52, 57, 53, - 54, 55, 56, 63, 62, 58, 60, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 57, 64, 64, 58, 64, 58, 64, 40, - 60, 41, 64, 60, 50, 64, 55, 53, 54, 55, - 56, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29 + 33, 34, 35, 36, 37, 38, 39, 40, 62, 60, + 62, 45, 63, 49, 50, 60, 46, 47, 48, 62, + 53, 62, 0, 56, 57, 58, 59, 61, 73, 41, + 75, 64, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 51, 52, 54, 62, 62, 61, 67, 67, 63, 63, + 67, 42, 53, 55, 60, 56, 57, 58, 59, 66, + 65, 61, 63, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 60, 67, 67, 61, 67, 61, 67, 43, 63, + 44, 67, 63, 53, 67, 58, 56, 57, 58, 59, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29 }; /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of @@ -874,32 +881,32 @@ static const yytype_int8 yystos[] = 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 50, 53, 54, 55, - 56, 66, 67, 68, 69, 70, 71, 79, 86, 87, - 92, 101, 59, 59, 72, 59, 80, 59, 0, 38, - 51, 59, 69, 59, 67, 42, 58, 97, 58, 90, - 73, 64, 81, 60, 64, 64, 60, 67, 74, 102, - 61, 67, 82, 93, 88, 75, 103, 83, 60, 39, - 52, 57, 76, 57, 60, 104, 106, 58, 85, 43, - 44, 45, 98, 57, 91, 63, 77, 105, 84, 64, - 64, 58, 78, 64, 58, 107, 62, 94, 89, 64, - 40, 60, 46, 47, 99, 64, 95, 41, 48, 49, - 100, 64, 96, 60 + 32, 33, 34, 35, 36, 37, 38, 39, 40, 53, + 56, 57, 58, 59, 69, 70, 71, 72, 73, 74, + 82, 89, 90, 95, 104, 62, 62, 75, 62, 83, + 62, 0, 41, 54, 62, 72, 62, 70, 45, 61, + 100, 61, 93, 76, 67, 84, 63, 67, 67, 63, + 70, 77, 105, 64, 70, 85, 96, 91, 78, 106, + 86, 63, 42, 55, 60, 79, 60, 63, 107, 109, + 61, 88, 46, 47, 48, 101, 60, 94, 66, 80, + 108, 87, 67, 67, 61, 81, 67, 61, 110, 65, + 97, 92, 67, 43, 63, 49, 50, 102, 67, 98, + 44, 51, 52, 103, 67, 99, 63 }; /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ static const yytype_int8 yyr1[] = { - 0, 65, 66, 66, 67, 67, 67, 67, 68, 68, - 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 70, 70, 70, 70, 70, 70, 70, 72, 71, 73, - 73, 75, 74, 76, 77, 77, 78, 80, 79, 81, - 81, 83, 84, 82, 85, 86, 88, 89, 87, 90, - 91, 93, 94, 95, 96, 92, 97, 97, 98, 98, - 98, 99, 99, 100, 100, 102, 101, 103, 103, 105, - 104, 106, 107 + 0, 68, 69, 69, 70, 70, 70, 70, 71, 71, + 71, 71, 71, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 75, 74, 76, 76, 78, 77, 79, 80, 80, 81, + 83, 82, 84, 84, 86, 87, 85, 88, 89, 91, + 92, 90, 93, 94, 96, 97, 98, 99, 95, 100, + 100, 101, 101, 101, 102, 102, 103, 103, 105, 104, + 106, 106, 108, 107, 109, 110 }; /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ @@ -909,12 +916,12 @@ static const yytype_int8 yyr2[] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 0, 5, 0, - 2, 0, 5, 1, 0, 2, 1, 0, 6, 0, - 2, 0, 0, 5, 1, 4, 0, 0, 11, 1, - 1, 0, 0, 0, 0, 19, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 0, 7, 0, 2, 0, - 4, 1, 1 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 5, 0, 2, 0, 5, 1, 0, 2, 1, + 0, 6, 0, 2, 0, 0, 5, 1, 4, 0, + 0, 11, 1, 1, 0, 0, 0, 0, 19, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 0, 7, + 0, 2, 0, 4, 1, 1 }; @@ -1378,245 +1385,263 @@ yyreduce: switch (yyn) { case 2: /* start: %empty */ -#line 101 "hl/src//H5LTparse.y" +#line 102 "hl/src//H5LTparse.y" { memset(arr_stack, 0, STACK_SIZE*sizeof(struct arr_info)); /*initialize here?*/ } -#line 1353 "hl/src//H5LTparse.c" +#line 1360 "hl/src//H5LTparse.c" break; case 3: /* start: ddl_type */ -#line 102 "hl/src//H5LTparse.y" +#line 103 "hl/src//H5LTparse.y" { return (yyval.hid);} -#line 1359 "hl/src//H5LTparse.c" +#line 1366 "hl/src//H5LTparse.c" break; case 13: /* integer_type: H5T_STD_I8BE_TOKEN */ -#line 116 "hl/src//H5LTparse.y" +#line 117 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_I8BE); } -#line 1365 "hl/src//H5LTparse.c" +#line 1372 "hl/src//H5LTparse.c" break; case 14: /* integer_type: H5T_STD_I8LE_TOKEN */ -#line 117 "hl/src//H5LTparse.y" +#line 118 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_I8LE); } -#line 1371 "hl/src//H5LTparse.c" +#line 1378 "hl/src//H5LTparse.c" break; case 15: /* integer_type: H5T_STD_I16BE_TOKEN */ -#line 118 "hl/src//H5LTparse.y" +#line 119 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_I16BE); } -#line 1377 "hl/src//H5LTparse.c" +#line 1384 "hl/src//H5LTparse.c" break; case 16: /* integer_type: H5T_STD_I16LE_TOKEN */ -#line 119 "hl/src//H5LTparse.y" +#line 120 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_I16LE); } -#line 1383 "hl/src//H5LTparse.c" +#line 1390 "hl/src//H5LTparse.c" break; case 17: /* integer_type: H5T_STD_I32BE_TOKEN */ -#line 120 "hl/src//H5LTparse.y" +#line 121 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_I32BE); } -#line 1389 "hl/src//H5LTparse.c" +#line 1396 "hl/src//H5LTparse.c" break; case 18: /* integer_type: H5T_STD_I32LE_TOKEN */ -#line 121 "hl/src//H5LTparse.y" +#line 122 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_I32LE); } -#line 1395 "hl/src//H5LTparse.c" +#line 1402 "hl/src//H5LTparse.c" break; case 19: /* integer_type: H5T_STD_I64BE_TOKEN */ -#line 122 "hl/src//H5LTparse.y" +#line 123 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_I64BE); } -#line 1401 "hl/src//H5LTparse.c" +#line 1408 "hl/src//H5LTparse.c" break; case 20: /* integer_type: H5T_STD_I64LE_TOKEN */ -#line 123 "hl/src//H5LTparse.y" +#line 124 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_I64LE); } -#line 1407 "hl/src//H5LTparse.c" +#line 1414 "hl/src//H5LTparse.c" break; case 21: /* integer_type: H5T_STD_U8BE_TOKEN */ -#line 124 "hl/src//H5LTparse.y" +#line 125 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_U8BE); } -#line 1413 "hl/src//H5LTparse.c" +#line 1420 "hl/src//H5LTparse.c" break; case 22: /* integer_type: H5T_STD_U8LE_TOKEN */ -#line 125 "hl/src//H5LTparse.y" +#line 126 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_U8LE); } -#line 1419 "hl/src//H5LTparse.c" +#line 1426 "hl/src//H5LTparse.c" break; case 23: /* integer_type: H5T_STD_U16BE_TOKEN */ -#line 126 "hl/src//H5LTparse.y" +#line 127 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_U16BE); } -#line 1425 "hl/src//H5LTparse.c" +#line 1432 "hl/src//H5LTparse.c" break; case 24: /* integer_type: H5T_STD_U16LE_TOKEN */ -#line 127 "hl/src//H5LTparse.y" +#line 128 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_U16LE); } -#line 1431 "hl/src//H5LTparse.c" +#line 1438 "hl/src//H5LTparse.c" break; case 25: /* integer_type: H5T_STD_U32BE_TOKEN */ -#line 128 "hl/src//H5LTparse.y" +#line 129 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_U32BE); } -#line 1437 "hl/src//H5LTparse.c" +#line 1444 "hl/src//H5LTparse.c" break; case 26: /* integer_type: H5T_STD_U32LE_TOKEN */ -#line 129 "hl/src//H5LTparse.y" +#line 130 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_U32LE); } -#line 1443 "hl/src//H5LTparse.c" +#line 1450 "hl/src//H5LTparse.c" break; case 27: /* integer_type: H5T_STD_U64BE_TOKEN */ -#line 130 "hl/src//H5LTparse.y" +#line 131 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_U64BE); } -#line 1449 "hl/src//H5LTparse.c" +#line 1456 "hl/src//H5LTparse.c" break; case 28: /* integer_type: H5T_STD_U64LE_TOKEN */ -#line 131 "hl/src//H5LTparse.y" +#line 132 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_U64LE); } -#line 1455 "hl/src//H5LTparse.c" +#line 1462 "hl/src//H5LTparse.c" break; case 29: /* integer_type: H5T_NATIVE_CHAR_TOKEN */ -#line 132 "hl/src//H5LTparse.y" +#line 133 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_CHAR); } -#line 1461 "hl/src//H5LTparse.c" +#line 1468 "hl/src//H5LTparse.c" break; case 30: /* integer_type: H5T_NATIVE_SCHAR_TOKEN */ -#line 133 "hl/src//H5LTparse.y" +#line 134 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_SCHAR); } -#line 1467 "hl/src//H5LTparse.c" +#line 1474 "hl/src//H5LTparse.c" break; case 31: /* integer_type: H5T_NATIVE_UCHAR_TOKEN */ -#line 134 "hl/src//H5LTparse.y" +#line 135 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_UCHAR); } -#line 1473 "hl/src//H5LTparse.c" +#line 1480 "hl/src//H5LTparse.c" break; case 32: /* integer_type: H5T_NATIVE_SHORT_TOKEN */ -#line 135 "hl/src//H5LTparse.y" +#line 136 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_SHORT); } -#line 1479 "hl/src//H5LTparse.c" +#line 1486 "hl/src//H5LTparse.c" break; case 33: /* integer_type: H5T_NATIVE_USHORT_TOKEN */ -#line 136 "hl/src//H5LTparse.y" +#line 137 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_USHORT); } -#line 1485 "hl/src//H5LTparse.c" +#line 1492 "hl/src//H5LTparse.c" break; case 34: /* integer_type: H5T_NATIVE_INT_TOKEN */ -#line 137 "hl/src//H5LTparse.y" +#line 138 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_INT); } -#line 1491 "hl/src//H5LTparse.c" +#line 1498 "hl/src//H5LTparse.c" break; case 35: /* integer_type: H5T_NATIVE_UINT_TOKEN */ -#line 138 "hl/src//H5LTparse.y" +#line 139 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_UINT); } -#line 1497 "hl/src//H5LTparse.c" +#line 1504 "hl/src//H5LTparse.c" break; case 36: /* integer_type: H5T_NATIVE_LONG_TOKEN */ -#line 139 "hl/src//H5LTparse.y" +#line 140 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_LONG); } -#line 1503 "hl/src//H5LTparse.c" +#line 1510 "hl/src//H5LTparse.c" break; case 37: /* integer_type: H5T_NATIVE_ULONG_TOKEN */ -#line 140 "hl/src//H5LTparse.y" +#line 141 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULONG); } -#line 1509 "hl/src//H5LTparse.c" +#line 1516 "hl/src//H5LTparse.c" break; case 38: /* integer_type: H5T_NATIVE_LLONG_TOKEN */ -#line 141 "hl/src//H5LTparse.y" +#line 142 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_LLONG); } -#line 1515 "hl/src//H5LTparse.c" +#line 1522 "hl/src//H5LTparse.c" break; case 39: /* integer_type: H5T_NATIVE_ULLONG_TOKEN */ -#line 142 "hl/src//H5LTparse.y" +#line 143 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULLONG); } -#line 1521 "hl/src//H5LTparse.c" +#line 1528 "hl/src//H5LTparse.c" + break; + + case 40: /* fp_type: H5T_IEEE_F16BE_TOKEN */ +#line 146 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_IEEE_F16BE); } +#line 1534 "hl/src//H5LTparse.c" + break; + + case 41: /* fp_type: H5T_IEEE_F16LE_TOKEN */ +#line 147 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_IEEE_F16LE); } +#line 1540 "hl/src//H5LTparse.c" break; - case 40: /* fp_type: H5T_IEEE_F32BE_TOKEN */ -#line 145 "hl/src//H5LTparse.y" + case 42: /* fp_type: H5T_IEEE_F32BE_TOKEN */ +#line 148 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_IEEE_F32BE); } -#line 1527 "hl/src//H5LTparse.c" +#line 1546 "hl/src//H5LTparse.c" break; - case 41: /* fp_type: H5T_IEEE_F32LE_TOKEN */ -#line 146 "hl/src//H5LTparse.y" + case 43: /* fp_type: H5T_IEEE_F32LE_TOKEN */ +#line 149 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_IEEE_F32LE); } -#line 1533 "hl/src//H5LTparse.c" +#line 1552 "hl/src//H5LTparse.c" break; - case 42: /* fp_type: H5T_IEEE_F64BE_TOKEN */ -#line 147 "hl/src//H5LTparse.y" + case 44: /* fp_type: H5T_IEEE_F64BE_TOKEN */ +#line 150 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_IEEE_F64BE); } -#line 1539 "hl/src//H5LTparse.c" +#line 1558 "hl/src//H5LTparse.c" break; - case 43: /* fp_type: H5T_IEEE_F64LE_TOKEN */ -#line 148 "hl/src//H5LTparse.y" + case 45: /* fp_type: H5T_IEEE_F64LE_TOKEN */ +#line 151 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_IEEE_F64LE); } -#line 1545 "hl/src//H5LTparse.c" +#line 1564 "hl/src//H5LTparse.c" break; - case 44: /* fp_type: H5T_NATIVE_FLOAT_TOKEN */ -#line 149 "hl/src//H5LTparse.y" + case 46: /* fp_type: H5T_NATIVE_FLOAT16_TOKEN */ +#line 152 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_FLOAT16); } +#line 1570 "hl/src//H5LTparse.c" + break; + + case 47: /* fp_type: H5T_NATIVE_FLOAT_TOKEN */ +#line 153 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_FLOAT); } -#line 1551 "hl/src//H5LTparse.c" +#line 1576 "hl/src//H5LTparse.c" break; - case 45: /* fp_type: H5T_NATIVE_DOUBLE_TOKEN */ -#line 150 "hl/src//H5LTparse.y" + case 48: /* fp_type: H5T_NATIVE_DOUBLE_TOKEN */ +#line 154 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_DOUBLE); } -#line 1557 "hl/src//H5LTparse.c" +#line 1582 "hl/src//H5LTparse.c" break; - case 46: /* fp_type: H5T_NATIVE_LDOUBLE_TOKEN */ -#line 151 "hl/src//H5LTparse.y" + case 49: /* fp_type: H5T_NATIVE_LDOUBLE_TOKEN */ +#line 155 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_LDOUBLE); } -#line 1563 "hl/src//H5LTparse.c" +#line 1588 "hl/src//H5LTparse.c" break; - case 47: /* $@1: %empty */ -#line 155 "hl/src//H5LTparse.y" + case 50: /* $@1: %empty */ +#line 159 "hl/src//H5LTparse.y" { csindex++; cmpd_stack[csindex].id = H5Tcreate(H5T_COMPOUND, 1); /*temporarily set size to 1*/ } -#line 1569 "hl/src//H5LTparse.c" +#line 1594 "hl/src//H5LTparse.c" break; - case 48: /* compound_type: H5T_COMPOUND_TOKEN $@1 '{' memb_list '}' */ -#line 157 "hl/src//H5LTparse.y" + case 51: /* compound_type: H5T_COMPOUND_TOKEN $@1 '{' memb_list '}' */ +#line 161 "hl/src//H5LTparse.y" { (yyval.hid) = cmpd_stack[csindex].id; cmpd_stack[csindex].id = 0; cmpd_stack[csindex].first_memb = 1; csindex--; } -#line 1579 "hl/src//H5LTparse.c" +#line 1604 "hl/src//H5LTparse.c" break; - case 51: /* $@2: %empty */ -#line 166 "hl/src//H5LTparse.y" + case 54: /* $@2: %empty */ +#line 170 "hl/src//H5LTparse.y" { cmpd_stack[csindex].is_field = 1; /*notify lexer a compound member is parsed*/ } -#line 1585 "hl/src//H5LTparse.c" +#line 1610 "hl/src//H5LTparse.c" break; - case 52: /* memb_def: ddl_type $@2 field_name field_offset ';' */ -#line 168 "hl/src//H5LTparse.y" + case 55: /* memb_def: ddl_type $@2 field_name field_offset ';' */ +#line 172 "hl/src//H5LTparse.y" { size_t origin_size, new_size; hid_t dtype_id = cmpd_stack[csindex].id; @@ -1651,108 +1676,108 @@ yyreduce: new_size = H5Tget_size(dtype_id); } -#line 1624 "hl/src//H5LTparse.c" +#line 1649 "hl/src//H5LTparse.c" break; - case 53: /* field_name: STRING */ -#line 204 "hl/src//H5LTparse.y" + case 56: /* field_name: STRING */ +#line 208 "hl/src//H5LTparse.y" { (yyval.sval) = strdup(yylval.sval); free(yylval.sval); yylval.sval = NULL; } -#line 1634 "hl/src//H5LTparse.c" +#line 1659 "hl/src//H5LTparse.c" break; - case 54: /* field_offset: %empty */ -#line 211 "hl/src//H5LTparse.y" + case 57: /* field_offset: %empty */ +#line 215 "hl/src//H5LTparse.y" { (yyval.ival) = 0; } -#line 1640 "hl/src//H5LTparse.c" +#line 1665 "hl/src//H5LTparse.c" break; - case 55: /* field_offset: ':' offset */ -#line 213 "hl/src//H5LTparse.y" + case 58: /* field_offset: ':' offset */ +#line 217 "hl/src//H5LTparse.y" { (yyval.ival) = yylval.ival; } -#line 1646 "hl/src//H5LTparse.c" +#line 1671 "hl/src//H5LTparse.c" break; - case 57: /* $@3: %empty */ -#line 217 "hl/src//H5LTparse.y" + case 60: /* $@3: %empty */ +#line 221 "hl/src//H5LTparse.y" { asindex++; /*pushd onto the stack*/ } -#line 1652 "hl/src//H5LTparse.c" +#line 1677 "hl/src//H5LTparse.c" break; - case 58: /* array_type: H5T_ARRAY_TOKEN $@3 '{' dim_list ddl_type '}' */ -#line 219 "hl/src//H5LTparse.y" + case 61: /* array_type: H5T_ARRAY_TOKEN $@3 '{' dim_list ddl_type '}' */ +#line 223 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tarray_create2((yyvsp[-1].hid), arr_stack[asindex].ndims, arr_stack[asindex].dims); arr_stack[asindex].ndims = 0; asindex--; H5Tclose((yyvsp[-1].hid)); } -#line 1663 "hl/src//H5LTparse.c" +#line 1688 "hl/src//H5LTparse.c" break; - case 61: /* $@4: %empty */ -#line 229 "hl/src//H5LTparse.y" + case 64: /* $@4: %empty */ +#line 233 "hl/src//H5LTparse.y" { arr_stack[asindex].is_dim = 1; /*notice lexer of dimension size*/ } -#line 1669 "hl/src//H5LTparse.c" +#line 1694 "hl/src//H5LTparse.c" break; - case 62: /* $@5: %empty */ -#line 230 "hl/src//H5LTparse.y" + case 65: /* $@5: %empty */ +#line 234 "hl/src//H5LTparse.y" { unsigned ndims = arr_stack[asindex].ndims; arr_stack[asindex].dims[ndims] = (hsize_t)yylval.ival; arr_stack[asindex].ndims++; arr_stack[asindex].is_dim = 0; } -#line 1679 "hl/src//H5LTparse.c" +#line 1704 "hl/src//H5LTparse.c" break; - case 65: /* vlen_type: H5T_VLEN_TOKEN '{' ddl_type '}' */ -#line 241 "hl/src//H5LTparse.y" + case 68: /* vlen_type: H5T_VLEN_TOKEN '{' ddl_type '}' */ +#line 245 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tvlen_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); } -#line 1685 "hl/src//H5LTparse.c" +#line 1710 "hl/src//H5LTparse.c" break; - case 66: /* @6: %empty */ -#line 247 "hl/src//H5LTparse.y" + case 69: /* @6: %empty */ +#line 251 "hl/src//H5LTparse.y" { size_t size = (size_t)yylval.ival; (yyval.hid) = H5Tcreate(H5T_OPAQUE, size); } -#line 1694 "hl/src//H5LTparse.c" +#line 1719 "hl/src//H5LTparse.c" break; - case 67: /* $@7: %empty */ -#line 252 "hl/src//H5LTparse.y" + case 70: /* $@7: %empty */ +#line 256 "hl/src//H5LTparse.y" { H5Tset_tag((yyvsp[-3].hid), yylval.sval); free(yylval.sval); yylval.sval = NULL; } -#line 1704 "hl/src//H5LTparse.c" +#line 1729 "hl/src//H5LTparse.c" break; - case 68: /* opaque_type: H5T_OPAQUE_TOKEN '{' OPQ_SIZE_TOKEN opaque_size ';' @6 OPQ_TAG_TOKEN opaque_tag ';' $@7 '}' */ -#line 257 "hl/src//H5LTparse.y" + case 71: /* opaque_type: H5T_OPAQUE_TOKEN '{' OPQ_SIZE_TOKEN opaque_size ';' @6 OPQ_TAG_TOKEN opaque_tag ';' $@7 '}' */ +#line 261 "hl/src//H5LTparse.y" { (yyval.hid) = (yyvsp[-5].hid); } -#line 1710 "hl/src//H5LTparse.c" +#line 1735 "hl/src//H5LTparse.c" break; - case 71: /* $@8: %empty */ -#line 266 "hl/src//H5LTparse.y" + case 74: /* $@8: %empty */ +#line 270 "hl/src//H5LTparse.y" { if((yyvsp[-1].ival) == H5T_VARIABLE_TOKEN) is_variable = 1; else str_size = yylval.ival; } -#line 1721 "hl/src//H5LTparse.c" +#line 1746 "hl/src//H5LTparse.c" break; - case 72: /* $@9: %empty */ -#line 273 "hl/src//H5LTparse.y" + case 75: /* $@9: %empty */ +#line 277 "hl/src//H5LTparse.y" { if((yyvsp[-1].ival) == H5T_STR_NULLTERM_TOKEN) str_pad = H5T_STR_NULLTERM; @@ -1761,33 +1786,33 @@ yyreduce: else if((yyvsp[-1].ival) == H5T_STR_SPACEPAD_TOKEN) str_pad = H5T_STR_SPACEPAD; } -#line 1734 "hl/src//H5LTparse.c" +#line 1759 "hl/src//H5LTparse.c" break; - case 73: /* $@10: %empty */ -#line 282 "hl/src//H5LTparse.y" + case 76: /* $@10: %empty */ +#line 286 "hl/src//H5LTparse.y" { if((yyvsp[-1].ival) == H5T_CSET_ASCII_TOKEN) str_cset = H5T_CSET_ASCII; else if((yyvsp[-1].ival) == H5T_CSET_UTF8_TOKEN) str_cset = H5T_CSET_UTF8; } -#line 1745 "hl/src//H5LTparse.c" +#line 1770 "hl/src//H5LTparse.c" break; - case 74: /* @11: %empty */ -#line 289 "hl/src//H5LTparse.y" + case 77: /* @11: %empty */ +#line 293 "hl/src//H5LTparse.y" { if((yyvsp[-1].hid) == H5T_C_S1_TOKEN) (yyval.hid) = H5Tcopy(H5T_C_S1); else if((yyvsp[-1].hid) == H5T_FORTRAN_S1_TOKEN) (yyval.hid) = H5Tcopy(H5T_FORTRAN_S1); } -#line 1756 "hl/src//H5LTparse.c" +#line 1781 "hl/src//H5LTparse.c" break; - case 75: /* string_type: H5T_STRING_TOKEN '{' STRSIZE_TOKEN strsize ';' $@8 STRPAD_TOKEN strpad ';' $@9 CSET_TOKEN cset ';' $@10 CTYPE_TOKEN ctype ';' @11 '}' */ -#line 296 "hl/src//H5LTparse.y" + case 78: /* string_type: H5T_STRING_TOKEN '{' STRSIZE_TOKEN strsize ';' $@8 STRPAD_TOKEN strpad ';' $@9 CSET_TOKEN cset ';' $@10 CTYPE_TOKEN ctype ';' @11 '}' */ +#line 300 "hl/src//H5LTparse.y" { hid_t str_id = (yyvsp[-1].hid); @@ -1804,82 +1829,82 @@ yyreduce: (yyval.hid) = str_id; } -#line 1777 "hl/src//H5LTparse.c" +#line 1802 "hl/src//H5LTparse.c" break; - case 76: /* strsize: H5T_VARIABLE_TOKEN */ -#line 313 "hl/src//H5LTparse.y" + case 79: /* strsize: H5T_VARIABLE_TOKEN */ +#line 317 "hl/src//H5LTparse.y" {(yyval.ival) = H5T_VARIABLE_TOKEN;} -#line 1783 "hl/src//H5LTparse.c" +#line 1808 "hl/src//H5LTparse.c" break; - case 78: /* strpad: H5T_STR_NULLTERM_TOKEN */ -#line 316 "hl/src//H5LTparse.y" + case 81: /* strpad: H5T_STR_NULLTERM_TOKEN */ +#line 320 "hl/src//H5LTparse.y" {(yyval.ival) = H5T_STR_NULLTERM_TOKEN;} -#line 1789 "hl/src//H5LTparse.c" +#line 1814 "hl/src//H5LTparse.c" break; - case 79: /* strpad: H5T_STR_NULLPAD_TOKEN */ -#line 317 "hl/src//H5LTparse.y" + case 82: /* strpad: H5T_STR_NULLPAD_TOKEN */ +#line 321 "hl/src//H5LTparse.y" {(yyval.ival) = H5T_STR_NULLPAD_TOKEN;} -#line 1795 "hl/src//H5LTparse.c" +#line 1820 "hl/src//H5LTparse.c" break; - case 80: /* strpad: H5T_STR_SPACEPAD_TOKEN */ -#line 318 "hl/src//H5LTparse.y" + case 83: /* strpad: H5T_STR_SPACEPAD_TOKEN */ +#line 322 "hl/src//H5LTparse.y" {(yyval.ival) = H5T_STR_SPACEPAD_TOKEN;} -#line 1801 "hl/src//H5LTparse.c" +#line 1826 "hl/src//H5LTparse.c" break; - case 81: /* cset: H5T_CSET_ASCII_TOKEN */ -#line 320 "hl/src//H5LTparse.y" + case 84: /* cset: H5T_CSET_ASCII_TOKEN */ +#line 324 "hl/src//H5LTparse.y" {(yyval.ival) = H5T_CSET_ASCII_TOKEN;} -#line 1807 "hl/src//H5LTparse.c" +#line 1832 "hl/src//H5LTparse.c" break; - case 82: /* cset: H5T_CSET_UTF8_TOKEN */ -#line 321 "hl/src//H5LTparse.y" + case 85: /* cset: H5T_CSET_UTF8_TOKEN */ +#line 325 "hl/src//H5LTparse.y" {(yyval.ival) = H5T_CSET_UTF8_TOKEN;} -#line 1813 "hl/src//H5LTparse.c" +#line 1838 "hl/src//H5LTparse.c" break; - case 83: /* ctype: H5T_C_S1_TOKEN */ -#line 323 "hl/src//H5LTparse.y" + case 86: /* ctype: H5T_C_S1_TOKEN */ +#line 327 "hl/src//H5LTparse.y" {(yyval.hid) = H5T_C_S1_TOKEN;} -#line 1819 "hl/src//H5LTparse.c" +#line 1844 "hl/src//H5LTparse.c" break; - case 84: /* ctype: H5T_FORTRAN_S1_TOKEN */ -#line 324 "hl/src//H5LTparse.y" + case 87: /* ctype: H5T_FORTRAN_S1_TOKEN */ +#line 328 "hl/src//H5LTparse.y" {(yyval.hid) = H5T_FORTRAN_S1_TOKEN;} -#line 1825 "hl/src//H5LTparse.c" +#line 1850 "hl/src//H5LTparse.c" break; - case 85: /* $@12: %empty */ -#line 328 "hl/src//H5LTparse.y" + case 88: /* $@12: %empty */ +#line 332 "hl/src//H5LTparse.y" { is_enum = 1; enum_id = H5Tenum_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); } -#line 1831 "hl/src//H5LTparse.c" +#line 1856 "hl/src//H5LTparse.c" break; - case 86: /* enum_type: H5T_ENUM_TOKEN '{' integer_type ';' $@12 enum_list '}' */ -#line 330 "hl/src//H5LTparse.y" + case 89: /* enum_type: H5T_ENUM_TOKEN '{' integer_type ';' $@12 enum_list '}' */ +#line 334 "hl/src//H5LTparse.y" { is_enum = 0; /*reset*/ (yyval.hid) = enum_id; } -#line 1837 "hl/src//H5LTparse.c" +#line 1862 "hl/src//H5LTparse.c" break; - case 89: /* $@13: %empty */ -#line 335 "hl/src//H5LTparse.y" + case 92: /* $@13: %empty */ +#line 339 "hl/src//H5LTparse.y" { is_enum_memb = 1; /*indicate member of enum*/ enum_memb_symbol = strdup(yylval.sval); free(yylval.sval); yylval.sval = NULL; } -#line 1848 "hl/src//H5LTparse.c" +#line 1873 "hl/src//H5LTparse.c" break; - case 90: /* enum_def: enum_symbol $@13 enum_val ';' */ -#line 342 "hl/src//H5LTparse.y" + case 93: /* enum_def: enum_symbol $@13 enum_val ';' */ +#line 346 "hl/src//H5LTparse.y" { char char_val=(char)yylval.ival; short short_val=(short)yylval.ival; @@ -1922,11 +1947,11 @@ yyreduce: H5Tclose(super); H5Tclose(native); } -#line 1895 "hl/src//H5LTparse.c" +#line 1920 "hl/src//H5LTparse.c" break; -#line 1899 "hl/src//H5LTparse.c" +#line 1924 "hl/src//H5LTparse.c" default: break; } diff --git a/hl/src/H5LTparse.h b/hl/src/H5LTparse.h index 84c5fd0..be3c91f 100644 --- a/hl/src/H5LTparse.h +++ b/hl/src/H5LTparse.h @@ -81,35 +81,38 @@ extern int H5LTyydebug; H5T_NATIVE_ULONG_TOKEN = 282, /* H5T_NATIVE_ULONG_TOKEN */ H5T_NATIVE_LLONG_TOKEN = 283, /* H5T_NATIVE_LLONG_TOKEN */ H5T_NATIVE_ULLONG_TOKEN = 284, /* H5T_NATIVE_ULLONG_TOKEN */ - H5T_IEEE_F32BE_TOKEN = 285, /* H5T_IEEE_F32BE_TOKEN */ - H5T_IEEE_F32LE_TOKEN = 286, /* H5T_IEEE_F32LE_TOKEN */ - H5T_IEEE_F64BE_TOKEN = 287, /* H5T_IEEE_F64BE_TOKEN */ - H5T_IEEE_F64LE_TOKEN = 288, /* H5T_IEEE_F64LE_TOKEN */ - H5T_NATIVE_FLOAT_TOKEN = 289, /* H5T_NATIVE_FLOAT_TOKEN */ - H5T_NATIVE_DOUBLE_TOKEN = 290, /* H5T_NATIVE_DOUBLE_TOKEN */ - H5T_NATIVE_LDOUBLE_TOKEN = 291, /* H5T_NATIVE_LDOUBLE_TOKEN */ - H5T_STRING_TOKEN = 292, /* H5T_STRING_TOKEN */ - STRSIZE_TOKEN = 293, /* STRSIZE_TOKEN */ - STRPAD_TOKEN = 294, /* STRPAD_TOKEN */ - CSET_TOKEN = 295, /* CSET_TOKEN */ - CTYPE_TOKEN = 296, /* CTYPE_TOKEN */ - H5T_VARIABLE_TOKEN = 297, /* H5T_VARIABLE_TOKEN */ - H5T_STR_NULLTERM_TOKEN = 298, /* H5T_STR_NULLTERM_TOKEN */ - H5T_STR_NULLPAD_TOKEN = 299, /* H5T_STR_NULLPAD_TOKEN */ - H5T_STR_SPACEPAD_TOKEN = 300, /* H5T_STR_SPACEPAD_TOKEN */ - H5T_CSET_ASCII_TOKEN = 301, /* H5T_CSET_ASCII_TOKEN */ - H5T_CSET_UTF8_TOKEN = 302, /* H5T_CSET_UTF8_TOKEN */ - H5T_C_S1_TOKEN = 303, /* H5T_C_S1_TOKEN */ - H5T_FORTRAN_S1_TOKEN = 304, /* H5T_FORTRAN_S1_TOKEN */ - H5T_OPAQUE_TOKEN = 305, /* H5T_OPAQUE_TOKEN */ - OPQ_SIZE_TOKEN = 306, /* OPQ_SIZE_TOKEN */ - OPQ_TAG_TOKEN = 307, /* OPQ_TAG_TOKEN */ - H5T_COMPOUND_TOKEN = 308, /* H5T_COMPOUND_TOKEN */ - H5T_ENUM_TOKEN = 309, /* H5T_ENUM_TOKEN */ - H5T_ARRAY_TOKEN = 310, /* H5T_ARRAY_TOKEN */ - H5T_VLEN_TOKEN = 311, /* H5T_VLEN_TOKEN */ - STRING = 312, /* STRING */ - NUMBER = 313 /* NUMBER */ + H5T_IEEE_F16BE_TOKEN = 285, /* H5T_IEEE_F16BE_TOKEN */ + H5T_IEEE_F16LE_TOKEN = 286, /* H5T_IEEE_F16LE_TOKEN */ + H5T_IEEE_F32BE_TOKEN = 287, /* H5T_IEEE_F32BE_TOKEN */ + H5T_IEEE_F32LE_TOKEN = 288, /* H5T_IEEE_F32LE_TOKEN */ + H5T_IEEE_F64BE_TOKEN = 289, /* H5T_IEEE_F64BE_TOKEN */ + H5T_IEEE_F64LE_TOKEN = 290, /* H5T_IEEE_F64LE_TOKEN */ + H5T_NATIVE_FLOAT16_TOKEN = 291, /* H5T_NATIVE_FLOAT16_TOKEN */ + H5T_NATIVE_FLOAT_TOKEN = 292, /* H5T_NATIVE_FLOAT_TOKEN */ + H5T_NATIVE_DOUBLE_TOKEN = 293, /* H5T_NATIVE_DOUBLE_TOKEN */ + H5T_NATIVE_LDOUBLE_TOKEN = 294, /* H5T_NATIVE_LDOUBLE_TOKEN */ + H5T_STRING_TOKEN = 295, /* H5T_STRING_TOKEN */ + STRSIZE_TOKEN = 296, /* STRSIZE_TOKEN */ + STRPAD_TOKEN = 297, /* STRPAD_TOKEN */ + CSET_TOKEN = 298, /* CSET_TOKEN */ + CTYPE_TOKEN = 299, /* CTYPE_TOKEN */ + H5T_VARIABLE_TOKEN = 300, /* H5T_VARIABLE_TOKEN */ + H5T_STR_NULLTERM_TOKEN = 301, /* H5T_STR_NULLTERM_TOKEN */ + H5T_STR_NULLPAD_TOKEN = 302, /* H5T_STR_NULLPAD_TOKEN */ + H5T_STR_SPACEPAD_TOKEN = 303, /* H5T_STR_SPACEPAD_TOKEN */ + H5T_CSET_ASCII_TOKEN = 304, /* H5T_CSET_ASCII_TOKEN */ + H5T_CSET_UTF8_TOKEN = 305, /* H5T_CSET_UTF8_TOKEN */ + H5T_C_S1_TOKEN = 306, /* H5T_C_S1_TOKEN */ + H5T_FORTRAN_S1_TOKEN = 307, /* H5T_FORTRAN_S1_TOKEN */ + H5T_OPAQUE_TOKEN = 308, /* H5T_OPAQUE_TOKEN */ + OPQ_SIZE_TOKEN = 309, /* OPQ_SIZE_TOKEN */ + OPQ_TAG_TOKEN = 310, /* OPQ_TAG_TOKEN */ + H5T_COMPOUND_TOKEN = 311, /* H5T_COMPOUND_TOKEN */ + H5T_ENUM_TOKEN = 312, /* H5T_ENUM_TOKEN */ + H5T_ARRAY_TOKEN = 313, /* H5T_ARRAY_TOKEN */ + H5T_VLEN_TOKEN = 314, /* H5T_VLEN_TOKEN */ + STRING = 315, /* STRING */ + NUMBER = 316 /* NUMBER */ }; typedef enum yytokentype yytoken_kind_t; #endif @@ -124,7 +127,7 @@ union YYSTYPE char *sval; /*for name string*/ hid_t hid; /*for hid_t token*/ -#line 128 "hl/src//H5LTparse.h" +#line 131 "hl/src//H5LTparse.h" }; typedef union YYSTYPE YYSTYPE; diff --git a/hl/src/H5LTparse.y b/hl/src/H5LTparse.y index 8621836..3a14e76 100644 --- a/hl/src/H5LTparse.y +++ b/hl/src/H5LTparse.y @@ -79,8 +79,9 @@ static char* enum_memb_symbol; /*enum member symbol string*/ %token H5T_NATIVE_SHORT_TOKEN H5T_NATIVE_USHORT_TOKEN H5T_NATIVE_INT_TOKEN H5T_NATIVE_UINT_TOKEN %token H5T_NATIVE_LONG_TOKEN H5T_NATIVE_ULONG_TOKEN H5T_NATIVE_LLONG_TOKEN H5T_NATIVE_ULLONG_TOKEN +%token H5T_IEEE_F16BE_TOKEN H5T_IEEE_F16LE_TOKEN %token H5T_IEEE_F32BE_TOKEN H5T_IEEE_F32LE_TOKEN H5T_IEEE_F64BE_TOKEN H5T_IEEE_F64LE_TOKEN -%token H5T_NATIVE_FLOAT_TOKEN H5T_NATIVE_DOUBLE_TOKEN H5T_NATIVE_LDOUBLE_TOKEN +%token H5T_NATIVE_FLOAT16_TOKEN H5T_NATIVE_FLOAT_TOKEN H5T_NATIVE_DOUBLE_TOKEN H5T_NATIVE_LDOUBLE_TOKEN %token H5T_STRING_TOKEN STRSIZE_TOKEN STRPAD_TOKEN CSET_TOKEN CTYPE_TOKEN H5T_VARIABLE_TOKEN %token H5T_STR_NULLTERM_TOKEN H5T_STR_NULLPAD_TOKEN H5T_STR_SPACEPAD_TOKEN @@ -142,10 +143,13 @@ integer_type : H5T_STD_I8BE_TOKEN { $$ = H5Tcopy(H5T_STD_I8BE); } | H5T_NATIVE_ULLONG_TOKEN { $$ = H5Tcopy(H5T_NATIVE_ULLONG); } ; -fp_type : H5T_IEEE_F32BE_TOKEN { $$ = H5Tcopy(H5T_IEEE_F32BE); } +fp_type : H5T_IEEE_F16BE_TOKEN { $$ = H5Tcopy(H5T_IEEE_F16BE); } + | H5T_IEEE_F16LE_TOKEN { $$ = H5Tcopy(H5T_IEEE_F16LE); } + | H5T_IEEE_F32BE_TOKEN { $$ = H5Tcopy(H5T_IEEE_F32BE); } | H5T_IEEE_F32LE_TOKEN { $$ = H5Tcopy(H5T_IEEE_F32LE); } | H5T_IEEE_F64BE_TOKEN { $$ = H5Tcopy(H5T_IEEE_F64BE); } | H5T_IEEE_F64LE_TOKEN { $$ = H5Tcopy(H5T_IEEE_F64LE); } + | H5T_NATIVE_FLOAT16_TOKEN { $$ = H5Tcopy(H5T_NATIVE_FLOAT16); } | H5T_NATIVE_FLOAT_TOKEN { $$ = H5Tcopy(H5T_NATIVE_FLOAT); } | H5T_NATIVE_DOUBLE_TOKEN { $$ = H5Tcopy(H5T_NATIVE_DOUBLE); } | H5T_NATIVE_LDOUBLE_TOKEN { $$ = H5Tcopy(H5T_NATIVE_LDOUBLE); } diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java index 25b65fa..55b6f4b 100644 --- a/java/src/hdf/hdf5lib/HDF5Constants.java +++ b/java/src/hdf/hdf5lib/HDF5Constants.java @@ -1095,6 +1095,10 @@ public class HDF5Constants { /** */ public static final long H5T_FORTRAN_S1 = H5T_FORTRAN_S1(); /** */ + public static final long H5T_IEEE_F16BE = H5T_IEEE_F16BE(); + /** */ + public static final long H5T_IEEE_F16LE = H5T_IEEE_F16LE(); + /** */ public static final long H5T_IEEE_F32BE = H5T_IEEE_F32BE(); /** */ public static final long H5T_IEEE_F32LE = H5T_IEEE_F32LE(); @@ -1175,6 +1179,8 @@ public class HDF5Constants { /** */ public static final long H5T_NATIVE_FLOAT = H5T_NATIVE_FLOAT(); /** */ + public static final long H5T_NATIVE_FLOAT16 = H5T_NATIVE_FLOAT16(); + /** */ public static final long H5T_NATIVE_HADDR = H5T_NATIVE_HADDR(); /** */ public static final long H5T_NATIVE_HBOOL = H5T_NATIVE_HBOOL(); @@ -2580,6 +2586,10 @@ public class HDF5Constants { private static native final long H5T_FORTRAN_S1(); + private static native final long H5T_IEEE_F16BE(); + + private static native final long H5T_IEEE_F16LE(); + private static native final long H5T_IEEE_F32BE(); private static native final long H5T_IEEE_F32LE(); @@ -2660,6 +2670,8 @@ public class HDF5Constants { private static native final long H5T_NATIVE_FLOAT(); + private static native final long H5T_NATIVE_FLOAT16(); + private static native final long H5T_NATIVE_HADDR(); private static native final long H5T_NATIVE_HBOOL(); diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index d83b462..ee1bd5a 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -2678,6 +2678,16 @@ Java_hdf_hdf5lib_HDF5Constants_H5T_1FORTRAN_1S1(JNIEnv *env, jclass cls) return H5T_FORTRAN_S1; } JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5T_1IEEE_1F16BE(JNIEnv *env, jclass cls) +{ + return H5T_IEEE_F16BE; +} +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5T_1IEEE_1F16LE(JNIEnv *env, jclass cls) +{ + return H5T_IEEE_F16LE; +} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1IEEE_1F32BE(JNIEnv *env, jclass cls) { return H5T_IEEE_F32BE; @@ -2878,6 +2888,11 @@ Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1FLOAT(JNIEnv *env, jclass cls) return H5T_NATIVE_FLOAT; } JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1FLOAT16(JNIEnv *env, jclass cls) +{ + return H5T_NATIVE_FLOAT16; +} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HADDR(JNIEnv *env, jclass cls) { return H5T_NATIVE_HADDR; diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index bf798b8..d10ab83 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -2082,7 +2082,9 @@ h5str_get_little_endian_type(hid_t tid) } case H5T_FLOAT: { - if (size == 4) + if (size == 2) + p_type = H5Tcopy(H5T_IEEE_F16LE); + else if (size == 4) p_type = H5Tcopy(H5T_IEEE_F32LE); else if (size == 8) p_type = H5Tcopy(H5T_IEEE_F64LE); @@ -2176,7 +2178,9 @@ h5str_get_big_endian_type(hid_t tid) } case H5T_FLOAT: { - if (size == 4) + if (size == 2) + p_type = H5Tcopy(H5T_IEEE_F16BE); + else if (size == 4) p_type = H5Tcopy(H5T_IEEE_F32BE); else if (size == 8) p_type = H5Tcopy(H5T_IEEE_F64BE); diff --git a/src/H5T.c b/src/H5T.c index 09eeff8..a340211 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -100,6 +100,30 @@ dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; \ } +/* Define the code templates for standard 16-bit floats for the "GUTS" in the H5T_INIT_TYPE macro */ +#define H5T_INIT_TYPE_FLOAT16_COMMON(ENDIANNESS) \ + { \ + H5T_INIT_TYPE_NUM_COMMON(ENDIANNESS) \ + dt->shared->u.atomic.u.f.sign = 15; \ + dt->shared->u.atomic.u.f.epos = 10; \ + dt->shared->u.atomic.u.f.esize = 5; \ + dt->shared->u.atomic.u.f.ebias = 0xf; \ + dt->shared->u.atomic.u.f.mpos = 0; \ + dt->shared->u.atomic.u.f.msize = 10; \ + dt->shared->u.atomic.u.f.norm = H5T_NORM_IMPLIED; \ + dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO; \ + } + +#define H5T_INIT_TYPE_FLOAT16LE_CORE \ + { \ + H5T_INIT_TYPE_FLOAT16_COMMON(H5T_ORDER_LE) \ + } + +#define H5T_INIT_TYPE_FLOAT16BE_CORE \ + { \ + H5T_INIT_TYPE_FLOAT16_COMMON(H5T_ORDER_BE) \ + } + /* Define the code templates for standard floats for the "GUTS" in the H5T_INIT_TYPE macro */ #define H5T_INIT_TYPE_FLOAT_COMMON(ENDIANNESS) \ { \ @@ -374,6 +398,8 @@ H5T_order_t H5T_native_order_g = H5T_ORDER_ERROR; * If more of these are added, the new ones must be added to the list of * types to reset in H5T_term_package(). */ +hid_t H5T_IEEE_F16BE_g = FAIL; +hid_t H5T_IEEE_F16LE_g = FAIL; hid_t H5T_IEEE_F32BE_g = FAIL; hid_t H5T_IEEE_F32LE_g = FAIL; hid_t H5T_IEEE_F64BE_g = FAIL; @@ -429,6 +455,7 @@ hid_t H5T_NATIVE_LONG_g = FAIL; hid_t H5T_NATIVE_ULONG_g = FAIL; hid_t H5T_NATIVE_LLONG_g = FAIL; hid_t H5T_NATIVE_ULLONG_g = FAIL; +hid_t H5T_NATIVE_FLOAT16_g = FAIL; hid_t H5T_NATIVE_FLOAT_g = FAIL; hid_t H5T_NATIVE_DOUBLE_g = FAIL; hid_t H5T_NATIVE_LDOUBLE_g = FAIL; @@ -497,6 +524,7 @@ size_t H5T_NATIVE_LONG_ALIGN_g = 0; size_t H5T_NATIVE_ULONG_ALIGN_g = 0; size_t H5T_NATIVE_LLONG_ALIGN_g = 0; size_t H5T_NATIVE_ULLONG_ALIGN_g = 0; +size_t H5T_NATIVE_FLOAT16_ALIGN_g = 0; size_t H5T_NATIVE_FLOAT_ALIGN_g = 0; size_t H5T_NATIVE_DOUBLE_ALIGN_g = 0; size_t H5T_NATIVE_LDOUBLE_ALIGN_g = 0; @@ -532,6 +560,15 @@ size_t H5T_NATIVE_UINT_FAST64_ALIGN_g = 0; /* Useful floating-point values for conversion routines */ /* (+/- Inf for all floating-point types) */ +#ifdef H5_HAVE__FLOAT16 +/* Initialize these with a float literal since the f16 suffix + * is non-standard C and gives warnings when compiling the + * library with the -pedantic flag. These values will be + * overwritten anyway. + */ +H5__Float16 H5T_NATIVE_FLOAT16_POS_INF_g = 0.0f; +H5__Float16 H5T_NATIVE_FLOAT16_NEG_INF_g = 0.0f; +#endif float H5T_NATIVE_FLOAT_POS_INF_g = 0.0F; float H5T_NATIVE_FLOAT_NEG_INF_g = 0.0F; double H5T_NATIVE_DOUBLE_POS_INF_g = 0.0; @@ -684,6 +721,49 @@ H5T__init_inf(void) } /* end for */ } /* end if */ +#ifdef H5_HAVE__FLOAT16 + /* Get the _Float16 datatype */ + if (NULL == (dst_p = (H5T_t *)H5I_object(H5T_NATIVE_FLOAT16_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); + dst = &dst_p->shared->u.atomic; + + /* Check that we can re-order the bytes correctly */ + if (H5T_ORDER_LE != H5T_native_order_g && H5T_ORDER_BE != H5T_native_order_g) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order"); + + /* +Inf */ + d = (uint8_t *)&H5T_NATIVE_FLOAT16_POS_INF_g; + H5T__bit_set(d, dst->u.f.sign, (size_t)1, false); + H5T__bit_set(d, dst->u.f.epos, dst->u.f.esize, true); + H5T__bit_set(d, dst->u.f.mpos, dst->u.f.msize, false); + + /* Swap the bytes if the machine architecture is big-endian */ + if (H5T_ORDER_BE == H5T_native_order_g) { + half_size = dst_p->shared->size / 2; + for (u = 0; u < half_size; u++) { + uint8_t tmp = d[dst_p->shared->size - (u + 1)]; + d[dst_p->shared->size - (u + 1)] = d[u]; + d[u] = tmp; + } /* end for */ + } /* end if */ + + /* -Inf */ + d = (uint8_t *)&H5T_NATIVE_FLOAT16_NEG_INF_g; + H5T__bit_set(d, dst->u.f.sign, (size_t)1, true); + H5T__bit_set(d, dst->u.f.epos, dst->u.f.esize, true); + H5T__bit_set(d, dst->u.f.mpos, dst->u.f.msize, false); + + /* Swap the bytes if the machine architecture is big-endian */ + if (H5T_ORDER_BE == H5T_native_order_g) { + half_size = dst_p->shared->size / 2; + for (u = 0; u < half_size; u++) { + uint8_t tmp = d[dst_p->shared->size - (u + 1)]; + d[dst_p->shared->size - (u + 1)] = d[u]; + d[u] = tmp; + } /* end for */ + } /* end if */ +#endif + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__init_inf() */ @@ -737,6 +817,9 @@ H5T_init(void) herr_t status; bool copied_dtype = true; /* Flag to indicate whether datatype was copied or allocated (for error cleanup) */ +#ifdef H5_HAVE__FLOAT16 + H5T_t *native_float16 = NULL; /* Datatype structure for native _Float16 type */ +#endif herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -778,6 +861,10 @@ H5T_init(void) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); if (NULL == (native_ullong = (H5T_t *)H5I_object(H5T_NATIVE_ULLONG_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); +#ifdef H5_HAVE__FLOAT16 + if (NULL == (native_float16 = (H5T_t *)H5I_object(H5T_NATIVE_FLOAT16_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); +#endif if (NULL == (native_float = (H5T_t *)H5I_object(H5T_NATIVE_FLOAT_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); if (NULL == (native_double = (H5T_t *)H5I_object(H5T_NATIVE_DOUBLE_g))) @@ -822,6 +909,12 @@ H5T_init(void) *------------------------------------------------------------ */ + /* IEEE 2-byte little-endian float */ + H5T_INIT_TYPE(FLOAT16LE, H5T_IEEE_F16LE_g, COPY, native_double, SET, 2) + + /* IEEE 2-byte big-endian float */ + H5T_INIT_TYPE(FLOAT16BE, H5T_IEEE_F16BE_g, COPY, native_double, SET, 2) + /* IEEE 4-byte little-endian float */ H5T_INIT_TYPE(FLOATLE, H5T_IEEE_F32LE_g, COPY, native_double, SET, 4) @@ -1061,6 +1154,20 @@ H5T_init(void) H5T__register_int(H5T_PERS_HARD, "ldbl_flt", native_ldouble, native_float, H5T__conv_ldouble_float); status |= H5T__register_int(H5T_PERS_HARD, "ldbl_dbl", native_ldouble, native_double, H5T__conv_ldouble_double); +#ifdef H5_HAVE__FLOAT16 + status |= + H5T__register_int(H5T_PERS_HARD, "flt16_flt", native_float16, native_float, H5T__conv__Float16_float); + status |= H5T__register_int(H5T_PERS_HARD, "flt16_dbl", native_float16, native_double, + H5T__conv__Float16_double); + status |= H5T__register_int(H5T_PERS_HARD, "flt16_ldbl", native_float16, native_ldouble, + H5T__conv__Float16_ldouble); + status |= + H5T__register_int(H5T_PERS_HARD, "flt_flt16", native_float, native_float16, H5T__conv_float__Float16); + status |= H5T__register_int(H5T_PERS_HARD, "dbl_flt16", native_double, native_float16, + H5T__conv_double__Float16); + status |= H5T__register_int(H5T_PERS_HARD, "ldbl_flt16", native_ldouble, native_float16, + H5T__conv_ldouble__Float16); +#endif /* from long long */ status |= @@ -1219,6 +1326,10 @@ H5T_init(void) H5T__register_int(H5T_PERS_HARD, "schar_dbl", native_schar, native_double, H5T__conv_schar_double); status |= H5T__register_int(H5T_PERS_HARD, "schar_ldbl", native_schar, native_ldouble, H5T__conv_schar_ldouble); +#ifdef H5_HAVE__FLOAT16 + status |= H5T__register_int(H5T_PERS_HARD, "schar_flt16", native_schar, native_float16, + H5T__conv_schar__Float16); +#endif /* From unsigned char to floats */ status |= @@ -1227,6 +1338,10 @@ H5T_init(void) H5T__register_int(H5T_PERS_HARD, "uchar_dbl", native_uchar, native_double, H5T__conv_uchar_double); status |= H5T__register_int(H5T_PERS_HARD, "uchar_ldbl", native_uchar, native_ldouble, H5T__conv_uchar_ldouble); +#ifdef H5_HAVE__FLOAT16 + status |= H5T__register_int(H5T_PERS_HARD, "uchar_flt16", native_uchar, native_float16, + H5T__conv_uchar__Float16); +#endif /* From short to floats */ status |= @@ -1235,6 +1350,10 @@ H5T_init(void) H5T__register_int(H5T_PERS_HARD, "short_dbl", native_short, native_double, H5T__conv_short_double); status |= H5T__register_int(H5T_PERS_HARD, "short_ldbl", native_short, native_ldouble, H5T__conv_short_ldouble); +#ifdef H5_HAVE__FLOAT16 + status |= H5T__register_int(H5T_PERS_HARD, "short_flt16", native_short, native_float16, + H5T__conv_short__Float16); +#endif /* From unsigned short to floats */ status |= @@ -1243,23 +1362,39 @@ H5T_init(void) H5T__register_int(H5T_PERS_HARD, "ushort_dbl", native_ushort, native_double, H5T__conv_ushort_double); status |= H5T__register_int(H5T_PERS_HARD, "ushort_ldbl", native_ushort, native_ldouble, H5T__conv_ushort_ldouble); +#ifdef H5_HAVE__FLOAT16 + status |= H5T__register_int(H5T_PERS_HARD, "ushort_flt16", native_ushort, native_float16, + H5T__conv_ushort__Float16); +#endif /* From int to floats */ status |= H5T__register_int(H5T_PERS_HARD, "int_flt", native_int, native_float, H5T__conv_int_float); status |= H5T__register_int(H5T_PERS_HARD, "int_dbl", native_int, native_double, H5T__conv_int_double); status |= H5T__register_int(H5T_PERS_HARD, "int_ldbl", native_int, native_ldouble, H5T__conv_int_ldouble); +#ifdef H5_HAVE__FLOAT16 + status |= + H5T__register_int(H5T_PERS_HARD, "int_flt16", native_int, native_float16, H5T__conv_int__Float16); +#endif /* From unsigned int to floats */ status |= H5T__register_int(H5T_PERS_HARD, "uint_flt", native_uint, native_float, H5T__conv_uint_float); status |= H5T__register_int(H5T_PERS_HARD, "uint_dbl", native_uint, native_double, H5T__conv_uint_double); status |= H5T__register_int(H5T_PERS_HARD, "uint_ldbl", native_uint, native_ldouble, H5T__conv_uint_ldouble); +#ifdef H5_HAVE__FLOAT16 + status |= + H5T__register_int(H5T_PERS_HARD, "uint_flt16", native_uint, native_float16, H5T__conv_uint__Float16); +#endif /* From long to floats */ status |= H5T__register_int(H5T_PERS_HARD, "long_flt", native_long, native_float, H5T__conv_long_float); status |= H5T__register_int(H5T_PERS_HARD, "long_dbl", native_long, native_double, H5T__conv_long_double); status |= H5T__register_int(H5T_PERS_HARD, "long_ldbl", native_long, native_ldouble, H5T__conv_long_ldouble); +#ifdef H5_HAVE__FLOAT16 + status |= + H5T__register_int(H5T_PERS_HARD, "long_flt16", native_long, native_float16, H5T__conv_long__Float16); +#endif /* From unsigned long to floats */ status |= @@ -1268,6 +1403,10 @@ H5T_init(void) H5T__register_int(H5T_PERS_HARD, "ulong_dbl", native_ulong, native_double, H5T__conv_ulong_double); status |= H5T__register_int(H5T_PERS_HARD, "ulong_ldbl", native_ulong, native_ldouble, H5T__conv_ulong_ldouble); +#ifdef H5_HAVE__FLOAT16 + status |= H5T__register_int(H5T_PERS_HARD, "ulong_flt16", native_ulong, native_float16, + H5T__conv_ulong__Float16); +#endif /* From long long to floats */ status |= @@ -1278,6 +1417,10 @@ H5T_init(void) status |= H5T__register_int(H5T_PERS_HARD, "llong_ldbl", native_llong, native_ldouble, H5T__conv_llong_ldouble); #endif /* H5T_CONV_INTERNAL_LLONG_LDOUBLE */ +#ifdef H5_HAVE__FLOAT16 + status |= H5T__register_int(H5T_PERS_HARD, "llong_flt16", native_llong, native_float16, + H5T__conv_llong__Float16); +#endif /* From unsigned long long to floats */ status |= @@ -1288,6 +1431,10 @@ H5T_init(void) status |= H5T__register_int(H5T_PERS_HARD, "ullong_ldbl", native_ullong, native_ldouble, H5T__conv_ullong_ldouble); #endif /* H5T_CONV_INTERNAL_ULLONG_LDOUBLE */ +#ifdef H5_HAVE__FLOAT16 + status |= H5T__register_int(H5T_PERS_HARD, "ullong_flt16", native_ullong, native_float16, + H5T__conv_ullong__Float16); +#endif /* From floats to char */ status |= @@ -1296,6 +1443,10 @@ H5T_init(void) H5T__register_int(H5T_PERS_HARD, "dbl_schar", native_double, native_schar, H5T__conv_double_schar); status |= H5T__register_int(H5T_PERS_HARD, "ldbl_schar", native_ldouble, native_schar, H5T__conv_ldouble_schar); +#ifdef H5_HAVE__FLOAT16 + status |= H5T__register_int(H5T_PERS_HARD, "flt16_schar", native_float16, native_schar, + H5T__conv__Float16_schar); +#endif /* From floats to unsigned char */ status |= @@ -1304,6 +1455,10 @@ H5T_init(void) H5T__register_int(H5T_PERS_HARD, "dbl_uchar", native_double, native_uchar, H5T__conv_double_uchar); status |= H5T__register_int(H5T_PERS_HARD, "ldbl_uchar", native_ldouble, native_uchar, H5T__conv_ldouble_uchar); +#ifdef H5_HAVE__FLOAT16 + status |= H5T__register_int(H5T_PERS_HARD, "flt16_uchar", native_float16, native_uchar, + H5T__conv__Float16_uchar); +#endif /* From floats to short */ status |= @@ -1312,6 +1467,10 @@ H5T_init(void) H5T__register_int(H5T_PERS_HARD, "dbl_short", native_double, native_short, H5T__conv_double_short); status |= H5T__register_int(H5T_PERS_HARD, "ldbl_short", native_ldouble, native_short, H5T__conv_ldouble_short); +#ifdef H5_HAVE__FLOAT16 + status |= H5T__register_int(H5T_PERS_HARD, "flt16_short", native_float16, native_short, + H5T__conv__Float16_short); +#endif /* From floats to unsigned short */ status |= @@ -1320,23 +1479,39 @@ H5T_init(void) H5T__register_int(H5T_PERS_HARD, "dbl_ushort", native_double, native_ushort, H5T__conv_double_ushort); status |= H5T__register_int(H5T_PERS_HARD, "ldbl_ushort", native_ldouble, native_ushort, H5T__conv_ldouble_ushort); +#ifdef H5_HAVE__FLOAT16 + status |= H5T__register_int(H5T_PERS_HARD, "flt16_ushort", native_float16, native_ushort, + H5T__conv__Float16_ushort); +#endif /* From floats to int */ status |= H5T__register_int(H5T_PERS_HARD, "flt_int", native_float, native_int, H5T__conv_float_int); status |= H5T__register_int(H5T_PERS_HARD, "dbl_int", native_double, native_int, H5T__conv_double_int); status |= H5T__register_int(H5T_PERS_HARD, "ldbl_int", native_ldouble, native_int, H5T__conv_ldouble_int); +#ifdef H5_HAVE__FLOAT16 + status |= + H5T__register_int(H5T_PERS_HARD, "flt16_int", native_float16, native_int, H5T__conv__Float16_int); +#endif /* From floats to unsigned int */ status |= H5T__register_int(H5T_PERS_HARD, "flt_uint", native_float, native_uint, H5T__conv_float_uint); status |= H5T__register_int(H5T_PERS_HARD, "dbl_uint", native_double, native_uint, H5T__conv_double_uint); status |= H5T__register_int(H5T_PERS_HARD, "ldbl_uint", native_ldouble, native_uint, H5T__conv_ldouble_uint); +#ifdef H5_HAVE__FLOAT16 + status |= + H5T__register_int(H5T_PERS_HARD, "flt16_uint", native_float16, native_uint, H5T__conv__Float16_uint); +#endif /* From floats to long */ status |= H5T__register_int(H5T_PERS_HARD, "flt_long", native_float, native_long, H5T__conv_float_long); status |= H5T__register_int(H5T_PERS_HARD, "dbl_long", native_double, native_long, H5T__conv_double_long); status |= H5T__register_int(H5T_PERS_HARD, "ldbl_long", native_ldouble, native_long, H5T__conv_ldouble_long); +#ifdef H5_HAVE__FLOAT16 + status |= + H5T__register_int(H5T_PERS_HARD, "flt16_long", native_float16, native_long, H5T__conv__Float16_long); +#endif /* From floats to unsigned long */ status |= @@ -1345,6 +1520,10 @@ H5T_init(void) H5T__register_int(H5T_PERS_HARD, "dbl_ulong", native_double, native_ulong, H5T__conv_double_ulong); status |= H5T__register_int(H5T_PERS_HARD, "ldbl_ulong", native_ldouble, native_ulong, H5T__conv_ldouble_ulong); +#ifdef H5_HAVE__FLOAT16 + status |= H5T__register_int(H5T_PERS_HARD, "flt16_ulong", native_float16, native_ulong, + H5T__conv__Float16_ulong); +#endif /* From floats to long long */ status |= @@ -1355,6 +1534,10 @@ H5T_init(void) status |= H5T__register_int(H5T_PERS_HARD, "ldbl_llong", native_ldouble, native_llong, H5T__conv_ldouble_llong); #endif /* H5T_CONV_INTERNAL_LDOUBLE_LLONG */ +#ifdef H5_HAVE__FLOAT16 + status |= H5T__register_int(H5T_PERS_HARD, "flt16_llong", native_float16, native_llong, + H5T__conv__Float16_llong); +#endif /* From floats to unsigned long long */ status |= @@ -1365,6 +1548,10 @@ H5T_init(void) status |= H5T__register_int(H5T_PERS_HARD, "ldbl_ullong", native_ldouble, native_ullong, H5T__conv_ldouble_ullong); #endif /* H5T_CONV_INTERNAL_LDOUBLE_ULLONG */ +#ifdef H5_HAVE__FLOAT16 + status |= H5T__register_int(H5T_PERS_HARD, "flt16_ullong", native_float16, native_ullong, + H5T__conv__Float16_ullong); +#endif /* * The special no-op conversion is the fastest, so we list it last. The @@ -1546,6 +1733,8 @@ H5T_top_term_package(void) /* Reset all the datatype IDs */ if (H5T_IEEE_F32BE_g > 0) { + H5T_IEEE_F16BE_g = FAIL; + H5T_IEEE_F16LE_g = FAIL; H5T_IEEE_F32BE_g = FAIL; H5T_IEEE_F32LE_g = FAIL; H5T_IEEE_F64BE_g = FAIL; @@ -1598,6 +1787,7 @@ H5T_top_term_package(void) H5T_NATIVE_ULONG_g = FAIL; H5T_NATIVE_LLONG_g = FAIL; H5T_NATIVE_ULLONG_g = FAIL; + H5T_NATIVE_FLOAT16_g = FAIL; H5T_NATIVE_FLOAT_g = FAIL; H5T_NATIVE_DOUBLE_g = FAIL; H5T_NATIVE_LDOUBLE_g = FAIL; diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 72debe8..33852a9 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -113,6 +113,14 @@ * at least as wide as the destination. Overflow can occur * when the source magnitude is too large for the destination. * + * fX: Floating-point values to integers where the destination is at least + * as wide as the source. This case cannot generate overflows. + * + * Xf: Integers to floating-point values where the source is at least as + * wide as the destination. Overflows can occur when the destination is + * narrower than the source. + * + * * The macros take a subset of these arguments in the order listed here: * * CDATA: A pointer to the H5T_cdata_t structure that was passed to the @@ -690,6 +698,72 @@ H5T_CONV(H5T_CONV_Fx, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, Y) \ } while (0) +#define H5T_CONV_fX(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ + do { \ + HDcompile_assert(sizeof(ST) <= sizeof(DT)); \ + H5T_CONV(H5T_CONV_xX, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \ + } while (0) + +#define H5T_CONV_Xf_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \ + { \ + if (*(S) > (ST)(D_MAX) || (sprec < dprec && *(S) == (ST)(D_MAX))) { \ + H5T_conv_ret_t except_ret = \ + (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, src_id, dst_id, S, D, cb_struct.user_data); \ + if (except_ret == H5T_CONV_UNHANDLED) \ + /* Let compiler convert if case is ignored by user handler*/ \ + *(D) = H5_GLUE3(H5T_NATIVE_, DTYPE, _POS_INF_g); \ + else if (except_ret == H5T_CONV_ABORT) \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \ + /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ + } \ + else if (*(S) < (ST)(D_MIN)) { \ + H5T_conv_ret_t except_ret = \ + (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_LOW, src_id, dst_id, S, D, cb_struct.user_data); \ + if (except_ret == H5T_CONV_UNHANDLED) \ + /* Let compiler convert if case is ignored by user handler*/ \ + *(D) = H5_GLUE3(H5T_NATIVE_, DTYPE, _NEG_INF_g); \ + else if (except_ret == H5T_CONV_ABORT) \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \ + /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ + } \ + else if (sprec > dprec) { \ + unsigned low_bit_pos, high_bit_pos; \ + \ + /* Detect high & low bits set in source */ \ + H5T_HI_LO_BIT_SET(ST, *(S), low_bit_pos, high_bit_pos) \ + \ + /* Check for more bits of precision in src than available in dst */ \ + if ((high_bit_pos - low_bit_pos) >= dprec) { \ + H5T_conv_ret_t except_ret = \ + (cb_struct.func)(H5T_CONV_EXCEPT_PRECISION, src_id, dst_id, S, D, cb_struct.user_data); \ + if (except_ret == H5T_CONV_UNHANDLED) \ + /* Let compiler convert if case is ignored by user handler*/ \ + *(D) = (DT)(*(S)); \ + else if (except_ret == H5T_CONV_ABORT) \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \ + /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ + } \ + else \ + *(D) = (DT)(*(S)); \ + } \ + else \ + *(D) = (DT)(*(S)); \ + } +#define H5T_CONV_Xf_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \ + { \ + if (*(S) > (ST)(D_MAX)) \ + *(D) = H5_GLUE3(H5T_NATIVE_, DTYPE, _POS_INF_g); \ + else if (*(S) < (ST)(D_MIN)) \ + *(D) = H5_GLUE3(H5T_NATIVE_, DTYPE, _NEG_INF_g); \ + else \ + *(D) = (DT)(*(S)); \ + } + +#define H5T_CONV_Xf(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ + do { \ + H5T_CONV(H5T_CONV_Xf, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, Y) \ + } while (0) + /* Since all "no exception" cores do the same thing (assign the value in the * source location to the destination location, using casting), use one "core" * to do them all. @@ -7874,6 +7948,227 @@ H5T__conv_ldouble_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t } #endif /*H5T_CONV_INTERNAL_LDOUBLE_ULLONG*/ +/* Conversions for _Float16 type */ +#ifdef H5_HAVE__FLOAT16 +herr_t +H5T__conv_schar__Float16(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) +{ + H5T_CONV_xF(SCHAR, FLOAT16, signed char, H5__Float16, -, -); +} + +herr_t +H5T__conv_uchar__Float16(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) +{ + H5T_CONV_xF(UCHAR, FLOAT16, unsigned char, H5__Float16, -, -); +} + +herr_t +H5T__conv_short__Float16(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) +{ + H5T_CONV_xF(SHORT, FLOAT16, short, H5__Float16, -, -); +} + +herr_t +H5T__conv_ushort__Float16(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) +{ + /* Suppress warning about non-standard floating-point literal suffix */ + H5_GCC_CLANG_DIAG_OFF("pedantic") + H5T_CONV_Xf(USHORT, FLOAT16, unsigned short, H5__Float16, -FLT16_MAX, FLT16_MAX); + H5_GCC_CLANG_DIAG_ON("pedantic") +} + +herr_t +H5T__conv_int__Float16(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) +{ + /* Suppress warning about non-standard floating-point literal suffix */ + H5_GCC_CLANG_DIAG_OFF("pedantic") + H5T_CONV_Xf(INT, FLOAT16, int, H5__Float16, -FLT16_MAX, FLT16_MAX); + H5_GCC_CLANG_DIAG_ON("pedantic") +} + +herr_t +H5T__conv_uint__Float16(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) +{ + /* Suppress warning about non-standard floating-point literal suffix */ + H5_GCC_CLANG_DIAG_OFF("pedantic") + H5T_CONV_Xf(UINT, FLOAT16, unsigned int, H5__Float16, -FLT16_MAX, FLT16_MAX); + H5_GCC_CLANG_DIAG_ON("pedantic") +} + +herr_t +H5T__conv_long__Float16(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) +{ + /* Suppress warning about non-standard floating-point literal suffix */ + H5_GCC_CLANG_DIAG_OFF("pedantic") + H5T_CONV_Xf(LONG, FLOAT16, long, H5__Float16, -FLT16_MAX, FLT16_MAX); + H5_GCC_CLANG_DIAG_ON("pedantic") +} + +herr_t +H5T__conv_ulong__Float16(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) +{ + /* Suppress warning about non-standard floating-point literal suffix */ + H5_GCC_CLANG_DIAG_OFF("pedantic") + H5T_CONV_Xf(ULONG, FLOAT16, unsigned long, H5__Float16, -FLT16_MAX, FLT16_MAX); + H5_GCC_CLANG_DIAG_ON("pedantic") +} + +herr_t +H5T__conv_llong__Float16(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) +{ + /* Suppress warning about non-standard floating-point literal suffix */ + H5_GCC_CLANG_DIAG_OFF("pedantic") + H5T_CONV_Xf(LLONG, FLOAT16, long long, H5__Float16, -FLT16_MAX, FLT16_MAX); + H5_GCC_CLANG_DIAG_ON("pedantic") +} + +herr_t +H5T__conv_ullong__Float16(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) +{ + /* Suppress warning about non-standard floating-point literal suffix */ + H5_GCC_CLANG_DIAG_OFF("pedantic") + H5T_CONV_Xf(ULLONG, FLOAT16, unsigned long long, H5__Float16, -FLT16_MAX, FLT16_MAX); + H5_GCC_CLANG_DIAG_ON("pedantic") +} + +herr_t +H5T__conv_float__Float16(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) +{ + /* Suppress warning about non-standard floating-point literal suffix */ + H5_GCC_CLANG_DIAG_OFF("pedantic") + H5T_CONV_Ff(FLOAT, FLOAT16, float, H5__Float16, -FLT16_MAX, FLT16_MAX); + H5_GCC_CLANG_DIAG_ON("pedantic") +} + +herr_t +H5T__conv_double__Float16(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) +{ + /* Suppress warning about non-standard floating-point literal suffix */ + H5_GCC_CLANG_DIAG_OFF("pedantic") + H5T_CONV_Ff(DOUBLE, FLOAT16, double, H5__Float16, -FLT16_MAX, FLT16_MAX); + H5_GCC_CLANG_DIAG_ON("pedantic") +} + +herr_t +H5T__conv_ldouble__Float16(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) +{ + /* Suppress warning about non-standard floating-point literal suffix */ + H5_GCC_CLANG_DIAG_OFF("pedantic") + H5T_CONV_Ff(LDOUBLE, FLOAT16, long double, H5__Float16, -FLT16_MAX, FLT16_MAX); + H5_GCC_CLANG_DIAG_ON("pedantic") +} + +herr_t +H5T__conv__Float16_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) +{ + H5_GCC_CLANG_DIAG_OFF("float-equal") + H5T_CONV_Fx(FLOAT16, SCHAR, H5__Float16, signed char, SCHAR_MIN, SCHAR_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") +} + +herr_t +H5T__conv__Float16_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) +{ + H5_GCC_CLANG_DIAG_OFF("float-equal") + H5T_CONV_Fx(FLOAT16, UCHAR, H5__Float16, unsigned char, 0, UCHAR_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") +} + +herr_t +H5T__conv__Float16_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) +{ + H5_GCC_CLANG_DIAG_OFF("float-equal") + H5T_CONV_Fx(FLOAT16, SHORT, H5__Float16, short, SHRT_MIN, SHRT_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") +} + +herr_t +H5T__conv__Float16_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) +{ + H5T_CONV_fX(FLOAT16, USHORT, H5__Float16, unsigned short, 0, USHRT_MAX); +} + +herr_t +H5T__conv__Float16_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) +{ + H5T_CONV_fX(FLOAT16, INT, H5__Float16, int, INT_MIN, INT_MAX); +} + +herr_t +H5T__conv__Float16_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) +{ + H5T_CONV_fX(FLOAT16, UINT, H5__Float16, unsigned int, 0, UINT_MAX); +} + +herr_t +H5T__conv__Float16_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) +{ + H5T_CONV_fX(FLOAT16, LONG, H5__Float16, long, LONG_MIN, LONG_MAX); +} + +herr_t +H5T__conv__Float16_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) +{ + H5T_CONV_fX(FLOAT16, ULONG, H5__Float16, unsigned long, 0, ULONG_MAX); +} + +herr_t +H5T__conv__Float16_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) +{ + H5T_CONV_fX(FLOAT16, LLONG, H5__Float16, long long, LLONG_MIN, LLONG_MAX); +} + +herr_t +H5T__conv__Float16_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) +{ + H5T_CONV_fX(FLOAT16, ULLONG, H5__Float16, unsigned long long, 0, ULLONG_MAX); +} + +herr_t +H5T__conv__Float16_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) +{ + H5T_CONV_fF(FLOAT16, FLOAT, H5__Float16, float, -, -); +} + +herr_t +H5T__conv__Float16_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) +{ + H5T_CONV_fF(FLOAT16, DOUBLE, H5__Float16, double, -, -); +} + +herr_t +H5T__conv__Float16_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) +{ + H5T_CONV_fF(FLOAT16, LDOUBLE, H5__Float16, long double, -, -); +} +#endif + /*------------------------------------------------------------------------- * Function: H5T__conv_f_i * @@ -7910,8 +8205,9 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz uint8_t *int_buf = NULL; /*buffer for temporary value */ size_t buf_size; /*buffer size for temporary value */ size_t i; /*miscellaneous counters */ - size_t first; /*first bit(MSB) in an integer */ - ssize_t sfirst; /*a signed version of `first' */ + ssize_t msb_pos_s; /*first bit(MSB) in an integer */ + ssize_t new_msb_pos; /*MSB position after shifting mantissa by exponent */ + hssize_t shift_val; /*shift value when shifting mantissa by exponent */ H5T_conv_cb_t cb_struct = {NULL, NULL}; /*conversion callback structure */ bool truncated; /*if fraction value is dropped */ bool reverse; /*if reverse order of destination at the end */ @@ -7976,8 +8272,11 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz /* Allocate enough space for the buffer holding temporary * converted value */ - buf_size = (size_t)(pow(2.0, (double)src.u.f.esize) / 8 + 1); - int_buf = (uint8_t *)H5MM_calloc(buf_size); + if (dst.prec / 8 > src_p->shared->size) + buf_size = (dst.prec + 7) / 8; + else + buf_size = src_p->shared->size; + int_buf = (uint8_t *)H5MM_calloc(buf_size); /* Get conversion exception callback property */ if (H5CX_get_dt_conv_cb(&cb_struct) < 0) @@ -8234,35 +8533,46 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz H5T__bit_inc(int_buf, src.u.f.msize, 8 * buf_size - src.u.f.msize); /* + * What is the bit position for the most significant bit(MSB) of S + * which is set? This is checked before shifting and before possibly + * converting to a negative integer. Note that later use of this value + * assumes that H5T__bit_shift will always shift in 0 during a right + * shift. + */ + msb_pos_s = H5T__bit_find(int_buf, (size_t)0, src.prec, H5T_BIT_MSB, true); + + /* + * The temporary buffer has no bits set and must therefore be + * zero; nothing to do. + */ + if (msb_pos_s < 0) + goto padding; + + /* * Shift mantissa part by exponent minus mantissa size(right shift), * or by mantissa size minus exponent(left shift). Example: Sequence * 10...010111, expo=20, expo-msize=-3. Right-shift the sequence, we get * 00010...10. The last three bits were dropped. */ - H5T__bit_shift(int_buf, expo - (ssize_t)src.u.f.msize, (size_t)0, buf_size * 8); + shift_val = expo - (ssize_t)src.u.f.msize; + H5T__bit_shift(int_buf, shift_val, (size_t)0, buf_size * 8); + + /* Calculate the new position of the MSB after shifting and + * skip to the padding section if we shifted exactly to 0 + * (MSB position is -1) + */ + new_msb_pos = msb_pos_s + shift_val; + if (new_msb_pos == -1) + goto padding; /* - * If expo is less than mantissa size, the frantional value is dropped off + * If expo is less than mantissa size, the fractional value is dropped off * during conversion. Set exception type to be "truncate" */ if ((size_t)expo < src.u.f.msize && cb_struct.func) truncated = true; - /* - * What is the bit position for the most significant bit(MSB) of S - * which is set? This is checked before converted to negative - * integer. - */ - sfirst = H5T__bit_find(int_buf, (size_t)0, 8 * buf_size, H5T_BIT_MSB, true); - first = (size_t)sfirst; - - if (sfirst < 0) { - /* - * The source has no bits set and must therefore be zero. - * Set the destination to zero - nothing to do. - */ - } - else if (H5T_SGN_NONE == dst.u.i.sign) { /*destination is unsigned*/ + if (H5T_SGN_NONE == dst.u.i.sign) { /*destination is unsigned*/ /* * Destination is unsigned. Library's default way: If the source value * is greater than the maximal destination value then it overflows, the @@ -8289,7 +8599,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } } else { /*source is positive*/ - if (first >= dst.prec) { + if (new_msb_pos >= (ssize_t)dst.prec) { /*overflow*/ if (cb_struct.func) { /*If user's exception handler is present, use it*/ /*reverse order first*/ @@ -8310,7 +8620,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); } - else if (first < dst.prec) { + else { if (truncated && cb_struct.func) { /*If user's exception handler is present, use it*/ /*reverse order first*/ @@ -8320,9 +8630,11 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz src_rev, d, cb_struct.user_data); } - if (except_ret == H5T_CONV_UNHANDLED) + if (except_ret == H5T_CONV_UNHANDLED) { /*copy source value into it if case is ignored by user handler*/ - H5T__bit_copy(d, dst.offset, int_buf, (size_t)0, first + 1); + if (new_msb_pos >= 0) + H5T__bit_copy(d, dst.offset, int_buf, (size_t)0, (size_t)new_msb_pos + 1); + } else if (except_ret == H5T_CONV_HANDLED) { /*No need to reverse the order of destination because user handles it*/ reverse = false; @@ -8336,7 +8648,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else if (H5T_SGN_2 == dst.u.i.sign) { /*Destination is signed*/ if (sign) { /*source is negative*/ - if (first < dst.prec - 1) { + if ((new_msb_pos >= 0) && ((size_t)new_msb_pos < dst.prec - 1)) { if (truncated && cb_struct.func) { /*If user's exception handler is present, use it*/ /*reverse order first*/ @@ -8348,8 +8660,8 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz if (except_ret == H5T_CONV_UNHANDLED) { /*If this case ignored by user handler*/ /*Convert to integer representation. Equivalent to ~(value - 1).*/ - H5T__bit_dec(int_buf, (size_t)0, 8 * buf_size); - H5T__bit_neg(int_buf, (size_t)0, 8 * buf_size); + H5T__bit_dec(int_buf, (size_t)0, dst.prec); + H5T__bit_neg(int_buf, (size_t)0, dst.prec); /*copy source value into destination*/ H5T__bit_copy(d, dst.offset, int_buf, (size_t)0, dst.prec - 1); @@ -8389,7 +8701,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } } else { /*source is positive*/ - if (first >= dst.prec - 1) { + if (new_msb_pos >= (ssize_t)dst.prec - 1) { /*overflow*/ if (cb_struct.func) { /*If user's exception handler is present, use it*/ /*reverse order first*/ @@ -8410,7 +8722,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz goto next; } } - else if (first < dst.prec - 1) { + else if (new_msb_pos < (ssize_t)dst.prec - 1) { if (truncated && cb_struct.func) { /*If user's exception handler is present, use it*/ /*reverse order first*/ @@ -8422,7 +8734,8 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz if (except_ret == H5T_CONV_UNHANDLED) { /*copy source value into it if case is ignored by user handler*/ - H5T__bit_copy(d, dst.offset, int_buf, (size_t)0, first + 1); + if (new_msb_pos >= 0) + H5T__bit_copy(d, dst.offset, int_buf, (size_t)0, (size_t)new_msb_pos + 1); } else if (except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, @@ -8601,7 +8914,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz /* Allocate enough space for the buffer holding temporary * converted value */ - buf_size = (src.prec > dst.u.f.msize ? src.prec : dst.u.f.msize) / 8 + 1; + buf_size = ((src.prec > dst.u.f.msize ? src.prec : dst.u.f.msize) + 7) / 8; int_buf = (uint8_t *)H5MM_calloc(buf_size); /* Get conversion exception callback property */ diff --git a/src/H5Tinit_float.c b/src/H5Tinit_float.c index 3213f00..7ddd65b 100644 --- a/src/H5Tinit_float.c +++ b/src/H5Tinit_float.c @@ -53,8 +53,8 @@ * Purpose: This macro takes a floating point type like `double' and * and detects byte order, mantissa location, exponent location, * sign bit location, presence or absence of implicit mantissa - * bit, and exponent bias and initializes a detected_t structure - * with those properties. + * bit, and exponent bias and initializes a H5T_fpoint_det_t + * structure with those properties. * * Note that these operations can raise floating-point * exceptions and building with some compiler options @@ -306,14 +306,17 @@ H5T__fix_order(int n, int last, int *perm, H5T_order_t *order) if (last <= 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "failed to detect byte order"); - /* We have at least three points to consider */ - if (perm[last] < perm[last - 1] && perm[last - 1] < perm[last - 2]) { + if (perm[last] < perm[last - 1] && + /* Only check perm[last - 2] if we have more than 2 points to consider */ + ((last < 2) || (perm[last - 1] < perm[last - 2]))) { /* Little endian */ *order = H5T_ORDER_LE; for (int i = 0; i < n; i++) perm[i] = i; } - else if (perm[last] > perm[last - 1] && perm[last - 1] > perm[last - 2]) { + else if (perm[last] > perm[last - 1] && + /* Only check perm[last - 2] if we have more than 2 points to consider */ + ((last < 2) || (perm[last - 1] > perm[last - 2]))) { /* Big endian */ *order = H5T_ORDER_BE; for (int i = 0; i < n; i++) @@ -358,7 +361,7 @@ done: * Return: imp_bit will be set to 1 if the most significant bit * of the mantissa is discarded (ie, the mantissa has an * implicit `one' as the most significant bit). Otherwise, - * imp_bit will be set to zero zero. + * imp_bit will be set to zero. * * SUCCEED/FAIL *------------------------------------------------------------------------- @@ -570,6 +573,39 @@ H5T__init_native_float_types(void) */ H5T_native_order_g = det.order; +#ifdef H5_HAVE__FLOAT16 + /* H5T_NATIVE_FLOAT16 */ + + /* Get the type's characteristics */ + memset(&det, 0, sizeof(H5T_fpoint_det_t)); + DETECT_F(H5__Float16, det); + + /* Allocate and fill type structure */ + if (NULL == (dt = H5T__alloc())) + HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed"); + dt->shared->state = H5T_STATE_IMMUTABLE; + dt->shared->type = H5T_FLOAT; + dt->shared->size = det.size; + dt->shared->u.atomic.order = det.order; + dt->shared->u.atomic.offset = det.offset; + dt->shared->u.atomic.prec = det.prec; + dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; + dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; + dt->shared->u.atomic.u.f.sign = det.sign; + dt->shared->u.atomic.u.f.epos = det.epos; + dt->shared->u.atomic.u.f.esize = det.esize; + dt->shared->u.atomic.u.f.ebias = det.ebias; + dt->shared->u.atomic.u.f.mpos = det.mpos; + dt->shared->u.atomic.u.f.msize = det.msize; + dt->shared->u.atomic.u.f.norm = det.norm; + dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO; + + /* Register the type and set global variables */ + if ((H5T_NATIVE_FLOAT16_g = H5I_register(H5I_DATATYPE, dt, false)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype"); + H5T_NATIVE_FLOAT16_ALIGN_g = det.comp_align; +#endif + done: /* Clear any FE_INVALID exceptions from NaN handling */ if (feclearexcept(FE_INVALID) != 0) diff --git a/src/H5Tmodule.h b/src/H5Tmodule.h index f1b7b17..3654025 100644 --- a/src/H5Tmodule.h +++ b/src/H5Tmodule.h @@ -712,6 +712,14 @@ * * * + * #H5T_NATIVE_FLOAT16 + * + * + * _Float16 + * + * + * + * * #H5T_NATIVE_FLOAT * * @@ -3753,10 +3761,11 @@ filled according to the value of this property. The padding can be: * H5T_NATIVE_INT | H5T_NATIVE_UINT | * H5T_NATIVE_LONG | H5T_NATIVE_ULONG | * H5T_NATIVE_LLONG | H5T_NATIVE_ULLONG - * ::= H5T_IEEE_F32BE | H5T_IEEE_F32LE | + * ::= H5T_IEEE_F16BE | H5T_IEEE_F16LE | + * H5T_IEEE_F32BE | H5T_IEEE_F32LE | * H5T_IEEE_F64BE | H5T_IEEE_F64LE | - * H5T_NATIVE_FLOAT | H5T_NATIVE_DOUBLE | - * H5T_NATIVE_LDOUBLE + * H5T_NATIVE_FLOAT16 | H5T_NATIVE_FLOAT | + * H5T_NATIVE_DOUBLE | H5T_NATIVE_LDOUBLE *