diff options
author | Robb Matzke <matzke@llnl.gov> | 1998-08-10 18:15:14 (GMT) |
---|---|---|
committer | Robb Matzke <matzke@llnl.gov> | 1998-08-10 18:15:14 (GMT) |
commit | 9754e9373b731856dbf61fdb9c99501f452ca552 (patch) | |
tree | 0bb99d2caf87b9ec8e4dfd2a52bf03b5c7d06055 /src/H5T.c | |
parent | 1d0b2915c2d492ecf35b83ff65287d5d95bf5f7c (diff) | |
download | hdf5-9754e9373b731856dbf61fdb9c99501f452ca552.zip hdf5-9754e9373b731856dbf61fdb9c99501f452ca552.tar.gz hdf5-9754e9373b731856dbf61fdb9c99501f452ca552.tar.bz2 |
[svn-r584] Changes since 19980806
----------------------
./doc/html/Datatypes.html
./doc/html/H5.format.html
./src/H5.c
./src/H5Odtype.c
./src/H5T.c
./src/H5Tconv.c
./src/H5Tpkg.h
./src/H5Tpublic.h
./test/dtypes.c
Changed the values of the H5T_str_t type in order to make a
distinction between C's null terminated strings and strings
which are not null terminated.
The string character set and padding method are saved to the
hdf5 file instead of using defaults.
Added conversion function from one fixed-length string type
to another.
./test/chunk.c
Fixed to work with new filter API
Diffstat (limited to 'src/H5T.c')
-rw-r--r-- | src/H5T.c | 49 |
1 files changed, 27 insertions, 22 deletions
@@ -534,7 +534,7 @@ H5T_init_interface(void) dt->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->u.atomic.msb_pad = H5T_PAD_ZERO; dt->u.atomic.u.s.cset = H5T_CSET_ASCII; - dt->u.atomic.u.s.pad = H5T_STR_NULL; + dt->u.atomic.u.s.pad = H5T_STR_NULLTERM; if ((H5T_C_S1_g = H5I_register(H5_DATATYPE, dt)) < 0) { HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't initialize H5T layer"); @@ -560,7 +560,7 @@ H5T_init_interface(void) dt->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->u.atomic.msb_pad = H5T_PAD_ZERO; dt->u.atomic.u.s.cset = H5T_CSET_ASCII; - dt->u.atomic.u.s.pad = H5T_STR_SPACE; + dt->u.atomic.u.s.pad = H5T_STR_SPACEPAD; if ((H5T_FORTRAN_S1_g = H5I_register(H5_DATATYPE, dt)) < 0) { HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't initialize H5T layer"); @@ -570,22 +570,23 @@ H5T_init_interface(void) * Register conversion functions beginning with the most general and * ending with the most specific. */ - if (H5Tregister_soft ("i_i", H5T_INTEGER, H5T_INTEGER, - H5T_conv_i_i) < 0) { + if (H5Tregister_soft ("i_i", H5T_INTEGER, H5T_INTEGER, H5T_conv_i_i)<0) { HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to register conversion function"); } - if (H5Tregister_soft ("f_f", H5T_FLOAT, H5T_FLOAT, - H5T_conv_f_f) < 0) { + if (H5Tregister_soft ("f_f", H5T_FLOAT, H5T_FLOAT, H5T_conv_f_f)<0) { HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to register conversion function"); } - if (H5Tregister_soft("ibo", H5T_INTEGER, H5T_INTEGER, - H5T_conv_order) < 0) { + if (H5Tregister_soft("s_s", H5T_STRING, H5T_STRING, H5T_conv_s_s)<0) { HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to register conversion function"); } - if (H5Tregister_soft("fbo", H5T_FLOAT, H5T_FLOAT, H5T_conv_order) < 0) { + if (H5Tregister_soft("ibo", H5T_INTEGER, H5T_INTEGER, H5T_conv_order)<0) { + HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, + "unable to register conversion function"); + } + if (H5Tregister_soft("fbo", H5T_FLOAT, H5T_FLOAT, H5T_conv_order)<0) { HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to register conversion function"); } @@ -1503,8 +1504,7 @@ H5Tget_precision (hid_t type_id) * and then the size is increased to insure that significant * bits do not "hang over" the edge of the data type. * - * Changing the precision of an H5T_STRING automatically changes - * the size as well. The precision must be a multiple of 8. + * The precision property of strings is read-only. * * When decreasing the precision of a floating point type, set * the locations and sizes of the sign, mantissa, and exponent @@ -1564,13 +1564,8 @@ H5Tset_precision (hid_t type_id, size_t prec) break; case H5T_STRING: - if (prec % 8) { - HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "precision for this type must be a multiple of 8"); - } - offset = 0; - size = prec / 8; - break; + HRETURN_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, + "precision for this type is read-only"); case H5T_FLOAT: /* @@ -2424,6 +2419,16 @@ H5Tget_strpad (hid_t type_id) * Fortran left-justifies and space-pads strings. This property * defines the storage mechanism for the string. * + * When converting from a long string to a short string if the + * short string is H5T_STR_NULLPAD or H5T_STR_SPACEPAD then the + * string is simply truncated; otherwise if the short string is + * H5T_STR_NULLTERM it will be truncated and a null terminator + * is appended. + * + * When converting from a short string to a long string, the + * long string is padded on the end by appending nulls or + * spaces. + * * Return: Success: SUCCEED * * Failure: FAIL @@ -4245,17 +4250,17 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2) break; case H5T_STRING: - if (dt1->u.atomic.u.s.cset < dt1->u.atomic.u.s.cset) { + if (dt1->u.atomic.u.s.cset < dt2->u.atomic.u.s.cset) { HGOTO_DONE(-1); } - if (dt1->u.atomic.u.s.cset > dt1->u.atomic.u.s.cset) { + if (dt1->u.atomic.u.s.cset > dt2->u.atomic.u.s.cset) { HGOTO_DONE(1); } - if (dt1->u.atomic.u.s.pad < dt1->u.atomic.u.s.pad) { + if (dt1->u.atomic.u.s.pad < dt2->u.atomic.u.s.pad) { HGOTO_DONE(-1); } - if (dt1->u.atomic.u.s.pad > dt1->u.atomic.u.s.pad) { + if (dt1->u.atomic.u.s.pad > dt2->u.atomic.u.s.pad) { HGOTO_DONE(1); } |