RFC: Ambiguous output from h5ls on nested compound datatypes with -dlS option

Hi all,

We'd like to change some output from h5ls as part of bug fix and would like
to share the output change as you may care to know ahead.

With the current output from h5ls, it's hard to distinguish which member
label&value belongs to which compound type from the output of h5ls when -dlS
options are used.

The example dataset and the current and expected outputs are shown below.

Example dataset:

$ h5dump compound.h5

GROUP "/" {

   DATASET "comp2" {

      DATATYPE H5T_COMPOUND {

         H5T_STD_I32LE "a_int";

         H5T_IEEE_F32LE "a_float";

         H5T_COMPOUND {

            H5T_STD_I32LE "b_int";

            H5T_IEEE_F32LE "b_float";

         } "comp1";

         H5T_STD_I32LE "c_int";

      }

      DATASPACE SIMPLE { ( 2 ) / ( 2 ) }

      DATA {

      (0): {

            20,

            20.2,

            {

               10,

               10.1

            },

            30

         },

      (1): {

            21,

            21.21,

            {

               11,

               11.11

            },

            31

         }

      }

   }

}

···

------------------------------------------------------

[Example output 1 : with -S and -l option]

Current output :

   $ h5ls -dlS compound.h5

   comp2 Dataset {2}

       Data:

           a_int=20 a_float=20.2 comp1=b_int=10 b_float=10.1 c_int=30

           a_int=21 a_float=21.21 comp1=b_int=11 b_float=11.11 c_int=31

In this output, there is no way to tell where the 'b_float' and 'c_int'
belongs.

Expected output after fix:

$ h5ls -dlS compound.h5

comp2 Dataset {2}

   Data:

     {a_int=20 a_float=20.2 comp1={b_int=10 b_float=10.1} c_int=30}

     {a_int=21 a_float=21.21 comp1={b_int=11 b_float=11.11} c_int=31}

In this output, it's clear that where the 'b_float' and 'c_int' belongs.

-------------------------------------------------------------

[Example output 2 : with -S and without -l option]

Current outputs:

   $ h5ls -d compound.h5

   comp2 Dataset {2}

       Data:

           (0) {20, 20.2, {10, 10.1}, 30}, {21, 21.21, {11, 11.11}, 31}

   $ h5ls -dS compound.h5

   comp2 Dataset {2}

       Data:

           20 20.2 10 10.1 30

           21 21.21 11 11.11 31

The output will stay same as the current output (no curly brackets) if -S
option is used without -l option, so it only displays data values to keep
the original purpose.

Let us know if you have any issue with the expected output fix?

Thank you!

- HDF tool team